Project

General

Profile

Feature #19647 ยป class.tslib_fe.php.trunk.diff

Administrator Admin, 2008-11-26 14:31

View differences:

class.tslib_fe.php.trunk.patched 2008-11-26 14:12:07.000000000 +0100
$GLOBALS['TT']->push('Split content');
$INTiS_splitC = explode('<!--INT_SCRIPT.',$this->content); // Splits content with the key.
$this->content = '';
$content = array(); // output storage array to accumulate content blocks in variable order
$GLOBALS['TT']->setTSlogMessage('Parts: '.count($INTiS_splitC));
$GLOBALS['TT']->pull();
/**
* calculate sorting (begin)
*
* This part extends INCincScript_process by the ability to read sorting priority values
* out of each calculated values plugin typoscript definition and execute the pages
* plugins in thereby defined order.
*/
$INTiS_splitC_order = array(); // array for calculating sorting order of content blocks
$subSorting = 0; // innter sorting counter to make sure untouched content blocks are calculated in their nativ order
foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
$subSorting++;
if (substr($INTiS_cPart,32,3)=='-->') {
$INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
$INTiS_pluginConfig = $INTiS_config[$INTiS_key]['conf'];
// get sorting order out of plugins "plugin.pluginName.renderPriority", guess 100+$subSorting as native values
$INTiS_splitC_order[$INTiS_c] = (isset($INTiS_pluginConfig['renderPriority'])?intval($INTiS_pluginConfig['renderPriority']):(100+$subSorting));
}
else
$INTiS_splitC_order[$INTiS_c] = -1-$subSorting;
}
natsort($INTiS_splitC_order); // sort sorting array by sorting value
$INTiS_splitC_sorted = array(); // replaces former $INTiS_splitC to contain sorted references
foreach ($INTiS_splitC_order as $INTiS_index=>$INTiS_renderPriority)
$INTiS_splitC_sorted[$INTiS_index] = &$INTiS_splitC[$INTiS_index];
/**
* calculate sorting (end)
*/
foreach($INTiS_splitC_sorted as $INTiS_c => $INTiS_cPart) { // uses sorted array insted of former unsorted one
if (substr($INTiS_cPart,32,3)=='-->') { // If the split had a comment-end after 32 characters it's probably a split-string
$INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
$GLOBALS['TT']->push('Include '.$INTiS_config[$INTiS_key]['file'],'');
......
break;
}
}
$this->content.= $this->convOutputCharset($incContent,'INC-'.$INTiS_c);
$this->content.= substr($INTiS_cPart,35);
$content[$INTiS_c] = $this->convOutputCharset($incContent,'INC-'.$INTiS_c); // write content blocks into content array not to desturbe the output order
$content[$INTiS_c] .= substr($INTiS_cPart,35);
$GLOBALS['TT']->pull($incContent);
} else {
$this->content.= ($INTiS_c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
$content[$INTiS_c] = ($INTiS_c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
}
}
ksort($content); // restore the contents native output order
$this->content = join('', $content);
}
/**
    (1-1/1)