| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/wordpress-seo/inc/indexables/validators/ |
Upload File : |
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Indexables
*/
/**
* Class WPSEO_Robots_Validator.
*/
class WPSEO_Robots_Validator implements WPSEO_Endpoint_Validator {
/**
* The robots keys to validate.
*
* @var array
*/
private $robots_to_validate = array(
'is_robots_nofollow',
'is_robots_noarchive',
'is_robots_noimageindex',
'is_robots_nosnippet',
'is_robots_noindex',
);
/**
* Validates the passed request data.
*
* @param array $request_data The request data to validate.
*
* @return void
*
* @throws WPSEO_Invalid_Argument_Exception Thrown if the robots values are not a boolean type.
*/
public function validate( $request_data ) {
foreach ( $this->robots_to_validate as $item ) {
if ( ! WPSEO_Validator::key_exists( $request_data, $item ) ) {
continue;
}
if ( ! is_null( $request_data[ $item ] ) && ! WPSEO_Validator::is_boolean( $request_data[ $item ] ) ) {
throw WPSEO_Invalid_Argument_Exception::invalid_boolean_parameter( $request_data[ $item ], $item );
}
}
}
}