merge forgotten function splithtmlbyPRE into 1.8. Was introduced accidentally by Ralf while merging in for rev34580: fixed not working deinstall of languages

This commit is contained in:
Klaus Leithoff 2011-04-19 07:49:04 +00:00
parent 2dc0739b2c
commit 415b492f18

View File

@ -1491,5 +1491,31 @@ class html
}
}
}
/**
* split html by PRE tag, return array with all content pre-sections isolated in array elements
* @author Leithoff, Klaus
* @param string html
* @return mixed array of parts or unaffected html
*/
static function splithtmlByPRE($html)
{
if (($pos = stripos($html,'<pre>')) === false)
{
return $html;
}
$html2ret[] = substr($html,0,$pos);
while ($pos!==false)
{
$endofpre = stripos($html,'</pre>',$pos);
$length = $endofpre-$pos+6;
$html2ret[] = substr($html,$pos,$length);
$pos = stripos($html,'<pre>', $endofpre+6);
$html2ret[] = ($pos ? substr($html,$endofpre+6,$pos-($endofpre+6)): substr($html,$endofpre+6));
//$pos=false;
}
return $html2ret;
}
}
html::_init_static();