PluginProbe
Polylang / 3.3
Polylang v3.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 +19 -12 2.83.3 View file →
@@ -16,10 +16,8 @@
16 16 */
17 17 public $options;
18 18
19 19 /**
20 - * Instance of PLL_Model.
21 - *
22 20 * @var PLL_Model
23 21 */
24 22 public $model;
25 23
@@ -47,9 +45,9 @@
47 45 /**
48 46 * Stores the module name.
49 47 * It must be unique.
50 48 *
51 - * @var string
49 + * @var string|null
52 50 */
53 51 public $module;
54 52
55 53 /**
@@ -82,9 +80,9 @@
82 80
83 81 /**
84 82 * Stores html form when provided by a child class.
85 83 *
86 - * @var bool|string
84 + * @var string|false
87 85 */
88 86 protected $form = false;
89 87
90 88 /**
@@ -160,8 +158,10 @@
160 158 /**
161 159 * Activates the module
162 160 *
163 161 * @since 1.8
162 + *
163 + * @return void
164 164 */
165 165 public function activate() {
166 166 if ( ! empty( $this->active_option ) ) {
167 167 $this->options[ $this->active_option ] = true;
@@ -172,8 +172,10 @@
172 172 /**
173 173 * Deactivates the module
174 174 *
175 175 * @since 1.8
176 + *
177 + * @return void
176 178 */
177 179 public function deactivate() {
178 180 if ( ! empty( $this->active_option ) ) {
179 181 $this->options[ $this->active_option ] = false;
@@ -184,8 +186,10 @@
184 186 /**
185 187 * Protected method to display a configuration form
186 188 *
187 189 * @since 1.8
190 + *
191 + * @return void
188 192 */
189 193 protected function form() {
190 194 // Child classes can provide a form
191 195 }
@@ -215,9 +219,9 @@
215 219 *
216 220 * @param array $options Raw options
217 221 * @return array Options
218 222 */
219 - protected function update( $options ) {
223 + protected function update( $options ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
220 224 return array(); // It's responsibility of the child class to decide what is saved
221 225 }
222 226
223 227 /**
@@ -223,8 +227,10 @@
223 227 /**
224 228 * Ajax method to save the options
225 229 *
226 230 * @since 1.8
231 + *
232 + * @return void
227 233 */
228 234 public function save_options() {
229 235 check_ajax_referer( 'pll_options', '_pll_nonce' );
230 236 if ( ! current_user_can( 'manage_options' ) ) {
@@ -244,11 +250,12 @@
244 250 // Refresh rewrite rules in case rewrite, hide_default, post types or taxonomies options have been modified
245 251 // Don't use flush_rewrite_rules as we don't have the right links model and permastruct
246 252 delete_option( 'rewrite_rules' );
247 253
254 +
248 255 ob_start();
249 256
250 - if ( ! get_settings_errors() ) {
257 + if ( empty( get_settings_errors() ) ) {
251 258 // Send update message
252 259 add_settings_error( 'general', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'updated' );
253 260 settings_errors();
254 261 $x = new WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) );
@@ -262,13 +269,13 @@
262 269 }
263 270 }
264 271
265 272 /**
266 - * Get the row actions
273 + * Get the row actions.
267 274 *
268 275 * @since 1.8
269 276 *
270 - * @return array
277 + * @return string[]
271 278 */
272 279 protected function get_actions() {
273 280 $actions = array();
274 281
@@ -287,13 +294,13 @@
287 294 return $actions;
288 295 }
289 296
290 297 /**
291 - * Get the actions links
298 + * Get the actions links.
292 299 *
293 300 * @since 1.8
294 301 *
295 - * @return array
302 + * @return string[] Action links.
296 303 */
297 304 public function get_action_links() {
298 305 return array_intersect_key( $this->action_links, array_flip( $this->get_actions() ) );
299 306 }
@@ -325,13 +332,13 @@
325 332 return '';
326 333 }
327 334
328 335 /**
329 - * Get the buttons
336 + * Get the buttons.
330 337 *
331 338 * @since 1.9
332 339 *
333 - * @return array
340 + * @return string[] An array of html fragment for the buttons.
334 341 */
335 342 public function get_buttons() {
336 343 return $this->buttons;
337 344 }