Index: t3lib/class.t3lib_tceforms.php =================================================================== --- t3lib/class.t3lib_tceforms.php (revision 9469) +++ t3lib/class.t3lib_tceforms.php (revision ) @@ -1,29 +1,29 @@ uc['titleLen'] but what is default?? + var $titleLen = 15; // @deprecated since TYPO3 4.1: $BE_USER->uc['titleLen'] but what is default?? - var $defaultLanguageData = array(); // Array where records in the default language is stored. (processed by transferdata) + var $defaultLanguageData = array(); // Array where records in the default language is stored. (processed by transferdata) - var $defaultLanguageData_diff = array(); // Array where records in the default language is stored (raw without any processing. used for making diff) + var $defaultLanguageData_diff = array(); // Array where records in the default language is stored (raw without any processing. used for making diff) var $additionalPreviewLanguageData = array(); // EXTERNAL, static - var $backPath=''; // Set this to the 'backPath' pointing back to the typo3 admin directory from the script where this form is displayed. + var $backPath = ''; // Set this to the 'backPath' pointing back to the typo3 admin directory from the script where this form is displayed. - var $returnUrl=''; // Alternative return URL path (default is t3lib_div::linkThisScript()) + var $returnUrl = ''; // Alternative return URL path (default is t3lib_div::linkThisScript()) - var $doSaveFieldName=''; // Can be set to point to a field name in the form which will be set to '1' when the form is submitted with a *save* button. This way the recipient script can determine that the form was submitted for save and not "close" for example. + var $doSaveFieldName = ''; // Can be set to point to a field name in the form which will be set to '1' when the form is submitted with a *save* button. This way the recipient script can determine that the form was submitted for save and not "close" for example. - var $palettesCollapsed=0; // Can be set true/false to whether palettes (secondary options) are in the topframe or in form. True means they are NOT IN-form. So a collapsed palette is one, which is shown in the top frame, not in the page. + var $palettesCollapsed = 0; // Can be set true/false to whether palettes (secondary options) are in the topframe or in form. True means they are NOT IN-form. So a collapsed palette is one, which is shown in the top frame, not in the page. - var $disableRTE=0; // If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!) + var $disableRTE = 0; // If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!) - var $globalShowHelp=1; // If false, then all CSH will be disabled, regardless of settings in $this->edit_showFieldHelp + var $globalShowHelp = 1; // If false, then all CSH will be disabled, regardless of settings in $this->edit_showFieldHelp - var $localizationMode=''; // If true, the forms are rendering only localization relevant fields of the records. + var $localizationMode = ''; // If true, the forms are rendering only localization relevant fields of the records. - var $fieldOrder=''; // Overrule the field order set in TCA[types][showitem], eg for tt_content this value, 'bodytext,image', would make first the 'bodytext' field, then the 'image' field (if set for display)... and then the rest in the old order. + var $fieldOrder = ''; // Overrule the field order set in TCA[types][showitem], eg for tt_content this value, 'bodytext,image', would make first the 'bodytext' field, then the 'image' field (if set for display)... and then the rest in the old order. - var $doPrintPalette=1; // If set to false, palettes will NEVER be rendered. + var $doPrintPalette = 1; // If set to false, palettes will NEVER be rendered. /** * Set to initialized clipboard object; Then the element browser will offer a link to paste in records from clipboard. * * @var t3lib_clipboard */ - var $clipObj=FALSE; + var $clipObj = FALSE; - var $enableClickMenu=FALSE; // Enable click menu on reference icons. + var $enableClickMenu = FALSE; // Enable click menu on reference icons. - var $enableTabMenu = FALSE; // Enable Tab Menus. + var $enableTabMenu = FALSE; // Enable Tab Menus. - var $renderReadonly = FALSE; // When enabled all fields are rendered non-editable. + var $renderReadonly = FALSE; // When enabled all fields are rendered non-editable. - var $form_rowsToStylewidth = 9.58; // Form field width compensation: Factor from NN4 form field widths to style-aware browsers (like NN6+ and MSIE, with the $CLIENT[FORMSTYLE] value set) + var $form_rowsToStylewidth = 9.58; // Form field width compensation: Factor from NN4 form field widths to style-aware browsers (like NN6+ and MSIE, with the $CLIENT[FORMSTYLE] value set) - var $form_largeComp = 1.33; // Form field width compensation: Compensation for large documents, doc-tab (editing) + var $form_largeComp = 1.33; // Form field width compensation: Compensation for large documents, doc-tab (editing) - var $charsPerRow=40; // The number of chars expected per row when the height of a text area field is automatically calculated based on the number of characters found in the field content. + var $charsPerRow = 40; // The number of chars expected per row when the height of a text area field is automatically calculated based on the number of characters found in the field content. - var $maxTextareaWidth=48; // The maximum abstract value for textareas + var $maxTextareaWidth = 48; // The maximum abstract value for textareas - var $maxInputWidth=48; // The maximum abstract value for input fields + var $maxInputWidth = 48; // The maximum abstract value for input fields - var $defaultMultipleSelectorStyle='width:250px;'; // Default style for the selector boxes used for multiple items in "select" and "group" types. + var $defaultMultipleSelectorStyle = 'width:250px;'; // Default style for the selector boxes used for multiple items in "select" and "group" types. // INTERNAL, static - var $prependFormFieldNames = 'data'; // The string to prepend formfield names with. + var $prependFormFieldNames = 'data'; // The string to prepend formfield names with. - var $prependCmdFieldNames = 'cmd'; // The string to prepend commands for tcemain::process_cmdmap with. + var $prependCmdFieldNames = 'cmd'; // The string to prepend commands for tcemain::process_cmdmap with. - var $prependFormFieldNames_file = 'data_files'; // The string to prepend FILE form field names with. + var $prependFormFieldNames_file = 'data_files'; // The string to prepend FILE form field names with. - var $formName = 'editform'; // The name attribute of the form. + var $formName = 'editform'; // The name attribute of the form. - var $allowOverrideMatrix = array(); // Whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf() + var $allowOverrideMatrix = array(); // Whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf() - // INTERNAL, dynamic - var $perms_clause=''; // Set by readPerms() (caching) + var $perms_clause = ''; // Set by readPerms() (caching) - var $perms_clause_set=0; // Set by readPerms() (caching-flag) + var $perms_clause_set = 0; // Set by readPerms() (caching-flag) - var $edit_showFieldHelp=''; // Used to indicate the mode of CSH (Context Sensitive Help), whether it should be icons-only ('icon'), full description ('text') or not at all (blank). + var $edit_showFieldHelp = ''; // Used to indicate the mode of CSH (Context Sensitive Help), whether it should be icons-only ('icon'), full description ('text') or not at all (blank). - var $docLarge=0; // If set, the forms will be rendered a little wider, more precisely with a factor of $this->form_largeComp. + var $docLarge = 0; // If set, the forms will be rendered a little wider, more precisely with a factor of $this->form_largeComp. - var $clientInfo=array(); // Loaded with info about the browser when class is instantiated. + var $clientInfo = array(); // Loaded with info about the browser when class is instantiated. - var $RTEenabled=0; // True, if RTE is possible for the current user (based on result from BE_USER->isRTE()) + var $RTEenabled = 0; // True, if RTE is possible for the current user (based on result from BE_USER->isRTE()) - var $RTEenabled_notReasons=''; // If $this->RTEenabled was false, you can find the reasons listed in this array which is filled with reasons why the RTE could not be loaded) + var $RTEenabled_notReasons = ''; // If $this->RTEenabled was false, you can find the reasons listed in this array which is filled with reasons why the RTE could not be loaded) - var $RTEcounter = 0; // Counter that is incremented before an RTE is created. Can be used for unique ids etc. + var $RTEcounter = 0; // Counter that is incremented before an RTE is created. Can be used for unique ids etc. - var $colorScheme; // Contains current color scheme + var $colorScheme; // Contains current color scheme - var $classScheme; // Contains current class scheme + var $classScheme; // Contains current class scheme - var $defColorScheme; // Contains the default color scheme + var $defColorScheme; // Contains the default color scheme - var $defClassScheme; // Contains the default class scheme + var $defClassScheme; // Contains the default class scheme - var $fieldStyle; // Contains field style values + var $fieldStyle; // Contains field style values - var $borderStyle; // Contains border style values. + var $borderStyle; // Contains border style values. - var $commentMessages=array(); // An accumulation of messages from the class. + var $commentMessages = array(); // An accumulation of messages from the class. // INTERNAL, templates - var $totalWrap='
|
'; // Total wrapping for the table rows. + var $totalWrap = '
|
'; // Total wrapping for the table rows. - var $fieldTemplate='###FIELD_NAME###
###FIELD_ITEM###
'; // Field template + var $fieldTemplate = '###FIELD_NAME###
###FIELD_ITEM###
'; // Field template - var $sectionWrap=''; // Wrapping template code for a section + var $sectionWrap = ''; // Wrapping template code for a section - var $palFieldTemplateHeader=''; // Template for palette headers + var $palFieldTemplateHeader = ''; // Template for palette headers - var $palFieldTemplate=''; // Template for palettes + var $palFieldTemplate = ''; // Template for palettes // INTERNAL, working memory - var $excludeElements=''; // Set to the fields NOT to display, if any. + var $excludeElements = ''; // Set to the fields NOT to display, if any. - var $palettesRendered=array(); // During rendering of forms this will keep track of which palettes has already been rendered (so they are not rendered twice by mistake) + var $palettesRendered = array(); // During rendering of forms this will keep track of which palettes has already been rendered (so they are not rendered twice by mistake) - var $hiddenFieldListArr = array(); // This array of fields will be set as hidden-fields instead of rendered normally! For instance palette fields edited in the top frame are set as hidden fields since the main form has to submit the values. The top frame actually just sets the value in the main form! + var $hiddenFieldListArr = array(); // This array of fields will be set as hidden-fields instead of rendered normally! For instance palette fields edited in the top frame are set as hidden fields since the main form has to submit the values. The top frame actually just sets the value in the main form! - var $requiredFields=array(); // Used to register input-field names, which are required. (Done during rendering of the fields). This information is then used later when the JavaScript is made. + var $requiredFields = array(); // Used to register input-field names, which are required. (Done during rendering of the fields). This information is then used later when the JavaScript is made. - var $requiredAdditional=array(); // Used to register input-field names, which are required an have additional requirements (e.g. like a date/time must be positive integer). The information of this array is merged with $this->requiredFields later. + var $requiredAdditional = array(); // Used to register input-field names, which are required an have additional requirements (e.g. like a date/time must be positive integer). The information of this array is merged with $this->requiredFields later. - var $requiredElements=array(); // Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance) + var $requiredElements = array(); // Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance) - var $requiredNested=array(); // Used to determine where $requiredFields or $requiredElements are nested (in Tabs or IRRE) + var $requiredNested = array(); // Used to determine where $requiredFields or $requiredElements are nested (in Tabs or IRRE) - var $renderDepth=0; // Keeps track of the rendering depth of nested records. + var $renderDepth = 0; // Keeps track of the rendering depth of nested records. - var $savedSchemes=array(); // Color scheme buffer. + var $savedSchemes = array(); // Color scheme buffer. - var $dynNestedStack = array(); // holds the path an element is nested in (e.g. required for RTEhtmlarea) + var $dynNestedStack = array(); // holds the path an element is nested in (e.g. required for RTEhtmlarea) // Internal, registers for user defined functions etc. - var $additionalCode_pre = array(); // Additional HTML code, printed before the form. + var $additionalCode_pre = array(); // Additional HTML code, printed before the form. - var $additionalJS_pre = array(); // Additional JavaScript, printed before the form + var $additionalJS_pre = array(); // Additional JavaScript, printed before the form - var $additionalJS_post = array(); // Additional JavaScript printed after the form + var $additionalJS_post = array(); // Additional JavaScript printed after the form - var $additionalJS_submit = array(); // Additional JavaScript executed on submit; If you set "OK" variable it will raise an error about RTEs not being loaded and offer to block further submission. + var $additionalJS_submit = array(); // Additional JavaScript executed on submit; If you set "OK" variable it will raise an error about RTEs not being loaded and offer to block further submission. - var $additionalJS_delete = array(); // Additional JavaScript executed when section element is deleted. This is neceessary, for example, to correctly clean up HTMLArea RTE (bug #8232) + var $additionalJS_delete = array(); // Additional JavaScript executed when section element is deleted. This is neceessary, for example, to correctly clean up HTMLArea RTE (bug #8232) /** * Instance of t3lib_tceforms_inline @@ -306,37 +292,36 @@ * @var t3lib_TCEforms_inline */ var $inline; - var $hookObjectsMainFields = array(); // Array containing hook class instances called once for a form + var $hookObjectsMainFields = array(); // Array containing hook class instances called once for a form - var $hookObjectsSingleField = array(); // Array containing hook class instances called for each field + var $hookObjectsSingleField = array(); // Array containing hook class instances called for each field - var $extraFormHeaders = array(); // Rows gettings inserted into the alt_doc headers (when called from alt_doc.php) + var $extraFormHeaders = array(); // Rows gettings inserted into the alt_doc headers (when called from alt_doc.php) - public $templateFile = ''; // Form templates, relative to typo3 directory + public $templateFile = ''; // Form templates, relative to typo3 directory - /** * Constructor function, setting internal variables, loading the styles used. * * @return void */ - function t3lib_TCEforms() { + function t3lib_TCEforms() { global $CLIENT, $TYPO3_CONF_VARS; $this->clientInfo = t3lib_div::clientInfo(); $this->RTEenabled = $GLOBALS['BE_USER']->isRTE(); - if (!$this->RTEenabled) { + if (!$this->RTEenabled) { - $this->RTEenabled_notReasons = implode(LF,$GLOBALS['BE_USER']->RTE_errors); + $this->RTEenabled_notReasons = implode(LF, $GLOBALS['BE_USER']->RTE_errors); - $this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:'.LF.$this->RTEenabled_notReasons; + $this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:' . LF . $this->RTEenabled_notReasons; } // Default color+class scheme $this->defColorScheme = array( - $GLOBALS['SOBE']->doc->bgColor, // Background for the field AND palette + $GLOBALS['SOBE']->doc->bgColor, // Background for the field AND palette - t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-20), // Background for the field header + t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor, -20), // Background for the field header - t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-10), // Background for the palette field header + t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor, -10), // Background for the palette field header - 'black', // Field header font color + 'black', // Field header font color - '#666666' // Palette field header font color + '#666666' // Palette field header font color ); $this->defColorScheme = array(); @@ -358,24 +343,24 @@ ); // Create instance of t3lib_TCEforms_inline only if this a non-IRRE-AJAX call: - if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], 't3lib_TCEforms_inline::')!==0) { + if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], 't3lib_TCEforms_inline::') !== 0) { $this->inline = t3lib_div::makeInstance('t3lib_TCEforms_inline'); } // Create instance of t3lib_TCEforms_suggest only if this a non-Suggest-AJAX call: - if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], 't3lib_TCEforms_suggest::')!==0) { + if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], 't3lib_TCEforms_suggest::') !== 0) { $this->suggest = t3lib_div::makeInstance('t3lib_TCEforms_suggest'); } // Prepare user defined objects (if any) for hooks which extend this function: $this->hookObjectsMainFields = array(); - if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'])) { + if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'])) { - foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef) { + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef) { $this->hookObjectsMainFields[] = t3lib_div::getUserObj($classRef); } } $this->hookObjectsSingleField = array(); - if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'])) { + if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'])) { - foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'] as $classRef) { + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'] as $classRef) { $this->hookObjectsSingleField[] = t3lib_div::getUserObj($classRef); } } @@ -389,7 +374,7 @@ * * @return void */ - function initDefaultBEmode() { + function initDefaultBEmode() { global $BE_USER; $this->prependFormFieldNames = 'data'; $this->formName = 'editform'; @@ -398,28 +383,13 @@ $this->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp']; $this->edit_docModuleUpload = $BE_USER->uc['edit_docModuleUpload']; - $this->titleLen = $BE_USER->uc['titleLen']; // @deprecated since TYPO3 4.1 + $this->titleLen = $BE_USER->uc['titleLen']; // @deprecated since TYPO3 4.1 $this->inline->init($this); $this->suggest->init($this); } - - - - - - - - - - - - - - - /******************************************************* * * Rendering the forms, fields etc @@ -437,25 +407,25 @@ * @return string HTML output * @see getMainFields() */ - function getSoloField($table,$row,$theFieldToReturn) { + function getSoloField($table, $row, $theFieldToReturn) { global $TCA; - if ($TCA[$table]) { + if ($TCA[$table]) { t3lib_div::loadTCA($table); - $typeNum = $this->getRTypeNum($table,$row); + $typeNum = $this->getRTypeNum($table, $row); - if ($TCA[$table]['types'][$typeNum]) { + if ($TCA[$table]['types'][$typeNum]) { $itemList = $TCA[$table]['types'][$typeNum]['showitem']; - if ($itemList) { + if ($itemList) { - $fields = t3lib_div::trimExplode(',',$itemList,1); + $fields = t3lib_div::trimExplode(',', $itemList, 1); - $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum); + $excludeElements = $this->excludeElements = $this->getExcludeElements($table, $row, $typeNum); - foreach($fields as $fieldInfo) { + foreach ($fields as $fieldInfo) { - $parts = explode(';',$fieldInfo); + $parts = explode(';', $fieldInfo); $theField = trim($parts[0]); - if (!in_array($theField,$excludeElements) && !strcmp($theField,$theFieldToReturn)) { + if (!in_array($theField, $excludeElements) && !strcmp($theField, $theFieldToReturn)) { - if ($TCA[$table]['columns'][$theField]) { + if ($TCA[$table]['columns'][$theField]) { - $sField = $this->getSingleField($table,$theField,$row,$parts[1],1,$parts[3],$parts[2]); + $sField = $this->getSingleField($table, $theField, $row, $parts[1], 1, $parts[3], $parts[2]); return $sField['ITEM']; } } @@ -475,30 +445,30 @@ * @return string HTML output * @see getSoloField() */ - function getMainFields($table,$row,$depth=0) { + function getMainFields($table, $row, $depth = 0) { global $TCA, $TYPO3_CONF_VARS; - $this->renderDepth=$depth; + $this->renderDepth = $depth; // Init vars: $out_array = array(array()); $out_array_meta = array(array( - 'title' => $this->getLL('l_generalTab') - )); + 'title' => $this->getLL('l_generalTab') + )); - $out_pointer=0; + $out_pointer = 0; - $out_sheet=0; + $out_sheet = 0; - $this->palettesRendered=array(); + $this->palettesRendered = array(); - $this->palettesRendered[$this->renderDepth][$table]=array(); + $this->palettesRendered[$this->renderDepth][$table] = array(); // Hook: getMainFields_preProcess (requested by Thomas Hempel for use with the "dynaflex" extension) - foreach ($this->hookObjectsMainFields as $hookObj) { + foreach ($this->hookObjectsMainFields as $hookObj) { - if (method_exists($hookObj,'getMainFields_preProcess')) { + if (method_exists($hookObj, 'getMainFields_preProcess')) { - $hookObj->getMainFields_preProcess($table,$row,$this); + $hookObj->getMainFields_preProcess($table, $row, $this); } } - if ($TCA[$table]) { + if ($TCA[$table]) { // Load the full TCA for the table. t3lib_div::loadTCA($table); @@ -507,104 +477,110 @@ $dividers2tabs =& $TCA[$table]['ctrl']['dividers2tabs']; // Load the description content for the table. - if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) { + if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) { $GLOBALS['LANG']->loadSingleTableDescription($table); } // Get the current "type" value for the record. - $typeNum = $this->getRTypeNum($table,$row); + $typeNum = $this->getRTypeNum($table, $row); // Find the list of fields to display: - if ($TCA[$table]['types'][$typeNum]) { + if ($TCA[$table]['types'][$typeNum]) { $itemList = $TCA[$table]['types'][$typeNum]['showitem']; - if ($itemList) { // If such a list existed... + if ($itemList) { // If such a list existed... // Explode the field list and possibly rearrange the order of the fields, if configured for - $fields = t3lib_div::trimExplode(',',$itemList,1); + $fields = t3lib_div::trimExplode(',', $itemList, 1); - if ($this->fieldOrder) { + if ($this->fieldOrder) { $fields = $this->rearrange($fields); } // Get excluded fields, added fiels and put it together: - $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum); + $excludeElements = $this->excludeElements = $this->getExcludeElements($table, $row, $typeNum); - $fields = $this->mergeFieldsWithAddedFields($fields,$this->getFieldsToAdd($table,$row,$typeNum)); + $fields = $this->mergeFieldsWithAddedFields($fields, $this->getFieldsToAdd($table, $row, $typeNum)); // If TCEforms will render a tab menu in the next step, push the name to the tab stack: $tabIdentString = ''; $tabIdentStringMD5 = ''; if (strstr($itemList, '--div--') !== false && $this->enableTabMenu && $dividers2tabs) { - $tabIdentString = 'TCEforms:'.$table.':'.$row['uid']; + $tabIdentString = 'TCEforms:' . $table . ':' . $row['uid']; $tabIdentStringMD5 = $GLOBALS['TBE_TEMPLATE']->getDynTabMenuId($tabIdentString); // Remember that were currently working on the general tab: if (isset($fields[0]) && strpos($fields[0], '--div--') !== 0) { - $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-1'); + $this->pushToDynNestedStack('tab', $tabIdentStringMD5 . '-1'); } } // Traverse the fields to render: - $cc=0; + $cc = 0; - foreach($fields as $fieldInfo) { + foreach ($fields as $fieldInfo) { // Exploding subparts of the field configuration: - $parts = explode(';',$fieldInfo); + $parts = explode(';', $fieldInfo); // Getting the style information out: - $color_style_parts = t3lib_div::trimExplode('-',$parts[4]); + $color_style_parts = t3lib_div::trimExplode('-', $parts[4]); - if (strcmp($color_style_parts[0],'')) { + if (strcmp($color_style_parts[0], '')) { $this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][intval($color_style_parts[0])]); } - if (strcmp($color_style_parts[1],'')) { + if (strcmp($color_style_parts[1], '')) { $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][intval($color_style_parts[1])]; - if (!isset($this->fieldStyle)) $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0]; + if (!isset($this->fieldStyle)) { + $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0]; - } + } + } - if (strcmp($color_style_parts[2],'')) { + if (strcmp($color_style_parts[2], '')) { - $this->wrapBorder($out_array[$out_sheet],$out_pointer); + $this->wrapBorder($out_array[$out_sheet], $out_pointer); $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][intval($color_style_parts[2])]; - if (!isset($this->borderStyle)) $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0]; + if (!isset($this->borderStyle)) { + $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0]; - } + } + } // Render the field: $theField = $parts[0]; - if (!in_array($theField,$excludeElements)) { + if (!in_array($theField, $excludeElements)) { - if ($TCA[$table]['columns'][$theField]) { + if ($TCA[$table]['columns'][$theField]) { - $sFieldPal=''; + $sFieldPal = ''; - if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) { + if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) { - $sFieldPal=$this->getPaletteFields($table,$row,$parts[2]); + $sFieldPal = $this->getPaletteFields($table, $row, $parts[2]); $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1; } - $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],$parts[2]); + $sField = $this->getSingleField($table, $theField, $row, $parts[1], 0, $parts[3], $parts[2]); - if ($sField) { $sField.= $sFieldPal; } + if ($sField) { + $sField .= $sFieldPal; + } - $out_array[$out_sheet][$out_pointer].= $sField; + $out_array[$out_sheet][$out_pointer] .= $sField; - } elseif ($theField=='--div--') { + } elseif ($theField == '--div--') { - if ($cc>0) { + if ($cc > 0) { - $out_array[$out_sheet][$out_pointer].=$this->getDivider(); + $out_array[$out_sheet][$out_pointer] .= $this->getDivider(); if ($this->enableTabMenu && $dividers2tabs) { - $this->wrapBorder($out_array[$out_sheet],$out_pointer); + $this->wrapBorder($out_array[$out_sheet], $out_pointer); // Remove last tab entry from the dynNestedStack: $out_sheet++; // Remove the previous sheet from stack (if any): - $this->popFromDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet)); + $this->popFromDynNestedStack('tab', $tabIdentStringMD5 . '-' . ($out_sheet)); // Remember on which sheet we're currently working: - $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet+1)); + $this->pushToDynNestedStack('tab', $tabIdentStringMD5 . '-' . ($out_sheet + 1)); $out_array[$out_sheet] = array(); $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]); - // Register newline for Tab - $out_array_meta[$out_sheet]['newline'] = ($parts[2] == "newline"); + // Register newline for Tab + $out_array_meta[$out_sheet]['newline'] = ($parts[2] == "newline"); } - } else { // Setting alternative title for "General" tab if "--div--" is the very first element. + } else { // Setting alternative title for "General" tab if "--div--" is the very first element. $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]); // Only add the first tab to the dynNestedStack if there are more tabs: if ($tabIdentString && strpos($itemList, '--div--', strlen($fieldInfo))) { - $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-1'); + $this->pushToDynNestedStack('tab', $tabIdentStringMD5 . '-1'); } } - } elseif($theField=='--palette--') { + } elseif ($theField == '--palette--') { - if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) { + if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) { // render a 'header' if not collapsed if ($TCA[$table]['palettes'][$parts[2]]['canNotCollapse'] AND $parts[1]) { - $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],$this->sL($parts[1])); + $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], $this->sL($parts[1])); } else { - $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],'','',$this->sL($parts[1])); + $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], '', '', $this->sL($parts[1])); } $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1; } @@ -618,60 +594,60 @@ } // Hook: getMainFields_postProcess (requested by Thomas Hempel for use with the "dynaflex" extension) - foreach ($this->hookObjectsMainFields as $hookObj) { + foreach ($this->hookObjectsMainFields as $hookObj) { - if (method_exists($hookObj,'getMainFields_postProcess')) { + if (method_exists($hookObj, 'getMainFields_postProcess')) { - $hookObj->getMainFields_postProcess($table,$row,$this); + $hookObj->getMainFields_postProcess($table, $row, $this); } } // Wrapping a border around it all: - $this->wrapBorder($out_array[$out_sheet],$out_pointer); + $this->wrapBorder($out_array[$out_sheet], $out_pointer); // Resetting styles: $this->resetSchemes(); // Rendering Main palettes, if any - $mParr = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['mainpalette']); + $mParr = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['mainpalette']); $i = 0; - if (count($mParr)) { + if (count($mParr)) { - foreach ($mParr as $mP) { + foreach ($mParr as $mP) { - if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP])) { + if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP])) { - $temp_palettesCollapsed=$this->palettesCollapsed; + $temp_palettesCollapsed = $this->palettesCollapsed; - $this->palettesCollapsed=0; + $this->palettesCollapsed = 0; - $label = ($i==0?$this->getLL('l_generalOptions'):$this->getLL('l_generalOptions_more')); + $label = ($i == 0 ? $this->getLL('l_generalOptions') : $this->getLL('l_generalOptions_more')); - $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$mP,$label); + $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $mP, $label); - $this->palettesCollapsed=$temp_palettesCollapsed; + $this->palettesCollapsed = $temp_palettesCollapsed; $this->palettesRendered[$this->renderDepth][$table][$mP] = 1; } - $this->wrapBorder($out_array[$out_sheet],$out_pointer); + $this->wrapBorder($out_array[$out_sheet], $out_pointer); $i++; - if ($this->renderDepth) { + if ($this->renderDepth) { $this->renderDepth--; } } } // Return the imploded $out_array: - if ($out_sheet>0) { // There were --div-- dividers around... + if ($out_sheet > 0) { // There were --div-- dividers around... // Create parts array for the tab menu: $parts = array(); - foreach ($out_array as $idx => $sheetContent) { + foreach ($out_array as $idx => $sheetContent) { $content = implode('', $sheetContent); if ($content) { - // Wrap content (row) with table-tag, otherwise tab/sheet will be disabled (see getdynTabMenu() ) + // Wrap content (row) with table-tag, otherwise tab/sheet will be disabled (see getdynTabMenu() ) - $content = ''.$content.'
'; + $content = '' . $content . '
'; } $parts[$idx] = array( 'label' => $out_array_meta[$idx]['title'], 'content' => $content, - 'newline' => $out_array_meta[$idx]['newline'], // Newline for this tab/sheet + 'newline' => $out_array_meta[$idx]['newline'], // Newline for this tab/sheet ); } if (count($parts) > 1) { // Unset the current level of tab menus: - $this->popFromDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet+1)); + $this->popFromDynNestedStack('tab', $tabIdentStringMD5 . '-' . ($out_sheet + 1)); $dividersToTabsBehaviour = (isset($TCA[$table]['ctrl']['dividers2tabs']) ? $TCA[$table]['ctrl']['dividers2tabs'] : 1); $output = $this->getDynTabMenu($parts, $tabIdentString, $dividersToTabsBehaviour); @@ -683,13 +659,13 @@ $output = ' - '.$output.' + ' . $output . ' '; } else { // Only one, so just implode: - $output = implode('',$out_array[$out_sheet]); + $output = implode('', $out_array[$out_sheet]); } return $output; @@ -705,31 +681,31 @@ * @param string Commalist of fields from the table. These will be shown in the specified order in a form. * @return string TCEform elements in a string. */ - function getListedFields($table,$row,$list) { + function getListedFields($table, $row, $list) { global $TCA; t3lib_div::loadTCA($table); - if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) { + if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) { $GLOBALS['LANG']->loadSingleTableDescription($table); } $out = ''; - $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row,1); + $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table, $row, 1); - $editFieldList=array_unique(t3lib_div::trimExplode(',',$list,1)); + $editFieldList = array_unique(t3lib_div::trimExplode(',', $list, 1)); - foreach($editFieldList as $theFieldC) { + foreach ($editFieldList as $theFieldC) { - list($theField,$palFields) = preg_split('/\[|\]/', $theFieldC); + list($theField, $palFields) = preg_split('/\[|\]/', $theFieldC); $theField = trim($theField); $palFields = trim($palFields); - if ($TCA[$table]['columns'][$theField]) { + if ($TCA[$table]['columns'][$theField]) { - $parts = t3lib_div::trimExplode(';',$types_fieldConfig[$theField]['origString']); + $parts = t3lib_div::trimExplode(';', $types_fieldConfig[$theField]['origString']); - $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],0); // Don't sent palette pointer - there are no options anyways for a field-list. + $sField = $this->getSingleField($table, $theField, $row, $parts[1], 0, $parts[3], 0); // Don't sent palette pointer - there are no options anyways for a field-list. - $out.= $sField; + $out .= $sField; - } elseif($theField=='--div--') { + } elseif ($theField == '--div--') { - $out.= $this->getDivider(); + $out .= $this->getDivider(); } - if ($palFields) { + if ($palFields) { - $out.= $this->getPaletteFields($table,$row,'','',implode(',',t3lib_div::trimExplode('|',$palFields,1))); + $out .= $this->getPaletteFields($table, $row, '', '', implode(',', t3lib_div::trimExplode('|', $palFields, 1))); } } @@ -747,8 +723,8 @@ * @param string Optional Link text for activating a palette (when palettes does not have another form element to belong to). * @return string HTML code. */ - function getPaletteFields($table,$row,$palette,$header='',$itemList='',$collapsedHeader=NULL) { + function getPaletteFields($table, $row, $palette, $header = '', $itemList = '', $collapsedHeader = NULL) { - if (!$this->doPrintPalette) { + if (!$this->doPrintPalette) { return ''; } @@ -770,9 +746,9 @@ if ($header) { $out .= $this->intoTemplate( - array('HEADER' => htmlspecialchars($header)), - $this->palFieldTemplateHeader - ); + array('HEADER' => htmlspecialchars($header)), + $this->palFieldTemplateHeader + ); } $collapsed = $this->isPalettesCollapsed($table, $palette); @@ -787,12 +763,12 @@ $thePalIcon = '' . $thePalIcon . $collapsedHeader . ''; } - $paletteHtml = $this->wrapPaletteField($this->printPalette($parts), $table, $row ,$palette, $collapsed); + $paletteHtml = $this->wrapPaletteField($this->printPalette($parts), $table, $row, $palette, $collapsed); $out .= $this->intoTemplate( - array('PALETTE' => $thePalIcon . $paletteHtml), - $this->palFieldTemplate - ); + array('PALETTE' => $thePalIcon . $paletteHtml), + $this->palFieldTemplate + ); } } return $out; @@ -810,12 +786,12 @@ * @param integer The palette pointer. * @return mixed String (normal) or array (palettes) */ - function getSingleField($table,$field,$row,$altName='',$palette=0,$extra='',$pal=0) { + function getSingleField($table, $field, $row, $altName = '', $palette = 0, $extra = '', $pal = 0) { - global $TCA,$BE_USER; + global $TCA, $BE_USER; // Hook: getSingleField_preProcess - foreach ($this->hookObjectsSingleField as $hookObj) { + foreach ($this->hookObjectsSingleField as $hookObj) { - if (method_exists($hookObj,'getSingleField_preProcess')) { + if (method_exists($hookObj, 'getSingleField_preProcess')) { $hookObj->getSingleField_preProcess($table, $field, $row, $altName, $palette, $extra, $pal, $this); } } @@ -832,48 +808,47 @@ // Get the TCA configuration for the current field: $PA['fieldConf'] = $TCA[$table]['columns'][$field]; - $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; // Using "form_type" locally in this script + $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; // Using "form_type" locally in this script $skipThisField = $this->inline->skipField($table, $field, $row, $PA['fieldConf']['config']); // Now, check if this field is configured and editable (according to excludefields + other configuration) - if ( is_array($PA['fieldConf']) && + if (is_array($PA['fieldConf']) && - !$skipThisField && + !$skipThisField && - (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$field)) && + (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields', $table . ':' . $field)) && - $PA['fieldConf']['config']['form_type']!='passthrough' && + $PA['fieldConf']['config']['form_type'] != 'passthrough' && - ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) && + ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) && - (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'],$row)) && + (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'], $row)) && - (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'],'exclude') || $row[$TCA[$table]['ctrl']['languageField']]<=0) && + (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'], 'exclude') || $row[$TCA[$table]['ctrl']['languageField']] <= 0) && - (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode===$PA['fieldConf']['l10n_cat']) + (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode === $PA['fieldConf']['l10n_cat']) - ) { + ) { - // Fetching the TSconfig for the current table/field. This includes the $row which means that - $PA['fieldTSConfig'] = $this->setTSconfig($table,$row,$field); + $PA['fieldTSConfig'] = $this->setTSconfig($table, $row, $field); // If the field is NOT disabled from TSconfig (which it could have been) then render it - if (!$PA['fieldTSConfig']['disabled']) { + if (!$PA['fieldTSConfig']['disabled']) { // Override fieldConf by fieldTSconfig: $PA['fieldConf']['config'] = $this->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']); // Init variables: - $PA['itemFormElName']=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']'; // Form field name + $PA['itemFormElName'] = $this->prependFormFieldNames . '[' . $table . '][' . $row['uid'] . '][' . $field . ']'; // Form field name - $PA['itemFormElName_file']=$this->prependFormFieldNames_file.'['.$table.']['.$row['uid'].']['.$field.']'; // Form field name, in case of file uploads + $PA['itemFormElName_file'] = $this->prependFormFieldNames_file . '[' . $table . '][' . $row['uid'] . '][' . $field . ']'; // Form field name, in case of file uploads - $PA['itemFormElValue']=$row[$field]; // The value to show in the form field. + $PA['itemFormElValue'] = $row[$field]; // The value to show in the form field. - $PA['itemFormElID']=$this->prependFormFieldNames.'_'.$table.'_'.$row['uid'].'_'.$field; + $PA['itemFormElID'] = $this->prependFormFieldNames . '_' . $table . '_' . $row['uid'] . '_' . $field; // set field to read-only if configured for translated records to show default language content as readonly if ($PA['fieldConf']['l10n_display'] && t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly') && $row[$TCA[$table]['ctrl']['languageField']] > 0) { - $PA['fieldConf']['config']['readOnly'] = true; + $PA['fieldConf']['config']['readOnly'] = true; - $PA['itemFormElValue'] = $this->defaultLanguageData[$table.':'.$row['uid']][$field]; + $PA['itemFormElValue'] = $this->defaultLanguageData[$table . ':' . $row['uid']][$field]; } // Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate" if ( - ($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) || + ($TCA[$table]['ctrl']['type'] && !strcmp($field, $TCA[$table]['ctrl']['type'])) || - ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) { + ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'], $field))) { - if($GLOBALS['BE_USER']->jsConfirmation(1)) { + if ($GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };'; } else { $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };'; @@ -883,48 +858,48 @@ } // Render as a hidden field? - if (in_array($field,$this->hiddenFieldListArr)) { + if (in_array($field, $this->hiddenFieldListArr)) { - $this->hiddenFieldAccum[]=''; + $this->hiddenFieldAccum[] = ''; - } else { // Render as a normal field: + } else { // Render as a normal field: // If the field is NOT a palette field, then we might create an icon which links to a palette for the field, if one exists. - if (!$PA['palette']) { + if (!$PA['palette']) { $paletteFields = $this->loadPaletteElements($table, $row, $PA['pal']); - if ($PA['pal'] && $this->isPalettesCollapsed($table,$PA['pal']) && count($paletteFields)) { + if ($PA['pal'] && $this->isPalettesCollapsed($table, $PA['pal']) && count($paletteFields)) { - list($thePalIcon,$palJSfunc) = $this->wrapOpenPalette(t3lib_iconWorks::getSpriteIcon('actions-system-options-view', array('title' => htmlspecialchars($this->getLL('l_moreOptions')))),$table,$row,$PA['pal'],1); + list($thePalIcon, $palJSfunc) = $this->wrapOpenPalette(t3lib_iconWorks::getSpriteIcon('actions-system-options-view', array('title' => htmlspecialchars($this->getLL('l_moreOptions')))), $table, $row, $PA['pal'], 1); } else { $thePalIcon = ''; $palJSfunc = ''; } } // onFocus attribute to add to the field: - $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="'.htmlspecialchars($palJSfunc).'"' : ''; + $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="' . htmlspecialchars($palJSfunc) . '"' : ''; // Find item - $item=''; + $item = ''; $PA['label'] = ($PA['altName'] ? $PA['altName'] : $PA['fieldConf']['label']); $PA['label'] = ($PA['fieldTSConfig']['label'] ? $PA['fieldTSConfig']['label'] : $PA['label']); $PA['label'] = ($PA['fieldTSConfig']['label.'][$GLOBALS['LANG']->lang] ? $PA['fieldTSConfig']['label.'][$GLOBALS['LANG']->lang] : $PA['label']); $PA['label'] = $this->sL($PA['label']); // JavaScript code for event handlers: - $PA['fieldChangeFunc']=array(); + $PA['fieldChangeFunc'] = array(); - $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR.fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');"; + $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR.fieldChanged('" . $table . "','" . $row['uid'] . "','" . $field . "','" . $PA['itemFormElName'] . "');"; - $PA['fieldChangeFunc']['alert']=$alertMsgOnChange; + $PA['fieldChangeFunc']['alert'] = $alertMsgOnChange; // if this is the child of an inline type and it is the field creating the label if ($this->inline->isInlineChildAndLabelField($table, $field)) { $inlineObjectId = implode( t3lib_TCEforms_inline::Structure_Separator, array( - $this->inline->inlineNames['object'], - $table, - $row['uid'] + $this->inline->inlineNames['object'], + $table, + $row['uid'] ) ); $PA['fieldChangeFunc']['inline'] = "inline.handleChangedField('" . $PA['itemFormElName'] . "','" . $inlineObjectId . "');"; } // Based on the type of the item, call a render function: - $item = $this->getSingleField_SW($table,$field,$row,$PA); + $item = $this->getSingleField_SW($table, $field, $row, $PA); // Add language + diff if ($PA['fieldConf']['l10n_display'] && (t3lib_div::inList($PA['fieldConf']['l10n_display'], 'hideDiff') || t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly'))) { @@ -934,14 +909,14 @@ } if ($renderLanguageDiff) { - $item = $this->renderDefaultLanguageContent($table,$field,$row,$item); + $item = $this->renderDefaultLanguageContent($table, $field, $row, $item); - $item = $this->renderDefaultLanguageDiff($table,$field,$row,$item); + $item = $this->renderDefaultLanguageDiff($table, $field, $row, $item); } // If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in alt_doc.php $label = t3lib_div::deHSCentities(htmlspecialchars($PA['label'])); - if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !t3lib_div::_GP('columnsOnly')) { + if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !t3lib_div::_GP('columnsOnly')) { - $lTTS_url = $this->backPath.'alt_doc.php?edit['.$table.']['.$row['uid'].']=edit&columnsOnly='.$field.'&returnUrl='.rawurlencode($this->thisReturnUrl()); + $lTTS_url = $this->backPath . 'alt_doc.php?edit[' . $table . '][' . $row['uid'] . ']=edit&columnsOnly=' . $field . '&returnUrl=' . rawurlencode($this->thisReturnUrl()); $label = '' . $label . ''; } @@ -949,38 +924,40 @@ $PA['label'] = $label = t3lib_BEfunc::wrapInHelp($table, $field, $label); // Create output value: - if ($PA['fieldConf']['config']['form_type']=='user' && $PA['fieldConf']['config']['noTableWrapping']) { + if ($PA['fieldConf']['config']['form_type'] == 'user' && $PA['fieldConf']['config']['noTableWrapping']) { $out = $item; - } elseif ($PA['palette']) { + } elseif ($PA['palette']) { // Array: - $out=array( + $out = array( 'NAME' => $label, - 'ID'=>$row['uid'], + 'ID' => $row['uid'], - 'FIELD'=>$field, + 'FIELD' => $field, - 'TABLE'=>$table, + 'TABLE' => $table, - 'ITEM'=>$item + 'ITEM' => $item ); - $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA); + $out = $this->addUserTemplateMarkers($out, $table, $field, $row, $PA); } else { // String: - $out=array( + $out = array( - 'NAME'=>$label, + 'NAME' => $label, - 'ITEM'=>$item, + 'ITEM' => $item, - 'TABLE'=>$table, + 'TABLE' => $table, - 'ID'=>$row['uid'], + 'ID' => $row['uid'], - 'PAL_LINK_ICON'=>$thePalIcon, + 'PAL_LINK_ICON' => $thePalIcon, - 'FIELD'=>$field + 'FIELD' => $field ); - $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA); + $out = $this->addUserTemplateMarkers($out, $table, $field, $row, $PA); // String: - $out=$this->intoTemplate($out); + $out = $this->intoTemplate($out); } } - } else $this->commentMessages[]=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']: Disabled by TSconfig'; + } else { + $this->commentMessages[] = $this->prependFormFieldNames . '[' . $table . '][' . $row['uid'] . '][' . $field . ']: Disabled by TSconfig'; - } + } + } // Hook: getSingleField_postProcess - foreach ($this->hookObjectsSingleField as $hookObj) { + foreach ($this->hookObjectsSingleField as $hookObj) { - if (method_exists($hookObj,'getSingleField_postProcess')) { + if (method_exists($hookObj, 'getSingleField_postProcess')) { $hookObj->getSingleField_postProcess($table, $field, $row, $out, $PA, $this); } } @@ -999,49 +976,49 @@ * @access private * @see getSingleField(), getSingleField_typeFlex_draw() */ - function getSingleField_SW($table,$field,$row,&$PA) { + function getSingleField_SW($table, $field, $row, &$PA) { - $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; // Using "form_type" locally in this script + $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; // Using "form_type" locally in this script - // Hook: getSingleField_beforeRender + // Hook: getSingleField_beforeRender foreach ($this->hookObjectsSingleField as $hookObject) { if (method_exists($hookObject, 'getSingleField_beforeRender')) { $hookObject->getSingleField_beforeRender($table, $field, $row, $PA); } } - switch($PA['fieldConf']['config']['form_type']) { + switch ($PA['fieldConf']['config']['form_type']) { case 'input': - $item = $this->getSingleField_typeInput($table,$field,$row,$PA); + $item = $this->getSingleField_typeInput($table, $field, $row, $PA); break; case 'text': - $item = $this->getSingleField_typeText($table,$field,$row,$PA); + $item = $this->getSingleField_typeText($table, $field, $row, $PA); break; case 'check': - $item = $this->getSingleField_typeCheck($table,$field,$row,$PA); + $item = $this->getSingleField_typeCheck($table, $field, $row, $PA); break; case 'radio': - $item = $this->getSingleField_typeRadio($table,$field,$row,$PA); + $item = $this->getSingleField_typeRadio($table, $field, $row, $PA); break; case 'select': - $item = $this->getSingleField_typeSelect($table,$field,$row,$PA); + $item = $this->getSingleField_typeSelect($table, $field, $row, $PA); break; case 'group': - $item = $this->getSingleField_typeGroup($table,$field,$row,$PA); + $item = $this->getSingleField_typeGroup($table, $field, $row, $PA); break; case 'inline': - $item = $this->inline->getSingleField_typeInline($table,$field,$row,$PA); + $item = $this->inline->getSingleField_typeInline($table, $field, $row, $PA); break; case 'none': - $item = $this->getSingleField_typeNone($table,$field,$row,$PA); + $item = $this->getSingleField_typeNone($table, $field, $row, $PA); break; case 'user': - $item = $this->getSingleField_typeUser($table,$field,$row,$PA); + $item = $this->getSingleField_typeUser($table, $field, $row, $PA); break; case 'flex': - $item = $this->getSingleField_typeFlex($table,$field,$row,$PA); + $item = $this->getSingleField_typeFlex($table, $field, $row, $PA); break; default: - $item = $this->getSingleField_typeUnknown($table,$field,$row,$PA); + $item = $this->getSingleField_typeUnknown($table, $field, $row, $PA); break; } @@ -1049,23 +1026,6 @@ } - - - - - - - - - - - - - - - - - /********************************************************** * * Rendering of each TCEform field type @@ -1082,20 +1042,20 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeInput($table,$field,$row,&$PA) { + function getSingleField_typeInput($table, $field, $row, &$PA) { $config = $PA['fieldConf']['config']; $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']); - $size = t3lib_div::intInRange($config['size']?$config['size']:30,5,$this->maxInputWidth); + $size = t3lib_div::intInRange($config['size'] ? $config['size'] : 30, 5, $this->maxInputWidth); - $evalList = t3lib_div::trimExplode(',',$config['eval'],1); + $evalList = t3lib_div::trimExplode(',', $config['eval'], 1); $classAndStyleAttributes = $this->formWidthAsArray($size); $fieldAppendix = ''; - $cssClasses = array($classAndStyleAttributes['class']); + $cssClasses = array($classAndStyleAttributes['class']); - $cssStyle = $classAndStyleAttributes['style']; + $cssStyle = $classAndStyleAttributes['style']; - if(in_array('date', $evalList) || in_array('datetime', $evalList)) { + if (in_array('date', $evalList) || in_array('datetime', $evalList)) { - if(in_array('datetime', $evalList)) { + if (in_array('datetime', $evalList)) { $class = 'datetime'; } else { $class = 'date'; @@ -1112,8 +1072,8 @@ $fieldAppendix = t3lib_iconWorks::getSpriteIcon( 'actions-edit-pick-date', array( - 'style' => 'cursor:pointer;', - 'id' => 'picker-' . $inputId + 'style' => 'cursor:pointer;', + 'id' => 'picker-' . $inputId ) ); } elseif (in_array('timesec', $evalList)) { @@ -1150,16 +1110,16 @@ $cssClasses[] = 'tceforms-textfield tceforms-colorfield'; } - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $itemFormElValue = $PA['itemFormElValue']; - if (in_array('date',$evalList)) { + if (in_array('date', $evalList)) { $config['format'] = 'date'; - } elseif (in_array('datetime',$evalList)) { + } elseif (in_array('datetime', $evalList)) { $config['format'] = 'datetime'; - } elseif (in_array('time',$evalList)) { + } elseif (in_array('time', $evalList)) { $config['format'] = 'time'; } - if (in_array('password',$evalList)) { + if (in_array('password', $evalList)) { $itemFormElValue = $itemFormElValue ? '*********' : ''; } return $this->getSingleField_typeNone_render($config, $itemFormElValue); @@ -1168,31 +1128,31 @@ foreach ($evalList as $func) { switch ($func) { case 'required': - $this->registerRequiredProperty('field', $table.'_'.$row['uid'].'_'.$field, $PA['itemFormElName']); + $this->registerRequiredProperty('field', $table . '_' . $row['uid'] . '_' . $field, $PA['itemFormElName']); // Mark this field for date/time disposal: if (array_intersect($evalList, array('date', 'datetime', 'time'))) { - $this->requiredAdditional[$PA['itemFormElName']]['isPositiveNumber'] = true; + $this->requiredAdditional[$PA['itemFormElName']]['isPositiveNumber'] = true; } - break; + break; default: - if (substr($func, 0, 3) == 'tx_') { + if (substr($func, 0, 3) == 'tx_') { - // Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval() + // Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval() - $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func].':&'.$func); + $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func] . ':&' . $func); - if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue')) { + if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue')) { $_params = array( 'value' => $PA['itemFormElValue'] ); $PA['itemFormElValue'] = $evalObj->deevaluateFieldValue($_params); } } - break; + break; } } $paramsList = "'" . $PA['itemFormElName'] . "','" . implode(',', $evalList) . "','" . trim($config['is_in']) . "'," . (isset($config['checkbox']) ? 1 : 0) . ",'" . $config['checkbox'] . "'"; if ((in_array('date', $evalList) || in_array('datetime', $evalList))) { $item .= ''; + $inputId . '\').value) {this.className=\'t3-tceforms-input-wrapper-datetime-hover\';} else {this.className=\'t3-tceforms-input-wrapper-datetime\';};" onmouseOut="this.className=\'t3-tceforms-input-wrapper-datetime\';">'; // Add server timezone offset to UTC to our stored date if ($PA['itemFormElValue'] > 0) { @@ -1200,7 +1160,7 @@ } } else { $item .= ''; + '\').value) {this.className=\'t3-tceforms-input-wrapper-hover\';} else {this.className=\'t3-tceforms-input-wrapper\';};" onmouseOut="this.className=\'t3-tceforms-input-wrapper\';">'; } $PA['fieldChangeFunc'] = array_merge( @@ -1215,30 +1175,30 @@ $iOnChange = implode('', $PA['fieldChangeFunc']); $item .= ''; // This is the EDITABLE form field. + '" class="' . implode(' ', $cssClasses) . '" name="' . $PA['itemFormElName'] . + '_hr" value="" style="' . $cssStyle . '" maxlength="' . $mLgd . '" onchange="' . + htmlspecialchars($iOnChange) . '"' . $PA['onFocus'] . ' />'; // This is the EDITABLE form field. $item .= ''; // This is the ACTUAL form field - values from the EDITABLE field must be transferred to this field which is the one that is written to the database. + htmlspecialchars($PA['itemFormElValue']) . '" />'; // This is the ACTUAL form field - values from the EDITABLE field must be transferred to this field which is the one that is written to the database. $item .= $fieldAppendix . '
'; $this->extJSCODE .= 'typo3form.fieldSet(' . $paramsList . ');'; // going through all custom evaluations configured for this field foreach ($evalList as $evalData) { - if (substr($evalData, 0, 3) == 'tx_') { + if (substr($evalData, 0, 3) == 'tx_') { - $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData].':&'.$evalData); + $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData] . ':&' . $evalData); - if(is_object($evalObj) && method_exists($evalObj, 'returnFieldJS')) { + if (is_object($evalObj) && method_exists($evalObj, 'returnFieldJS')) { - $this->extJSCODE .= "\n\nfunction ".$evalData."(value) {\n".$evalObj->returnFieldJS()."\n}\n"; + $this->extJSCODE .= "\n\nfunction " . $evalData . "(value) {\n" . $evalObj->returnFieldJS() . "\n}\n"; } } } // Creating an alternative item without the JavaScript handlers. - $altItem = ''; + $altItem = ''; - $altItem.= ''; + $altItem .= ''; // Wrap a wizard around the item? - $item= $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'].'_hr',$specConf); + $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'] . '_hr', $specConf); return $item; } @@ -1253,13 +1213,13 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeText($table,$field,$row,&$PA) { + function getSingleField_typeText($table, $field, $row, &$PA) { // Init config: $config = $PA['fieldConf']['config']; $evalList = t3lib_div::trimExplode(',', $config['eval'], 1); - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']); } @@ -1268,41 +1228,43 @@ // Setting number of rows: $origRows = $rows = t3lib_div::intInRange($config['rows'] ? $config['rows'] : 5, 1, 20); - if (strlen($PA['itemFormElValue']) > $this->charsPerRow*2) { + if (strlen($PA['itemFormElValue']) > $this->charsPerRow * 2) { $cols = $this->maxTextareaWidth; - $rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue'])/$this->charsPerRow), count(explode(LF,$PA['itemFormElValue'])), 20); + $rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue']) / $this->charsPerRow), count(explode(LF, $PA['itemFormElValue'])), 20); - if ($rows<$origRows) $rows = $origRows; + if ($rows < $origRows) { + $rows = $origRows; - } + } + } - if (in_array('required', $evalList)) { + if (in_array('required', $evalList)) { $this->requiredFields[$table . '_' . $row['uid'] . '_' . $field] = $PA['itemFormElName']; } // Init RTE vars: - $RTEwasLoaded = 0; // Set true, if the RTE is loaded; If not a normal textarea is shown. + $RTEwasLoaded = 0; // Set true, if the RTE is loaded; If not a normal textarea is shown. - $RTEwouldHaveBeenLoaded = 0; // Set true, if the RTE would have been loaded if it wasn't for the disable-RTE flag in the bottom of the page... + $RTEwouldHaveBeenLoaded = 0; // Set true, if the RTE would have been loaded if it wasn't for the disable-RTE flag in the bottom of the page... // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found. $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']); // Setting up the altItem form field, which is a hidden field containing the value - $altItem = ''; + $altItem = ''; // If RTE is generally enabled (TYPO3_CONF_VARS and user settings) if ($this->RTEenabled) { $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']); - if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) { // If the field is configured for RTE and if any flag-field is not set to disable it. + if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) { // If the field is configured for RTE and if any flag-field is not set to disable it. - t3lib_BEfunc::fixVersioningPid($table,$row); + t3lib_BEfunc::fixVersioningPid($table, $row); - list($tscPID,$thePidValue) = $this->getTSCpid($table,$row['uid'],$row['pid']); + list($tscPID, $thePidValue) = $this->getTSCpid($table, $row['uid'], $row['pid']); // If the pid-value is not negative (that is, a pid could NOT be fetched) - if ($thePidValue >= 0) { + if ($thePidValue >= 0) { - $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID)); + $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($tscPID)); - $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row); + $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table, $row); - $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal); + $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal); - if (!$thisConfig['disabled']) { + if (!$thisConfig['disabled']) { - if (!$this->disableRTE) { + if (!$this->disableRTE) { $this->RTEcounter++; // Find alternative relative path for RTE images/links: @@ -1311,79 +1273,93 @@ // Get RTE object, draw form and set flag: $RTEobj = t3lib_BEfunc::RTEgetObj(); - $item = $RTEobj->drawRTE($this,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue); + $item = $RTEobj->drawRTE($this, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue); // Wizard: - $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf,1); + $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf, 1); $RTEwasLoaded = 1; } else { $RTEwouldHaveBeenLoaded = 1; - $this->commentMessages[] = $PA['itemFormElName'].': RTE is disabled by the on-page RTE-flag (probably you can enable it by the check-box in the bottom of this page!)'; + $this->commentMessages[] = $PA['itemFormElName'] . ': RTE is disabled by the on-page RTE-flag (probably you can enable it by the check-box in the bottom of this page!)'; } - } else $this->commentMessages[] = $PA['itemFormElName'].': RTE is disabled by the Page TSconfig, "RTE"-key (eg. by RTE.default.disabled=0 or such)'; - } else $this->commentMessages[] = $PA['itemFormElName'].': PID value could NOT be fetched. Rare error, normally with new records.'; - } else { + } else { - if (!isset($specConf['richtext'])) $this->commentMessages[] = $PA['itemFormElName'].': RTE was not configured for this field in TCA-types'; - if (!(!$p['flag'] || !$row[$p['flag']])) $this->commentMessages[] = $PA['itemFormElName'].': Field-flag ('.$PA['flag'].') has been set to disable RTE!'; + $this->commentMessages[] = $PA['itemFormElName'] . ': RTE is disabled by the Page TSconfig, "RTE"-key (eg. by RTE.default.disabled=0 or such)'; - } + } + } else { + $this->commentMessages[] = $PA['itemFormElName'] . ': PID value could NOT be fetched. Rare error, normally with new records.'; - } + } + } else { + if (!isset($specConf['richtext'])) { + $this->commentMessages[] = $PA['itemFormElName'] . ': RTE was not configured for this field in TCA-types'; + } + if (!(!$p['flag'] || !$row[$p['flag']])) { + $this->commentMessages[] = $PA['itemFormElName'] . ': Field-flag (' . $PA['flag'] . ') has been set to disable RTE!'; + } + } + } // Display ordinary field if RTE was not loaded. if (!$RTEwasLoaded) { - if ($specConf['rte_only']) { // Show message, if no RTE (field can only be edited with RTE!) + if ($specConf['rte_only']) { // Show message, if no RTE (field can only be edited with RTE!) - $item = '

