Manual and Documentation

NOTE: This manual describes HammerKit version 3.5. To view documentation for the current release of HammerKit Studio, please go to http://manual.hammerkit.com/
search
Index / D. Object API / Classes / HammerKit_Converter

A. Introduction
B. Installation and Configuration
C. Using HammerKit tools
D. Object API
Classes
Button
FileUtils
HammerKit_BasicFile
HammerKit_Color
HammerKit_ColorPalette
HammerKit_Component
HammerKit_Converter
HammerKit_CssRule
HammerKit_Db
HammerKit_DbQueryResult
HammerKit_Document
HammerKit_Element
HammerKit_File
HammerKit_GenericObject
HammerKit_Image
HammerKit_Keyword
HammerKit_ObjectCache
HammerKit_ObjectList
HammerKit_Session
HammerKit_Shortcut
HammerKit_Site
HammerKit_System
HammerKit_User
HammerKit_UserGroup
HammerKit_VariableHandler
Style
Interfaces
Object Choosers
Global Variables
Modules
Tools
Converters
Using the API
E. HammerScript
F. Access Rights
HammerKit_Converter


NOTE! EXPERIMENTAL. WILL BE IMPLEMENTED IN HammerKit v4

Abstract class

This class describes and contains the functionality of HammerKit data converters. Data converters are simple pieces of PHP code that are extendable like HammerKit modules. Internally all data in HammerKit is handled as PHP native types or HammerKit_Object classes. Very often there is the need in HammerKit applications for representing data in another format then the native format of the data. This is where converters come in and give the possibility to translate the data into another format according to converter parameters.

Like the HammerKit_Element class also this class is abstract and is always extended by a real converter class that is then used in HammerKit applications.




Attributes

string class_name
Description: The class name of the converter

string converter_author
Description: The value of the converter's AUTHOR constant

string converter_copyright
Description: The value of the converter's COPYRIGHT constant

string converter_description
Description: The value returned by the converter's getDescription method

string converter_max_php_version
Description: The value of the converter's MAX_PHP_VERSION constant

string converter_max_system_version
Description: The value of the converter's MAX_SYSTEM_VERSION constant

string converter_min_php_version
Description: The value of the converter's MIN_PHP_VERSION constant

string converter_min_system_version
Description: The value of the converter's MIN_SYSTEM_VERSION constant

string converter_name
Description: The value returned by the converter's getName method

time converter_release_date
Description: The value of the converter's RELEASE_DATE constant

string[] converter_required_php_extensions
Description: The value of the converter's REQUIRED_PHP_EXTENSIONS constant. Note that unlike the constant this attribute is an array of strings.

string[] converter_types
Description: The value of the converter's TYPES constant. Note that unlike the constant this attribute is an array of strings.

string converter_version
Description: The value of the converter's VERSION constant

string[] lang
Description: This array contains the user interface text strings defined in the converter's language files. The values of this array are used in the converter class' method getSettingsUi where the user interface for the converter settings are defined. More about the language files in the section about how to build converters.

string[] parameters
Description: The parameters from the converter settings

string[] parameters_parsed
Description: The parameters from the converter settings with all HammerScript expressions expanded


Methods

optional public string[] compat(string[] parameters, string old_filter_version)
Description: This method handles backwards compatibility between different versions of the filter. If the parameters have been saved with an old version of the filter and the parameters or the values of the parameters have changed since then it is possible to correct the parameters to work with the new version of the filter. This method is optional and is only called if it is defined and the filter's version number is grater than the version number was when the filter parameters were last saved.
Arguments:
Returns: The parameters array with corrected values

abstract public mixed exec(mixed data)
Description: All extending classes must implement this method. This method handles the filtering of the data according to the parameters given by the user.
Returns: The filtered data.

public static final string[string[]] getAttributeList()
Description: Get a list of all class attributes and their properties
Returns: An array where the keys are the attribute names and the values arrays with the properties of the attribute

public final mixed getConstant(string constant_name)
Description: Get the value of a constant of the filter's class
Returns: The value of the constant

public string getDescription(void)
Description: Get the description text of the filter
Returns: By default this method returns the description key of the lang attribute array. So if the filter author specifies a user interface text in the language files with the key description, then the return value will by default be fetched from there. If the description key is not specified an empty string is returned.

public string getName(void)
Description: Get the name of the filter for the filter chooser's filter list
Returns: By default this method returns the name key of the lang attribute array. So if the filter author specifies a user interface text in the language files with the key name, then the name will by default be fetched from there. If the name key is not specified the filter's class name is returned.

public final string getParameterName(void)
Description: Get the name of the settings parameters array in the filter's settings XHTML form.
Returns: A string like "element_parameters"

abstract public string getSettingsUi(void)
Description: Get the user interface for the filter's settings used in the filter chooser.
Returns: A valid XHTML string containing the form elements for setting the filter's parameter values.




� HammerKit Oy 2008 UPDATED: 13.01.2009 15:58