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

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 hits per line

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

0.0
/inc/class-wpseo-statistics.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Internals
6
 */
7

8
/**
9
 * Class that generates interesting statistics about things.
10
 */
11
class WPSEO_Statistics {
12

13
        /**
14
         * Returns the post count for a certain SEO rank.
15
         *
16
         * @todo Merge/DRY this with the logic virtually the same in WPSEO_Metabox::column_sort_orderby().
17
         *
18
         * @param WPSEO_Rank $rank The SEO rank to get the post count for.
19
         *
20
         * @return int
21
         */
UNCOV
22
        public function get_post_count( $rank ) {
×
UNCOV
23
                if ( $rank->get_rank() === WPSEO_Rank::NO_FOCUS ) {
×
24
                        $posts = [
25
                                'meta_query' => [
UNCOV
26
                                        'relation' => 'OR',
×
27
                                        [
UNCOV
28
                                                'key'     => WPSEO_Meta::$meta_prefix . 'focuskw',
×
UNCOV
29
                                                'value'   => 'needs-a-value-anyway',
×
UNCOV
30
                                                'compare' => 'NOT EXISTS',
×
31
                                        ],
32
                                ],
33
                        ];
34
                }
UNCOV
35
                elseif ( $rank->get_rank() === WPSEO_Rank::NO_INDEX ) {
×
36
                        $posts = [
UNCOV
37
                                'meta_key'   => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
×
UNCOV
38
                                'meta_value' => '1',
×
UNCOV
39
                                'compare'    => '=',
×
40
                        ];
41
                }
42
                else {
43
                        $posts = [
UNCOV
44
                                'meta_key'     => WPSEO_Meta::$meta_prefix . 'linkdex',
×
UNCOV
45
                                'meta_value'   => [ $rank->get_starting_score(), $rank->get_end_score() ],
×
UNCOV
46
                                'meta_compare' => 'BETWEEN',
×
UNCOV
47
                                'meta_type'    => 'NUMERIC',
×
48
                        ];
49
                }
50

UNCOV
51
                $posts['fields']      = 'ids';
×
UNCOV
52
                $posts['post_status'] = 'publish';
×
53

UNCOV
54
                if ( current_user_can( 'edit_others_posts' ) === false ) {
×
UNCOV
55
                        $posts['author'] = get_current_user_id();
×
56
                }
57

UNCOV
58
                $posts = new WP_Query( $posts );
×
59

UNCOV
60
                return (int) $posts->found_posts;
×
61
        }
62
}
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