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\\
'# (?$1',
'$1',
'$1',
'$1',
'$1',
'
$2]*>).*?(\1|\2>)~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 );
}
}
?>