PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | settings/settings-module.php +10 -92 3.02.7.3 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Base class for all settings
8 5 *
@@ -8,85 +5,14 @@
8 5 *
9 6 * @since 1.8
10 7 */
11 8 class PLL_Settings_Module {
12 - /**
13 - * Stores the plugin options.
14 - *
15 - * @var array
16 - */
9 + public $active_option, $configure;
10 + public $module, $title, $description;
17 11 public $options;
12 + protected $action_links, $buttons, $form = false;
18 13
19 14 /**
20 - * @var PLL_Model
21 - */
22 - public $model;
23 -
24 - /**
25 - * Instance of a child class of PLL_Links_Model.
26 - *
27 - * @var PLL_Links_Model
28 - */
29 - public $links_model;
30 -
31 - /**
32 - * Stores if the module is active.
33 - *
34 - * @var bool
35 - */
36 - public $active_option;
37 -
38 - /**
39 - * Stores the display order priority.
40 - *
41 - * @var int
42 - */
43 - public $priority = 100;
44 -
45 - /**
46 - * Stores the module name.
47 - * It must be unique.
48 - *
49 - * @var string
50 - */
51 - public $module;
52 -
53 - /**
54 - * Stores the module title.
55 - *
56 - * @var string
57 - */
58 - public $title;
59 -
60 - /**
61 - * Stores the module description.
62 - *
63 - * @var string
64 - */
65 - public $description;
66 -
67 - /**
68 - * Stores the settings actions.
69 - *
70 - * @var array
71 - */
72 - protected $action_links;
73 -
74 - /**
75 - * Stores html fragment for the buttons.
76 - *
77 - * @var array
78 - */
79 - protected $buttons;
80 -
81 - /**
82 - * Stores html form when provided by a child class.
83 - *
84 - * @var bool|string
85 - */
86 - protected $form = false;
87 -
88 - /**
89 15 * Constructor
90 16 *
91 17 * @since 1.8
92 18 *
@@ -158,10 +84,8 @@
158 84 /**
159 85 * Activates the module
160 86 *
161 87 * @since 1.8
162 - *
163 - * @return void
164 88 */
165 89 public function activate() {
166 90 if ( ! empty( $this->active_option ) ) {
167 91 $this->options[ $this->active_option ] = true;
@@ -172,10 +96,8 @@
172 96 /**
173 97 * Deactivates the module
174 98 *
175 99 * @since 1.8
176 - *
177 - * @return void
178 100 */
179 101 public function deactivate() {
180 102 if ( ! empty( $this->active_option ) ) {
181 103 $this->options[ $this->active_option ] = false;
@@ -186,10 +108,8 @@
186 108 /**
187 109 * Protected method to display a configuration form
188 110 *
189 111 * @since 1.8
190 - *
191 - * @return void
192 112 */
193 113 protected function form() {
194 114 // Child classes can provide a form
195 115 }
@@ -219,9 +139,9 @@
219 139 *
220 140 * @param array $options Raw options
221 141 * @return array Options
222 142 */
223 - protected function update( $options ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
143 + protected function update( $options ) {
224 144 return array(); // It's responsibility of the child class to decide what is saved
225 145 }
226 146
227 147 /**
@@ -227,10 +147,8 @@
227 147 /**
228 148 * Ajax method to save the options
229 149 *
230 150 * @since 1.8
231 - *
232 - * @return void
233 151 */
234 152 public function save_options() {
235 153 check_ajax_referer( 'pll_options', '_pll_nonce' );
236 154 if ( ! current_user_can( 'manage_options' ) ) {
@@ -268,13 +186,13 @@
268 186 }
269 187 }
270 188
271 189 /**
272 - * Get the row actions.
190 + * Get the row actions
273 191 *
274 192 * @since 1.8
275 193 *
276 - * @return string[]
194 + * @return array
277 195 */
278 196 protected function get_actions() {
279 197 $actions = array();
280 198
@@ -293,13 +211,13 @@
293 211 return $actions;
294 212 }
295 213
296 214 /**
297 - * Get the actions links.
215 + * Get the actions links
298 216 *
299 217 * @since 1.8
300 218 *
301 - * @return string[] Action links.
219 + * @return array
302 220 */
303 221 public function get_action_links() {
304 222 return array_intersect_key( $this->action_links, array_flip( $this->get_actions() ) );
305 223 }
@@ -331,13 +249,13 @@
331 249 return '';
332 250 }
333 251
334 252 /**
335 - * Get the buttons.
253 + * Get the buttons
336 254 *
337 255 * @since 1.9
338 256 *
339 - * @return string[] An array of html fragment for the buttons.
257 + * @return array
340 258 */
341 259 public function get_buttons() {
342 260 return $this->buttons;
343 261 }