.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ============= Developer API ============= :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed: 2008-09-24T18:34:15 :Email: info@macmade.net :Info 2: :Info 3: :Info 4: .. _Developer-API: Developer API ============= Extension Key: **api\_macmade** Copyright 2000-2002, Jean-David Gadina, This document is published under the Open Content License available from http://www.opencontent.org/opl.shtml The content of this document is related to TYPO3 \- a GNU/GPL CMS/Framework available from www.typo3.com .. _Table-of-Contents: Table of Contents ----------------- **Developer API 1** **Introduction 2** About this API 2 Why another API? 2 How to use this API 2 **PHP 5 classes 2** Introduction 2 tx\_apimacmade\_flexform 2 **JavaScript 4** Introduction 4 **Section 1 - Internal 5** About this section 5 tx\_apimacmade 5 versionError 6 errorMsg 6 getPhp5Class 6 newInstance 6 **Section 2 - FrontEnd 8** About this section 8 fe\_mergeTSconfFlex 8 fe\_initTemplate 9 fe\_renderTemplate 9 fe\_makeStyledContent 10 fe\_setInternalVars 10 fe\_buildSwapClassesJSCode 10 fe\_makeSwapClassesJSLink 11 fe\_createImageObjects 11 fe\_linkTP 11 fe\_linkTP\_keepPIvars 12 fe\_linkTP\_keepPIvars\_url 12 fe\_linkTP\_unsetPIvars 12 fe\_linkTP\_unsetPIvars\_url 13 fe\_typoLinkParams 13 fe\_initFeAdmin 13 fe\_createInput 14 fe\_createTextArea 14 fe\_createSelect 15 fe\_createSelectFromTable 15 fe\_buildFormElementHeader 16 fe\_buildLoginBox 16 fe\_buildSearchBox 17 fe\_buildBrowseBox 17 fe\_includePrototypeJs 18 fe\_includeMootoolsJs 18 fe\_includeScriptaculousJs 18 fe\_includeLightBoxJs 18 fe\_includeUfo 18 fe\_includeSwfObject 19 fe\_includeWebToolKitJs 19 **Section 3 - BackEnd 20** About this section 20 be\_buildRecordIcons 20 be\_buildPageTreeSelect 20 be\_getSelectStyleRecordIcon 20 be\_initCSM 21 be\_getRecordCSMIcon 21 be\_includePrototypeJs 21 be\_includeMootoolsJs 21 be\_includeScriptaculousJs 21 be\_includeLightBoxJs 21 be\_includeUfo 22 be\_includeSwfObject 22 be\_includeWebToolKitJs 22 **Section 4 - Database 23** About this section 23 db\_table2text 23 db\_table2xml 23 **Section 5 - Miscellaneous 25** About this section 25 div\_utf8ToIso 25 div\_getAge 25 div\_writeTagParams 25 div\_checkVarType 25 div\_cleanArray 26 div\_baseURL 26 div\_vCardCreate 26 div\_vCardFileParse 27 div\_str2list 28 div\_array2list 28 div\_output 28 div\_xml2array 29 div\_array2xml 29 div\_crop 30 div\_week2date 30 div\_numberInRange 30 div\_rgb2hsl 31 div\_hsl2rgb 31 div\_rgb2hsv 31 div\_hsv2rgb 32 div\_hsl2hsv 32 div\_hsv2hsl 33 div\_createHexColor 33 div\_modifyHexColor 33 div\_formatXHTML 34 div\_convertLineBreaks 34 div\_checkArrayKeys 34 div\_rmdir 35 div\_isType 36 **Section 6 - Debug 37** About this section 37 viewArray 37 debug 37 **Known problems 38** **To-Do list 38** **Changelog 39** .. _Introduction: Introduction ------------ .. _About-this-API: About this API ^^^^^^^^^^^^^^ The goal of this API is to provide to the Typo3 developers community some useful functions, to help in the process of extension development. It includes functions, for frontend, backend, databases and miscellaneous development. It's not here to replace any of the existing Typo3 core class or function. It just try to complete them by providing a quick way to develop extensions, and to produce code. .. _Why-another-API: Why another API? ^^^^^^^^^^^^^^^^ Typo3 comes with a bunch of wonderful functions. But for new developers, it may be hard to get the whole picture with extensions, classes hierarchy, etc. That was the case for me when I begun working with Typo3, and it's still the case now for a lot of things. However, when I begun to develop extensions, I quickly realized that I often had to use the same functions inside my classes, or adapt previously build functions for a specific need. So I decided, for all of my extensions, to build another one, containing all the generic functions I use very frequently, and to make a dependencies to that big one. So now I can access my own functions from everywhere, without having to include them. It's just a gain of time to me, and it help me to keep my code clean and upgradeable easily. In the logic of OpenSource, I also decided to make this API public, as it may help some people. I really hope it will. .. _How-to-use-this-API: How to use this API ^^^^^^^^^^^^^^^^^^^ The API is divided into six main sections. The first one is for the internal class processing, the second one for frontend development (all the functions are prefixed with fe\_), the third one for backend development (prefix be\_), the fourth for database queries (prefix db\_), the fifth for miscellaneous development (prefix div\_), and the last one for debugging (no prefix). You'll find in this manual a complete reference of the class. Be sure to read carefully the description of the class constructor, just below. It will teach you how to use this API in your own extensions. Without this step, you won't be able to use most of the functions, as the class needs, except for some cases, to be instantiated in a special way, to ensure to usability of the API functions. .. _PHP-5-classes: PHP 5 classes ------------- .. _Introduction: Introduction ^^^^^^^^^^^^ Since version 4.0, this API contains classes that can be used only with PHP5. You can instantiate them «by hand», or use the recommended getPhp5Class method of the API, which will make sure that PHP5 is available. Each class is for a specific purpose, and is described below. .. _tx-apimacmade-flexform: tx\_apimacmade\_flexform ^^^^^^^^^^^^^^^^^^^^^^^^ .. _About: About """"" The goal of this class is to simplify the use of flexform fields. It will allows you to easily access to every field contained in a flexform, without having to use the xml2array method from the t3lib\_div class, which produces an huge multidimensionnal array which is hard to work with. .. _Usage: Usage """"" The only thing you have to do is the creates a new instance of the class, and pass the XML data of the flexform to the constructor. Here's an example: .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: // Gets the flexform helper with some flexform data from a database record $flexHelper = tx_apimacmade::getPhp5Class( 'flexform', array( $row[ 'flexform_field' ] ) ); .. ###### END~OF~TABLE ###### Then you can access any flexform field directly: .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: $myFieldValue = $flexHelper->myFieldName; .. ###### END~OF~TABLE ###### You can also do a loop on the object to get each flexform field .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: foreach( $flexHelper as $fieldName => $fieldValue ) { // ... do something ... } .. ###### END~OF~TABLE ###### If you are working with multiple sheets or languages in your flexform, you can set which sheet or language will be used when getting a field value: .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: $flexHelper->setDefaultSheet( 'sDEF' ); $flexHelper->setDefaultLang( 'lDEF' ); $flexHelper->setDefaultValue( 'vDEF' ); .. ###### END~OF~TABLE ###### Or you can use the getFieldValue() method (note that the three last arguments are optional): .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: $myFieldValue = $flexHelper->getFieldValue( 'myFieldName', 'sDEF', 'lDEF', 'vDEF' ); .. ###### END~OF~TABLE ###### This class also works if you use sections in your flexforms. The only difference is that the return of a section field is an array containing sub-objects, that you will be able to use as the first one. Also note that if you cast a section item object as a string, you will get the item type: .. ### BEGIN~OF~TABLE ### .. _: :: ~~ .. container:: table-row a :: // Process each base field of the flexform foreach( $flexHelper as $fieldName => $fieldValue ) { // Checks if we have a section field if( is_array( $fieldValue ) ) { // Process each section item foreach( $fieldValue as $sectionItem ) { // Gets the item type $itemType = ( string )$sectionItem; // Gets each sub-field of the current item foreach( $sectionItem as $sectionItemFieldName => $sectionItemFieldValue ) { // ... do something ... } } } else { // ... processing for normal fields ... } } .. ###### END~OF~TABLE ###### .. _JavaScript: JavaScript ---------- .. _Introduction: Introduction ^^^^^^^^^^^^ This API provides several JavaScript files that can be included either in the TYPO3 frontend, or in the backend. Available scripts includes: Prototype Mootools Scriptaculous LightBox UFO (Universal Flash Object) SWF Object WebToolKit Base64 WebToolKit CRC32 WebToolKit MD5 WebToolKit SHA1 WebToolKit SHA256 WebToolKit URL Encode WebToolKit UTF-8 Each one has a method to include the script, that you can use in your extensions. Of course, if one script is already included, a second call to the include method won't include it another time.But as many other TYPO3 extensions uses and includes the same scripts, you also have to possibility to avoid loading a particular script from this API.For instance, imagine that you have on the same page two extensions that use the Prototype JS script. The first one includes Prototype from this API, and the second one uses a local version. Then, the Prototype script will be loaded twice.In such a case, you can deactivate the inclusion of Prototype for that page, as it's already included by the other extension. This is done through the constant editor. Each script can be deactivated separately: |img-1| .. _Section-1-Internal: Section 1 - Internal -------------------- .. _About-this-section: About this section ^^^^^^^^^^^^^^^^^^ .. _Functions-for-the-initialization-of-the-class: Functions for the initialization of the class. """""""""""""""""""""""""""""""""""""""""""""" Those functions are the core of this API. Except the class constructor, they are all reserved for internal use. .. _tx-apimacmade: tx\_apimacmade ^^^^^^^^^^^^^^ .. _Class-constructor: Class constructor. """""""""""""""""" This function can't be called by t3lib\_div::makeInstance, since it needs the parent object to be passed as an argument. Sorry about that. When you call the constructor, do not forget to set the $apimacmade\_version class variable, as it will be used for version checking. Read the example below to find out more. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: &$pObj Default value Description The parent object .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ Void. .. _Example: Example ~~~~~~~ Heres how to use this API in your own extensions. First, you'll need to include the API class in your extension (line 5). This is done like this (all of following example are in a frontend plugin context, but the procedure is the same for every development context): .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: b :: // Typo3 FE plugin class require_once(PATH_tslib.'class.tslib_pibase.php'); // API class require_once(t3lib_extMgm::extPath('api_macmade').'class.tx_apimacmade.php'); class tx_myextension_pi1 extends tslib_pibase { .. ###### END~OF~TABLE ###### Then you need to define a class variable (line 13): .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: b :: class tx_myextension_pi1 extends tslib_pibase { // Same as class name var $prefixId = 'tx_myextension_pi1'; // Path to this script relative to the extension dir var $scriptRelPath = 'pi1/class.tx_myextension_pi1.php'; // The extension key var $extKey = 'myextension'; // API version var $apimacmade_version = 1.0; .. ###### END~OF~TABLE ###### It's used to check the version of the API. Let's say you have made an extension which uses the version 1.1 of this API, and that you have set the version variable consequently. If a user try to use your extension with an older version of the API, he may get some problems, as some functions may not be present. So with this variable, the user will just get a page saying he should upgrade to the required version (1.1 in that case). It's a way to protect your work from errors dues to an old version. The last step is to instantiate the API class. You can't do that by calling t3lib\_div::makeInstance, as the class constructor needs an argument to be passed. So here's how we do this (line 4): .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: b :: function main($content,$conf) { // New instance of the API $this->api = new tx_apimacmade($this); .. ###### END~OF~TABLE ###### Most often, it's a good idea to set the API object as a class variable, like in this example, to allow you to use API function from any of your functions. The parameter of the constructor must be always be $this. It will allow the API to reach your own variables by itself, and to use all of the Typo3 core functions available in your context. Then, you're done. You can use the function you need, just like that, for example: .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: b :: $this->api->debug('Hello World!'); .. ###### END~OF~TABLE ###### In this manual, we are going to use $this->api for the API object, in the examples. You're of course free to name that object as you want. .. _versionError: versionError ^^^^^^^^^^^^ .. _Produce-a-version-error-message: Produce a version error message. """""""""""""""""""""""""""""""" This function produce the error message if the version of the API is too old. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $version Default value :: false Description The required version of the API .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ An HTML page with the error message. .. _errorMsg: errorMsg ^^^^^^^^ .. _Produce-an-error-message: Produce an error message. """"""""""""""""""""""""" This function is used to produce an error message, if another function report a problem, often caused by bad argument types. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $method Default value Description The name of the method .. _: :: '' .. container:: table-row Parameter :: $message Default value Description The error message to display .. _: :: '' .. container:: table-row Parameter :: $line Default value Description The line number .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ Void. .. _getPhp5Class: getPhp5Class ^^^^^^^^^^^^ .. _Gets-a-PHP-5-class: Gets a PHP 5 class. """"""""""""""""""" This function is used to load an PHP5 class contained in this API. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $name Default value Description The name of the component to load .. _: :: '' .. container:: table-row Parameter :: $args Default value :: array() Description An array with the arguments to pass to the constructor (5 maximum) .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ An instance of the requested class. .. _newInstance: newInstance ^^^^^^^^^^^ .. _Returns-a-new-instance-of-a-class: Returns a new instance of a class. """""""""""""""""""""""""""""""""" This method does basically the same stuff as the makeInstance method from t3lib\_div, except the fact that this one can take arguments that will be passed to the class constructor. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $className Default value Description The name of the class .. _: :: '' .. container:: table-row Parameter :: $args Default value :: array() Description An array with the arguments to pass to the constructor (5 maximum) .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ An instance of the requested class. .. _Section-2-FrontEnd: Section 2 - FrontEnd -------------------- .. _About-this-section: About this section ^^^^^^^^^^^^^^^^^^ .. _Functions-for-frontend-development: Functions for frontend development. """"""""""""""""""""""""""""""""""" All of those functions are only available in a frontend context. They also all need the API class to be instantiated, as they will use the internal variable $pObj. Do not try to use them out of a frontend context, and without the API class instantiated. .. _fe-mergeTSconfFlex: fe\_mergeTSconfFlex ^^^^^^^^^^^^^^^^^^^ .. _Merge-plugin-TS-configuration-with-flexform-configuration: Merge plugin TS configuration with flexform configuration. """""""""""""""""""""""""""""""""""""""""""""""""""""""""" This function merge the plugin TS configuration array with the flexform configuration (priority is given to flexform). Everything is done automatically with a mapping array containing the path of the TS elements to replace, and the path of the flexform fields in the XML. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $mapArray Default value Description The mapping array with informations about values to replace .. _: :: '' .. container:: table-row Parameter :: $tsArray Default value Description The initial TS configuration array .. _: :: '' .. container:: table-row Parameter :: $flexRes Default value Description The flexform object (usually $this->pObj->cObj->data['pi\_flexform']) .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The merged configuration array. .. _Examples: Examples ~~~~~~~~ When you use flexforms for the configuration of a plugin, the values you set are most often defined by default in the ext\_typoscript\_setup.txt files, as default values. Those TypoScript values are passed to your plugin class as an array ($conf). So with flexforms, you need to check for an existing value in the XML, and to replace the value in the $conf array if necessary. This function will handle that process automatically. It will check for flexform values, and replace the corresponding values in the $conf array. All you have to do is to provide a mapping array, with informations about where the values are located. Look at the example below: .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: b :: // Mapping array for PI flexform $flex2conf = array( 'pidList' => 'sDEF:pages', 'recursive' => 'sDEF:recursive', 'allowHTML' => 'sDEF:allow_html', 'templateFile' => 'sTEMPLATE:template_file', 'dateFormat' => 'sDEF:date_format', 'list.' => array( 'defaultMode' => 'sLIST:default_mode', 'maxRecords' => 'sLIST:max_records', 'maxPages' => 'sLIST:max_pages', 'displayFields' => 'sLIST:display_fields', 'pictures.' => array( 'file.' => array( 'maxW' => 'sLIST:image_maxw', 'maxH' => 'sLIST:image_maxh', ), 'params' => 'sLIST:image_params', ), ); .. ###### END~OF~TABLE ###### The keys of the array are the TypoScript objects names in the $conf array. You can add as many levels as you want, just by adding sub- arrays. The values of the array must be path to the corresponding value in the flexform. For example: :: sDEF:pages It will tell the function to look for the pages field of the sDEF sheet. When you have your mapping array, you need to get the flexform values, and to launch the function. This is done like this: .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: 8: b :: // Init flexform configuration of the plugin $this->pi_initPIflexForm(); // Get flexform informations $piFlexForm = $this->cObj->data['pi_flexform']; // Ovverride TS setup with flexform $conf = $this->api->fe_mergeTSconfFlex($flex2conf,$conf,$piFlexForm); .. ###### END~OF~TABLE ###### Then every TypoScript object of your $conf array will be replaced by the corresponding flexform value, if there is one. Otherwise, the TypoScript value will remain untouched. .. _fe-initTemplate: fe\_initTemplate ^^^^^^^^^^^^^^^^ .. _Loads-a-template-file: Loads a template file. """""""""""""""""""""" This function reads a template file and store it as a C-Object in the API class. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $templateFile Default value Description The template file to load .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ Void. .. _Examples: Examples ~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: b :: // Store template file in the API class for further processing $this->api->fe_initTemplate('EXT:myextension/pi1/template.html'); .. ###### END~OF~TABLE ###### .. _fe-renderTemplate: fe\_renderTemplate ^^^^^^^^^^^^^^^^^^ .. _Template-rendering: Template rendering. """"""""""""""""""" This function analyzes the template C-Object, previously set by $this->fe\_initTemplate and substitute the specified section with the specified subsections. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $templateMarkers Default value Description The markers array .. _: :: '' .. container:: table-row Parameter :: $templateSection Default value Description The section to substitute .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The processed template section. .. _Examples: Examples ~~~~~~~~ Here's an example HTML template: .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: b :: Template File

