PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / conditionals / admin / yoast-admin-conditional.php

yoast-admin-conditional.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.5, at src/conditionals/admin/yoast-admin-conditional.php

42 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast admin.
2
3 namespace Yoast\WP\SEO\Conditionals\Admin;
4
5 use Yoast\WP\SEO\Conditionals\Conditional;
6 use Yoast\WP\SEO\Helpers\Current_Page_Helper;
7
8 /**
9 * Conditional that is only met when on a Yoast SEO admin page.
10 */
11 class Yoast_Admin_Conditional implements Conditional {
12
13 /**
14 * Holds the Current_Page_Helper.
15 *
16 * @var Current_Page_Helper
17 */
18 private $current_page_helper;
19
20 /**
21 * Constructs the conditional.
22 *
23 * @param Current_Page_Helper $current_page_helper The current page helper.
24 */
25 public function __construct( Current_Page_Helper $current_page_helper ) {
26 $this->current_page_helper = $current_page_helper;
27 }
28
29 /**
30 * Returns `true` when on the admin dashboard, update or Yoast SEO pages.
31 *
32 * @return bool `true` when on the admin dashboard, update or Yoast SEO pages.
33 */
34 public function is_met() {
35 if ( ! \is_admin() ) {
36 return false;
37 }
38
39 return $this->current_page_helper->is_yoast_seo_page();
40 }
41 }
42