|
Server : LiteSpeed System : Linux srv107862549.host 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 User : malam2778 ( 1069) PHP Version : 8.0.30 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/self/cwd/wp-content/plugins/wordpress-seo/src/conditionals/ |
Upload File : |
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when on the front end or Yoast file editor page.
*/
class Robots_Txt_Conditional implements Conditional {
/**
* Holds the Front_End_Conditional instance.
*
* @var Front_End_Conditional
*/
protected $front_end_conditional;
/**
* Constructs the class.
*
* @param Front_End_Conditional $front_end_conditional The front end conditional.
*/
public function __construct( Front_End_Conditional $front_end_conditional ) {
$this->front_end_conditional = $front_end_conditional;
}
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return $this->front_end_conditional->is_met() || $this->is_file_editor_page();
}
/**
* Returns whether the current page is the file editor page.
*
* This checks for two locations:
* - Multisite network admin file editor page
* - Single site file editor page (under tools)
*
* @return bool
*/
protected function is_file_editor_page() {
global $pagenow;
if ( $pagenow !== 'admin.php' ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_files' && \is_multisite() && \is_network_admin() ) {
return true;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( ! ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_tools' ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['tool'] ) && $_GET['tool'] === 'file-editor' ) {
return true;
}
return false;
}
}