###WORLD###

###UNIVERSE###

.. ###### END~OF~TABLE ###### And here's the PHP code to render it: .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row a :: 1: 2: 3: 4: 5: 6: 7: 8: b :: // Template markers $templateMarkers = array( '###WORLD###' => 'Hello World!', '###UNIVERSE###' => 'Hello Universe!', ); // Render template $content = $this->api->fe_renderTemplate($templateMarkers,'###HELLO###'); .. ###### END~OF~TABLE ###### .. _fe-makeStyledContent: fe\_makeStyledContent ^^^^^^^^^^^^^^^^^^^^^ .. _Returns-the-content-with-CSS: Returns the content with CSS. """"""""""""""""""""""""""""" This function is used to output the requested content wrapped in an HTML element, containing a CSS class. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $element Default value Description The HTML element to produce. .. _: :: '' .. container:: table-row Parameter :: $className Default value Description The CSS class name to link. .. _: :: '' .. container:: table-row Parameter :: $content Default value :: false Description The content to wrap. .. _: :: '' .. container:: table-row Parameter :: $piClass Default value :: 1 Description Prepends class name with plugin name (using pi\_classParam). .. _: :: '' .. container:: table-row Parameter :: $htmlSpecialChars Default value :: false Description Pass the content through htmlspecialchars(). .. _: :: '' .. container:: table-row Parameter :: $startTagOnly Default value :: false Description Generate only the starting tag (without content!). .. _: :: '' .. container:: table-row Parameter :: $params Default value :: array() Description The parameters of the HTML element as key/value pairs. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The CSS styled content. .. _See-also: See also ~~~~~~~~ div\_cleanArray div\_writeTagParams .. _fe-setInternalVars: fe\_setInternalVars ^^^^^^^^^^^^^^^^^^^ .. _Sets-internals-variables: Sets internals variables. """"""""""""""""""""""""" This function is used to set the internal variables array ($this->pObj->internal) needed to execute a MySQL query. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $results_at_a_time Default value :: false Description The maximum number of records to display in a list view. .. _: :: '' .. container:: table-row Parameter :: $maxPages Default value :: false Description The maximum number of pages to display in the browsebox. .. _: :: '' .. container:: table-row Parameter :: $searchFieldList Default value :: false Description The fields available for searching. .. _: :: '' .. container:: table-row Parameter :: $orderByList Default value :: false Description The fields available to use as ORDER BY parameter. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ Void. .. _fe-buildSwapClassesJSCode: fe\_buildSwapClassesJSCode ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Adds-swapClasses-JavaScript-Code: Adds swapClasses JavaScript Code. """"""""""""""""""""""""""""""""" This function adds the javascript code used to switch between CSS classes. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $class1 Default value Description The first class. .. _: :: '' .. container:: table-row Parameter :: $class2 Default value Description The second class. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ Void. .. _fe-makeSwapClassesJSLink: fe\_makeSwapClassesJSLink ^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Returns-a-swapClasses-link: Returns a swapClasses link. """"""""""""""""""""""""""" This function is used to output the requested content wrapped in an HTML link element calling the swapClasses JS function. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $elementId Default value Description The ID of the HTML element to change. .. _: :: '' .. container:: table-row Parameter :: $content Default value :: false Description The content to wrap. .. _: :: '' .. container:: table-row Parameter :: $htmlSpecialChars Default value :: false Description Pass the content through htmlspecialchars(). .. _: :: '' .. container:: table-row Parameter :: $startTagOnly Default value :: false Description Generate only the starting tag (without content!). .. _: :: '' .. container:: table-row Parameter :: $params Default value :: array() Description The attributes of the HTML element as key/value pairs. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The swap classes link. .. _See-also: See also ~~~~~~~~ div\_cleanArray div\_writeTagParams .. _fe-createImageObjects: fe\_createImageObjects ^^^^^^^^^^^^^^^^^^^^^^ .. _Create-IMAGE-cObjects: Create IMAGE cObjects. """""""""""""""""""""" This function creates an IMAGE cObject for each given filename. This function is particularly useful with image references stored in a database field. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $imgRefs Default value Description A comma list of picture names. .. _: :: '' .. container:: table-row Parameter :: $conf Default value Description The TS setup for the images. .. _: :: '' .. container:: table-row Parameter :: $imgPath Default value :: false Description The path of the images (will be prepended to each picture name). .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ An IMAGE cObject for each picture. .. _fe-linkTP: fe\_linkTP ^^^^^^^^^^ .. _Link-a-string-to-some-page: Link a string to some page. """"""""""""""""""""""""""" This function links a string to a page (the active one by default). It's the same function as tslib\_pibase::pi\_linkTP(), except that a configuration array for the typolink can be passed directly as argument, and that it will always returns a correct cHash. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $str Default value Description The content string to wrap in tags. .. _: :: '' .. container:: table-row Parameter :: $urlParameters Default value :: array() Description Array with URL parameters as key/value pairs. They will be "imploded" and added to the list of parameters defined in the plugins TypoScript property "parent.addParams" plus $this->pi\_moreParams. .. _: :: '' .. container:: table-row Parameter :: $cache Default value :: 0 Description If $cache is set (0/1), the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER\_INT). Otherwise the no\_cache-parameter will be a part of the link. .. _: :: '' .. container:: table-row Parameter :: $altPageId Default value :: 0 Description Alternative page ID for the link (by default this function links to the SAME page!). .. _: :: '' .. container:: table-row Parameter :: $conf Default value :: array() Description An optionnal array for the typolink configuration. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The input string wrapped in tags. .. _fe-linkTP-keepPIvars: fe\_linkTP\_keepPIvars ^^^^^^^^^^^^^^^^^^^^^^ .. _Link-a-string-to-some-page: Link a string to some page. """"""""""""""""""""""""""" This method is the same as method fe\_linkTP\_keepPIvars of tslib\_piBase, except the fact that it will always return a correct cHash. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $str Default value Description The content string to wrap in tags. .. _: :: '' .. container:: table-row Parameter :: $overrulePIvars Default value :: array() Description Array of values to override or add in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $cache Default value :: 0 Description Ask the page to be cached by a &cHash value. .. _: :: '' .. container:: table-row Parameter :: $clearAnyway Default value :: 0 Description Do not preserve current piVars. .. _: :: '' .. container:: table-row Parameter :: $altPageId Default value :: 0 Description Alternative page ID for the link. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The input string wrapped in tags. .. _See-also: See also ~~~~~~~~ fe\_linkTP .. _fe-linkTP-keepPIvars-url: fe\_linkTP\_keepPIvars\_url ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Returns-an-URL-to-some-page: Returns an URL to some page. """""""""""""""""""""""""""" This method is the same as method pi\_fe\_linkTP\_keepPIvars\_url of tslib\_piBase, except the fact that it will always return a correct cHash. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $overrulePIvars Default value :: array() Description Array of values to override or add in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $cache Default value :: 0 Description Ask the page to be cached by a &cHash value. .. _: :: '' .. container:: table-row Parameter :: $clearAnyway Default value :: 0 Description Do not preserve current piVars. .. _: :: '' .. container:: table-row Parameter :: $altPageId Default value :: 0 Description Alternative page ID for the link. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The complete URL. .. _See-also: See also ~~~~~~~~ fe\_linkTP\_keepPIvars .. _fe-linkTP-unsetPIvars: fe\_linkTP\_unsetPIvars ^^^^^^^^^^^^^^^^^^^^^^^ .. _Link-a-string-to-some-page: Link a string to some page. """"""""""""""""""""""""""" This function links a string to a page (the active one by default), while keeping current piVars. Additionnal piVars can be added or overlaid in the overrulePIvars array. All piVars found in the unsetPIvars array won't be preserved. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $str Default value Description The content string to wrap in tags. .. _: :: '' .. container:: table-row Parameter :: $overrulePIvars Default value :: array() Description Array of values to override or add in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $unsetPIvars Default value :: array() Description Array of values not to include in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $cache Default value :: 0 Description Ask the page to be cached by a &cHash value. .. _: :: '' .. container:: table-row Parameter :: $clearAnyway Default value :: 0 Description Do not preserve current piVars. .. _: :: '' .. container:: table-row Parameter :: $altPageId Default value :: 0 Description Alternative page ID for the link. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The input string wrapped in tags. .. _See-also: See also ~~~~~~~~ fe\_linkTP\_keepPIvars .. _fe-linkTP-unsetPIvars-url: fe\_linkTP\_unsetPIvars\_url ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Returns-an-URL-to-some-page: Returns an URL to some page. """""""""""""""""""""""""""" This function returns the URL to a page (the active one by default), while keeping current piVars. Additionnal piVars can be added or overlaid in the overrulePIvars array. All piVars found in the unsetPIvars array won't be preserved. Same as fe\_linkTP\_unsetPIvars, but it returns only the URL. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $overrulePIvars Default value :: array() Description Array of values to override or add in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $unsetPIvars Default value :: array() Description Array of values not to include in the current piVars. .. _: :: '' .. container:: table-row Parameter :: $cache Default value :: 0 Description Ask the page to be cached by a &cHash value. .. _: :: '' .. container:: table-row Parameter :: $clearAnyway Default value :: 0 Description Do not preserve current piVars. .. _: :: '' .. container:: table-row Parameter :: $altPageId Default value :: 0 Description Alternative page ID for the link. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The complete URL. .. _See-also: See also ~~~~~~~~ fe\_linkTP\_keepPIvars\_url .. _fe-typoLinkParams: fe\_typoLinkParams ^^^^^^^^^^^^^^^^^^ .. _Builds-parameters-for-a-typoLink: Builds parameters for a typoLink. """"""""""""""""""""""""""""""""" This method is used to build the 'additionalParams' TypoScript option. Each parameter of the array will be formed as a piVar (prefixed with pObj->prefixId). .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $params Default value :: array() Description An associative array with the URL parameters. .. _: :: '' .. container:: table-row Parameter :: $keepPiVars Default value :: true Description If this is true, the piVars will be kept .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The additional parameters ready for a typoLink. .. _fe-initFeAdmin: fe\_initFeAdmin ^^^^^^^^^^^^^^^ .. _Init-the-FE-Admin-script-for-frontend-input: Init the FE-Admin script for frontend input. """""""""""""""""""""""""""""""""""""""""""" This function adds all the configuration necessary to use fe\_adminLib to the plugin configuration array. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $conf Default value Description The plugin configuration array. .. _: :: '' .. container:: table-row Parameter :: $table Default value Description The table to use. .. _: :: '' .. container:: table-row Parameter :: $pid Default value Description The pid for the records. .. _: :: '' .. container:: table-row Parameter :: $feAdminConf Default value Description The configuration array for fe\_adminLib subparts. .. _: :: '' .. container:: table-row Parameter :: $create Default value :: 1 Description Create capabilities (Boolean). .. _: :: '' .. container:: table-row Parameter :: $edit Default value :: 0 Description Edit capabilities (Boolean). .. _: :: '' .. container:: table-row Parameter :: $delete Default value :: 0 Description Delete capabilities (Boolean). .. _: :: '' .. container:: table-row Parameter :: $infomail Default value :: 0 Description Infomail capabilities (Boolean). .. _: :: '' .. container:: table-row Parameter :: $fe_userOwnSelf Default value :: 0 Description FE-Users own themselves (Boolean). .. _: :: '' .. container:: table-row Parameter :: $fe_userEditSelf Default value :: 0 Description FE-Users can edit themselves (Boolean). .. _: :: '' .. container:: table-row Parameter :: $debug Default value :: 0 Description Output debug informations (Boolean). .. _: :: '' .. container:: table-row Parameter :: $defaultCmd Default value :: 'create' Description The default command to use if none is found. .. _: :: '' .. container:: table-row Parameter :: $confKey Default value :: 'fe_adminLib' Description The key to use for fe\_adminLib in the plugin configuration array. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ The complete plugin configuration array with a valid fe\_adminLib configuration. .. _fe-createInput: fe\_createInput ^^^^^^^^^^^^^^^ .. _Creates-an-input: Creates an input. """"""""""""""""" This function creates an HTML input tag, ready for a usage with fe\_adminLib. .. _Parameters: Parameters ~~~~~~~~~~ .. ### BEGIN~OF~TABLE ### .. _: :: '' .. container:: table-row Parameter :: $type Default value Description The type of the input. .. _: :: '' .. container:: table-row Parameter :: $name Default value Description The name of the input (field). .. _: :: '' .. container:: table-row Parameter :: $feAdminConf Default value Description The fe\_adminLib configuration array. .. _: :: '' .. container:: table-row Parameter :: $feAdminSection Default value Description The fe\_adminLib section (usually create or edit) - Used to check for required fields. .. _: :: '' .. container:: table-row Parameter :: $number Default value :: 1 Description The number of imput to create. .. _: :: '' .. container:: table-row Parameter :: $params Default value :: array() Description The input tag parameters (depending of context) as an array with key/value pairs. .. _: :: '' .. container:: table-row Parameter :: $defaultValue Default value :: 0 Description The default value for the input. Can be an array for multiple inputs, or 'unix' for checkboxes/radios with unix-perms like values (eg. 1 -2 - 4 - 8, etc.), or 'increment' for incrementing values (eg. 0 - 1 -2 - 3, etc.). .. _: :: '' .. container:: table-row Parameter :: $defaultChecked Default value :: 0 Description For checkboxes or radios, if the input must be checked by default. Can be a comma list for multiple checkboxes. .. _: :: '' .. container:: table-row Parameter :: $keepSentValues Default value :: 1 Description Keep element value if the form is redrawn (will override default value or default checked). .. _: :: '' .. container:: table-row Parameter :: $langPrefix Default value :: 'pi_feadmin_' Description The prefix for the plugin locallangfile. Used to fetch the title of the input and the warning message, if applicable. .. _: :: '' .. container:: table-row Parameter :: $headerSeparation Default value :: '
' Description The separation between the title and the input. .. ###### END~OF~TABLE ###### .. _Return: Return ~~~~~~ A complete form element, with title, warning, and the input itself. .. _See-also: See also ~~~~~~~~ div\_checkVarType div\_cleanArray fe\_buildFormElementHeader div\_writeTagParams .. _fe-createTextArea: fe\_createTextArea ^^^^^^^^^^^^^^^^^^ .. _Creates-a-text-area: Creates a text area. """""""""""""""""""" This function creates an HTML