function recent_comments_init()
{
    load_plugin_textdomain('recent_comments_plugin');
    $options = get_option('recent-comments');
    if ($options['content_filter'] === 'true' && function_exists('ppl_register_content_filter')) {
        ppl_register_content_filter('RecentComments');
    }
    if ($options['feed_on'] === 'true' && function_exists('ppl_register_post_filter')) {
        ppl_register_post_filter('feed', 'recent-comments', 'RecentComments');
    }
    if ($options['append_condition']) {
        $condition = $options['append_condition'];
    } else {
        $condition = 'true';
    }
    $condition = stristr($condition, "return") ? $condition : "return " . $condition;
    $condition = rtrim($condition, '; ') . ';';
    if ($options['append_on'] === 'true' && function_exists('ppl_register_post_filter')) {
        ppl_register_post_filter('append', 'recent-comments', 'RecentComments', $condition);
    }
}
Exemplo n.º 2
0
function popular_posts_init()
{
    load_plugin_textdomain('popular_posts_plugin');
    add_action('loop_start', 'pvc_tracker');
    $options = get_option('popular-posts');
    if ($options['content_filter'] === 'true' && function_exists('ppl_register_content_filter')) {
        ppl_register_content_filter('PopularPosts');
    }
    if ($options['feed_on'] === 'true' && function_exists('ppl_register_post_filter')) {
        ppl_register_post_filter('feed', 'popular-posts', 'PopularPosts');
    }
    if ($options['append_condition']) {
        $condition = $options['append_condition'];
    } else {
        $condition = 'true';
    }
    $condition = stristr($condition, "return") ? $condition : "return " . $condition;
    $condition = rtrim($condition, '; ') . ';';
    if ($options['append_on'] === 'true' && function_exists('ppl_register_post_filter')) {
        ppl_register_post_filter('append', 'popular-posts', 'PopularPosts', $condition);
    }
}