Example #1
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);
    }
}
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);
    }
}
Example #3
0
function similar_posts_init()
{
    global $overusedwords, $wp_db_version;
    load_plugin_textdomain('post_plugins');
    $options = get_option('similar-posts');
    if ($options['content_filter'] === 'true' && function_exists('ppl_register_content_filter')) {
        ppl_register_content_filter('SimilarPosts');
    }
    if ($options['feed_active'] === 'true') {
        add_filter('the_content', 'similar_posts_for_feed');
    }
    //install the actions to keep the index up to date
    add_action('save_post', 'sp_save_index_entry', 1);
    add_action('delete_post', 'sp_delete_index_entry', 1);
    if ($wp_db_version < 3308) {
        add_action('edit_post', 'sp_save_index_entry', 1);
        add_action('publish_post', 'sp_save_index_entry', 1);
    }
}