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

8
/**
9
 * Class WPSEO_Import_WooThemes_SEO
10
 *
11
 * Class with functionality to import & clean WooThemes SEO post metadata.
12
 */
13
class WPSEO_Import_WooThemes_SEO extends WPSEO_Plugin_Importer {
14

15
        /**
16
         * The plugin name.
17
         *
18
         * @var string
19
         */
20
        protected $plugin_name = 'WooThemes SEO';
21

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

29
        /**
30
         * Array of meta keys to detect and import.
31
         *
32
         * @var array
33
         */
34
        protected $clone_keys = [
35
                [
36
                        'old_key' => 'seo_description',
37
                        'new_key' => 'metadesc',
38
                ],
39
                [
40
                        'old_key' => 'seo_title',
41
                        'new_key' => 'title',
42
                ],
43
                [
44
                        'old_key' => 'seo_noindex',
45
                        'new_key' => 'meta-robots-noindex',
46
                ],
47
                [
48
                        'old_key' => 'seo_follow',
49
                        'new_key' => 'meta-robots-nofollow',
50
                ],
51
        ];
52

53
        /**
54
         * Holds the meta fields we can delete after import.
55
         *
56
         * @var array
57
         */
58
        protected $cleanup_metas = [
59
                'seo_follow',
60
                'seo_noindex',
61
                'seo_title',
62
                'seo_description',
63
                'seo_keywords',
64
        ];
65

66
        /**
67
         * Holds the options we can delete after import.
68
         *
69
         * @var array
70
         */
71
        protected $cleanup_options = [
72
                'seo_woo_archive_layout',
73
                'seo_woo_single_layout',
74
                'seo_woo_page_layout',
75
                'seo_woo_wp_title',
76
                'seo_woo_meta_single_desc',
77
                'seo_woo_meta_single_key',
78
                'seo_woo_home_layout',
79
        ];
80

81
        /**
82
         * Cleans up the WooThemes SEO settings.
83
         *
84
         * @return bool Cleanup status.
85
         */
UNCOV
86
        protected function cleanup() {
×
UNCOV
87
                $result = $this->cleanup_meta();
×
UNCOV
88
                if ( $result ) {
×
UNCOV
89
                        $this->cleanup_options();
×
90
                }
UNCOV
91
                return $result;
×
92
        }
93

94
        /**
95
         * Removes the Woo Options from the database.
96
         *
97
         * @return void
98
         */
UNCOV
99
        private function cleanup_options() {
×
UNCOV
100
                foreach ( $this->cleanup_options as $option ) {
×
UNCOV
101
                        delete_option( $option );
×
102
                }
103
        }
104

105
        /**
106
         * Removes the post meta fields from the database.
107
         *
108
         * @return bool Cleanup status.
109
         */
UNCOV
110
        private function cleanup_meta() {
×
UNCOV
111
                foreach ( $this->cleanup_metas as $key ) {
×
UNCOV
112
                        $result = $this->cleanup_meta_key( $key );
×
UNCOV
113
                        if ( ! $result ) {
×
114
                                return false;
×
115
                        }
116
                }
UNCOV
117
                return true;
×
118
        }
119

120
        /**
121
         * Removes a single meta field from the postmeta table in the database.
122
         *
123
         * @param string $key The meta_key to delete.
124
         *
125
         * @return bool Cleanup status.
126
         */
UNCOV
127
        private function cleanup_meta_key( $key ) {
×
UNCOV
128
                global $wpdb;
×
129

UNCOV
130
                $wpdb->query(
×
UNCOV
131
                        $wpdb->prepare(
×
UNCOV
132
                                "DELETE FROM {$wpdb->postmeta} WHERE meta_key = %s",
×
UNCOV
133
                                $key
×
UNCOV
134
                        )
×
UNCOV
135
                );
×
UNCOV
136
                return $wpdb->__get( 'result' );
×
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