$output = &$modx->documentOutput;
$output = str_replace(" maddona ", ' <a href="maddona.html">maddona</a> ', $output);
return $output;Fatal error: Call to undefined function str_replace_once() in /home/quirkybe/public_html/manager/includes/document.parser.class.inc.php(745) : eval()'d code on line 4

<a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> <a href="madonnna.html"> madonnna </a> </a> </a> </a> </a> </a> </a> </a> </a>
if (!function_exists('str_replace_once')) {
function str_replace_once($needle , $replace , $haystack){
// Looks for the first occurence of $needle in $haystack
// and replaces it with $replace.
$pos = strpos($haystack, $needle);
if ($pos === false) {
// Nothing found
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
}
$output = &$modx->documentOutput;
$output = str_replace_once(" consolidation ", ' <a href="consolidation.html">consolidation</a> ', $output); //notice str_replace_once
$output = str_replace_once(" RedBull ", ' <a href="redbull.html">RedBull</a> ', $output); //instead of str_replace
return $output;<?php
$output = str_replace(' machinery safety', ' <b>machinery safety</b>', $modx->documentOutput);
$modx->documentOutput = $output;
?>
if (!function_exists('str_replace_once')) {
function str_replace_once($needle , $replace , $haystack){
// Looks for the first occurence of $needle in $haystack
// and replaces it with $replace.
$pos = strpos($haystack, $needle);
if ($pos === false) {
// Nothing found
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
}
$output = str_replace_once(' machinery safety', ' <a href="mahcinery-safety">machinery safety</a>', $modx->documentOutput);
$modx->documentOutput = $output;
<?php
$output = str_replace(' machinery safety', ' <b>machinery safety</b>', $modx->documentOutput);
$modx->documentOutput = $output;
?>
<?php
if (!function_exists('str_replace_once')) {
function str_replace_once($needle , $replace , $haystack){
// Looks for the first occurence of $needle in $haystack
// and replaces it with $replace.
$pos = strpos($haystack, $needle);
if ($pos === false) {
// Nothing found
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
}
$output = str_replace_once(' machinery safety', ' <a href="mahcinery-safety">machinery safety</a>', $modx->documentOutput);
$modx->documentOutput = $output;
?>
but its how we deal with <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> <a href="debt"> debt </a></a></a></a></a></a></a></a></a>that really matters.