registerFunction( 'onPrepareContent', 'botMosSef' ); /** * Converting internal relative links to SEF URLs * * Usage: * */ function botMosSef( $published, &$row, &$params, $page=0 ) { global $mosConfig_absolute_path, $mosConfig_live_site; // define the regular expression for the bot $regex = "#href=\"(.*?)\"#s"; // perform the replacement $row->text = preg_replace_callback( $regex, 'botMosSef_replacer', $row->text ); return true; } /** * Replaces the matched tags * @param array An array of matches (see preg_match_all) * @return string */ function botMosSef_replacer( &$matches ) { if ( substr($matches[1],0,1)=="#" ) { // anchor $temp = split("index.php", $_SERVER['REQUEST_URI']); return "href=\"".sefRelToAbs("index.php".@$temp[1]).$matches[1]."\""; } else { return "href=\"".sefRelToAbs($matches[1])."\""; } } ?>