• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 52612d7369b0288e23ed59f15bc91909484d4b2c

23 May 2025 01:34PM UTC coverage: 38.951%. First build
52612d7369b0288e23ed59f15bc91909484d4b2c

Pull #22305

github

web-flow
Merge a08cc820a into adfa0279b
Pull Request #22305: Move ai generator integrations

2176 of 8301 branches covered (26.21%)

Branch coverage included in aggregate %.

0 of 120 new or added lines in 4 files covered. (0.0%)

20139 of 48989 relevant lines covered (41.11%)

4.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/conditionals/ai-editor-conditional.php
1
<?php
2

3
namespace Yoast\WP\SEO\Conditionals;
4

5
use Yoast\WP\SEO\Conditionals\Admin\Post_Conditional;
6
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
7

8
/**
9
 * Conditional that is met when the AI editor integration should be active.
10
 */
11
class AI_Editor_Conditional implements Conditional {
12

13
        /**
14
         * Holds the Post_Conditional.
15
         *
16
         * @var Post_Conditional
17
         */
18
        private $post_conditional;
19

20
        /**
21
         * Holds the Current_Page_Helper.
22
         *
23
         * @var Current_Page_Helper
24
         */
25
        private $current_page_helper;
26

27
        /**
28
         * Constructs Ai_Editor_Conditional.
29
         *
30
         * @param Post_Conditional    $post_conditional    The Post_Conditional.
31
         * @param Current_Page_Helper $current_page_helper The Current_Page_Helper.
32
         */
NEW
33
        public function __construct( Post_Conditional $post_conditional, Current_Page_Helper $current_page_helper ) {
×
NEW
34
                $this->post_conditional    = $post_conditional;
×
NEW
35
                $this->current_page_helper = $current_page_helper;
×
36
        }
37

38
        /**
39
         * Returns `true` when the AI editor integration should be active.
40
         *
41
         * @return bool `true` when the AI editor integration should be active.
42
         */
NEW
43
        public function is_met() {
×
NEW
44
                return $this->post_conditional->is_met() || $this->is_term() || $this->is_elementor_editor();
×
45
        }
46

47
        /**
48
         * Returns `true` when the page is a term page.
49
         *
50
         * @return bool `true` when the page is a term page.
51
         */
NEW
52
        private function is_term() {
×
NEW
53
                return $this->current_page_helper->get_current_admin_page() === 'term.php';
×
54
        }
55

56
        /**
57
         * Returns `true` when the page is the Elementor editor.
58
         *
59
         * @return bool `true` when the page is the Elementor editor.
60
         */
NEW
61
        private function is_elementor_editor() {
×
NEW
62
                if ( $this->current_page_helper->get_current_admin_page() !== 'post.php' ) {
×
NEW
63
                        return false;
×
64
                }
65

66
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
NEW
67
                if ( isset( $_GET['action'] ) && \is_string( $_GET['action'] ) ) {
×
68
                        // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only strictly comparing.
NEW
69
                        if ( \wp_unslash( $_GET['action'] ) === 'elementor' ) {
×
NEW
70
                                return true;
×
71
                        }
72
                }
73

NEW
74
                return false;
×
75
        }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc