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

Yoast / wordpress-seo / 6987097851

25 Nov 2023 04:49AM UTC coverage: 49.206% (-0.1%) from 49.302%
6987097851

push

github

web-flow
Merge pull request #20878 from Yoast/JRF/ghactions-minor-tweak

GH Actions: update a few links in inline comments

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

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

85.71
/src/conditionals/admin/estimated-reading-time-conditional.php
1
<?php
2

3
namespace Yoast\WP\SEO\Conditionals\Admin;
4

5
use Yoast\WP\SEO\Conditionals\Conditional;
6

7
/**
8
 * Conditional that is only when we want the Estimated Reading Time.
9
 */
10
class Estimated_Reading_Time_Conditional implements Conditional {
11

12
        /**
13
         * The Post Conditional.
14
         *
15
         * @var Post_Conditional
16
         */
17
        protected $post_conditional;
18

19
        /**
20
         * Constructs the Estimated Reading Time Conditional.
21
         *
22
         * @param Post_Conditional $post_conditional The post conditional.
23
         */
24
        public function __construct( Post_Conditional $post_conditional ) {
×
25
                $this->post_conditional = $post_conditional;
×
26
        }
27

28
        /**
29
         * Returns whether this conditional is met.
30
         *
31
         * @return bool Whether the conditional is met.
32
         */
33
        public function is_met() {
18✔
34
                // phpcs:disable WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing -- Reason: Nonce verification should not be done in a conditional but rather in the classes using the conditional.
35
                // Check if we are in our Elementor ajax request (for saving).
36
                if ( \wp_doing_ajax() && isset( $_POST['action'] ) && \is_string( $_POST['action'] ) ) {
18✔
37
                        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only strictly comparing the variable.
38
                        $post_action = \wp_unslash( $_POST['action'] );
4✔
39
                        if ( $post_action === 'wpseo_elementor_save' ) {
4✔
40
                                return true;
2✔
41
                        }
42
                }
43

44
                if ( ! $this->post_conditional->is_met() ) {
16✔
45
                        return false;
6✔
46
                }
47

48
                // We don't support Estimated Reading Time on the attachment post type.
49
                if ( isset( $_GET['post'] ) && \is_string( $_GET['post'] ) ) {
10✔
50
                        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are casting to an integer.
51
                        $post_id = (int) \wp_unslash( $_GET['post'] );
6✔
52
                        if ( $post_id !== 0 && \get_post_type( $post_id ) === 'attachment' ) {
6✔
53
                                return false;
2✔
54
                        }
55
                }
56

57
                return true;
8✔
58
                // phpcs:enable WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
59
        }
60
}
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

© 2026 Coveralls, Inc