As the sun rises and the forest mist clears, and the clouds return and the caves darken, these changes of light and shadow are the morning and evening in the mountains. Wildflowers bloom with their subtle fragrance, fine trees flourish with their dense shade, the wind and frost are pure and clean, and the water recedes to reveal the rocks—these are the four seasons in the mountains. Going out in the morning and returning in the evening, the scenery of the four seasons is different, and the joy is endless.至于负者歌于途,行者休于树,前者呼,后者应,伛偻提携,往来而不绝者,滁人游也。临溪而渔,溪深而鱼肥,酿泉为酒,泉香而酒洌,山肴野蔌,杂然而前陈者,太守宴也。宴酣之乐,非丝非竹,射者中,弈者胜,觥筹交错,起坐而喧哗者,众宾欢也。苍颜白发,颓然乎其间者,太守醉也。
<?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;
}
}