PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 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 All 129 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 18.1, at admin/class-option-tab.php

95 lines 1.8 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 * Gets the option group.
76 *
77 * @return string The option group.
78 */
79 public function get_opt_group() {
80 return $this->get_argument( 'opt_group' );
81 }
82
83 /**
84 * Retrieves the variable from the supplied arguments.
85 *
86 * @param string $variable Variable to retrieve.
87 * @param string|mixed $default_value Default to use when variable not found.
88 *
89 * @return mixed|string The retrieved variable.
90 */
91 protected function get_argument( $variable, $default_value = '' ) {
92 return array_key_exists( $variable, $this->arguments ) ? $this->arguments[ $variable ] : $default_value;
93 }
94 }
95