PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 19.1 All 128 releases
wordpress-seo / admin / class-option-tab.php

class-option-tab.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at admin/class-option-tab.php

113 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin\Options\Tabs
6 */
7
8 /**
9 * Class WPSEO_Option_Tab.
10 */
11 class WPSEO_Option_Tab {
12
13 /**
14 * Name of the tab.
15 *
16 * @var string
17 */
18 private $name;
19
20 /**
21 * Label of the tab.
22 *
23 * @var string
24 */
25 private $label;
26
27 /**
28 * Optional arguments.
29 *
30 * @var array
31 */
32 private $arguments;
33
34 /**
35 * WPSEO_Option_Tab constructor.
36 *
37 * @param string $name Name of the tab.
38 * @param string $label Localized label of the tab.
39 * @param array $arguments Optional arguments.
40 */
41 public function __construct( $name, $label, array $arguments = [] ) {
42 $this->name = sanitize_title( $name );
43 $this->label = $label;
44 $this->arguments = $arguments;
45 }
46
47 /**
48 * Gets the name.
49 *
50 * @return string The name.
51 */
52 public function get_name() {
53 return $this->name;
54 }
55
56 /**
57 * Gets the label.
58 *
59 * @return string The label.
60 */
61 public function get_label() {
62 return $this->label;
63 }
64
65 /**
66 * Retrieves whether the tab needs a save button.
67 *
68 * @return bool True whether the tabs needs a save button.
69 */
70 public function has_save_button() {
71 return (bool) $this->get_argument( 'save_button', true );
72 }
73
74 /**
75 * Retrieves whether the tab hosts beta functionalities.
76 *
77 * @return bool True whether the tab hosts beta functionalities.
78 */
79 public function is_beta() {
80 return (bool) $this->get_argument( 'beta', false );
81 }
82
83 /**
84 * Retrieves whether the tab hosts premium functionalities.
85 *
86 * @return bool True whether the tab hosts premium functionalities.
87 */
88 public function is_premium() {
89 return (bool) $this->get_argument( 'premium', false );
90 }
91
92 /**
93 * Gets the option group.
94 *
95 * @return string The option group.
96 */
97 public function get_opt_group() {
98 return $this->get_argument( 'opt_group' );
99 }
100
101 /**
102 * Retrieves the variable from the supplied arguments.
103 *
104 * @param string $variable Variable to retrieve.
105 * @param string|mixed $default_value Default to use when variable not found.
106 *
107 * @return mixed|string The retrieved variable.
108 */
109 protected function get_argument( $variable, $default_value = '' ) {
110 return array_key_exists( $variable, $this->arguments ) ? $this->arguments[ $variable ] : $default_value;
111 }
112 }
113