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

Yoast / wordpress-seo / d06ecddd1a2dfd570966e4466fc1ee34449e48a4

28 May 2024 08:44AM UTC coverage: 52.735% (+0.1%) from 52.604%
d06ecddd1a2dfd570966e4466fc1ee34449e48a4

Pull #21412

github

web-flow
Merge dff4c17b2 into 1cf35a642
Pull Request #21412: Feature/decouple hidden fields

7359 of 13368 branches covered (55.05%)

Branch coverage included in aggregate %.

63 of 297 new or added lines in 44 files covered. (21.21%)

22 existing lines in 16 files now uncovered.

28302 of 54255 relevant lines covered (52.16%)

41401.53 hits per line

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

85.71
/src/editors/framework/metadata-groups.php
1
<?php
2

3
namespace Yoast\WP\SEO\Editors\Framework;
4

5
use Yoast\WP\SEO\Helpers\Capability_Helper;
6
use Yoast\WP\SEO\Helpers\Options_Helper;
7

8
/**
9
 * Get the groups of metadata for the editor.
10
 *
11
 * @makePublic
12
 */
13
class Metadata_Groups {
14

15
        /**
16
         * The Options_Helper instance.
17
         *
18
         * @var Options_Helper
19
         */
20
        protected $options_helper;
21

22
        /**
23
         * The capability helper.
24
         *
25
         * @var Capability_Helper
26
         */
27
        protected $capability_helper;
28

29
        /**
30
         * Integrations_Action constructor.
31
         *
32
         * @param Options_Helper    $options_helper    The WPSEO options helper.
33
         * @param Capability_Helper $capability_helper The capability helper.
34
         */
NEW
35
        public function __construct( Options_Helper $options_helper, Capability_Helper $capability_helper ) {
×
NEW
36
                $this->options_helper    = $options_helper;
×
NEW
37
                $this->capability_helper = $capability_helper;
×
38
        }
39

40
        /**
41
         * Get list of groups of metadata for a post editor.
42
         *
43
         * @return array<string> List of metadata groups.
44
         */
45
        public function get_post_metadata_groups(): array {
12✔
46
                $groups = [ 'general', 'schema' ];
12✔
47

48
                if ( $this->is_advanced_enabled() ) {
12✔
49
                        $groups[] = 'advanced';
10✔
50
                }
51

52
                if ( $this->is_social_enabled() ) {
12✔
53
                        $groups[] = 'social';
4✔
54
                }
55

56
                return $groups;
12✔
57
        }
58

59
        /**
60
         * Get term metadata groups.
61
         *
62
         * @return array<string> List of metadata groups.
63
         */
64
        public function get_term_metadata_groups(): array {
12✔
65
                $groups = [ 'content' ];
12✔
66

67
                if ( $this->is_advanced_enabled() ) {
12✔
68
                        $groups[] = 'settings';
10✔
69
                }
70

71
                if ( $this->is_social_enabled() ) {
12✔
72
                        $groups[] = 'social';
4✔
73
                }
74

75
                return $groups;
12✔
76
        }
77

78
        /**
79
         * Get is social enabled.
80
         *
81
         * @return bool
82
         */
83
        public function is_social_enabled(): bool {
24✔
84
                return $this->options_helper->get( 'opengraph', false ) || $this->options_helper->get( 'twitter', false );
24✔
85
        }
86

87
        /**
88
         * Get is advanced enabled.
89
         *
90
         * @return bool
91
         */
92
        public function is_advanced_enabled(): bool {
24✔
93
                return $this->capability_helper->current_user_can( 'wpseo_edit_advanced_metadata' ) || $this->options_helper->get( 'disableadvanced_meta' ) === false;
24✔
94
        }
95
}
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