Lower number for $priority means earlier execution of $func.
If $func returns boolean FALSE the filter chain is broken, not applying
any more filter after the one returning FALSE. Returning anything else
have no effect.
static public add ( $tag, $func, $priority = 100 ) |
static function init($context) { if ($context !== 'rebuild') { return false; } self::$conf = gb::data('plugins/' . gb_filenoext(basename(__FILE__)), array('classname' => 'codeblock', 'tabsize' => 2, 'pygmentize' => 'pygmentize')); gb_cfilter::add('body.html', array(__CLASS__, 'filter'), 0); return true; }
static function init($context) { if ($context === 'rebuild') { gb::observe('did-parse-object-meta', array(__CLASS__, 'check_content')); gb_cfilter::add('body.html', array(__CLASS__, 'escape_php'), 0); gb_cfilter::add('body.html', array(__CLASS__, 'unescape_php'), 9000); return true; } elseif ($context === 'request') { gb::add_filter('post-body', array(__CLASS__, 'eval_body')); return true; } }
static function init($context) { $default_conf = array('api_key' => '', 'delete_spam' => true); self::$conf = gb::data('plugins/' . gb_filenoext(basename(__FILE__)), $default_conf); if (!self::$key) { self::$key = self::$conf['api_key']; } if (!self::$key) { gb::log(LOG_WARNING, 'akismet not loaded since "api_key" is not set in %s', self::$conf->file); return false; } if ($context === 'admin') { gb_cfilter::add('pre-comment', array(__CLASS__, 'check_comment')); return true; } return false; }
static function init($context) { if ($context !== 'rebuild') { return false; } foreach (array('md', 'markdown', 'mdown') as $ext) { gb_cfilter::add('post-reload-GBExposedContent.' . $ext, array(__CLASS__, 'reloadExposedObject'), 10); } # setup the MD parser self::$parser = new GBMarkdownParser(); self::$parser->use_codeblocks = gb::plugin_check_enabled($context, 'code_blocks'); gb_cfilter::add('body.md', array(self::$parser, 'transform'), 10); return true; }
gb_cfilter::add('body.html', 'gb_xmlents_to_utf8', 60); gb_cfilter::add('body.html', 'gb_force_balance_tags', 70); #gb_cfilter::add('body.html', 'gb_html_img_size', 80); gb_cfilter::add('body.html', 'gb_html_abspaths_to_urls', 10000); # Applied to GBComment after being posted, but before being saved gb_cfilter::add('pre-comment', 'gb_filter_pre_comment', 10); # before this one you might want to hook on some spam assessment plugin, like Akismet. gb_cfilter::add('pre-comment', 'gb_approve_ham_comment', 10000); # Applied to GBComments/GBComment after being reloaded but prior to writing cache. gb_cfilter::add('post-reload-comments', 'gb_filter_post_reload_comments', 10); gb_cfilter::add('post-reload-comment', 'gb_filter_post_reload_comment', 10); # Applied to GBComment::$body prior to writing the comments' cache. gb_cfilter::add('sanitize-comment', 'gb_texturize_html', 10); gb_cfilter::add('sanitize-comment', 'gb_convert_html_chars', 20); gb_cfilter::add('sanitize-comment', 'gb_html_to_xhtml', 30); gb_cfilter::add('sanitize-comment', 'gb_force_balance_tags', 40); gb_cfilter::add('sanitize-comment', 'gb_uri_to_html_link', 50); gb_cfilter::add('sanitize-comment', 'gb_filter_allowed_tags', 60); gb_cfilter::add('sanitize-comment', 'gb_normalize_html_structure', 70); gb_cfilter::add('sanitize-comment', 'gb_htmlents_to_xmlents', 80); gb_cfilter::add('sanitize-comment', 'gb_xmlents_to_utf8', 90); gb_cfilter::add('sanitize-comment', 'gb_html_abspaths_to_urls', 10000); # Applied to tag-type meta fields at reload and should at the end return a # clean array of tokens. Note that gb_split_tags performs the initial splitting # on comma and strips whitespace, thus any filter run after this one will get # an array as the first argument. Any filter run prior to gb_split_tags will # get a string as input and should return a string. gb_cfilter::add('parse-tags', 'gb_split_tags', 10); gb_cfilter::add('parse-tags', 'gb_vstrtolower', 20); gb_cfilter::add('parse-tags', 'gb_unique_strings', 30);