From 1f700f2dc5979105a97b100944673d8b5ac587c0 Mon Sep 17 00:00:00 2001 From: Dmitry Dulepov Date: Sat, 2 Feb 2008 11:17:33 +0000 Subject: [PATCH] t3lib/class.ts_parser_ext.php: quotes changed from double to single, function index updated with extdeveval git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3017 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_tsparser_ext.php | 773 ++++++++++++++--------------- 2 files changed, 380 insertions(+), 394 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71a3f862f704..0bca1de2fe7c 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2008-02-02 Dmitry Dulepov * Added feature #7336: Improve usability of Constants Editor + * t3lib/class.ts_parser_ext.php: quotes changed from double to single, function index updated with extdeveval 2008-02-02 Martin Kutschker diff --git a/t3lib/class.t3lib_tsparser_ext.php b/t3lib/class.t3lib_tsparser_ext.php index 61a4f14c9be6..baa0614f7aa0 100755 --- a/t3lib/class.t3lib_tsparser_ext.php +++ b/t3lib/class.t3lib_tsparser_ext.php @@ -38,56 +38,56 @@ * * * 105: class t3lib_tsparser_ext extends t3lib_TStemplate - * 194: function flattenSetup($setupArray, $prefix, $resourceFlag) - * 221: function substituteConstants($all) - * 234: function substituteConstantsCallBack($matches) - * 264: function substituteCMarkers($all) - * 286: function generateConfig_constants() - * 335: function ext_getSetup($theSetup,$theKey) - * 366: function ext_getObjTree($arr, $depth_in, $depthData, $parentType="",$parentValue="") + * 191: function flattenSetup($setupArray, $prefix, $resourceFlag) + * 218: function substituteConstants($all) + * 231: function substituteConstantsCallBack($matches) + * 261: function substituteCMarkers($all) + * 284: function generateConfig_constants() + * 330: function ext_getSetup($theSetup,$theKey) + * 358: function ext_getObjTree($arr, $depth_in, $depthData, $parentType='',$parentValue='', $alphaSort='0') * 463: function lineNumberToScript($lnArr) * 494: function makeHtmlspecialchars($theValue) * 507: function ext_getSearchKeys($arr, $depth_in, $searchString, $keyArray) - * 563: function ext_getRootlineNumber($pid) - * 581: function ext_getTemplateHierarchyArr($arr,$depthData, $keyArray,$first=0) - * 640: function ext_process_hierarchyInfo($depthDataArr,&$pointer) - * 671: function ext_outputTS($config, $lineNumbers=0, $comments=0, $crop=0, $syntaxHL=0, $syntaxHLBlockmode=0) - * 698: function ext_fixed_lgd($string,$chars) - * 714: function ext_lnBreakPointWrap($ln,$str) - * 727: function ext_formatTS($input, $ln, $comments=1, $crop=0) - * 766: function ext_getFirstTemplate($id,$template_uid=0) - * 786: function ext_getAllTemplates($id) - * 807: function ext_compareFlatSetups($default) - * 873: function ext_categorizeEditableConstants($editConstArray) - * 896: function ext_getCategoryLabelArray() - * 913: function ext_getTypeData($type) - * 955: function ext_getTSCE_config($category) - * 994: function ext_getKeyImage($key) - * 1004: function ext_getTSCE_config_image($imgConf) - * 1028: function ext_resourceDims() - * 1058: function ext_readDirResources($path) - * 1073: function readDirectory($path,$type="file") - * 1098: function ext_fNandV($params) - * 1116: function ext_printFields($theConstants,$category) + * 562: function ext_getRootlineNumber($pid) + * 580: function ext_getTemplateHierarchyArr($arr,$depthData, $keyArray,$first=0) + * 639: function ext_process_hierarchyInfo($depthDataArr,&$pointer) + * 670: function ext_outputTS($config, $lineNumbers=0, $comments=0, $crop=0, $syntaxHL=0, $syntaxHLBlockmode=0) + * 697: function ext_fixed_lgd($string,$chars) + * 713: function ext_lnBreakPointWrap($ln,$str) + * 726: function ext_formatTS($input, $ln, $comments=1, $crop=0) + * 765: function ext_getFirstTemplate($id,$template_uid=0) + * 785: function ext_getAllTemplates($id) + * 806: function ext_compareFlatSetups($default) + * 872: function ext_categorizeEditableConstants($editConstArray) + * 895: function ext_getCategoryLabelArray() + * 912: function ext_getTypeData($type) + * 953: function ext_getTSCE_config($category) + * 992: function ext_getKeyImage($key) + * 1002: function ext_getTSCE_config_image($imgConf) + * 1026: function ext_resourceDims() + * 1056: function ext_readDirResources($path) + * 1071: function readDirectory($path,$type='file') + * 1096: function ext_fNandV($params) + * 1114: function ext_printFields($theConstants,$category) * * SECTION: Processing input values - * 1373: function ext_regObjectPositions($constants) - * 1388: function ext_regObjects($pre) - * 1433: function ext_putValueInConf($key, $var) - * 1456: function ext_removeValueInConf($key) - * 1472: function ext_depthKeys($arr,$settings) - * 1507: function ext_procesInput($http_post_vars,$http_post_files,$theConstants,$tplRow) - * 1634: function upload_copy_file($typeDat,&$tplRow,$theRealFileName,$tmp_name) - * 1683: function ext_prevPageWithTemplate($id,$perms_clause) - * 1699: function ext_setStar($val) - * 1711: function ext_detectAndFixExtensionPrefix($value) + * 1408: function ext_regObjectPositions($constants) + * 1423: function ext_regObjects($pre) + * 1468: function ext_putValueInConf($key, $var) + * 1491: function ext_removeValueInConf($key) + * 1507: function ext_depthKeys($arr,$settings) + * 1542: function ext_procesInput($http_post_vars,$http_post_files,$theConstants,$tplRow) + * 1666: function upload_copy_file($typeDat,&$tplRow,$theRealFileName,$tmp_name) + * 1715: function ext_prevPageWithTemplate($id,$perms_clause) + * 1731: function ext_setStar($val) + * 1743: function ext_detectAndFixExtensionPrefix($value) * * TOTAL FUNCTIONS: 41 * (This index is automatically created/updated by the extension "extdeveval") * */ -require_once(PATH_t3lib."class.t3lib_tstemplate.php"); +require_once(PATH_t3lib.'class.t3lib_tstemplate.php'); @@ -104,53 +104,50 @@ require_once(PATH_t3lib."class.t3lib_tstemplate.php"); */ class t3lib_tsparser_ext extends t3lib_TStemplate { - var $edit_divider = "###MOD_TS:EDITABLE_CONSTANTS###"; // This string is used to indicate the point in a template from where the editable constants are listed. Any vars before this point (if it exists though) is regarded as default values. - var $HTMLcolorList = "aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white"; + var $edit_divider = '###MOD_TS:EDITABLE_CONSTANTS###'; // This string is used to indicate the point in a template from where the editable constants are listed. Any vars before this point (if it exists though) is regarded as default values. + var $HTMLcolorList = 'aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white'; // internal var $categories = array( - "basic" => array(), // Constants of superior importance for the template-layout. This is dimensions, imagefiles and enabling of various features. The most basic constants, which you would almost always want to configure. - "menu" => array(), // Menu setup. This includes fontfiles, sizes, background images. Depending on the menutype. - "content" => array(), // All constants related to the display of pagecontent elements - "page" => array(), // General configuration like metatags, link targets - "advanced" => array(), // Advanced functions, which are used very seldomly. - "all" => array() // All constants are put here also! + 'basic' => array(), // Constants of superior importance for the template-layout. This is dimensions, imagefiles and enabling of various features. The most basic constants, which you would almost always want to configure. + 'menu' => array(), // Menu setup. This includes fontfiles, sizes, background images. Depending on the menutype. + 'content' => array(), // All constants related to the display of pagecontent elements + 'page' => array(), // General configuration like metatags, link targets + 'advanced' => array(), // Advanced functions, which are used very seldomly. + 'all' => array() // All constants are put here also! ); // This will be filled with the available categories of the current template. var $subCategories = array( - // Standard categories: - "enable" => Array("Enable features", "a"), - "dims" => Array("Dimensions, widths, heights, pixels", "b"), - "file" => Array("Files", "c"), - "typo" => Array("Typography", "d"), - "color" => Array("Colors", "e"), - "links" => Array("Links and targets", "f"), - "language" => Array("Language specific constants", "g"), - - // subcategories based on the default content elements - "cheader" => Array("Content: 'Header'", "ma"), - "cheader_g" => Array("Content: 'Header', Graphical", "ma"), - "ctext" => Array("Content: 'Text'", "mb"), -// "ctextpic" => - "cimage" => Array("Content: 'Image'", "md"), - "cbullets" => Array("Content: 'Bullet list'", "me"), - "ctable" => Array("Content: 'Table'", "mf"), - "cuploads" => Array("Content: 'Filelinks'", "mg"), - "cmultimedia" => Array("Content: 'Multimedia'", "mh"), - "cmailform" => Array("Content: 'Form'", "mi"), - "csearch" => Array("Content: 'Search'", "mj"), - "clogin" => Array("Content: 'Login'", "mk"), - "csplash" => Array("Content: 'Textbox'", "ml"), - "cmenu" => Array("Content: 'Menu/Sitemap'", "mm"), - "cshortcut" => Array("Content: 'Insert records'", "mn"), - "clist" => Array("Content: 'List of records'", "mo"), - "cscript" => Array("Content: 'Script'", "mp"), - "chtml" => Array("Content: 'HTML'", "mq") + // Standard categories: + 'enable' => Array('Enable features', 'a'), + 'dims' => Array('Dimensions, widths, heights, pixels', 'b'), + 'file' => Array('Files', 'c'), + 'typo' => Array('Typography', 'd'), + 'color' => Array('Colors', 'e'), + 'links' => Array('Links and targets', 'f'), + 'language' => Array('Language specific constants', 'g'), + + // subcategories based on the default content elements + 'cheader' => Array('Content: \'Header\'', 'ma'), + 'cheader_g' => Array('Content: \'Header\', Graphical', 'ma'), + 'ctext' => Array('Content: \'Text\'', 'mb'), + 'cimage' => Array('Content: \'Image\'', 'md'), + 'cbullets' => Array('Content: \'Bullet list\'', 'me'), + 'ctable' => Array('Content: \'Table\'', 'mf'), + 'cuploads' => Array('Content: \'Filelinks\'', 'mg'), + 'cmultimedia' => Array('Content: \'Multimedia\'', 'mh'), + 'cmailform' => Array('Content: \'Form\'', 'mi'), + 'csearch' => Array('Content: \'Search\'', 'mj'), + 'clogin' => Array('Content: \'Login\'', 'mk'), + 'csplash' => Array('Content: \'Textbox\'', 'ml'), + 'cmenu' => Array('Content: \'Menu/Sitemap\'', 'mm'), + 'cshortcut' => Array('Content: \'Insert records\'', 'mn'), + 'clist' => Array('Content: \'List of records\'', 'mo'), + 'cscript' => Array('Content: \'Script\'', 'mp'), + 'chtml' => Array('Content: \'HTML\'', 'mq') ); var $resourceDimensions = array(); var $dirResources = array(); -// var $matchAll = 0; // If set, all conditions are matched! - var $backend_info=1; // tsconstanteditor @@ -159,22 +156,22 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { // tsbrowser var $tsbrowser_searchKeys = array(); var $tsbrowser_depthKeys = array(); - var $constantMode=""; - var $regexMode=""; - var $fixedLgd=""; + var $constantMode=''; + var $regexMode=''; + var $fixedLgd=''; var $resourceCheck=0; var $ext_lineNumberOffset=0; - var $ext_localGfxPrefix=""; - var $ext_localWebGfxPrefix=""; + var $ext_localGfxPrefix=''; + var $ext_localWebGfxPrefix=''; var $ext_expandAllNotes=0; var $ext_noPMicons=0; var $ext_noSpecialCharsOnLabels=0; var $ext_listOfTemplatesArr=array(); - var $ext_lineNumberOffset_mode=""; + var $ext_lineNumberOffset_mode=''; var $ext_dontCheckIssetValues=0; // Dont change... var $ext_noCEUploadAndCopying=0; var $ext_printAll=0; - var $ext_CEformName="forms[0]"; + var $ext_CEformName='forms[0]'; var $ext_defaultOnlineResourceFlag=0; var $doNotSortCategoriesBeforeMakingForm = FALSE; @@ -184,7 +181,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { /** * This flattens a hierarchical setuparray to $this->flatSetup - * The original function fetched the resource-file if any ("file."). This functions doesn't. + * The original function fetched the resource-file if any ('file.'). This functions doesn't. * * @param [type] $setupArray: ... * @param [type] $prefix: ... @@ -196,9 +193,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $this->getFileName_backPath=PATH_site; // Setting absolute prefixed path for relative resources. reset($setupArray); while(list($key,$val)=each($setupArray)) { - if ($prefix || substr($key,0,16)!="TSConstantEditor") { // We don't want "TSConstantEditor" in the flattend setup. + if ($prefix || substr($key,0,16)!='TSConstantEditor') { // We don't want 'TSConstantEditor' in the flattend setup. if (is_array($val)) { - $this->flattenSetup($val,$prefix.$key, ($key=="file.")); + $this->flattenSetup($val,$prefix.$key, ($key=='file.')); } elseif ($resourceFlag && $this->resourceCheck) { $this->flatSetup[$prefix.$key] = $this->getFileName($val); if ($this->removeFromGetFilePath && substr($this->flatSetup[$prefix.$key],0,strlen($this->removeFromGetFilePath))==$this->removeFromGetFilePath) { @@ -219,7 +216,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function substituteConstants($all) { - $this->Cmarker = substr(md5(uniqid("")),0,6); + $this->Cmarker = substr(md5(uniqid('')),0,6); return preg_replace_callback('/\{\$(.[^}]+)\}/', array($this, 'substituteConstantsCallBack'), $all); } @@ -263,11 +260,11 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { */ function substituteCMarkers($all) { switch($this->constantMode) { - case "const": + case 'const': $all = str_replace('##'.$this->Cmarker.'_B##', '', $all); $all = str_replace('##'.$this->Cmarker.'_E##', '', $all); break; - case "subst": + case 'subst': $all = str_replace('##'.$this->Cmarker.'_B##', '', $all); $all = str_replace('##'.$this->Cmarker.'_E##', '', $all); break; @@ -290,13 +287,12 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $this->setup['sitetitle'] = $this->sitetitle; // parse constants - $constants = t3lib_div::makeInstance("t3lib_TSparser"); + $constants = t3lib_div::makeInstance('t3lib_TSparser'); $constants->regComments=1; // Register comments! $constants->setup = $this->const; $constants->setup = $this->mergeConstantsFromPageTSconfig($constants->setup); - $matchObj = t3lib_div::makeInstance("t3lib_matchCondition"); -// $matchObj->matchAlternative = array("[globalString = page | title = *test*]"); + $matchObj = t3lib_div::makeInstance('t3lib_matchCondition'); $matchObj->matchAll=1; // Matches ALL conditions in TypoScript $c=0; @@ -311,15 +307,15 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $constants->parse($parts[0],$matchObj); } $this->flatSetup = Array(); - $this->flattenSetup($constants->setup,"",""); + $this->flattenSetup($constants->setup,'',''); $defaultConstants=$this->flatSetup; } $constants->parse($str,$matchObj); } $this->flatSetup = Array(); - $this->flattenSetup($constants->setup,"",""); - $this->setup["constants"] = $constants->setup; + $this->flattenSetup($constants->setup,'',''); + $this->setup['constants'] = $constants->setup; return $this->ext_compareFlatSetups($defaultConstants); } @@ -332,22 +328,18 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_getSetup($theSetup,$theKey) { - $parts = explode(".",$theKey,2); -// debug("-----------",1); -// debug($theKey,1); - if (strcmp($parts[0],"") && is_array($theSetup[$parts[0]."."])) { -// debug(trim($parts[1]),1); - if (strcmp(trim($parts[1]),"")) { -// debug(trim($parts[1]),1); - return $this->ext_getSetup($theSetup[$parts[0]."."],trim($parts[1])); + $parts = explode('.',$theKey,2); + if (strcmp($parts[0],'') && is_array($theSetup[$parts[0].'.'])) { + if (strcmp(trim($parts[1]),'')) { + return $this->ext_getSetup($theSetup[$parts[0].'.'],trim($parts[1])); } else { - return array($theSetup[$parts[0]."."], $theSetup[$parts[0]]); + return array($theSetup[$parts[0].'.'], $theSetup[$parts[0]]); } } else { - if (strcmp(trim($theKey),"")) { + if (strcmp(trim($theKey),'')) { return array(array(),$theSetup[$theKey]); } else { - return array($theSetup,""); + return array($theSetup,''); } } } @@ -364,7 +356,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_getObjTree($arr, $depth_in, $depthData, $parentType='',$parentValue='', $alphaSort='0') { - $HTML=""; + $HTML=''; $a=0; reset($arr); @@ -374,9 +366,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $keyArr_num=array(); $keyArr_alpha=array(); while (list($key,)=each($arr)) { - if (substr($key,-2)!="..") { // Don't do anything with comments / linenumber registrations... - $key=ereg_replace("\.$","",$key); - if (substr($key,-1)!=".") { + if (substr($key,-2)!='..') { // Don't do anything with comments / linenumber registrations... + $key=ereg_replace('\.$','',$key); + if (substr($key,-1)!='.') { if (t3lib_div::testInt($key)) { $keyArr_num[$key]=$arr[$key]; } else { @@ -389,39 +381,35 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $keyArr=$keyArr_num+$keyArr_alpha; reset($keyArr); $c=count($keyArr); - if ($depth_in) {$depth_in = $depth_in.".";} - -// $validate_info= verify_TSobjects($keyArr,$parentType,$parentValue); -// debug($validate_info); + if ($depth_in) {$depth_in = $depth_in.'.';} while (list($key,)=each($keyArr)) { $a++; $depth=$depth_in.$key; - if ($this->bType!="const" || substr($depth,0,1)!="_") { // this excludes all constants starting with "_" from being shown. + if ($this->bType!='const' || substr($depth,0,1)!='_') { // this excludes all constants starting with '_' from being shown. $goto = substr(md5($depth),0,6); - // debug($depth); - $deeper = (is_array($arr[$key."."]) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes)) ? 1 : 0; - $PM = "join"; - $LN = ($a==$c)?"blank":"line"; - $BTM = ($a==$c)?"bottom":""; - $PM = is_array($arr[$key."."]) && !$this->ext_noPMicons ? ($deeper ? "minus":"plus") : "join"; + $deeper = (is_array($arr[$key.'.']) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes)) ? 1 : 0; + $PM = 'join'; + $LN = ($a==$c)?'blank':'line'; + $BTM = ($a==$c)?'bottom':''; + $PM = is_array($arr[$key.'.']) && !$this->ext_noPMicons ? ($deeper ? 'minus':'plus') : 'join'; $HTML.=$depthData; - $theIcon=''; - if ($PM=="join") { + $theIcon=''; + if ($PM=='join') { $HTML.=$theIcon; } else { - $aHref='index.php?id='.$GLOBALS["SOBE"]->id.'&tsbr['.$depth.']='.($deeper?0:1).'#'.$goto; + $aHref='index.php?id='.$GLOBALS['SOBE']->id.'&tsbr['.$depth.']='.($deeper?0:1).'#'.$goto; $HTML.=''.$theIcon.''; } $label = $key; - if (t3lib_div::inList("types,resources,sitetitle",$depth) && $this->bType=="setup") { // Read only... + if (t3lib_div::inList('types,resources,sitetitle',$depth) && $this->bType=='setup') { // Read only... $label=''.$label.''; } else { if ($this->linkObjects) { - $aHref = 'index.php?id='.$GLOBALS["SOBE"]->id.'&sObj='.$depth; - if ($this->bType!="const") { + $aHref = 'index.php?id='.$GLOBALS['SOBE']->id.'&sObj='.$depth; + if ($this->bType!='const') { $ln = is_array($arr[$key.'.ln..']) ? 'Defined in: '.$this->lineNumberToScript($arr[$key.'.ln..']) : 'N/A'; } else { $ln = ''; @@ -432,34 +420,34 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } } - $HTML.="[".$label."]"; + $HTML.='['.$label.']'; if (isset($arr[$key])) { $theValue = $arr[$key]; if ($this->fixedLgd) { $imgBlocks = ceil(1+strlen($depthData)/77); - $lgdChars = 68-ceil(strlen("[".$key."]")*0.8)-$imgBlocks*3; + $lgdChars = 68-ceil(strlen('['.$key.']')*0.8)-$imgBlocks*3; $theValue = $this->ext_fixed_lgd($theValue,$lgdChars); } if ($this->tsbrowser_searchKeys[$depth] & 2) { // The value has matched the search string $HTML.=' = '.$this->makeHtmlspecialchars($theValue).''; } else { - $HTML.=" = ".$this->makeHtmlspecialchars($theValue).""; + $HTML.=' = '.$this->makeHtmlspecialchars($theValue).''; } if ($this->ext_regComments && isset($arr[$key.'..'])) { $comment = $arr[$key.'..']; if (!preg_match('/### '; } } } - $HTML.="
"; + $HTML.='
'; if ($deeper) { - $HTML.=$this->ext_getObjTree($arr[$key."."], $depth, $depthData.'', '' /* not used: $validate_info[$key] */, $arr[$key], $alphaSort); + $HTML.=$this->ext_getObjTree($arr[$key.'.'], $depth, $depthData.'', '' /* not used: $validate_info[$key] */, $arr[$key], $alphaSort); } } } @@ -526,12 +514,11 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } } reset($keyArr); -// asort($keyArr); $c=count($keyArr); if ($depth_in) { $depth_in = $depth_in.'.'; } while (list($key,)=each($keyArr)) { $depth=$depth_in.$key; - $deeper = is_array($arr[$key."."]); + $deeper = is_array($arr[$key.'.']); if ($this->regexMode) { if (ereg($searchString,$arr[$key])) { // The value has matched @@ -573,9 +560,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_getRootlineNumber($pid) { - if ($pid && is_array($GLOBALS["rootLine"])) { - reset($GLOBALS["rootLine"]); - while(list($key,$val)=each($GLOBALS["rootLine"])) { + if ($pid && is_array($GLOBALS['rootLine'])) { + reset($GLOBALS['rootLine']); + while(list($key,$val)=each($GLOBALS['rootLine'])) { if ($val['uid']==$pid) return $key; } } @@ -594,8 +581,8 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { reset($arr); $keyArr=array(); while (list($key,)=each($arr)) { - $key=ereg_replace("\.$","",$key); - if (substr($key,-1)!=".") { + $key=ereg_replace('\.$','',$key); + if (substr($key,-1)!='.') { $keyArr[$key]=1; } } @@ -603,40 +590,40 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $a=0; $c=count($keyArr); while (list($key,)=each($keyArr)) { - $HTML=""; + $HTML=''; $a++; - $deeper = is_array($arr[$key."."]); + $deeper = is_array($arr[$key.'.']); $row=$arr[$key]; - $PM = "join"; - $LN = ($a==$c)?"blank":"line"; - $BTM = ($a==$c)?"top":""; - $PM = "join"; + $PM = 'join'; + $LN = ($a==$c)?'blank':'line'; + $BTM = ($a==$c)?'top':''; + $PM = 'join'; $HTML.=$depthData; - $icon = substr($row["templateID"],0,3)=="sys" ? t3lib_iconWorks::getIcon("sys_template",array("root"=>$row["root"])) : - (substr($row["templateID"],0,6)=="static" ? t3lib_iconWorks::getIcon("static_template",array()) : 'gfx/i/default.gif'); - $alttext= "[".$row['templateID']."]"; - $alttext.= $row['pid'] ? " - ".t3lib_BEfunc::getRecordPath($row['pid'],$GLOBALS["SOBE"]->perms_clause,20) : ""; + $icon = substr($row['templateID'],0,3)=='sys' ? t3lib_iconWorks::getIcon('sys_template',array('root'=>$row['root'])) : + (substr($row['templateID'],0,6)=='static' ? t3lib_iconWorks::getIcon('static_template',array()) : 'gfx/i/default.gif'); + $alttext= '['.$row['templateID'].']'; + $alttext.= $row['pid'] ? ' - '.t3lib_BEfunc::getRecordPath($row['pid'],$GLOBALS['SOBE']->perms_clause,20) : ''; if (in_array($row['templateID'],$this->clearList_const) || in_array($row['templateID'],$this->clearList_setup)) { - $A_B='id.'&template='.$row['templateID'].'">'; - $A_E=""; + $A_B=''; + $A_E=''; } else { - $A_B=""; - $A_E=""; + $A_B=''; + $A_E=''; } - $HTML.=($first?'':'').''.$A_B.t3lib_div::fixed_lgd_cs($row['title'],$GLOBALS["BE_USER"]->uc["titleLen"]).$A_E."  "; + $HTML.=($first?'':'').''.$A_B.t3lib_div::fixed_lgd_cs($row['title'],$GLOBALS['BE_USER']->uc['titleLen']).$A_E.'  '; $RL = $this->ext_getRootlineNumber($row['pid']); $keyArray[] = ' '.$HTML.' - '.($row["root"]?"X":"").'   - '.fw(($row["clConf"]?"X":"")."  ").' - '.fw(($row["clConst"]?"X":"")."  ").' - '.($row["pid"]?" ".$row["pid"].(strcmp($RL,"")?" (".$RL.")":"")."  ":"").' - '.($row["next"]?" ".$row["next"]."  ":"").' + '.($row['root']?'X':'').'   + '.fw(($row['clConf']?'X':'').'  ').' + '.fw(($row['clConst']?'X':'').'  ').' + '.($row['pid']?' '.$row['pid'].(strcmp($RL,'')?' ('.$RL.')':'').'  ':'').' + '.($row['next']?' '.$row['next'].'  ':'').' '; if ($deeper) { - $keyArray = $this->ext_getTemplateHierarchyArr($arr[$key."."], $depthData.($first?'':''), $keyArray); + $keyArray = $this->ext_getTemplateHierarchyArr($arr[$key.'.'], $depthData.($first?'':''), $keyArray); } } return $keyArray; @@ -656,14 +643,14 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $row = $this->hierarchyInfo[$pointer]; $depthDataArr[$row['templateID']]=$row; - $depthDataArr[$row['templateID']]["bgcolor_setup"] = isset($this->clearList_setup_temp[$row['templateID']])?' class="bgColor5"':''; - $depthDataArr[$row['templateID']]["bgcolor_const"] = isset($this->clearList_const_temp[$row['templateID']])?' class="bgColor5"':''; + $depthDataArr[$row['templateID']]['bgcolor_setup'] = isset($this->clearList_setup_temp[$row['templateID']])?' class="bgColor5"':''; + $depthDataArr[$row['templateID']]['bgcolor_const'] = isset($this->clearList_const_temp[$row['templateID']])?' class="bgColor5"':''; unset($this->clearList_setup_temp[$row['templateID']]); unset($this->clearList_const_temp[$row['templateID']]); - $this->templateTitles[$row['templateID']]=$row["title"]; + $this->templateTitles[$row['templateID']]=$row['title']; if ($row['templateID']==$this->hierarchyInfo[$pointer-1]['templateParent']) { - $depthDataArr[$row['templateID']."."] = $this->ext_process_hierarchyInfo(array(), $pointer); + $depthDataArr[$row['templateID'].'.'] = $this->ext_process_hierarchyInfo(array(), $pointer); } } return $depthDataArr; @@ -681,16 +668,16 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_outputTS($config, $lineNumbers=0, $comments=0, $crop=0, $syntaxHL=0, $syntaxHLBlockmode=0) { - $all=""; + $all=''; reset($config); while (list(,$str)=each($config)) { - $all.="\n[GLOBAL]\n".$str; + $all .= chr(10) .'[GLOBAL]' . chr(10) . $str; } if ($syntaxHL) { - $all = ereg_replace("^[^".chr(10)."]*.","",$all); + $all = ereg_replace('^[^'.chr(10).']*.','',$all); $all = chop($all); - $tsparser = t3lib_div::makeInstance("t3lib_TSparser"); + $tsparser = t3lib_div::makeInstance('t3lib_TSparser'); $tsparser->lineNumberOffset=$this->ext_lineNumberOffset+1; return $tsparser->doSyntaxHighlight($all,$lineNumbers?array($this->ext_lineNumberOffset+1):'',$syntaxHLBlockmode); } else { @@ -700,7 +687,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { /** * Returns a new string of max. $chars lenght - * If the string is longer, it will be truncated and prepended with "..." + * If the string is longer, it will be truncated and prepended with '...' * $chars must be an integer of at least 4 * * @param [type] $string: ... @@ -710,7 +697,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { function ext_fixed_lgd($string,$chars) { if ($chars >= 4) { if(strlen($string)>$chars) { - return substr($string, 0, $chars-3)."..."; + return substr($string, 0, $chars-3).'...'; } } return $string; @@ -724,7 +711,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_lnBreakPointWrap($ln,$str) { - return ''.$str.''; + return ''.$str.''; } /** @@ -737,24 +724,24 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_formatTS($input, $ln, $comments=1, $crop=0) { - $input = ereg_replace("^[^".chr(10)."]*.","",$input); + $input = ereg_replace('^[^'.chr(10).']*.','',$input); $input = chop($input); $cArr = explode(chr(10),$input); reset($cArr); $n = ceil(log10(count($cArr)+$this->ext_lineNumberOffset)); - $lineNum=""; + $lineNum=''; while(list($k,$v)=each($cArr)) { $lln=$k+$this->ext_lineNumberOffset+1; - if ($ln) $lineNum = $this->ext_lnBreakPointWrap($lln,str_replace(" ",' ',sprintf("% ".$n."d",$lln))).": "; + if ($ln) $lineNum = $this->ext_lnBreakPointWrap($lln,str_replace(' ',' ',sprintf('% '.$n.'d',$lln))).': '; $v=htmlspecialchars($v); if ($crop) {$v=$this->ext_fixed_lgd($v,($ln?71:77));} - $cArr[$k] = $lineNum.str_replace(" ",' ',$v); + $cArr[$k] = $lineNum.str_replace(' ',' ',$v); $firstChar = substr(trim($v),0,1); - if ($firstChar=="[") { + if ($firstChar=='[') { $cArr[$k] = ''.$cArr[$k].''; - } elseif ($firstChar=="/" || $firstChar=="#") { + } elseif ($firstChar=='/' || $firstChar=='#') { if ($comments) { $cArr[$k] = ''.$cArr[$k].''; } else { @@ -764,7 +751,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } - $output = implode($cArr, "
")."
"; + $output = implode($cArr, '
').'
'; return $output; } @@ -779,7 +766,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { // Query is taken from the runThroughTemplates($theRootLine) function in the parent class. if (intval($id)) { if ($template_uid) { - $addC = " AND uid=".$template_uid; + $addC = ' AND uid='.$template_uid; } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($id).$addC.' '.$this->whereClause, '', 'sorting', '1'); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); @@ -820,18 +807,18 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $editableComments=array(); reset($this->flatSetup); while(list($const,$value)=each($this->flatSetup)) { - if (substr($const,-2)!=".." && isset($this->flatSetup[$const.".."])) { - $comment = trim($this->flatSetup[$const.".."]); + if (substr($const,-2)!='..' && isset($this->flatSetup[$const.'..'])) { + $comment = trim($this->flatSetup[$const.'..']); $c_arr = explode(chr(10),$comment); while(list($k,$v)=each($c_arr)) { - $line=trim(ereg_replace("^[#\/]*","",$v)); + $line=trim(ereg_replace('^[#\/]*','',$v)); if ($line) { - $parts = explode(";", $line); + $parts = explode(';', $line); while(list(,$par)=each($parts)) { - if (strstr($par,"=")) { - $keyValPair =explode("=",$par,2); + if (strstr($par,'=')) { + $keyValPair =explode('=',$par,2); switch(trim(strtolower($keyValPair[0]))) { - case "type": + case 'type': // Type: /* int (range; low-high, list: item,item,item = selector), @@ -841,23 +828,23 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { html-color ..., file */ - $editableComments[$const]["type"] = trim($keyValPair[1]); + $editableComments[$const]['type'] = trim($keyValPair[1]); break; - case "cat": + case 'cat': // list of categories. - $catSplit=explode("/",strtolower($keyValPair[1])); - $editableComments[$const]["cat"] = trim($catSplit[0]); + $catSplit=explode('/',strtolower($keyValPair[1])); + $editableComments[$const]['cat'] = trim($catSplit[0]); $catSplit[1]=trim($catSplit[1]); // This is the subcategory. Must be a key in $this->subCategories[]. catSplit[2] represents the search-order within the subcat. if ($catSplit[1] && isset($this->subCategories[$catSplit[1]])) { - $editableComments[$const]["subcat_name"]=$catSplit[1]; - $editableComments[$const]["subcat"]=$this->subCategories[$catSplit[1]][1]."/".$catSplit[1]."/".trim($catSplit[2])."z"; + $editableComments[$const]['subcat_name']=$catSplit[1]; + $editableComments[$const]['subcat']=$this->subCategories[$catSplit[1]][1].'/'.$catSplit[1].'/'.trim($catSplit[2]).'z'; } else { - $editableComments[$const]["subcat"]="x"."/".trim($catSplit[2])."z"; + $editableComments[$const]['subcat']='x'.'/'.trim($catSplit[2]).'z'; } break; - case "label": + case 'label': // label - $editableComments[$const]["label"] = trim($keyValPair[1]); + $editableComments[$const]['label'] = trim($keyValPair[1]); break; } } @@ -866,10 +853,10 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } } if (isset($editableComments[$const])) { - $editableComments[$const]["name"]=$const; - $editableComments[$const]["value"]=trim($value); + $editableComments[$const]['name']=$const; + $editableComments[$const]['value']=trim($value); if (isset($default[$const])) { - $editableComments[$const]["default_value"]=trim($default[$const]); + $editableComments[$const]['default_value']=trim($default[$const]); } } } @@ -886,18 +873,18 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { // Runs through the available constants and fills the $this->categories array with pointers and priority-info reset($editConstArray); while(list($constName,$constData)=each($editConstArray)) { - if (!$constData["type"]) {$constData["type"]="string";} - $cats = explode(",",$constData["cat"]); + if (!$constData['type']) { + $constData['type']='string'; + } + $cats = explode(',',$constData['cat']); reset($cats); while (list(,$theCat)=each($cats)) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way... $theCat=trim($theCat); if ($theCat) { - $this->categories[$theCat][$constName]=$constData["subcat"]; -// $this->categories["all"][$constName]=$constData["subcat"]; + $this->categories[$theCat][$constName]=$constData['subcat']; } } } -// debug($this->categories); } /** @@ -910,7 +897,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $retArr = array(); while(list($k,$v)=each($this->categories)) { if (count($v)) { - $retArr[$k]=strtoupper($k)." (".count($v).")"; + $retArr[$k]=strtoupper($k).' ('.count($v).')'; } } return $retArr; @@ -926,35 +913,34 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $retArr = array(); $type=trim($type); if (!$type) { - $retArr["type"]="string"; + $retArr['type']='string'; } else { - $m=strcspn ($type," ["); - $retArr["type"]=strtolower(substr($type,0,$m)); + $m=strcspn ($type,' ['); + $retArr['type']=strtolower(substr($type,0,$m)); if (t3lib_div::inList('int,options,file,boolean,offset,user', $retArr['type'])) { $p=trim(substr($type,$m)); $reg = array(); - ereg("\[(.*)\]",$p,$reg); + ereg('\[(.*)\]',$p,$reg); $p=trim($reg[1]); if ($p) { - $retArr["paramstr"]=$p; - switch($retArr["type"]) { - case "int": - if (substr($retArr["paramstr"],0,1)=="-") { - $retArr["params"]=t3lib_div::intExplode("-",substr($retArr["paramstr"],1)); - $retArr["params"][0]=intval("-".$retArr["params"][0]); + $retArr['paramstr']=$p; + switch($retArr['type']) { + case 'int': + if (substr($retArr['paramstr'],0,1)=='-') { + $retArr['params']=t3lib_div::intExplode('-',substr($retArr['paramstr'],1)); + $retArr['params'][0]=intval('-'.$retArr['params'][0]); } else { - $retArr["params"]=t3lib_div::intExplode("-",$retArr["paramstr"]); + $retArr['params']=t3lib_div::intExplode('-',$retArr['paramstr']); } - $retArr["paramstr"]=$retArr["params"][0]." - ".$retArr["params"][1]; + $retArr['paramstr']=$retArr['params'][0].' - '.$retArr['params'][1]; break; - case "options": - $retArr["params"]=explode(",",$retArr["paramstr"]); + case 'options': + $retArr['params']=explode(',',$retArr['paramstr']); break; } } } } -// debug($retArr); return $retArr; } @@ -965,28 +951,28 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_getTSCE_config($category) { - $catConf=$this->setup["constants"]["TSConstantEditor."][$category."."]; + $catConf=$this->setup['constants']['TSConstantEditor.'][$category.'.']; $out=array(); if (is_array($catConf)) { reset($catConf); while(list($key,$val)=each($catConf)) { switch($key) { - case "image": - $out["imagetag"] = $this->ext_getTSCE_config_image($catConf["image"]); + case 'image': + $out['imagetag'] = $this->ext_getTSCE_config_image($catConf['image']); break; - case "description": - case "bulletlist": - case "header": + case 'description': + case 'bulletlist': + case 'header': $out[$key] = $val; break; default: if (t3lib_div::testInt($key)) { - $constRefs = explode(",",$val); + $constRefs = explode(',',$val); reset($constRefs); while(list(,$const)=each($constRefs)) { $const=trim($const); if ($const && $const<=20) { - $out["constants"][$const].=$this->ext_getKeyImage($key); + $out['constants'][$const].=$this->ext_getKeyImage($key); } } } @@ -1014,19 +1000,19 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_getTSCE_config_image($imgConf) { - if (substr($imgConf,0,4)=="gfx/") { + if (substr($imgConf,0,4)=='gfx/') { $iFile=$this->ext_localGfxPrefix.$imgConf; $tFile=$this->ext_localWebGfxPrefix.$imgConf; } elseif (substr($imgConf,0,4)=='EXT:') { $iFile = t3lib_div::getFileAbsFileName($imgConf); if ($iFile) { $f = substr($iFile,strlen(PATH_site)); - $tFile=$GLOBALS["BACK_PATH"]."../".$f; + $tFile=$GLOBALS['BACK_PATH'].'../'.$f; } } else { - $f = "uploads/tf/".$this->extractFromResources($this->setup["resources"],$imgConf); + $f = 'uploads/tf/'.$this->extractFromResources($this->setup['resources'],$imgConf); $iFile=PATH_site.$f; - $tFile=$GLOBALS["BACK_PATH"]."../".$f; + $tFile=$GLOBALS['BACK_PATH'].'../'.$f; } $imageInfo=@getImagesize($iFile); return ''; @@ -1038,16 +1024,16 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_resourceDims() { - if ($this->setup["resources"]) { - $rArr=explode(",",$this->setup["resources"]); + if ($this->setup['resources']) { + $rArr=explode(',',$this->setup['resources']); while(list($c,$val)=each($rArr)) { $val=trim($val); - $theFile = PATH_site."uploads/tf/".$val; + $theFile = PATH_site.'uploads/tf/'.$val; if ($val && @is_file($theFile)) { $imgInfo = @getimagesize($theFile); } if (is_array($imgInfo)) { - $this->resourceDimensions[$val]=" (".$imgInfo[0]."x".$imgInfo[1].")"; + $this->resourceDimensions[$val]=' ('.$imgInfo[0].'x'.$imgInfo[1].')'; } } } @@ -1056,7 +1042,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $val=trim($val); $imgInfo = @getimagesize(PATH_site.$val); if (is_array($imgInfo)) { - $this->resourceDimensions[$val]=" (".$imgInfo[0]."x".$imgInfo[1].")"; + $this->resourceDimensions[$val]=' ('.$imgInfo[0].'x'.$imgInfo[1].')'; } } } @@ -1069,8 +1055,8 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { */ function ext_readDirResources($path) { $path=trim($path); - if ($path && substr($path,0,10)=="fileadmin/") { - $path = ereg_replace("\/$","",$path); + if ($path && substr($path,0,10)=='fileadmin/') { + $path = ereg_replace('\/$','',$path); $this->readDirectory(PATH_site.$path); } } @@ -1082,14 +1068,14 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @param [type] $type: ... * @return [type] ... */ - function readDirectory($path,$type="file") { + function readDirectory($path,$type='file') { if(@is_dir($path)) { $d = @dir($path); $tempArray=Array(); if (is_object($d)) { while($entry=$d->read()) { - if ($entry!="." && $entry!="..") { - $wholePath = $path."/".$entry; // Because of odd PHP-error where
-tag is sometimes placed after a filename!! + if ($entry!='.' && $entry!='..') { + $wholePath = $path.'/'.$entry; // Because of odd PHP-error where
-tag is sometimes placed after a filename!! if (@file_exists($wholePath) && (!$type || filetype($wholePath)==$type)) { $fI = t3lib_div::split_fileref($wholePath); $this->dirResources[]=substr($wholePath,strlen(PATH_site)); @@ -1110,8 +1096,8 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { function ext_fNandV($params) { $fN='data['.$params['name'].']'; $fV=$params['value']; - if (ereg("^{[\$][a-zA-Z0-9\.]*}$",trim($fV),$reg)) { // Values entered from the constantsedit cannot be constants! 230502; removed \{ and set { - $fV=""; + if (ereg('^{[\$][a-zA-Z0-9\.]*}$',trim($fV),$reg)) { // Values entered from the constantsedit cannot be constants! 230502; removed \{ and set { + $fV=''; } $fV=htmlspecialchars($fV); @@ -1130,11 +1116,11 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { reset($theConstants); $output=' '; - $subcat=""; + $subcat=''; if (is_array($this->categories[$category])) { $help=$this->helpConfig; - $this->rArr=explode(",",$this->setup["resources"].",".implode($this->dirResources,",")); + $this->rArr=explode(',',$this->setup['resources'].','.implode($this->dirResources,',')); if (!$this->doNotSortCategoriesBeforeMakingForm) asort($this->categories[$category]); while(list($name,$type)=each($this->categories[$category])) { @@ -1142,124 +1128,126 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { if (is_array($params)) { if ($subcat!=$params['subcat_name']) { $subcat=$params['subcat_name']; - $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : "Others"; - + $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : 'Others'; + $output.='

'.$subcat_name.'

'; } - $label=$GLOBALS["LANG"]->sL($params['label']); - $label_parts = explode(":",$label,2); + $label=$GLOBALS['LANG']->sL($params['label']); + $label_parts = explode(':',$label,2); if (count($label_parts)==2) { $head=trim($label_parts[0]); $body=trim($label_parts[1]); } else { $head=trim($label_parts[0]); - $body=""; + $body=''; } if (strlen($head)>35) { if (!$body) {$body=$head;} $head=t3lib_div::fixed_lgd_cs($head,35); } $typeDat=$this->ext_getTypeData($params['type']); - $checked=""; - $p_field=""; + $checked=''; + $p_field=''; $raname = substr(md5($params['name']),0,10); - $aname="'".$raname."'"; + $aname='\''.$raname.'\''; list($fN,$fV,$params)=$this->ext_fNandV($params); switch($typeDat['type']) { case 'int': case 'int+': - $p_field='formWidth(5).' onChange="uFormUrl('.$aname.')" />'; - if ($typeDat["paramstr"]) { - $p_field.=' Range: '.$typeDat["paramstr"]; - } elseif ($typeDat['type']=="int+") { + $p_field='formWidth(5).' onChange="uFormUrl('.$aname.')" />'; + if ($typeDat['paramstr']) { + $p_field.=' Range: '.$typeDat['paramstr']; + } elseif ($typeDat['type']=='int+') { $p_field.=' Range: 0 - '; } else { $p_field.=' (Integer)'; } break; case 'color': - $colorNames=explode(",",",".$this->HTMLcolorList); - $p_field=""; + $colorNames=explode(',',','.$this->HTMLcolorList); + $p_field=''; while(list(,$val)=each($colorNames)) { - $sel=""; - if ($val==strtolower($params['value'])) {$sel=" selected";} + $sel=''; + if ($val==strtolower($params['value'])) { + $sel = ' selected'; + } $p_field.=''; } $p_field=''; - $p_field.='formWidth(7).' onChange="uFormUrl('.$aname.')" />'; + $p_field.='formWidth(7).' onChange="uFormUrl('.$aname.')" />'; break; case 'wrap': - $wArr = explode("|",$fV); - $p_field='formWidth(29).' onChange="uFormUrl('.$aname.')" />'; + $wArr = explode('|',$fV); + $p_field='formWidth(29).' onChange="uFormUrl('.$aname.')" />'; $p_field.=' | '; - $p_field.='formWidth(15).' onChange="uFormUrl('.$aname.')" />'; + $p_field.='formWidth(15).' onChange="uFormUrl('.$aname.')" />'; break; case 'offset': - $wArr = explode(",",$fV); - $labels = t3lib_div::trimExplode(",",$typeDat["paramstr"]); - $p_field=($labels[0]?$labels[0]:"x").':formWidth(4).' onChange="uFormUrl('.$aname.')" />'; + $wArr = explode(',',$fV); + $labels = t3lib_div::trimExplode(',',$typeDat['paramstr']); + $p_field=($labels[0]?$labels[0]:'x').':formWidth(4).' onChange="uFormUrl('.$aname.')" />'; $p_field.=' , '; - $p_field.=($labels[1]?$labels[1]:"y").':formWidth(4).' onChange="uFormUrl('.$aname.')" />'; + $p_field.=($labels[1]?$labels[1]:'y').':formWidth(4).' onChange="uFormUrl('.$aname.')" />'; for ($aa=2;$aaformWidth(4).' onChange="uFormUrl('.$aname.')" />'; + $p_field.=' , '.$labels[$aa].':formWidth(4).' onChange="uFormUrl('.$aname.')" />'; } else { $p_field.=''; } } break; case 'options': - if (is_array($typeDat["params"])) { - $p_field=""; - while(list(,$val)=each($typeDat["params"])) { - $vParts = explode("=",$val,2); + if (is_array($typeDat['params'])) { + $p_field=''; + while(list(,$val)=each($typeDat['params'])) { + $vParts = explode('=',$val,2); $label = $vParts[0]; $val = isset($vParts[1]) ? $vParts[1] : $vParts[0]; // option tag: - $sel=""; + $sel=''; if ($val==$params['value']) { - $sel=" selected"; + $sel=' selected'; } - $p_field.=''; + $p_field.=''; } $p_field=''; } break; case 'boolean': - $p_field=''; - $sel=""; + $p_field=''; + $sel=''; if ($fV) { - $sel=" checked"; + $sel=' checked'; } - $p_field.=''; + $p_field.=''; break; case 'comment': - $p_field=''; - $sel=""; + $p_field=''; + $sel=''; if (!$fV) { - $sel=" checked"; + $sel=' checked'; } $p_field.=''; break; case 'file': $p_field=''; - $theImage=""; - $selectThisFile = $this->extractFromResources($this->setup["resources"],$params['value']); + $theImage=''; + $selectThisFile = $this->extractFromResources($this->setup['resources'],$params['value']); if ($params['value'] && !$selectThisFile) { if (in_array($params['value'],$this->dirResources)) { $selectThisFile=$params['value']; } } // extensionlist - $extList = $typeDat["paramstr"]; + $extList = $typeDat['paramstr']; $p_field=''; - if ($extList=="IMAGE_EXT") { - $extList = $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"]; + if ($extList=='IMAGE_EXT') { + $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; } reset($this->rArr); $onlineResourceFlag=$this->ext_defaultOnlineResourceFlag; @@ -1267,24 +1255,24 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { while(list($c,$val)=each($this->rArr)) { $val=trim($val); $fI=t3lib_div::split_fileref($val); - if ($val && (!$extList || t3lib_div::inList($extList,$fI["fileext"]))) { - if ($onlineResourceFlag<=0 && substr($fI["path"],0,10)=="fileadmin/") { + if ($val && (!$extList || t3lib_div::inList($extList,$fI['fileext']))) { + if ($onlineResourceFlag<=0 && substr($fI['path'],0,10)=='fileadmin/') { if ($onlineResourceFlag<0) { $p_field.=''; } - $p_field.=''; + $p_field.=''; $onlineResourceFlag=1; } $dims=$this->resourceDimensions[$val]; - $sel=""; + $sel=''; // Check if $params['value'] is in the list of resources. if ($selectThisFile && $selectThisFile==$val) { - $sel=" selected"; + $sel=' selected'; if ($onlineResourceFlag<=0) { - $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$selectThisFile),"sys_template","resources",$GLOBALS["BACK_PATH"],""); + $theImage=t3lib_BEfunc::thumbCode(array('resources'=>$selectThisFile),'sys_template','resources',$GLOBALS['BACK_PATH'],''); } else { - $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$fI["file"]),"sys_template","resources",$GLOBALS["BACK_PATH"],"",$fI["path"]); + $theImage=t3lib_BEfunc::thumbCode(array('resources'=>$fI['file']),'sys_template','resources',$GLOBALS['BACK_PATH'],'',$fI['path']); } } @@ -1294,7 +1282,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $val = $this->ext_setStar($val); $p_field.=''; } else { - $p_field.=''; + $p_field.=''; } } } @@ -1310,22 +1298,22 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { if (!$this->ext_noCEUploadAndCopying) { // Copy a resource - $copyFile = $this->extractFromResources($this->setup["resources"],$params['value']); + $copyFile = $this->extractFromResources($this->setup['resources'],$params['value']); if (!$copyFile) { if ($params['value']) { $copyFile=PATH_site.$this->ext_detectAndFixExtensionPrefix($params['value']); } } else { - $copyFile=""; + $copyFile=''; } if ($copyFile && @is_file($copyFile)) { - $p_field.=''; + $p_field.=''; } // Upload? $p_field.='
'; - $p_field.='formWidth().' onChange="uFormUrl('.$aname.')" size="50" />'; + $p_field.='formWidth().' onChange="uFormUrl('.$aname.')" size="50" />'; } break; case 'user': @@ -1335,26 +1323,26 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { break; case 'small': default: - $fwidth= $typeDat['type']=="small" ? 10 : 46; - $p_field='formWidth($fwidth).' onChange="uFormUrl('.$aname.')" />'; + $fwidth= $typeDat['type']=='small' ? 10 : 46; + $p_field='formWidth($fwidth).' onChange="uFormUrl('.$aname.')" />'; break; } - + // Define default names and IDs $userTyposcriptID = 'userTS-'.$params['name']; $defaultTyposcriptID = 'defaultTS-'.$params['name']; $checkboxName = 'check['.$params['name'].']'; $checkboxID = $checkboxName; - + // Handle type=color specially - if ($typeDat['type']=="color" && substr($params['value'],0,2)!='{$') { + if ($typeDat['type']=='color' && substr($params['value'],0,2)!='{$') { $color = '
 
'; } else { $color = ''; } if (!$this->ext_dontCheckIssetValues) { - + /* Set the default styling options */ if(isset($this->objReg[$params['name']])) { $checkboxValue = 'checked'; @@ -1365,31 +1353,31 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $userTyposcriptStyle = 'style="display:none;"'; $defaultTyposcriptStyle = ''; } - - + + $deleteIconHTML = 'Revert to default Constant'; $editIconHTML = 'Edit this Constant'; $constantCheckbox = ''; - + // If there's no default value for the field, use a static label. if(!$params['default_value']) { $params['default_value'] = '[Empty]'; } - - $constantDefaultRow='
'.$editIconHTML.htmlspecialchars($params["default_value"]).$color.'
'; + + $constantDefaultRow='
'.$editIconHTML.htmlspecialchars($params['default_value']).$color.'
'; } - + $constantEditRow = '
'.$deleteIconHTML.$p_field.$color.'
'; - + $constantLabel = '
'.htmlspecialchars($head).'
'; $constantName = '
['.$params['name'].']
'; - $constantDescription = $body ? '
'.htmlspecialchars($body).'
' : ""; + $constantDescription = $body ? '
'.htmlspecialchars($body).'
' : ''; $constantData = '
'.$constantCheckbox.$constantEditRow.$constantDefaultRow.'
'; - $output.=''.$help["constants"][$params['name']]; + $output.=''.$help['constants'][$params['name']]; $output.='
'.$constantLabel.$constantName.$constantDescription.$constantData.'
'; } else { - debug("Error. Constant did not exist. Should not happen."); + debug('Error. Constant did not exist. Should not happen.'); } } } @@ -1423,7 +1411,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { $this->rawP=0; $this->objReg=array(); // resetting the objReg if the divider is found!! - $this->ext_regObjects(""); + $this->ext_regObjects(''); } /** @@ -1441,24 +1429,24 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } $this->rawP++; if ($line) { - if (substr($line,0,1)=="[") { + if (substr($line,0,1)=='[') { // return $line; - } elseif (strcspn($line,"}#/")!=0) { - $varL = strcspn($line," {=<"); + } elseif (strcspn($line,'}#/')!=0) { + $varL = strcspn($line,' {=<'); $var=substr($line,0,$varL); $line = ltrim(substr($line,$varL)); switch(substr($line,0,1)) { - case "=": + case '=': $this->objReg[$pre.$var]=$this->rawP-1; break; - case "{": + case '{': $this->ext_inBrace++; - $this->ext_regObjects($pre.$var."."); + $this->ext_regObjects($pre.$var.'.'); break; } - $this->lastComment=""; - } elseif (substr($line,0,1)=="}") { - $this->lastComment=""; + $this->lastComment=''; + } elseif (substr($line,0,1)=='}') { + $this->lastComment=''; $this->ext_inBrace--; if ($this->ext_inBrace<0) { $this->ext_inBrace=0; @@ -1480,16 +1468,16 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { function ext_putValueInConf($key, $var) { // Puts the value $var to the TypoScript value $key in the current lines of the templates. // If the $key is not found in the template constants field, a new line is inserted in the bottom. - $theValue = " ".trim($var); + $theValue = ' '.trim($var); if (isset($this->objReg[$key])) { $lineNum = $this->objReg[$key]; - $parts = explode("=",$this->raw[$lineNum],2); + $parts = explode('=',$this->raw[$lineNum],2); if (count($parts)==2) { $parts[1]= $theValue; } - $this->raw[$lineNum]=implode($parts,"="); + $this->raw[$lineNum]=implode($parts,'='); } else { - $this->raw[]=$key." =".$theValue; + $this->raw[]=$key.' ='.$theValue; } $this->changed=1; } @@ -1520,13 +1508,13 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { reset($arr); $tsbrArray=array(); while(list($theK,$theV)=each($arr)) { - $theKeyParts = explode(".",$theK); - $depth=""; + $theKeyParts = explode('.',$theK); + $depth=''; $c=count($theKeyParts); $a=0; while(list(,$p)=each($theKeyParts)) { $a++; - $depth.=($depth?".":"").$p; + $depth.=($depth?'.':'').$p; $tsbrArray[$depth]= ($c==$a) ? $theV : 1; } } @@ -1552,14 +1540,14 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_procesInput($http_post_vars,$http_post_files,$theConstants,$tplRow) { - $data=$http_post_vars["data"]; - $check=$http_post_vars["check"]; - $copyResource=$http_post_vars["_copyResource"]; - $Wdata=$http_post_vars["Wdata"]; - $W2data=$http_post_vars["W2data"]; - $W3data=$http_post_vars["W3data"]; - $W4data=$http_post_vars["W4data"]; - $W5data=$http_post_vars["W5data"]; + $data=$http_post_vars['data']; + $check=$http_post_vars['check']; + $copyResource=$http_post_vars['_copyResource']; + $Wdata=$http_post_vars['Wdata']; + $W2data=$http_post_vars['W2data']; + $W3data=$http_post_vars['W3data']; + $W4data=$http_post_vars['W4data']; + $W5data=$http_post_vars['W5data']; if (is_array($data)) { reset($data); @@ -1567,70 +1555,70 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { if (isset($theConstants[$key])) { if ($this->ext_dontCheckIssetValues || isset($check[$key])) { // If checkbox is set, update the value list($var) = explode(chr(10),$var); // exploding with linebreak, just to make sure that no multiline input is given! - $typeDat=$this->ext_getTypeData($theConstants[$key]["type"]); + $typeDat=$this->ext_getTypeData($theConstants[$key]['type']); switch($typeDat['type']) { - case "int": - if ($typeDat["paramstr"]) { - $var=t3lib_div::intInRange($var,$typeDat["params"][0],$typeDat["params"][1]); + case 'int': + if ($typeDat['paramstr']) { + $var=t3lib_div::intInRange($var,$typeDat['params'][0],$typeDat['params'][1]); } else { $var=intval($var); } break; - case "int+": + case 'int+': $var=t3lib_div::intInRange($var,0,10000); break; - case "color": + case 'color': $col=array(); if($var && !t3lib_div::inList($this->HTMLcolorList,strtolower($var))) { - $var = ereg_replace("[^A-Fa-f0-9]*","",$var); + $var = ereg_replace('[^A-Fa-f0-9]*','',$var); $col[]=HexDec(substr($var,0,2)); $col[]=HexDec(substr($var,2,2)); $col[]=HexDec(substr($var,4,2)); - $var="#".strtoupper(substr("0".DecHex($col[0]),-2).substr("0".DecHex($col[1]),-2).substr("0".DecHex($col[2]),-2)); + $var='#'.strtoupper(substr('0'.DecHex($col[0]),-2).substr('0'.DecHex($col[1]),-2).substr('0'.DecHex($col[2]),-2)); } break; - case "comment": + case 'comment': if ($var) { - $var="#"; + $var='#'; } else { - $var=""; + $var=''; } break; - case "wrap": + case 'wrap': if (isset($Wdata[$key])) { - $var.="|".$Wdata[$key]; + $var.='|'.$Wdata[$key]; } break; - case "offset": + case 'offset': if (isset($Wdata[$key])) { - $var=intval($var).",".intval($Wdata[$key]); + $var=intval($var).','.intval($Wdata[$key]); if (isset($W2data[$key])) { - $var.=",".intval($W2data[$key]); + $var.=','.intval($W2data[$key]); if (isset($W3data[$key])) { - $var.=",".intval($W3data[$key]); + $var.=','.intval($W3data[$key]); if (isset($W4data[$key])) { - $var.=",".intval($W4data[$key]); + $var.=','.intval($W4data[$key]); if (isset($W5data[$key])) { - $var.=",".intval($W5data[$key]); + $var.=','.intval($W5data[$key]); } } } } } break; - case "boolean": + case 'boolean': if ($var) { - $var = $typeDat["paramstr"] ? $typeDat["paramstr"] : 1; + $var = $typeDat['paramstr'] ? $typeDat['paramstr'] : 1; } break; - case "file": + case 'file': if (!$this->ext_noCEUploadAndCopying) { - if ($http_post_files["upload_data"]["name"][$key] && $http_post_files["upload_data"]["tmp_name"][$key]!="none") { + if ($http_post_files['upload_data']['name'][$key] && $http_post_files['upload_data']['tmp_name'][$key]!='none') { $var = $this->upload_copy_file( $typeDat, $tplRow, - trim($http_post_files["upload_data"]["name"][$key]), - $http_post_files["upload_data"]["tmp_name"][$key] + trim($http_post_files['upload_data']['name'][$key]), + $http_post_files['upload_data']['tmp_name'][$key] ); } if ($copyResource[$key]) { @@ -1644,7 +1632,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { } break; } - if ($this->ext_printAll || strcmp($theConstants[$key]["value"],$var)) { + if ($this->ext_printAll || strcmp($theConstants[$key]['value'],$var)) { $this->ext_putValueInConf($key, $var); // Put value in, if changed. } unset($check[$key]); // Remove the entry because it has been "used" @@ -1659,14 +1647,11 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { reset($check); while(list($key,$var)=each($check)) { if (isset($theConstants[$key])) { - $dValue = $theConstants[$key]["default_value"]; -// debug($dValue); + $dValue = $theConstants[$key]['default_value']; $this->ext_putValueInConf($key, $dValue); -// debug($key,1); } } } -// debug($this->objReg); } /** @@ -1681,28 +1666,28 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { function upload_copy_file($typeDat,&$tplRow,$theRealFileName,$tmp_name) { // extensions - $extList = $typeDat["paramstr"]; - if ($extList=="IMAGE_EXT") { - $extList = $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"]; + $extList = $typeDat['paramstr']; + if ($extList=='IMAGE_EXT') { + $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; } $fI=t3lib_div::split_fileref($theRealFileName); - if ($theRealFileName && (!$extList || t3lib_div::inList($extList,$fI["fileext"]))) { + if ($theRealFileName && (!$extList || t3lib_div::inList($extList,$fI['fileext']))) { $tmp_upload_name = t3lib_div::upload_to_tempfile($tmp_name); // If there is an uploaded file, move it for the sake of safe_mode. // Saving resource $alternativeFileName=array(); $alternativeFileName[$tmp_upload_name] = $theRealFileName; // Making list of resources - $resList = $tplRow["resources"]; - $resList = $tmp_upload_name.",".$resList; - $resList=implode(t3lib_div::trimExplode(",",$resList,1),","); + $resList = $tplRow['resources']; + $resList = $tmp_upload_name.','.$resList; + $resList=implode(t3lib_div::trimExplode(',',$resList,1),','); // Making data-array $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; -// debug($saveId); + $recData=array(); - $recData["sys_template"][$saveId]["resources"] = $resList; + $recData['sys_template'][$saveId]['resources'] = $resList; // Saving - $tce = t3lib_div::makeInstance("t3lib_TCEmain"); + $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values=0; $tce->alternativeFileName = $alternativeFileName; $tce->start($recData,Array()); @@ -1710,9 +1695,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { t3lib_div::unlink_tempfile($tmp_upload_name); - $tmpRow = t3lib_BEfunc::getRecordWSOL("sys_template",$saveId,"resources"); + $tmpRow = t3lib_BEfunc::getRecordWSOL('sys_template',$saveId,'resources'); - $tplRow["resources"] = $tmpRow["resources"]; + $tplRow['resources'] = $tmpRow['resources']; // Setting the value $var = $this->ext_setStar($theRealFileName); @@ -1728,10 +1713,10 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_prevPageWithTemplate($id,$perms_clause) { - $rootLine = t3lib_BEfunc::BEgetRootLine($id,$perms_clause?" AND ".$perms_clause:""); + $rootLine = t3lib_BEfunc::BEgetRootLine($id,$perms_clause?' AND '.$perms_clause:''); reset($rootLine); while(list(,$p)=each($rootLine)) { - if ($this->ext_getFirstTemplate($p["uid"])) { + if ($this->ext_getFirstTemplate($p['uid'])) { return $p; } } @@ -1744,8 +1729,8 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_setStar($val) { - $fParts = explode(".",strrev($val),2); - $val=ereg_replace("_[0-9][0-9]$","",strrev($fParts[1]))."*.".strrev($fParts[0]); + $fParts = explode('.',strrev($val),2); + $val=ereg_replace('_[0-9][0-9]$','',strrev($fParts[1])).'*.'.strrev($fParts[0]); return $val; } @@ -1756,9 +1741,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate { * @return [type] ... */ function ext_detectAndFixExtensionPrefix($value) { - if (substr($value,0,4)=="EXT:") { - $parts = explode("/",substr($value,4),2); -#debug($parts); + if (substr($value,0,4)=='EXT:') { + $parts = explode('/',substr($value,4),2); + $extPath = t3lib_extMgm::siteRelPath($parts[0]); $value = $extPath.$parts[1]; return $value; -- 2.20.1