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

8
/**
9
 * Represents the post type utils.
10
 */
11
class WPSEO_Post_Type {
12

13
        /**
14
         * Returns an array with the accessible post types.
15
         *
16
         * An accessible post type is a post type that is public and isn't set as no-index (robots).
17
         *
18
         * @return array Array with all the accessible post_types.
19
         */
UNCOV
20
        public static function get_accessible_post_types() {
×
UNCOV
21
                return YoastSEO()->helpers->post_type->get_accessible_post_types();
×
22
        }
23

24
        /**
25
         * Returns whether the passed post type is considered accessible.
26
         *
27
         * @param string $post_type The post type to check.
28
         *
29
         * @return bool Whether or not the post type is considered accessible.
30
         */
31
        public static function is_post_type_accessible( $post_type ) {
×
32
                return in_array( $post_type, self::get_accessible_post_types(), true );
×
33
        }
34

35
        /**
36
         * Checks if the request post type is public and indexable.
37
         *
38
         * @param string $post_type_name The name of the post type to lookup.
39
         *
40
         * @return bool True when post type is set to index.
41
         */
UNCOV
42
        public static function is_post_type_indexable( $post_type_name ) {
×
UNCOV
43
                return YoastSEO()->helpers->post_type->is_indexable( $post_type_name );
×
44
        }
45

46
        /**
47
         * Filters the attachment post type from an array with post_types.
48
         *
49
         * @param array $post_types The array to filter the attachment post type from.
50
         *
51
         * @return array The filtered array.
52
         */
UNCOV
53
        public static function filter_attachment_post_type( array $post_types ) {
×
UNCOV
54
                unset( $post_types['attachment'] );
×
55

UNCOV
56
                return $post_types;
×
57
        }
58

59
        /**
60
         * Checks if the post type is enabled in the REST API.
61
         *
62
         * @param string $post_type The post type to check.
63
         *
64
         * @return bool Whether or not the post type is available in the REST API.
65
         */
UNCOV
66
        public static function is_rest_enabled( $post_type ) {
×
UNCOV
67
                $post_type_object = get_post_type_object( $post_type );
×
68

UNCOV
69
                if ( $post_type_object === null ) {
×
UNCOV
70
                        return false;
×
71
                }
72

UNCOV
73
                return $post_type_object->show_in_rest === true;
×
74
        }
75

76
        /**
77
         * Checks if the current post type has an archive.
78
         *
79
         * Context: The has_archive value can be a string or a boolean. In most case it will be a boolean,
80
         * but it can be defined as a string. When it is a string the archive_slug will be overwritten to
81
         * define another endpoint.
82
         *
83
         * @param WP_Post_Type $post_type The post type object.
84
         *
85
         * @return bool True whether the post type has an archive.
86
         */
87
        public static function has_archive( $post_type ) {
×
88
                return YoastSEO()->helpers->post_type->has_archive( $post_type );
×
89
        }
90

91
        /**
92
         * Checks if the Yoast Metabox has been enabled for the post type.
93
         *
94
         * @param string $post_type The post type name.
95
         *
96
         * @return bool True whether the metabox is enabled.
97
         */
98
        public static function has_metabox_enabled( $post_type ) {
×
99
                return WPSEO_Options::get( 'display-metabox-pt-' . $post_type, false );
×
100
        }
101

102
        /* ********************* DEPRECATED METHODS ********************* */
103

104
        /**
105
         * Removes the notification related to the post types which have been made public.
106
         *
107
         * @deprecated 20.10
108
         * @codeCoverageIgnore
109
         *
110
         * @return void
111
         */
112
        public static function remove_post_types_made_public_notification() {
113
                _deprecated_function( __METHOD__, 'Yoast SEO 20.10', 'Content_Type_Visibility_Dismiss_Notifications::dismiss_notifications' );
114
                $notification_center = Yoast_Notification_Center::get();
115
                $notification_center->remove_notification_by_id( 'post-types-made-public' );
116
        }
117

118
        /**
119
         * Removes the notification related to the taxonomies which have been made public.
120
         *
121
         * @deprecated 20.10
122
         * @codeCoverageIgnore
123
         *
124
         * @return void
125
         */
126
        public static function remove_taxonomies_made_public_notification() {
127
                _deprecated_function( __METHOD__, 'Yoast SEO 20.10', 'Content_Type_Visibility_Dismiss_Notifications::dismiss_notifications' );
128
                $notification_center = Yoast_Notification_Center::get();
129
                $notification_center->remove_notification_by_id( 'taxonomies-made-public' );
130
        }
131
}
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