WPSEO_Import_SEOPressor::get_robot_value()
Gets the robot config by given SEOpressor robots value.
Метод класса: WPSEO_Import_SEOPressor{}
Хуков нет.
Возвращает
Массив
. The robots values in Yoast format.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_robot_value( $seopressor_robots );
- $seopressor_robots(массив) (обязательный)
- The value in SEOpressor that needs to be converted to the Yoast format.
Код WPSEO_Import_SEOPressor::get_robot_value() WPSEO Import SEOPressor::get robot value Yoast 22.3
private function get_robot_value( $seopressor_robots ) { $return = [ 'index' => 2, 'follow' => 0, 'advanced' => '', ]; if ( in_array( 'noindex', $seopressor_robots, true ) ) { $return['index'] = 1; } if ( in_array( 'nofollow', $seopressor_robots, true ) ) { $return['follow'] = 1; } foreach ( [ 'noarchive', 'nosnippet', 'noimageindex' ] as $needle ) { if ( in_array( $needle, $seopressor_robots, true ) ) { $return['advanced'] .= $needle . ','; } } $return['advanced'] = rtrim( $return['advanced'], ',' ); return $return; }