Do not replace in tags, it matches e.g. the following for italic:
* """ [...] http://"""!
*
* @package plugins
*/
class gmcode_plugin extends Plugin
{
var $code = 'b2evGMco';
var $name = 'GM code';
var $priority = 45;
var $group = 'rendering';
var $short_desc;
var $long_desc;
var $version = '5.0.0';
var $number_of_installs = 1;
/**
* GreyMatter formatting search array
*
* @access private
*/
var $search = array(
'# \*\* (.+?) \*\* #x', // **bold**
'# \\\\ (.+?) \\\\ #x', // \\italics\\
'# (?<!:) \x2f\x2f (.+?) \x2f\x2f #x', // //italics// (not preceded by : as in http://)
'# __ (.+?) __ #x', // __underline__
'/ \#\# (.+?) \#\# /x', // ##tt##
'/ %%
( \s*? \n )? # Eat optional blank line after %%%
(.+?)
( \n \s*? )? # Eat optional blank line before %%%
%%
/sx' // %%codeblock%%
);
/**
* HTML replace array
*
* @access private
*/
var $replace = array(
'$1',
'$1',
'$1',
'$1',
'$1',
'
$2]*>.*?\1>~is',
array( $this, 'replace_out_tags' ) );
}
else
{ // No code/pre blocks, replace on the whole thing
$content = $this->replace_out_tags( $content );
}
return true;
}
/**
* Replace text outside of html tags
*
* @param string
* @return string
*/
function replace_out_tags( $text )
{
return callback_on_non_matching_blocks( $text, '~<[^>]*>~s', array( $this, 'replace_callback' ) );
}
/**
* Replace callback
*
* @param string
* @return string
*/
function replace_callback( $text )
{
return preg_replace( $this->search, $this->replace, $text );
}
}
?>