• 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
/admin/import/plugins/class-import-platinum-seo-pack.php
1
<?php
2
/**
3
 * File with the class to handle data from Platinum SEO Pack.
4
 *
5
 * @package WPSEO\Admin\Import\Plugins
6
 */
7

8
/**
9
 * Class with functionality to import & clean Ultimate SEO post metadata.
10
 */
11
class WPSEO_Import_Platinum_SEO extends WPSEO_Plugin_Importer {
12

13
        /**
14
         * The plugin name.
15
         *
16
         * @var string
17
         */
18
        protected $plugin_name = 'Platinum SEO Pack';
19

20
        /**
21
         * Meta key, used in SQL LIKE clause for delete query.
22
         *
23
         * @var string
24
         */
25
        protected $meta_key = 'title';
26

27
        /**
28
         * Array of meta keys to detect and import.
29
         *
30
         * @var array
31
         */
32
        protected $clone_keys = [
33
                [
34
                        'old_key' => 'description',
35
                        'new_key' => 'metadesc',
36
                ],
37
                [
38
                        'old_key' => 'title',
39
                        'new_key' => 'title',
40
                ],
41
        ];
42

43
        /**
44
         * Runs the import of post meta keys stored by Platinum SEO Pack.
45
         *
46
         * @return bool
47
         */
UNCOV
48
        protected function import() {
×
UNCOV
49
                $return = parent::import();
×
UNCOV
50
                if ( $return ) {
×
UNCOV
51
                        $this->import_robots_meta();
×
52
                }
53

UNCOV
54
                return $return;
×
55
        }
56

57
        /**
58
         * Cleans up all the meta values Platinum SEO pack creates.
59
         *
60
         * @return bool
61
         */
UNCOV
62
        protected function cleanup() {
×
UNCOV
63
                $this->meta_key = 'title';
×
UNCOV
64
                parent::cleanup();
×
65

UNCOV
66
                $this->meta_key = 'description';
×
UNCOV
67
                parent::cleanup();
×
68

UNCOV
69
                $this->meta_key = 'metarobots';
×
UNCOV
70
                parent::cleanup();
×
71

UNCOV
72
                return true;
×
73
        }
74

75
        /**
76
         * Finds all the robotsmeta fields to import and deals with them.
77
         *
78
         * There are four potential values that Platinum SEO stores:
79
         * - index,folllow
80
         * - index,nofollow
81
         * - noindex,follow
82
         * - noindex,nofollow
83
         *
84
         * We only have to deal with the latter 3, the first is our default.
85
         *
86
         * @return void
87
         */
UNCOV
88
        protected function import_robots_meta() {
×
UNCOV
89
                $this->import_by_meta_robots( 'index,nofollow', [ 'nofollow' ] );
×
UNCOV
90
                $this->import_by_meta_robots( 'noindex,follow', [ 'noindex' ] );
×
UNCOV
91
                $this->import_by_meta_robots( 'noindex,nofollow', [ 'noindex', 'nofollow' ] );
×
92
        }
93

94
        /**
95
         * Imports the values for all index, nofollow posts.
96
         *
97
         * @param string $value The meta robots value to find posts for.
98
         * @param array  $metas The meta field(s) to save.
99
         *
100
         * @return void
101
         */
UNCOV
102
        protected function import_by_meta_robots( $value, $metas ) {
×
UNCOV
103
                $posts = $this->find_posts_by_robots_meta( $value );
×
UNCOV
104
                if ( ! $posts ) {
×
UNCOV
105
                        return;
×
106
                }
107

UNCOV
108
                foreach ( $posts as $post_id ) {
×
UNCOV
109
                        foreach ( $metas as $meta ) {
×
UNCOV
110
                                $this->maybe_save_post_meta( 'meta-robots-' . $meta, 1, $post_id );
×
111
                        }
112
                }
113
        }
114

115
        /**
116
         * Finds posts by a given meta robots value.
117
         *
118
         * @param string $meta_value Robots meta value.
119
         *
120
         * @return array|bool Array of Post IDs on success, false on failure.
121
         */
UNCOV
122
        protected function find_posts_by_robots_meta( $meta_value ) {
×
UNCOV
123
                $posts = get_posts(
×
UNCOV
124
                        [
×
UNCOV
125
                                'post_type'  => 'any',
×
UNCOV
126
                                'meta_key'   => 'robotsmeta',
×
UNCOV
127
                                'meta_value' => $meta_value,
×
UNCOV
128
                                'order'      => 'ASC',
×
UNCOV
129
                                'fields'     => 'ids',
×
UNCOV
130
                                'nopaging'   => true,
×
UNCOV
131
                        ]
×
UNCOV
132
                );
×
UNCOV
133
                if ( empty( $posts ) ) {
×
UNCOV
134
                        return false;
×
135
                }
UNCOV
136
                return $posts;
×
137
        }
138
}
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