File Editor
Directories:
.. (Back)
open-graph
schema
twitter
Files:
aioseo-helper.php
asset-helper.php
attachment-cleanup-helper.php
author-archive-helper.php
blocks-helper.php
capability-helper.php
crawl-cleanup-helper.php
curl-helper.php
current-page-helper.php
date-helper.php
environment-helper.php
first-time-configuration-notice-helper.php
home-url-helper.php
image-helper.php
import-cursor-helper.php
import-helper.php
indexable-helper.php
indexable-to-postmeta-helper.php
indexing-helper.php
language-helper.php
meta-helper.php
notification-helper.php
options-helper.php
pagination-helper.php
permalink-helper.php
post-helper.php
post-type-helper.php
primary-term-helper.php
product-helper.php
redirect-helper.php
require-file-helper.php
robots-helper.php
robots-txt-helper.php
sanitization-helper.php
score-icon-helper.php
short-link-helper.php
site-helper.php
social-profiles-helper.php
string-helper.php
taxonomy-helper.php
url-helper.php
user-helper.php
wincher-helper.php
woocommerce-helper.php
wordpress-helper.php
wpdb-helper.php
Create New File
Create
Edit File: robots-helper.php
<?php namespace Yoast\WP\SEO\Helpers; use Yoast\WP\SEO\Models\Indexable; /** * A helper object for the robots meta tag. */ class Robots_Helper { /** * Holds the Post_Type_Helper. * * @var Post_Type_Helper */ protected $post_type_helper; /** * Holds the Taxonomy_Helper. * * @var Taxonomy_Helper */ protected $taxonomy_helper; /** * Constructs a Score_Helper. * * @param Post_Type_Helper $post_type_helper The Post_Type_Helper. * @param Taxonomy_Helper $taxonomy_helper The Taxonomy_Helper. */ public function __construct( Post_Type_Helper $post_type_helper, Taxonomy_Helper $taxonomy_helper ) { $this->post_type_helper = $post_type_helper; $this->taxonomy_helper = $taxonomy_helper; } /** * Retrieves whether the Indexable is indexable. * * @param Indexable $indexable The Indexable. * * @return bool Whether the Indexable is indexable. */ public function is_indexable( Indexable $indexable ) { if ( $indexable->is_robots_noindex === null ) { // No individual value set, check the global setting. switch ( $indexable->object_type ) { case 'post': return $this->post_type_helper->is_indexable( $indexable->object_sub_type ); case 'term': return $this->taxonomy_helper->is_indexable( $indexable->object_sub_type ); } } return $indexable->is_robots_noindex === false; } /** * Sets the robots index to noindex. * * @param array $robots The current robots value. * * @return array The altered robots string. */ public function set_robots_no_index( $robots ) { if ( ! \is_array( $robots ) ) { \_deprecated_argument( __METHOD__, '14.1', '$robots has to be a key-value paired array.' ); return $robots; } $robots['index'] = 'noindex'; return $robots; } }
Save Changes
Rename File
Rename