• 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-custom-fields.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO
6
 */
7

8
/**
9
 * WPSEO_Custom_Fields.
10
 */
11
class WPSEO_Custom_Fields {
12

13
        /**
14
         * Custom fields cache.
15
         *
16
         * @var array
17
         */
18
        protected static $custom_fields = null;
19

20
        /**
21
         * Retrieves the custom field names as an array.
22
         *
23
         * @link WordPress core: wp-admin/includes/template.php. Reused query from it.
24
         *
25
         * @return array The custom fields.
26
         */
27
        public static function get_custom_fields() {
×
28
                global $wpdb;
×
29

30
                // Use cached value if available.
31
                if ( ! is_null( self::$custom_fields ) ) {
×
32
                        return self::$custom_fields;
×
33
                }
34

35
                self::$custom_fields = [];
×
36

37
                /**
38
                 * Filters the number of custom fields to retrieve for the drop-down
39
                 * in the Custom Fields meta box.
40
                 *
41
                 * @param int $limit Number of custom fields to retrieve. Default 30.
42
                 */
43
                $limit  = apply_filters( 'postmeta_form_limit', 30 );
×
UNCOV
44
                $sql    = "SELECT DISTINCT meta_key
×
45
                        FROM $wpdb->postmeta
×
46
                        WHERE meta_key NOT BETWEEN '_' AND '_z' AND SUBSTRING(meta_key, 1, 1) != '_'
UNCOV
47
                        LIMIT %d";
×
48
                $fields = $wpdb->get_col( $wpdb->prepare( $sql, $limit ) );
×
49

50
                /**
51
                 * Filters the custom fields that are auto-completed and replaced as replacement variables
52
                 * in the meta box and sidebar.
53
                 *
54
                 * @param string[] $fields The custom field names.
55
                 */
56
                $fields = apply_filters( 'wpseo_replacement_variables_custom_fields', $fields );
×
57

58
                if ( is_array( $fields ) ) {
×
59
                        self::$custom_fields = array_map( [ 'WPSEO_Custom_Fields', 'add_custom_field_prefix' ], $fields );
×
60
                }
61

62
                return self::$custom_fields;
×
63
        }
64

65
        /**
66
         * Adds the cf_ prefix to a field.
67
         *
68
         * @param string $field The field to prefix.
69
         *
70
         * @return string The prefixed field.
71
         */
72
        private static function add_custom_field_prefix( $field ) {
×
73
                return 'cf_' . $field;
×
74
        }
75
}
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