'.htmlspecialchars($this->getLL('l_noRTEfound')).'

'; + $item = '

' . htmlspecialchars($this->getLL('l_noRTEfound')) . '

'; } else { - if ($specConf['nowrap']) { + if ($specConf['nowrap']) { $wrap = 'off'; } else { $wrap = ($config['wrap'] ? $config['wrap'] : 'virtual'); } $classes = array(); - if ($specConf['fixed-font']) { $classes[] = 'fixed-font'; } - if ($specConf['enable-tab']) { $classes[] = 'enable-tab'; } + if ($specConf['fixed-font']) { + $classes[] = 'fixed-font'; + } + if ($specConf['enable-tab']) { + $classes[] = 'enable-tab'; + } - $formWidthText = $this->formWidthText($cols,$wrap); + $formWidthText = $this->formWidthText($cols, $wrap); // Extract class attributes from $formWidthText (otherwise it would be added twice to the output) $res = array(); - if (preg_match('/ class="(.+?)"/',$formWidthText,$res)) { + if (preg_match('/ class="(.+?)"/', $formWidthText, $res)) { - $formWidthText = str_replace(' class="'.$res[1].'"','',$formWidthText); + $formWidthText = str_replace(' class="' . $res[1] . '"', '', $formWidthText); - $classes = array_merge($classes, explode(' ',$res[1])); + $classes = array_merge($classes, explode(' ', $res[1])); } - if (count($classes)) { + if (count($classes)) { - $class = ' class="tceforms-textarea '.implode(' ',$classes).'"'; + $class = ' class="tceforms-textarea ' . implode(' ', $classes) . '"'; - } else $class='tceforms-textarea'; + } else { + $class = 'tceforms-textarea'; + } - $evalList = t3lib_div::trimExplode(',',$config['eval'],1); + $evalList = t3lib_div::trimExplode(',', $config['eval'], 1); foreach ($evalList as $func) { switch ($func) { case 'required': - $this->registerRequiredProperty('field', $table.'_'.$row['uid'].'_'.$field, $PA['itemFormElName']); + $this->registerRequiredProperty('field', $table . '_' . $row['uid'] . '_' . $field, $PA['itemFormElName']); - break; + break; default: - if (substr($func, 0, 3) == 'tx_') { + if (substr($func, 0, 3) == 'tx_') { - // Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval() and t3lib_TCEmain::checkValue_text_Eval() + // Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval() and t3lib_TCEmain::checkValue_text_Eval() - $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func].':&'.$func); + $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func] . ':&' . $func); - if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue')) { + if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue')) { $_params = array( 'value' => $PA['itemFormElValue'] ); $PA['itemFormElValue'] = $evalObj->deevaluateFieldValue($_params); } } - break; + break; } } - $iOnChange = implode('',$PA['fieldChangeFunc']); + $iOnChange = implode('', $PA['fieldChangeFunc']); - $item.= ' + $item .= ' - '; + ''; - $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf,$RTEwouldHaveBeenLoaded); + $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf, $RTEwouldHaveBeenLoaded); } } @@ -1401,59 +1377,67 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeCheck($table,$field,$row,&$PA) { + function getSingleField_typeCheck($table, $field, $row, &$PA) { $config = $PA['fieldConf']['config']; $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // Traversing the array of items: $selItems = $this->initItemArray($PA['fieldConf']); - if ($config['itemsProcFunc']) $selItems = $this->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field); + if ($config['itemsProcFunc']) { + $selItems = $this->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field); + } - if (!count($selItems)) { + if (!count($selItems)) { - $selItems[]=array('',''); + $selItems[] = array('', ''); } $thisValue = intval($PA['itemFormElValue']); $cols = intval($config['cols']); - if ($cols > 1) { + if ($cols > 1) { - $item.= ''; + $item .= '
'; - for ($c=0;$ccheckBoxParams($PA['itemFormElName'],$thisValue,$c,count($selItems),implode('',$PA['fieldChangeFunc'])); + $cBP = $this->checkBoxParams($PA['itemFormElName'], $thisValue, $c, count($selItems), implode('', $PA['fieldChangeFunc'])); - $cBName = $PA['itemFormElName'].'_'.$c; + $cBName = $PA['itemFormElName'] . '_' . $c; - $cBID = $PA['itemFormElID'].'_'.$c; + $cBID = $PA['itemFormElID'] . '_' . $c; - $item.= ''; + ''; - if(($c%$cols)+1==$cols) {$item.='';} + if (($c % $cols) + 1 == $cols) { + $item .= ''; - } + } + } - if ($c%$cols) { + if ($c % $cols) { - $rest=$cols-($c%$cols); + $rest = $cols - ($c % $cols); - for ($c=0;$c<$rest;$c++) { + for ($c = 0; $c < $rest; $c++) { - $item.= ''; + $item .= ''; } - if ($c>0) { $item.= ''; } + if ($c > 0) { + $item .= ''; - } + } + } - $item.= '
'. + $item .= '' . - 'insertDefStyle('check').' value="1" name="'.$cBName.'"'.$cBP.$disabled.' id="'.$cBID.'" />'. + 'insertDefStyle('check') . ' value="1" name="' . $cBName . '"' . $cBP . $disabled . ' id="' . $cBID . '" />' . - $this->wrapLabels(' '). + $this->wrapLabels(' ') . - '
'; + $item .= ''; } else { - for ($c=0;$ccheckBoxParams($PA['itemFormElName'],$thisValue,$c,count($selItems),implode('',$PA['fieldChangeFunc'])); + $cBP = $this->checkBoxParams($PA['itemFormElName'], $thisValue, $c, count($selItems), implode('', $PA['fieldChangeFunc'])); - $cBName = $PA['itemFormElName'].'_'.$c; + $cBName = $PA['itemFormElName'] . '_' . $c; - $cBID = $PA['itemFormElID'].'_'.$c; + $cBID = $PA['itemFormElID'] . '_' . $c; - $item.= ($c>0?'
':''). + $item .= ($c > 0 ? '
' : '') . - 'insertDefStyle('check').' value="1" name="'.$cBName.'"'.$cBP.$PA['onFocus'].$disabled.' id="'.$cBID.'" />'. + 'insertDefStyle('check') . ' value="1" name="' . $cBName . '"' . $cBP . $PA['onFocus'] . $disabled . ' id="' . $cBID . '" />' . - $this->wrapLabels(''); + $this->wrapLabels(''); } } if (!$disabled) { - $item.= ''; + $item .= ''; } return $item; @@ -1469,26 +1453,28 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeRadio($table,$field,$row,&$PA) { + function getSingleField_typeRadio($table, $field, $row, &$PA) { $config = $PA['fieldConf']['config']; $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // Get items for the array: $selItems = $this->initItemArray($PA['fieldConf']); - if ($config['itemsProcFunc']) $selItems = $this->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field); + if ($config['itemsProcFunc']) { + $selItems = $this->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field); + } // Traverse the items, making the form elements: - for ($c=0;$cinsertDefStyle('radio').' name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($p[1]).'" onclick="'.htmlspecialchars($rOnClick).'"'.$rChecked.$PA['onFocus'].$disabled.' id="'.$rID.'" /> + $item .= 'insertDefStyle('radio') . ' name="' . $PA['itemFormElName'] . '" value="' . htmlspecialchars($p[1]) . '" onclick="' . htmlspecialchars($rOnClick) . '"' . $rChecked . $PA['onFocus'] . $disabled . ' id="' . $rID . '" /> - +
'; } @@ -1505,14 +1491,14 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeSelect($table,$field,$row,&$PA) { + function getSingleField_typeSelect($table, $field, $row, &$PA) { global $TCA; // Field configuration from TCA: $config = $PA['fieldConf']['config']; $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } @@ -1537,50 +1523,50 @@ } // Possibly remove some items: - $removeItems = t3lib_div::trimExplode(',',$PA['fieldTSConfig']['removeItems'],1); + $removeItems = t3lib_div::trimExplode(',', $PA['fieldTSConfig']['removeItems'], 1); - foreach($selItems as $tk => $p) { + foreach ($selItems as $tk => $p) { // Checking languages and authMode: $languageDeny = $TCA[$table]['ctrl']['languageField'] && !strcmp($TCA[$table]['ctrl']['languageField'], $field) && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]); - $authModeDeny = $config['form_type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table,$field,$p[1],$config['authMode']); + $authModeDeny = $config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $p[1], $config['authMode']); - if (in_array($p[1],$removeItems) || $languageDeny || $authModeDeny) { + if (in_array($p[1], $removeItems) || $languageDeny || $authModeDeny) { unset($selItems[$tk]); } elseif (isset($PA['fieldTSConfig']['altLabels.'][$p[1]])) { - $selItems[$tk][0]=$this->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]); + $selItems[$tk][0] = $this->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]); } // Removing doktypes with no access: if (($table === 'pages' || $table === 'pages_language_overlay') && $field === 'doktype') { - if (!($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['pagetypes_select'],$p[1]))) { + if (!($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['pagetypes_select'], $p[1]))) { unset($selItems[$tk]); } } } // Creating the label for the "No Matching Value" entry. - $nMV_label = isset($PA['fieldTSConfig']['noMatchingValue_label']) ? $this->sL($PA['fieldTSConfig']['noMatchingValue_label']) : '[ '.$this->getLL('l_noMatchingValue').' ]'; + $nMV_label = isset($PA['fieldTSConfig']['noMatchingValue_label']) ? $this->sL($PA['fieldTSConfig']['noMatchingValue_label']) : '[ ' . $this->getLL('l_noMatchingValue') . ' ]'; // Prepare some values: $maxitems = intval($config['maxitems']); // If a SINGLE selector box... - if ($maxitems<=1 && $config['renderMode'] !== 'tree') { + if ($maxitems <= 1 && $config['renderMode'] !== 'tree') { - $item = $this->getSingleField_typeSelect_single($table,$field,$row,$PA,$config,$selItems,$nMV_label); + $item = $this->getSingleField_typeSelect_single($table, $field, $row, $PA, $config, $selItems, $nMV_label); - } elseif (!strcmp($config['renderMode'],'checkbox')) { // Checkbox renderMode + } elseif (!strcmp($config['renderMode'], 'checkbox')) { // Checkbox renderMode - $item = $this->getSingleField_typeSelect_checkbox($table,$field,$row,$PA,$config,$selItems,$nMV_label); + $item = $this->getSingleField_typeSelect_checkbox($table, $field, $row, $PA, $config, $selItems, $nMV_label); - } elseif (!strcmp($config['renderMode'],'singlebox')) { // Single selector box renderMode + } elseif (!strcmp($config['renderMode'], 'singlebox')) { // Single selector box renderMode - $item = $this->getSingleField_typeSelect_singlebox($table,$field,$row,$PA,$config,$selItems,$nMV_label); + $item = $this->getSingleField_typeSelect_singlebox($table, $field, $row, $PA, $config, $selItems, $nMV_label); - } elseif (!strcmp($config['renderMode'],'tree')) { // Tree renderMode + } elseif (!strcmp($config['renderMode'], 'tree')) { // Tree renderMode $treeClass = t3lib_div::makeInstance('t3lib_TCEforms_Tree'); $item = $treeClass->renderField($table, $field, $row, $PA, $this); - } else { // Traditional multiple selector box: + } else { // Traditional multiple selector box: - $item = $this->getSingleField_typeSelect_multiple($table,$field,$row,$PA,$config,$selItems,$nMV_label); + $item = $this->getSingleField_typeSelect_multiple($table, $field, $row, $PA, $config, $selItems, $nMV_label); } // Wizards: if (!$disabled) { - $altItem = ''; + $altItem = ''; - $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf); + $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf); } return $item; @@ -1600,13 +1586,13 @@ * @return string The HTML code for the item * @see getSingleField_typeSelect() */ - function getSingleField_typeSelect_single($table,$field,$row,&$PA,$config,$selItems,$nMV_label) { + function getSingleField_typeSelect_single($table, $field, $row, &$PA, $config, $selItems, $nMV_label) { // check against inline uniqueness $inlineParent = $this->inline->getStructureLevel(-1); - if(is_array($inlineParent) && $inlineParent['uid']) { + if (is_array($inlineParent) && $inlineParent['uid']) { if ($inlineParent['config']['foreign_table'] == $table && $inlineParent['config']['foreign_unique'] == $field) { - $uniqueIds = $this->inline->inlineData['unique'][$this->inline->inlineNames['object'].'['.$table.']']['used']; + $uniqueIds = $this->inline->inlineData['unique'][$this->inline->inlineNames['object'] . '[' . $table . ']']['used']; - $PA['fieldChangeFunc']['inlineUnique'] = "inline.updateUnique(this,'".$this->inline->inlineNames['object'].'['.$table."]','".$this->inline->inlineNames['form']."','".$row['uid']."');"; + $PA['fieldChangeFunc']['inlineUnique'] = "inline.updateUnique(this,'" . $this->inline->inlineNames['object'] . '[' . $table . "]','" . $this->inline->inlineNames['form'] . "','" . $row['uid'] . "');"; } // hide uid of parent record for symmetric relations if ($inlineParent['config']['foreign_table'] == $table && ($inlineParent['config']['foreign_field'] == $field || $inlineParent['config']['symmetric_field'] == $field)) { @@ -1625,126 +1611,130 @@ $selectedStyle = ''; // Style set on '; // MUST be inserted before the selector - else is the value of the hiddenfield here mysteriously submitted... + $item .= ''; // MUST be inserted before the selector - else is the value of the hiddenfield here mysteriously submitted... } $item .= 'insertDefStyle('select', 'icon-select') : $this->insertDefStyle('select')) . - ($size ? ' size="' . $size . '"' : '') . - ' onchange="' . htmlspecialchars($onChangeIcon . $sOnChange) . '"' . - $PA['onFocus'] . $disabled . '>'; + ($config['iconsInOptionTags'] ? $this->insertDefStyle('select', 'icon-select') : $this->insertDefStyle('select')) . + ($size ? ' size="' . $size . '"' : '') . + ' onchange="' . htmlspecialchars($onChangeIcon . $sOnChange) . '"' . + $PA['onFocus'] . $disabled . '>'; - $item.= implode('',$opt); + $item .= implode('', $opt); - $item.= ''; + $item .= ''; // Create icon table: - if (count($selicons) && !$config['noIconsBelowSelect']) { + if (count($selicons) && !$config['noIconsBelowSelect']) { - $item.=''; + $item .= '
'; $selicon_cols = intval($config['selicon_cols']); - if (!$selicon_cols) $selicon_cols=count($selicons); + if (!$selicon_cols) { + $selicon_cols = count($selicons); + } - $sR = ceil(count($selicons)/$selicon_cols); + $sR = ceil(count($selicons) / $selicon_cols); - $selicons = array_pad($selicons,$sR*$selicon_cols,''); + $selicons = array_pad($selicons, $sR * $selicon_cols, ''); - for($sa=0;$sa<$sR;$sa++) { + for ($sa = 0; $sa < $sR; $sa++) { - $item.=''; + $item .= ''; - for($sb=0;$sb<$selicon_cols;$sb++) { + for ($sb = 0; $sb < $selicon_cols; $sb++) { - $sk=($sa*$selicon_cols+$sb); + $sk = ($sa * $selicon_cols + $sb); - $imgN = 'selIcon_'.$table.'_'.$row['uid'].'_'.$field.'_'.$selicons[$sk][1]; + $imgN = 'selIcon_' . $table . '_' . $row['uid'] . '_' . $field . '_' . $selicons[$sk][1]; - $imgS = ($selicons[$sk][2]?$this->backPath.'gfx/content_selected.gif':'clear.gif'); + $imgS = ($selicons[$sk][2] ? $this->backPath . 'gfx/content_selected.gif' : 'clear.gif'); - $item.=''; + $item .= ''; - $item.=''; + $item .= ''; } - $item.=''; + $item .= ''; } - $item.='
'.$selicons[$sk][0].'' . $selicons[$sk][0] . '
'; + $item .= ''; } return $item; @@ -1764,58 +1754,58 @@ * @return string The HTML code for the item * @see getSingleField_typeSelect() */ - function getSingleField_typeSelect_checkbox($table,$field,$row,&$PA,$config,$selItems,$nMV_label) { + function getSingleField_typeSelect_checkbox($table, $field, $row, &$PA, $config, $selItems, $nMV_label) { // Get values in an array (and make unique, which is fine because there can be no duplicates anyway): $itemArray = array_flip($this->extractValuesOnlyFromValueLabelList($PA['itemFormElValue'])); $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // Traverse the Array of selector box items: $tRows = array(); - $c=0; + $c = 0; if (!$disabled) { - $sOnChange = implode('',$PA['fieldChangeFunc']); + $sOnChange = implode('', $PA['fieldChangeFunc']); - $setAll = array(); // Used to accumulate the JS needed to restore the original selection. + $setAll = array(); // Used to accumulate the JS needed to restore the original selection. $unSetAll = array(); - foreach($selItems as $p) { + foreach ($selItems as $p) { // Non-selectable element: - if (!strcmp($p[1],'--div--')) { + if (!strcmp($p[1], '--div--')) { - if (count($setAll)) { + if (count($setAll)) { - $tRows[] = ' + $tRows[] = ' ' . - '' . + '' . - htmlspecialchars($this->getLL('l_checkAll')) . - ' + htmlspecialchars($this->getLL('l_checkAll')) . + ' - ' . + ' . - htmlspecialchars($this->getLL('l_uncheckAll')) . - ' + htmlspecialchars($this->getLL('l_uncheckAll')) . + ' '; - $setAll = array(); - $unSetAll = array(); + $setAll = array(); + $unSetAll = array(); } $tRows[] = ' - '.htmlspecialchars($p[0]).' + ' . htmlspecialchars($p[0]) . ' '; } else { // Selected or not by default: $sM = ''; - if (isset($itemArray[$p[1]])) { + if (isset($itemArray[$p[1]])) { $sM = ' checked="checked"'; unset($itemArray[$p[1]]); } // Icon: $selIconFile = ''; - if ($p[2]) { + if ($p[2]) { - list($selIconFile,$selIconInfo) = $this->getIcon($p[2]); + list($selIconFile, $selIconInfo) = $this->getIcon($p[2]); } // Compile row: @@ -1824,20 +1814,20 @@ $onClick = 'this.attributes.getNamedItem("class").nodeValue = ' . $this->elName($PA['itemFormElName'] . '[' . $c . ']') . '.checked ? "c-selectedItem" : "c-unselectedItem";'; $setAll[] = $this->elName($PA['itemFormElName'] . '[' . $c . ']') . '.checked=1;'; $setAll[] .= '$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');$(\'' . $rowId . '\').addClassName(\'c-selectedItem\');'; - $unSetAll[] = $this->elName($PA['itemFormElName'].'['.$c.']').'.checked=0;'; + $unSetAll[] = $this->elName($PA['itemFormElName'] . '[' . $c . ']') . '.checked=0;'; $unSetAll[] .= '$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').addClassName(\'c-unselectedItem\');'; $restoreCmd[] = $this->elName($PA['itemFormElName'] . '[' . $c . ']') . '.checked=' . ($sM ? 1 : 0) . ';' . - '$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');' . - '$(\'' . $rowId . '\').addClassName(\'c-' . ($sM ? '' : 'un') . 'selectedItem\');'; + '$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');' . + '$(\'' . $rowId . '\').addClassName(\'c-' . ($sM ? '' : 'un') . 'selectedItem\');'; - $hasHelp = ($p[3] !=''); + $hasHelp = ($p[3] != ''); $label = t3lib_div::deHSCentities(htmlspecialchars($p[0])); $help = $hasHelp ? '' . $label . '' . - '' . $GLOBALS['LANG']->hscAndCharConv(nl2br(trim(htmlspecialchars($p[3]))), false) . '' : ''; + '' . $GLOBALS['LANG']->hscAndCharConv(nl2br(trim(htmlspecialchars($p[3]))), false) . '
' : ''; if ($hasHelp && $this->edit_showFieldHelp == 'icon') { - $helpIcon = ''; + $helpIcon = ''; $helpIcon .= t3lib_iconWorks::getSpriteIcon('actions-system-help-open'); $helpIcon .= $help; $helpIcon .= ''; @@ -1845,61 +1835,61 @@ } $tRows[] = ' - + - insertDefStyle('check').' name="'.htmlspecialchars($PA['itemFormElName'].'['.$c.']').'" value="'.htmlspecialchars($p[1]).'"'.$sM.' onclick="'.htmlspecialchars($sOnChange).'"'.$PA['onFocus'].' /> + insertDefStyle('check') . ' name="' . htmlspecialchars($PA['itemFormElName'] . '[' . $c . ']') . '" value="' . htmlspecialchars($p[1]) . '"' . $sM . ' onclick="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . ' /> - '. + ' . - ($selIconFile ? '' : ''). + ($selIconFile ? '' : '') . - $label . - ' + $label . + ' - ' . (strcmp($p[3],'') ? $help : '') . ' + ' . (strcmp($p[3], '') ? $help : '') . ' '; $c++; } } // Remaining checkboxes will get their set-all link: - if (count($setAll)) { + if (count($setAll)) { - $tRows[] = ' + $tRows[] = ' - '. + ' . - '' . + '' . - htmlspecialchars($this->getLL('l_checkAll')) . - ' + htmlspecialchars($this->getLL('l_checkAll')) . + ' - ' . + ' . - htmlspecialchars($this->getLL('l_uncheckAll')) . - ' + htmlspecialchars($this->getLL('l_uncheckAll')) . + ' '; } } // Remaining values (invalid): - if (count($itemArray) && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { + if (count($itemArray) && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { - foreach($itemArray as $theNoMatchValue => $temp) { + foreach ($itemArray as $theNoMatchValue => $temp) { // Compile tag: - array_unshift($tRows,' + array_unshift($tRows, ' - insertDefStyle('check').' name="'.htmlspecialchars($PA['itemFormElName'].'['.$c.']').'" value="'.htmlspecialchars($theNoMatchValue).'" checked="checked" onclick="'.htmlspecialchars($sOnChange).'"'.$PA['onFocus'].$disabled.' /> + insertDefStyle('check') . ' name="' . htmlspecialchars($PA['itemFormElName'] . '[' . $c . ']') . '" value="' . htmlspecialchars($theNoMatchValue) . '" checked="checked" onclick="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . $disabled . ' /> - '. + ' . - t3lib_div::deHSCentities(htmlspecialchars(@sprintf($nMV_label, $theNoMatchValue))). + t3lib_div::deHSCentities(htmlspecialchars(@sprintf($nMV_label, $theNoMatchValue))) . - '  + '  '); $c++; } } // Add an empty hidden field which will send a blank value if all items are unselected. - $item .= ''; + $item .= ''; // Add revert icon if (is_array($restoreCmd)) { - $item .= '' . + $item .= '' . - t3lib_iconWorks::getSpriteIcon('actions-edit-undo', array('title' => htmlspecialchars($this->getLL('l_revertSelection')))) . ''; + t3lib_iconWorks::getSpriteIcon('actions-edit-undo', array('title' => htmlspecialchars($this->getLL('l_revertSelection')))) . ''; } // Implode rows in table: $item .= ' - '. +
' . - implode('',$tRows).' + implode('', $tRows) . '
'; @@ -1920,32 +1910,32 @@ * @return string The HTML code for the item * @see getSingleField_typeSelect() */ - function getSingleField_typeSelect_singlebox($table,$field,$row,&$PA,$config,$selItems,$nMV_label) { + function getSingleField_typeSelect_singlebox($table, $field, $row, &$PA, $config, $selItems, $nMV_label) { // Get values in an array (and make unique, which is fine because there can be no duplicates anyway): $itemArray = array_flip($this->extractValuesOnlyFromValueLabelList($PA['itemFormElValue'])); $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // Traverse the Array of selector box items: $opt = array(); - $restoreCmd = array(); // Used to accumulate the JS needed to restore the original selection. + $restoreCmd = array(); // Used to accumulate the JS needed to restore the original selection. $c = 0; - foreach($selItems as $p) { + foreach ($selItems as $p) { // Selected or not by default: $sM = ''; - if (isset($itemArray[$p[1]])) { + if (isset($itemArray[$p[1]])) { $sM = ' selected="selected"'; - $restoreCmd[] = $this->elName($PA['itemFormElName'].'[]').'.options['.$c.'].selected=1;'; + $restoreCmd[] = $this->elName($PA['itemFormElName'] . '[]') . '.options[' . $c . '].selected=1;'; unset($itemArray[$p[1]]); } // Non-selectable element: $nonSel = ''; - if (!strcmp($p[1],'--div--')) { + if (!strcmp($p[1], '--div--')) { $nonSel = ' onclick="this.selected=0;" class="c-divider"'; } @@ -1955,59 +1945,59 @@ } // Compile '; + '>' . t3lib_div::deHSCentities(htmlspecialchars($p[0])) . ''; $c++; } // Remaining values: - if (count($itemArray) && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { + if (count($itemArray) && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { - foreach($itemArray as $theNoMatchValue => $temp) { + foreach ($itemArray as $theNoMatchValue => $temp) { // Compile '); + array_unshift($opt, ''); } } // Compile selector box: - $sOnChange = implode('',$PA['fieldChangeFunc']); + $sOnChange = implode('', $PA['fieldChangeFunc']); - $selector_itemListStyle = isset($config['itemListStyle']) ? ' style="'.htmlspecialchars($config['itemListStyle']).'"' : ' style="'.$this->defaultMultipleSelectorStyle.'"'; + $selector_itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"'; $size = intval($config['size']); - $size = $config['autoSizeMax'] ? t3lib_div::intInRange(count($selItems)+1,t3lib_div::intInRange($size,1),$config['autoSizeMax']) : $size; + $size = $config['autoSizeMax'] ? t3lib_div::intInRange(count($selItems) + 1, t3lib_div::intInRange($size, 1), $config['autoSizeMax']) : $size; - $selectBox = ''; // Add an empty hidden field which will send a blank value if all items are unselected. if (!$disabled) { - $item.=''; + $item .= ''; } // Put it all into a table: - $item.= ' + $item .= '
- '.$selectBox.' + ' . $selectBox . '
- '. + ' . - htmlspecialchars($this->getLL('l_holdDownCTRL')). + htmlspecialchars($this->getLL('l_holdDownCTRL')) . - ' + '
- ' . + ' . - t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . - ' + t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . + '
@@ -2030,28 +2020,30 @@ * @return string The HTML code for the item * @see getSingleField_typeSelect() */ - function getSingleField_typeSelect_multiple($table,$field,$row,&$PA,$config,$selItems,$nMV_label) { + function getSingleField_typeSelect_multiple($table, $field, $row, &$PA, $config, $selItems, $nMV_label) { $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // Setting this hidden field (as a flag that JavaScript can read out) if (!$disabled) { - $item.= ''; + $item .= ''; } // Set max and min items: - $maxitems = t3lib_div::intInRange($config['maxitems'],0); + $maxitems = t3lib_div::intInRange($config['maxitems'], 0); - if (!$maxitems) $maxitems=100000; + if (!$maxitems) { + $maxitems = 100000; + } - $minitems = t3lib_div::intInRange($config['minitems'],0); + $minitems = t3lib_div::intInRange($config['minitems'], 0); // Register the required number of elements: - $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems,$maxitems,'imgName'=>$table.'_'.$row['uid'].'_'.$field)); + $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field)); // Get "removeItems": - $removeItems = t3lib_div::trimExplode(',',$PA['fieldTSConfig']['removeItems'],1); + $removeItems = t3lib_div::trimExplode(',', $PA['fieldTSConfig']['removeItems'], 1); // Get the array with selected items: $itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); @@ -2061,11 +2053,11 @@ $itemArray = t3lib_div::keepItemsInArray($itemArray, $PA['fieldTSConfig']['keepItems'], $keepItemsFunc); // Perform modification of the selected items array: - foreach($itemArray as $tk => $tv) { + foreach ($itemArray as $tk => $tv) { - $tvP = explode('|',$tv,2); + $tvP = explode('|', $tv, 2); $evalValue = $tvP[0]; - $isRemoved = in_array($evalValue,$removeItems) || ($config['form_type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table,$field,$evalValue,$config['authMode'])); + $isRemoved = in_array($evalValue, $removeItems) || ($config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $evalValue, $config['authMode'])); - if ($isRemoved && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { + if ($isRemoved && !$PA['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) { $tvP[1] = rawurlencode(@sprintf($nMV_label, $evalValue)); } elseif (isset($PA['fieldTSConfig']['altLabels.'][$evalValue])) { $tvP[1] = rawurlencode($this->sL($PA['fieldTSConfig']['altLabels.'][$evalValue])); @@ -2079,62 +2071,62 @@ } } } - $itemArray[$tk] = implode('|',$tvP); + $itemArray[$tk] = implode('|', $tvP); } $itemsToSelect = ''; - if(!$disabled) { + if (!$disabled) { // Create option tags: $opt = array(); $styleAttrValue = ''; - foreach($selItems as $p) { + foreach ($selItems as $p) { - if ($config['iconsInOptionTags']) { + if ($config['iconsInOptionTags']) { $styleAttrValue = $this->optionTagStyle($p[2]); } - $opt[]= ''; + '>' . $p[0] . ''; } // Put together the selector box: - $selector_itemListStyle = isset($config['itemListStyle']) ? ' style="'.htmlspecialchars($config['itemListStyle']).'"' : ' style="'.$this->defaultMultipleSelectorStyle.'"'; + $selector_itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"'; $size = intval($config['size']); - $size = $config['autoSizeMax'] ? t3lib_div::intInRange(count($itemArray)+1,t3lib_div::intInRange($size,1),$config['autoSizeMax']) : $size; + $size = $config['autoSizeMax'] ? t3lib_div::intInRange(count($itemArray) + 1, t3lib_div::intInRange($size, 1), $config['autoSizeMax']) : $size; - if ($config['exclusiveKeys']) { + if ($config['exclusiveKeys']) { - $sOnChange = 'setFormValueFromBrowseWin(\''.$PA['itemFormElName'].'\',this.options[this.selectedIndex].value,this.options[this.selectedIndex].text,\''.$config['exclusiveKeys'].'\'); '; + $sOnChange = 'setFormValueFromBrowseWin(\'' . $PA['itemFormElName'] . '\',this.options[this.selectedIndex].value,this.options[this.selectedIndex].text,\'' . $config['exclusiveKeys'] . '\'); '; } else { - $sOnChange = 'setFormValueFromBrowseWin(\''.$PA['itemFormElName'].'\',this.options[this.selectedIndex].value,this.options[this.selectedIndex].text); '; + $sOnChange = 'setFormValueFromBrowseWin(\'' . $PA['itemFormElName'] . '\',this.options[this.selectedIndex].value,this.options[this.selectedIndex].text); '; } - $sOnChange .= implode('',$PA['fieldChangeFunc']); + $sOnChange .= implode('', $PA['fieldChangeFunc']); $itemsToSelect = ' - '; } // Pass to "dbFileIcons" function: $params = array( 'size' => $size, - 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'],0), + 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), - 'style' => isset($config['selectedListStyle']) ? ' style="'.htmlspecialchars($config['selectedListStyle']).'"' : ' style="'.$this->defaultMultipleSelectorStyle.'"', + 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', - 'dontShowMoveIcons' => ($maxitems<=1), + 'dontShowMoveIcons' => ($maxitems <= 1), 'maxitems' => $maxitems, 'info' => '', 'headers' => array( - 'selector' => $this->getLL('l_selected').':
', + 'selector' => $this->getLL('l_selected') . ':
', - 'items' => $this->getLL('l_items').':
' + 'items' => $this->getLL('l_items') . ':
' ), 'noBrowser' => 1, 'thumbnails' => $itemsToSelect, 'readOnly' => $disabled ); - $item.= $this->dbFileIcons($PA['itemFormElName'],'','',$itemArray,'',$params,$PA['onFocus']); + $item .= $this->dbFileIcons($PA['itemFormElName'], '', '', $itemArray, '', $params, $PA['onFocus']); return $item; } @@ -2149,63 +2141,69 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeGroup($table,$field,$row,&$PA) { + function getSingleField_typeGroup($table, $field, $row, &$PA) { // Init: $config = $PA['fieldConf']['config']; $internal_type = $config['internal_type']; $show_thumbs = $config['show_thumbs']; $size = intval($config['size']); - $maxitems = t3lib_div::intInRange($config['maxitems'],0); + $maxitems = t3lib_div::intInRange($config['maxitems'], 0); - if (!$maxitems) $maxitems=100000; + if (!$maxitems) { + $maxitems = 100000; + } - $minitems = t3lib_div::intInRange($config['minitems'],0); + $minitems = t3lib_div::intInRange($config['minitems'], 0); $allowed = trim($config['allowed']); $disallowed = trim($config['disallowed']); $disabled = ''; - if($this->renderReadonly || $config['readOnly']) { + if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } - $item.= ''; + $item .= ''; - $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems,$maxitems,'imgName'=>$table.'_'.$row['uid'].'_'.$field)); + $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field)); - $info=''; + $info = ''; // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. See http://typo3.org/documentation/document-library/doc_core_api/Wizards_Configuratio/. $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']); // Acting according to either "file" or "db" type: - switch((string)$config['internal_type']) { + switch ((string) $config['internal_type']) { case 'file_reference': $config['uploadfolder'] = ''; // Fall through - case 'file': // If the element is of the internal type "file": + case 'file': // If the element is of the internal type "file": // Creating string showing allowed types: - $tempFT = t3lib_div::trimExplode(',',$allowed,1); + $tempFT = t3lib_div::trimExplode(',', $allowed, 1); - if (!count($tempFT)) {$info.='*';} + if (!count($tempFT)) { + $info .= '*'; + } - foreach($tempFT as $ext) { + foreach ($tempFT as $ext) { - if ($ext) { + if ($ext) { - $info.=strtoupper($ext).' '; + $info .= strtoupper($ext) . ' '; } } // Creating string, showing disallowed types: - $tempFT_dis = t3lib_div::trimExplode(',',$disallowed,1); + $tempFT_dis = t3lib_div::trimExplode(',', $disallowed, 1); - if (count($tempFT_dis)) {$info.='
';} + if (count($tempFT_dis)) { + $info .= '
'; + } - foreach($tempFT_dis as $ext) { + foreach ($tempFT_dis as $ext) { - if ($ext) { + if ($ext) { - $info.='-'.strtoupper($ext).' '; + $info .= '-' . strtoupper($ext) . ' '; } } // Making the array of file items: - $itemArray = t3lib_div::trimExplode(',',$PA['itemFormElValue'],1); + $itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); // Showing thumbnails: $thumbsnail = ''; - if ($show_thumbs) { + if ($show_thumbs) { $imgs = array(); - foreach($itemArray as $imgRead) { + foreach ($itemArray as $imgRead) { - $imgP = explode('|',$imgRead); + $imgP = explode('|', $imgRead); $imgPath = rawurldecode($imgP[0]); $rowCopy = array(); @@ -2218,48 +2216,48 @@ $fileIcon = t3lib_iconWorks::getSpriteIconForFile( strtolower($fI['extension']), array( - 'title' => htmlspecialchars( - $fI['basename'] . - ($absFilePath && @is_file($absFilePath) - ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : - ' - FILE NOT FOUND!' - ) - ) + 'title' => htmlspecialchars( + $fI['basename'] . + ($absFilePath && @is_file($absFilePath) + ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : + ' - FILE NOT FOUND!' + ) + ) ) ); - $imgs[] = ''.t3lib_BEfunc::thumbCode($rowCopy,$table,$field,$this->backPath,'thumbs.php',$config['uploadfolder'],0,' align="middle"'). + $imgs[] = '' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['uploadfolder'], 0, ' align="middle"') . - ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon). + ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . - $imgPath. + $imgPath . - ''; + ''; } - $thumbsnail = implode('
',$imgs); + $thumbsnail = implode('
', $imgs); } // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array( 'size' => $size, - 'dontShowMoveIcons' => ($maxitems<=1), + 'dontShowMoveIcons' => ($maxitems <= 1), - 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'],0), + 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, - 'style' => isset($config['selectedListStyle']) ? ' style="'.htmlspecialchars($config['selectedListStyle']).'"' : ' style="'.$this->defaultMultipleSelectorStyle.'"', + 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', 'info' => $info, 'thumbnails' => $thumbsnail, 'readOnly' => $disabled, 'noBrowser' => $noList || (isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser')), 'noList' => $noList, ); - $item.= $this->dbFileIcons($PA['itemFormElName'],'file',implode(',',$tempFT),$itemArray,'',$params,$PA['onFocus']); + $item .= $this->dbFileIcons($PA['itemFormElName'], 'file', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus']); - if(!$disabled && !(isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'upload'))) { + if (!$disabled && !(isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'upload'))) { // Adding the upload field: if ($this->edit_docModuleUpload && $config['uploadfolder']) { $item .= ''; } } break; - case 'folder': // If the element is of the internal type "folder": + case 'folder': // If the element is of the internal type "folder": // array of folder items: $itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); @@ -2267,20 +2265,20 @@ // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array( - 'size' => $size, + 'size' => $size, 'dontShowMoveIcons' => ($maxitems <= 1), - 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), + 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), - 'maxitems' => $maxitems, + 'maxitems' => $maxitems, - 'style' => isset($config['selectedListStyle']) ? + 'style' => isset($config['selectedListStyle']) ? - ' style="'.htmlspecialchars($config['selectedListStyle']).'"' + ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' - : ' style="'.$this->defaultMultipleSelectorStyle.'"', + : ' style="' . $this->defaultMultipleSelectorStyle . '"', - 'info' => $info, + 'info' => $info, - 'readOnly' => $disabled, + 'readOnly' => $disabled, 'noBrowser' => $noList || (isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser')), 'noList' => $noList, ); - $item.= $this->dbFileIcons( + $item .= $this->dbFileIcons( $PA['itemFormElName'], 'folder', '', @@ -2290,22 +2288,22 @@ $PA['onFocus'] ); break; - case 'db': // If the element is of the internal type "db": + case 'db': // If the element is of the internal type "db": // Creating string showing allowed types: - $tempFT = t3lib_div::trimExplode(',', $allowed, true); + $tempFT = t3lib_div::trimExplode(',', $allowed, TRUE); if (!strcmp(trim($tempFT[0]), '*')) { $onlySingleTableAllowed = false; - $info.='    '. + $info .= '    ' . - htmlspecialchars($this->getLL('l_allTables')). + htmlspecialchars($this->getLL('l_allTables')) . - '
'; + '

'; } elseif ($tempFT) { $onlySingleTableAllowed = (count($tempFT) == 1); foreach ($tempFT as $theT) { - $info.= '    ' . + $info .= '    ' . - t3lib_iconWorks::getSpriteIconForRecord($theT, array()) . - htmlspecialchars($this->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . - '
'; + t3lib_iconWorks::getSpriteIconForRecord($theT, array()) . + htmlspecialchars($this->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . + '

'; } } @@ -2314,63 +2312,63 @@ $imgs = array(); // Thumbnails: - $temp_itemArray = t3lib_div::trimExplode(',',$PA['itemFormElValue'],1); + $temp_itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); - foreach($temp_itemArray as $dbRead) { + foreach ($temp_itemArray as $dbRead) { - $recordParts = explode('|',$dbRead); + $recordParts = explode('|', $dbRead); - list($this_table,$this_uid) = t3lib_BEfunc::splitTable_Uid($recordParts[0]); + list($this_table, $this_uid) = t3lib_BEfunc::splitTable_Uid($recordParts[0]); - // For the case that no table was found and only a single table is defined to be allowed, use that one: + // For the case that no table was found and only a single table is defined to be allowed, use that one: if (!$this_table && $onlySingleTableAllowed) { $this_table = $allowed; } - $itemArray[] = array('table'=>$this_table, 'id'=>$this_uid); + $itemArray[] = array('table' => $this_table, 'id' => $this_uid); - if (!$disabled && $show_thumbs) { + if (!$disabled && $show_thumbs) { - $rr = t3lib_BEfunc::getRecordWSOL($this_table,$this_uid); + $rr = t3lib_BEfunc::getRecordWSOL($this_table, $this_uid); - $imgs[] = ''. + $imgs[] = '' . - $this->getClickMenu( - t3lib_iconWorks::getSpriteIconForRecord( - $this_table, - $rr, - array( - 'style' => 'vertical-align:top', - 'title' => htmlspecialchars(t3lib_BEfunc::getRecordPath($rr['pid'], $perms_clause, 15) . ' [UID: ' . $rr['uid'] . ']') - ) - ), - $this_table, - $this_uid - ) . + $this->getClickMenu( + t3lib_iconWorks::getSpriteIconForRecord( + $this_table, + $rr, + array( + 'style' => 'vertical-align:top', + 'title' => htmlspecialchars(t3lib_BEfunc::getRecordPath($rr['pid'], $perms_clause, 15) . ' [UID: ' . $rr['uid'] . ']') + ) + ), + $this_table, + $this_uid + ) . - ' '. + ' ' . - t3lib_BEfunc::getRecordTitle($this_table,$rr,TRUE).' ['.$rr['uid'].']'. + t3lib_BEfunc::getRecordTitle($this_table, $rr, TRUE) . ' [' . $rr['uid'] . ']' . - ''; + ''; } } - $thumbsnail=''; + $thumbsnail = ''; - if (!$disabled && $show_thumbs) { + if (!$disabled && $show_thumbs) { - $thumbsnail = implode('
',$imgs); + $thumbsnail = implode('
', $imgs); } // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array( 'size' => $size, - 'dontShowMoveIcons' => ($maxitems<=1), + 'dontShowMoveIcons' => ($maxitems <= 1), - 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'],0), + 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, - 'style' => isset($config['selectedListStyle']) ? ' style="'.htmlspecialchars($config['selectedListStyle']).'"' : ' style="'.$this->defaultMultipleSelectorStyle.'"', + 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', 'info' => $info, 'thumbnails' => $thumbsnail, 'readOnly' => $disabled, 'noBrowser' => $noList || (isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser')), 'noList' => $noList, ); - $item.= $this->dbFileIcons($PA['itemFormElName'],'db',implode(',',$tempFT),$itemArray,'',$params,$PA['onFocus'],$table,$field,$row['uid']); + $item .= $this->dbFileIcons($PA['itemFormElName'], 'db', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus'], $table, $field, $row['uid']); break; } // Wizards: - $altItem = ''; + $altItem = ''; if (!$disabled) { - $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf); + $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf); } return $item; @@ -2386,12 +2384,12 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeNone($table,$field,$row,&$PA) { + function getSingleField_typeNone($table, $field, $row, &$PA) { // Init: $config = $PA['fieldConf']['config']; $itemValue = $PA['itemFormElValue']; - return $this->getSingleField_typeNone_render($config,$itemValue); + return $this->getSingleField_typeNone_render($config, $itemValue); } /** @@ -2402,54 +2400,60 @@ * @return string The HTML code for the display * @see getSingleField_typeNone(); */ - function getSingleField_typeNone_render($config,$itemValue) { + function getSingleField_typeNone_render($config, $itemValue) { - // is colorScheme[0] the right value? + // is colorScheme[0] the right value? - $divStyle = 'border:solid 1px '.t3lib_div::modifyHTMLColorAll($this->colorScheme[0],-30).';'.$this->defStyle.$this->formElStyle('none').' background-color: '.$this->colorScheme[0].'; padding-left:1px;color:#555;'; + $divStyle = 'border:solid 1px ' . t3lib_div::modifyHTMLColorAll($this->colorScheme[0], -30) . ';' . $this->defStyle . $this->formElStyle('none') . ' background-color: ' . $this->colorScheme[0] . '; padding-left:1px;color:#555;'; - if ($config['format']) { + if ($config['format']) { $itemValue = $this->formatValue($config, $itemValue); } $rows = intval($config['rows']); if ($rows > 1) { - if(!$config['pass_content']) { + if (!$config['pass_content']) { $itemValue = nl2br(htmlspecialchars($itemValue)); } // like textarea $cols = t3lib_div::intInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth); if (!$config['fixedRows']) { $origRows = $rows = t3lib_div::intInRange($rows, 1, 20); - if (strlen($itemValue)>$this->charsPerRow*2) { + if (strlen($itemValue) > $this->charsPerRow * 2) { $cols = $this->maxTextareaWidth; - $rows = t3lib_div::intInRange(round(strlen($itemValue)/$this->charsPerRow),count(explode(LF,$itemValue)),20); + $rows = t3lib_div::intInRange(round(strlen($itemValue) / $this->charsPerRow), count(explode(LF, $itemValue)), 20); - if ($rows<$origRows) $rows=$origRows; + if ($rows < $origRows) { + $rows = $origRows; - } - } + } + } + } - if ($this->docLarge) $cols = round($cols*$this->form_largeComp); + if ($this->docLarge) { + $cols = round($cols * $this->form_largeComp); + } - $width = ceil($cols*$this->form_rowsToStylewidth); + $width = ceil($cols * $this->form_rowsToStylewidth); // hardcoded: 12 is the height of the font - $height=$rows*12; + $height = $rows * 12; - $item=' + $item = ' -
'. +
' . - $itemValue. + $itemValue . - '
'; + '
'; } else { - if(!$config['pass_content']) { + if (!$config['pass_content']) { $itemValue = htmlspecialchars($itemValue); } - $cols = $config['cols']?$config['cols']:($config['size']?$config['size']:$this->maxInputWidth); + $cols = $config['cols'] ? $config['cols'] : ($config['size'] ? $config['size'] : $this->maxInputWidth); - if ($this->docLarge) $cols = round($cols*$this->form_largeComp); + if ($this->docLarge) { + $cols = round($cols * $this->form_largeComp); + } - $width = ceil($cols*$this->form_rowsToStylewidth); + $width = ceil($cols * $this->form_rowsToStylewidth); // overflow:auto crashes mozilla here. Title tag is usefull when text is longer than the div box (overflow:hidden). $item = ' -
'. +
' . - ''.(strcmp($itemValue,'')?$itemValue:' ').''. + '' . (strcmp($itemValue, '') ? $itemValue : ' ') . '' . - '
'; + '
'; } return $item; @@ -2464,10 +2468,10 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeFlex($table,$field,$row,&$PA) { + function getSingleField_typeFlex($table, $field, $row, &$PA) { // Data Structure: - $dataStructArray = t3lib_BEfunc::getFlexFormDS($PA['fieldConf']['config'],$row,$table); + $dataStructArray = t3lib_BEfunc::getFlexFormDS($PA['fieldConf']['config'], $row, $table); // Manipulate Flexform DS via TSConfig and group access lists if (is_array($dataStructArray)) { @@ -2477,46 +2481,47 @@ } // Get data structure: - if (is_array($dataStructArray)) { + if (is_array($dataStructArray)) { // Get data: $xmlData = $PA['itemFormElValue']; $xmlHeaderAttributes = t3lib_div::xmlGetHeaderAttribs($xmlData); $storeInCharset = strtolower($xmlHeaderAttributes['encoding']); - if ($storeInCharset) { + if ($storeInCharset) { - $currentCharset=$GLOBALS['LANG']->charSet; + $currentCharset = $GLOBALS['LANG']->charSet; - $xmlData = $GLOBALS['LANG']->csConvObj->conv($xmlData,$storeInCharset,$currentCharset,1); + $xmlData = $GLOBALS['LANG']->csConvObj->conv($xmlData, $storeInCharset, $currentCharset, 1); } - $editData=t3lib_div::xml2array($xmlData); + $editData = t3lib_div::xml2array($xmlData); - if (!is_array($editData)) { // Must be XML parsing error... + if (!is_array($editData)) { // Must be XML parsing error... - $editData=array(); + $editData = array(); - } elseif (!isset($editData['meta']) || !is_array($editData['meta'])) { + } elseif (!isset($editData['meta']) || !is_array($editData['meta'])) { $editData['meta'] = array(); } // Find the data structure if sheets are found: - $sheet = $editData['meta']['currentSheetId'] ? $editData['meta']['currentSheetId'] : 'sDEF'; // Sheet to display + $sheet = $editData['meta']['currentSheetId'] ? $editData['meta']['currentSheetId'] : 'sDEF'; // Sheet to display // Create sheet menu: + //TODO; Why is this commented out? -// if (is_array($dataStructArray['sheets'])) { -// #$item.=$this->getSingleField_typeFlex_sheetMenu($dataStructArray['sheets'], $PA['itemFormElName'].'[meta][currentSheetId]', $sheet).'
'; -// } + // if (is_array($dataStructArray['sheets'])) { + // #$item.=$this->getSingleField_typeFlex_sheetMenu($dataStructArray['sheets'], $PA['itemFormElName'].'[meta][currentSheetId]', $sheet).'
'; + // } // Create language menu: $langChildren = $dataStructArray['meta']['langChildren'] ? 1 : 0; $langDisabled = $dataStructArray['meta']['langDisable'] ? 1 : 0; - $editData['meta']['currentLangId']=array(); + $editData['meta']['currentLangId'] = array(); // Look up page overlays: - $checkPageLanguageOverlay = $GLOBALS['BE_USER']->getTSConfigVal('options.checkPageLanguageOverlay')?TRUE:FALSE; + $checkPageLanguageOverlay = $GLOBALS['BE_USER']->getTSConfigVal('options.checkPageLanguageOverlay') ? TRUE : FALSE; - if ($checkPageLanguageOverlay) { + if ($checkPageLanguageOverlay) { $pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( '*', 'pages_language_overlay', - 'pid='.intval($row['pid']). + 'pid=' . intval($row['pid']) . - t3lib_BEfunc::deleteClause('pages_language_overlay'). + t3lib_BEfunc::deleteClause('pages_language_overlay') . - t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'), + t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'), '', '', '', @@ -2525,82 +2530,81 @@ } $languages = $this->getAvailableLanguages(); - foreach($languages as $lInfo) { + foreach ($languages as $lInfo) { - if ($GLOBALS['BE_USER']->checkLanguageAccess($lInfo['uid']) && (!$checkPageLanguageOverlay || $lInfo['uid']<=0 || is_array($pageOverlays[$lInfo['uid']]))) { + if ($GLOBALS['BE_USER']->checkLanguageAccess($lInfo['uid']) && (!$checkPageLanguageOverlay || $lInfo['uid'] <= 0 || is_array($pageOverlays[$lInfo['uid']]))) { - $editData['meta']['currentLangId'][] = $lInfo['ISOcode']; + $editData['meta']['currentLangId'][] = $lInfo['ISOcode']; } } - if (!is_array($editData['meta']['currentLangId']) || !count($editData['meta']['currentLangId'])) { + if (!is_array($editData['meta']['currentLangId']) || !count($editData['meta']['currentLangId'])) { - $editData['meta']['currentLangId']=array('DEF'); + $editData['meta']['currentLangId'] = array('DEF'); } $editData['meta']['currentLangId'] = array_unique($editData['meta']['currentLangId']); - + //TODO: Why is this commented out? -// if (!$langDisabled && count($languages) > 1) { -// $item.=$this->getSingleField_typeFlex_langMenu($languages, $PA['itemFormElName'].'[meta][currentLangId]', $editData['meta']['currentLangId']).'
'; -// } + // if (!$langDisabled && count($languages) > 1) { + // $item.=$this->getSingleField_typeFlex_langMenu($languages, $PA['itemFormElName'].'[meta][currentLangId]', $editData['meta']['currentLangId']).'
'; + // } $PA['_noEditDEF'] = FALSE; - if ($langChildren || $langDisabled) { + if ($langChildren || $langDisabled) { $rotateLang = array('DEF'); } else { - if (!in_array('DEF',$editData['meta']['currentLangId'])) { + if (!in_array('DEF', $editData['meta']['currentLangId'])) { - array_unshift($editData['meta']['currentLangId'],'DEF'); + array_unshift($editData['meta']['currentLangId'], 'DEF'); $PA['_noEditDEF'] = TRUE; } $rotateLang = $editData['meta']['currentLangId']; } // Tabs sheets - if (is_array($dataStructArray['sheets'])) { + if (is_array($dataStructArray['sheets'])) { $tabsToTraverse = array_keys($dataStructArray['sheets']); } else { $tabsToTraverse = array($sheet); } - foreach ($rotateLang as $lKey) { + foreach ($rotateLang as $lKey) { - if (!$langChildren && !$langDisabled) { + if (!$langChildren && !$langDisabled) { - $item.= ''.$this->getLanguageIcon($table,$row,'v'.$lKey).$lKey.':'; + $item .= '' . $this->getLanguageIcon($table, $row, 'v' . $lKey) . $lKey . ':'; } $tabParts = array(); - foreach ($tabsToTraverse as $sheet) { + foreach ($tabsToTraverse as $sheet) { - list ($dataStruct, $sheet) = t3lib_div::resolveSheetDefInDS($dataStructArray,$sheet); + list ($dataStruct, $sheet) = t3lib_div::resolveSheetDefInDS($dataStructArray, $sheet); // Render sheet: - if (is_array($dataStruct['ROOT']) && is_array($dataStruct['ROOT']['el'])) { + if (is_array($dataStruct['ROOT']) && is_array($dataStruct['ROOT']['el'])) { - $lang = 'l'.$lKey; // Default language, other options are "lUK" or whatever country code (independant of system!!!) + $lang = 'l' . $lKey; // Default language, other options are "lUK" or whatever country code (independant of system!!!) - $PA['_valLang'] = $langChildren && !$langDisabled ? $editData['meta']['currentLangId'] : 'DEF'; // Default language, other options are "lUK" or whatever country code (independant of system!!!) + $PA['_valLang'] = $langChildren && !$langDisabled ? $editData['meta']['currentLangId'] : 'DEF'; // Default language, other options are "lUK" or whatever country code (independant of system!!!) $PA['_lang'] = $lang; $PA['_cshFile'] = ((isset($dataStruct['ROOT']['TCEforms']) && isset($dataStruct['ROOT']['TCEforms']['cshFile'])) ? $dataStruct['ROOT']['TCEforms']['cshFile'] : ''); // Push the sheet level tab to DynNestedStack if (is_array($dataStructArray['sheets'])) { $tabIdentString = $GLOBALS['TBE_TEMPLATE']->getDynTabMenuId('TCEFORMS:flexform:' . $PA['itemFormElName'] . $PA['_lang']); - $this->pushToDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts)+1)); + $this->pushToDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) + 1)); } // Render flexform: $tRows = $this->getSingleField_typeFlex_draw( - $dataStruct['ROOT']['el'], - $editData['data'][$sheet][$lang], - $table, - $field, - $row, - $PA, + $dataStruct['ROOT']['el'], + $editData['data'][$sheet][$lang], + $table, + $field, + $row, + $PA, - '[data]['.$sheet.']['.$lang.']' + '[data][' . $sheet . '][' . $lang . ']' - ); + ); - #$sheetContent= ''.implode('',$tRows).'
'; - $sheetContent = '
'.$tRows.'
'; + $sheetContent = '
' . $tRows . '
'; - # $item = '
'.$item.'
'; - //visibility:hidden; // Pop the sheet level tab from DynNestedStack if (is_array($dataStructArray['sheets'])) { - $this->popFromDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts)+1)); + $this->popFromDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) + 1)); } - } else $sheetContent='Data Structure ERROR: No ROOT element found for sheet "'.$sheet.'".'; + } else { + $sheetContent = 'Data Structure ERROR: No ROOT element found for sheet "' . $sheet . '".'; + } // Add to tab: $tabParts[] = array( @@ -2611,14 +2615,16 @@ ); } - if (is_array($dataStructArray['sheets'])) { + if (is_array($dataStructArray['sheets'])) { $dividersToTabsBehaviour = (isset($GLOBALS['TCA'][$table]['ctrl']['dividers2tabs']) ? $GLOBALS['TCA'][$table]['ctrl']['dividers2tabs'] : 1); - $item.= $this->getDynTabMenu($tabParts, 'TCEFORMS:flexform:'.$PA['itemFormElName'].$PA['_lang'], $dividersToTabsBehaviour); + $item .= $this->getDynTabMenu($tabParts, 'TCEFORMS:flexform:' . $PA['itemFormElName'] . $PA['_lang'], $dividersToTabsBehaviour); } else { - $item.= $sheetContent; + $item .= $sheetContent; } } - } else $item='Data Structure ERROR: '.$dataStructArray; + } else { + $item = 'Data Structure ERROR: ' . $dataStructArray; + } return $item; } @@ -2632,13 +2638,13 @@ * @param [type] $multi: ... * @return string HTML for menu */ - function getSingleField_typeFlex_langMenu($languages,$elName,$selectedLanguage,$multi=1) { + function getSingleField_typeFlex_langMenu($languages, $elName, $selectedLanguage, $multi = 1) { - $opt=array(); + $opt = array(); - foreach($languages as $lArr) { + foreach ($languages as $lArr) { - $opt[]=''; + $opt[] = ''; } - $output = ''; + $output = ''; return $output; } @@ -2651,24 +2657,24 @@ * @param string Current sheet key * @return string HTML for menu */ - function getSingleField_typeFlex_sheetMenu($sArr,$elName,$sheetKey) { + function getSingleField_typeFlex_sheetMenu($sArr, $elName, $sheetKey) { - $tCells =array(); + $tCells = array(); - $pct = round(100/count($sArr)); + $pct = round(100 / count($sArr)); - foreach($sArr as $sKey => $sheetCfg) { + foreach ($sArr as $sKey => $sheetCfg) { - if ($GLOBALS['BE_USER']->jsConfirmation(1)) { + if ($GLOBALS['BE_USER']->jsConfirmation(1)) { - $onClick = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR.submitForm()};"; + $onClick = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){' . $this->elName($elName) . ".value='" . $sKey . "'; TBE_EDITOR.submitForm()};"; } else { - $onClick = 'if(TBE_EDITOR.checkSubmit(-1)){ '.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR.submitForm();}"; + $onClick = 'if(TBE_EDITOR.checkSubmit(-1)){ ' . $this->elName($elName) . ".value='" . $sKey . "'; TBE_EDITOR.submitForm();}"; } - $tCells[]=''. + $tCells[] = '' . - ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey). + ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey) . - ''; + ''; } - return ''.implode('',$tCells).'
'; + return '' . implode('', $tCells) . '
'; } /** @@ -2686,32 +2692,32 @@ * @param boolean Defines whether the next flexform level is open or closed. Comes from _TOGGLE pseudo field in FlexForm xml. * @return string HTMl code for form. */ - function getSingleField_typeFlex_draw($dataStruct,$editData,$table,$field,$row,&$PA,$formPrefix='',$level=0,$idPrefix='ID',$toggleClosed=FALSE) { + function getSingleField_typeFlex_draw($dataStruct, $editData, $table, $field, $row, &$PA, $formPrefix = '', $level = 0, $idPrefix = 'ID', $toggleClosed = FALSE) { $output = ''; $mayRestructureFlexforms = $GLOBALS['BE_USER']->checkLanguageAccess(0); // Data Structure array must be ... and array of course... - if (is_array($dataStruct)) { + if (is_array($dataStruct)) { - foreach($dataStruct as $key => $value) { // Traversing fields in structure: + foreach ($dataStruct as $key => $value) { // Traversing fields in structure: - if (is_array($value)) { // The value of each entry must be an array. + if (is_array($value)) { // The value of each entry must be an array. // ******************** // Making the row: // ******************** // Title of field: - $theTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($value['tx_templavoila']['title']),30)); + $theTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($value['tx_templavoila']['title']), 30)); // If it's a "section" or "container": - if ($value['type']=='array') { + if ($value['type'] == 'array') { // Creating IDs for form fields: // It's important that the IDs "cascade" - otherwise we can't dynamically expand the flex form because this relies on simple string substitution of the first parts of the id values. - $thisId = t3lib_div::shortMd5(uniqid('id',true)); // This is a suffix used for forms on this level + $thisId = t3lib_div::shortMd5(uniqid('id', TRUE)); // This is a suffix used for forms on this level - $idTagPrefix = $idPrefix.'-'.$thisId; // $idPrefix is the prefix for elements on lower levels in the hierarchy and we combine this with the thisId value to form a new ID on this level. + $idTagPrefix = $idPrefix . '-' . $thisId; // $idPrefix is the prefix for elements on lower levels in the hierarchy and we combine this with the thisId value to form a new ID on this level. // If it's a "section" containing other elements: - if ($value['section']) { + if ($value['section']) { // Load script.aculo.us if flexform sections can be moved by drag'n'drop: $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous(); @@ -2720,24 +2726,24 @@ // Render elements in data array for section: $tRows = array(); - $cc=0; + $cc = 0; - if (is_array($editData[$key]['el'])) { + if (is_array($editData[$key]['el'])) { - foreach ($editData[$key]['el'] as $k3 => $v3) { + foreach ($editData[$key]['el'] as $k3 => $v3) { - $cc=$k3; + $cc = $k3; - if (is_array($v3)) { + if (is_array($v3)) { $theType = key($v3); $theDat = $v3[$theType]; $newSectionEl = $value['el'][$theType]; - if (is_array($newSectionEl)) { + if (is_array($newSectionEl)) { - $tRows[]= $this->getSingleField_typeFlex_draw( + $tRows[] = $this->getSingleField_typeFlex_draw( array($theType => $newSectionEl), array($theType => $theDat), $table, $field, $row, $PA, - $formPrefix.'['.$key.'][el]['.$cc.']', + $formPrefix . '[' . $key . '][el][' . $cc . ']', - $level+1, + $level + 1, $idTagPrefix, $v3['_TOGGLE'] ); @@ -2754,7 +2760,7 @@ // Traversing possible types of new content in the section: $newElementsLinks = array(); - foreach($value['el'] as $nnKey => $nCfg) { + foreach ($value['el'] as $nnKey => $nCfg) { $additionalJS_post_saved = $this->additionalJS_post; $this->additionalJS_post = array(); $additionalJS_submit_saved = $this->additionalJS_submit; @@ -2766,8 +2772,8 @@ $field, $row, $PA, - $formPrefix.'['.$key.'][el]['.$idTagPrefix.'-form]', + $formPrefix . '[' . $key . '][el][' . $idTagPrefix . '-form]', - $level+1, + $level + 1, $idTagPrefix ); @@ -2775,18 +2781,18 @@ $var = uniqid('idvar'); $replace = 'replace(/' . $idTagPrefix . '-/g,"' . $idTagPrefix . '-"+' . $var . '+"-")'; $onClickInsert = 'var ' . $var . ' = "' . 'idx"+(new Date()).getTime();'; - // Do not replace $isTagPrefix in setActionStatus() because it needs section id! + // Do not replace $isTagPrefix in setActionStatus() because it needs section id! - $onClickInsert .= 'new Insertion.Bottom($("'.$idTagPrefix.'"), unescape("'.rawurlencode($newElementTemplate).'").' . $replace . '); setActionStatus("'.$idTagPrefix.'");'; + $onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), unescape("' . rawurlencode($newElementTemplate) . '").' . $replace . '); setActionStatus("' . $idTagPrefix . '");'; $onClickInsert .= 'eval(unescape("' . rawurlencode(implode(';', $this->additionalJS_post)) . '").' . $replace . ');'; $onClickInsert .= 'TBE_EDITOR.addActionChecks("submit", unescape("' . rawurlencode(implode(';', $this->additionalJS_submit)) . '").' . $replace . ');'; $onClickInsert .= 'return false;'; - // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... + // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... $this->additionalJS_post = $additionalJS_post_saved; $this->additionalJS_submit = $additionalJS_submit_saved; $new = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1); - $newElementsLinks[]= '' . + $newElementsLinks[] = '' . - t3lib_iconWorks::getSpriteIcon('actions-document-new') . + t3lib_iconWorks::getSpriteIcon('actions-document-new') . - htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']),30)) . ''; + htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']), 30)) . ''; } // Reverting internal variables we don't want to change: @@ -2794,88 +2800,88 @@ // Adding the sections: $toggleAll = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.toggleall', 1); - $output.= ' + $output .= '
' - . t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . ' + . t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . '
' . implode('', $tRows) . '
'; - $output.= $mayRestructureFlexforms ? '
' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.addnew', 1) . ': '.implode(' | ',$newElementsLinks).'
' : ''; + $output .= $mayRestructureFlexforms ? '
' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.addnew', 1) . ': ' . implode(' | ', $newElementsLinks) . '
' : ''; } else { - // It is a container + // It is a container $toggleIcon_open = t3lib_iconWorks::getSpriteIcon('actions-move-down'); $toggleIcon_close = t3lib_iconWorks::getSpriteIcon('actions-move-right'); // Create on-click actions. - //$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file. + //$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file. - $onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("'.$idTagPrefix.'").hide();setActionStatus("'.$idPrefix.'");} return false;'; + $onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("' . $idTagPrefix . '").hide();setActionStatus("' . $idPrefix . '");} return false;'; - $onClickToggle = 'flexFormToggle("'.$idTagPrefix.'"); return false;'; + $onClickToggle = 'flexFormToggle("' . $idTagPrefix . '"); return false;'; - $onMove = 'flexFormSortable("'.$idPrefix.'")'; + $onMove = 'flexFormSortable("' . $idPrefix . '")'; // Notice: Creating "new" elements after others seemed to be too difficult to do and since moving new elements created in the bottom is now so easy with drag'n'drop I didn't see the need. // Putting together header of a section. Sections can be removed, copied, opened/closed, moved up and down: // I didn't know how to make something right-aligned without a table, so I put it in a table. can be made into
's if someone like to. // Notice: The fact that I make a "Sortable.create" right onmousedown is that if we initialize this when rendering the form in PHP new and copied elements will not be possible to move as a sortable. But this way a new sortable is initialized everytime someone tries to move and it will always work. - $ctrlHeader= ' + $ctrlHeader = ' - + '
- + - '.($toggleClosed?$toggleIcon_close:$toggleIcon_open).' + ' . ($toggleClosed ? $toggleIcon_close : $toggleIcon_open) . ' - '.$theTitle.' + ' . $theTitle . ' '. + ' . - ($mayRestructureFlexforms ? t3lib_iconWorks::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move')) : ''). + ($mayRestructureFlexforms ? t3lib_iconWorks::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move')) : '') . - ($mayRestructureFlexforms ? ''.t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Delete')) : ''). + ($mayRestructureFlexforms ? '' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Delete')) : '') . - '
'; - $s = t3lib_div::revExplode('[]',$formPrefix,2); + $s = t3lib_div::revExplode('[]', $formPrefix, 2); - $actionFieldName = '_ACTION_FLEX_FORM'.$PA['itemFormElName'].$s[0].'][_ACTION]['.$s[1]; + $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1]; // Push the container to DynNestedStack as it may be toggled - $this->pushToDynNestedStack('flex' , $idTagPrefix); + $this->pushToDynNestedStack('flex', $idTagPrefix); // Putting together the container: $this->additionalJS_delete = array(); - $output.= ' + $output .= ' -
+
- + - '.$ctrlHeader.' + ' . $ctrlHeader . ' - +
'; $output = str_replace('/*###REMOVE###*/', t3lib_div::slashJS(htmlspecialchars(implode('', $this->additionalJS_delete))), $output); - // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact. + // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact. // Pop the container from DynNestedStack - $this->popFromDynNestedStack('flex' , $idTagPrefix); + $this->popFromDynNestedStack('flex', $idTagPrefix); } - // If it's a "single form element": + // If it's a "single form element": - } elseif (is_array($value['TCEforms']['config'])) { // Rendering a single form element: + } elseif (is_array($value['TCEforms']['config'])) { // Rendering a single form element: - if (is_array($PA['_valLang'])) { + if (is_array($PA['_valLang'])) { $rotateLang = $PA['_valLang']; } else { $rotateLang = array($PA['_valLang']); @@ -2886,18 +2892,18 @@ $conditionData['parentRec'] = $row; $tRows = array(); - foreach($rotateLang as $vDEFkey) { + foreach ($rotateLang as $vDEFkey) { - $vDEFkey = 'v'.$vDEFkey; + $vDEFkey = 'v' . $vDEFkey; if (!$value['TCEforms']['displayCond'] || $this->isDisplayCondition($value['TCEforms']['displayCond'], $conditionData, $vDEFkey)) { - $fakePA=array(); + $fakePA = array(); - $fakePA['fieldConf']=array( + $fakePA['fieldConf'] = array( 'label' => $this->sL(trim($value['TCEforms']['label'])), 'config' => $value['TCEforms']['config'], 'defaultExtras' => $value['TCEforms']['defaultExtras'], 'onChange' => $value['TCEforms']['onChange'] ); - if ($PA['_noEditDEF'] && $PA['_lang']==='lDEF') { + if ($PA['_noEditDEF'] && $PA['_lang'] === 'lDEF') { $fakePA['fieldConf']['config'] = array( 'type' => 'none', 'rows' => 2 @@ -2906,9 +2912,9 @@ if ( $fakePA['fieldConf']['onChange'] == 'reload' || - ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key,$GLOBALS['TCA'][$table]['ctrl']['type'])) || + ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key, $GLOBALS['TCA'][$table]['ctrl']['type'])) || - ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'],$key))) { + ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $key))) { - if ($GLOBALS['BE_USER']->jsConfirmation(1)) { + if ($GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };'; } else { $alertMsgOnChange = 'if(TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}'; @@ -2917,36 +2923,36 @@ $alertMsgOnChange = ''; } - $fakePA['fieldChangeFunc']=$PA['fieldChangeFunc']; + $fakePA['fieldChangeFunc'] = $PA['fieldChangeFunc']; if (strlen($alertMsgOnChange)) { - $fakePA['fieldChangeFunc']['alert']=$alertMsgOnChange; + $fakePA['fieldChangeFunc']['alert'] = $alertMsgOnChange; } - $fakePA['onFocus']=$PA['onFocus']; + $fakePA['onFocus'] = $PA['onFocus']; - $fakePA['label']=$PA['label']; + $fakePA['label'] = $PA['label']; - $fakePA['itemFormElName']=$PA['itemFormElName'].$formPrefix.'['.$key.']['.$vDEFkey.']'; + $fakePA['itemFormElName'] = $PA['itemFormElName'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']'; - $fakePA['itemFormElName_file']=$PA['itemFormElName_file'].$formPrefix.'['.$key.']['.$vDEFkey.']'; + $fakePA['itemFormElName_file'] = $PA['itemFormElName_file'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']'; - if(isset($editData[$key][$vDEFkey])) { + if (isset($editData[$key][$vDEFkey])) { - $fakePA['itemFormElValue']=$editData[$key][$vDEFkey]; + $fakePA['itemFormElValue'] = $editData[$key][$vDEFkey]; } else { - $fakePA['itemFormElValue']=$fakePA['fieldConf']['config']['default']; + $fakePA['itemFormElValue'] = $fakePA['fieldConf']['config']['default']; } - $theFormEl= $this->getSingleField_SW($table,$field,$row,$fakePA); + $theFormEl = $this->getSingleField_SW($table, $field, $row, $fakePA); - $theTitle= htmlspecialchars($fakePA['fieldConf']['label']); + $theTitle = htmlspecialchars($fakePA['fieldConf']['label']); - if (!in_array('DEF',$rotateLang)) { + if (!in_array('DEF', $rotateLang)) { $defInfo = '
' . $this->getLanguageIcon($table, $row, 0) . - $this->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field) . ' 
'; + $this->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field) . ' 
'; } else { $defInfo = ''; } - if (!$PA['_noEditDEF']) { + if (!$PA['_noEditDEF']) { $prLang = $this->getAdditionalPreviewLanguages(); - foreach($prLang as $prL) { + foreach ($prLang as $prL) { - $defInfo.= '
'.$this->getLanguageIcon($table, $row, 'v' . $prL['ISOcode']) . + $defInfo .= '
' . $this->getLanguageIcon($table, $row, 'v' . $prL['ISOcode']) . $this->previewFieldValue($editData[$key]['v' . $prL['ISOcode']], $fakePA['fieldConf'], $field) . ' 
'; } } @@ -2958,21 +2964,23 @@ // Put row together // possible linebreaks in the label through xml: \n =>
, usage of nl2br() not possible, so it's done through str_replace $processedTitle = str_replace('\n', '
', $theTitle); - $tRows[]='
' . + $tRows[] = '
' . - '
' . - $this->helpTextIcon_typeFlex($key, $processedTitle, $PA['_cshFile']) . - $languageIcon . - $processedTitle . - '
+ '
' . + $this->helpTextIcon_typeFlex($key, $processedTitle, $PA['_cshFile']) . + $languageIcon . + $processedTitle . + '
-
'.$theFormEl.$defInfo.$this->renderVDEFDiff($editData[$key],$vDEFkey).'
+
' . $theFormEl . $defInfo . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '
'; } } - if (count($tRows)) $output.= implode('',$tRows); + if (count($tRows)) { + $output .= implode('', $tRows); - } - } - } - } + } + } + } + } + } return $output; } @@ -2986,8 +2994,8 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeUnknown($table,$field,$row,&$PA) { + function getSingleField_typeUnknown($table, $field, $row, &$PA) { - $item='Unknown type: '.$PA['fieldConf']['config']['form_type'].'
'; + $item = 'Unknown type: ' . $PA['fieldConf']['config']['form_type'] . '
'; return $item; } @@ -3001,21 +3009,17 @@ * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ - function getSingleField_typeUser($table,$field,$row,&$PA) { + function getSingleField_typeUser($table, $field, $row, &$PA) { - $PA['table']=$table; + $PA['table'] = $table; - $PA['field']=$field; + $PA['field'] = $field; - $PA['row']=$row; + $PA['row'] = $row; - $PA['pObj']=&$this; + $PA['pObj'] =& $this; - return t3lib_div::callUserFunction($PA['fieldConf']['config']['userFunc'],$PA,$this); + return t3lib_div::callUserFunction($PA['fieldConf']['config']['userFunc'], $PA, $this); } - - - - /************************************************************ * * Field content processing @@ -3030,79 +3034,79 @@ * @param string The value to display * @return string Formatted Field content */ - function formatValue ($config, $itemValue) { + function formatValue($config, $itemValue) { $format = trim($config['format']); - switch($format) { + switch ($format) { case 'date': - if ($itemValue) { + if ($itemValue) { $option = trim($config['format.']['option']); - if ($option) { + if ($option) { - if ($config['format.']['strftime']) { + if ($config['format.']['strftime']) { - $value = strftime($option,$itemValue); + $value = strftime($option, $itemValue); } else { - $value = date($option,$itemValue); + $value = date($option, $itemValue); } } else { - $value = date('d-m-Y',$itemValue); + $value = date('d-m-Y', $itemValue); } } else { $value = ''; } - if ($config['format.']['appendAge']) { + if ($config['format.']['appendAge']) { $value .= ' (' . - t3lib_BEfunc::calcAge(($GLOBALS['EXEC_TIME'] - $itemValue), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . - ')'; + t3lib_BEfunc::calcAge(($GLOBALS['EXEC_TIME'] - $itemValue), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . + ')'; } $itemValue = $value; - break; + break; - case 'datetime': // compatibility with "eval" (type "input") + case 'datetime': // compatibility with "eval" (type "input") - $itemValue = date('H:i d-m-Y',$itemValue); + $itemValue = date('H:i d-m-Y', $itemValue); - break; + break; - case 'time': // compatibility with "eval" (type "input") + case 'time': // compatibility with "eval" (type "input") - $itemValue = date('H:i',$itemValue); + $itemValue = date('H:i', $itemValue); - break; + break; - case 'timesec': // compatibility with "eval" (type "input") + case 'timesec': // compatibility with "eval" (type "input") - $itemValue = date('H:i:s',$itemValue); + $itemValue = date('H:i:s', $itemValue); - break; + break; - case 'year': // compatibility with "eval" (type "input") + case 'year': // compatibility with "eval" (type "input") - $itemValue = date('Y',$itemValue); + $itemValue = date('Y', $itemValue); - break; + break; case 'int': - $baseArr = array('dec'=>'d','hex'=>'x','HEX'=>'X','oct'=>'o','bin'=>'b'); + $baseArr = array('dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b'); $base = trim($config['format.']['base']); $format = $baseArr[$base] ? $baseArr[$base] : 'd'; - $itemValue = sprintf('%'.$format,$itemValue); + $itemValue = sprintf('%' . $format, $itemValue); - break; + break; case 'float': - $precision = t3lib_div::intInRange($config['format.']['precision'],1,10,2); + $precision = t3lib_div::intInRange($config['format.']['precision'], 1, 10, 2); - $itemValue = sprintf('%.'.$precision.'f',$itemValue); + $itemValue = sprintf('%.' . $precision . 'f', $itemValue); - break; + break; case 'number': $format = trim($config['format.']['option']); - $itemValue = sprintf('%'.$format,$itemValue); + $itemValue = sprintf('%' . $format, $itemValue); - break; + break; case 'md5': $itemValue = md5($itemValue); - break; + break; case 'filesize': $value = t3lib_div::formatSize(intval($itemValue)); - if ($config['format.']['appendByteSize']) { + if ($config['format.']['appendByteSize']) { - $value .= ' ('.$itemValue.')'; + $value .= ' (' . $itemValue . ')'; } $itemValue = $value; - break; + break; case 'user': $func = trim($config['format.']['userFunc']); - if ($func) { + if ($func) { $params = array( 'value' => $itemValue, 'args' => $config['format.']['userFunc'], 'config' => $config, 'pObj' => &$this ); - $itemValue = t3lib_div::callUserFunction($func,$params,$this); + $itemValue = t3lib_div::callUserFunction($func, $params, $this); } - break; + break; default: break; } @@ -3111,10 +3115,6 @@ } - - - - /************************************************************ * * "Configuration" fetching/processing functions @@ -3128,20 +3128,22 @@ * @param array The row from the table, should contain at least the "type" field, if applicable. * @return string Return the "type" value for this record, ready to pick a "types" configuration from the $TCA array. */ - function getRTypeNum($table,$row) { + function getRTypeNum($table, $row) { global $TCA; // If there is a "type" field configured... - if ($TCA[$table]['ctrl']['type']) { + if ($TCA[$table]['ctrl']['type']) { $typeFieldName = $TCA[$table]['ctrl']['type']; $typeFieldConfig = $TCA[$table]['columns'][$typeFieldName]; $typeNum = $this->getLanguageOverlayRawValue($table, $row, $typeFieldName, $typeFieldConfig); - if (!strcmp($typeNum,'')) $typeNum=0; // If that value is an empty string, set it to "0" (zero) + if (!strcmp($typeNum, '')) { + $typeNum = 0; + } // If that value is an empty string, set it to "0" (zero) } else { - $typeNum = 0; // If no "type" field, then set to "0" (zero) + $typeNum = 0; // If no "type" field, then set to "0" (zero) } - $typeNum = (string)$typeNum; // Force to string. Necessary for eg '-1' to be recognized as a type value. + $typeNum = (string) $typeNum; // Force to string. Necessary for eg '-1' to be recognized as a type value. - if (!$TCA[$table]['types'][$typeNum]) { // However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons) + if (!$TCA[$table]['types'][$typeNum]) { // However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons) $typeNum = 1; } @@ -3155,18 +3157,18 @@ * @return array Returns rearranged version (keys are changed around as well.) * @see getMainFields() */ - function rearrange($fields) { + function rearrange($fields) { - $fO = array_flip(t3lib_div::trimExplode(',',$this->fieldOrder,1)); + $fO = array_flip(t3lib_div::trimExplode(',', $this->fieldOrder, 1)); - $newFields=array(); + $newFields = array(); - foreach($fields as $cc => $content) { + foreach ($fields as $cc => $content) { - $cP = t3lib_div::trimExplode(';',$content); + $cP = t3lib_div::trimExplode(';', $content); - if (isset($fO[$cP[0]])) { + if (isset($fO[$cP[0]])) { $newFields[$fO[$cP[0]]] = $content; unset($fields[$cc]); } } ksort($newFields); - $fields=array_merge($newFields,$fields); // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble... + $fields = array_merge($newFields, $fields); // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble... return $fields; } @@ -3180,34 +3182,34 @@ * @return array Array with fieldnames as values. The fieldnames are those which should NOT be displayed "anyways" * @see getMainFields() */ - function getExcludeElements($table,$row,$typeNum) { + function getExcludeElements($table, $row, $typeNum) { global $TCA; // Init: - $excludeElements=array(); + $excludeElements = array(); // If a subtype field is defined for the type - if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) { + if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) { $sTfield = $TCA[$table]['types'][$typeNum]['subtype_value_field']; - if (trim($TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) { + if (trim($TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) { - $excludeElements=t3lib_div::trimExplode(',',$TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]],1); + $excludeElements = t3lib_div::trimExplode(',', $TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]], 1); } } // If a bitmask-value field has been configured, then find possible fields to exclude based on that: - if ($TCA[$table]['types'][$typeNum]['bitmask_value_field']) { + if ($TCA[$table]['types'][$typeNum]['bitmask_value_field']) { $sTfield = $TCA[$table]['types'][$typeNum]['bitmask_value_field']; - $sTValue = t3lib_div::intInRange($row[$sTfield],0); + $sTValue = t3lib_div::intInRange($row[$sTfield], 0); - if (is_array($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'])) { + if (is_array($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'])) { - foreach($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) { + foreach ($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) { - $bit=substr($bitKey,1); + $bit = substr($bitKey, 1); - if (t3lib_div::testInt($bit)) { + if (t3lib_div::testInt($bit)) { - $bit = t3lib_div::intInRange($bit,0,30); + $bit = t3lib_div::intInRange($bit, 0, 30); if ( - (substr($bitKey,0,1)=='-' && !($sTValue&pow(2,$bit))) || + (substr($bitKey, 0, 1) == '-' && !($sTValue & pow(2, $bit))) || - (substr($bitKey,0,1)=='+' && ($sTValue&pow(2,$bit))) + (substr($bitKey, 0, 1) == '+' && ($sTValue & pow(2, $bit))) - ) { + ) { - $excludeElements = array_merge($excludeElements,t3lib_div::trimExplode(',',$eList,1)); + $excludeElements = array_merge($excludeElements, t3lib_div::trimExplode(',', $eList, 1)); } } } @@ -3227,21 +3229,21 @@ * @return array An array containing two values: 1) Another array containing fieldnames to add and 2) the subtype value field. * @see getMainFields() */ - function getFieldsToAdd($table,$row,$typeNum) { + function getFieldsToAdd($table, $row, $typeNum) { global $TCA; // Init: - $addElements=array(); + $addElements = array(); // If a subtype field is defined for the type - if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) { + if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) { $sTfield = $TCA[$table]['types'][$typeNum]['subtype_value_field']; - if (trim($TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) { + if (trim($TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) { - $addElements=t3lib_div::trimExplode(',',$TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]],1); + $addElements = t3lib_div::trimExplode(',', $TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]], 1); } } // Return the return - return array($addElements,$sTfield); + return array($addElements, $sTfield); } /** @@ -3252,15 +3254,15 @@ * @return array Return the modified $fields array. * @see getMainFields(),getFieldsToAdd() */ - function mergeFieldsWithAddedFields($fields,$fieldsToAdd) { + function mergeFieldsWithAddedFields($fields, $fieldsToAdd) { - if (count($fieldsToAdd[0])) { + if (count($fieldsToAdd[0])) { - $c=0; + $c = 0; - foreach($fields as $fieldInfo) { + foreach ($fields as $fieldInfo) { - $parts = explode(';',$fieldInfo); + $parts = explode(';', $fieldInfo); - if (!strcmp(trim($parts[0]),$fieldsToAdd[1])) { + if (!strcmp(trim($parts[0]), $fieldsToAdd[1])) { array_splice( $fields, - $c+1, + $c + 1, 0, $fieldsToAdd[0] ); @@ -3283,12 +3285,12 @@ * @return mixed The TSconfig values (probably in an array) * @see t3lib_BEfunc::getTCEFORM_TSconfig() */ - function setTSconfig($table,$row,$field='') { + function setTSconfig($table, $row, $field = '') { - $mainKey = $table.':'.$row['uid']; + $mainKey = $table . ':' . $row['uid']; - if (!isset($this->cachedTSconfig[$mainKey])) { + if (!isset($this->cachedTSconfig[$mainKey])) { - $this->cachedTSconfig[$mainKey]=t3lib_BEfunc::getTCEFORM_TSconfig($table,$row); + $this->cachedTSconfig[$mainKey] = t3lib_BEfunc::getTCEFORM_TSconfig($table, $row); } - if ($field) { + if ($field) { return $this->cachedTSconfig[$mainKey][$field]; } else { return $this->cachedTSconfig[$mainKey]; @@ -3312,7 +3314,7 @@ if (is_array($TSconfig['config']) && is_array($this->allowOverrideMatrix[$type])) { // Check if the keys in TSconfig['config'] are allowed to override TCA field config: foreach (array_keys($TSconfig['config']) as $key) { - if (!in_array($key, $this->allowOverrideMatrix[$type], true)) { + if (!in_array($key, $this->allowOverrideMatrix[$type], TRUE)) { unset($TSconfig['config'][$key]); } } @@ -3336,18 +3338,20 @@ * @return array * @see getSpecConfFromString(), t3lib_BEfunc::getTCAtypes() */ - function getSpecConfForField($table,$row,$field) { + function getSpecConfForField($table, $row, $field) { // Finds the current "types" configuration for the table/row: - $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row); + $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table, $row); // If this is an array, then traverse it: - if (is_array($types_fieldConfig)) { + if (is_array($types_fieldConfig)) { - foreach($types_fieldConfig as $vconf) { + foreach ($types_fieldConfig as $vconf) { // If the input field name matches one found in the 'types' list, then return the 'special' configuration. - if ($vconf['field']==$field) return $vconf['spec']; + if ($vconf['field'] == $field) { + return $vconf['spec']; - } - } - } + } + } + } + } /** * Returns the "special" configuration of an "extra" string (non-parsed) @@ -3357,7 +3361,7 @@ * @return array An array with the special options in. * @see getSpecConfForField(), t3lib_BEfunc::getSpecConfParts() */ - function getSpecConfFromString($extraString, $defaultExtras) { + function getSpecConfFromString($extraString, $defaultExtras) { return t3lib_BEfunc::getSpecConfParts($extraString, $defaultExtras); } @@ -3371,31 +3375,31 @@ * @param string Optional alternative list of fields for the palette * @return array The palette elements */ - public function loadPaletteElements($table, $row, $palette, $itemList='') { + public function loadPaletteElements($table, $row, $palette, $itemList = '') { global $TCA; t3lib_div::loadTCA($table); $parts = array(); // Getting excludeElements, if any. - if (!is_array($this->excludeElements)) { + if (!is_array($this->excludeElements)) { - $this->excludeElements = $this->getExcludeElements($table, $row, $this->getRTypeNum($table,$row)); + $this->excludeElements = $this->getExcludeElements($table, $row, $this->getRTypeNum($table, $row)); } // Load the palette TCEform elements - if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList)) { + if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList)) { $itemList = ($itemList ? $itemList : $TCA[$table]['palettes'][$palette]['showitem']); - if ($itemList) { + if ($itemList) { - $fields = t3lib_div::trimExplode(',',$itemList,1); + $fields = t3lib_div::trimExplode(',', $itemList, 1); - foreach($fields as $info) { + foreach ($fields as $info) { - $fieldParts = t3lib_div::trimExplode(';',$info); + $fieldParts = t3lib_div::trimExplode(';', $info); $theField = $fieldParts[0]; if ($theField === '--linebreak--') { $parts[]['NAME'] = '--linebreak--'; - } elseif (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField]) { + } elseif (!in_array($theField, $this->excludeElements) && $TCA[$table]['columns'][$theField]) { $this->palFieldArr[$palette][] = $theField; - $elem = $this->getSingleField($table,$theField,$row,$fieldParts[1],1,'',$fieldParts[2]); + $elem = $this->getSingleField($table, $theField, $row, $fieldParts[1], 1, '', $fieldParts[2]); - if (is_array($elem)) { + if (is_array($elem)) { $parts[] = $elem; } } @@ -3406,13 +3410,6 @@ } - - - - - - - /************************************************************ * * Display of localized content etc. @@ -3428,32 +3425,32 @@ * @param array Record array of the record being edited * @return void */ - function registerDefaultLanguageData($table,$rec) { + function registerDefaultLanguageData($table, $rec) { global $TCA; // Add default language: if ($TCA[$table]['ctrl']['languageField'] - && $rec[$TCA[$table]['ctrl']['languageField']] > 0 - && $TCA[$table]['ctrl']['transOrigPointerField'] + && $rec[$TCA[$table]['ctrl']['languageField']] > 0 + && $TCA[$table]['ctrl']['transOrigPointerField'] - && intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) { + && intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) { $lookUpTable = $TCA[$table]['ctrl']['transOrigPointerTable'] ? $TCA[$table]['ctrl']['transOrigPointerTable'] : $table; // Get data formatted: - $this->defaultLanguageData[$table.':'.$rec['uid']] = t3lib_BEfunc::getRecordWSOL($lookUpTable, intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']])); + $this->defaultLanguageData[$table . ':' . $rec['uid']] = t3lib_BEfunc::getRecordWSOL($lookUpTable, intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']])); // Get data for diff: - if ($TCA[$table]['ctrl']['transOrigDiffSourceField']) { + if ($TCA[$table]['ctrl']['transOrigDiffSourceField']) { - $this->defaultLanguageData_diff[$table.':'.$rec['uid']] = unserialize($rec[$TCA[$table]['ctrl']['transOrigDiffSourceField']]); + $this->defaultLanguageData_diff[$table . ':' . $rec['uid']] = unserialize($rec[$TCA[$table]['ctrl']['transOrigDiffSourceField']]); } // If there are additional preview languages, load information for them also: $prLang = $this->getAdditionalPreviewLanguages(); - foreach($prLang as $prL) { + foreach ($prLang as $prL) { $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools'); - $tInfo = $t8Tools->translationInfo($lookUpTable,intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]),$prL['uid']); + $tInfo = $t8Tools->translationInfo($lookUpTable, intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]), $prL['uid']); - if (is_array($tInfo['translations'][$prL['uid']])) { + if (is_array($tInfo['translations'][$prL['uid']])) { - $this->additionalPreviewLanguageData[$table.':'.$rec['uid']][$prL['uid']] = t3lib_BEfunc::getRecordWSOL($table, intval($tInfo['translations'][$prL['uid']]['uid'])); + $this->additionalPreviewLanguageData[$table . ':' . $rec['uid']][$prL['uid']] = t3lib_BEfunc::getRecordWSOL($table, intval($tInfo['translations'][$prL['uid']]['uid'])); } } } @@ -3470,16 +3467,16 @@ * @param array Content of $PA['fieldConf'] * @return string Unprocessed field value merged with default language data if needed */ - function getLanguageOverlayRawValue($table, $row, $field, $fieldConf) { + function getLanguageOverlayRawValue($table, $row, $field, $fieldConf) { global $TCA; $value = $row[$field]; - if (is_array($this->defaultLanguageData[$table.':'.$row['uid']])) { + if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) { - if ($fieldConf['l10n_mode']=='exclude' + if ($fieldConf['l10n_mode'] == 'exclude' - || ($fieldConf['l10n_mode']=='mergeIfNotBlank' && strcmp(trim($this->defaultLanguageData[$table.':'.$row['uid']][$field]),''))) { + || ($fieldConf['l10n_mode'] == 'mergeIfNotBlank' && strcmp(trim($this->defaultLanguageData[$table . ':' . $row['uid']][$field]), ''))) { - $value = $this->defaultLanguageData[$table.':'.$row['uid']][$field]; + $value = $this->defaultLanguageData[$table . ':' . $row['uid']][$field]; } } @@ -3498,25 +3495,25 @@ * @return string Item string returned again, possibly with the original value added to. * @see getSingleField(), registerDefaultLanguageData() */ - function renderDefaultLanguageContent($table,$field,$row,$item) { + function renderDefaultLanguageContent($table, $field, $row, $item) { - if (is_array($this->defaultLanguageData[$table.':'.$row['uid']])) { + if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) { - $dLVal = t3lib_BEfunc::getProcessedValue($table,$field,$this->defaultLanguageData[$table.':'.$row['uid']][$field],0,1); + $dLVal = t3lib_BEfunc::getProcessedValue($table, $field, $this->defaultLanguageData[$table . ':' . $row['uid']][$field], 0, 1); $fCfg = $GLOBALS['TCA'][$table]['columns'][$field]; // Don't show content if it's for IRRE child records: - if ($fCfg['config']['type']!='inline') { + if ($fCfg['config']['type'] != 'inline') { - if (strcmp($dLVal,'')) { + if (strcmp($dLVal, '')) { $item .= '
' . $this->getLanguageIcon($table, $row, 0) . - $this->previewFieldValue($dLVal, $fCfg, $field) . ' 
'; + $this->previewFieldValue($dLVal, $fCfg, $field) . ' 
'; } $prLang = $this->getAdditionalPreviewLanguages(); - foreach($prLang as $prL) { + foreach ($prLang as $prL) { - $dlVal = t3lib_BEfunc::getProcessedValue($table,$field,$this->additionalPreviewLanguageData[$table.':'.$row['uid']][$prL['uid']][$field],0,1); + $dlVal = t3lib_BEfunc::getProcessedValue($table, $field, $this->additionalPreviewLanguageData[$table . ':' . $row['uid']][$prL['uid']][$field], 0, 1); - if(strcmp($dlVal, '')) { + if (strcmp($dlVal, '')) { $item .= '
' . $this->getLanguageIcon($table, $row, 'v' . $prL['ISOcode']) . - $this->previewFieldValue($dlVal, $fCfg, $field) . ' 
'; + $this->previewFieldValue($dlVal, $fCfg, $field) . ' 
'; } } } @@ -3536,29 +3533,29 @@ * @return string Item string returned again, possibly with the original value added to. * @see getSingleField(), registerDefaultLanguageData() */ - function renderDefaultLanguageDiff($table,$field,$row,$item) { + function renderDefaultLanguageDiff($table, $field, $row, $item) { - if (is_array($this->defaultLanguageData_diff[$table.':'.$row['uid']])) { + if (is_array($this->defaultLanguageData_diff[$table . ':' . $row['uid']])) { // Initialize: $dLVal = array( - 'old' => $this->defaultLanguageData_diff[$table.':'.$row['uid']], + 'old' => $this->defaultLanguageData_diff[$table . ':' . $row['uid']], - 'new' => $this->defaultLanguageData[$table.':'.$row['uid']], + 'new' => $this->defaultLanguageData[$table . ':' . $row['uid']], ); - if (isset($dLVal['old'][$field])) { // There must be diff-data: + if (isset($dLVal['old'][$field])) { // There must be diff-data: - if (strcmp($dLVal['old'][$field],$dLVal['new'][$field])) { + if (strcmp($dLVal['old'][$field], $dLVal['new'][$field])) { // Create diff-result: $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff'); $diffres = $t3lib_diff_Obj->makeDiffDisplay( - t3lib_BEfunc::getProcessedValue($table,$field,$dLVal['old'][$field],0,1), + t3lib_BEfunc::getProcessedValue($table, $field, $dLVal['old'][$field], 0, 1), - t3lib_BEfunc::getProcessedValue($table,$field,$dLVal['new'][$field],0,1) + t3lib_BEfunc::getProcessedValue($table, $field, $dLVal['new'][$field], 0, 1) ); - $item.='
'. + $item .= '
' . - '
'.htmlspecialchars($this->getLL('l_changeInOrig')).':
'. + '
' . htmlspecialchars($this->getLL('l_changeInOrig')) . ':
' . - $diffres. + $diffres . - '
'; + '
'; } } } @@ -3576,29 +3573,23 @@ * @return string Item string returned again, possibly with the original value added to. * @see getSingleField(), registerDefaultLanguageData() */ - function renderVDEFDiff($vArray,$vDEFkey) { + function renderVDEFDiff($vArray, $vDEFkey) { - if ($GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && isset($vArray[$vDEFkey.'.vDEFbase']) && strcmp($vArray[$vDEFkey.'.vDEFbase'],$vArray['vDEF'])) { + if ($GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && isset($vArray[$vDEFkey . '.vDEFbase']) && strcmp($vArray[$vDEFkey . '.vDEFbase'], $vArray['vDEF'])) { // Create diff-result: $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff'); - $diffres = $t3lib_diff_Obj->makeDiffDisplay($vArray[$vDEFkey.'.vDEFbase'],$vArray['vDEF']); + $diffres = $t3lib_diff_Obj->makeDiffDisplay($vArray[$vDEFkey . '.vDEFbase'], $vArray['vDEF']); - $item.='
'. + $item .= '
' . - '
'.htmlspecialchars($this->getLL('l_changeInOrig')).':
'. + '
' . htmlspecialchars($this->getLL('l_changeInOrig')) . ':
' . - $diffres. + $diffres . - '
'; + '
'; } return $item; } - - - - - - /************************************************************ * * Form element helper functions @@ -3620,34 +3611,34 @@ * @param string $uid: (optional) uid of table record processing for * @return string The form fields for the selection. */ - function dbFileIcons($fName,$mode,$allowed,$itemArray,$selector='',$params=array(),$onFocus='',$table='',$field='',$uid='') { + function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $table = '', $field = '', $uid = '') { $disabled = ''; - if($this->renderReadonly || $params['readOnly']) { + if ($this->renderReadonly || $params['readOnly']) { $disabled = ' disabled="disabled"'; } // Sets a flag which means some JavaScript is included on the page to support this element. - $this->printNeededJS['dbFileIcons']=1; + $this->printNeededJS['dbFileIcons'] = 1; // INIT - $uidList=array(); + $uidList = array(); - $opt=array(); + $opt = array(); - $itemArrayC=0; + $itemArrayC = 0; // Creating '; + $opt[] = ''; } } break; @@ -3661,26 +3652,26 @@ break; case 'folder': foreach ($itemArray as $pp) { - $pParts = explode('|',$pp); + $pParts = explode('|', $pp); - $uidList[]=$pUid=$pTitle = $pParts[0]; + $uidList[] = $pUid = $pTitle = $pParts[0]; - $opt[]=''; + $opt[] = ''; } break; default: foreach ($itemArray as $pp) { - $pParts = explode('|',$pp, 2); + $pParts = explode('|', $pp, 2); - $uidList[]=$pUid=$pParts[0]; + $uidList[] = $pUid = $pParts[0]; $pTitle = $pParts[1]; - $opt[]=''; + $opt[] = ''; } break; } } // Create selector box of the options - $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC+1,t3lib_div::intInRange($params['size'],1),$params['autoSizeMax']) : $params['size']; + $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size']; - if (!$selector) { + if (!$selector) { - $selector = ''; + $selector = ''; } @@ -3689,63 +3680,63 @@ 'R' => array(), ); if (!$params['readOnly'] && !$params['noList']) { - if (!$params['noBrowser']) { + if (!$params['noBrowser']) { // check against inline uniqueness $inlineParent = $this->inline->getStructureLevel(-1); - if(is_array($inlineParent) && $inlineParent['uid']) { + if (is_array($inlineParent) && $inlineParent['uid']) { if ($inlineParent['config']['foreign_table'] == $table && $inlineParent['config']['foreign_unique'] == $field) { - $objectPrefix = $this->inline->inlineNames['object'].'['.$table.']'; + $objectPrefix = $this->inline->inlineNames['object'] . '[' . $table . ']'; - $aOnClickInline = $objectPrefix.'|inline.checkUniqueElement|inline.setUniqueElement'; + $aOnClickInline = $objectPrefix . '|inline.checkUniqueElement|inline.setUniqueElement'; - $rOnClickInline = 'inline.revertUnique(\''.$objectPrefix.'\',null,\''.$uid.'\');'; + $rOnClickInline = 'inline.revertUnique(\'' . $objectPrefix . '\',null,\'' . $uid . '\');'; } } - $aOnClick='setFormValueOpenBrowser(\''.$mode.'\',\''.($fName.'|||'.$allowed.'|'.$aOnClickInline).'\'); return false;'; + $aOnClick = 'setFormValueOpenBrowser(\'' . $mode . '\',\'' . ($fName . '|||' . $allowed . '|' . $aOnClickInline) . '\'); return false;'; - $icons['R'][]=''. + $icons['R'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-insert-record', array('title' => htmlspecialchars($this->getLL('l_browse_' . ($mode == 'db' ? 'db' : 'file'))))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-insert-record', array('title' => htmlspecialchars($this->getLL('l_browse_' . ($mode == 'db' ? 'db' : 'file'))))) . + ''; } - if (!$params['dontShowMoveIcons']) { + if (!$params['dontShowMoveIcons']) { - if ($sSize>=5) { + if ($sSize >= 5) { - $icons['L'][]=''. + $icons['L'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-move-to-top', array('title' => htmlspecialchars($this->getLL('l_move_to_top')))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-move-to-top', array('title' => htmlspecialchars($this->getLL('l_move_to_top')))) . + ''; } - $icons['L'][]=''. + $icons['L'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-move-up', array('title' => htmlspecialchars($this->getLL('l_move_up')))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-move-up', array('title' => htmlspecialchars($this->getLL('l_move_up')))) . + ''; - $icons['L'][]=''. + $icons['L'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-move-down', array('title' => htmlspecialchars($this->getLL('l_move_down')))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-move-down', array('title' => htmlspecialchars($this->getLL('l_move_down')))) . + ''; - if ($sSize>=5) { + if ($sSize >= 5) { - $icons['L'][]=''. + $icons['L'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-move-to-bottom', array('title' => htmlspecialchars($this->getLL('l_move_to_bottom')))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-move-to-bottom', array('title' => htmlspecialchars($this->getLL('l_move_to_bottom')))) . + ''; } } - $clipElements = $this->getClipboardElements($allowed,$mode); + $clipElements = $this->getClipboardElements($allowed, $mode); - if (count($clipElements)) { + if (count($clipElements)) { $aOnClick = ''; - foreach($clipElements as $elValue) { + foreach ($clipElements as $elValue) { if ($mode == 'db') { - list($itemTable,$itemUid) = explode('|', $elValue); + list($itemTable, $itemUid) = explode('|', $elValue); - $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, t3lib_BEfunc::getRecordWSOL($itemTable,$itemUid))); + $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid))); - $elValue = $itemTable.'_'.$itemUid; + $elValue = $itemTable . '_' . $itemUid; } else { // 'file', 'file_reference' and 'folder' mode $itemTitle = 'unescape(\'' . rawurlencode(basename($elValue)) . '\')'; } - $aOnClick.= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20',' ',$elValue)).'\'),'.$itemTitle.');'; + $aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',unescape(\'' . rawurlencode(str_replace('%20', ' ', $elValue)) . '\'),' . $itemTitle . ');'; } - $aOnClick.= 'return false;'; + $aOnClick .= 'return false;'; - $icons['R'][]=''. + $icons['R'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-document-paste-into', array('title' => htmlspecialchars(sprintf($this->getLL('l_clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-document-paste-into', array('title' => htmlspecialchars(sprintf($this->getLL('l_clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))))) . + ''; } - $rOnClick = $rOnClickInline.'setFormValueManipulate(\''.$fName.'\',\'Remove\'); return false'; + $rOnClick = $rOnClickInline . 'setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false'; - $icons['L'][]=''. + $icons['L'][] = '' . - t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => htmlspecialchars($this->getLL('l_remove_selected')))) . - ''; + t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => htmlspecialchars($this->getLL('l_remove_selected')))) . + ''; } $imagesOnly = FALSE; if ($params['thumbnails'] && $params['info']) { @@ -3763,39 +3754,39 @@ } if ($imagesOnly) { $rightbox = ''; - $thumbnails = '
'. $this->wrapLabels($params['thumbnails']) .'
'; + $thumbnails = '
' . $this->wrapLabels($params['thumbnails']) . '
'; } else { $rightbox = $this->wrapLabels($params['thumbnails']); $thumbnails = ''; } - $str=' + $str = '
- '.($params['headers']?' + ' . ($params['headers'] ? ' - + - + - ':''). + ' : '') . - ' + ' - + ' - + implode('
', $icons['L']) . ' - + implode('
', $icons['R']) . ' - + '
'.$this->wrapLabels($params['headers']['selector']).'' . $this->wrapLabels($params['headers']['selector']) . ' '.($params['thumbnails'] ? $this->wrapLabels($params['headers']['items']) : '').'' . ($params['thumbnails'] ? $this->wrapLabels($params['headers']['items']) : '') . '
'. + ' . - $selector. + $selector . - $thumbnails. + $thumbnails . - ($params['noList'] ? '' : ''. $this->wrapLabels($params['info'])) . + ($params['noList'] ? '' : '' . $this->wrapLabels($params['info'])) . - ''. + ' . - implode('
',$icons['L']).'
'. + ' . - implode('
',$icons['R']).'
'. + ' . - $rightbox. + $rightbox . - '
'; // Creating the hidden field which contains the actual value as a comma list. - $str.=''; + $str .= ''; return $str; } @@ -3807,37 +3798,37 @@ * @param string Mode of relations: "db" or "file" * @return array Array of elements in values (keys are insignificant), if none found, empty array. */ - function getClipboardElements($allowed,$mode) { + function getClipboardElements($allowed, $mode) { $output = array(); - if (is_object($this->clipObj)) { + if (is_object($this->clipObj)) { - switch($mode) { + switch ($mode) { case 'file_reference': case 'file': $elFromTable = $this->clipObj->elFromTable('_FILE'); $allowedExts = t3lib_div::trimExplode(',', $allowed, 1); - if ($allowedExts) { // If there are a set of allowed extensions, filter the content: + if ($allowedExts) { // If there are a set of allowed extensions, filter the content: - foreach($elFromTable as $elValue) { + foreach ($elFromTable as $elValue) { $pI = pathinfo($elValue); $ext = strtolower($pI['extension']); - if (in_array($ext, $allowedExts)) { + if (in_array($ext, $allowedExts)) { $output[] = $elValue; } } - } else { // If all is allowed, insert all: (This does NOT respect any disallowed extensions, but those will be filtered away by the backend TCEmain) + } else { // If all is allowed, insert all: (This does NOT respect any disallowed extensions, but those will be filtered away by the backend TCEmain) $output = $elFromTable; } break; case 'db': $allowedTables = t3lib_div::trimExplode(',', $allowed, 1); - if (!strcmp(trim($allowedTables[0]),'*')) { // All tables allowed for relation: + if (!strcmp(trim($allowedTables[0]), '*')) { // All tables allowed for relation: $output = $this->clipObj->elFromTable(''); - } else { // Only some tables, filter them: + } else { // Only some tables, filter them: - foreach($allowedTables as $tablename) { + foreach ($allowedTables as $tablename) { $elFromTable = $this->clipObj->elFromTable($tablename); - $output = array_merge($output,$elFromTable); + $output = array_merge($output, $elFromTable); } } $output = array_keys($output); @@ -3857,10 +3848,10 @@ * @param integer The uid of the record OR if file, just blank value. * @return string HTML */ - function getClickMenu($str,$table,$uid='') { + function getClickMenu($str, $table, $uid = '') { - if ($this->enableClickMenu) { + if ($this->enableClickMenu) { - $onClick = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($str,$table,$uid,1,'','+copy,info,edit,view', TRUE); + $onClick = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($str, $table, $uid, 1, '', '+copy,info,edit,view', TRUE); - return ''.$str.''; + return '' . $str . ''; } } @@ -3878,58 +3869,58 @@ * @param boolean Whether the RTE could have been loaded. * @return string The new item value. */ - function renderWizards($itemKinds,$wizConf,$table,$row,$field,&$PA,$itemName,$specConf,$RTE=0) { + function renderWizards($itemKinds, $wizConf, $table, $row, $field, &$PA, $itemName, $specConf, $RTE = 0) { // Init: $fieldChangeFunc = $PA['fieldChangeFunc']; $item = $itemKinds[0]; $outArr = array(); $colorBoxLinks = array(); - $fName = '['.$table.']['.$row['uid'].']['.$field.']'; + $fName = '[' . $table . '][' . $row['uid'] . '][' . $field . ']'; - $md5ID = 'ID'.t3lib_div::shortmd5($itemName); + $md5ID = 'ID' . t3lib_div::shortmd5($itemName); $listFlag = '_list'; - $prefixOfFormElName = 'data['.$table.']['.$row['uid'].']['.$field.']'; + $prefixOfFormElName = 'data[' . $table . '][' . $row['uid'] . '][' . $field . ']'; - if (t3lib_div::isFirstPartOfStr($PA['itemFormElName'],$prefixOfFormElName)) { + if (t3lib_div::isFirstPartOfStr($PA['itemFormElName'], $prefixOfFormElName)) { - $flexFormPath = str_replace('][','/',substr($PA['itemFormElName'],strlen($prefixOfFormElName)+1,-1)); + $flexFormPath = str_replace('][', '/', substr($PA['itemFormElName'], strlen($prefixOfFormElName) + 1, -1)); } // Manipulate the field name (to be the true form field name) and remove a suffix-value if the item is a selector box with renderMode "singlebox": - if ($PA['fieldConf']['config']['form_type']=='select') { + if ($PA['fieldConf']['config']['form_type'] == 'select') { - if ($PA['fieldConf']['config']['maxitems']<=1) { // Single select situation: + if ($PA['fieldConf']['config']['maxitems'] <= 1) { // Single select situation: $listFlag = ''; - } elseif ($PA['fieldConf']['config']['renderMode']=='singlebox') { + } elseif ($PA['fieldConf']['config']['renderMode'] == 'singlebox') { - $itemName.='[]'; + $itemName .= '[]'; $listFlag = ''; } } // traverse wizards: - if (is_array($wizConf) && !$this->disableWizards) { + if (is_array($wizConf) && !$this->disableWizards) { $parametersOfWizards =& $specConf['wizards']['parameters']; - foreach($wizConf as $wid => $wConf) { + foreach ($wizConf as $wid => $wConf) { - if (substr($wid,0,1)!='_' + if (substr($wid, 0, 1) != '_' - && (!$wConf['enableByTypeConfig'] || is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) - && ($RTE || !$wConf['RTEonly']) + && (!$wConf['enableByTypeConfig'] || is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) + && ($RTE || !$wConf['RTEonly']) - ) { + ) { // Title / icon: $iTitle = htmlspecialchars($this->sL($wConf['title'])); - if ($wConf['icon']) { + if ($wConf['icon']) { $iDat = $this->getIcon($wConf['icon']); - $icon = ''; + $icon = ''; } else { $icon = $iTitle; } // - switch((string)$wConf['type']) { + switch ((string) $wConf['type']) { case 'userFunc': case 'script': case 'popup': case 'colorbox': - if (!$wConf['notNewRecords'] || t3lib_div::testInt($row['uid'])) { + if (!$wConf['notNewRecords'] || t3lib_div::testInt($row['uid'])) { // Setting &P array contents: $params = array(); @@ -3944,25 +3935,29 @@ $params['returnUrl'] = $this->thisReturnUrl(); // Resolving script filename and setting URL. - if (!strcmp(substr($wConf['script'],0,4), 'EXT:')) { + if (!strcmp(substr($wConf['script'], 0, 4), 'EXT:')) { $wScript = t3lib_div::getFileAbsFileName($wConf['script']); - if ($wScript) { + if ($wScript) { - $wScript = '../'.substr($wScript,strlen(PATH_site)); + $wScript = '../' . substr($wScript, strlen(PATH_site)); - } else break; - } else { + } else { + break; + } + } else { $wScript = $wConf['script']; } - $url = $this->backPath.$wScript.(strstr($wScript,'?') ? '' : '?'); + $url = $this->backPath . $wScript . (strstr($wScript, '?') ? '' : '?'); // If there is no script and the type is "colorbox", break right away: - if ((string)$wConf['type']=='colorbox' && !$wConf['script']) { break; } + if ((string) $wConf['type'] == 'colorbox' && !$wConf['script']) { + break; + } // If "script" type, create the links around the icon: - if ((string)$wConf['type']=='script') { + if ((string) $wConf['type'] == 'script') { - $aUrl = $url.t3lib_div::implodeArrayForUrl('',array('P'=>$params)); + $aUrl = $url . t3lib_div::implodeArrayForUrl('', array('P' => $params)); - $outArr[]=''. + $outArr[] = '' . - $icon. + $icon . - ''; + ''; } else { // ... else types "popup", "colorbox" and "userFunc" will need additional parameters: @@ -3971,38 +3966,38 @@ $params['fieldChangeFunc'] = $fieldChangeFunc; $params['fieldChangeFuncHash'] = t3lib_div::hmac(serialize($fieldChangeFunc)); - switch((string)$wConf['type']) { + switch ((string) $wConf['type']) { case 'popup': case 'colorbox': // Current form value is passed as P[currentValue]! - $addJS = $wConf['popup_onlyOpenIfSelected']?'if (!TBE_EDITOR.curSelected(\''.$itemName.$listFlag.'\')){alert('.$GLOBALS['LANG']->JScharCode($this->getLL('m_noSelItemForEdit')).'); return false;}':''; + $addJS = $wConf['popup_onlyOpenIfSelected'] ? 'if (!TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')){alert(' . $GLOBALS['LANG']->JScharCode($this->getLL('m_noSelItemForEdit')) . '); return false;}' : ''; - $curSelectedValues='+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\''.$itemName.$listFlag.'\')'; + $curSelectedValues = '+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')'; - $aOnClick= $this->blur(). + $aOnClick = $this->blur() . - $addJS. + $addJS . - 'vHWin=window.open(\''.$url.t3lib_div::implodeArrayForUrl('',array('P'=>$params)).'\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode('.$this->elName($itemName).'.value,200)'.$curSelectedValues.',\'popUp'.$md5ID.'\',\''.$wConf['JSopenParams'].'\');'. + 'vHWin=window.open(\'' . $url . t3lib_div::implodeArrayForUrl('', array('P' => $params)) . '\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode(' . $this->elName($itemName) . '.value,200)' . $curSelectedValues . ',\'popUp' . $md5ID . '\',\'' . $wConf['JSopenParams'] . '\');' . 'vHWin.focus();return false;'; // Setting "colorBoxLinks" - user LATER to wrap around the color box as well: - $colorBoxLinks = Array('',''); + $colorBoxLinks = Array('', ''); - if ((string)$wConf['type']=='popup') { + if ((string) $wConf['type'] == 'popup') { - $outArr[] = $colorBoxLinks[0].$icon.$colorBoxLinks[1]; + $outArr[] = $colorBoxLinks[0] . $icon . $colorBoxLinks[1]; } break; case 'userFunc': - $params['item'] = &$item; // Reference set! + $params['item'] = &$item; // Reference set! $params['icon'] = $icon; $params['iTitle'] = $iTitle; $params['wConf'] = $wConf; $params['row'] = $row; - $outArr[] = t3lib_div::callUserFunction($wConf['userFunc'],$params,$this); + $outArr[] = t3lib_div::callUserFunction($wConf['userFunc'], $params, $this); break; } } // Hide the real form element? - if (is_array($wConf['hideParent']) || $wConf['hideParent']) { + if (is_array($wConf['hideParent']) || $wConf['hideParent']) { - $item = $itemKinds[1]; // Setting the item to a hidden-field. + $item = $itemKinds[1]; // Setting the item to a hidden-field. - if (is_array($wConf['hideParent'])) { + if (is_array($wConf['hideParent'])) { - $item.= $this->getSingleField_typeNone_render($wConf['hideParent'], $PA['itemFormElValue']); + $item .= $this->getSingleField_typeNone_render($wConf['hideParent'], $PA['itemFormElValue']); } } } @@ -4010,27 +4005,27 @@ case 'select': $fieldValue = array('config' => $wConf); $TSconfig = $this->setTSconfig($table, $row); - $TSconfig[$field] = $TSconfig[$field]['wizards.'][$wid.'.']; + $TSconfig[$field] = $TSconfig[$field]['wizards.'][$wid . '.']; $selItems = $this->addSelectOptionsToItemArray($this->initItemArray($fieldValue), $fieldValue, $TSconfig, $field); $opt = array(); - $opt[] = ''; + $opt[] = ''; - foreach($selItems as $p) { + foreach ($selItems as $p) { - $opt[] = ''; + $opt[] = ''; } - if ($wConf['mode']=='append') { + if ($wConf['mode'] == 'append') { - $assignValue = $this->elName($itemName).'.value=\'\'+this.options[this.selectedIndex].value+'.$this->elName($itemName).'.value'; + $assignValue = $this->elName($itemName) . '.value=\'\'+this.options[this.selectedIndex].value+' . $this->elName($itemName) . '.value'; - } elseif ($wConf['mode']=='prepend') { + } elseif ($wConf['mode'] == 'prepend') { - $assignValue = $this->elName($itemName).'.value+=\'\'+this.options[this.selectedIndex].value'; + $assignValue = $this->elName($itemName) . '.value+=\'\'+this.options[this.selectedIndex].value'; } else { - $assignValue = $this->elName($itemName).'.value=this.options[this.selectedIndex].value'; + $assignValue = $this->elName($itemName) . '.value=this.options[this.selectedIndex].value'; } - $sOnChange = $assignValue.';this.blur();this.selectedIndex=0;'.implode('',$fieldChangeFunc); + $sOnChange = $assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc); - $outArr[] = ''; + $outArr[] = ''; break; case 'suggest': if (isset($PA['fieldTSConfig']['suggest.']['default.']['hide']) && - ((bool)$PA['fieldTSConfig']['suggest.']['default.']['hide'] == TRUE)) { + ((bool) $PA['fieldTSConfig']['suggest.']['default.']['hide'] == TRUE)) { break; } $outArr[] = $this->suggest->renderSuggestSelector($PA['itemFormElName'], $table, $field, $row, $PA); @@ -4038,20 +4033,20 @@ } // Color wizard colorbox: - if ((string)$wConf['type']=='colorbox') { + if ((string) $wConf['type'] == 'colorbox') { - $dim = t3lib_div::intExplode('x',$wConf['dim']); + $dim = t3lib_div::intExplode('x', $wConf['dim']); - $dX = t3lib_div::intInRange($dim[0],1,200,20); + $dX = t3lib_div::intInRange($dim[0], 1, 200, 20); - $dY = t3lib_div::intInRange($dim[1],1,200,20); + $dY = t3lib_div::intInRange($dim[1], 1, 200, 20); - $color = $PA['itemFormElValue'] ? ' bgcolor="'.htmlspecialchars($PA['itemFormElValue']).'"' : ''; + $color = $PA['itemFormElValue'] ? ' bgcolor="' . htmlspecialchars($PA['itemFormElValue']) . '"' : ''; - $outArr[] = ' + $outArr[] = '
- + '
'. + ' . - $colorBoxLinks[0].'backPath, + t3lib_iconWorks::skinImg($this->backPath, - (strlen(trim($color))==0 || strcmp(trim($color),'0')==0) ? 'gfx/colorpicker_empty.png' : 'gfx/colorpicker.png', + (strlen(trim($color)) == 0 || strcmp(trim($color), '0') == 0) ? 'gfx/colorpicker_empty.png' : 'gfx/colorpicker.png', - 'width="'.$dX.'" height="'.$dY.'"'.t3lib_BEfunc::titleAltAttrib(trim($iTitle.' '.$PA['itemFormElValue'])).' border="0"'). + 'width="' . $dX . '" height="' . $dY . '"' . t3lib_BEfunc::titleAltAttrib(trim($iTitle . ' ' . $PA['itemFormElValue'])) . ' border="0"') . - '>'.$colorBoxLinks[1]. + '>' . $colorBoxLinks[1] . - '
'; } @@ -4059,36 +4054,38 @@ } // For each rendered wizard, put them together around the item. - if (count($outArr)) { + if (count($outArr)) { - if ($wizConf['_HIDDENFIELD']) $item = $itemKinds[1]; + if ($wizConf['_HIDDENFIELD']) { + $item = $itemKinds[1]; + } $outStr = ''; - $vAlign = $wizConf['_VALIGN'] ? ' style="vertical-align:'.$wizConf['_VALIGN'].'"' : ''; + $vAlign = $wizConf['_VALIGN'] ? ' style="vertical-align:' . $wizConf['_VALIGN'] . '"' : ''; - if (count($outArr)>1 || $wizConf['_PADDING']) { + if (count($outArr) > 1 || $wizConf['_PADDING']) { $dist = intval($wizConf['_DISTANCE']); - if ($wizConf['_VERTICAL']) { + if ($wizConf['_VERTICAL']) { - $dist = $dist ? '' : ''; + $dist = $dist ? '' : ''; - $outStr = ''.implode(''.$dist.'',$outArr).''; + $outStr = '' . implode('' . $dist . '', $outArr) . ''; } else { - $dist = $dist ? '' : ''; + $dist = $dist ? '' : ''; - $outStr = ''.implode(''.$dist.'',$outArr).''; + $outStr = '' . implode('' . $dist . '', $outArr) . ''; } - $outStr = ''.$outStr.'
'; + $outStr = '' . $outStr . '
'; } else { - $outStr = implode('',$outArr); + $outStr = implode('', $outArr); } - if (!strcmp($wizConf['_POSITION'],'left')) { + if (!strcmp($wizConf['_POSITION'], 'left')) { - $outStr = ''.$outStr.''.$item.''; + $outStr = '' . $outStr . '' . $item . ''; - } elseif (!strcmp($wizConf['_POSITION'],'top')) { + } elseif (!strcmp($wizConf['_POSITION'], 'top')) { - $outStr = ''.$outStr.''.$item.''; + $outStr = '' . $outStr . '' . $item . ''; - } elseif (!strcmp($wizConf['_POSITION'],'bottom')) { + } elseif (!strcmp($wizConf['_POSITION'], 'bottom')) { - $outStr = ''.$item.''.$outStr.''; + $outStr = '' . $item . '' . $outStr . ''; } else { - $outStr = ''.$item.''.$outStr.''; + $outStr = '' . $item . '' . $outStr . ''; } - $item = ''.$outStr.'
'; + $item = '' . $outStr . '
'; } } return $item; @@ -4100,26 +4097,26 @@ * @param string Icon reference * @return array Array with two values; the icon file reference (relative to PATH_typo3 minus backPath), the icon file information array (getimagesize()) */ - function getIcon($icon) { + function getIcon($icon) { - if (substr($icon,0,4)=='EXT:') { + if (substr($icon, 0, 4) == 'EXT:') { $file = t3lib_div::getFileAbsFileName($icon); - if ($file) { + if ($file) { - $file = substr($file,strlen(PATH_site)); + $file = substr($file, strlen(PATH_site)); - $selIconFile = $this->backPath.'../'.$file; + $selIconFile = $this->backPath . '../' . $file; - $selIconInfo = @getimagesize(PATH_site.$file); + $selIconInfo = @getimagesize(PATH_site . $file); } - } elseif (substr($icon,0,3)=='../') { + } elseif (substr($icon, 0, 3) == '../') { - $selIconFile = $this->backPath.t3lib_div::resolveBackPath($icon); + $selIconFile = $this->backPath . t3lib_div::resolveBackPath($icon); - $selIconInfo = @getimagesize(PATH_site.t3lib_div::resolveBackPath(substr($icon,3))); + $selIconInfo = @getimagesize(PATH_site . t3lib_div::resolveBackPath(substr($icon, 3))); - } elseif (substr($icon,0,4)=='ext/' || substr($icon,0,7)=='sysext/') { + } elseif (substr($icon, 0, 4) == 'ext/' || substr($icon, 0, 7) == 'sysext/') { - $selIconFile = $this->backPath.$icon; + $selIconFile = $this->backPath . $icon; - $selIconInfo = @getimagesize(PATH_typo3.$icon); + $selIconInfo = @getimagesize(PATH_typo3 . $icon); } else { - $selIconFile = t3lib_iconWorks::skinImg($this->backPath,'gfx/'.$icon,'',1); + $selIconFile = t3lib_iconWorks::skinImg($this->backPath, 'gfx/' . $icon, '', 1); $iconPath = substr($selIconFile, strlen($this->backPath)); $selIconInfo = @getimagesize(PATH_typo3 . $iconPath); } - return array($selIconFile,$selIconInfo); + return array($selIconFile, $selIconInfo); } /** @@ -4128,17 +4125,17 @@ * @param string Icon string for option item * @return string Style attribute content, if any */ - function optionTagStyle($iconString) { + function optionTagStyle($iconString) { - if ($iconString) { + if ($iconString) { - list($selIconFile,$selIconInfo) = $this->getIcon($iconString); + list($selIconFile, $selIconInfo) = $this->getIcon($iconString); - $padLeft = $selIconInfo[0]+4; + $padLeft = $selIconInfo[0] + 4; - if($padLeft >= 18 && $padLeft <= 24) { + if ($padLeft >= 18 && $padLeft <= 24) { $padLeft = 22; // In order to get the same padding for all option tags even if icon sizes differ a little, set it to 22 if it was between 18 and 24 pixels } - $padTop = t3lib_div::intInRange(($selIconInfo[1]-12)/2,0); + $padTop = t3lib_div::intInRange(($selIconInfo[1] - 12) / 2, 0); $styleAttr = 'background: #fff url(' . $selIconFile . ') 0% 50% no-repeat; height: ' . t3lib_div::intInRange(($selIconInfo[1] + 2) - $padTop, 0) . 'px; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;'; return $styleAttr; } @@ -4151,11 +4148,11 @@ * @param array Values in an array * @return array Input string exploded with comma and for each value only the label part is set in the array. Keys are numeric */ - function extractValuesOnlyFromValueLabelList($itemFormElValue) { + function extractValuesOnlyFromValueLabelList($itemFormElValue) { // Get values of selected items: - $itemArray = t3lib_div::trimExplode(',',$itemFormElValue,1); + $itemArray = t3lib_div::trimExplode(',', $itemFormElValue, 1); - foreach($itemArray as $tk => $tv) { + foreach ($itemArray as $tk => $tv) { - $tvP = explode('|',$tv,2); + $tvP = explode('|', $tv, 2); $tvP[0] = rawurldecode($tvP[0]); $itemArray[$tk] = $tvP[0]; @@ -4171,13 +4168,13 @@ * @param array The palette pointer. * @param integer The record array */ - function wrapOpenPalette($header,$table,$row,$palette,$retFunc) { + function wrapOpenPalette($header, $table, $row, $palette, $retFunc) { - $id = 'TCEFORMS_'.$table.'_'.$palette.'_'.$row['uid']; + $id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid']; - $res = ''.$header.''; + $res = '' . $header . ''; - return array($res,''); + return array($res, ''); } - /** + /** * Add the id and the style property to the field palette * * @param string Palette Code @@ -4186,10 +4183,10 @@ * @param string The record array * @return boolean is collapsed */ - function wrapPaletteField($code,$table,$row,$palette,$collapsed ) { + function wrapPaletteField($code, $table, $row, $palette, $collapsed) { $display = $collapsed ? 'none' : 'block'; - $id = 'TCEFORMS_'.$table.'_'.$palette.'_'.$row['uid']; + $id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid']; - $code = '
'.$code.'
'; + $code = '
' . $code . '
'; return $code; } @@ -4203,11 +4200,11 @@ * @param string Additional JavaScript for the onclick handler. * @return string The onclick attribute + possibly the checked-option set. */ - function checkBoxParams($itemName,$thisValue,$c,$iCount,$addFunc='') { + function checkBoxParams($itemName, $thisValue, $c, $iCount, $addFunc = '') { - $onClick = $this->elName($itemName).'.value=this.checked?('.$this->elName($itemName).'.value|'.pow(2,$c).'):('.$this->elName($itemName).'.value&'.(pow(2,$iCount)-1-pow(2,$c)).');'. + $onClick = $this->elName($itemName) . '.value=this.checked?(' . $this->elName($itemName) . '.value|' . pow(2, $c) . '):(' . $this->elName($itemName) . '.value&' . (pow(2, $iCount) - 1 - pow(2, $c)) . ');' . - $addFunc; + $addFunc; - $str = ' onclick="'.htmlspecialchars($onClick).'"'. + $str = ' onclick="' . htmlspecialchars($onClick) . '"' . - (($thisValue&pow(2,$c))?' checked="checked"':''); + (($thisValue & pow(2, $c)) ? ' checked="checked"' : ''); return $str; } @@ -4217,8 +4214,8 @@ * @param string Form element name * @return string Form element reference (JS) */ - function elName($itemName) { + function elName($itemName) { - return 'document.'.$this->formName."['".$itemName."']"; + return 'document.' . $this->formName . "['" . $itemName . "']"; } /** @@ -4231,10 +4228,10 @@ * @return string * @deprecated since TYPO3 4.1, this function will be removed in TYPO3 4.6. */ - function noTitle($str,$wrapParts=array()) { + function noTitle($str, $wrapParts = array()) { t3lib_div::logDeprecatedFunction(); - return strcmp($str,'') ? $str : $wrapParts[0].'['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').']'.$wrapParts[1]; + return strcmp($str, '') ? $str : $wrapParts[0] . '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . ']' . $wrapParts[1]; } /** @@ -4242,8 +4239,8 @@ * * @return string If the current browser supports styles, the string 'this.blur();' is returned. */ - function blur() { + function blur() { - return $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();':''; + return $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : ''; } /** @@ -4251,7 +4248,7 @@ * * @return string Return URL of current script */ - function thisReturnUrl() { + function thisReturnUrl() { return $this->returnUrl ? $this->returnUrl : t3lib_div::linkThisScript(); } @@ -4264,16 +4261,16 @@ * @param array The row * @return string The hidden-field tag. */ - function getSingleHiddenField($table,$field,$row) { + function getSingleHiddenField($table, $field, $row) { global $TCA; - $out=''; + $out = ''; t3lib_div::loadTCA($table); - if ($TCA[$table]['columns'][$field]) { + if ($TCA[$table]['columns'][$field]) { - $uid=$row['uid']; + $uid = $row['uid']; - $itemName=$this->prependFormFieldNames.'['.$table.']['.$uid.']['.$field.']'; + $itemName = $this->prependFormFieldNames . '[' . $table . '][' . $uid . '][' . $field . ']'; - $itemValue=$row[$field]; + $itemValue = $row[$field]; - $item.=''; + $item .= ''; $out = $item; } return $out; @@ -4286,7 +4283,7 @@ * @param boolean If this is for a text area. * @return string Either a "style" attribute string or "cols"/"size" attribute string. */ - function formWidth($size=48,$textarea=0) { + function formWidth($size = 48, $textarea = 0) { $widthAndStyleAttributes = ''; $fieldWidthAndStyle = $this->formWidthAsArray($size, $textarea); @@ -4312,7 +4309,7 @@ * @param boolean If set, calculates sizes for a text area. * @return array An array containing style, class, and width attributes. */ - protected function formWidthAsArray($size = 48, $textarea = false) { + protected function formWidthAsArray($size = 48, $textarea = FALSE) { $fieldWidthAndStyle = array('style' => '', 'class' => '', 'width' => ''); if ($this->docLarge) { @@ -4327,8 +4324,8 @@ // Setting width by style-attribute. 'cols' MUST be avoided with NN6+ $widthInPixels = ceil($size * $this->form_rowsToStylewidth); $fieldWidthAndStyle['style'] = 'width: ' . $widthInPixels . 'px; ' - . $this->defStyle - . $this->formElStyle($textarea ? 'text' : 'input'); + . $this->defStyle + . $this->formElStyle($textarea ? 'text' : 'input'); $fieldWidthAndStyle['class'] = $this->formElClass($textarea ? 'text' : 'input'); } @@ -4344,11 +4341,11 @@ * @return string The "cols" attribute string (or style from formWidth()) * @see formWidth() */ - function formWidthText($size=48,$wrap='') { + function formWidthText($size = 48, $wrap = '') { - $wTags = $this->formWidth($size,1); + $wTags = $this->formWidth($size, 1); // Netscape 6+ seems to have this ODD problem where there WILL ALWAYS be wrapping with the cols-attribute set and NEVER without the col-attribute... - if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) { + if (strtolower(trim($wrap)) != 'off' && $GLOBALS['CLIENT']['BROWSER'] == 'net' && $GLOBALS['CLIENT']['VERSION'] >= 5) { - $wTags.= ' cols="'.$size.'"'; + $wTags .= ' cols="' . $size . '"'; } return $wTags; } @@ -4360,7 +4357,7 @@ * @return string CSS attributes * @see formElStyleClassValue() */ - function formElStyle($type) { + function formElStyle($type) { return $this->formElStyleClassValue($type); } @@ -4371,7 +4368,7 @@ * @return string CSS attributes * @see formElStyleClassValue() */ - function formElClass($type) { + function formElClass($type) { return $this->formElStyleClassValue($type, TRUE); } @@ -4382,17 +4379,17 @@ * @param boolean If set, will return value only if prefixed with CLASS, otherwise must not be prefixed "CLASS" * @return string CSS attributes */ - function formElStyleClassValue($type, $class=FALSE) { + function formElStyleClassValue($type, $class = FALSE) { // Get value according to field: - if (isset($this->fieldStyle[$type])) { + if (isset($this->fieldStyle[$type])) { $style = trim($this->fieldStyle[$type]); } else { $style = trim($this->fieldStyle['all']); } // Check class prefixed: - if (substr($style,0,6)=='CLASS:') { + if (substr($style, 0, 6) == 'CLASS:') { - $out = $class ? trim(substr($style,6)) : ''; + $out = $class ? trim(substr($style, 6)) : ''; } else { $out = !$class ? $style : ''; } @@ -4407,11 +4404,11 @@ * @param string Additional class(es) to be added * @return string CSS attributes */ - function insertDefStyle($type, $additionalClass = '') { + function insertDefStyle($type, $additionalClass = '') { $out = ''; - $style = trim($this->defStyle.$this->formElStyle($type)); + $style = trim($this->defStyle . $this->formElStyle($type)); - $out.= $style?' style="'.htmlspecialchars($style).'"':''; + $out .= $style ? ' style="' . htmlspecialchars($style) . '"' : ''; $class = $this->formElClass($type); $classAttributeValue = join(' ', array_filter(array($class, $additionalClass))); @@ -4434,27 +4431,18 @@ return $GLOBALS['TBE_TEMPLATE']->getDynTabMenu($parts, $idString, 0, FALSE, 0, 1, FALSE, 1, $dividersToTabsBehaviour); } else { $output = ''; - foreach($parts as $singlePad) { + foreach ($parts as $singlePad) { - $output.=' + $output .= ' -

'.htmlspecialchars($singlePad['label']).'

+

' . htmlspecialchars($singlePad['label']) . '

- '.($singlePad['description'] ? '

'.nl2br(htmlspecialchars($singlePad['description'])).'

' : '').' + ' . ($singlePad['description'] ? '

' . nl2br(htmlspecialchars($singlePad['description'])) . '

' : '') . ' - '.$singlePad['content']; + ' . $singlePad['content']; } - return '
'.$output.'
'; + return '
' . $output . '
'; } } - - - - - - - - - /************************************************************ * * Item-array manipulation functions (check/select/radio) @@ -4468,9 +4456,9 @@ * @param array The "columns" array for the field (from TCA) * @return array An array of arrays with three elements; label, value, icon */ - function initItemArray($fieldValue) { + function initItemArray($fieldValue) { $items = array(); - if (is_array($fieldValue['config']['items'])) { + if (is_array($fieldValue['config']['items'])) { foreach ($fieldValue['config']['items'] as $itemValue) { $items[] = array($this->sL($itemValue[0]), $itemValue[1], $itemValue[2]); } @@ -4485,11 +4473,11 @@ * @param array An array of items to add. NOTICE: The keys are mapped to values, and the values and mapped to be labels. No possibility of adding an icon. * @return array The updated $item array */ - function addItems($items,$iArray) { + function addItems($items, $iArray) { global $TCA; - if (is_array($iArray)) { + if (is_array($iArray)) { foreach ($iArray as $value => $label) { - $items[]=array($this->sl($label),$value); + $items[] = array($this->sl($label), $value); } } return $items; @@ -4506,10 +4494,10 @@ * @param string Field name * @return array The modified $items array */ - function procItems($items,$iArray,$config,$table,$row,$field) { + function procItems($items, $iArray, $config, $table, $row, $field) { global $TCA; - $params=array(); + $params = array(); $params['items'] = &$items; $params['config'] = $config; $params['TSconfig'] = $iArray; @@ -4517,7 +4505,7 @@ $params['row'] = $row; $params['field'] = $field; - t3lib_div::callUserFunction($config['itemsProcFunc'],$params,$this); + t3lib_div::callUserFunction($config['itemsProcFunc'], $params, $this); return $items; } @@ -4530,34 +4518,34 @@ * @param string The fieldname * @return array The $items array modified. */ - function addSelectOptionsToItemArray($items,$fieldValue,$TSconfig,$field) { + function addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field) { global $TCA; // Values from foreign tables: - if ($fieldValue['config']['foreign_table']) { + if ($fieldValue['config']['foreign_table']) { - $items = $this->foreignTable($items,$fieldValue,$TSconfig,$field); + $items = $this->foreignTable($items, $fieldValue, $TSconfig, $field); - if ($fieldValue['config']['neg_foreign_table']) { + if ($fieldValue['config']['neg_foreign_table']) { - $items = $this->foreignTable($items,$fieldValue,$TSconfig,$field,1); + $items = $this->foreignTable($items, $fieldValue, $TSconfig, $field, 1); } } // Values from a file folder: - if ($fieldValue['config']['fileFolder']) { + if ($fieldValue['config']['fileFolder']) { $fileFolder = t3lib_div::getFileAbsFileName($fieldValue['config']['fileFolder']); - if (@is_dir($fileFolder)) { + if (@is_dir($fileFolder)) { // Configurations: $extList = $fieldValue['config']['fileFolder_extList']; - $recursivityLevels = isset($fieldValue['config']['fileFolder_recursions']) ? t3lib_div::intInRange($fieldValue['config']['fileFolder_recursions'],0,99) : 99; + $recursivityLevels = isset($fieldValue['config']['fileFolder_recursions']) ? t3lib_div::intInRange($fieldValue['config']['fileFolder_recursions'], 0, 99) : 99; // Get files: - $fileFolder = rtrim($fileFolder, '/').'/'; + $fileFolder = rtrim($fileFolder, '/') . '/'; - $fileArr = t3lib_div::getAllFilesAndFoldersInPath(array(),$fileFolder,$extList,0,$recursivityLevels); + $fileArr = t3lib_div::getAllFilesAndFoldersInPath(array(), $fileFolder, $extList, 0, $recursivityLevels); $fileArr = t3lib_div::removePrefixPathFromList($fileArr, $fileFolder); - foreach($fileArr as $fileRef) { + foreach ($fileArr as $fileRef) { $fI = pathinfo($fileRef); - $icon = t3lib_div::inList('gif,png,jpeg,jpg', strtolower($fI['extension'])) ? '../'.substr($fileFolder,strlen(PATH_site)).$fileRef : ''; + $icon = t3lib_div::inList('gif,png,jpeg,jpg', strtolower($fI['extension'])) ? '../' . substr($fileFolder, strlen(PATH_site)) . $fileRef : ''; $items[] = array( $fileRef, $fileRef, @@ -4568,20 +4556,20 @@ } // If 'special' is configured: - if ($fieldValue['config']['special']) { + if ($fieldValue['config']['special']) { - switch ($fieldValue['config']['special']) { + switch ($fieldValue['config']['special']) { case 'tables': $temp_tc = array_keys($TCA); $descr = ''; - foreach($temp_tc as $theTableNames) { + foreach ($temp_tc as $theTableNames) { - if (!$TCA[$theTableNames]['ctrl']['adminOnly']) { + if (!$TCA[$theTableNames]['ctrl']['adminOnly']) { // Icon: - $icon = '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon($theTableNames, array()),'',1); + $icon = '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, t3lib_iconWorks::getIcon($theTableNames, array()), '', 1); // Add description texts: - if ($this->edit_showFieldHelp) { + if ($this->edit_showFieldHelp) { $GLOBALS['LANG']->loadSingleTableDescription($theTableNames); $fDat = $GLOBALS['TCA_DESCR'][$theTableNames]['columns']['']; $descr = $fDat['description']; @@ -4600,9 +4588,9 @@ case 'pagetypes': $theTypes = $TCA['pages']['columns']['doktype']['config']['items']; - foreach($theTypes as $theTypeArrays) { + foreach ($theTypes as $theTypeArrays) { // Icon: - $icon = $theTypeArrays[1]!='--div--' ? '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon('pages', array('doktype' => $theTypeArrays[1])),'',1) : ''; + $icon = $theTypeArrays[1] != '--div--' ? '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, t3lib_iconWorks::getIcon('pages', array('doktype' => $theTypeArrays[1])), '', 1) : ''; // Item configuration: $items[] = array( @@ -4616,11 +4604,11 @@ $theTypes = t3lib_BEfunc::getExcludeFields(); $descr = ''; - foreach($theTypes as $theTypeArrays) { + foreach ($theTypes as $theTypeArrays) { list($theTable, $theField) = explode(':', $theTypeArrays[1]); // Add description texts: - if ($this->edit_showFieldHelp) { + if ($this->edit_showFieldHelp) { $GLOBALS['LANG']->loadSingleTableDescription($theTable); $fDat = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField]; $descr = $fDat['description']; @@ -4638,16 +4626,16 @@ case 'explicitValues': $theTypes = t3lib_BEfunc::getExplicitAuthFieldValues(); - // Icons: + // Icons: $icons = array( - 'ALLOW' => '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,'gfx/icon_ok2.gif','',1), + 'ALLOW' => '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, 'gfx/icon_ok2.gif', '', 1), - 'DENY' => '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,'gfx/icon_fatalerror.gif','',1), + 'DENY' => '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, 'gfx/icon_fatalerror.gif', '', 1), ); // Traverse types: - foreach($theTypes as $tableFieldKey => $theTypeArrays) { + foreach ($theTypes as $tableFieldKey => $theTypeArrays) { - if (is_array($theTypeArrays['items'])) { + if (is_array($theTypeArrays['items'])) { // Add header: $items[] = array( $theTypeArrays['tableFieldLabel'], @@ -4655,11 +4643,11 @@ ); // Traverse options for this field: - foreach($theTypeArrays['items'] as $itemValue => $itemContent) { + foreach ($theTypeArrays['items'] as $itemValue => $itemContent) { // Add item to be selected: $items[] = array( - '['.$itemContent[2].'] '.$itemContent[1], + '[' . $itemContent[2] . '] ' . $itemContent[1], - $tableFieldKey.':'.preg_replace('/[:|,]/','',$itemValue).':'.$itemContent[0], + $tableFieldKey . ':' . preg_replace('/[:|,]/', '', $itemValue) . ':' . $itemContent[0], $icons[$itemContent[0]] ); } @@ -4667,14 +4655,14 @@ } break; case 'languages': - $items = array_merge($items,t3lib_BEfunc::getSystemLanguages()); + $items = array_merge($items, t3lib_BEfunc::getSystemLanguages()); break; case 'custom': // Initialize: $customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions']; - if (is_array($customOptions)) { + if (is_array($customOptions)) { - foreach($customOptions as $coKey => $coValue) { + foreach ($customOptions as $coKey => $coValue) { - if (is_array($coValue['items'])) { + if (is_array($coValue['items'])) { // Add header: $items[] = array( $GLOBALS['LANG']->sl($coValue['header']), @@ -4682,17 +4670,21 @@ ); // Traverse items: - foreach($coValue['items'] as $itemKey => $itemCfg) { + foreach ($coValue['items'] as $itemKey => $itemCfg) { // Icon: - if ($itemCfg[1]) { + if ($itemCfg[1]) { list($icon) = $this->getIcon($itemCfg[1]); - if ($icon) $icon = '../'.TYPO3_mainDir.$icon; - } else $icon = ''; + if ($icon) { + $icon = '../' . TYPO3_mainDir . $icon; + } + } else { + $icon = ''; + } // Add item to be selected: $items[] = array( $GLOBALS['LANG']->sl($itemCfg[0]), - $coKey.':'.preg_replace('/[:|,]/','',$itemKey), + $coKey . ':' . preg_replace('/[:|,]/', '', $itemKey), $icon, $GLOBALS['LANG']->sl($itemCfg[2]), ); @@ -4706,23 +4698,23 @@ $loadModules = t3lib_div::makeInstance('t3lib_loadModules'); $loadModules->load($GLOBALS['TBE_MODULES']); - $modList = $fieldValue['config']['special']=='modListUser' ? $loadModules->modListUser : $loadModules->modListGroup; + $modList = $fieldValue['config']['special'] == 'modListUser' ? $loadModules->modListUser : $loadModules->modListGroup; - if (is_array($modList)) { + if (is_array($modList)) { $descr = ''; - foreach($modList as $theMod) { + foreach ($modList as $theMod) { // Icon: - $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$theMod.'_tab']; + $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$theMod . '_tab']; - if ($icon) { + if ($icon) { - $icon = '../'.substr($icon,strlen(PATH_site)); + $icon = '../' . substr($icon, strlen(PATH_site)); } // Description texts: - if ($this->edit_showFieldHelp) { + if ($this->edit_showFieldHelp) { - $descr = $GLOBALS['LANG']->moduleLabels['labels'][$theMod.'_tablabel']. + $descr = $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tablabel'] . - LF. + LF . - $GLOBALS['LANG']->moduleLabels['labels'][$theMod.'_tabdescr']; + $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tabdescr']; } // Item configuration: @@ -4750,13 +4742,15 @@ * @access private * @see addSelectOptionsToItemArray() */ - function addSelectOptionsToItemArray_makeModuleData($value) { + function addSelectOptionsToItemArray_makeModuleData($value) { $label = ''; // Add label for main module: - $pp = explode('_',$value); + $pp = explode('_', $value); - if (count($pp)>1) $label.=$GLOBALS['LANG']->moduleLabels['tabs'][$pp[0].'_tab'].'>'; + if (count($pp) > 1) { + $label .= $GLOBALS['LANG']->moduleLabels['tabs'][$pp[0] . '_tab'] . '>'; + } // Add modules own label now: - $label.= $GLOBALS['LANG']->moduleLabels['tabs'][$value.'_tab']; + $label .= $GLOBALS['LANG']->moduleLabels['tabs'][$value . '_tab']; return $label; } @@ -4772,42 +4766,44 @@ * @return array The $items array modified. * @see addSelectOptionsToItemArray(), t3lib_BEfunc::exec_foreign_table_where_query() */ - function foreignTable($items,$fieldValue,$TSconfig,$field,$pFFlag=0) { + function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = 0) { global $TCA; // Init: - $pF=$pFFlag?'neg_':''; + $pF = $pFFlag ? 'neg_' : ''; - $f_table = $fieldValue['config'][$pF.'foreign_table']; + $f_table = $fieldValue['config'][$pF . 'foreign_table']; - $uidPre = $pFFlag?'-':''; + $uidPre = $pFFlag ? '-' : ''; // Get query: - $res = t3lib_BEfunc::exec_foreign_table_where_query($fieldValue,$field,$TSconfig,$pF); + $res = t3lib_BEfunc::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF); // Perform lookup - if ($GLOBALS['TYPO3_DB']->sql_error()) { + if ($GLOBALS['TYPO3_DB']->sql_error()) { - echo($GLOBALS['TYPO3_DB']->sql_error()."\n\nThis may indicate a table defined in tables.php is not existing in the database!"); + echo($GLOBALS['TYPO3_DB']->sql_error() . "\n\nThis may indicate a table defined in tables.php is not existing in the database!"); return array(); } // Get label prefix. - $lPrefix = $this->sL($fieldValue['config'][$pF.'foreign_table_prefix']); + $lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']); // Get icon field + path if any: $iField = $TCA[$f_table]['ctrl']['selicon_field']; $iPath = trim($TCA[$f_table]['ctrl']['selicon_field_path']); // Traverse the selected rows to add them: - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { t3lib_BEfunc::workspaceOL($f_table, $row); - if (is_array($row)) { + if (is_array($row)) { // Prepare the icon if available: - if ($iField && $iPath && $row[$iField]) { + if ($iField && $iPath && $row[$iField]) { - $iParts = t3lib_div::trimExplode(',',$row[$iField],1); + $iParts = t3lib_div::trimExplode(',', $row[$iField], 1); - $icon = '../'.$iPath.'/'.trim($iParts[0]); + $icon = '../' . $iPath . '/' . trim($iParts[0]); - } elseif (t3lib_div::inList('singlebox,checkbox',$fieldValue['config']['renderMode'])) { + } elseif (t3lib_div::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) { - $icon = '../'.TYPO3_mainDir.t3lib_iconWorks::skinImg($this->backPath,t3lib_iconWorks::getIcon($f_table, $row),'',1); + $icon = '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, t3lib_iconWorks::getIcon($f_table, $row), '', 1); - } else $icon = ''; + } else { + $icon = ''; + } // Add the item: $items[] = array( @@ -4821,29 +4817,6 @@ } - - - - - - - - - - - - - - - - - - - - - - - /******************************************** * * Template functions @@ -4856,7 +4829,7 @@ * * @return void */ - function setNewBEDesign() { + function setNewBEDesign() { $template = t3lib_div::getURL(PATH_typo3 . $this->templateFile); // Wrapping all table rows for a particular record being edited: @@ -4878,14 +4851,14 @@ * @param string Alternative template to use instead of the default. * @return string */ - function intoTemplate($inArr,$altTemplate='') { + function intoTemplate($inArr, $altTemplate = '') { - // Put into template_ + // Put into template_ - $fieldTemplateParts = explode('###FIELD_',$this->rplColorScheme($altTemplate?$altTemplate:$this->fieldTemplate)); + $fieldTemplateParts = explode('###FIELD_', $this->rplColorScheme($altTemplate ? $altTemplate : $this->fieldTemplate)); - $out=current($fieldTemplateParts); + $out = current($fieldTemplateParts); foreach ($fieldTemplateParts as $part) { - list($key,$val)=explode('###',$part,2); + list($key, $val) = explode('###', $part, 2); - $out.=$inArr[$key]; + $out .= $inArr[$key]; - $out.=$val; + $out .= $val; } return $out; } @@ -4901,7 +4874,7 @@ * @return array marker array for template output * @see function intoTemplate() */ - function addUserTemplateMarkers($marker,$table,$field,$row,&$PA) { + function addUserTemplateMarkers($marker, $table, $field, $row, &$PA) { return $marker; } @@ -4912,7 +4885,7 @@ * @param string Input string. * @return string Output string. */ - function wrapLabels($str) { + function wrapLabels($str) { return $str; } @@ -4925,9 +4898,9 @@ * @param string The table name * @return string */ - function wrapTotal($c,$rec,$table) { + function wrapTotal($c, $rec, $table) { - $parts = $this->replaceTableWrap(explode('|',$this->totalWrap,2),$rec,$table); + $parts = $this->replaceTableWrap(explode('|', $this->totalWrap, 2), $rec, $table); - return $parts[0].$c.$parts[1].implode('',$this->hiddenFieldAccum); + return $parts[0] . $c . $parts[1] . implode('', $this->hiddenFieldAccum); } /** @@ -4938,13 +4911,13 @@ * @param string The table name * @return string */ - function replaceTableWrap($arr,$rec,$table) { + function replaceTableWrap($arr, $rec, $table) { global $TCA; // Make "new"-label - if (strstr($rec['uid'],'NEW')) { + if (strstr($rec['uid'], 'NEW')) { - $newLabel = ' '. + $newLabel = ' ' . - $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.new',1). + $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.new', 1) . ''; // Kasper: Should not be used here because NEW records are not offline workspace versions... @@ -4968,8 +4941,8 @@ $pageTitle = sprintf($label, $tableTitle, $pageTitle); } } else { - $newLabel = ' ['.$rec['uid'].']'; + $newLabel = ' [' . $rec['uid'] . ']'; - $rLabel = t3lib_BEfunc::getRecordTitle($table, $rec, TRUE, FALSE); + $rLabel = t3lib_BEfunc::getRecordTitle($table, $rec, TRUE, FALSE); $prec = t3lib_BEfunc::getRecordWSOL('pages', $rec['pid'], 'uid,title'); // Fetch translated title of the table @@ -5002,12 +4975,12 @@ } } - foreach ($arr as $k => $v) { + foreach ($arr as $k => $v) { // Make substitutions: $arr[$k] = str_replace('###PAGE_TITLE###', $pageTitle, $arr[$k]); $arr[$k] = str_replace('###ID_NEW_INDICATOR###', $newLabel, $arr[$k]); $arr[$k] = str_replace('###RECORD_LABEL###', $rLabel, $arr[$k]); - $arr[$k] = str_replace('###TABLE_TITLE###',htmlspecialchars($this->sL($TCA[$table]['ctrl']['title'])),$arr[$k]); + $arr[$k] = str_replace('###TABLE_TITLE###', htmlspecialchars($this->sL($TCA[$table]['ctrl']['title'])), $arr[$k]); $arr[$k] = str_replace('###RECORD_ICON###', t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec))), $arr[$k]); @@ -5022,16 +4995,16 @@ * @param integer The pointer to the entry in the $out_array (passed by reference and incremented!) * @return void */ - function wrapBorder(&$out_array,&$out_pointer) { + function wrapBorder(&$out_array, &$out_pointer) { - if ($this->sectionWrap && $out_array[$out_pointer]) { + if ($this->sectionWrap && $out_array[$out_pointer]) { - $tableAttribs=''; + $tableAttribs = ''; - $tableAttribs.= $this->borderStyle[0] ? ' style="'.htmlspecialchars($this->borderStyle[0]).'"':''; + $tableAttribs .= $this->borderStyle[0] ? ' style="' . htmlspecialchars($this->borderStyle[0]) . '"' : ''; - $tableAttribs.= $this->borderStyle[2] ? ' background="'.htmlspecialchars($this->backPath.$this->borderStyle[2]).'"':''; + $tableAttribs .= $this->borderStyle[2] ? ' background="' . htmlspecialchars($this->backPath . $this->borderStyle[2]) . '"' : ''; - $tableAttribs.= $this->borderStyle[3] ? ' class="'.htmlspecialchars($this->borderStyle[3]).'"':''; + $tableAttribs .= $this->borderStyle[3] ? ' class="' . htmlspecialchars($this->borderStyle[3]) . '"' : ''; - if ($tableAttribs) { + if ($tableAttribs) { - $tableAttribs='border="0" cellspacing="0" cellpadding="0" width="100%"'.$tableAttribs; + $tableAttribs = 'border="0" cellspacing="0" cellpadding="0" width="100%"' . $tableAttribs; - $out_array[$out_pointer] = str_replace('###CONTENT###',$out_array[$out_pointer], + $out_array[$out_pointer] = str_replace('###CONTENT###', $out_array[$out_pointer], - str_replace('###TABLE_ATTRIBS###',$tableAttribs, $this->sectionWrap)); + str_replace('###TABLE_ATTRIBS###', $tableAttribs, $this->sectionWrap)); } $out_pointer++; } @@ -5043,16 +5016,16 @@ * @param string Template string with markers to be substituted. * @return string */ - function rplColorScheme($inTemplate) { + function rplColorScheme($inTemplate) { // Colors: - $inTemplate = str_replace('###BGCOLOR###',$this->colorScheme[0]?' bgcolor="'.$this->colorScheme[0].'"':'',$inTemplate); + $inTemplate = str_replace('###BGCOLOR###', $this->colorScheme[0] ? ' bgcolor="' . $this->colorScheme[0] . '"' : '', $inTemplate); - $inTemplate = str_replace('###BGCOLOR_HEAD###',$this->colorScheme[1]?' bgcolor="'.$this->colorScheme[1].'"':'',$inTemplate); + $inTemplate = str_replace('###BGCOLOR_HEAD###', $this->colorScheme[1] ? ' bgcolor="' . $this->colorScheme[1] . '"' : '', $inTemplate); - $inTemplate = str_replace('###FONTCOLOR_HEAD###',$this->colorScheme[3],$inTemplate); + $inTemplate = str_replace('###FONTCOLOR_HEAD###', $this->colorScheme[3], $inTemplate); // Classes: - $inTemplate = str_replace('###CLASSATTR_1###',$this->classScheme[0]?' class="'.$this->classScheme[0].'"':'',$inTemplate); + $inTemplate = str_replace('###CLASSATTR_1###', $this->classScheme[0] ? ' class="' . $this->classScheme[0] . '"' : '', $inTemplate); - $inTemplate = str_replace('###CLASSATTR_2###',$this->classScheme[1]?' class="'.$this->classScheme[1].'"':'',$inTemplate); + $inTemplate = str_replace('###CLASSATTR_2###', $this->classScheme[1] ? ' class="' . $this->classScheme[1] . '"' : '', $inTemplate); - $inTemplate = str_replace('###CLASSATTR_4###',$this->classScheme[3]?' class="'.$this->classScheme[3].'"':'',$inTemplate); + $inTemplate = str_replace('###CLASSATTR_4###', $this->classScheme[3] ? ' class="' . $this->classScheme[3] . '"' : '', $inTemplate); return $inTemplate; } @@ -5110,15 +5083,15 @@ $lastLineWasLinebreak = FALSE; $fieldIdentifierForJs = $content['TABLE'] . '_' . $content['ID'] . '_' . $content['FIELD']; $iRow[$row][] = '' . - '' . - $content['NAME'] . - '' . - '' . - '' . - '' . - $content['ITEM'] . - '' . - ''; + '' . + $content['NAME'] . + '' . + '' . + '' . + '' . + $content['ITEM'] . + '' . + ''; } } @@ -5145,9 +5118,9 @@ * @return string HTML, -tag with * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 */ - function helpTextIcon($table,$field,$force=0) { + function helpTextIcon($table, $field, $force = 0) { t3lib_div::logDeprecatedFunction(); - if ($this->globalShowHelp && $GLOBALS['TCA_DESCR'][$table]['columns'][$field] && (($this->edit_showFieldHelp=='icon'&&!$this->doLoadTableDescr($table)) || $force)) { + if ($this->globalShowHelp && $GLOBALS['TCA_DESCR'][$table]['columns'][$field] && (($this->edit_showFieldHelp == 'icon' && !$this->doLoadTableDescr($table)) || $force)) { return t3lib_BEfunc::helpTextIcon($table, $field, $this->backPath, $force); } else { // Detects fields with no CSH and outputs dummy line to insert into CSH locallang file: @@ -5163,19 +5136,19 @@ * @return string * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 */ - function helpText($table,$field) { + function helpText($table, $field) { t3lib_div::logDeprecatedFunction(); - if ($this->globalShowHelp && $GLOBALS['TCA_DESCR'][$table]['columns'][$field] && ($this->edit_showFieldHelp=='text' || $this->doLoadTableDescr($table))) { + if ($this->globalShowHelp && $GLOBALS['TCA_DESCR'][$table]['columns'][$field] && ($this->edit_showFieldHelp == 'text' || $this->doLoadTableDescr($table))) { $fDat = $GLOBALS['TCA_DESCR'][$table]['columns'][$field]; - return '
'. + return '
' . - $this->helpTextIcon( - $table, - $field, + $this->helpTextIcon( + $table, + $field, - $fDat['details']||$fDat['syntax']||$fDat['image_descr']||$fDat['image']||$fDat['seeAlso'] + $fDat['details'] || $fDat['syntax'] || $fDat['image_descr'] || $fDat['image'] || $fDat['seeAlso'] - ). + ) . - ''. + '' . - $GLOBALS['LANG']->hscAndCharConv(strip_tags($fDat['description']),1). + $GLOBALS['LANG']->hscAndCharConv(strip_tags($fDat['description']), 1) . - '
'; + '
'; } } @@ -5205,19 +5178,19 @@ if ($alttitle) { $hoverText = '' . $alttitle . '
' . $hoverText; } - $hoverText = '' . $GLOBALS['LANG']->hscAndCharConv($hoverText, false) . ''; + $hoverText = '' . $GLOBALS['LANG']->hscAndCharConv($hoverText, FALSE) . ''; } // CSH exists $params = base64_encode(serialize(array( - 'cshFile' => $cshFile, - 'field' => $field, - 'title' => $fieldTitle - ))); + 'cshFile' => $cshFile, + 'field' => $field, + 'title' => $fieldTitle + ))); - $aOnClick = 'vHWin=window.open(\''.$this->backPath.'view_help.php?ffID=' . $params . '\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;'; + $aOnClick = 'vHWin=window.open(\'' . $this->backPath . 'view_help.php?ffID=' . $params . '\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;'; - return '
'. + return '' . - t3lib_iconWorks::getSpriteIcon('actions-system-help-open') . $hoverText . - ''; + t3lib_iconWorks::getSpriteIcon('actions-system-help-open') . $hoverText . + ''; } } return ''; @@ -5235,14 +5208,14 @@ $value = $GLOBALS['LANG']->sL($cshFile . ':' . $field . '.description'); if (trim($value)) { return '
' . - $this->helpTextIcon_typeFlex( - $field, - $fieldTitle, - $cshFile + $this->helpTextIcon_typeFlex( + $field, + $fieldTitle, + $cshFile - ). + ) . - '' . - $GLOBALS['LANG']->hscAndCharConv(strip_tags($value), 1) . - '
'; + '' . + $GLOBALS['LANG']->hscAndCharConv(strip_tags($value), 1) . + ''; } } return ''; @@ -5255,31 +5228,39 @@ * @param string A color scheme string. * @return void */ - function setColorScheme($scheme) { + function setColorScheme($scheme) { $this->colorScheme = $this->defColorScheme; $this->classScheme = $this->defClassScheme; - $parts = t3lib_div::trimExplode(',',$scheme); + $parts = t3lib_div::trimExplode(',', $scheme); - foreach($parts as $key => $col) { + foreach ($parts as $key => $col) { // Split for color|class: - list($color,$class) = t3lib_div::trimExplode('|',$col); + list($color, $class) = t3lib_div::trimExplode('|', $col); // Handle color values: - if ($color) $this->colorScheme[$key] = $color; - if ($color=='-') $this->colorScheme[$key] = ''; + if ($color) { + $this->colorScheme[$key] = $color; + } + if ($color == '-') { + $this->colorScheme[$key] = ''; + } // Handle class values: - if ($class) $this->classScheme[$key] = $class; - if ($class=='-') $this->classScheme[$key] = ''; + if ($class) { + $this->classScheme[$key] = $class; - } + } + if ($class == '-') { + $this->classScheme[$key] = ''; - } + } + } + } /** * Reset color schemes. * * @return void */ - function resetSchemes() { + function resetSchemes() { $this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][0]); $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0]; $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0]; @@ -5290,7 +5271,7 @@ * * @return void */ - function storeSchemes() { + function storeSchemes() { $this->savedSchemes['classScheme'] = $this->classScheme; $this->savedSchemes['colorScheme'] = $this->colorScheme; $this->savedSchemes['fieldStyle'] = $this->fieldStyle; @@ -5302,7 +5283,7 @@ * * @return void */ - function restoreSchemes() { + function restoreSchemes() { $this->classScheme = $this->savedSchemes['classScheme']; $this->colorScheme = $this->savedSchemes['colorScheme']; $this->fieldStyle = $this->savedSchemes['fieldStyle']; @@ -5310,17 +5291,6 @@ } - - - - - - - - - - - /******************************************** * * JavaScript related functions @@ -5332,21 +5302,21 @@ * * @return string A section with JavaScript. */ - function JStop() { + function JStop() { $out = ''; // Additional top HTML: - if (count($this->additionalCode_pre)) { + if (count($this->additionalCode_pre)) { - $out.= implode(' + $out .= implode(' - ',$this->additionalCode_pre); + ', $this->additionalCode_pre); } // Additional top JavaScript - if (count($this->additionalJS_pre)) { + if (count($this->additionalJS_pre)) { - $out.=' + $out .= '