Index: t3lib/class.t3lib_page.php =================================================================== --- t3lib/class.t3lib_page.php (Revision 5713) +++ t3lib/class.t3lib_page.php (Arbeitskopie) @@ -588,8 +588,7 @@ $MPA = array(); if ($MP) { $MPA = explode(',',$MP); - reset($MPA); - while(list($MPAk) = each($MPA)) { + foreach ($MPA as $MPAk => $v) { $MPA[$MPAk] = explode('-', $MPA[$MPAk]); } } Index: t3lib/class.t3lib_tsparser.php =================================================================== --- t3lib/class.t3lib_tsparser.php (Revision 5713) +++ t3lib/class.t3lib_tsparser.php (Arbeitskopie) @@ -519,8 +519,7 @@ if (strstr($string,$splitStr)) { $newString=''; $allParts = explode($splitStr,chr(10).$string.chr(10)); // adds line break char before/after - reset($allParts); - while(list($c,$v)=each($allParts)) { + foreach ($allParts as $c => $v) { if (!$c) { // first goes through $newString.=$v; } elseif (preg_match('/\r?\n\s*$/',$allParts[$c-1])) { // There must be a line-break char before. @@ -576,8 +575,7 @@ * @return array Same array but where the values has been parsed for include-commands */ function checkIncludeLines_array($array) { - reset($array); - while(list($k)=each($array)) { + foreach ($array as $k => $v) { $array[$k]=t3lib_TSparser::checkIncludeLines($array[$k]); } return $array; Index: typo3/sysext/cms/tslib/class.tslib_pibase.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_pibase.php (Revision 5713) +++ typo3/sysext/cms/tslib/class.tslib_pibase.php (Arbeitskopie) @@ -640,8 +640,7 @@ */ function pi_list_modeSelector($items=array(),$tableParams='') { $cells=array(); - reset($items); - while(list($k,$v)=each($items)) { + foreach ($items as $k => $v) { $cells[]=' piVars['mode']==$k?$this->pi_classParam('modeSelector-SCell'):'').'>

'. $this->pi_linkTP_keepPIvars(htmlspecialchars($v),array('mode'=>$k),$this->pi_isOnlyFields($this->pi_isOnlyFields)). @@ -981,9 +980,9 @@ } // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!): - if (is_array($this->conf['_LOCAL_LANG.'])) { - reset($this->conf['_LOCAL_LANG.']); - while(list($k,$lA)=each($this->conf['_LOCAL_LANG.'])) { + $confLL = $this->conf['_LOCAL_LANG.']; + if (is_array($confLL)) { + foreach ($confLL as $k => $lA) { if (is_array($lA)) { $k = substr($k,0,-1); foreach($lA as $llK => $llV) { @@ -1196,7 +1195,7 @@ function pi_prependFieldsWithTable($table,$fieldList) { $list=t3lib_div::trimExplode(',',$fieldList,1); $return=array(); - while(list(,$listItem)=each($list)) { + foreach ($list as $listItem) { $return[]=$table.'.'.$listItem; } return implode(',',$return); @@ -1262,7 +1261,7 @@ $fList = t3lib_div::trimExplode(',',$fList,1); $tempPiVars = $this->piVars; - while(list(,$k)=each($fList)) { + foreach ($fList as $k) { if (!t3lib_div::testInt($tempPiVars[$k]) || $tempPiVars[$k]<$lowerThan) unset($tempPiVars[$k]); } if (!count($tempPiVars)) return 1; @@ -1279,8 +1278,7 @@ */ function pi_autoCache($inArray) { if (is_array($inArray)) { - reset($inArray); - while(list($fN,$fV)=each($inArray)) { + foreach ($inArray as $fN => $v) { if (!strcmp($inArray[$fN],'')) { unset($inArray[$fN]); } elseif (is_array($this->pi_autoCacheFields[$fN])) { Index: typo3/sysext/cms/tslib/class.tslib_menu.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_menu.php (Revision 5713) +++ typo3/sysext/cms/tslib/class.tslib_menu.php (Arbeitskopie) @@ -708,8 +708,7 @@ $prevnext_menu = $this->sys_page->getMenu($value_rec['pid'],'*',$altSortField); $lastKey=0; $nextActive=0; - reset($prevnext_menu); - while(list($k_b,$v_b)=each($prevnext_menu)) { + foreach ($prevnext_menu as $k_b => $v_b) { if ($nextActive) { $recArr['next']=$v_b; $nextActive=0; @@ -732,8 +731,7 @@ $prevnextsection_menu = $this->sys_page->getMenu($recArr['index']['uid'],'*',$altSortField); $lastKey=0; $nextActive=0; - reset($prevnextsection_menu); - while(list($k_b,$v_b)=each($prevnextsection_menu)) { + foreach ($prevnextsection_menu as $k_b => $v_b) { if ($nextActive) { $sectionRec_temp = $this->sys_page->getMenu($v_b['uid'],'*',$altSortField); if (count($sectionRec_temp)) { @@ -770,7 +768,7 @@ $items = explode('|',$this->conf['special.']['items']); $c=0; - while(list($k_b,$v_b)=each($items)) { + foreach ($items as $k_b => $v_b) { $v_b=strtolower(trim($v_b)); if (intval($this->conf['special.'][$v_b.'.']['uid'])) { $recArr[$v_b] = $this->sys_page->getPage(intval($this->conf['special.'][$v_b.'.']['uid'])); // fetches the page in case of a hardcoded pid in template @@ -780,9 +778,9 @@ if ($this->conf['special.'][$v_b.'.']['target']) { $temp[$c]['target']=$this->conf['special.'][$v_b.'.']['target']; } - if (is_array($this->conf['special.'][$v_b.'.']['fields.'])) { - reset($this->conf['special.'][$v_b.'.']['fields.']); - while(list($fk,$val)=each($this->conf['special.'][$v_b.'.']['fields.'])) { + $tmpSpecialFields = $this->conf['special.'][$v_b.'.']['fields.']; + if (is_array($tmpSpecialFields)) { + foreach ($tmpSpecialFields as $fk => $val) { $temp[$c][$fk]=$val; } } @@ -1007,8 +1005,7 @@ // IFSUB is true if there exist submenu items to the current item if ($this->mconf['IFSUB']) { $IFSUBinit = 0; // Flag: If $IFSUB is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { + foreach ($NOconf as $key => $val) { if ($this->isItemState('IFSUB',$key)) { if (!$IFSUBinit) { // if this is the first IFSUB element, we must generate IFSUB. $IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'],$splitCount); @@ -1027,8 +1024,7 @@ // Prepare active settings, overriding normal settings if ($this->mconf['ACT']) { $ACTinit = 0; // Flag: If $ACT is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find active + foreach ($NOconf as $key => $val) { // Find active if ($this->isItemState('ACT',$key)) { if (!$ACTinit) { // if this is the first 'active', we must generate ACT. $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'],$splitCount); @@ -1049,8 +1045,7 @@ // ACTIFSUB is true if there exist submenu items to the current item and the current item is active if ($this->mconf['ACTIFSUB']) { $ACTIFSUBinit = 0; // Flag: If $ACTIFSUB is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find active + foreach ($NOconf as $key => $val) { // Find active if ($this->isItemState('ACTIFSUB',$key)) { if (!$ACTIFSUBinit) { // if this is the first 'active', we must generate ACTIFSUB. $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'],$splitCount); @@ -1071,8 +1066,7 @@ // CUR is true if the current page equals the item here! if ($this->mconf['CUR']) { $CURinit = 0; // Flag: If $CUR is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { + foreach ($NOconf as $key => $val) { if ($this->isItemState('CUR',$key)) { if (!$CURinit) { // if this is the first 'current', we must generate CUR. Basically this control is just inherited from the other implementations as current would only exist one time and thats it (unless you use special-features of HMENU) $CURconf = $this->tmpl->splitConfArray($this->mconf['CUR.'],$splitCount); @@ -1092,8 +1086,7 @@ // CURIFSUB is true if there exist submenu items to the current item and the current page equals the item here! if ($this->mconf['CURIFSUB']) { $CURIFSUBinit = 0; // Flag: If $CURIFSUB is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { + foreach ($NOconf as $key => $val) { if ($this->isItemState('CURIFSUB',$key)) { if (!$CURIFSUBinit) { // if this is the first 'current', we must generate CURIFSUB. $CURIFSUBconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUB.'],$splitCount); @@ -1113,8 +1106,7 @@ // Prepare active settings, overriding normal settings if ($this->mconf['USR']) { $USRinit = 0; // Flag: If $USR is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find active + foreach ($NOconf as $key => $val) { // Find active if ($this->isItemState('USR',$key)) { if (!$USRinit) { // if this is the first active, we must generate USR. $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'],$splitCount); @@ -1134,8 +1126,7 @@ // Prepare spacer settings, overriding normal settings if ($this->mconf['SPC']) { $SPCinit = 0; // Flag: If $SPC is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find spacers + foreach ($NOconf as $key => $val) { // Find spacers if ($this->isItemState('SPC',$key)) { if (!$SPCinit) { // if this is the first spacer, we must generate SPC. $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'],$splitCount); @@ -1148,8 +1139,7 @@ // Prepare Userdefined settings if ($this->mconf['USERDEF1']) { $USERDEF1init = 0; // Flag: If $USERDEF1 is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find active + foreach ($NOconf as $key => $val) { // Find active if ($this->isItemState('USERDEF1',$key)) { if (!$USERDEF1init) { // if this is the first active, we must generate USERDEF1. $USERDEF1conf = $this->tmpl->splitConfArray($this->mconf['USERDEF1.'],$splitCount); @@ -1169,8 +1159,7 @@ // Prepare Userdefined settings if ($this->mconf['USERDEF2']) { $USERDEF2init = 0; // Flag: If $USERDEF2 is generated - reset($NOconf); - while (list($key,$val)=each($NOconf)) { // Find active + foreach ($NOconf as $key => $val) { // Find active if ($this->isItemState('USERDEF2',$key)) { if (!$USERDEF2init) { // if this is the first active, we must generate USERDEF2. $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'],$splitCount); @@ -1672,8 +1661,7 @@ $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix'=>$this->mconf['submenuObjSuffixes']),$this->WMmenuItems); $this->extProc_init(); - reset($this->result); - while (list($key,$val)=each($this->result)) { + foreach ($this->result as $key => $val) { $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++; $GLOBALS['TSFE']->register['count_MENUOBJ']++; @@ -2075,8 +2063,7 @@ $c=0; $maxFlag=0; $distributeAccu=array('H'=>0,'W'=>0); - reset($conf); - while (list($key,$val)=each($conf)) { + foreach ($conf as $key => $val) { $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++; $GLOBALS['TSFE']->register['count_MENUOBJ']++; @@ -2084,8 +2071,7 @@ $Lobjs = $this->mconf['removeObjectsOfDummy']; if ($Lobjs) { $Lobjs = t3lib_div::intExplode(',',$Lobjs); - reset($Lobjs); - while(list(,$remItem)=each($Lobjs)) { + foreach ($Lobjs as $remItem) { unset($val[$remItem]); unset($val[$remItem.'.']); } @@ -2160,8 +2146,7 @@ // displace if ($Hobjs) { - reset($Hobjs); - while(list(,$index)=each($Hobjs)) { + foreach ($Hobjs as $index) { if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.']) { $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']); $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(0,-$Hcounter))); @@ -2170,8 +2155,7 @@ } if ($Wobjs) { - reset($Wobjs); - while(list(,$index)=each($Wobjs)) { + foreach ($Wobjs as $index) { if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.']) { $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']); $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(-$Wcounter,0))); @@ -2248,15 +2232,13 @@ $Wcounter = 0; $c=0; $maxFlag=0; - reset($conf); - while (list($key,$val)=each($conf)) { + foreach ($conf as $key => $val) { // SAME CODE AS makeGifs()! BEGIN if ($items==($c+1) && $minDim) { $Lobjs = $this->mconf['removeObjectsOfDummy']; if ($Lobjs) { $Lobjs = t3lib_div::intExplode(',',$Lobjs); - reset($Lobjs); - while(list(,$remItem)=each($Lobjs)) { + foreach ($Lobjs as $remItem) { unset($val[$remItem]); unset($val[$remItem.'.']); } @@ -2581,9 +2563,8 @@ $lastOriginal = $gifObjCount; // Now we add graphical objects to the gifbuilder-setup - reset($itemsConf); $waArr = Array(); - while (list($key,$val)=each($itemsConf)) { + foreach ($itemsConf as $key => $val) { if (is_array($val)) { $gifObjCount++; $waArr[$key]['free']=$gifObjCount; @@ -2644,8 +2625,7 @@ if ($theValue=='IMAGE') { if ($theValArr['file']=='GIFBUILDER') { $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['file.']); - reset($temp_sKeyArray); - while(list(,$temp_theKey)=each($temp_sKeyArray)) { + foreach ($temp_sKeyArray as $temp_theKey) { if ($theValArr['mask.'][$temp_theKey]=='TEXT') { $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array(); $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']); @@ -2655,8 +2635,7 @@ } if ($theValArr['mask']=='GIFBUILDER') { $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['mask.']); - reset($temp_sKeyArray); - while(list(,$temp_theKey)=each($temp_sKeyArray)) { + foreach ($temp_sKeyArray as $temp_theKey) { if ($theValArr['mask.'][$temp_theKey]=='TEXT') { $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array(); $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']); @@ -2690,9 +2669,8 @@ // calculations $sum=Array(0,0,0,0); - reset($waArr); - while (list($key,$val)=each($waArr)) { - if ($dConf[$key] =$itemsConf[$key]['distrib']) { + foreach ($waArr as $key => $val) { + if ($dConf[$key] = $itemsConf[$key]['distrib']) { $textBB = $gifCreator->objBB[$val['textNum']]; $dConf[$key] = str_replace('textX',$textBB[0],$dConf[$key]); $dConf[$key] = str_replace('textY',$textBB[1],$dConf[$key]); @@ -2700,8 +2678,7 @@ } } $workArea = t3lib_div::intExplode(',',$gifCreator->calcOffset($this->mconf['dWorkArea'])); - reset($waArr); - while (list($key,$val)=each($waArr)) { + foreach ($waArr as $key => $val) { $index = $val['free']; $gifCreator->setup[$index] = 'WORKAREA'; $workArea[2] = $dConf[$key][2] ? $dConf[$key][2] : $dConf[$key][0]; Index: typo3/sysext/cms/tslib/class.tslib_pagegen.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_pagegen.php (Revision 5713) +++ typo3/sysext/cms/tslib/class.tslib_pagegen.php (Arbeitskopie) @@ -102,12 +102,10 @@ } if ($GLOBALS['TSFE']->config['config']['MP_defaults']) { $temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1); - reset($temp_parts); - while(list(,$temp_p)=each($temp_parts)) { + foreach ($temp_parts as $temp_p) { list($temp_idP,$temp_MPp) = explode(':',$temp_p,2); $temp_ids=t3lib_div::intExplode(',',$temp_idP); - reset($temp_ids); - while(list(,$temp_id)=each($temp_ids)) { + foreach ($temp_ids as $temp_id) { $GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp; } } @@ -169,8 +167,7 @@ $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']); $space = ($standAlone) ? '[[:space:]]' : ''; - reset($GLOBALS['TSFE']->sWordList); - while (list($key,$val) = each($GLOBALS['TSFE']->sWordList)) { + foreach ($GLOBALS['TSFE']->sWordList as $val) { if (trim($val)) { if (!$noMixedCase) { $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|'; @@ -272,8 +269,7 @@ if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();} if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.'])) {$incLibs+=$GLOBALS['TSFE']->tmpl->setup['includeLibs.'];} // toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me) if (count($incLibs)) { - reset($incLibs); - while(list(,$theLib)=each($incLibs)) { + foreach ($incLibs as $theLib) { if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib)) { $incFilesArray[] = $incFile; } @@ -676,8 +672,7 @@ $conf=$GLOBALS['TSFE']->pSetup['meta.']; if (is_array($conf)) { - reset($conf); - while(list($theKey,$theValue)=each($conf)) { + foreach ($conf as $theKey => $v) { if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) { // Only if 1) the property is set but not the value itself, 2) the value and/or any property if (strstr($theKey,'.')) { $theKey = substr($theKey,0,-1); Index: typo3/sysext/cms/tslib/class.tslib_content.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_content.php (Revision 5713) +++ typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie) @@ -874,7 +874,7 @@ $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']); if (!$capSplit) {$capSplit=chr(10);} $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject')); - while (list($ca_key, $ca_val) = each($captionArray)) { + foreach ($captionArray as $ca_key => $ca_val) { $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']); } } @@ -1366,16 +1366,14 @@ if ($conf['tables'] && $conf['source']) { $allowedTables = $conf['tables']; if (is_array($conf['conf.'])) { - reset($conf['conf.']); - while(list($k)=each($conf['conf.'])) { + foreach ($conf['conf.'] as $k => $v) { if (substr($k,-1)!='.') $allowedTables.=','.$k; } } $loadDB = t3lib_div::makeInstance('FE_loadDBGroup'); $loadDB->start($conf['source'], $allowedTables); - reset($loadDB->tableArray); - while(list($table,)=each($loadDB->tableArray)) { + foreach ($loadDB->tableArray as $table => $v) { if (is_array($GLOBALS['TCA'][$table])) { $loadDB->additionalWhere[$table]=$this->enableFields($table); } @@ -1389,8 +1387,7 @@ $cObj->setParent($this->data,$this->currentRecord); $this->currentRecordNumber=0; $this->currentRecordTotal = count($loadDB->itemArray); - reset($loadDB->itemArray); - while(list(,$val)=each($loadDB->itemArray)) { + foreach ($loadDB->itemArray as $val) { $row = $data[$val['table']][$val['id']]; // Versioning preview: @@ -1537,8 +1534,7 @@ 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.']) ); $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1); - reset($gapData); - while(list(,$val)=each($gapData)) { + foreach ($gapData as $val) { $totalGapWidth+=intval($val['gapWidth']); } @@ -1654,8 +1650,7 @@ } else { array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register); if (is_array($conf)) { - reset($conf); - while(list($theKey,$theValue)=each($conf)) { + foreach ($conf as $theKey => $v) { if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) { // Only if 1) the property is set but not the value itself, 2) the value and/or any property if (strstr($theKey,'.')) { $theKey = substr($theKey,0,-1); @@ -1716,9 +1711,8 @@ list($temp[2]) = explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']); // If value Array is set, then implode those values. if (is_array($dAA['valueArray.'])) { - reset($dAA['valueArray.']); $temp_accum = array(); - while (list($dAKey_vA,$dAA_vA) = each($dAA['valueArray.'])) { + foreach ($dAA['valueArray.'] as $dAKey_vA => $dAA_vA) { if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) { $temp_vA=array(); list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']); @@ -2155,8 +2149,7 @@ // hidden fields: if (is_array($conf['hiddenFields.'])) { - reset($conf['hiddenFields.']); - while (list($hF_key,$hF_conf) = each($conf['hiddenFields.'])) { + foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) { if (substr($hF_key,-1)!='.') { $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields'); if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) { @@ -2222,9 +2215,9 @@ $temp_theStartId=t3lib_div::_GP('stype'); $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId); // The page MUST have a rootline with the Level0-page of the current site inside!! - while(list(,$val)=each($rootLine)) { + foreach ($rootLine as $val) { if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { - $theStartId=$temp_theStartId; + $theStartId = $temp_theStartId; } } } else if (t3lib_div::_GP('stype')) { @@ -2239,10 +2232,9 @@ ksort($altRootLine); if (count($altRootLine)) { // check if the rootline has the real Level0 in it!! - reset($altRootLine); $hitRoot=0; $theNewRoot=array(); - while(list(,$val)=each($altRootLine)) { + foreach ($altRootLine as $val) { if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { $hitRoot=1; $theNewRoot[]=$val; @@ -2444,8 +2436,7 @@ if ($conf['nonCachedSubst']) { // NON-CACHED: // Getting marks if (is_array($conf['marks.'])) { - reset($conf['marks.']); - while(list($theKey,$theValue)=each($conf['marks.'])) { + foreach ($conf['marks.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $content = str_replace( $PRE.$theKey.$POST, @@ -2457,8 +2448,7 @@ // Getting subparts. if (is_array($conf['subparts.'])) { - reset($conf['subparts.']); - while(list($theKey,$theValue)=each($conf['subparts.'])) { + foreach ($conf['subparts.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); if ($subpart) { @@ -2475,8 +2465,7 @@ } // Getting subpart wraps if (is_array($conf['wraps.'])) { - reset($conf['wraps.']); - while(list($theKey,$theValue)=each($conf['wraps.'])) { + foreach ($conf['wraps.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); if ($subpart) { @@ -2494,8 +2483,7 @@ } else { // CACHED // Getting subparts. if (is_array($conf['subparts.'])) { - reset($conf['subparts.']); - while(list($theKey,$theValue)=each($conf['subparts.'])) { + foreach ($conf['subparts.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); if ($subpart) { @@ -2508,8 +2496,7 @@ } // Getting marks if (is_array($conf['marks.'])) { - reset($conf['marks.']); - while(list($theKey,$theValue)=each($conf['marks.'])) { + foreach ($conf['marks.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $marks[$theKey]['name'] = $theValue; $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.']; @@ -2518,8 +2505,7 @@ } // Getting subpart wraps if (is_array($conf['wraps.'])) { - reset($conf['wraps.']); - while(list($theKey,$theValue)=each($conf['wraps.'])) { + foreach ($conf['wraps.'] as $theKey => $theValue) { if (!strstr($theKey,'.')) { $wraps[$theKey]['name'] = $theValue; $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.']; @@ -2528,8 +2514,7 @@ } // Getting subparts $subpartArray =array(); - reset($subparts); - while(list($theKey,$theValue)=each($subparts)) { + foreach ($subparts as $theKey => $theValue) { // Set current with the content of the subpart... $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey]; // Get subpart cObject and substitute it! @@ -2539,14 +2524,12 @@ // Getting marks $markerArray =array(); - reset($marks); - while(list($theKey,$theValue)=each($marks)) { + foreach ($marks as $theKey => $theValue) { $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey); } // Getting wraps $subpartWraps =array(); - reset($wraps); - while(list($theKey,$theValue)=each($wraps)) { + foreach ($wraps as $theKey => $theValue) { $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey)); } @@ -2598,7 +2581,7 @@ // fetching params $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.'])); - while(list(,$l)=each($lines)) { + foreach ($lines as $l) { $parts = explode('=', $l); $parameter = strtolower(trim($parts[0])); $value = trim($parts[1]); @@ -3139,20 +3122,17 @@ $storeArr=array(); // Finding subparts and substituting them with the subpart as a marker - reset($sPkeys); - while(list(,$sPK)=each($sPkeys)) { + foreach ($sPkeys as $sPK) { $content =$this->substituteSubpart($content,$sPK,$sPK); } // Finding subparts and wrapping them with markers - reset($wPkeys); - while(list(,$wPK)=each($wPkeys)) { + foreach ($wPkeys as $wPK) { $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK)); } // traverse keys and quote them for reg ex. - reset($aKeys); - while(list($tK,$tV)=each($aKeys)) { + foreach ($aKeys as $tK => $tV) { $aKeys[$tK] = preg_quote($tV, '/'); } $regex = '/' . implode('|', $aKeys) . '/'; @@ -3181,10 +3161,9 @@ $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray); $wSCA_reg=array(); - reset($storeArr['k']); $content = ''; - // traversin the keyList array and merging the static and dynamic content - while(list($n,$keyN)=each($storeArr['k'])) { + // traversing the keyList array and merging the static and dynamic content + foreach ($storeArr['k'] as $n => $keyN) { $content.=$storeArr['c'][$n]; if (!is_array($valueArr[$keyN])) { $content.=$valueArr[$keyN]; @@ -3232,8 +3211,7 @@ */ public function substituteMarkerInObject(&$tree, array $markContentArray) { if (is_array ($tree)) { - reset($tree); - while(list($key, $value) = each($tree)) { + foreach ($tree as $key => $value) { $this->substituteMarkerInObject ($tree[$key], $markContentArray); } } else { @@ -3700,7 +3678,7 @@ reset($items['sorting']); $fullPath = trim($data_arr[4]); $list_arr=Array(); - while(list($key,)=each($items['sorting'])) { + foreach ($items['sorting'] as $key => $v) { $list_arr[]= $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key]; } return implode(',',$list_arr); @@ -4135,8 +4113,7 @@ $mimetype=''; if ($fI['extension']) { $mimeTypes = t3lib_div::trimExplode(',',$conf['mimeTypes'],1); - reset($mimeTypes); - while(list(,$v)=each($mimeTypes)) { + foreach ($mimeTypes as $v) { $parts = explode('=',$v,2); if (strtolower($fI['extension']) == strtolower(trim($parts[0]))) { $mimetype = '&mimeType='.rawurlencode(trim($parts[1])); @@ -4164,8 +4141,7 @@ function calc($val) { $parts= t3lib_div::splitCalc($val,'+-*/'); $value=0; - reset($parts); - while(list(,$part)=each($parts)) { + foreach ($parts as $part) { $theVal = $part[1]; $sign = $part[0]; if ((string)intval($theVal)==(string)$theVal) { @@ -4192,7 +4168,7 @@ */ function calcIntExplode($delim, $string) { $temp = explode($delim,$string); - while(list($key,$val)=each($temp)) { + foreach ($temp as $key => $val) { $temp[$key]=intval(tslib_cObj::calc($val)); } return $temp; @@ -4290,8 +4266,7 @@ $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml'); $parts = $htmlParser->splitIntoBlock($tags,$theValue); - reset($parts); - while(list($k,$v)=each($parts)) { + foreach ($parts as $k => $v) { if ($k%2) { // font: $tagName=strtolower($htmlParser->getFirstTagName($v)); $cfg=$conf['externalBlocks.'][$tagName.'.']; @@ -4304,8 +4279,7 @@ } } - reset($parts); - while(list($k,$v)=each($parts)) { + foreach ($parts as $k => $v) { if ($k%2) { $tag=$htmlParser->getFirstTag($v); $tagName=strtolower($htmlParser->getFirstTagName($v)); @@ -4324,13 +4298,11 @@ } } elseif($cfg['HTMLtableCells']) { $rowParts = $htmlParser->splitIntoBlock('tr',$parts[$k]); - reset($rowParts); - while(list($kk,$vv)=each($rowParts)) { + foreach ($rowParts as $kk => $vv) { if ($kk%2) { $colParts = $htmlParser->splitIntoBlock('td,th',$vv); - reset($colParts); $cc=0; - while(list($kkk,$vvv)=each($colParts)) { + foreach ($colParts as $kkk => $vvv) { if ($kkk%2) { $cc++; $tag=$htmlParser->getFirstTag($vvv); @@ -4427,9 +4399,9 @@ if (!is_array($currentTag)) { // These operations should only be performed on code outside the tags... // Constants - if ($conf['constants'] && is_array($GLOBALS['TSFE']->tmpl->setup['constants.'])) { - reset($GLOBALS['TSFE']->tmpl->setup['constants.']); - while(list($key,$val)=each($GLOBALS['TSFE']->tmpl->setup['constants.'])) { + $tmpConstants = $GLOBALS['TSFE']->tmpl->setup['constants.']; + if ($conf['constants'] && is_array($tmpConstants)) { + foreach ($tmpConstants as $key => $val) { if (is_string($val)) { $data = str_replace('###'.$key.'###', $val, $data); } @@ -4439,8 +4411,7 @@ if (is_array($conf['short.'])) { $shortWords = $conf['short.']; krsort($shortWords); - reset($shortWords); - while(list($key,$val)=each($shortWords)) { + foreach ($shortWords as $key => $val) { if (is_string($val)) { $data = str_replace($key, $val, $data); } @@ -4519,8 +4490,7 @@ if ($currentTag[1]) { $params=t3lib_div::get_tag_attributes($currentTag[1]); if (is_array($params)) { - reset($params); - while(list($option,$val)=each($params)) { + foreach ($params as $option => $val) { $this->parameters[strtolower($option)]=$val; } } @@ -4597,7 +4567,7 @@ if (!strcmp('',$theValue)) return ''; - while(list($k,$l)=each($lParts)) { + foreach ($lParts as $k => $l) { $sameBeginEnd=0; $l=trim($l); $attrib=array(); @@ -4628,8 +4598,7 @@ if ($uTagName) { // Setting common attributes if (is_array($conf['addAttributes.'][$uTagName.'.'])) { - reset($conf['addAttributes.'][$uTagName.'.']); - while(list($kk,$vv)=each($conf['addAttributes.'][$uTagName.'.'])) { + foreach ($conf['addAttributes.'][$uTagName.'.'] as $kk => $vv) { if (!is_array($vv)) { if ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='blank') { if (!strcmp($attrib[$kk],'')) $attrib[$kk]=$vv; @@ -4893,8 +4862,7 @@ // The image onto the background $gifCreator->combineExec($tempScale['m_bgImg'],$tempFileInfo[3],$tempScale['m_mask'],$dest); // Unlink the temp-images... - reset($tempScale); - while(list(,$file)=each($tempScale)) { + foreach ($tempScale as $file) { if (@is_file($file)) { unlink($file); } @@ -5002,7 +4970,7 @@ return $this->data[trim($field)]; } else { $sections = t3lib_div::trimExplode('//',$field,1); - while (list(,$k)=each($sections)) { + foreach ($sections as $k) { if (strcmp($this->data[$k],'')) return $this->data[$k]; } } @@ -5259,8 +5227,7 @@ $output = array(); foreach ($values as $value) { // Traverse the items-array... - reset($TCA[$table]['columns'][$field]['config']['items']); - while (list($key,$item)=each($TCA[$table]['columns'][$field]['config']['items'])) { + foreach ($TCA[$table]['columns'][$field]['config']['items'] as $item) { // ... and return the first found label where the value was equal to $key if (!strcmp($item[1],trim($value))) { $output[] = $GLOBALS['TSFE']->sL($item[0]); @@ -6111,8 +6078,7 @@ */ function keywords($content) { $listArr = preg_split('/[,;' . chr(10) . ']/', $content); - reset($listArr); - while(list($k,$v)=each($listArr)) { + foreach ($listArr as $k => $v) { $listArr[$k]=trim($v); } return implode(',',$listArr); @@ -6284,7 +6250,7 @@ */ function clearTSProperties($TSArr,$propList) { $list = explode(',',$propList); - while(list(,$prop)=each($list)) { + foreach ($list as $prop) { $prop = trim($prop); unset($TSArr[$prop]); unset($TSArr[$prop.'.']); @@ -6326,8 +6292,7 @@ */ function joinTSarrays($conf,$old_conf) { if (is_array($old_conf)) { - reset($old_conf); - while(list($key,$val)=each($old_conf)) { + foreach ($old_conf as $key => $val) { if (is_array($val)) { $conf[$key] = $this->joinTSarrays($conf[$key],$val); } else { @@ -6357,8 +6322,7 @@ if ($tmplObjNumber && $gifbuilderConf[$tmplObjNumber]=='TEXT') { $textArr = $this->linebreaks($text,$chars,$maxLines); $angle = intval($gifbuilderConf[$tmplObjNumber.'.']['angle']); - reset($textArr); - while(list($c,$textChunk)=each($textArr)) { + foreach ($textArr as $c => $textChunk) { $index = $tmplObjNumber+1+($c*2); // Workarea $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index); @@ -6407,9 +6371,9 @@ $lines = explode(chr(10),$string); $lineArr=Array(); $c=0; - while(list(,$paragraph)=each($lines)) { + foreach ($lines as $paragraph) { $words = explode(' ',$paragraph); - while(list(,$word)=each($words)) { + foreach ($words as $word) { if (strlen($lineArr[$c].$word)>$chars) { $c++; } @@ -6437,12 +6401,10 @@ function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) { $JSPart=''; $updateValues=t3lib_div::trimExplode(',',$fieldList); - reset($updateValues); - while(list(,$fKey)=each($updateValues)) { + foreach ($updateValues as $fKey) { $value = $dataArray[$fKey]; if (is_array($value)) { - reset($value); - while(list(,$Nvalue)=each($value)) { + foreach ($value as $Nvalue) { $JSPart.=" updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).");"; } @@ -6716,7 +6678,7 @@ // points to the field (integer) that holds the fe_group-id of the creator fe_user's first group if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { $values = t3lib_div::intExplode(',',$groupList); - while(list(,$theGroupUid)=each($values)) { + foreach ($values as $theGroupUid) { if ($theGroupUid) {$OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'].'='.$theGroupUid;} } } @@ -7027,13 +6989,12 @@ $searchFields = explode(',',$searchFieldList); $kw = preg_split('/[ ,]/', $sw); - while(list(,$val)=each($kw)) { + foreach ($kw as $val) { $val = trim($val); $where_p = array(); if (strlen($val)>=2) { $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val,$searchTable),$searchTable); - reset($searchFields); - while(list(,$field)=each($searchFields)) { + foreach ($searchFields as $field) { $where_p[] = $prefixTableName.$field.' LIKE \'%'.$val.'%\''; } } @@ -7452,8 +7413,7 @@ $content = ''; if (is_array($setup)) { $sKeyArray=t3lib_TStemplate::sortedKeyList($setup); - reset($sKeyArray); - while(list(,$theKey)=each($sKeyArray)) { + foreach ($sKeyArray as $theKey) { $theValue=$setup[$theKey]; if (intval($theKey) && $conf=$setup[$theKey.'.']) { switch($theValue) {