registerFunction( 'onPrepareContent', 'botGeshi' ); /** * Code Highlighting Mambot * * Replaces
...tags with highlighted text */ function botGeshi( $published, &$row, &$params, $page=0 ) { require_once( $GLOBALS['mosConfig_absolute_path'] . '/includes/domit/xml_saxy_shared.php' ); // simple performance check to determine whether bot should process further if ( strpos( $row->text, 'pre>' ) === false ) { return true; } // define the regular expression for the bot $regex = "#
(.*?)#s"; // check whether mambot has been unpublished if ( !$published ) { return true; } $GLOBALS['_MAMBOT_GESHI_PARAMS'] =& $params; // perform the replacement $row->text = preg_replace_callback( $regex, 'botGeshi_replacer', $row->text ); return true; } /** * Replaces the matched tags an image * @param array An array of matches (see preg_match_all) * @return string */ function botGeshi_replacer( &$matches ) { $params =& $GLOBALS['_MAMBOT_GESHI_PARAMS']; include_once( dirname( __FILE__ ) . '/geshi/geshi.php' ); $args = SAXY_Parser_Base::parseAttributes( $matches[1] ); $text = $matches[2]; $lang = mosGetParam( $args, 'lang', 'php' ); $lines = mosGetParam( $args, 'lines', 'false' ); $html_entities_match = array( "|\