• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 6987097851

25 Nov 2023 04:49AM UTC coverage: 49.206% (-0.1%) from 49.302%
6987097851

push

github

web-flow
Merge pull request #20878 from Yoast/JRF/ghactions-minor-tweak

GH Actions: update a few links in inline comments

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/presenters/admin/meta-fields-presenter.php
1
<?php
2

3
namespace Yoast\WP\SEO\Presenters\Admin;
4

5
use WP_Post;
6
use WPSEO_Meta;
7
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
8

9
/**
10
 * Presenter class for meta fields in the post editor.
11
 *
12
 * Outputs the hidden fields for a particular field group and post.
13
 */
14
class Meta_Fields_Presenter extends Abstract_Presenter {
15

16
        /**
17
         * The meta fields for which we are going to output hidden input.
18
         *
19
         * @var array
20
         */
21
        private $meta_fields;
22

23
        /**
24
         * The metabox post.
25
         *
26
         * @var WP_Post The metabox post.
27
         */
28
        private $post;
29

30
        /**
31
         * Meta_Fields_Presenter constructor.
32
         *
33
         * @param WP_Post $post        The metabox post.
34
         * @param string  $field_group The key under which a group of fields is grouped.
35
         * @param string  $post_type   The post type.
36
         */
37
        public function __construct( $post, $field_group, $post_type = 'post' ) {
×
38
                $this->post        = $post;
×
39
                $this->meta_fields = WPSEO_Meta::get_meta_field_defs( $field_group, $post_type );
×
40
        }
41

42
        /**
43
         * Presents the Meta Fields.
44
         *
45
         * @return string The styled Alert.
46
         */
47
        public function present() {
×
48
                $output = '';
×
49

50
                foreach ( $this->meta_fields as $key => $meta_field ) {
×
51
                        $form_key   = \esc_attr( WPSEO_Meta::$form_prefix . $key );
×
52
                        $meta_value = WPSEO_Meta::get_value( $key, $this->post->ID );
×
53

54
                        $default = '';
×
55
                        if ( isset( $meta_field['default'] ) ) {
×
56
                                $default = \sprintf( ' data-default="%s"', \esc_attr( $meta_field['default'] ) );
×
57
                        }
58

59
                        $output .= '<input type="hidden" id="' . $form_key . '" name="' . $form_key . '" value="' . \esc_attr( $meta_value ) . '"' . $default . '/>' . "\n";
×
60
                }
61

62
                return $output;
×
63
        }
64
}
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

© 2026 Coveralls, Inc