BLOCK::2
"
* so look for those place holders and replace
* them with the original blocks */
if (preg_match_all('/BLOCK::(\d+)<\/code>/', $eventData[$element], $matches )) {
foreach($matches[1] as $key=>$match) {
$eventData[$element] = str_replace($matches[0][$key], $blocks[$match], $eventData[$element]);
}
}
/* post-process each block */
foreach($preserve_tags as $tag) {
$method = '_process_tag_' . $tag;
if (method_exists($this,$method)) {
if (preg_match_all('/<'.$tag.'[^>]?>(.*)<\/'.$tag.'>/msU', $eventData[$element], $matches )) {
foreach($matches[1] as $key=>$match) {
$eventData[$element] = str_replace($matches[0][$key], $this->$method($match), $eventData[$element]);
}
}
}
}
/* end textile processing */
}
}
return true;
case 'frontend_comment':
if (serendipity_db_bool($this->get_config('COMMENT', true))) {
$url = $this->get_config('textile_version') == 1
? 'http://www.textism.com/tools/textile/'
: 'http://thresholdstate.com/articles/4312/the-textile-reference-manual';
echo '' . sprintf(PLUGIN_EVENT_TEXTILE_TRANSFORM, $url) . '';
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
function _process_tag_php($text) {
$code = "";
# Using OB, as highlight_string() only supports
# returning the result from 4.2.0
ob_start();
highlight_string($code);
$highlighted = ob_get_contents();
ob_end_clean();
# Fix output to use CSS classes and wrap well
$highlighted = '' . str_replace(
array(
' ',
'
',
'\n",
'';
return $highlighted;
}
function _process_tag_output($text) {
return '' . $text . '
';
}
function _process_tag_name($text) {
return '';
}
function textile($string) {
if ($this->get_config('textile_version') == 2) {
require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/classTextile.php';
$textile = new Textile();
return $textile->textileThis($string);
} else {
require_once S9Y_INCLUDE_PATH . 'plugins/serendipity_event_textile/textile.php';
return textile($string);
}
}
}
/* vim: set sts=4 ts=4 expandtab : */