本文整理汇总了PHP中is_comment_feed函数的典型用法代码示例。如果您正苦于以下问题:PHP is_comment_feed函数的具体用法?PHP is_comment_feed怎么用?PHP is_comment_feed使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_comment_feed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_query
function filter_query()
{
if (is_comment_feed()) {
// we are inside a comment feed
wp_die(__('Comments are closed.'), '', array('response' => 403));
}
}
示例2: apply_filters
function apply_filters()
{
if (is_feed()) {
$hs_settings = get_option('hs_settings');
if ($hs_settings !== false && !empty($hs_settings['hs_portal'])) {
$this->portal_id = $hs_settings['hs_portal'];
add_filter('the_content_feed', array($this, 'hs_add_rss_readers_tracking'));
add_filter('the_excerpt_rss', array($this, 'hs_add_rss_readers_tracking'));
if (!is_category() && !is_comment_feed()) {
add_filter('the_content_feed', array($this, 'hs_add_rss_subscribers_tracking'));
}
}
}
}
示例3: genesis_feed_redirect
/**
* Redirect the browser to the custom feed URI.
*
* Exits PHP after redirect.
*
* @since 1.3.0
*
* @uses genesis_get_option() Get theme setting value.
*
* @return null Return early on failure. Exits on success.
*/
function genesis_feed_redirect()
{
if (!is_feed() || isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/feed(blitz|burner|validator)/i', $_SERVER['HTTP_USER_AGENT'])) {
return;
}
//* Don't redirect if viewing archive, search, or post comments feed
if (is_archive() || is_search() || is_singular()) {
return;
}
$feed_uri = genesis_get_option('feed_uri');
$comments_feed_uri = genesis_get_option('comments_feed_uri');
if ($feed_uri && !is_comment_feed() && genesis_get_option('redirect_feed')) {
wp_redirect($feed_uri, 302);
exit;
}
if ($comments_feed_uri && is_comment_feed() && genesis_get_option('redirect_comments_feed')) {
wp_redirect($comments_feed_uri, 302);
exit;
}
}
示例4: filterFeedComments
/**
* Filter out the comment feed
*
* @since 0.0.2
* @access public
* @link https://github.com/solarissmoke/disable-comments-mu
* @uses wp_die()
*/
public static function filterFeedComments()
{
if (is_comment_feed()) {
wp_die('There are no comments enabled on this site.', '', ['response' => 403]);
}
}
示例5: pre_get_posts
function pre_get_posts($query)
{
// don't make anything if no language has been defined yet
// $this->post_types & $this->taxonomies are defined only once the action 'wp_loaded' has been fired
// honor suppress_filters
if (!$this->get_languages_list() || !did_action('wp_loaded') || $query->get('suppress_filters')) {
return $query;
}
$qv = $query->query_vars;
// users may want to display content in a different language than the current one by setting it explicitely in the query
if (!$this->first_query && $this->curlang && isset($qv['lang']) && $qv['lang']) {
return $query;
}
$this->first_query = false;
// detect our exclude pages query and returns to avoid conflicts
// this test should be sufficient
if (isset($qv['tax_query'][0]['taxonomy']) && $qv['tax_query'][0]['taxonomy'] == 'language' && isset($qv['tax_query'][0]['operator']) && $qv['tax_query'][0]['operator'] == 'NOT IN') {
return $query;
}
// special case for wp-signup.php & wp-activate.php
if (is_home() && false === strpos($_SERVER['SCRIPT_NAME'], 'index.php')) {
$this->curlang = $this->get_preferred_language();
return $query;
}
// homepage is requested, let's set the language
// take care to avoid posts page for which is_home = 1
if (!$this->curlang && empty($query->query) && (is_home() || is_page() && $qv['page_id'] == $this->page_on_front)) {
$this->home_requested($query);
}
// redirect the language page to the homepage
if ($this->options['redirect_lang'] && is_tax('language') && $this->page_on_front && (count($query->query) == 1 || is_paged() && count($query->query) == 2)) {
$qv['page_id'] = $this->get_post($this->page_on_front, $this->get_language(get_query_var('lang')));
$query->parse_query($qv);
return $query;
}
// sets is_home on translated home page when it displays posts
// is_home must be true on page 2, 3... too
if (!$this->page_on_front && is_tax('language') && (count($query->query) == 1 || is_paged() && count($query->query) == 2)) {
$query->is_home = true;
$query->is_tax = false;
$this->curlang = $this->get_language(get_query_var('lang'));
// sets the language now otherwise it will be too late to filter sticky posts !
}
// sets the language for posts page in case the front page displays a static page
if ($this->page_for_posts) {
// If permalinks are used, WordPress does set and use $query->queried_object_id and sets $query->query_vars['page_id'] to 0
// and does set and use $query->query_vars['page_id'] if permalinks are not used :(
if (isset($qv['pagename']) && $qv['pagename'] && isset($query->queried_object_id)) {
$page_id = $query->queried_object_id;
} elseif (isset($qv['page_id'])) {
$page_id = $qv['page_id'];
}
if (isset($page_id) && $page_id && $this->get_post($page_id, $this->get_post_language($this->page_for_posts)) == $this->page_for_posts) {
$this->page_for_posts = $page_id;
$this->curlang = $this->get_post_language($page_id);
$query->set('lang', $this->curlang->slug);
$query->is_page = false;
$query->is_singular = false;
$query->is_home = true;
$query->is_posts_page = true;
}
}
$is_post_type = isset($qv['post_type']) && (in_array($qv['post_type'], $this->post_types) || is_array($qv['post_type']) && array_intersect($qv['post_type'], $this->post_types));
// FIXME to generalize as I probably forget things
$is_archive = count($query->query) == 1 && isset($qv['paged']) && $qv['paged'] || isset($qv['m']) && $qv['m'] || isset($qv['author']) && $qv['author'] || isset($qv['post_type']) && is_post_type_archive() && $is_post_type;
// sets 404 when the language is not set for archives needing the language in the url
if (!$this->options['hide_default'] && !isset($qv['lang']) && !$GLOBALS['wp_rewrite']->using_permalinks() && $is_archive) {
$query->set_404();
}
// sets the language in case we hide the default language
if ($this->options['hide_default'] && !isset($qv['lang']) && ($is_archive || is_search() || count($query->query) == 1 && isset($qv['feed']) && $qv['feed'])) {
$query->set('lang', $this->options['default_lang']);
}
// allow filtering recent posts and secondary queries by the current language
// take care not to break queries for non visible post types such as nav_menu_items, attachments...
if ($this->curlang && (!isset($qv['post_type']) || $is_post_type)) {
$query->set('lang', $this->curlang->slug);
}
// remove pages query when the language is set unless we do a search
// FIXME is only search broken by this ?
if (isset($qv['lang']) && $qv['lang'] && !isset($qv['post_type']) && !is_search()) {
$query->set('post_type', 'post');
}
// unset the is_archive flag for language pages to prevent loading the archive template
// keep archive flag for comment feed otherwise the language filter does not work
if (isset($qv['lang']) && $qv['lang'] && !is_comment_feed() && !is_post_type_archive() && !is_date() && !is_author() && !is_category() && !is_tag() && !is_tax('post_format')) {
$query->is_archive = false;
}
// unset the is_tax flag for authors pages and post types archives
// FIXME Probably I should do this for other cases
if (isset($qv['lang']) && $qv['lang'] && (is_author() || is_post_type_archive() || is_date() || is_search())) {
$query->is_tax = false;
unset($query->queried_object);
}
// sets a language for theme preview
if (is_preview() && is_front_page()) {
$this->curlang = $this->get_current_language();
$query->set('lang', $this->curlang->slug);
}
// sets the language for an empty string search when hiding the code for default language
//.........这里部分代码省略.........
示例6: filter_query
/**
* Redirect on comment feed, set status 301
*
* @since 04/08/2013
* @param void
* @return void
*/
public function filter_query()
{
if (!is_comment_feed()) {
return NULL;
}
if (isset($_GET['feed'])) {
wp_redirect(remove_query_arg('feed'), 301);
exit;
}
// redirect_canonical will do the rest
set_query_var('feed', '');
}
示例7: getQuery
public function getQuery()
{
$query = ['isArchive' => is_archive(), 'isPostTypeArchive' => is_post_type_archive(), 'isAttachment' => is_attachment(), 'isAuthor' => is_author(), 'isCategory' => is_category(), 'isTag' => is_tag(), 'isTaxonomy' => is_tax(), 'isCommentsPopup' => is_comments_popup(), 'isDate' => is_date(), 'isDay' => is_day(), 'isFeed' => is_feed(), 'isCommentFeed' => is_comment_feed(), 'isFrontPage' => is_front_page(), 'isHome' => is_home(), 'isMonth' => is_month(), 'isPage' => is_page(), 'isPaged' => is_paged(), 'isPreview' => is_preview(), 'isRobots' => is_robots(), 'isSearch' => is_search(), 'isSingle' => is_single(), 'isSingular' => is_singular(), 'isTime' => is_time(), 'isTrackback' => is_trackback(), 'isYear' => is_year(), 'is404' => is_404(), 'postType' => is_singular() ? get_queried_object()->post_type : get_query_var('post_type', null), 'attachmentId' => is_attachment() ? get_queried_object()->ID : null, 'authorId' => is_author() ? get_queried_object()->ID : null, 'categoryId' => is_category() ? get_queried_object()->term_id : null, 'tagId' => is_tag() ? get_queried_object()->term_id : null, 'taxonomy' => is_tax() ? get_queried_object()->taxonomy : null, 'termId' => is_tax() ? get_queried_object()->term_id : null, 'feed' => is_feed() ? get_query_var('feed', null) : null, 'postId' => is_single() ? get_queried_object()->ID : null];
return $query;
}
示例8: filter_query
/**
*
*/
function filter_query()
{
if (is_comment_feed()) {
if (isset($_GET['feed'])) {
// remove possible XSS
$url = esc_url_raw(remove_query_arg('feed', 301));
wp_redirect($url);
exit;
}
set_query_var('feed', '');
// redirect_canonical will do the rest
redirect_canonical();
}
}
示例9: pshb_template_redirect
function pshb_template_redirect() {
if ((is_comment_feed() && !is_singular())
|| (is_feed() && !is_comment_feed() && !is_archive())) {
$hub_urls = pshb_get_pubsub_endpoints();
foreach ($hub_urls as $hub_url) {
header('Link: <'.$hub_url.'>; rel=hub', false);
}
header('Link: <'.( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'].'>; rel=self', false);
}
}
示例10: wp
/**
* HideMyWP::wp()
*
* Disable WP components when permalink is enabled
* @return
*/
function wp()
{
//delete_option('pp_important_messages_last');
/*echo 'last raw:'.get_option('pp_important_messages_last');
echo '<br>last timestap +70';
// strtotime( '+70 hours', strtotime($recent_message_last)
echo strtotime( '+70 hours', strtotime(get_option('pp_important_messages_last')));
echo ' again str:';
echo date('Y-m-d H:i:s', strtotime( '+70 hours', strtotime(get_option('pp_important_messages_last'))));
echo '<p>';
echo current_time('timestamp', 1) < strtotime( '+70 hours', strtotime(get_option('pp_important_messages_last')));*/
if ((is_feed() || is_comment_feed()) && !isset($_GET['feed']) && !$this->opt('feed_enable')) {
$this->block_access();
}
if (is_author() && !isset($_GET['author']) && !isset($_GET['author']) && !$this->opt('author_enable')) {
$this->block_access();
}
if (is_search() && !isset($_GET['s']) && !$this->opt('search_enable')) {
$this->block_access();
}
if (is_paged() && !isset($_GET['paged']) && !$this->opt('paginate_enable')) {
$this->block_access();
}
if (is_page() && !isset($_GET['page_id']) && !isset($_GET['pagename']) && !$this->opt('page_enable')) {
$this->block_access();
}
if (is_single() && !isset($_GET['p']) && !$this->opt('post_enable')) {
$this->block_access();
}
if (is_category() && !isset($_GET['cat']) && !$this->opt('category_enable')) {
$this->block_access();
}
if (is_tag() && !isset($_GET['tag']) && !$this->opt('tag_enable')) {
$this->block_access();
}
if ((is_date() || is_time()) && !isset($_GET['monthnum']) && !isset($_GET['m']) && !isset($_GET['w']) && !isset($_GET['second']) && !isset($_GET['year']) && !isset($_GET['day']) && !isset($_GET['hour']) && !isset($_GET['second']) && !isset($_GET['minute']) && !isset($_GET['calendar']) && $this->opt('disable_archive')) {
$this->block_access();
}
if ((is_tax() || is_post_type_archive() || is_trackback() || is_comments_popup() || is_attachment()) && !isset($_GET['post_type']) && !isset($_GET['taxonamy']) && !isset($_GET['attachment']) && !isset($_GET['attachment_id']) && !isset($_GET['preview']) && $this->opt('disable_other_wp')) {
$this->block_access();
}
if (isset($_SERVER['HTTP_USER_AGENT']) && !is_404() && !is_home() && (stristr($_SERVER['HTTP_USER_AGENT'], 'BuiltWith') || stristr($_SERVER['HTTP_USER_AGENT'], '2ip.ru'))) {
wp_redirect(home_url());
}
if ($this->opt('remove_other_meta')) {
if (function_exists('header_remove')) {
header_remove('X-Powered-By');
} else {
header('X-Powered-By: ');
}
}
}
示例11: is_frontend_request
/**
* Determine whether the current request is for a frontend (i.e. themed) page.
*
* @return boolean [description]
*/
protected function is_frontend_request()
{
global $pagenow;
$is_login = 'wp-login.php' === $pagenow;
// @todo Might want to allow this to run on feeds...
$is_backend = is_feed() || is_robots() || is_trackback() || is_comment_feed() || is_admin() || $is_login;
return !$is_backend;
}
示例12: pre_get_posts
function pre_get_posts($query)
{
$qvars = $query->query_vars;
// detect our exclude pages query and returns to avoid conflicts
// this test should be sufficient
if (isset($qvars['tax_query'][0]['taxonomy']) && $qvars['tax_query'][0]['taxonomy'] == 'language' && isset($qvars['tax_query'][0]['operator'])) {
return;
}
// homepage is requested, let's set the language
// second check not to break wp-signup & wp-activate
if (empty($query->query) && home_url('/') == trailingslashit((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
// find out the language
if ($this->options['hide_default'] && isset($_COOKIE['wordpress_polylang'])) {
$this->curlang = $this->get_language($this->options['default_lang']);
} else {
$this->curlang = $this->get_preferred_language();
}
// sets the language according to browser preference or default language
// we are already on the right page
if ($this->options['default_lang'] == $this->curlang->slug && $this->options['hide_default']) {
if ($this->page_on_front && ($link_id = $this->get_post($this->page_on_front, $this->curlang))) {
$query->set('page_id', $link_id);
} else {
$query->set('lang', $this->curlang->slug);
}
} else {
wp_redirect($this->get_home_url($this->curlang));
exit;
}
}
// redirect the language page to the homepage
if ($this->options['redirect_lang'] && is_tax('language') && count($query->query) == 1 && $this->page_on_front) {
$this->curlang = $this->get_language(get_query_var('lang'));
$query->parse_query('page_id=' . $this->get_post($this->page_on_front, $this->curlang));
return;
}
// sets is_home on translated home page when it displays posts
// is_home must be true on page 2, 3... too
if (!$this->page_on_front && is_tax('language') && (count($query->query) == 1 || is_paged() && count($query->query) == 2)) {
$query->is_home = true;
$query->is_tax = false;
$this->curlang = $this->get_language(get_query_var('lang'));
// sets the language now otherwise it will be too late to filter sticky posts !
}
// sets the language for posts page in case the front page displays a static page
if ($this->page_for_posts) {
// If permalinks are used, WordPress does set and use $query->queried_object_id and sets $query->query_vars['page_id'] to 0
// and does set and use $query->query_vars['page_id'] if permalinks are not used :(
if (isset($qvars['pagename']) && $qvars['pagename'] && isset($query->queried_object_id)) {
$page_id = $query->queried_object_id;
} elseif (isset($qvars['page_id'])) {
$page_id = $qvars['page_id'];
}
if (isset($page_id) && $page_id && $this->get_post($page_id, $this->get_post_language($this->page_for_posts)) == $this->page_for_posts) {
$this->page_for_posts = $page_id;
$this->curlang = $this->get_post_language($page_id);
$query->set('lang', $this->curlang->slug);
$query->is_page = false;
$query->is_home = true;
$query->is_posts_page = true;
$query->is_singular = false;
}
}
// FIXME to generalize as I probably forget things
$is_archive = count($query->query) == 1 && isset($qvars['paged']) && $qvars['paged'] || isset($qvars['m']) && $qvars['m'] || isset($qvars['author']) && $qvars['author'] || isset($qvars['post_type']) && is_post_type_archive() && in_array($qvars['post_type'], $this->post_types);
// sets 404 when the language is not set for archives needing the language in the url
if (!$this->options['hide_default'] && !isset($qvars['lang']) && !$GLOBALS['wp_rewrite']->using_permalinks() && $is_archive) {
$query->set_404();
}
// sets the language in case we hide the default language
if ($this->options['hide_default'] && !isset($qvars['lang']) && ($is_archive || count($query->query) == 1 && isset($qvars['feed']) && $qvars['feed'])) {
$query->set('lang', $this->options['default_lang']);
}
// allow filtering recent posts by the current language
// take care not to break queries for non visible post types such as nav_menu_items, attachments...
if ($query->is_home && $this->curlang && (!isset($qvars['post_type']) || in_array($qvars['post_type'], $this->post_types) || is_array($qvars['post_type']) && array_intersect($qvars['post_type'], $this->post_types))) {
$query->set('lang', $this->curlang->slug);
}
// remove pages query when the language is set unless we do a search
// FIXME is only search broken by this ?
if (isset($qvars['lang']) && $qvars['lang'] && !isset($qvars['post_type']) && !is_search()) {
$query->set('post_type', 'post');
}
// unset the is_archive flag for language pages to prevent loading the archive template
// keep archive flag for comment feed otherwise the language filter does not work
if (isset($qvars['lang']) && $qvars['lang'] && !is_comment_feed() && !is_post_type_archive() && !is_date() && !is_author() && !is_category() && !is_tag() && !is_tax('post_format')) {
$query->is_archive = false;
}
// unset the is_tax flag for authors pages and post types archives
// FIXME Probably I should do this for other cases
if (isset($qvars['lang']) && $qvars['lang'] && (is_author() || is_post_type_archive())) {
$query->is_tax = false;
unset($query->queried_object);
}
// sets a language for theme preview
if (isset($_GET['preview'])) {
$query->set('lang', $this->options['default_lang']);
}
if (PLL_DISPLAY_ALL) {
// add posts with no language set
//.........这里部分代码省略.........
示例13: comment_text
public function comment_text()
{
if (!is_feed() && !is_comment_feed()) {
//Yay, filters.
add_filter('comment_excerpt', array("AECFilters", 'add_edit_links'), '1000');
//Commented out because some ppl add issues with these screwing up their theme
//add_filter('get_comment_date', array(&$this, 'add_date_spans'), '1000');
//add_filter('get_comment_time', array(&$this, 'add_time_spans'), '1000');
add_filter('comment_text', array("AECFilters", 'add_edit_links'), '1000');
//Low priority so other HTML can be added first
add_filter('thesis_comment_text', array("AECFilters", 'add_edit_links'), '1000');
//For Thesis (todo - remove when necessary)
add_filter('get_comment_author_link', array("AECFilters", 'add_author_spans'), '1000');
//Low priority so other HTML can be added first
}
}
示例14: wp
/**
* HideMyWP::wp()
*
* Disable WP components when permalink is enabled
* @return
*/
function wp()
{
if ((is_feed() || is_comment_feed()) && !isset($_GET['feed']) && !$this->opt('feed_enable')) {
$this->block_access();
}
if (is_author() && !isset($_GET['author']) && !isset($_GET['author']) && !$this->opt('author_enable')) {
$this->block_access();
}
if (is_search() && !isset($_GET['s']) && !$this->opt('search_enable')) {
$this->block_access();
}
if (is_paged() && !isset($_GET['paged']) && !$this->opt('paginate_enable')) {
$this->block_access();
}
if (is_page() && !isset($_GET['page_id']) && !isset($_GET['pagename']) && !$this->opt('page_enable')) {
$this->block_access();
}
if (is_single() && !isset($_GET['p']) && !$this->opt('post_enable')) {
$this->block_access();
}
if (is_category() && !isset($_GET['cat']) && !$this->opt('category_enable')) {
$this->block_access();
}
if (is_tag() && !isset($_GET['tag']) && !$this->opt('tag_enable')) {
$this->block_access();
}
if ((is_date() || is_time()) && !isset($_GET['monthnum']) && !isset($_GET['m']) && !isset($_GET['w']) && !isset($_GET['second']) && !isset($_GET['year']) && !isset($_GET['day']) && !isset($_GET['hour']) && !isset($_GET['second']) && !isset($_GET['minute']) && !isset($_GET['calendar']) && $this->opt('disable_archive')) {
$this->block_access();
}
if ((is_tax() || is_post_type_archive() || is_trackback() || is_comments_popup() || is_attachment()) && !isset($_GET['post_type']) && !isset($_GET['taxonamy']) && !isset($_GET['attachment']) && !isset($_GET['attachment_id']) && !isset($_GET['preview']) && $this->opt('disable_other_wp')) {
$this->block_access();
}
if (!is_404() && !is_home() && (stristr($_SERVER['HTTP_USER_AGENT'], 'BuiltWith') || stristr($_SERVER['HTTP_USER_AGENT'], '2ip.ru'))) {
wp_redirect(home_url());
}
}
示例15: setRouter
/**
* Hook into front-end routing.
* Setup the router API to be executed before
* theme default templates.
*/
public function setRouter()
{
if (is_feed() || is_comment_feed()) {
return;
}
try {
$request = $this->container['request'];
$response = $this->container['router']->dispatch($request);
// We only send back the content because, headers are already defined
// by WordPress internals.
$response->sendContent();
} catch (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $exception) {
/*
* Fallback to WordPress templates.
*/
}
}