@@ -85,30 +85,30 @@ |
||
85 | 85 | /** |
86 | 86 | * @since 2.3.0 |
87 | 87 | */ |
88 | - public function __construct( $slug ) { |
|
88 | + public function __construct($slug) { |
|
89 | 89 | |
90 | - if ( $this->meta_type ) { |
|
90 | + if ($this->meta_type) { |
|
91 | 91 | |
92 | - if ( ! $this->wpdb_table_name ) { |
|
92 | + if ( ! $this->wpdb_table_name) { |
|
93 | 93 | $this->wpdb_table_name = $this->meta_type . 'meta'; |
94 | 94 | } |
95 | 95 | |
96 | - if ( ! $this->entity_id_field ) { |
|
96 | + if ( ! $this->entity_id_field) { |
|
97 | 97 | $this->entity_id_field = $this->meta_type . '_id'; |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - parent::__construct( $slug ); |
|
101 | + parent::__construct($slug); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @since 2.3.0 |
106 | 106 | */ |
107 | - protected function get_attr_value_from_entity( WordPoints_Entity $entity ) { |
|
107 | + protected function get_attr_value_from_entity(WordPoints_Entity $entity) { |
|
108 | 108 | |
109 | 109 | $entity_id = $entity->get_the_id(); |
110 | 110 | |
111 | - if ( ! $entity_id ) { |
|
111 | + if ( ! $entity_id) { |
|
112 | 112 | return null; |
113 | 113 | } |
114 | 114 |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | WordPoints_Hook_Event_Args $event_args |
58 | 58 | ) { |
59 | 59 | |
60 | - if ( ! isset( $settings[ $this->slug ] ) ) { |
|
60 | + if ( ! isset($settings[$this->slug])) { |
|
61 | 61 | return $settings; |
62 | 62 | } |
63 | 63 | |
64 | 64 | $this->validator = $validator; |
65 | 65 | $this->event_args = $event_args; |
66 | 66 | |
67 | - $this->validator->push_field( $this->slug ); |
|
67 | + $this->validator->push_field($this->slug); |
|
68 | 68 | |
69 | 69 | $validated_settings = $this->validate_extension_settings( |
70 | - $settings[ $this->slug ] |
|
70 | + $settings[$this->slug] |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | $this->validator->pop_field(); |
74 | 74 | |
75 | - if ( null !== $validated_settings ) { |
|
76 | - $settings[ $this->slug ] = $validated_settings; |
|
75 | + if (null !== $validated_settings) { |
|
76 | + $settings[$this->slug] = $validated_settings; |
|
77 | 77 | } else { |
78 | - unset( $settings[ $this->slug ] ); |
|
78 | + unset($settings[$this->slug]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $settings; |
@@ -95,27 +95,27 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return mixed The validated settings, or null if invalid. |
97 | 97 | */ |
98 | - protected function validate_extension_settings( $settings ) { |
|
98 | + protected function validate_extension_settings($settings) { |
|
99 | 99 | |
100 | - if ( ! is_array( $settings ) ) { |
|
100 | + if ( ! is_array($settings)) { |
|
101 | 101 | |
102 | - $this->validator->add_error( __( 'Invalid settings format.', 'wordpoints' ) ); |
|
102 | + $this->validator->add_error(__('Invalid settings format.', 'wordpoints')); |
|
103 | 103 | |
104 | 104 | return null; |
105 | 105 | } |
106 | 106 | |
107 | - foreach ( $settings as $action_type => $action_type_settings ) { |
|
107 | + foreach ($settings as $action_type => $action_type_settings) { |
|
108 | 108 | |
109 | - $this->validator->push_field( $action_type ); |
|
109 | + $this->validator->push_field($action_type); |
|
110 | 110 | |
111 | 111 | $validated_settings = $this->validate_action_type_settings( |
112 | 112 | $action_type_settings |
113 | 113 | ); |
114 | 114 | |
115 | - if ( null !== $validated_settings ) { |
|
116 | - $settings[ $action_type ] = $validated_settings; |
|
115 | + if (null !== $validated_settings) { |
|
116 | + $settings[$action_type] = $validated_settings; |
|
117 | 117 | } else { |
118 | - unset( $settings[ $action_type ] ); |
|
118 | + unset($settings[$action_type]); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $this->validator->pop_field(); |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * @since 2.1.0 |
129 | 129 | */ |
130 | - public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
|
130 | + public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) { |
|
131 | 131 | |
132 | - if ( isset( $settings[ $this->slug ] ) ) { |
|
133 | - $reaction->update_meta( $this->slug, $settings[ $this->slug ] ); |
|
132 | + if (isset($settings[$this->slug])) { |
|
133 | + $reaction->update_meta($this->slug, $settings[$this->slug]); |
|
134 | 134 | } else { |
135 | - $reaction->delete_meta( $this->slug ); |
|
135 | + $reaction->delete_meta($this->slug); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @return mixed The validated settings, or null if invalid. |
149 | 149 | */ |
150 | - protected function validate_action_type_settings( $settings ) { |
|
150 | + protected function validate_action_type_settings($settings) { |
|
151 | 151 | return $settings; |
152 | 152 | } |
153 | 153 | |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return mixed The settings for the extension, or false if none. |
166 | 166 | */ |
167 | - protected function get_settings_from_fire( WordPoints_Hook_Fire $fire ) { |
|
167 | + protected function get_settings_from_fire(WordPoints_Hook_Fire $fire) { |
|
168 | 168 | |
169 | - $settings = $fire->reaction->get_meta( $this->slug ); |
|
169 | + $settings = $fire->reaction->get_meta($this->slug); |
|
170 | 170 | |
171 | - if ( ! is_array( $settings ) ) { |
|
171 | + if ( ! is_array($settings)) { |
|
172 | 172 | return $settings; |
173 | 173 | } |
174 | 174 | |
175 | - if ( isset( $settings[ $fire->action_type ] ) ) { |
|
176 | - return $settings[ $fire->action_type ]; |
|
175 | + if (isset($settings[$fire->action_type])) { |
|
176 | + return $settings[$fire->action_type]; |
|
177 | 177 | } else { |
178 | 178 | return false; |
179 | 179 | } |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | * @param string $slug The slug of the entity. |
286 | 286 | * @param string $version The current code version of the entity. |
287 | 287 | */ |
288 | - public function __construct( $slug = null, $version = null ) { |
|
288 | + public function __construct($slug = null, $version = null) { |
|
289 | 289 | |
290 | - if ( ! isset( $slug ) ) { |
|
291 | - _doing_it_wrong( __METHOD__, 'The $slug parameter is required.', '2.0.0' ); |
|
290 | + if ( ! isset($slug)) { |
|
291 | + _doing_it_wrong(__METHOD__, 'The $slug parameter is required.', '2.0.0'); |
|
292 | 292 | } |
293 | 293 | |
294 | - if ( ! isset( $version ) ) { |
|
295 | - _doing_it_wrong( __METHOD__, 'The $version parameter is required.', '2.0.0' ); |
|
294 | + if ( ! isset($version)) { |
|
295 | + _doing_it_wrong(__METHOD__, 'The $version parameter is required.', '2.0.0'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | $this->slug = $slug; |
299 | 299 | $this->version = $version; |
300 | 300 | |
301 | - if ( isset( $this->option_prefix ) ) { |
|
302 | - _deprecated_argument( __METHOD__, '2.0.0', 'The $option_prefix property is deprecated.' ); |
|
301 | + if (isset($this->option_prefix)) { |
|
302 | + _deprecated_argument(__METHOD__, '2.0.0', 'The $option_prefix property is deprecated.'); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @param bool $network Whether the install should be network-wide on multisite. |
312 | 312 | */ |
313 | - public function install( $network ) { |
|
313 | + public function install($network) { |
|
314 | 314 | |
315 | 315 | $this->action = 'install'; |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $hooks = wordpoints_hooks(); |
322 | 322 | $hooks_mode = $hooks->get_current_mode(); |
323 | - $hooks->set_current_mode( 'standard' ); |
|
323 | + $hooks->set_current_mode('standard'); |
|
324 | 324 | |
325 | 325 | $this->before_install(); |
326 | 326 | |
@@ -329,38 +329,38 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @since 1.8.0 |
331 | 331 | */ |
332 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
332 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
333 | 333 | |
334 | - if ( is_multisite() ) { |
|
334 | + if (is_multisite()) { |
|
335 | 335 | |
336 | 336 | $this->context = 'network'; |
337 | - $hooks->set_current_mode( 'network' ); |
|
337 | + $hooks->set_current_mode('network'); |
|
338 | 338 | |
339 | 339 | $this->install_network(); |
340 | 340 | |
341 | 341 | $this->context = 'site'; |
342 | - $hooks->set_current_mode( 'standard' ); |
|
342 | + $hooks->set_current_mode('standard'); |
|
343 | 343 | |
344 | - if ( $network ) { |
|
344 | + if ($network) { |
|
345 | 345 | |
346 | 346 | $this->set_network_installed(); |
347 | 347 | |
348 | 348 | $skip_per_site_install = $this->skip_per_site_install(); |
349 | 349 | |
350 | - if ( ! ( $skip_per_site_install & self::SKIP_INSTALL ) ) { |
|
350 | + if ( ! ($skip_per_site_install & self::SKIP_INSTALL)) { |
|
351 | 351 | |
352 | 352 | $ms_switched_state = new WordPoints_Multisite_Switched_State(); |
353 | 353 | $ms_switched_state->backup(); |
354 | 354 | |
355 | - foreach ( $this->get_all_site_ids() as $blog_id ) { |
|
356 | - switch_to_blog( $blog_id ); |
|
355 | + foreach ($this->get_all_site_ids() as $blog_id) { |
|
356 | + switch_to_blog($blog_id); |
|
357 | 357 | $this->install_site(); |
358 | 358 | } |
359 | 359 | |
360 | 360 | $ms_switched_state->restore(); |
361 | 361 | } |
362 | 362 | |
363 | - if ( $skip_per_site_install & self::REQUIRES_MANUAL_INSTALL ) { |
|
363 | + if ($skip_per_site_install & self::REQUIRES_MANUAL_INSTALL) { |
|
364 | 364 | |
365 | 365 | // We'll check this later and let the user know that per-site |
366 | 366 | // install was skipped. |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | } // End if ( is_multisite() ) else. |
382 | 382 | |
383 | - $hooks->set_current_mode( $hooks_mode ); |
|
383 | + $hooks->set_current_mode($hooks_mode); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @param int $site_id The ID of the site to install on. |
392 | 392 | */ |
393 | - public function install_on_site( $site_id ) { |
|
393 | + public function install_on_site($site_id) { |
|
394 | 394 | |
395 | 395 | $this->action = 'install'; |
396 | 396 | $this->network_wide = true; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | $hooks = wordpoints_hooks(); |
401 | 401 | $hooks_mode = $hooks->get_current_mode(); |
402 | - $hooks->set_current_mode( 'standard' ); |
|
402 | + $hooks->set_current_mode('standard'); |
|
403 | 403 | |
404 | 404 | $this->before_install(); |
405 | 405 | |
@@ -408,15 +408,15 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @since 1.8.0 |
410 | 410 | */ |
411 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
411 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
412 | 412 | |
413 | 413 | $this->context = 'site'; |
414 | 414 | |
415 | - switch_to_blog( $site_id ); |
|
415 | + switch_to_blog($site_id); |
|
416 | 416 | $this->install_site(); |
417 | 417 | restore_current_blog(); |
418 | 418 | |
419 | - $hooks->set_current_mode( $hooks_mode ); |
|
419 | + $hooks->set_current_mode($hooks_mode); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
@@ -435,13 +435,13 @@ discard block |
||
435 | 435 | |
436 | 436 | $hooks = wordpoints_hooks(); |
437 | 437 | $hooks_mode = $hooks->get_current_mode(); |
438 | - $hooks->set_current_mode( 'standard' ); |
|
438 | + $hooks->set_current_mode('standard'); |
|
439 | 439 | |
440 | 440 | $this->before_uninstall(); |
441 | 441 | |
442 | - if ( is_multisite() ) { |
|
442 | + if (is_multisite()) { |
|
443 | 443 | |
444 | - if ( $this->do_per_site_uninstall() ) { |
|
444 | + if ($this->do_per_site_uninstall()) { |
|
445 | 445 | |
446 | 446 | $this->context = 'site'; |
447 | 447 | |
@@ -450,22 +450,22 @@ discard block |
||
450 | 450 | |
451 | 451 | $site_ids = $this->get_installed_site_ids(); |
452 | 452 | |
453 | - if ( ! $this->is_network_installed() ) { |
|
454 | - $site_ids = $this->validate_site_ids( $site_ids ); |
|
453 | + if ( ! $this->is_network_installed()) { |
|
454 | + $site_ids = $this->validate_site_ids($site_ids); |
|
455 | 455 | } |
456 | 456 | |
457 | - foreach ( $site_ids as $blog_id ) { |
|
458 | - switch_to_blog( $blog_id ); |
|
457 | + foreach ($site_ids as $blog_id) { |
|
458 | + switch_to_blog($blog_id); |
|
459 | 459 | $this->uninstall_site(); |
460 | 460 | } |
461 | 461 | |
462 | 462 | $ms_switched_state->restore(); |
463 | 463 | |
464 | - unset( $ms_switched_state, $site_ids ); |
|
464 | + unset($ms_switched_state, $site_ids); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | $this->context = 'network'; |
468 | - $hooks->set_current_mode( 'network' ); |
|
468 | + $hooks->set_current_mode('network'); |
|
469 | 469 | |
470 | 470 | $this->uninstall_network(); |
471 | 471 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | // If WordPoints is being uninstalled, the options will already have been |
475 | 475 | // deleted, and calling these methods will actually create them again. |
476 | - if ( 'wordpoints' !== $this->slug ) { |
|
476 | + if ('wordpoints' !== $this->slug) { |
|
477 | 477 | $this->unset_network_installed(); |
478 | 478 | $this->unset_network_install_skipped(); |
479 | 479 | $this->unset_network_update_skipped(); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | |
487 | 487 | } // End if ( is_multisite() ) else. |
488 | 488 | |
489 | - $hooks->set_current_mode( $hooks_mode ); |
|
489 | + $hooks->set_current_mode($hooks_mode); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -499,24 +499,24 @@ discard block |
||
499 | 499 | * @param bool $network Whether the entity is network active. Defaults to the |
500 | 500 | * state of WordPoints itself. |
501 | 501 | */ |
502 | - protected function prepare_to_update( $from, $to, $network ) { |
|
502 | + protected function prepare_to_update($from, $to, $network) { |
|
503 | 503 | |
504 | 504 | $this->action = 'update'; |
505 | 505 | |
506 | - if ( null === $network ) { |
|
506 | + if (null === $network) { |
|
507 | 507 | $network = is_wordpoints_network_active(); |
508 | 508 | } |
509 | 509 | |
510 | 510 | $this->network_wide = $network; |
511 | - $this->updating_from = ( null === $from ) ? $this->get_db_version() : $from; |
|
512 | - $this->updating_to = ( null === $to ) ? $this->version : $to; |
|
511 | + $this->updating_from = (null === $from) ? $this->get_db_version() : $from; |
|
512 | + $this->updating_to = (null === $to) ? $this->version : $to; |
|
513 | 513 | |
514 | 514 | $updates = array(); |
515 | 515 | |
516 | - foreach ( $this->updates as $version => $types ) { |
|
516 | + foreach ($this->updates as $version => $types) { |
|
517 | 517 | |
518 | - if ( version_compare( $from, $version, '<' ) ) { |
|
519 | - $updates[ str_replace( array( '.', '-' ), '_', $version ) ] = $types; |
|
518 | + if (version_compare($from, $version, '<')) { |
|
519 | + $updates[str_replace(array('.', '-'), '_', $version)] = $types; |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | * @param bool $network Whether the entity is network active. Defaults to the |
534 | 534 | * state of WordPoints itself. |
535 | 535 | */ |
536 | - public function update( $from = null, $to = null, $network = null ) { |
|
536 | + public function update($from = null, $to = null, $network = null) { |
|
537 | 537 | |
538 | - $this->prepare_to_update( $from, $to, $network ); |
|
538 | + $this->prepare_to_update($from, $to, $network); |
|
539 | 539 | |
540 | - if ( empty( $this->updates ) ) { |
|
540 | + if (empty($this->updates)) { |
|
541 | 541 | return; |
542 | 542 | } |
543 | 543 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | $hooks = wordpoints_hooks(); |
547 | 547 | $hooks_mode = $hooks->get_current_mode(); |
548 | - $hooks->set_current_mode( 'standard' ); |
|
548 | + $hooks->set_current_mode('standard'); |
|
549 | 549 | |
550 | 550 | $this->before_update(); |
551 | 551 | |
@@ -554,32 +554,32 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @since 1.8.0 |
556 | 556 | */ |
557 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
557 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
558 | 558 | |
559 | - if ( is_multisite() ) { |
|
559 | + if (is_multisite()) { |
|
560 | 560 | |
561 | 561 | $this->context = 'network'; |
562 | - $hooks->set_current_mode( 'network' ); |
|
562 | + $hooks->set_current_mode('network'); |
|
563 | 563 | |
564 | - $this->update_( 'network', $this->get_updates_for( 'network' ) ); |
|
564 | + $this->update_('network', $this->get_updates_for('network')); |
|
565 | 565 | |
566 | 566 | $this->context = 'site'; |
567 | - $hooks->set_current_mode( 'standard' ); |
|
567 | + $hooks->set_current_mode('standard'); |
|
568 | 568 | |
569 | - if ( $this->network_wide ) { |
|
569 | + if ($this->network_wide) { |
|
570 | 570 | |
571 | - $updates = $this->get_updates_for( 'site' ); |
|
571 | + $updates = $this->get_updates_for('site'); |
|
572 | 572 | |
573 | - if ( $updates ) { |
|
573 | + if ($updates) { |
|
574 | 574 | |
575 | - if ( $this->do_per_site_update() ) { |
|
575 | + if ($this->do_per_site_update()) { |
|
576 | 576 | |
577 | 577 | $ms_switched_state = new WordPoints_Multisite_Switched_State(); |
578 | 578 | $ms_switched_state->backup(); |
579 | 579 | |
580 | - foreach ( $this->get_installed_site_ids() as $blog_id ) { |
|
581 | - switch_to_blog( $blog_id ); |
|
582 | - $this->update_( 'site', $updates ); |
|
580 | + foreach ($this->get_installed_site_ids() as $blog_id) { |
|
581 | + switch_to_blog($blog_id); |
|
582 | + $this->update_('site', $updates); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | $ms_switched_state->restore(); |
@@ -594,19 +594,19 @@ discard block |
||
594 | 594 | |
595 | 595 | } else { |
596 | 596 | |
597 | - $this->update_( 'site', $this->get_updates_for( 'site' ) ); |
|
597 | + $this->update_('site', $this->get_updates_for('site')); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | } else { |
601 | 601 | |
602 | 602 | $this->context = 'single'; |
603 | - $this->update_( 'single', $this->get_updates_for( 'single' ) ); |
|
603 | + $this->update_('single', $this->get_updates_for('single')); |
|
604 | 604 | |
605 | 605 | } // End if ( is_multisite() ) else. |
606 | 606 | |
607 | 607 | $this->after_update(); |
608 | 608 | |
609 | - $hooks->set_current_mode( $hooks_mode ); |
|
609 | + $hooks->set_current_mode($hooks_mode); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | // |
@@ -620,10 +620,10 @@ discard block |
||
620 | 620 | */ |
621 | 621 | protected function no_interruptions() { |
622 | 622 | |
623 | - ignore_user_abort( true ); |
|
623 | + ignore_user_abort(true); |
|
624 | 624 | |
625 | - if ( ! wordpoints_is_function_disabled( 'set_time_limit' ) ) { |
|
626 | - set_time_limit( 0 ); |
|
625 | + if ( ! wordpoints_is_function_disabled('set_time_limit')) { |
|
626 | + set_time_limit(0); |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | */ |
639 | 639 | protected function skip_per_site_install() { |
640 | 640 | |
641 | - return ( wp_is_large_network() ) |
|
641 | + return (wp_is_large_network()) |
|
642 | 642 | ? self::SKIP_INSTALL | self::REQUIRES_MANUAL_INSTALL |
643 | 643 | : self::DO_INSTALL; |
644 | 644 | } |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | */ |
674 | 674 | protected function get_all_site_ids() { |
675 | 675 | |
676 | - $site_ids = get_site_transient( 'wordpoints_all_site_ids' ); |
|
676 | + $site_ids = get_site_transient('wordpoints_all_site_ids'); |
|
677 | 677 | |
678 | - if ( ! $site_ids ) { |
|
678 | + if ( ! $site_ids) { |
|
679 | 679 | |
680 | 680 | $site_ids = get_sites( |
681 | 681 | array( |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ) |
686 | 686 | ); |
687 | 687 | |
688 | - set_site_transient( 'wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS ); |
|
688 | + set_site_transient('wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | return $site_ids; |
@@ -699,11 +699,11 @@ discard block |
||
699 | 699 | * @param string $option The name of the option to set. |
700 | 700 | * @param mixed $value The value of the option. |
701 | 701 | */ |
702 | - private function _set_option( $option, $value = true ) { |
|
702 | + private function _set_option($option, $value = true) { |
|
703 | 703 | |
704 | - if ( isset( $this->option_prefix ) ) { |
|
704 | + if (isset($this->option_prefix)) { |
|
705 | 705 | |
706 | - update_site_option( "{$this->option_prefix}{$option}", $value ); |
|
706 | + update_site_option("{$this->option_prefix}{$option}", $value); |
|
707 | 707 | |
708 | 708 | } else { |
709 | 709 | |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | , 'site' |
713 | 713 | ); |
714 | 714 | |
715 | - $data[ $this->type ][ $this->slug ] = $value; |
|
715 | + $data[$this->type][$this->slug] = $value; |
|
716 | 716 | |
717 | - update_site_option( "wordpoints_{$option}", $data ); |
|
717 | + update_site_option("wordpoints_{$option}", $data); |
|
718 | 718 | } |
719 | 719 | } |
720 | 720 | |
@@ -725,11 +725,11 @@ discard block |
||
725 | 725 | * |
726 | 726 | * @param string $option The name of the option to delete. |
727 | 727 | */ |
728 | - private function _unset_option( $option ) { |
|
728 | + private function _unset_option($option) { |
|
729 | 729 | |
730 | - if ( isset( $this->option_prefix ) ) { |
|
730 | + if (isset($this->option_prefix)) { |
|
731 | 731 | |
732 | - delete_site_option( "{$this->option_prefix}{$option}" ); |
|
732 | + delete_site_option("{$this->option_prefix}{$option}"); |
|
733 | 733 | |
734 | 734 | } else { |
735 | 735 | |
@@ -738,9 +738,9 @@ discard block |
||
738 | 738 | , 'site' |
739 | 739 | ); |
740 | 740 | |
741 | - unset( $data[ $this->type ][ $this->slug ] ); |
|
741 | + unset($data[$this->type][$this->slug]); |
|
742 | 742 | |
743 | - update_site_option( "wordpoints_{$option}", $data ); |
|
743 | + update_site_option("wordpoints_{$option}", $data); |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | |
@@ -753,9 +753,9 @@ discard block |
||
753 | 753 | */ |
754 | 754 | protected function is_network_installed() { |
755 | 755 | |
756 | - if ( isset( $this->option_prefix ) ) { |
|
756 | + if (isset($this->option_prefix)) { |
|
757 | 757 | |
758 | - return (bool) get_site_option( "{$this->option_prefix}network_installed" ); |
|
758 | + return (bool) get_site_option("{$this->option_prefix}network_installed"); |
|
759 | 759 | |
760 | 760 | } else { |
761 | 761 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | , 'site' |
765 | 765 | ); |
766 | 766 | |
767 | - return isset( $network_installed[ $this->type ][ $this->slug ] ); |
|
767 | + return isset($network_installed[$this->type][$this->slug]); |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | * @since 2.0.0 |
775 | 775 | */ |
776 | 776 | protected function set_network_installed() { |
777 | - $this->_set_option( 'network_installed' ); |
|
777 | + $this->_set_option('network_installed'); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | * @since 2.0.0 |
784 | 784 | */ |
785 | 785 | protected function unset_network_installed() { |
786 | - $this->_unset_option( 'network_installed' ); |
|
786 | + $this->_unset_option('network_installed'); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * @since 2.0.0 |
793 | 793 | */ |
794 | 794 | protected function set_network_install_skipped() { |
795 | - $this->_set_option( 'network_install_skipped' ); |
|
795 | + $this->_set_option('network_install_skipped'); |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | /** |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * @since 2.0.0 |
802 | 802 | */ |
803 | 803 | protected function unset_network_install_skipped() { |
804 | - $this->_unset_option( 'network_install_skipped' ); |
|
804 | + $this->_unset_option('network_install_skipped'); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @since 2.0.0 |
811 | 811 | */ |
812 | 812 | protected function set_network_update_skipped() { |
813 | - $this->_set_option( 'network_update_skipped', $this->updating_from ); |
|
813 | + $this->_set_option('network_update_skipped', $this->updating_from); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | /** |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | * @since 2.0.0 |
820 | 820 | */ |
821 | 821 | protected function unset_network_update_skipped() { |
822 | - $this->_unset_option( 'network_update_skipped' ); |
|
822 | + $this->_unset_option('network_update_skipped'); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
@@ -833,11 +833,11 @@ discard block |
||
833 | 833 | */ |
834 | 834 | protected function do_per_site_uninstall() { |
835 | 835 | |
836 | - if ( wp_is_large_network() ) { |
|
836 | + if (wp_is_large_network()) { |
|
837 | 837 | |
838 | - if ( $this->is_network_installed() ) { |
|
838 | + if ($this->is_network_installed()) { |
|
839 | 839 | return false; |
840 | - } elseif ( count( $this->get_installed_site_ids() ) > 10000 ) { |
|
840 | + } elseif (count($this->get_installed_site_ids()) > 10000) { |
|
841 | 841 | return false; |
842 | 842 | } |
843 | 843 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | */ |
857 | 857 | protected function do_per_site_update() { |
858 | 858 | |
859 | - if ( $this->is_network_installed() && wp_is_large_network() ) { |
|
859 | + if ($this->is_network_installed() && wp_is_large_network()) { |
|
860 | 860 | return false; |
861 | 861 | } |
862 | 862 | |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | */ |
873 | 873 | private function _get_installed_site_ids_option_name() { |
874 | 874 | |
875 | - if ( isset( $this->option_prefix ) ) { |
|
875 | + if (isset($this->option_prefix)) { |
|
876 | 876 | $option_prefix = $this->option_prefix; |
877 | - } elseif ( 'wordpoints' === $this->slug ) { |
|
877 | + } elseif ('wordpoints' === $this->slug) { |
|
878 | 878 | $option_prefix = 'wordpoints_'; |
879 | - } elseif ( 'component' === $this->type ) { |
|
879 | + } elseif ('component' === $this->type) { |
|
880 | 880 | $option_prefix = "wordpoints_{$this->slug}_"; |
881 | 881 | } else { |
882 | 882 | $option_prefix = "wordpoints_{$this->type}_{$this->slug}_"; |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | */ |
895 | 895 | protected function get_installed_site_ids() { |
896 | 896 | |
897 | - if ( $this->is_network_installed() ) { |
|
897 | + if ($this->is_network_installed()) { |
|
898 | 898 | $sites = $this->get_all_site_ids(); |
899 | 899 | } else { |
900 | 900 | $sites = wordpoints_get_array_option( |
@@ -913,18 +913,18 @@ discard block |
||
913 | 913 | * |
914 | 914 | * @param int $id The ID of the site to add. Defaults to the current site's ID. |
915 | 915 | */ |
916 | - protected function add_installed_site_id( $id = null ) { |
|
916 | + protected function add_installed_site_id($id = null) { |
|
917 | 917 | |
918 | - if ( empty( $id ) ) { |
|
918 | + if (empty($id)) { |
|
919 | 919 | $id = get_current_blog_id(); |
920 | 920 | } |
921 | 921 | |
922 | 922 | $option_name = $this->_get_installed_site_ids_option_name(); |
923 | 923 | |
924 | - $sites = wordpoints_get_array_option( $option_name, 'site' ); |
|
924 | + $sites = wordpoints_get_array_option($option_name, 'site'); |
|
925 | 925 | $sites[] = $id; |
926 | 926 | |
927 | - update_site_option( $option_name, $sites ); |
|
927 | + update_site_option($option_name, $sites); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | /** |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | * @since 2.0.0 |
934 | 934 | */ |
935 | 935 | protected function delete_installed_site_ids() { |
936 | - delete_site_option( $this->_get_installed_site_ids_option_name() ); |
|
936 | + delete_site_option($this->_get_installed_site_ids_option_name()); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | /** |
@@ -945,9 +945,9 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @return array The validated site IDs. |
947 | 947 | */ |
948 | - protected function validate_site_ids( $site_ids ) { |
|
948 | + protected function validate_site_ids($site_ids) { |
|
949 | 949 | |
950 | - if ( empty( $site_ids ) || ! is_array( $site_ids ) ) { |
|
950 | + if (empty($site_ids) || ! is_array($site_ids)) { |
|
951 | 951 | return array(); |
952 | 952 | } |
953 | 953 | |
@@ -976,20 +976,20 @@ discard block |
||
976 | 976 | */ |
977 | 977 | protected function get_db_version() { |
978 | 978 | |
979 | - if ( $this->network_wide ) { |
|
980 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' ); |
|
979 | + if ($this->network_wide) { |
|
980 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site'); |
|
981 | 981 | } else { |
982 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' ); |
|
982 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data'); |
|
983 | 983 | } |
984 | 984 | |
985 | - if ( 'wordpoints' === $this->slug ) { |
|
985 | + if ('wordpoints' === $this->slug) { |
|
986 | 986 | |
987 | - if ( isset( $wordpoints_data['version'] ) ) { |
|
987 | + if (isset($wordpoints_data['version'])) { |
|
988 | 988 | return $wordpoints_data['version']; |
989 | 989 | } |
990 | 990 | |
991 | - } elseif ( isset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] ) ) { |
|
992 | - return $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version']; |
|
991 | + } elseif (isset($wordpoints_data["{$this->type}s"][$this->slug]['version'])) { |
|
992 | + return $wordpoints_data["{$this->type}s"][$this->slug]['version']; |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | return false; |
@@ -1003,28 +1003,28 @@ discard block |
||
1003 | 1003 | * |
1004 | 1004 | * @param string $version The version of the entity. |
1005 | 1005 | */ |
1006 | - protected function set_db_version( $version = null ) { |
|
1006 | + protected function set_db_version($version = null) { |
|
1007 | 1007 | |
1008 | - if ( null === $version ) { |
|
1008 | + if (null === $version) { |
|
1009 | 1009 | $version = $this->version; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | - if ( $this->network_wide ) { |
|
1013 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' ); |
|
1012 | + if ($this->network_wide) { |
|
1013 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site'); |
|
1014 | 1014 | } else { |
1015 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' ); |
|
1015 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data'); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | - if ( 'wordpoints' === $this->slug ) { |
|
1018 | + if ('wordpoints' === $this->slug) { |
|
1019 | 1019 | $wordpoints_data['version'] = $version; |
1020 | 1020 | } else { |
1021 | - $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] = $version; |
|
1021 | + $wordpoints_data["{$this->type}s"][$this->slug]['version'] = $version; |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( $this->network_wide ) { |
|
1025 | - update_site_option( 'wordpoints_data', $wordpoints_data ); |
|
1024 | + if ($this->network_wide) { |
|
1025 | + update_site_option('wordpoints_data', $wordpoints_data); |
|
1026 | 1026 | } else { |
1027 | - update_option( 'wordpoints_data', $wordpoints_data ); |
|
1027 | + update_option('wordpoints_data', $wordpoints_data); |
|
1028 | 1028 | } |
1029 | 1029 | } |
1030 | 1030 | |
@@ -1036,22 +1036,22 @@ discard block |
||
1036 | 1036 | protected function unset_db_version() { |
1037 | 1037 | |
1038 | 1038 | // The whole option will be deleted when WordPoints is uninstalled. |
1039 | - if ( 'wordpoints' === $this->slug ) { |
|
1039 | + if ('wordpoints' === $this->slug) { |
|
1040 | 1040 | return; |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - if ( 'network' === $this->context ) { |
|
1044 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' ); |
|
1043 | + if ('network' === $this->context) { |
|
1044 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site'); |
|
1045 | 1045 | } else { |
1046 | - $wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' ); |
|
1046 | + $wordpoints_data = wordpoints_get_array_option('wordpoints_data'); |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | - unset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ] ); |
|
1049 | + unset($wordpoints_data["{$this->type}s"][$this->slug]); |
|
1050 | 1050 | |
1051 | - if ( 'network' === $this->context ) { |
|
1052 | - update_site_option( 'wordpoints_data', $wordpoints_data ); |
|
1051 | + if ('network' === $this->context) { |
|
1052 | + update_site_option('wordpoints_data', $wordpoints_data); |
|
1053 | 1053 | } else { |
1054 | - update_option( 'wordpoints_data', $wordpoints_data ); |
|
1054 | + update_option('wordpoints_data', $wordpoints_data); |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1066,19 +1066,19 @@ discard block |
||
1066 | 1066 | * @param string $component The component's slug. |
1067 | 1067 | * @param string $version The installed component version. |
1068 | 1068 | */ |
1069 | - protected function set_component_version( $component, $version ) { |
|
1069 | + protected function set_component_version($component, $version) { |
|
1070 | 1070 | |
1071 | - _deprecated_function( __METHOD__, '2.0.0', '::set_db_version()' ); |
|
1071 | + _deprecated_function(__METHOD__, '2.0.0', '::set_db_version()'); |
|
1072 | 1072 | |
1073 | 1073 | $wordpoints_data = wordpoints_get_maybe_network_array_option( |
1074 | 1074 | 'wordpoints_data' |
1075 | 1075 | ); |
1076 | 1076 | |
1077 | - if ( empty( $wordpoints_data['components'][ $component ]['version'] ) ) { |
|
1078 | - $wordpoints_data['components'][ $component ]['version'] = $version; |
|
1077 | + if (empty($wordpoints_data['components'][$component]['version'])) { |
|
1078 | + $wordpoints_data['components'][$component]['version'] = $version; |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | - wordpoints_update_maybe_network_option( 'wordpoints_data', $wordpoints_data ); |
|
1081 | + wordpoints_update_maybe_network_option('wordpoints_data', $wordpoints_data); |
|
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | /** |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | protected function maybe_load_custom_caps() { |
1090 | 1090 | |
1091 | - if ( empty( $this->custom_caps_getter ) ) { |
|
1091 | + if (empty($this->custom_caps_getter)) { |
|
1092 | 1092 | return; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - $this->custom_caps = call_user_func( $this->custom_caps_getter ); |
|
1096 | - $this->custom_caps_keys = array_keys( $this->custom_caps ); |
|
1095 | + $this->custom_caps = call_user_func($this->custom_caps_getter); |
|
1096 | + $this->custom_caps_keys = array_keys($this->custom_caps); |
|
1097 | 1097 | |
1098 | - if ( 'uninstall' === $this->action ) { |
|
1098 | + if ('uninstall' === $this->action) { |
|
1099 | 1099 | $this->uninstall['local']['custom_caps'] = true; |
1100 | 1100 | } |
1101 | 1101 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | * @since 1.8.0 |
1107 | 1107 | */ |
1108 | 1108 | protected function before_install() { |
1109 | - $this->map_shortcuts( 'schema' ); |
|
1109 | + $this->map_shortcuts('schema'); |
|
1110 | 1110 | $this->maybe_load_custom_caps(); |
1111 | 1111 | } |
1112 | 1112 | |
@@ -1117,8 +1117,8 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | protected function install_custom_caps() { |
1119 | 1119 | |
1120 | - if ( ! empty( $this->custom_caps ) ) { |
|
1121 | - wordpoints_add_custom_caps( $this->custom_caps ); |
|
1120 | + if ( ! empty($this->custom_caps)) { |
|
1121 | + wordpoints_add_custom_caps($this->custom_caps); |
|
1122 | 1122 | } |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1131,8 +1131,8 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | $schema = $this->get_db_schema(); |
1133 | 1133 | |
1134 | - if ( ! empty( $schema ) ) { |
|
1135 | - dbDelta( $schema ); |
|
1134 | + if ( ! empty($schema)) { |
|
1135 | + dbDelta($schema); |
|
1136 | 1136 | } |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | */ |
1146 | 1146 | public function get_db_schema() { |
1147 | 1147 | |
1148 | - if ( ! isset( $this->schema[ $this->context ]['tables'] ) ) { |
|
1148 | + if ( ! isset($this->schema[$this->context]['tables'])) { |
|
1149 | 1149 | return ''; |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1155,16 +1155,16 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | $charset_collate = $wpdb->get_charset_collate(); |
1157 | 1157 | |
1158 | - if ( 'site' === $this->context ) { |
|
1158 | + if ('site' === $this->context) { |
|
1159 | 1159 | $prefix = $wpdb->prefix; |
1160 | 1160 | } else { |
1161 | 1161 | $prefix = $wpdb->base_prefix; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - foreach ( $this->schema[ $this->context ]['tables'] as $table_name => $table_schema ) { |
|
1164 | + foreach ($this->schema[$this->context]['tables'] as $table_name => $table_schema) { |
|
1165 | 1165 | |
1166 | - $table_name = str_replace( '`', '``', $table_name ); |
|
1167 | - $table_schema = trim( $table_schema ); |
|
1166 | + $table_name = str_replace('`', '``', $table_name); |
|
1167 | + $table_schema = trim($table_schema); |
|
1168 | 1168 | |
1169 | 1169 | $schema .= "CREATE TABLE {$prefix}{$table_name} ( |
1170 | 1170 | {$table_schema} |
@@ -1184,31 +1184,31 @@ discard block |
||
1184 | 1184 | $this->maybe_load_custom_caps(); |
1185 | 1185 | |
1186 | 1186 | $this->prepare_uninstall_list_tables(); |
1187 | - $this->prepare_uninstall_non_per_site_items( 'meta_boxes' ); |
|
1188 | - $this->map_uninstall_shortcut( 'widgets', 'options', array( 'prefix' => 'widget_' ) ); |
|
1189 | - $this->map_uninstall_shortcut( 'points_hooks', 'options', array( 'prefix' => 'wordpoints_hook-' ) ); |
|
1187 | + $this->prepare_uninstall_non_per_site_items('meta_boxes'); |
|
1188 | + $this->map_uninstall_shortcut('widgets', 'options', array('prefix' => 'widget_')); |
|
1189 | + $this->map_uninstall_shortcut('points_hooks', 'options', array('prefix' => 'wordpoints_hook-')); |
|
1190 | 1190 | |
1191 | 1191 | // Add any tables to uninstall based on the db schema. |
1192 | - foreach ( $this->schema as $context => $schema ) { |
|
1192 | + foreach ($this->schema as $context => $schema) { |
|
1193 | 1193 | |
1194 | - if ( ! isset( $schema['tables'] ) ) { |
|
1194 | + if ( ! isset($schema['tables'])) { |
|
1195 | 1195 | continue; |
1196 | 1196 | } |
1197 | 1197 | |
1198 | - if ( ! isset( $this->uninstall[ $context ]['tables'] ) ) { |
|
1199 | - $this->uninstall[ $context ]['tables'] = array(); |
|
1198 | + if ( ! isset($this->uninstall[$context]['tables'])) { |
|
1199 | + $this->uninstall[$context]['tables'] = array(); |
|
1200 | 1200 | } |
1201 | 1201 | |
1202 | - $this->uninstall[ $context ]['tables'] = array_unique( |
|
1202 | + $this->uninstall[$context]['tables'] = array_unique( |
|
1203 | 1203 | array_merge( |
1204 | - $this->uninstall[ $context ]['tables'] |
|
1205 | - , array_keys( $schema['tables'] ) |
|
1204 | + $this->uninstall[$context]['tables'] |
|
1205 | + , array_keys($schema['tables']) |
|
1206 | 1206 | ) |
1207 | 1207 | ); |
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | // This *must* happen *after* the schema and list tables args are parsed. |
1211 | - $this->map_shortcuts( 'uninstall' ); |
|
1211 | + $this->map_shortcuts('uninstall'); |
|
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | /** |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | */ |
1243 | 1243 | protected function prepare_uninstall_list_tables() { |
1244 | 1244 | |
1245 | - if ( ! isset( $this->uninstall['list_tables'] ) ) { |
|
1245 | + if ( ! isset($this->uninstall['list_tables'])) { |
|
1246 | 1246 | return; |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1253,17 +1253,17 @@ discard block |
||
1253 | 1253 | ); |
1254 | 1254 | |
1255 | 1255 | // Loop through all of the list table screens. |
1256 | - foreach ( $this->uninstall['list_tables'] as $screen_id => $args ) { |
|
1256 | + foreach ($this->uninstall['list_tables'] as $screen_id => $args) { |
|
1257 | 1257 | |
1258 | 1258 | // Back-compat for pre-2.1.0. |
1259 | - if ( isset( $args['parent'] ) && '_page' === substr( $args['parent'], -5 /* _page */ ) ) { |
|
1260 | - $args['parent'] = substr( $args['parent'], 0, -5 ); |
|
1259 | + if (isset($args['parent']) && '_page' === substr($args['parent'], -5 /* _page */)) { |
|
1260 | + $args['parent'] = substr($args['parent'], 0, -5); |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | - $this->uninstall['universal']['list_tables'][ $screen_id ] = $args; |
|
1263 | + $this->uninstall['universal']['list_tables'][$screen_id] = $args; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | - $this->prepare_uninstall_non_per_site_items( 'list_tables' ); |
|
1266 | + $this->prepare_uninstall_non_per_site_items('list_tables'); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | /** |
@@ -1281,22 +1281,22 @@ discard block |
||
1281 | 1281 | * |
1282 | 1282 | * @param string $items_key The key name of the items in the uninstall[*] arrays. |
1283 | 1283 | */ |
1284 | - protected function prepare_uninstall_non_per_site_items( $items_key ) { |
|
1284 | + protected function prepare_uninstall_non_per_site_items($items_key) { |
|
1285 | 1285 | |
1286 | - if ( isset( $this->uninstall['universal'][ $items_key ] ) ) { |
|
1286 | + if (isset($this->uninstall['universal'][$items_key])) { |
|
1287 | 1287 | |
1288 | - $this->uninstall['global'][ $items_key ] |
|
1289 | - = $this->uninstall['universal'][ $items_key ]; |
|
1288 | + $this->uninstall['global'][$items_key] |
|
1289 | + = $this->uninstall['universal'][$items_key]; |
|
1290 | 1290 | |
1291 | - unset( $this->uninstall['universal'][ $items_key ] ); |
|
1291 | + unset($this->uninstall['universal'][$items_key]); |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | - if ( isset( $this->uninstall['site'][ $items_key ] ) ) { |
|
1294 | + if (isset($this->uninstall['site'][$items_key])) { |
|
1295 | 1295 | |
1296 | - $this->uninstall['network'][ $items_key ] |
|
1297 | - = $this->uninstall['site'][ $items_key ]; |
|
1296 | + $this->uninstall['network'][$items_key] |
|
1297 | + = $this->uninstall['site'][$items_key]; |
|
1298 | 1298 | |
1299 | - unset( $this->uninstall['site'][ $items_key ] ); |
|
1299 | + unset($this->uninstall['site'][$items_key]); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1333,20 +1333,20 @@ discard block |
||
1333 | 1333 | * adding to them to the canonical array. |
1334 | 1334 | * } |
1335 | 1335 | */ |
1336 | - protected function map_uninstall_shortcut( $shortcut, $canonical, $args ) { |
|
1336 | + protected function map_uninstall_shortcut($shortcut, $canonical, $args) { |
|
1337 | 1337 | |
1338 | - $args = array_merge( array( 'prefix' => '' ), $args ); |
|
1338 | + $args = array_merge(array('prefix' => ''), $args); |
|
1339 | 1339 | |
1340 | - $types = array( 'single', 'site', 'network', 'local', 'global', 'universal' ); |
|
1340 | + $types = array('single', 'site', 'network', 'local', 'global', 'universal'); |
|
1341 | 1341 | |
1342 | - foreach ( $types as $type ) { |
|
1342 | + foreach ($types as $type) { |
|
1343 | 1343 | |
1344 | - if ( ! isset( $this->uninstall[ $type ][ $shortcut ] ) ) { |
|
1344 | + if ( ! isset($this->uninstall[$type][$shortcut])) { |
|
1345 | 1345 | continue; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | - foreach ( $this->uninstall[ $type ][ $shortcut ] as $slug ) { |
|
1349 | - $this->uninstall[ $type ][ $canonical ][] = $args['prefix'] . $slug; |
|
1348 | + foreach ($this->uninstall[$type][$shortcut] as $slug) { |
|
1349 | + $this->uninstall[$type][$canonical][] = $args['prefix'] . $slug; |
|
1350 | 1350 | } |
1351 | 1351 | } |
1352 | 1352 | } |
@@ -1366,28 +1366,28 @@ discard block |
||
1366 | 1366 | * |
1367 | 1367 | * @param string $type The type of shortcuts to map. Corresponds to a member var. |
1368 | 1368 | */ |
1369 | - protected function map_shortcuts( $type ) { |
|
1369 | + protected function map_shortcuts($type) { |
|
1370 | 1370 | |
1371 | 1371 | // shortcut => canonicals |
1372 | 1372 | $map = array( |
1373 | - 'local' => array( 'single', 'site', /* - */ ), |
|
1374 | - 'global' => array( 'single', /* - */ 'network' ), |
|
1375 | - 'universal' => array( 'single', 'site', 'network' ), |
|
1373 | + 'local' => array('single', 'site', /* - */), |
|
1374 | + 'global' => array('single', /* - */ 'network'), |
|
1375 | + 'universal' => array('single', 'site', 'network'), |
|
1376 | 1376 | ); |
1377 | 1377 | |
1378 | 1378 | $this->$type = array_merge( |
1379 | 1379 | array_fill_keys( |
1380 | - array( 'single', 'site', 'network', 'local', 'global', 'universal' ) |
|
1380 | + array('single', 'site', 'network', 'local', 'global', 'universal') |
|
1381 | 1381 | , array() |
1382 | 1382 | ) |
1383 | 1383 | , $this->$type |
1384 | 1384 | ); |
1385 | 1385 | |
1386 | - foreach ( $map as $shortcut => $canonicals ) { |
|
1387 | - foreach ( $canonicals as $canonical ) { |
|
1388 | - $this->{$type}[ $canonical ] = array_merge_recursive( |
|
1389 | - $this->{$type}[ $canonical ] |
|
1390 | - , $this->{$type}[ $shortcut ] |
|
1386 | + foreach ($map as $shortcut => $canonicals) { |
|
1387 | + foreach ($canonicals as $canonical) { |
|
1388 | + $this->{$type}[$canonical] = array_merge_recursive( |
|
1389 | + $this->{$type}[$canonical] |
|
1390 | + , $this->{$type}[$shortcut] |
|
1391 | 1391 | ); |
1392 | 1392 | } |
1393 | 1393 | } |
@@ -1418,9 +1418,9 @@ discard block |
||
1418 | 1418 | * |
1419 | 1419 | * @return array The versions that request this type of update. |
1420 | 1420 | */ |
1421 | - protected function get_updates_for( $type ) { |
|
1421 | + protected function get_updates_for($type) { |
|
1422 | 1422 | |
1423 | - return array_keys( wp_list_filter( $this->updates, array( $type => true ) ) ); |
|
1423 | + return array_keys(wp_list_filter($this->updates, array($type => true))); |
|
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | /** |
@@ -1431,9 +1431,9 @@ discard block |
||
1431 | 1431 | * @param string $type The type of update to run. |
1432 | 1432 | * @param array $versions The versions to run this type of update for. |
1433 | 1433 | */ |
1434 | - protected function update_( $type, $versions ) { |
|
1434 | + protected function update_($type, $versions) { |
|
1435 | 1435 | |
1436 | - foreach ( $versions as $version ) { |
|
1436 | + foreach ($versions as $version) { |
|
1437 | 1437 | $this->{"update_{$type}_to_{$version}"}(); |
1438 | 1438 | } |
1439 | 1439 | } |
@@ -1445,22 +1445,22 @@ discard block |
||
1445 | 1445 | * |
1446 | 1446 | * @param string $type The type of tables to update. |
1447 | 1447 | */ |
1448 | - protected function maybe_update_tables_to_utf8mb4( $type ) { |
|
1448 | + protected function maybe_update_tables_to_utf8mb4($type) { |
|
1449 | 1449 | |
1450 | 1450 | global $wpdb; |
1451 | 1451 | |
1452 | - if ( 'utf8mb4' !== $wpdb->charset ) { |
|
1452 | + if ('utf8mb4' !== $wpdb->charset) { |
|
1453 | 1453 | return; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - if ( 'global' === $type || 'network' === $type ) { |
|
1456 | + if ('global' === $type || 'network' === $type) { |
|
1457 | 1457 | $prefix = $wpdb->base_prefix; |
1458 | 1458 | } else { |
1459 | 1459 | $prefix = $wpdb->prefix; |
1460 | 1460 | } |
1461 | 1461 | |
1462 | - foreach ( $this->schema[ $type ]['tables'] as $table_name => $schema ) { |
|
1463 | - maybe_convert_table_to_utf8mb4( $prefix . $table_name ); |
|
1462 | + foreach ($this->schema[$type]['tables'] as $table_name => $schema) { |
|
1463 | + maybe_convert_table_to_utf8mb4($prefix . $table_name); |
|
1464 | 1464 | } |
1465 | 1465 | } |
1466 | 1466 | |
@@ -1471,9 +1471,9 @@ discard block |
||
1471 | 1471 | * |
1472 | 1472 | * @param string $type The type of uninstallation to perform. |
1473 | 1473 | */ |
1474 | - protected function uninstall_( $type ) { |
|
1474 | + protected function uninstall_($type) { |
|
1475 | 1475 | |
1476 | - if ( empty( $this->uninstall[ $type ] ) ) { |
|
1476 | + if (empty($this->uninstall[$type])) { |
|
1477 | 1477 | return; |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1486,35 +1486,35 @@ discard block |
||
1486 | 1486 | 'meta_boxes' => array(), |
1487 | 1487 | 'list_tables' => array(), |
1488 | 1488 | ) |
1489 | - , $this->uninstall[ $type ] |
|
1489 | + , $this->uninstall[$type] |
|
1490 | 1490 | ); |
1491 | 1491 | |
1492 | - if ( ! empty( $uninstall['custom_caps'] ) ) { |
|
1493 | - $this->uninstall_custom_caps( $this->custom_caps_keys ); |
|
1492 | + if ( ! empty($uninstall['custom_caps'])) { |
|
1493 | + $this->uninstall_custom_caps($this->custom_caps_keys); |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | - foreach ( $uninstall['user_meta'] as $meta_key ) { |
|
1497 | - $this->uninstall_metadata( 'user', $meta_key ); |
|
1496 | + foreach ($uninstall['user_meta'] as $meta_key) { |
|
1497 | + $this->uninstall_metadata('user', $meta_key); |
|
1498 | 1498 | } |
1499 | 1499 | |
1500 | - foreach ( $uninstall['options'] as $option ) { |
|
1501 | - $this->uninstall_option( $option ); |
|
1500 | + foreach ($uninstall['options'] as $option) { |
|
1501 | + $this->uninstall_option($option); |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | - foreach ( $uninstall['tables'] as $table ) { |
|
1505 | - $this->uninstall_table( $table ); |
|
1504 | + foreach ($uninstall['tables'] as $table) { |
|
1505 | + $this->uninstall_table($table); |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | - foreach ( $uninstall['comment_meta'] as $meta_key ) { |
|
1509 | - $this->uninstall_metadata( 'comment', $meta_key ); |
|
1508 | + foreach ($uninstall['comment_meta'] as $meta_key) { |
|
1509 | + $this->uninstall_metadata('comment', $meta_key); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | - foreach ( $uninstall['meta_boxes'] as $screen_id => $args ) { |
|
1513 | - $this->uninstall_meta_boxes( $screen_id, $args ); |
|
1512 | + foreach ($uninstall['meta_boxes'] as $screen_id => $args) { |
|
1513 | + $this->uninstall_meta_boxes($screen_id, $args); |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | - foreach ( $uninstall['list_tables'] as $screen_id => $args ) { |
|
1517 | - $this->uninstall_list_table( $screen_id, $args ); |
|
1516 | + foreach ($uninstall['list_tables'] as $screen_id => $args) { |
|
1517 | + $this->uninstall_list_table($screen_id, $args); |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | |
@@ -1525,9 +1525,9 @@ discard block |
||
1525 | 1525 | * |
1526 | 1526 | * @param string[] $caps The capabilities to uninstall. |
1527 | 1527 | */ |
1528 | - protected function uninstall_custom_caps( $caps ) { |
|
1528 | + protected function uninstall_custom_caps($caps) { |
|
1529 | 1529 | |
1530 | - wordpoints_remove_custom_caps( $caps ); |
|
1530 | + wordpoints_remove_custom_caps($caps); |
|
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | /** |
@@ -1538,17 +1538,17 @@ discard block |
||
1538 | 1538 | * @param string $type The type of metadata to uninstall, e.g., 'user', 'post'. |
1539 | 1539 | * @param string $key The metadata key to delete. |
1540 | 1540 | */ |
1541 | - protected function uninstall_metadata( $type, $key ) { |
|
1541 | + protected function uninstall_metadata($type, $key) { |
|
1542 | 1542 | |
1543 | - if ( 'user' === $type && 'site' === $this->context ) { |
|
1543 | + if ('user' === $type && 'site' === $this->context) { |
|
1544 | 1544 | $key = $GLOBALS['wpdb']->get_blog_prefix() . $key; |
1545 | 1545 | } |
1546 | 1546 | |
1547 | - if ( false !== strpos( $key, '%' ) ) { |
|
1547 | + if (false !== strpos($key, '%')) { |
|
1548 | 1548 | |
1549 | 1549 | global $wpdb; |
1550 | 1550 | |
1551 | - $table = wordpoints_escape_mysql_identifier( _get_meta_table( $type ) ); |
|
1551 | + $table = wordpoints_escape_mysql_identifier(_get_meta_table($type)); |
|
1552 | 1552 | |
1553 | 1553 | $keys = $wpdb->get_col( // WPCS: unprepared SQL OK. |
1554 | 1554 | $wpdb->prepare( // WPCS: unprepared SQL OK. |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | ); // WPCS: cache pass. |
1563 | 1563 | |
1564 | 1564 | } else { |
1565 | - $keys = array( $key ); |
|
1565 | + $keys = array($key); |
|
1566 | 1566 | } |
1567 | 1567 | |
1568 | - foreach ( $keys as $key ) { |
|
1569 | - delete_metadata( $type, 0, wp_slash( $key ), '', true ); |
|
1568 | + foreach ($keys as $key) { |
|
1569 | + delete_metadata($type, 0, wp_slash($key), '', true); |
|
1570 | 1570 | } |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1600,25 +1600,25 @@ discard block |
||
1600 | 1600 | * 'meta-box-order'. |
1601 | 1601 | * } |
1602 | 1602 | */ |
1603 | - protected function uninstall_meta_boxes( $screen_id, $args ) { |
|
1603 | + protected function uninstall_meta_boxes($screen_id, $args) { |
|
1604 | 1604 | |
1605 | 1605 | $defaults = array( |
1606 | 1606 | 'parent' => 'wordpoints', |
1607 | - 'options' => array( 'closedpostboxes', 'metaboxhidden', 'meta-box-order' ), |
|
1607 | + 'options' => array('closedpostboxes', 'metaboxhidden', 'meta-box-order'), |
|
1608 | 1608 | ); |
1609 | 1609 | |
1610 | - $args = array_merge( $defaults, $args ); |
|
1611 | - $args['options'] = array_merge( $defaults['options'], $args['options'] ); |
|
1610 | + $args = array_merge($defaults, $args); |
|
1611 | + $args['options'] = array_merge($defaults['options'], $args['options']); |
|
1612 | 1612 | |
1613 | 1613 | // Each user gets to set the options to their liking. |
1614 | - foreach ( $args['options'] as $option ) { |
|
1614 | + foreach ($args['options'] as $option) { |
|
1615 | 1615 | |
1616 | 1616 | $this->uninstall_metadata( |
1617 | 1617 | 'user' |
1618 | 1618 | , "{$option}_{$args['parent']}_page_{$screen_id}" |
1619 | 1619 | ); |
1620 | 1620 | |
1621 | - if ( 'network' === $this->context ) { |
|
1621 | + if ('network' === $this->context) { |
|
1622 | 1622 | $this->uninstall_metadata( |
1623 | 1623 | 'user' |
1624 | 1624 | , "{$option}_{$args['parent']}_page_{$screen_id}-network" |
@@ -1659,21 +1659,21 @@ discard block |
||
1659 | 1659 | * 'per_page'. |
1660 | 1660 | * } |
1661 | 1661 | */ |
1662 | - protected function uninstall_list_table( $screen_id, $args ) { |
|
1662 | + protected function uninstall_list_table($screen_id, $args) { |
|
1663 | 1663 | |
1664 | 1664 | $defaults = array( |
1665 | 1665 | 'parent' => 'wordpoints', |
1666 | - 'options' => array( 'per_page' ), |
|
1666 | + 'options' => array('per_page'), |
|
1667 | 1667 | ); |
1668 | 1668 | |
1669 | - $args = array_merge( $defaults, $args ); |
|
1669 | + $args = array_merge($defaults, $args); |
|
1670 | 1670 | |
1671 | 1671 | $network_parent = $args['parent']; |
1672 | 1672 | $parent = $network_parent; |
1673 | 1673 | |
1674 | 1674 | // The parent page is usually the same on a multisite site, but we need to |
1675 | 1675 | // handle the special case of the modules screen. |
1676 | - if ( 'wordpoints_modules' === $screen_id && is_multisite() ) { |
|
1676 | + if ('wordpoints_modules' === $screen_id && is_multisite()) { |
|
1677 | 1677 | $parent = 'toplevel'; |
1678 | 1678 | } |
1679 | 1679 | |
@@ -1682,23 +1682,23 @@ discard block |
||
1682 | 1682 | // Each user can hide specific columns of the table. |
1683 | 1683 | $meta_keys[] = "manage{$parent}_page_{$screen_id}columnshidden"; |
1684 | 1684 | |
1685 | - if ( 'network' === $this->context ) { |
|
1685 | + if ('network' === $this->context) { |
|
1686 | 1686 | $meta_keys[] = "manage{$network_parent}_page_{$screen_id}-networkcolumnshidden"; |
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | // Loop through each of the other options provided by this list table. |
1690 | - foreach ( $args['options'] as $option ) { |
|
1690 | + foreach ($args['options'] as $option) { |
|
1691 | 1691 | |
1692 | 1692 | // Each user gets to set the options to their liking. |
1693 | 1693 | $meta_keys[] = "{$parent}_page_{$screen_id}_{$option}"; |
1694 | 1694 | |
1695 | - if ( 'network' === $this->context ) { |
|
1695 | + if ('network' === $this->context) { |
|
1696 | 1696 | $meta_keys[] = "{$network_parent}_page_{$screen_id}_network_{$option}"; |
1697 | 1697 | } |
1698 | 1698 | } |
1699 | 1699 | |
1700 | - foreach ( $meta_keys as $meta_key ) { |
|
1701 | - $this->uninstall_metadata( 'user', $meta_key ); |
|
1700 | + foreach ($meta_keys as $meta_key) { |
|
1701 | + $this->uninstall_metadata('user', $meta_key); |
|
1702 | 1702 | } |
1703 | 1703 | } |
1704 | 1704 | |
@@ -1713,14 +1713,14 @@ discard block |
||
1713 | 1713 | * |
1714 | 1714 | * @param string $option The option to uninstall. |
1715 | 1715 | */ |
1716 | - protected function uninstall_option( $option ) { |
|
1716 | + protected function uninstall_option($option) { |
|
1717 | 1717 | |
1718 | - if ( 'network' === $this->context ) { |
|
1719 | - $this->uninstall_network_option( $option ); |
|
1718 | + if ('network' === $this->context) { |
|
1719 | + $this->uninstall_network_option($option); |
|
1720 | 1720 | return; |
1721 | 1721 | } |
1722 | 1722 | |
1723 | - if ( false !== strpos( $option, '%' ) ) { |
|
1723 | + if (false !== strpos($option, '%')) { |
|
1724 | 1724 | |
1725 | 1725 | global $wpdb; |
1726 | 1726 | |
@@ -1736,10 +1736,10 @@ discard block |
||
1736 | 1736 | ); // WPCS: cache pass. |
1737 | 1737 | |
1738 | 1738 | } else { |
1739 | - $options = array( $option ); |
|
1739 | + $options = array($option); |
|
1740 | 1740 | } |
1741 | 1741 | |
1742 | - array_map( 'delete_option', $options ); |
|
1742 | + array_map('delete_option', $options); |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | /** |
@@ -1751,9 +1751,9 @@ discard block |
||
1751 | 1751 | * |
1752 | 1752 | * @param string $option The network option to uninstall. |
1753 | 1753 | */ |
1754 | - protected function uninstall_network_option( $option ) { |
|
1754 | + protected function uninstall_network_option($option) { |
|
1755 | 1755 | |
1756 | - if ( false !== strpos( $option, '%' ) ) { |
|
1756 | + if (false !== strpos($option, '%')) { |
|
1757 | 1757 | |
1758 | 1758 | global $wpdb; |
1759 | 1759 | |
@@ -1771,10 +1771,10 @@ discard block |
||
1771 | 1771 | ); // WPCS: cache pass. |
1772 | 1772 | |
1773 | 1773 | } else { |
1774 | - $options = array( $option ); |
|
1774 | + $options = array($option); |
|
1775 | 1775 | } |
1776 | 1776 | |
1777 | - array_map( 'delete_site_option', $options ); |
|
1777 | + array_map('delete_site_option', $options); |
|
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | /** |
@@ -1784,9 +1784,9 @@ discard block |
||
1784 | 1784 | * |
1785 | 1785 | * @param string $id_base The base ID of the widget to uninstall (class name). |
1786 | 1786 | */ |
1787 | - protected function uninstall_widget( $id_base ) { |
|
1787 | + protected function uninstall_widget($id_base) { |
|
1788 | 1788 | |
1789 | - $this->uninstall_option( "widget_{$id_base}" ); |
|
1789 | + $this->uninstall_option("widget_{$id_base}"); |
|
1790 | 1790 | } |
1791 | 1791 | |
1792 | 1792 | /** |
@@ -1796,9 +1796,9 @@ discard block |
||
1796 | 1796 | * |
1797 | 1797 | * @param string $id_base The base ID (class) of the points hook to uninstall. |
1798 | 1798 | */ |
1799 | - protected function uninstall_points_hook( $id_base ) { |
|
1799 | + protected function uninstall_points_hook($id_base) { |
|
1800 | 1800 | |
1801 | - $this->uninstall_option( "wordpoints_hook-{$id_base}" ); |
|
1801 | + $this->uninstall_option("wordpoints_hook-{$id_base}"); |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | /** |
@@ -1808,20 +1808,20 @@ discard block |
||
1808 | 1808 | * |
1809 | 1809 | * @param string $table The name of the table to uninstall, sans DB prefix. |
1810 | 1810 | */ |
1811 | - protected function uninstall_table( $table ) { |
|
1811 | + protected function uninstall_table($table) { |
|
1812 | 1812 | |
1813 | 1813 | global $wpdb; |
1814 | 1814 | |
1815 | 1815 | // Null will use the current blog's prefix, 0 the base prefix. |
1816 | - if ( 'site' === $this->context ) { |
|
1816 | + if ('site' === $this->context) { |
|
1817 | 1817 | $site_id = null; |
1818 | 1818 | } else { |
1819 | 1819 | $site_id = 0; |
1820 | 1820 | } |
1821 | 1821 | |
1822 | - $table = str_replace( '`', '``', $table ); |
|
1822 | + $table = str_replace('`', '``', $table); |
|
1823 | 1823 | |
1824 | - $wpdb->query( 'DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix( $site_id ) . $table . '`' ); // WPCS: unprepared SQL, cache pass. |
|
1824 | + $wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix($site_id) . $table . '`'); // WPCS: unprepared SQL, cache pass. |
|
1825 | 1825 | } |
1826 | 1826 | |
1827 | 1827 | // |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | |
1842 | 1842 | $this->install_db_schema(); |
1843 | 1843 | |
1844 | - if ( $this->network_wide ) { |
|
1844 | + if ($this->network_wide) { |
|
1845 | 1845 | $this->set_db_version(); |
1846 | 1846 | } |
1847 | 1847 | } |
@@ -1857,11 +1857,11 @@ discard block |
||
1857 | 1857 | */ |
1858 | 1858 | protected function install_site() { |
1859 | 1859 | |
1860 | - if ( isset( $this->schema['site'] ) ) { |
|
1860 | + if (isset($this->schema['site'])) { |
|
1861 | 1861 | $this->install_db_schema(); |
1862 | 1862 | } |
1863 | 1863 | |
1864 | - if ( ! $this->network_wide ) { |
|
1864 | + if ( ! $this->network_wide) { |
|
1865 | 1865 | $this->set_db_version(); |
1866 | 1866 | } |
1867 | 1867 | |
@@ -1891,10 +1891,10 @@ discard block |
||
1891 | 1891 | */ |
1892 | 1892 | protected function load_base_dependencies() { |
1893 | 1893 | |
1894 | - require_once dirname( __FILE__ ) . '/../../../includes/constants.php'; |
|
1894 | + require_once dirname(__FILE__) . '/../../../includes/constants.php'; |
|
1895 | 1895 | require_once WORDPOINTS_DIR . '/classes/class/autoloader.php'; |
1896 | 1896 | |
1897 | - WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . '/classes' ); |
|
1897 | + WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . '/classes'); |
|
1898 | 1898 | |
1899 | 1899 | require_once WORDPOINTS_DIR . '/includes/functions.php'; |
1900 | 1900 | require_once WORDPOINTS_DIR . '/includes/apps.php'; |
@@ -1921,8 +1921,8 @@ discard block |
||
1921 | 1921 | */ |
1922 | 1922 | protected function uninstall_network() { |
1923 | 1923 | |
1924 | - if ( ! empty( $this->uninstall['network'] ) ) { |
|
1925 | - $this->uninstall_( 'network' ); |
|
1924 | + if ( ! empty($this->uninstall['network'])) { |
|
1925 | + $this->uninstall_('network'); |
|
1926 | 1926 | } |
1927 | 1927 | |
1928 | 1928 | $this->unset_db_version(); |
@@ -1939,8 +1939,8 @@ discard block |
||
1939 | 1939 | */ |
1940 | 1940 | protected function uninstall_site() { |
1941 | 1941 | |
1942 | - if ( ! empty( $this->uninstall['site'] ) ) { |
|
1943 | - $this->uninstall_( 'site' ); |
|
1942 | + if ( ! empty($this->uninstall['site'])) { |
|
1943 | + $this->uninstall_('site'); |
|
1944 | 1944 | } |
1945 | 1945 | |
1946 | 1946 | $this->unset_db_version(); |
@@ -1957,8 +1957,8 @@ discard block |
||
1957 | 1957 | */ |
1958 | 1958 | protected function uninstall_single() { |
1959 | 1959 | |
1960 | - if ( ! empty( $this->uninstall['single'] ) ) { |
|
1961 | - $this->uninstall_( 'single' ); |
|
1960 | + if ( ! empty($this->uninstall['single'])) { |
|
1961 | + $this->uninstall_('single'); |
|
1962 | 1962 | } |
1963 | 1963 | |
1964 | 1964 | $this->unset_db_version(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 1.2.0 |
52 | 52 | */ |
53 | -include_once dirname( __FILE__ ) . '/includes/constants.php'; |
|
53 | +include_once dirname(__FILE__) . '/includes/constants.php'; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Core functions. |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 2.1.0 |
99 | 99 | */ |
100 | -require_once( WORDPOINTS_DIR . 'classes/class/autoloader.php' ); |
|
100 | +require_once(WORDPOINTS_DIR . 'classes/class/autoloader.php'); |
|
101 | 101 | |
102 | 102 | // Register the classes to autoload. |
103 | -WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'classes' ); |
|
103 | +WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'classes'); |
|
104 | 104 | |
105 | 105 | // Set up the components class. |
106 | 106 | WordPoints_Components::set_up(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | include_once WORDPOINTS_DIR . 'includes/deprecated.php'; |
121 | 121 | |
122 | -if ( is_admin() ) { |
|
122 | +if (is_admin()) { |
|
123 | 123 | |
124 | 124 | // We are on the administration side of the site. |
125 | 125 |