• 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-aioseo.php
1
<?php
2
/**
3
 * File with the class to handle data from All in One SEO Pack, versions 3 and under.
4
 *
5
 * @package WPSEO\Admin\Import\Plugins
6
 */
7

8
/**
9
 * Class with functionality to import & clean All in One SEO Pack post metadata, versions 3 and under.
10
 */
11
class WPSEO_Import_AIOSEO extends WPSEO_Plugin_Importer {
12

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

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

27
        /**
28
         * OpenGraph keys to import.
29
         *
30
         * @var array
31
         */
32
        protected $import_keys = [
33
                'aioseop_opengraph_settings_title'             => 'opengraph-title',
34
                'aioseop_opengraph_settings_desc'              => 'opengraph-description',
35
                'aioseop_opengraph_settings_customimg'         => 'opengraph-image',
36
                'aioseop_opengraph_settings_customimg_twitter' => 'twitter-image',
37
        ];
38

39
        /**
40
         * Array of meta keys to detect and import.
41
         *
42
         * @var array
43
         */
44
        protected $clone_keys = [
45
                [
46
                        'old_key' => '_aioseop_title',
47
                        'new_key' => 'title',
48
                ],
49
                [
50
                        'old_key' => '_aioseop_description',
51
                        'new_key' => 'metadesc',
52
                ],
53
                [
54
                        'old_key' => '_aioseop_noindex',
55
                        'new_key' => 'meta-robots-noindex',
56
                        'convert' => [ 'on' => 1 ],
57
                ],
58
                [
59
                        'old_key' => '_aioseop_nofollow',
60
                        'new_key' => 'meta-robots-nofollow',
61
                        'convert' => [ 'on' => 1 ],
62
                ],
63
        ];
64

65
        /**
66
         * Import All In One SEO meta values.
67
         *
68
         * @return bool Import success status.
69
         */
UNCOV
70
        protected function import() {
×
UNCOV
71
                $status = parent::import();
×
UNCOV
72
                if ( $status ) {
×
UNCOV
73
                        $this->import_opengraph();
×
74
                }
UNCOV
75
                return $status;
×
76
        }
77

78
        /**
79
         * Imports the OpenGraph and Twitter settings for all posts.
80
         *
81
         * @return bool
82
         */
UNCOV
83
        protected function import_opengraph() {
×
UNCOV
84
                $query_posts = new WP_Query( 'post_type=any&meta_key=_aioseop_opengraph_settings&order=ASC&fields=ids&nopaging=true' );
×
85

UNCOV
86
                if ( ! empty( $query_posts->posts ) ) {
×
UNCOV
87
                        foreach ( array_values( $query_posts->posts ) as $post_id ) {
×
UNCOV
88
                                $this->import_post_opengraph( $post_id );
×
89
                        }
90
                }
91

UNCOV
92
                return true;
×
93
        }
94

95
        /**
96
         * Imports the OpenGraph and Twitter settings for a single post.
97
         *
98
         * @param int $post_id Post ID.
99
         *
100
         * @return void
101
         */
UNCOV
102
        private function import_post_opengraph( $post_id ) {
×
UNCOV
103
                $meta = get_post_meta( $post_id, '_aioseop_opengraph_settings', true );
×
UNCOV
104
                $meta = maybe_unserialize( $meta );
×
105

UNCOV
106
                foreach ( $this->import_keys as $old_key => $new_key ) {
×
UNCOV
107
                        $this->maybe_save_post_meta( $new_key, $meta[ $old_key ], $post_id );
×
108
                }
109
        }
110
}
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