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