Project

General

Profile

Bug #18115 » delteUnusedMarker.diff

Administrator Admin, 2008-02-04 17:37

View differences:

t3lib/class.t3lib_parsehtml.php (working copy)
return $before.$between.$after;
}
/**
* Substitutes a marker string in the input content (by a simple str_replace())
*
......
* @param string The content stream, typically HTML template content.
* @param array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content stream with the content.
* @param string A wrap value - [part 1] | [part 2] - for the markers before substitution
* @param boolean If set, all marker string substitution is done with upper-case markers.
* @param boolean If set, all marker string substitution is done with upper-case markers.
* @param boolean If set, all unused marker are deleted.
* @return string The processed output stream
* @see substituteMarker(), substituteMarkerInObject(), TEMPLATE()
*/
public function substituteMarkerArray($content, $markContentArray, $wrap='', $uppercase=0) {
if (is_array($markContentArray)) {
public function substituteMarkerArray($content, $markContentArray, $wrap='', $uppercase=0, $deleteUnused=0) {
if (is_array($markContentArray)) {
$wrapArr = t3lib_div::trimExplode('|',$wrap);
foreach($markContentArray as $marker => $markContent) {
foreach($markContentArray as $marker => $markContent) {
if($uppercase) {
$marker = strtoupper($marker);
}
......
}
$content = str_replace($marker, $markContent, $content);
}
if ($deleteUnused) {
preg_match_all('/'.$wrapArr[0].'([A-Z0-9_-|]*)'.$wrapArr[1].'/is', $content,$match);
foreach((array)$match[0] as $marker) {
$content = str_replace($marker, '', $content);
}
}
}
return $content;
}
// *******************************************'
// COPY FROM class.tslib_content.php: / END
// *******************************************'
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
* @param string The content stream, typically HTML template content.
* @param array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content stream with the content.
* @param string A wrap value - [part 1] | [part 2] - for the markers before substitution
* @param boolean If set, all marker string substitution is done with upper-case markers.
* @param boolean If set, all marker string substitution is done with upper-case markers.
* @param boolean If set, all unused marker are deleted.
* @return string The processed output stream
* @see substituteMarker(), substituteMarkerInObject(), TEMPLATE()
*/
function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0) {
return t3lib_parsehtml::substituteMarkerArray($content,$markContentArray,$wrap,$uppercase);
function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0, $deleteUnused=0) {
return t3lib_parsehtml::substituteMarkerArray($content,$markContentArray,$wrap,$uppercase,$deleteUnused);
}
/**
(1-1/2)