Yep. I can do that this way:
Morfy::factory()->addFilter('content', function($content) {
return str_replace('<pre>', '<pre class="prettyprint">', $content);
});
But what about the other data? I have a plan to change the $page['tags'] results into links automatically once the tags plugin is installed. Currently, at my tags plugin, I use this way that will forces the user to rewrite their tags list in their template:
<?php Morfy::factory()->runAction('tags_links'); ?>
I want Morfy to have some ability to do something like this:
Morfy::factory()->addAction('before_render', function() {
// Configuration data
$config = Morfy::$config['tags_config'];
// Get current URI segments
$path = Morfy::factory()->getUriSegments();
array_pop($path);
// Get post data
$post = Morfy::factory()->getPage(Morfy::factory()->getUrl());
$tags = array();
if( ! empty($post['tags'])) {
foreach(explode(',', $post['tags']) as $tag) {
$tags[] = '<a class="' . $config['classes']['tag'] . '" href="' . rtrim(Morfy::$config['site_url'], '/') . '/' . implode('/', $path) . '?' . $config['param'] . '=' . preg_replace('/\s+/', '+', trim($tag)) . '">' . trim($tag) . '</a>';
}
}
sort($tags);
// Rewrite the `$post['tags']` data
// change the results into clickable links
// BUT NOT WORKING!!!
$post['tags'] = implode($config['separator'], $tags);
// nor this! :(
global $page;
$page['tags'] = implode($config['separator'], $tags);
});
XSS Testing <script>alert('HIYAA!!!');</script>