ID); } if ( $http_auth_if ) { add_filter('feed_link', array(&$this, 'filter_feed_link')); add_filter('category_feed_link', array(&$this, 'filter_feed_link')); add_filter('tag_feed_link', array(&$this, 'filter_feed_link')); add_filter('author_feed_link', array(&$this, 'filter_feed_link')); add_filter('post_comments_feed_link', array(&$this, 'filter_feed_link')); } add_filter('the_content_rss', array(&$this, 'filter_the_content_rss')); add_filter('the_excerpt_rss', array(&$this, 'filter_the_excerpt_rss')); if ( is_feed() ) { // Only filter the_content if we're sure this is an RSS request (TODO: is this still necessary?) if ( ! empty($_GET[HTTP_AUTH_RS]) ) add_filter('the_content', array(&$this, 'filter_the_content_rss')); } } function replace_feed_teaser_placeholder($content) { if ( ! empty( $GLOBALS['post'] ) ) { $search[] = PERMALINK_PLACEHOLDER_RS; $replace[] = get_permalink($GLOBALS['post']->ID); $content = str_replace($search, $replace, $content); } return $content; } function filter_rss( $text, $subject = 'content' ) { global $post; if ( ! empty($post) && ! empty($post->scoper_teaser) ) return $text; if ( $post->post_status == 'private') $feed_privacy = scoper_get_option( 'rss_private_feed_mode' ); else $feed_privacy = scoper_get_option( 'rss_nonprivate_feed_mode' ); switch ($feed_privacy) { case RSS_FULL_CONTENT_RS: return $text; case RSS_EXCERPT_ONLY_RS: if ( 'content' == $subject ) return apply_filters( 'the_excerpt_rss', get_the_excerpt(true) ); else return $text; default: if ( $msg = scoper_get_option( 'feed_teaser' ) ) { if ( defined('SCOPER_TRANSLATE_TEASER') ) { scoper_load_textdomain(); // otherwise this is only loaded for wp-admin $msg = translate( $msg, 'scoper'); if ( ! empty($msg) && ! is_null($msg) && is_string($msg) ) $msg = htmlspecialchars_decode( $msg ); } return $this->replace_feed_teaser_placeholder( $msg ); } } // end switch } // Called when using HTTP auth -- changes the article content for items which are not already filtered by Hidden Content Teaser function filter_the_content_rss($content) { return $this->filter_rss($content, 'content'); } // Called when using HTTP auth -- changes the article excerpt for items which are not already filtered by Hidden Content Teaser function filter_the_excerpt_rss($excerpt) { return $this->filter_rss($excerpt, 'excerpt'); } // Rewrites RSS feed links to support http authentication // if the user is logged in function filter_feed_link($output) { $delim = (strpos($output, '?') === false) ? '?' : '&'; return $output. $delim . HTTP_AUTH_RS . '=1'; } } ?>