示例#1
0
<?php

define('PREMIUMCAST', true);
define('PODPRESS_PREMIUM_METHOD', 'Digest');
podPress_validateLogin();
require 'wp-rss2.php';
示例#2
0
/**
* podPress_feed_content_filtering - is called via the Action Hook pre_get_posts and influences the WP Query if the query is for a feed
*
* @package podPress
* @since 8.8.8.1
*
* @param Array $query - WP Query object - see http://codex.wordpress.org/Function_Reference/WP_Query and http://codex.wordpress.org/Plugin_API/Action_Reference#Advanced_Actions
*/
function podPress_feed_content_filtering($query)
{
    global $podPress, $wp_version, $podpress_allowed_ext, $podPress_feed_post_limit;
    if ($query->is_feed) {
        $is_podpress_feed = FALSE;
        $feedslug = $query->query_vars['feed'];
        foreach ($podPress->settings['podpress_feeds'] as $feed) {
            if ($feedslug === $feed['slug']) {
                $is_podpress_feed = TRUE;
                if (TRUE === isset($feed['PostTypes']) and FALSE === empty($feed['PostTypes'])) {
                    if (isset($query->query_vars['post_type']) and is_array($query->query_vars['post_type'])) {
                        $result = array_merge($query->query_vars['post_type'], $feed['PostTypes']);
                        $query->query_vars['post_type'] = array_unique($result);
                    } else {
                        $query->query_vars['post_type'] = $feed['PostTypes'];
                    }
                    if (isset($query->query['post_type']) and is_array($query->query['post_type'])) {
                        $result = array_merge($query->query['post_type'], $feed['post_type_filter']);
                        $query->query['post_type'] = array_unique($result);
                    } else {
                        $query->query['post_type'] = $feed['post_type_filter'];
                    }
                }
                if (TRUE === isset($feed['posts_per_feed']) and FALSE === empty($feed['posts_per_feed'])) {
                    $podPress_feed_post_limit = $feed['posts_per_feed'];
                    add_filter('post_limits', 'podPress_post_limits');
                }
                break;
            }
        }
        if (FALSE === $is_podpress_feed) {
            if (TRUE === empty($query->query_vars['cat']) and TRUE === empty($query->query_vars['tag']) and FALSE === empty($query->query_vars['category_name'])) {
                if (TRUE == version_compare($wp_version, '2.3', '>=')) {
                    $idObj = get_category_by_slug($query->query_vars['category_name']);
                    $cat_id = $idObj->term_id;
                } else {
                    $cat_id = podPress_get_cat_ID_by_nicename($query->query_vars['category_name']);
                }
                $taxonomy = 'category';
            } else {
                if (FALSE === empty($query->query_vars['cat'])) {
                    $taxonomy = 'category';
                    $term_meta = get_term_by('slug', $query->query_vars['cat'], $taxonomy);
                } elseif (FALSE === empty($query->query_vars['tag'])) {
                    $taxonomy = 'post_tag';
                    $term_meta = get_term_by('slug', $query->query_vars['tag'], $taxonomy);
                }
                if (isset($term_meta->term_id)) {
                    $cat_id = $term_meta->term_id;
                } else {
                    $cat_id = '';
                }
            }
            if (FALSE === empty($cat_id)) {
                $categorysettings = get_option('podPress_' . $taxonomy . '_' . $cat_id);
            } else {
                $categorysettings = FALSE;
            }
        }
        if (TRUE === $is_podpress_feed) {
            // podPress Custom Feeds
            // get the list of allowed file extensions
            $podpress_allowed_ext = podpress_get_exts_from_filetypes($feed['FileTypes']);
            if (is_array($podpress_allowed_ext) and FALSE === empty($podpress_allowed_ext) or is_array($feed['inclCategories']) and FALSE === empty($feed['inclCategories'])) {
                if (is_array($podpress_allowed_ext) and FALSE === empty($podpress_allowed_ext)) {
                    // get a list of IDs of posts which have podPress attachment of an allowed type
                    $post_ids = podpress_get_IDs_of_posts_with_allowed_exts($podpress_allowed_ext);
                    if (is_array($post_ids) and FALSE == empty($post_ids)) {
                        // insert the post IDs into the WP Query
                        $query->set('post__in', $post_ids);
                    } else {
                        $query->set('post__in', array(0));
                    }
                }
                if (is_array($feed['inclCategories']) and FALSE === empty($feed['inclCategories'])) {
                    $query->query_vars['category__in'] = $feed['inclCategories'];
                }
            } else {
                if (isset($feed['show_only_podPress_podcasts']) and FALSE === $feed['show_only_podPress_podcasts']) {
                    // the feed should not only posts with podPress attachments
                    define('PODPRESS_PODCASTSONLY', FALSE);
                } else {
                    // get only posts with podPress attachments (that is how was in older versions)
                    define('PODPRESS_PODCASTSONLY', TRUE);
                }
            }
            if ('torrent' === $feed['slug']) {
                define('PODPRESS_TORRENTCAST', true);
            }
            if (TRUE === $feed['premium']) {
                global $cache_lastpostmodified;
                unset($_SERVER['HTTP_IF_MODIFIED_SINCE']);
                $cache_lastpostmodified = date('Y-m-d h:i:s', time() + 36000);
                podPress_addFeedHooks();
                define('PREMIUMCAST', true);
                require_once PODPRESS_DIR . '/podpress_premium_functions.php';
                podPress_validateLogin();
            } else {
                podPress_addFeedHooks();
            }
        } elseif (isset($categorysettings) and FALSE !== $categorysettings and isset($categorysettings['categoryCasting']) and 'true' == $categorysettings['categoryCasting']) {
            // Category Casting and Tag Casting Feeds
            // add same data of the current category temporarily to the $podPress->settings
            $podPress->settings['category_data'] = $categorysettings;
            $podPress->settings['category_data']['id'] = $cat_id;
            $term_data = get_term($cat_id, $taxonomy);
            $podPress->settings['category_data']['cat_name'] = $term_data->name;
            $podPress->settings['category_data']['cat_description'] = $term_data->description;
            $podPress->settings['category_data']['blogname'] = get_bloginfo('name');
            // get the list of allowed file extensions
            $podpress_allowed_ext = podpress_get_exts_from_filetypes($categorysettings['FileTypes']);
            if (is_array($podpress_allowed_ext) and FALSE === empty($podpress_allowed_ext)) {
                // get a list of IDs of posts which have podPress attachment of an allowed type
                $post_ids = podpress_get_IDs_of_posts_with_allowed_exts($podpress_allowed_ext);
                if (is_array($post_ids) and FALSE == empty($post_ids)) {
                    // insert the post IDs into the WP Query
                    $query->set('post__in', $post_ids);
                } else {
                    $query->set('post__in', array(0));
                }
            } else {
                // get only posts with podPress attachments
                if (isset($categorysettings['show_only_podPress_podcasts']) and FALSE === $categorysettings['show_only_podPress_podcasts']) {
                    // the feed should not only posts with podPress attachments
                    define('PODPRESS_PODCASTSONLY', FALSE);
                } else {
                    // get only posts with podPress attachments (that is how was in older versions)
                    define('PODPRESS_PODCASTSONLY', TRUE);
                }
            }
            podPress_addFeedHooks();
        } else {
            // RSS, RSS2, ATOM
            podPress_addFeedHooks();
        }
    }
}
 function podPress_get_currentuserinfo()
 {
     podPress_validateLogin();
 }