Completed
Push — master ( 2ed533...7d69b4 )
by Michael
16:09 queued 03:39
created
admin/includes/class-tgm-plugin-activation.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 		 *
1946 1946
 		 * @since 2.4.0
1947 1947
 		 *
1948
-		 * @return object The TGM_Plugin_Activation object.
1948
+		 * @return TGM_Plugin_Activation The TGM_Plugin_Activation object.
1949 1949
 		 */
1950 1950
 		public static function get_instance() {
1951 1951
 
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
 		 *
2093 2093
 		 * @since 2.5.0
2094 2094
 		 *
2095
-		 * @return array CSS classnames.
2095
+		 * @return string[] CSS classnames.
2096 2096
 		 */
2097 2097
 		public function get_table_classes() {
2098 2098
 			return array( 'widefat', 'fixed' );
Please login to merge, or discard this patch.
Spacing   +701 added lines, -701 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
44 44
 */
45 45
 
46
-if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
46
+if (!class_exists('TGM_Plugin_Activation')) {
47 47
 
48 48
 	/**
49 49
 	 * Automatic plugin installation and activation library.
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 			$this->wp_version = $GLOBALS['wp_version'];
268 268
 
269 269
 			// Announce that the class is ready, and pass the object (for advanced use).
270
-			do_action_ref_array( 'tgmpa_init', array( $this ) );
270
+			do_action_ref_array('tgmpa_init', array($this));
271 271
 
272 272
 			// When the rest of WP has loaded, kick-start the rest of the class.
273
-			add_action( 'init', array( $this, 'init' ) );
273
+			add_action('init', array($this, 'init'));
274 274
 
275 275
 		}
276 276
 
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
 			 * @param bool $load Whether or not TGMPA should load.
297 297
 			 *                   Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`.
298 298
 			 */
299
-			if ( true !== apply_filters( 'tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) {
299
+			if (true !== apply_filters('tgmpa_load', (is_admin() && !defined('DOING_AJAX')))) {
300 300
 				return;
301 301
 			}
302 302
 
303 303
 			// Load class strings.
304 304
 			$this->strings = array(
305
-				'page_title'                      => __( 'Install Required Plugins', 'tgmpa' ),
306
-				'menu_title'                      => __( 'Install Plugins', 'tgmpa' ),
307
-				'installing'                      => __( 'Installing Plugin: %s', 'tgmpa' ),
308
-				'oops'                            => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
305
+				'page_title'                      => __('Install Required Plugins', 'tgmpa'),
306
+				'menu_title'                      => __('Install Plugins', 'tgmpa'),
307
+				'installing'                      => __('Installing Plugin: %s', 'tgmpa'),
308
+				'oops'                            => __('Something went wrong with the plugin API.', 'tgmpa'),
309 309
 				'notice_can_install_required'     => _n_noop(
310 310
 					'This theme requires the following plugin: %1$s.',
311 311
 					'This theme requires the following plugins: %1$s.',
@@ -367,63 +367,63 @@  discard block
 block discarded – undo
367 367
 					'tgmpa'
368 368
 				),
369 369
 
370
-				'return'                          => __( 'Return to Required Plugins Installer', 'tgmpa' ),
371
-				'dashboard'                       => __( 'Return to the dashboard', 'tgmpa' ),
372
-				'plugin_activated'                => __( 'Plugin activated successfully.', 'tgmpa' ),
373
-				'activated_successfully'          => __( 'The following plugin was activated successfully:', 'tgmpa' ),
374
-				'plugin_already_active'           => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ),
375
-				'plugin_needs_higher_version'     => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa' ),
376
-				'complete'                        => __( 'All plugins installed and activated successfully. %1$s', 'tgmpa' ),
377
-				'dismiss'                         => __( 'Dismiss this notice', 'tgmpa' ),
378
-				'contact_admin'                   => __( 'Please contact the administrator of this site for help.', 'tgmpa' ),
370
+				'return'                          => __('Return to Required Plugins Installer', 'tgmpa'),
371
+				'dashboard'                       => __('Return to the dashboard', 'tgmpa'),
372
+				'plugin_activated'                => __('Plugin activated successfully.', 'tgmpa'),
373
+				'activated_successfully'          => __('The following plugin was activated successfully:', 'tgmpa'),
374
+				'plugin_already_active'           => __('No action taken. Plugin %1$s was already active.', 'tgmpa'),
375
+				'plugin_needs_higher_version'     => __('Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa'),
376
+				'complete'                        => __('All plugins installed and activated successfully. %1$s', 'tgmpa'),
377
+				'dismiss'                         => __('Dismiss this notice', 'tgmpa'),
378
+				'contact_admin'                   => __('Please contact the administrator of this site for help.', 'tgmpa'),
379 379
 			);
380 380
 
381
-			do_action( 'tgmpa_register' );
381
+			do_action('tgmpa_register');
382 382
 
383 383
 			/* After this point, the plugins should be registered and the configuration set. */
384 384
 
385 385
 			// Proceed only if we have plugins to handle.
386
-			if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
386
+			if (empty($this->plugins) || !is_array($this->plugins)) {
387 387
 				return;
388 388
 			}
389 389
 
390 390
 			// Set up the menu and notices if we still have outstanding actions.
391
-			if ( true !== $this->is_tgmpa_complete() ) {
391
+			if (true !== $this->is_tgmpa_complete()) {
392 392
 				// Sort the plugins.
393
-				array_multisort( $this->sort_order, SORT_ASC, $this->plugins );
393
+				array_multisort($this->sort_order, SORT_ASC, $this->plugins);
394 394
 
395
-				add_action( 'admin_menu', array( $this, 'admin_menu' ) );
396
-				add_action( 'admin_head', array( $this, 'dismiss' ) );
395
+				add_action('admin_menu', array($this, 'admin_menu'));
396
+				add_action('admin_head', array($this, 'dismiss'));
397 397
 
398 398
 				// Prevent the normal links from showing underneath a single install/update page.
399
-				add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
400
-				add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) );
399
+				add_filter('install_plugin_complete_actions', array($this, 'actions'));
400
+				add_filter('update_plugin_complete_actions', array($this, 'actions'));
401 401
 
402
-				if ( $this->has_notices ) {
403
-					add_action( 'admin_notices', array( $this, 'notices' ) );
404
-					add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
405
-					add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
402
+				if ($this->has_notices) {
403
+					add_action('admin_notices', array($this, 'notices'));
404
+					add_action('admin_init', array($this, 'admin_init'), 1);
405
+					add_action('admin_enqueue_scripts', array($this, 'thickbox'));
406 406
 				}
407 407
 
408
-				add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 );
408
+				add_action('load-plugins.php', array($this, 'add_plugin_action_link_filters'), 1);
409 409
 
410 410
 			}
411 411
 
412 412
 			// Make sure things get reset on switch theme.
413
-			add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
413
+			add_action('switch_theme', array($this, 'flush_plugins_cache'));
414 414
 
415
-			if ( $this->has_notices ) {
416
-				add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
415
+			if ($this->has_notices) {
416
+				add_action('switch_theme', array($this, 'update_dismiss'));
417 417
 			}
418 418
 
419 419
 			// Setup the force activation hook.
420
-			if ( true === $this->has_forced_activation ) {
421
-				add_action( 'admin_init', array( $this, 'force_activation' ) );
420
+			if (true === $this->has_forced_activation) {
421
+				add_action('admin_init', array($this, 'force_activation'));
422 422
 			}
423 423
 
424 424
 			// Setup the force deactivation hook.
425
-			if ( true === $this->has_forced_deactivation ) {
426
-				add_action( 'switch_theme', array( $this, 'force_deactivation' ) );
425
+			if (true === $this->has_forced_deactivation) {
426
+				add_action('switch_theme', array($this, 'force_deactivation'));
427 427
 			}
428 428
 
429 429
 		}
@@ -435,17 +435,17 @@  discard block
 block discarded – undo
435 435
 		 * @since 2.5.0
436 436
 		 */
437 437
 		public function add_plugin_action_link_filters() {
438
-			foreach ( $this->plugins as $slug => $plugin ) {
439
-				if ( false === $this->can_plugin_activate( $slug ) ) {
440
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
438
+			foreach ($this->plugins as $slug => $plugin) {
439
+				if (false === $this->can_plugin_activate($slug)) {
440
+					add_filter('plugin_action_links_'.$plugin['file_path'], array($this, 'filter_plugin_action_links_activate'), 20);
441 441
 				}
442 442
 
443
-				if ( true === $plugin['force_activation'] ) {
444
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
443
+				if (true === $plugin['force_activation']) {
444
+					add_filter('plugin_action_links_'.$plugin['file_path'], array($this, 'filter_plugin_action_links_deactivate'), 20);
445 445
 				}
446 446
 
447
-				if ( false !== $this->does_plugin_require_update( $slug ) ) {
448
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
447
+				if (false !== $this->does_plugin_require_update($slug)) {
448
+					add_filter('plugin_action_links_'.$plugin['file_path'], array($this, 'filter_plugin_action_links_update'), 20);
449 449
 				}
450 450
 			}
451 451
 		}
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 		 *
461 461
 		 * @return array
462 462
 		 */
463
-		public function filter_plugin_action_links_activate( $actions ) {
464
-			unset( $actions['activate'] );
463
+		public function filter_plugin_action_links_activate($actions) {
464
+			unset($actions['activate']);
465 465
 			return $actions;
466 466
 		}
467 467
 
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 		 *
475 475
 		 * @return array
476 476
 		 */
477
-		public function filter_plugin_action_links_deactivate( $actions ) {
478
-			unset( $actions['deactivate'] );
477
+		public function filter_plugin_action_links_deactivate($actions) {
478
+			unset($actions['deactivate']);
479 479
 			return $actions;
480 480
 		}
481 481
 
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
 		 *
490 490
 		 * @return array
491 491
 		 */
492
-		public function filter_plugin_action_links_update( $actions ) {
492
+		public function filter_plugin_action_links_update($actions) {
493 493
 			$actions['update'] = sprintf(
494 494
 				'<a href="%1$s" title="%2$s" class="edit">%3$s</a>',
495
-				esc_url( $this->get_tgmpa_status_url( 'update' ) ),
496
-				esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ),
497
-				esc_html__( 'Update Required', 'tgmpa' )
495
+				esc_url($this->get_tgmpa_status_url('update')),
496
+				esc_attr__('This plugin needs to be updated to be compatible with your theme.', 'tgmpa'),
497
+				esc_html__('Update Required', 'tgmpa')
498 498
 			);
499 499
 			return $actions;
500 500
 		}
@@ -524,15 +524,15 @@  discard block
 block discarded – undo
524 524
 		 */
525 525
 		public function admin_init() {
526 526
 
527
-			if ( ! $this->is_tgmpa_page() ) {
527
+			if (!$this->is_tgmpa_page()) {
528 528
 				return;
529 529
 			}
530 530
 
531
-			if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
531
+			if (isset($_REQUEST['tab']) && 'plugin-information' === $_REQUEST['tab']) {
532 532
 				// Needed for install_plugin_information().
533
-				require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
533
+				require_once ABSPATH.'wp-admin/includes/plugin-install.php';
534 534
 
535
-				wp_enqueue_style( 'plugin-install' );
535
+				wp_enqueue_style('plugin-install');
536 536
 
537 537
 				global $tab, $body_id;
538 538
 				$body_id = 'plugin-information';
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		 */
561 561
 		public function thickbox() {
562 562
 
563
-			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
563
+			if (!get_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true)) {
564 564
 				add_thickbox();
565 565
 			}
566 566
 
@@ -582,23 +582,23 @@  discard block
 block discarded – undo
582 582
 		public function admin_menu() {
583 583
 
584 584
 			// Make sure privileges are correct to see the page.
585
-			if ( ! current_user_can( 'install_plugins' ) ) {
585
+			if (!current_user_can('install_plugins')) {
586 586
 				return;
587 587
 			}
588 588
 
589 589
 			$args = apply_filters(
590 590
 				'tgmpa_admin_menu_args',
591 591
 				array(
592
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
593
-					'page_title'  => $this->strings['page_title'],           // Page title.
594
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
595
-					'capability'  => $this->capability,                      // Capability.
596
-					'menu_slug'   => $this->menu,                            // Menu slug.
597
-					'function'    => array( $this, 'install_plugins_page' ), // Callback.
592
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
593
+					'page_title'  => $this->strings['page_title'], // Page title.
594
+					'menu_title'  => $this->strings['menu_title'], // Menu title.
595
+					'capability'  => $this->capability, // Capability.
596
+					'menu_slug'   => $this->menu, // Menu slug.
597
+					'function'    => array($this, 'install_plugins_page'), // Callback.
598 598
 				)
599 599
 			);
600 600
 
601
-			$this->add_admin_menu( $args );
601
+			$this->add_admin_menu($args);
602 602
 
603 603
 		}
604 604
 
@@ -609,16 +609,16 @@  discard block
 block discarded – undo
609 609
 		 *
610 610
 		 * @param array $args Menu item configuration.
611 611
 		 */
612
-		protected function add_admin_menu( array $args ) {
613
-			if ( has_filter( 'tgmpa_admin_menu_use_add_theme_page' ) ) {
614
-				_deprecated_function( 'The "tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__( 'Set the parent_slug config variable instead.', 'tgmpa' ) );
612
+		protected function add_admin_menu(array $args) {
613
+			if (has_filter('tgmpa_admin_menu_use_add_theme_page')) {
614
+				_deprecated_function('The "tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__('Set the parent_slug config variable instead.', 'tgmpa'));
615 615
 			}
616 616
 
617
-			if ( 'themes.php' === $this->parent_slug ) {
618
-				$this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
617
+			if ('themes.php' === $this->parent_slug) {
618
+				$this->page_hook = call_user_func('add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']);
619 619
 
620 620
 			} else {
621
-				$this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
621
+				$this->page_hook = call_user_func('add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']);
622 622
 			}
623 623
 		}
624 624
 
@@ -639,28 +639,28 @@  discard block
 block discarded – undo
639 639
 			$plugin_table = new TGMPA_List_Table;
640 640
 
641 641
 			// Return early if processing a plugin installation action.
642
-			if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
642
+			if ((('tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action()) && $plugin_table->process_bulk_actions()) || $this->do_plugin_install()) {
643 643
 				return;
644 644
 			}
645 645
 
646 646
 			// Force refresh of available plugin information so we'll know about manual updates/deletes.
647
-			wp_clean_plugins_cache( false );
647
+			wp_clean_plugins_cache(false);
648 648
 
649 649
 			?>
650 650
 			<div class="tgmpa wrap">
651
-				<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
651
+				<h2><?php echo esc_html(get_admin_page_title()); ?></h2>
652 652
 				<?php $plugin_table->prepare_items(); ?>
653 653
 
654 654
 				<?php
655
-				if ( ! empty( $this->message ) && is_string( $this->message ) ) {
656
-					echo wp_kses_post( $this->message );
655
+				if (!empty($this->message) && is_string($this->message)) {
656
+					echo wp_kses_post($this->message);
657 657
 				}
658 658
 				?>
659 659
 				<?php $plugin_table->views(); ?>
660 660
 
661 661
 				<form id="tgmpa-plugins" action="" method="post">
662
-					<input type="hidden" name="tgmpa-page" value="<?php echo esc_attr( $this->menu ); ?>" />
663
-					<input type="hidden" name="plugin_status" value="<?php echo esc_attr( $plugin_table->view_context ); ?>" />
662
+					<input type="hidden" name="tgmpa-page" value="<?php echo esc_attr($this->menu); ?>" />
663
+					<input type="hidden" name="plugin_status" value="<?php echo esc_attr($plugin_table->view_context); ?>" />
664 664
 					<?php $plugin_table->display(); ?>
665 665
 				</form>
666 666
 			</div>
@@ -690,48 +690,48 @@  discard block
 block discarded – undo
690 690
 		 */
691 691
 		protected function do_plugin_install() {
692 692
 
693
-			if ( empty( $_GET['plugin'] ) ) {
693
+			if (empty($_GET['plugin'])) {
694 694
 				return false;
695 695
 			}
696 696
 
697 697
 			// All plugin information will be stored in an array for processing.
698
-			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
698
+			$slug = $this->sanitize_key(urldecode($_GET['plugin']));
699 699
 
700
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
700
+			if (!isset($this->plugins[$slug])) {
701 701
 				return false;
702 702
 			}
703 703
 
704 704
 			// Was an install or upgrade action link clicked?
705
-			if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) {
705
+			if ((isset($_GET['tgmpa-install']) && 'install-plugin' === $_GET['tgmpa-install']) || (isset($_GET['tgmpa-update']) && 'update-plugin' === $_GET['tgmpa-update'])) {
706 706
 
707 707
 				$install_type = 'install';
708
-				if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) {
708
+				if (isset($_GET['tgmpa-update']) && 'update-plugin' === $_GET['tgmpa-update']) {
709 709
 					$install_type = 'update';
710 710
 				}
711 711
 
712
-				check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' );
712
+				check_admin_referer('tgmpa-'.$install_type, 'tgmpa-nonce');
713 713
 
714 714
 				// Pass necessary information via URL if WP_Filesystem is needed.
715 715
 				$url = wp_nonce_url(
716 716
 					add_query_arg(
717 717
 						array(
718
-							'plugin'                 => urlencode( $slug ),
719
-							'tgmpa-' . $install_type => $install_type . '-plugin',
718
+							'plugin'                 => urlencode($slug),
719
+							'tgmpa-'.$install_type => $install_type.'-plugin',
720 720
 						),
721 721
 						$this->get_tgmpa_url()
722 722
 					),
723
-					'tgmpa-' . $install_type,
723
+					'tgmpa-'.$install_type,
724 724
 					'tgmpa-nonce'
725 725
 				);
726 726
 
727 727
 				$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
728 728
 
729
-				if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, array() ) ) ) {
729
+				if (false === ($creds = request_filesystem_credentials(esc_url_raw($url), $method, false, false, array()))) {
730 730
 					return true;
731 731
 				}
732 732
 
733
-				if ( ! WP_Filesystem( $creds ) ) {
734
-					request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, array() ); // Setup WP_Filesystem.
733
+				if (!WP_Filesystem($creds)) {
734
+					request_filesystem_credentials(esc_url_raw($url), $method, true, false, array()); // Setup WP_Filesystem.
735 735
 					return true;
736 736
 				}
737 737
 
@@ -740,68 +740,68 @@  discard block
 block discarded – undo
740 740
 				// Prep variables for Plugin_Installer_Skin class.
741 741
 				$extra         = array();
742 742
 				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
743
-				$source        = $this->get_download_url( $slug );
744
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
745
-				$api           = ( false !== $api ) ? $api : null;
743
+				$source        = $this->get_download_url($slug);
744
+				$api           = ('repo' === $this->plugins[$slug]['source_type']) ? $this->get_plugins_api($slug) : null;
745
+				$api           = (false !== $api) ? $api : null;
746 746
 
747 747
 				$url = add_query_arg(
748 748
 					array(
749
-						'action' => $install_type . '-plugin',
750
-						'plugin' => urlencode( $slug ),
749
+						'action' => $install_type.'-plugin',
750
+						'plugin' => urlencode($slug),
751 751
 					),
752 752
 					'update.php'
753 753
 				);
754 754
 
755
-				if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
756
-					require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
755
+				if (!class_exists('Plugin_Upgrader', false)) {
756
+					require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
757 757
 				}
758 758
 
759 759
 				$skin_args = array(
760
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
761
-					'title'  => sprintf( $this->strings['installing'], $this->plugins[ $slug ]['name'] ),
762
-					'url'    => esc_url_raw( $url ),
763
-					'nonce'  => $install_type . '-plugin_' . $slug,
760
+					'type'   => ('bundled' !== $this->plugins[$slug]['source_type']) ? 'web' : 'upload',
761
+					'title'  => sprintf($this->strings['installing'], $this->plugins[$slug]['name']),
762
+					'url'    => esc_url_raw($url),
763
+					'nonce'  => $install_type.'-plugin_'.$slug,
764 764
 					'plugin' => '',
765 765
 					'api'    => $api,
766 766
 					'extra'  => $extra,
767 767
 				);
768 768
 
769
-				if ( 'update' === $install_type ) {
770
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
771
-					$skin                = new Plugin_Upgrader_Skin( $skin_args );
769
+				if ('update' === $install_type) {
770
+					$skin_args['plugin'] = $this->plugins[$slug]['file_path'];
771
+					$skin                = new Plugin_Upgrader_Skin($skin_args);
772 772
 
773 773
 				} else {
774
-					$skin = new Plugin_Installer_Skin( $skin_args );
774
+					$skin = new Plugin_Installer_Skin($skin_args);
775 775
 				}
776 776
 
777 777
 				// Create a new instance of Plugin_Upgrader.
778
-				$upgrader = new Plugin_Upgrader( $skin );
778
+				$upgrader = new Plugin_Upgrader($skin);
779 779
 
780 780
 				// Perform the action and install the plugin from the $source urldecode().
781
-				add_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 );
781
+				add_filter('upgrader_source_selection', array($this, 'maybe_adjust_source_dir'), 1, 3);
782 782
 
783
-				if ( 'update' === $install_type ) {
783
+				if ('update' === $install_type) {
784 784
 					// Inject our info into the update transient.
785
-					$to_inject                    = array( $slug => $this->plugins[ $slug ] );
786
-					$to_inject[ $slug ]['source'] = $source;
787
-					$this->inject_update_info( $to_inject );
785
+					$to_inject                    = array($slug => $this->plugins[$slug]);
786
+					$to_inject[$slug]['source'] = $source;
787
+					$this->inject_update_info($to_inject);
788 788
 
789
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
789
+					$upgrader->upgrade($this->plugins[$slug]['file_path']);
790 790
 
791 791
 				} else {
792
-					$upgrader->install( $source );
792
+					$upgrader->install($source);
793 793
 				}
794 794
 
795
-				remove_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 );
795
+				remove_filter('upgrader_source_selection', array($this, 'maybe_adjust_source_dir'), 1, 3);
796 796
 
797 797
 				// Make sure we have the correct file path now the plugin is installed/updated.
798
-				$this->populate_file_path( $slug );
798
+				$this->populate_file_path($slug);
799 799
 
800 800
 				// Only activate plugins if the config option is set to true and the plugin isn't
801 801
 				// already active (upgrade).
802
-				if ( $this->is_automatic && ! $this->is_plugin_active( $slug ) ) {
802
+				if ($this->is_automatic && !$this->is_plugin_active($slug)) {
803 803
 					$plugin_activate = $upgrader->plugin_info(); // Grab the plugin info from the Plugin_Upgrader method.
804
-					if ( false === $this->activate_single_plugin( $plugin_activate, $slug, true ) ) {
804
+					if (false === $this->activate_single_plugin($plugin_activate, $slug, true)) {
805 805
 						return true; // Finish execution of the function early as we encountered an error.
806 806
 					}
807 807
 				}
@@ -809,20 +809,20 @@  discard block
 block discarded – undo
809 809
 				$this->show_tgmpa_version();
810 810
 
811 811
 				// Display message based on if all plugins are now active or not.
812
-				if ( $this->is_tgmpa_complete() ) {
813
-					echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>';
812
+				if ($this->is_tgmpa_complete()) {
813
+					echo '<p>', sprintf(esc_html($this->strings['complete']), '<a href="'.esc_url(self_admin_url()).'">'.esc_html__('Return to the Dashboard', 'tgmpa').'</a>'), '</p>';
814 814
 					echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
815 815
 
816 816
 				} else {
817
-					echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
817
+					echo '<p><a href="', esc_url($this->get_tgmpa_url()), '" target="_parent">', esc_html($this->strings['return']), '</a></p>';
818 818
 				}
819 819
 				return true;
820 820
 
821
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
821
+			} elseif (isset($this->plugins[$slug]['file_path'], $_GET['tgmpa-activate']) && 'activate-plugin' === $_GET['tgmpa-activate']) {
822 822
 				// Activate action link was clicked.
823
-				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
823
+				check_admin_referer('tgmpa-activate', 'tgmpa-nonce');
824 824
 
825
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
825
+				if (false === $this->activate_single_plugin($this->plugins[$slug]['file_path'], $slug)) {
826 826
 					return true; // Finish execution of the function early as we encountered an error.
827 827
 				}
828 828
 			}
@@ -838,33 +838,33 @@  discard block
 block discarded – undo
838 838
 		 *
839 839
 		 * @param array $plugins The plugin information for the plugins which are to be updated.
840 840
 		 */
841
-		public function inject_update_info( $plugins ) {
841
+		public function inject_update_info($plugins) {
842 842
 
843
-			$repo_updates = get_site_transient( 'update_plugins' );
843
+			$repo_updates = get_site_transient('update_plugins');
844 844
 
845
-			if ( ! is_object( $repo_updates ) ) {
845
+			if (!is_object($repo_updates)) {
846 846
 				$repo_updates = new stdClass;
847 847
 			}
848 848
 
849
-			foreach ( $plugins as $slug => $plugin ) {
849
+			foreach ($plugins as $slug => $plugin) {
850 850
 
851 851
 				$file_path = $plugin['file_path'];
852 852
 
853
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
854
-					$repo_updates->response[ $file_path ] = new stdClass;
853
+				if (empty($repo_updates->response[$file_path])) {
854
+					$repo_updates->response[$file_path] = new stdClass;
855 855
 				}
856 856
 
857 857
 				// We only really need to set package, but let's do all we can in case WP changes something.
858
-				$repo_updates->response[ $file_path ]->slug        = $slug;
859
-				$repo_updates->response[ $file_path ]->plugin      = $file_path;
860
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
861
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
862
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
863
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
858
+				$repo_updates->response[$file_path]->slug        = $slug;
859
+				$repo_updates->response[$file_path]->plugin      = $file_path;
860
+				$repo_updates->response[$file_path]->new_version = $plugin['version'];
861
+				$repo_updates->response[$file_path]->package     = $plugin['source'];
862
+				if (empty($repo_updates->response[$file_path]->url) && !empty($plugin['external_url'])) {
863
+					$repo_updates->response[$file_path]->url = $plugin['external_url'];
864 864
 				}
865 865
 			}
866 866
 
867
-			set_site_transient( 'update_plugins', $repo_updates );
867
+			set_site_transient('update_plugins', $repo_updates);
868 868
 		}
869 869
 
870 870
 		/**
@@ -884,15 +884,15 @@  discard block
 block discarded – undo
884 884
 		 *
885 885
 		 * @return string $source
886 886
 		 */
887
-		public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
887
+		public function maybe_adjust_source_dir($source, $remote_source, $upgrader) {
888 888
 
889
-			if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) {
889
+			if (!$this->is_tgmpa_page() || !is_object($GLOBALS['wp_filesystem'])) {
890 890
 				return $source;
891 891
 			}
892 892
 
893 893
 			// Check for single file plugins.
894
-			$source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) );
895
-			if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) {
894
+			$source_files = array_keys($GLOBALS['wp_filesystem']->dirlist($remote_source));
895
+			if (1 === count($source_files) && false === $GLOBALS['wp_filesystem']->is_dir($source)) {
896 896
 
897 897
 				return $source;
898 898
 			}
@@ -901,35 +901,35 @@  discard block
 block discarded – undo
901 901
 			$desired_slug = '';
902 902
 
903 903
 			// Figure out what the slug is supposed to be.
904
-			if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) {
904
+			if (false === $upgrader->bulk && !empty($upgrader->skin->options['extra']['slug'])) {
905 905
 				$desired_slug = $upgrader->skin->options['extra']['slug'];
906 906
 			} else {
907 907
 				// Bulk installer contains less info, so fall back on the info registered here.
908
-				foreach ( $this->plugins as $slug => $plugin ) {
909
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
908
+				foreach ($this->plugins as $slug => $plugin) {
909
+					if (!empty($upgrader->skin->plugin_names[$upgrader->skin->i]) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i]) {
910 910
 						$desired_slug = $slug;
911 911
 						break;
912 912
 					}
913 913
 				}
914
-				unset( $slug, $plugin );
914
+				unset($slug, $plugin);
915 915
 			}
916 916
 
917
-			if ( ! empty( $desired_slug ) ) {
918
-				$subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );
917
+			if (!empty($desired_slug)) {
918
+				$subdir_name = untrailingslashit(str_replace(trailingslashit($remote_source), '', $source));
919 919
 
920
-				if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
921
-					$from = untrailingslashit( $source );
922
-					$to   = trailingslashit( $remote_source ) . $desired_slug;
920
+				if (!empty($subdir_name) && $subdir_name !== $desired_slug) {
921
+					$from = untrailingslashit($source);
922
+					$to   = trailingslashit($remote_source).$desired_slug;
923 923
 
924
-					if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) {
925
-						return trailingslashit( $to );
924
+					if (true === $GLOBALS['wp_filesystem']->move($from, $to)) {
925
+						return trailingslashit($to);
926 926
 
927 927
 					} else {
928
-						return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
928
+						return new WP_Error('rename_failed', esc_html__('The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa').' '.esc_html__('Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa'), array('found' => $subdir_name, 'expected' => $desired_slug));
929 929
 
930 930
 					}
931
-				} elseif ( empty( $subdir_name ) ) {
932
-					return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
931
+				} elseif (empty($subdir_name)) {
932
+					return new WP_Error('packaged_wrong', esc_html__('The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa').' '.esc_html__('Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa'), array('found' => $subdir_name, 'expected' => $desired_slug));
933 933
 				}
934 934
 			}
935 935
 
@@ -948,53 +948,53 @@  discard block
 block discarded – undo
948 948
 		 *
949 949
 		 * @return bool False if an error was encountered, true otherwise.
950 950
 		 */
951
-		protected function activate_single_plugin( $file_path, $slug, $automatic = false ) {
951
+		protected function activate_single_plugin($file_path, $slug, $automatic = false) {
952 952
 
953
-			if ( $this->can_plugin_activate( $slug ) ) {
954
-				$activate = activate_plugin( $file_path );
953
+			if ($this->can_plugin_activate($slug)) {
954
+				$activate = activate_plugin($file_path);
955 955
 
956
-				if ( is_wp_error( $activate ) ) {
957
-					echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>',
958
-						'<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
956
+				if (is_wp_error($activate)) {
957
+					echo '<div id="message" class="error"><p>', wp_kses_post($activate->get_error_message()), '</p></div>',
958
+						'<p><a href="', esc_url($this->get_tgmpa_url()), '" target="_parent">', esc_html($this->strings['return']), '</a></p>';
959 959
 					return false; // End it here if there is an error with activation.
960 960
 
961 961
 				} else {
962
-					if ( ! $automatic ) {
962
+					if (!$automatic) {
963 963
 						// Make sure message doesn't display again if bulk activation is performed
964 964
 						// immediately after a single activation.
965
-						if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
966
-							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
965
+						if (!isset($_POST['action'])) { // WPCS: CSRF OK.
966
+							echo '<div id="message" class="updated"><p>', esc_html($this->strings['activated_successfully']), ' <strong>', esc_html($this->plugins[$slug]['name']), '.</strong></p></div>';
967 967
 						}
968 968
 					} else {
969 969
 						// Simpler message layout for use on the plugin install page.
970
-						echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>';
970
+						echo '<p>', esc_html($this->strings['plugin_activated']), '</p>';
971 971
 					}
972 972
 				}
973
-			} elseif ( $this->is_plugin_active( $slug ) ) {
973
+			} elseif ($this->is_plugin_active($slug)) {
974 974
 				// No simpler message format provided as this message should never be encountered
975 975
 				// on the plugin install page.
976 976
 				echo '<div id="message" class="error"><p>',
977 977
 					sprintf(
978
-						esc_html( $this->strings['plugin_already_active'] ),
979
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
978
+						esc_html($this->strings['plugin_already_active']),
979
+						'<strong>'.esc_html($this->plugins[$slug]['name']).'</strong>'
980 980
 					),
981 981
 					'</p></div>';
982 982
 
983
-			} elseif ( $this->does_plugin_require_update( $slug ) ) {
984
-				if ( ! $automatic ) {
983
+			} elseif ($this->does_plugin_require_update($slug)) {
984
+				if (!$automatic) {
985 985
 					// Make sure message doesn't display again if bulk activation is performed
986 986
 					// immediately after a single activation.
987
-					if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
987
+					if (!isset($_POST['action'])) { // WPCS: CSRF OK.
988 988
 						echo '<div id="message" class="error"><p>',
989 989
 							sprintf(
990
-								esc_html( $this->strings['plugin_needs_higher_version'] ),
991
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
990
+								esc_html($this->strings['plugin_needs_higher_version']),
991
+								'<strong>'.esc_html($this->plugins[$slug]['name']).'</strong>'
992 992
 							),
993 993
 							'</p></div>';
994 994
 					}
995 995
 				} else {
996 996
 					// Simpler message layout for use on the plugin install page.
997
-					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
997
+					echo '<p>', sprintf(esc_html($this->strings['plugin_needs_higher_version']), esc_html($this->plugins[$slug]['name'])), '</p>';
998 998
 				}
999 999
 			}
1000 1000
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		public function notices() {
1020 1020
 
1021 1021
 			// Remove nag on the install page / Return early if the nag message has been dismissed.
1022
-			if ( $this->is_tgmpa_page() || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
1022
+			if ($this->is_tgmpa_page() || get_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true)) {
1023 1023
 				return;
1024 1024
 			}
1025 1025
 
@@ -1031,18 +1031,18 @@  discard block
 block discarded – undo
1031 1031
 			$update_link_count   = 0;
1032 1032
 			$activate_link_count = 0;
1033 1033
 
1034
-			foreach ( $this->plugins as $slug => $plugin ) {
1034
+			foreach ($this->plugins as $slug => $plugin) {
1035 1035
 
1036
-				if ( $this->is_plugin_active( $slug ) && false === $this->does_plugin_have_update( $slug ) ) {
1036
+				if ($this->is_plugin_active($slug) && false === $this->does_plugin_have_update($slug)) {
1037 1037
 					continue;
1038 1038
 				}
1039 1039
 
1040
-				if ( ! $this->is_plugin_installed( $slug ) ) {
1040
+				if (!$this->is_plugin_installed($slug)) {
1041 1041
 
1042
-					if ( current_user_can( 'install_plugins' ) ) {
1042
+					if (current_user_can('install_plugins')) {
1043 1043
 						$install_link_count++;
1044 1044
 
1045
-						if ( true === $plugin['required'] ) {
1045
+						if (true === $plugin['required']) {
1046 1046
 							$message['notice_can_install_required'][] = $slug;
1047 1047
 						} else {
1048 1048
 							$message['notice_can_install_recommended'][] = $slug;
@@ -1052,12 +1052,12 @@  discard block
 block discarded – undo
1052 1052
 						$message['notice_cannot_install'][] = $slug;
1053 1053
 					}
1054 1054
 				} else {
1055
-					if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) {
1055
+					if (!$this->is_plugin_active($slug) && $this->can_plugin_activate($slug)) {
1056 1056
 
1057
-						if ( current_user_can( 'activate_plugins' ) ) {
1057
+						if (current_user_can('activate_plugins')) {
1058 1058
 							$activate_link_count++;
1059 1059
 
1060
-							if ( true === $plugin['required'] ) {
1060
+							if (true === $plugin['required']) {
1061 1061
 								$message['notice_can_activate_required'][] = $slug;
1062 1062
 							} else {
1063 1063
 								$message['notice_can_activate_recommended'][] = $slug;
@@ -1068,14 +1068,14 @@  discard block
 block discarded – undo
1068 1068
 						}
1069 1069
 					}
1070 1070
 
1071
-					if ( $this->does_plugin_require_update( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
1071
+					if ($this->does_plugin_require_update($slug) || false !== $this->does_plugin_have_update($slug)) {
1072 1072
 
1073
-						if ( current_user_can( 'install_plugins' ) ) {
1073
+						if (current_user_can('install_plugins')) {
1074 1074
 							$update_link_count++;
1075 1075
 
1076
-							if ( $this->does_plugin_require_update( $slug ) ) {
1076
+							if ($this->does_plugin_require_update($slug)) {
1077 1077
 								$message['notice_ask_to_update'][] = $slug;
1078
-							} elseif ( false !== $this->does_plugin_have_update( $slug ) ) {
1078
+							} elseif (false !== $this->does_plugin_have_update($slug)) {
1079 1079
 								$message['notice_ask_to_update_maybe'][] = $slug;
1080 1080
 							}
1081 1081
 						} else {
@@ -1085,107 +1085,107 @@  discard block
 block discarded – undo
1085 1085
 					}
1086 1086
 				}
1087 1087
 			}
1088
-			unset( $slug, $plugin );
1088
+			unset($slug, $plugin);
1089 1089
 
1090 1090
 			// If we have notices to display, we move forward.
1091
-			if ( ! empty( $message ) ) {
1092
-				krsort( $message ); // Sort messages.
1091
+			if (!empty($message)) {
1092
+				krsort($message); // Sort messages.
1093 1093
 				$rendered = '';
1094 1094
 
1095 1095
 				// As add_settings_error() wraps the final message in a <p> and as the final message can't be
1096 1096
 				// filtered, using <p>'s in our html would render invalid html output.
1097
-				$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n";
1097
+				$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n";
1098 1098
 
1099 1099
 				// If dismissable is false and a message is set, output it now.
1100
-				if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) {
1101
-					$rendered .= sprintf( $line_template, wp_kses_post( $this->dismiss_msg ) );
1100
+				if (!$this->dismissable && !empty($this->dismiss_msg)) {
1101
+					$rendered .= sprintf($line_template, wp_kses_post($this->dismiss_msg));
1102 1102
 				}
1103 1103
 
1104 1104
 				// Render the individual message lines for the notice.
1105
-				foreach ( $message as $type => $plugin_group ) {
1105
+				foreach ($message as $type => $plugin_group) {
1106 1106
 					$linked_plugins = array();
1107 1107
 
1108 1108
 					// Get the external info link for a plugin if one is available.
1109
-					foreach ( $plugin_group as $plugin_slug ) {
1110
-						$linked_plugins[] = $this->get_info_link( $plugin_slug );
1109
+					foreach ($plugin_group as $plugin_slug) {
1110
+						$linked_plugins[] = $this->get_info_link($plugin_slug);
1111 1111
 					}
1112
-					unset( $plugin_slug );
1112
+					unset($plugin_slug);
1113 1113
 
1114
-					$count          = count( $plugin_group );
1115
-					$linked_plugins = array_map( array( 'TGM_Utils', 'wrap_in_em' ), $linked_plugins );
1116
-					$last_plugin    = array_pop( $linked_plugins ); // Pop off last name to prep for readability.
1117
-					$imploded       = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin );
1114
+					$count          = count($plugin_group);
1115
+					$linked_plugins = array_map(array('TGM_Utils', 'wrap_in_em'), $linked_plugins);
1116
+					$last_plugin    = array_pop($linked_plugins); // Pop off last name to prep for readability.
1117
+					$imploded       = empty($linked_plugins) ? $last_plugin : (implode(', ', $linked_plugins).' '.esc_html_x('and', 'plugin A *and* plugin B', 'tgmpa').' '.$last_plugin);
1118 1118
 
1119 1119
 					$rendered .= sprintf(
1120 1120
 						$line_template,
1121 1121
 						sprintf(
1122
-							translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ),
1122
+							translate_nooped_plural($this->strings[$type], $count, 'tgmpa'),
1123 1123
 							$imploded,
1124 1124
 							$count
1125 1125
 						)
1126 1126
 					);
1127 1127
 
1128
-					if ( 0 === strpos( $type, 'notice_cannot' ) ) {
1128
+					if (0 === strpos($type, 'notice_cannot')) {
1129 1129
 						$rendered .= $this->strings['contact_admin'];
1130 1130
 					}
1131 1131
 				}
1132
-				unset( $type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded );
1132
+				unset($type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded);
1133 1133
 
1134 1134
 				// Setup action links.
1135 1135
 				$action_links = array(
1136 1136
 					'install'  => '',
1137 1137
 					'update'   => '',
1138 1138
 					'activate' => '',
1139
-					'dismiss'  => $this->dismissable ? '<a href="' . esc_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '',
1139
+					'dismiss'  => $this->dismissable ? '<a href="'.esc_url(add_query_arg('tgmpa-dismiss', 'dismiss_admin_notices')).'" class="dismiss-notice" target="_parent">'.esc_html($this->strings['dismiss']).'</a>' : '',
1140 1140
 				);
1141 1141
 
1142 1142
 				$link_template = '<a href="%2$s">%1$s</a>';
1143 1143
 
1144
-				if ( current_user_can( 'install_plugins' ) ) {
1145
-					if ( $install_link_count > 0 ) {
1144
+				if (current_user_can('install_plugins')) {
1145
+					if ($install_link_count > 0) {
1146 1146
 						$action_links['install'] = sprintf(
1147 1147
 							$link_template,
1148
-							translate_nooped_plural( $this->strings['install_link'], $install_link_count, 'tgmpa' ),
1149
-							esc_url( $this->get_tgmpa_status_url( 'install' ) )
1148
+							translate_nooped_plural($this->strings['install_link'], $install_link_count, 'tgmpa'),
1149
+							esc_url($this->get_tgmpa_status_url('install'))
1150 1150
 						);
1151 1151
 					}
1152
-					if ( $update_link_count > 0 ) {
1152
+					if ($update_link_count > 0) {
1153 1153
 						$action_links['update'] = sprintf(
1154 1154
 							$link_template,
1155
-							translate_nooped_plural( $this->strings['update_link'], $update_link_count, 'tgmpa' ),
1156
-							esc_url( $this->get_tgmpa_status_url( 'update' ) )
1155
+							translate_nooped_plural($this->strings['update_link'], $update_link_count, 'tgmpa'),
1156
+							esc_url($this->get_tgmpa_status_url('update'))
1157 1157
 						);
1158 1158
 					}
1159 1159
 				}
1160 1160
 
1161
-				if ( current_user_can( 'activate_plugins' ) && $activate_link_count > 0 ) {
1161
+				if (current_user_can('activate_plugins') && $activate_link_count > 0) {
1162 1162
 					$action_links['activate'] = sprintf(
1163 1163
 						$link_template,
1164
-						translate_nooped_plural( $this->strings['activate_link'], $activate_link_count, 'tgmpa' ),
1165
-						esc_url( $this->get_tgmpa_status_url( 'activate' ) )
1164
+						translate_nooped_plural($this->strings['activate_link'], $activate_link_count, 'tgmpa'),
1165
+						esc_url($this->get_tgmpa_status_url('activate'))
1166 1166
 					);
1167 1167
 				}
1168 1168
 
1169
-				$action_links = apply_filters( 'tgmpa_notice_action_links', $action_links );
1169
+				$action_links = apply_filters('tgmpa_notice_action_links', $action_links);
1170 1170
 
1171
-				$action_links = array_filter( (array) $action_links ); // Remove any empty array items.
1171
+				$action_links = array_filter((array) $action_links); // Remove any empty array items.
1172 1172
 
1173
-				if ( ! empty( $action_links ) && is_array( $action_links ) ) {
1174
-					$action_links = sprintf( $line_template, implode( ' | ', $action_links ) );
1175
-					$rendered    .= apply_filters( 'tgmpa_notice_rendered_action_links', $action_links );
1173
+				if (!empty($action_links) && is_array($action_links)) {
1174
+					$action_links = sprintf($line_template, implode(' | ', $action_links));
1175
+					$rendered    .= apply_filters('tgmpa_notice_rendered_action_links', $action_links);
1176 1176
 				}
1177 1177
 
1178 1178
 				// Register the nag messages and prepare them to be processed.
1179
-				if ( ! empty( $this->strings['nag_type'] ) ) {
1180
-					add_settings_error( 'tgmpa', 'tgmpa', $rendered, sanitize_html_class( strtolower( $this->strings['nag_type'] ) ) );
1179
+				if (!empty($this->strings['nag_type'])) {
1180
+					add_settings_error('tgmpa', 'tgmpa', $rendered, sanitize_html_class(strtolower($this->strings['nag_type'])));
1181 1181
 				} else {
1182
-					$nag_class = version_compare( $this->wp_version, '3.8', '<' ) ? 'updated' : 'update-nag';
1183
-					add_settings_error( 'tgmpa', 'tgmpa', $rendered, $nag_class );
1182
+					$nag_class = version_compare($this->wp_version, '3.8', '<') ? 'updated' : 'update-nag';
1183
+					add_settings_error('tgmpa', 'tgmpa', $rendered, $nag_class);
1184 1184
 				}
1185 1185
 			}
1186 1186
 
1187 1187
 			// Admin options pages already output settings_errors, so this is to avoid duplication.
1188
-			if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) {
1188
+			if ('options-general' !== $GLOBALS['current_screen']->parent_base) {
1189 1189
 				$this->display_settings_errors();
1190 1190
 			}
1191 1191
 
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 		protected function display_settings_errors() {
1200 1200
 			global $wp_settings_errors;
1201 1201
 
1202
-			settings_errors( 'tgmpa' );
1202
+			settings_errors('tgmpa');
1203 1203
 
1204
-			foreach ( (array) $wp_settings_errors as $key => $details ) {
1205
-				if ( 'tgmpa' === $details['setting'] ) {
1206
-					unset( $wp_settings_errors[ $key ] );
1204
+			foreach ((array) $wp_settings_errors as $key => $details) {
1205
+				if ('tgmpa' === $details['setting']) {
1206
+					unset($wp_settings_errors[$key]);
1207 1207
 					break;
1208 1208
 				}
1209 1209
 			}
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
 		 */
1219 1219
 		public function dismiss() {
1220 1220
 
1221
-			if ( isset( $_GET['tgmpa-dismiss'] ) ) {
1222
-				update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 );
1221
+			if (isset($_GET['tgmpa-dismiss'])) {
1222
+				update_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1);
1223 1223
 			}
1224 1224
 		}
1225 1225
 
@@ -1233,55 +1233,55 @@  discard block
 block discarded – undo
1233 1233
 		 *
1234 1234
 		 * @param array $plugin Array of plugin arguments.
1235 1235
 		 */
1236
-		public function register( $plugin ) {
1237
-			if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) {
1236
+		public function register($plugin) {
1237
+			if (empty($plugin['slug']) || empty($plugin['name'])) {
1238 1238
 				return;
1239 1239
 			}
1240 1240
 
1241
-			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1241
+			if (empty($plugin['slug']) || !is_string($plugin['slug']) || isset($this->plugins[$plugin['slug']])) {
1242 1242
 				return;
1243 1243
 			}
1244 1244
 
1245 1245
 			$defaults = array(
1246
-				'name'               => '',      // String
1247
-				'slug'               => '',      // String
1248
-				'source'             => 'repo',  // String
1249
-				'required'           => false,   // Boolean
1250
-				'version'            => '',      // String
1251
-				'force_activation'   => false,   // Boolean
1252
-				'force_deactivation' => false,   // Boolean
1253
-				'external_url'       => '',      // String
1254
-				'is_callable'        => '',      // String|Array.
1246
+				'name'               => '', // String
1247
+				'slug'               => '', // String
1248
+				'source'             => 'repo', // String
1249
+				'required'           => false, // Boolean
1250
+				'version'            => '', // String
1251
+				'force_activation'   => false, // Boolean
1252
+				'force_deactivation' => false, // Boolean
1253
+				'external_url'       => '', // String
1254
+				'is_callable'        => '', // String|Array.
1255 1255
 			);
1256 1256
 
1257 1257
 			// Prepare the received data.
1258
-			$plugin = wp_parse_args( $plugin, $defaults );
1258
+			$plugin = wp_parse_args($plugin, $defaults);
1259 1259
 
1260 1260
 			// Standardize the received slug.
1261
-			$plugin['slug'] = $this->sanitize_key( $plugin['slug'] );
1261
+			$plugin['slug'] = $this->sanitize_key($plugin['slug']);
1262 1262
 
1263 1263
 			// Forgive users for using string versions of booleans or floats for version number.
1264 1264
 			$plugin['version']            = (string) $plugin['version'];
1265
-			$plugin['source']             = empty( $plugin['source'] ) ? 'repo' : $plugin['source'];
1266
-			$plugin['required']           = TGM_Utils::validate_bool( $plugin['required'] );
1267
-			$plugin['force_activation']   = TGM_Utils::validate_bool( $plugin['force_activation'] );
1268
-			$plugin['force_deactivation'] = TGM_Utils::validate_bool( $plugin['force_deactivation'] );
1265
+			$plugin['source']             = empty($plugin['source']) ? 'repo' : $plugin['source'];
1266
+			$plugin['required']           = TGM_Utils::validate_bool($plugin['required']);
1267
+			$plugin['force_activation']   = TGM_Utils::validate_bool($plugin['force_activation']);
1268
+			$plugin['force_deactivation'] = TGM_Utils::validate_bool($plugin['force_deactivation']);
1269 1269
 
1270 1270
 			// Enrich the received data.
1271
-			$plugin['file_path']   = $this->_get_plugin_basename_from_slug( $plugin['slug'] );
1272
-			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1271
+			$plugin['file_path']   = $this->_get_plugin_basename_from_slug($plugin['slug']);
1272
+			$plugin['source_type'] = $this->get_plugin_source_type($plugin['source']);
1273 1273
 
1274 1274
 			// Set the class properties.
1275
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1276
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1275
+			$this->plugins[$plugin['slug']]    = $plugin;
1276
+			$this->sort_order[$plugin['slug']] = $plugin['name'];
1277 1277
 
1278 1278
 			// Should we add the force activation hook ?
1279
-			if ( true === $plugin['force_activation'] ) {
1279
+			if (true === $plugin['force_activation']) {
1280 1280
 				$this->has_forced_activation = true;
1281 1281
 			}
1282 1282
 
1283 1283
 			// Should we add the force deactivation hook ?
1284
-			if ( true === $plugin['force_deactivation'] ) {
1284
+			if (true === $plugin['force_deactivation']) {
1285 1285
 				$this->has_forced_deactivation = true;
1286 1286
 			}
1287 1287
 		}
@@ -1296,12 +1296,12 @@  discard block
 block discarded – undo
1296 1296
 		 *
1297 1297
 		 * @return string 'repo', 'external', or 'bundled'
1298 1298
 		 */
1299
-		protected function get_plugin_source_type( $source ) {
1299
+		protected function get_plugin_source_type($source) {
1300 1300
 
1301
-			if ( 'repo' === $source || preg_match( self::WP_REPO_REGEX, $source ) ) {
1301
+			if ('repo' === $source || preg_match(self::WP_REPO_REGEX, $source)) {
1302 1302
 				return 'repo';
1303 1303
 
1304
-			} elseif ( preg_match( self::IS_URL_REGEX, $source ) ) {
1304
+			} elseif (preg_match(self::IS_URL_REGEX, $source)) {
1305 1305
 				return 'external';
1306 1306
 
1307 1307
 			} else {
@@ -1323,9 +1323,9 @@  discard block
 block discarded – undo
1323 1323
 		 * @param string $key String key.
1324 1324
 		 * @return string Sanitized key
1325 1325
 		 */
1326
-		public function sanitize_key( $key ) {
1326
+		public function sanitize_key($key) {
1327 1327
 			$raw_key = $key;
1328
-			$key     = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );
1328
+			$key     = preg_replace('`[^A-Za-z0-9_-]`', '', $key);
1329 1329
 
1330 1330
 			/**
1331 1331
 			* Filter a sanitized key string.
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 			* @param string $key     Sanitized key.
1336 1336
 			* @param string $raw_key The key prior to sanitization.
1337 1337
 			*/
1338
-			return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key );
1338
+			return apply_filters('tgmpa_sanitize_key', $key, $raw_key);
1339 1339
 		}
1340 1340
 
1341 1341
 		/**
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 		 *
1346 1346
 		 * @param array $config Array of config options to pass as class properties.
1347 1347
 		 */
1348
-		public function config( $config ) {
1348
+		public function config($config) {
1349 1349
 
1350 1350
 			$keys = array(
1351 1351
 				'id',
@@ -1361,12 +1361,12 @@  discard block
 block discarded – undo
1361 1361
 				'strings',
1362 1362
 			);
1363 1363
 
1364
-			foreach ( $keys as $key ) {
1365
-				if ( isset( $config[ $key ] ) ) {
1366
-					if ( is_array( $config[ $key ] ) ) {
1367
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1364
+			foreach ($keys as $key) {
1365
+				if (isset($config[$key])) {
1366
+					if (is_array($config[$key])) {
1367
+						$this->$key = array_merge($this->$key, $config[$key]);
1368 1368
 					} else {
1369
-						$this->$key = $config[ $key ];
1369
+						$this->$key = $config[$key];
1370 1370
 					}
1371 1371
 				}
1372 1372
 			}
@@ -1382,10 +1382,10 @@  discard block
 block discarded – undo
1382 1382
 		 *
1383 1383
 		 * @return array Amended array of actions.
1384 1384
 		 */
1385
-		public function actions( $install_actions ) {
1385
+		public function actions($install_actions) {
1386 1386
 
1387 1387
 			// Remove action links on the TGMPA install page.
1388
-			if ( $this->is_tgmpa_page() ) {
1388
+			if ($this->is_tgmpa_page()) {
1389 1389
 				return false;
1390 1390
 			}
1391 1391
 
@@ -1402,9 +1402,9 @@  discard block
 block discarded – undo
1402 1402
 		 * @param bool $clear_update_cache Optional. Whether to clear the Plugin updates cache.
1403 1403
 		 *                                 Parameter added in v2.5.0.
1404 1404
 		 */
1405
-		public function flush_plugins_cache( $clear_update_cache = true ) {
1405
+		public function flush_plugins_cache($clear_update_cache = true) {
1406 1406
 
1407
-			wp_clean_plugins_cache( $clear_update_cache );
1407
+			wp_clean_plugins_cache($clear_update_cache);
1408 1408
 
1409 1409
 		}
1410 1410
 
@@ -1416,15 +1416,15 @@  discard block
 block discarded – undo
1416 1416
 		 * @param string $plugin_slug Optional. If set, only (re-)populates the file path for that specific plugin.
1417 1417
 		 *                            Parameter added in v2.5.0.
1418 1418
 		 */
1419
-		public function populate_file_path( $plugin_slug = '' ) {
1419
+		public function populate_file_path($plugin_slug = '') {
1420 1420
 
1421
-			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1422
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1421
+			if (!empty($plugin_slug) && is_string($plugin_slug) && isset($this->plugins[$plugin_slug])) {
1422
+				$this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug($plugin_slug);
1423 1423
 
1424 1424
 			} else {
1425 1425
 				// Add file_path key for all plugins.
1426
-				foreach ( $this->plugins as $slug => $values ) {
1427
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1426
+				foreach ($this->plugins as $slug => $values) {
1427
+					$this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug($slug);
1428 1428
 				}
1429 1429
 			}
1430 1430
 
@@ -1440,12 +1440,12 @@  discard block
 block discarded – undo
1440 1440
 		 *
1441 1441
 		 * @return string Either file path for plugin if installed, or just the plugin slug.
1442 1442
 		 */
1443
-		protected function _get_plugin_basename_from_slug( $slug ) {
1443
+		protected function _get_plugin_basename_from_slug($slug) {
1444 1444
 
1445
-			$keys = array_keys( $this->get_plugins() );
1445
+			$keys = array_keys($this->get_plugins());
1446 1446
 
1447
-			foreach ( $keys as $key ) {
1448
-				if ( preg_match( '|^' . $slug . '/|', $key ) ) {
1447
+			foreach ($keys as $key) {
1448
+				if (preg_match('|^'.$slug.'/|', $key)) {
1449 1449
 					return $key;
1450 1450
 				}
1451 1451
 			}
@@ -1467,11 +1467,11 @@  discard block
 block discarded – undo
1467 1467
 		 *
1468 1468
 		 * @return string|boolean Plugin slug if found, false otherwise.
1469 1469
 		 */
1470
-		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1470
+		public function _get_plugin_data_from_name($name, $data = 'slug') {
1471 1471
 
1472
-			foreach ( $this->plugins as $values ) {
1473
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1474
-					return $values[ $data ];
1472
+			foreach ($this->plugins as $values) {
1473
+				if ($name === $values['name'] && isset($values[$data])) {
1474
+					return $values[$data];
1475 1475
 				}
1476 1476
 			}
1477 1477
 
@@ -1488,20 +1488,20 @@  discard block
 block discarded – undo
1488 1488
 		 *
1489 1489
 		 * @return string Plugin download URL or path to local file or empty string if undetermined.
1490 1490
 		 */
1491
-		public function get_download_url( $slug ) {
1491
+		public function get_download_url($slug) {
1492 1492
 
1493 1493
 			$dl_source = '';
1494 1494
 
1495
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1495
+			switch ($this->plugins[$slug]['source_type']) {
1496 1496
 
1497 1497
 				case 'repo':
1498
-					return $this->get_wp_repo_download_url( $slug );
1498
+					return $this->get_wp_repo_download_url($slug);
1499 1499
 
1500 1500
 				case 'external':
1501
-					return $this->plugins[ $slug ]['source'];
1501
+					return $this->plugins[$slug]['source'];
1502 1502
 
1503 1503
 				case 'bundled':
1504
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1504
+					return $this->default_path.$this->plugins[$slug]['source'];
1505 1505
 			}
1506 1506
 
1507 1507
 			return $dl_source; // Should never happen.
@@ -1516,12 +1516,12 @@  discard block
 block discarded – undo
1516 1516
 		 *
1517 1517
 		 * @return string Plugin download URL.
1518 1518
 		 */
1519
-		protected function get_wp_repo_download_url( $slug ) {
1519
+		protected function get_wp_repo_download_url($slug) {
1520 1520
 
1521 1521
 			$source = '';
1522
-			$api    = $this->get_plugins_api( $slug );
1522
+			$api    = $this->get_plugins_api($slug);
1523 1523
 
1524
-			if ( false !== $api && isset( $api->download_link ) ) {
1524
+			if (false !== $api && isset($api->download_link)) {
1525 1525
 				$source = $api->download_link;
1526 1526
 			}
1527 1527
 
@@ -1538,27 +1538,27 @@  discard block
 block discarded – undo
1538 1538
 		 *
1539 1539
 		 * @return object Plugins_api response object on success, WP_Error on failure.
1540 1540
 		 */
1541
-		protected function get_plugins_api( $slug ) {
1541
+		protected function get_plugins_api($slug) {
1542 1542
 			static $api = array(); // Cache received responses.
1543 1543
 
1544
-			if ( ! isset( $api[ $slug ] ) ) {
1544
+			if (!isset($api[$slug])) {
1545 1545
 
1546
-				if ( ! function_exists( 'plugins_api' ) ) {
1547
-					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1546
+				if (!function_exists('plugins_api')) {
1547
+					require_once ABSPATH.'wp-admin/includes/plugin-install.php';
1548 1548
 				}
1549 1549
 
1550
-				$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
1550
+				$response = plugins_api('plugin_information', array('slug' => $slug, 'fields' => array('sections' => false)));
1551 1551
 
1552
-				$api[ $slug ] = false;
1552
+				$api[$slug] = false;
1553 1553
 
1554
-				if ( is_wp_error( $response ) ) {
1555
-					wp_die( esc_html( $this->strings['oops'] ) );
1554
+				if (is_wp_error($response)) {
1555
+					wp_die(esc_html($this->strings['oops']));
1556 1556
 				} else {
1557
-					$api[ $slug ] = $response;
1557
+					$api[$slug] = $response;
1558 1558
 				}
1559 1559
 			}
1560 1560
 
1561
-			return $api[ $slug ];
1561
+			return $api[$slug];
1562 1562
 		}
1563 1563
 
1564 1564
 		/**
@@ -1571,35 +1571,35 @@  discard block
 block discarded – undo
1571 1571
 		 * @return string Fully formed html link to a plugin information page if available
1572 1572
 		 *                or the plugin name if not.
1573 1573
 		 */
1574
-		public function get_info_link( $slug ) {
1574
+		public function get_info_link($slug) {
1575 1575
 
1576
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1576
+			if (!empty($this->plugins[$slug]['external_url']) && preg_match(self::IS_URL_REGEX, $this->plugins[$slug]['external_url'])) {
1577 1577
 				$link = sprintf(
1578 1578
 					'<a href="%1$s" target="_blank">%2$s</a>',
1579
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1580
-					esc_html( $this->plugins[ $slug ]['name'] )
1579
+					esc_url($this->plugins[$slug]['external_url']),
1580
+					esc_html($this->plugins[$slug]['name'])
1581 1581
 				);
1582 1582
 
1583
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1583
+			} elseif ('repo' === $this->plugins[$slug]['source_type']) {
1584 1584
 				$url = add_query_arg(
1585 1585
 					array(
1586 1586
 						'tab'       => 'plugin-information',
1587
-						'plugin'    => urlencode( $slug ),
1587
+						'plugin'    => urlencode($slug),
1588 1588
 						'TB_iframe' => 'true',
1589 1589
 						'width'     => '640',
1590 1590
 						'height'    => '500',
1591 1591
 					),
1592
-					self_admin_url( 'plugin-install.php' )
1592
+					self_admin_url('plugin-install.php')
1593 1593
 				);
1594 1594
 
1595 1595
 				$link = sprintf(
1596 1596
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1597
-					esc_url( $url ),
1598
-					esc_html( $this->plugins[ $slug ]['name'] )
1597
+					esc_url($url),
1598
+					esc_html($this->plugins[$slug]['name'])
1599 1599
 				);
1600 1600
 
1601 1601
 			} else {
1602
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1602
+				$link = esc_html($this->plugins[$slug]['name']); // No hyperlink.
1603 1603
 			}
1604 1604
 
1605 1605
 			return $link;
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		 */
1615 1615
 		protected function is_tgmpa_page() {
1616 1616
 
1617
-			return isset( $_GET['page'] ) && $this->menu === $_GET['page'];
1617
+			return isset($_GET['page']) && $this->menu === $_GET['page'];
1618 1618
 
1619 1619
 		}
1620 1620
 
@@ -1631,16 +1631,16 @@  discard block
 block discarded – undo
1631 1631
 		public function get_tgmpa_url() {
1632 1632
 			static $url;
1633 1633
 
1634
-			if ( ! isset( $url ) ) {
1634
+			if (!isset($url)) {
1635 1635
 				$parent = $this->parent_slug;
1636
-				if ( false === strpos( $parent, '.php' ) ) {
1636
+				if (false === strpos($parent, '.php')) {
1637 1637
 					$parent = 'admin.php';
1638 1638
 				}
1639 1639
 				$url = add_query_arg(
1640 1640
 					array(
1641
-						'page' => urlencode( $this->menu ),
1641
+						'page' => urlencode($this->menu),
1642 1642
 					),
1643
-					self_admin_url( $parent )
1643
+					self_admin_url($parent)
1644 1644
 				);
1645 1645
 			}
1646 1646
 
@@ -1659,10 +1659,10 @@  discard block
 block discarded – undo
1659 1659
 		 *
1660 1660
 		 * @return string Properly encoded URL (not escaped).
1661 1661
 		 */
1662
-		public function get_tgmpa_status_url( $status ) {
1662
+		public function get_tgmpa_status_url($status) {
1663 1663
 			return add_query_arg(
1664 1664
 				array(
1665
-					'plugin_status' => urlencode( $status ),
1665
+					'plugin_status' => urlencode($status),
1666 1666
 				),
1667 1667
 				$this->get_tgmpa_url()
1668 1668
 			);
@@ -1677,8 +1677,8 @@  discard block
 block discarded – undo
1677 1677
 		 */
1678 1678
 		public function is_tgmpa_complete() {
1679 1679
 			$complete = true;
1680
-			foreach ( $this->plugins as $slug => $plugin ) {
1681
-				if ( ! $this->is_plugin_active( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
1680
+			foreach ($this->plugins as $slug => $plugin) {
1681
+				if (!$this->is_plugin_active($slug) || false !== $this->does_plugin_have_update($slug)) {
1682 1682
 					$complete = false;
1683 1683
 					break;
1684 1684
 				}
@@ -1696,9 +1696,9 @@  discard block
 block discarded – undo
1696 1696
 		 *
1697 1697
 		 * @return bool True if installed, false otherwise.
1698 1698
 		 */
1699
-		public function is_plugin_installed( $slug ) {
1699
+		public function is_plugin_installed($slug) {
1700 1700
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1701
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1701
+			return (!empty($installed_plugins[$this->plugins[$slug]['file_path']]));
1702 1702
 		}
1703 1703
 
1704 1704
 		/**
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
 		 *
1711 1711
 		 * @return bool True if active, false otherwise.
1712 1712
 		 */
1713
-		public function is_plugin_active( $slug ) {
1714
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1713
+		public function is_plugin_active($slug) {
1714
+			return ((!empty($this->plugins[$slug]['is_callable']) && is_callable($this->plugins[$slug]['is_callable'])) || is_plugin_active($this->plugins[$slug]['file_path']));
1715 1715
 		}
1716 1716
 
1717 1717
 		/**
@@ -1724,17 +1724,17 @@  discard block
 block discarded – undo
1724 1724
 		 *
1725 1725
 		 * @return bool True if OK to update, false otherwise.
1726 1726
 		 */
1727
-		public function can_plugin_update( $slug ) {
1727
+		public function can_plugin_update($slug) {
1728 1728
 
1729 1729
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1730
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1730
+			if ('repo' !== $this->plugins[$slug]['source_type']) {
1731 1731
 				return true;
1732 1732
 			}
1733 1733
 
1734
-			$api = $this->get_plugins_api( $slug );
1734
+			$api = $this->get_plugins_api($slug);
1735 1735
 
1736
-			if ( false !== $api && isset( $api->requires ) ) {
1737
-				return version_compare( $GLOBALS['wp_version'], $api->requires, '>=' );
1736
+			if (false !== $api && isset($api->requires)) {
1737
+				return version_compare($GLOBALS['wp_version'], $api->requires, '>=');
1738 1738
 			}
1739 1739
 
1740 1740
 			// No usable info received from the plugins API, presume we can update.
@@ -1751,8 +1751,8 @@  discard block
 block discarded – undo
1751 1751
 		 *
1752 1752
 		 * @return bool True if OK to activate, false otherwise.
1753 1753
 		 */
1754
-		public function can_plugin_activate( $slug ) {
1755
-			return ( ! $this->is_plugin_active( $slug ) && ! $this->does_plugin_require_update( $slug ) );
1754
+		public function can_plugin_activate($slug) {
1755
+			return (!$this->is_plugin_active($slug) && !$this->does_plugin_require_update($slug));
1756 1756
 		}
1757 1757
 
1758 1758
 		/**
@@ -1765,12 +1765,12 @@  discard block
 block discarded – undo
1765 1765
 		 * @return string Version number as string or an empty string if the plugin is not installed
1766 1766
 		 *                or version unknown (plugins which don't comply with the plugin header standard).
1767 1767
 		 */
1768
-		public function get_installed_version( $slug ) {
1768
+		public function get_installed_version($slug) {
1769 1769
 
1770 1770
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1771 1771
 
1772
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1773
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1772
+			if (!empty($installed_plugins[$this->plugins[$slug]['file_path']]['Version'])) {
1773
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1774 1774
 			}
1775 1775
 
1776 1776
 			return '';
@@ -1785,11 +1785,11 @@  discard block
 block discarded – undo
1785 1785
 		 *
1786 1786
 		 * @return bool True when a plugin needs to be updated, otherwise false.
1787 1787
 		 */
1788
-		public function does_plugin_require_update( $slug ) {
1789
-			$installed_version = $this->get_installed_version( $slug );
1790
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1788
+		public function does_plugin_require_update($slug) {
1789
+			$installed_version = $this->get_installed_version($slug);
1790
+			$minimum_version   = $this->plugins[$slug]['version'];
1791 1791
 
1792
-			return version_compare( $minimum_version, $installed_version, '>' );
1792
+			return version_compare($minimum_version, $installed_version, '>');
1793 1793
 		}
1794 1794
 
1795 1795
 		/**
@@ -1801,20 +1801,20 @@  discard block
 block discarded – undo
1801 1801
 		 *
1802 1802
 		 * @return false|string Version number string of the available update or false if no update available.
1803 1803
 		 */
1804
-		public function does_plugin_have_update( $slug ) {
1804
+		public function does_plugin_have_update($slug) {
1805 1805
 
1806 1806
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1807
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1808
-				if ( $this->does_plugin_require_update( $slug ) ) {
1809
-					return $this->plugins[ $slug ]['version'];
1807
+			if ('repo' !== $this->plugins[$slug]['source_type']) {
1808
+				if ($this->does_plugin_require_update($slug)) {
1809
+					return $this->plugins[$slug]['version'];
1810 1810
 				}
1811 1811
 				return false;
1812 1812
 			}
1813 1813
 
1814
-			$repo_updates = get_site_transient( 'update_plugins' );
1814
+			$repo_updates = get_site_transient('update_plugins');
1815 1815
 
1816
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1817
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1816
+			if (isset($repo_updates->response[$this->plugins[$slug]['file_path']]->new_version)) {
1817
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1818 1818
 			}
1819 1819
 
1820 1820
 			return false;
@@ -1829,17 +1829,17 @@  discard block
 block discarded – undo
1829 1829
 		 *
1830 1830
 		 * @return string The upgrade notice or an empty string if no message was available or provided.
1831 1831
 		 */
1832
-		public function get_upgrade_notice( $slug ) {
1832
+		public function get_upgrade_notice($slug) {
1833 1833
 
1834 1834
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1835
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1835
+			if ('repo' !== $this->plugins[$slug]['source_type']) {
1836 1836
 				return '';
1837 1837
 			}
1838 1838
 
1839
-			$repo_updates = get_site_transient( 'update_plugins' );
1839
+			$repo_updates = get_site_transient('update_plugins');
1840 1840
 
1841
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
1842
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
1841
+			if (!empty($repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice)) {
1842
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
1843 1843
 			}
1844 1844
 
1845 1845
 			return '';
@@ -1854,12 +1854,12 @@  discard block
 block discarded – undo
1854 1854
 		 *
1855 1855
 		 * @return array Array of installed plugins with plugin information.
1856 1856
 		 */
1857
-		public function get_plugins( $plugin_folder = '' ) {
1858
-			if ( ! function_exists( 'get_plugins' ) ) {
1859
-				require_once ABSPATH . 'wp-admin/includes/plugin.php';
1857
+		public function get_plugins($plugin_folder = '') {
1858
+			if (!function_exists('get_plugins')) {
1859
+				require_once ABSPATH.'wp-admin/includes/plugin.php';
1860 1860
 			}
1861 1861
 
1862
-			return get_plugins( $plugin_folder );
1862
+			return get_plugins($plugin_folder);
1863 1863
 		}
1864 1864
 
1865 1865
 		/**
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 		 */
1873 1873
 		public function update_dismiss() {
1874 1874
 
1875
-			delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true );
1875
+			delete_metadata('user', null, 'tgmpa_dismissed_notice_'.$this->id, null, true);
1876 1876
 
1877 1877
 		}
1878 1878
 
@@ -1892,16 +1892,16 @@  discard block
 block discarded – undo
1892 1892
 		 */
1893 1893
 		public function force_activation() {
1894 1894
 
1895
-			foreach ( $this->plugins as $slug => $plugin ) {
1896
-				if ( true === $plugin['force_activation'] ) {
1895
+			foreach ($this->plugins as $slug => $plugin) {
1896
+				if (true === $plugin['force_activation']) {
1897 1897
 
1898
-					if ( ! $this->is_plugin_installed( $slug ) ) {
1898
+					if (!$this->is_plugin_installed($slug)) {
1899 1899
 						// Oops, plugin isn't there so iterate to next condition.
1900 1900
 						continue;
1901 1901
 
1902
-					} elseif ( $this->can_plugin_activate( $slug ) ) {
1902
+					} elseif ($this->can_plugin_activate($slug)) {
1903 1903
 						// There we go, activate the plugin.
1904
-						activate_plugin( $plugin['file_path'] );
1904
+						activate_plugin($plugin['file_path']);
1905 1905
 					}
1906 1906
 				}
1907 1907
 			}
@@ -1922,10 +1922,10 @@  discard block
 block discarded – undo
1922 1922
 		 */
1923 1923
 		public function force_deactivation() {
1924 1924
 
1925
-			foreach ( $this->plugins as $slug => $plugin ) {
1925
+			foreach ($this->plugins as $slug => $plugin) {
1926 1926
 				// Only proceed forward if the parameter is set to true and plugin is active.
1927
-				if ( true === $plugin['force_deactivation'] && $this->is_plugin_active( $slug ) ) {
1928
-					deactivate_plugins( $plugin['file_path'] );
1927
+				if (true === $plugin['force_deactivation'] && $this->is_plugin_active($slug)) {
1928
+					deactivate_plugins($plugin['file_path']);
1929 1929
 				}
1930 1930
 			}
1931 1931
 
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
 		 */
1937 1937
 		public function show_tgmpa_version() {
1938 1938
 			echo '<p style="float: right; padding: 0em 1.5em 0.5em 0;"><strong><small>',
1939
-				esc_html( sprintf( _x( 'TGMPA v%s', '%s = version number', 'tgmpa' ), self::TGMPA_VERSION ) ),
1939
+				esc_html(sprintf(_x('TGMPA v%s', '%s = version number', 'tgmpa'), self::TGMPA_VERSION)),
1940 1940
 				'</small></strong></p>';
1941 1941
 		}
1942 1942
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 		 */
1950 1950
 		public static function get_instance() {
1951 1951
 
1952
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
1952
+			if (!isset(self::$instance) && !(self::$instance instanceof self)) {
1953 1953
 				self::$instance = new self();
1954 1954
 			}
1955 1955
 
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
 
1960 1960
 	}
1961 1961
 
1962
-	if ( ! function_exists( 'load_tgm_plugin_activation' ) ) {
1962
+	if (!function_exists('load_tgm_plugin_activation')) {
1963 1963
 		/**
1964 1964
 		 * Ensure only one instance of the class is ever invoked.
1965 1965
 		 */
@@ -1968,14 +1968,14 @@  discard block
 block discarded – undo
1968 1968
 		}
1969 1969
 	}
1970 1970
 
1971
-	if ( did_action( 'plugins_loaded' ) ) {
1971
+	if (did_action('plugins_loaded')) {
1972 1972
 		load_tgm_plugin_activation();
1973 1973
 	} else {
1974
-		add_action( 'plugins_loaded', 'load_tgm_plugin_activation' );
1974
+		add_action('plugins_loaded', 'load_tgm_plugin_activation');
1975 1975
 	}
1976 1976
 }
1977 1977
 
1978
-if ( ! function_exists( 'tgmpa' ) ) {
1978
+if (!function_exists('tgmpa')) {
1979 1979
 	/**
1980 1980
 	 * Helper function to register a collection of required plugins.
1981 1981
 	 *
@@ -1985,15 +1985,15 @@  discard block
 block discarded – undo
1985 1985
 	 * @param array $plugins An array of plugin arrays.
1986 1986
 	 * @param array $config  Optional. An array of configuration values.
1987 1987
 	 */
1988
-	function tgmpa( $plugins, $config = array() ) {
1989
-		$instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
1988
+	function tgmpa($plugins, $config = array()) {
1989
+		$instance = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
1990 1990
 
1991
-		foreach ( $plugins as $plugin ) {
1992
-			call_user_func( array( $instance, 'register' ), $plugin );
1991
+		foreach ($plugins as $plugin) {
1992
+			call_user_func(array($instance, 'register'), $plugin);
1993 1993
 		}
1994 1994
 
1995
-		if ( ! empty( $config ) && is_array( $config ) ) {
1996
-			call_user_func( array( $instance, 'config' ), $config );
1995
+		if (!empty($config) && is_array($config)) {
1996
+			call_user_func(array($instance, 'config'), $config);
1997 1997
 		}
1998 1998
 	}
1999 1999
 }
@@ -2004,11 +2004,11 @@  discard block
 block discarded – undo
2004 2004
  *
2005 2005
  * @since 2.2.0
2006 2006
  */
2007
-if ( ! class_exists( 'WP_List_Table' ) ) {
2008
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
2007
+if (!class_exists('WP_List_Table')) {
2008
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
2009 2009
 }
2010 2010
 
2011
-if ( ! class_exists( 'TGMPA_List_Table' ) ) {
2011
+if (!class_exists('TGMPA_List_Table')) {
2012 2012
 
2013 2013
 	/**
2014 2014
 	 * List table class for handling plugins.
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
 		 * @since 2.2.0
2069 2069
 		 */
2070 2070
 		public function __construct() {
2071
-			$this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
2071
+			$this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
2072 2072
 
2073 2073
 			parent::__construct(
2074 2074
 				array(
@@ -2078,11 +2078,11 @@  discard block
 block discarded – undo
2078 2078
 				)
2079 2079
 			);
2080 2080
 
2081
-			if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) {
2082
-				$this->view_context = sanitize_key( $_REQUEST['plugin_status'] );
2081
+			if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('install', 'update', 'activate'), true)) {
2082
+				$this->view_context = sanitize_key($_REQUEST['plugin_status']);
2083 2083
 			}
2084 2084
 
2085
-			add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) );
2085
+			add_filter('tgmpa_table_data_items', array($this, 'sort_table_items'));
2086 2086
 		}
2087 2087
 
2088 2088
 		/**
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 		 * @return array CSS classnames.
2096 2096
 		 */
2097 2097
 		public function get_table_classes() {
2098
-			return array( 'widefat', 'fixed' );
2098
+			return array('widefat', 'fixed');
2099 2099
 		}
2100 2100
 
2101 2101
 		/**
@@ -2115,38 +2115,38 @@  discard block
 block discarded – undo
2115 2115
 			$plugins = $this->categorize_plugins_to_views();
2116 2116
 
2117 2117
 			// Set the counts for the view links.
2118
-			$this->set_view_totals( $plugins );
2118
+			$this->set_view_totals($plugins);
2119 2119
 
2120 2120
 			// Prep variables for use and grab list of all installed plugins.
2121 2121
 			$table_data = array();
2122 2122
 			$i          = 0;
2123 2123
 
2124 2124
 			// Redirect to the 'all' view if no plugins where found for the selected view context.
2125
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2125
+			if (empty($plugins[$this->view_context])) {
2126 2126
 				$this->view_context = 'all';
2127 2127
 			}
2128 2128
 
2129
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2129
+			foreach ($plugins[$this->view_context] as $slug => $plugin) {
2130 2130
 
2131
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2132
-				$table_data[ $i ]['slug']              = $slug;
2133
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2134
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2135
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2136
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2137
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2138
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2139
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2131
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2132
+				$table_data[$i]['slug']              = $slug;
2133
+				$table_data[$i]['plugin']            = '<strong>'.$this->tgmpa->get_info_link($slug).'</strong>';
2134
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text($plugin['source_type']);
2135
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text($plugin['required']);
2136
+				$table_data[$i]['status']            = $this->get_plugin_status_text($slug);
2137
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version($slug);
2138
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2139
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update($slug);
2140 2140
 
2141 2141
 				// Prep the upgrade notice info.
2142
-				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2143
-				if ( ! empty( $upgrade_notice ) ) {
2144
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2142
+				$upgrade_notice = $this->tgmpa->get_upgrade_notice($slug);
2143
+				if (!empty($upgrade_notice)) {
2144
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2145 2145
 
2146
-					add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2146
+					add_action("tgmpa_after_plugin_row_$slug", array($this, 'wp_plugin_update_row'), 10, 2);
2147 2147
 				}
2148 2148
 
2149
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2149
+				$table_data[$i] = apply_filters('tgmpa_table_data_item', $table_data[$i], $plugin);
2150 2150
 
2151 2151
 				$i++;
2152 2152
 			}
@@ -2169,25 +2169,25 @@  discard block
 block discarded – undo
2169 2169
 				'activate' => array(),
2170 2170
 			);
2171 2171
 
2172
-			foreach ( $this->tgmpa->plugins as $slug => $plugin ) {
2172
+			foreach ($this->tgmpa->plugins as $slug => $plugin) {
2173 2173
 
2174
-				if ( $this->tgmpa->is_plugin_active( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) {
2174
+				if ($this->tgmpa->is_plugin_active($slug) && false === $this->tgmpa->does_plugin_have_update($slug)) {
2175 2175
 					// No need to display plugins if they are installed, up-to-date and active.
2176 2176
 					continue;
2177 2177
 
2178 2178
 				} else {
2179
-					$plugins['all'][ $slug ] = $plugin;
2179
+					$plugins['all'][$slug] = $plugin;
2180 2180
 
2181
-					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2182
-						$plugins['install'][ $slug ] = $plugin;
2181
+					if (!$this->tgmpa->is_plugin_installed($slug)) {
2182
+						$plugins['install'][$slug] = $plugin;
2183 2183
 
2184 2184
 					} else {
2185
-						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2186
-							$plugins['update'][ $slug ] = $plugin;
2185
+						if (false !== $this->tgmpa->does_plugin_have_update($slug)) {
2186
+							$plugins['update'][$slug] = $plugin;
2187 2187
 						}
2188 2188
 
2189
-						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2190
-							$plugins['activate'][ $slug ] = $plugin;
2189
+						if ($this->tgmpa->can_plugin_activate($slug)) {
2190
+							$plugins['activate'][$slug] = $plugin;
2191 2191
 						}
2192 2192
 					}
2193 2193
 				}
@@ -2203,10 +2203,10 @@  discard block
 block discarded – undo
2203 2203
 		 *
2204 2204
 		 * @param array $plugins Plugins order by view.
2205 2205
 		 */
2206
-		protected function set_view_totals( $plugins ) {
2206
+		protected function set_view_totals($plugins) {
2207 2207
 
2208
-			foreach ( $plugins as $type => $list ) {
2209
-				$this->view_totals[ $type ] = count( $list );
2208
+			foreach ($plugins as $type => $list) {
2209
+				$this->view_totals[$type] = count($list);
2210 2210
 			}
2211 2211
 		}
2212 2212
 
@@ -2219,13 +2219,13 @@  discard block
 block discarded – undo
2219 2219
 		 *
2220 2220
 		 * @return string
2221 2221
 		 */
2222
-		protected function get_plugin_advise_type_text( $required ) {
2222
+		protected function get_plugin_advise_type_text($required) {
2223 2223
 
2224
-			if ( true === $required ) {
2225
-				return __( 'Required', 'tgmpa' );
2224
+			if (true === $required) {
2225
+				return __('Required', 'tgmpa');
2226 2226
 			}
2227 2227
 
2228
-			return __( 'Recommended', 'tgmpa' );
2228
+			return __('Recommended', 'tgmpa');
2229 2229
 		}
2230 2230
 
2231 2231
 		/**
@@ -2237,20 +2237,20 @@  discard block
 block discarded – undo
2237 2237
 		 *
2238 2238
 		 * @return string
2239 2239
 		 */
2240
-		protected function get_plugin_source_type_text( $type ) {
2240
+		protected function get_plugin_source_type_text($type) {
2241 2241
 			$string = '';
2242 2242
 
2243
-			switch ( $type ) {
2243
+			switch ($type) {
2244 2244
 				case 'repo':
2245
-					$string = __( 'WordPress Repository', 'tgmpa' );
2245
+					$string = __('WordPress Repository', 'tgmpa');
2246 2246
 					break;
2247 2247
 
2248 2248
 				case 'external':
2249
-					$string = __( 'External Source', 'tgmpa' );
2249
+					$string = __('External Source', 'tgmpa');
2250 2250
 					break;
2251 2251
 
2252 2252
 				case 'bundled':
2253
-					$string = __( 'Pre-Packaged', 'tgmpa' );
2253
+					$string = __('Pre-Packaged', 'tgmpa');
2254 2254
 					break;
2255 2255
 			}
2256 2256
 
@@ -2266,36 +2266,36 @@  discard block
 block discarded – undo
2266 2266
 		 *
2267 2267
 		 * @return string
2268 2268
 		 */
2269
-		protected function get_plugin_status_text( $slug ) {
2269
+		protected function get_plugin_status_text($slug) {
2270 2270
 
2271
-			if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2272
-				return __( 'Not Installed', 'tgmpa' );
2271
+			if (!$this->tgmpa->is_plugin_installed($slug)) {
2272
+				return __('Not Installed', 'tgmpa');
2273 2273
 			}
2274 2274
 
2275
-			if ( ! $this->tgmpa->is_plugin_active( $slug ) ) {
2276
-				$install_status = __( 'Installed But Not Activated', 'tgmpa' );
2275
+			if (!$this->tgmpa->is_plugin_active($slug)) {
2276
+				$install_status = __('Installed But Not Activated', 'tgmpa');
2277 2277
 			} else {
2278
-				$install_status = __( 'Active', 'tgmpa' );
2278
+				$install_status = __('Active', 'tgmpa');
2279 2279
 			}
2280 2280
 
2281 2281
 			$update_status = '';
2282 2282
 
2283
-			if ( $this->tgmpa->does_plugin_require_update( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) {
2284
-				$update_status = __( 'Required Update not Available', 'tgmpa' );
2283
+			if ($this->tgmpa->does_plugin_require_update($slug) && false === $this->tgmpa->does_plugin_have_update($slug)) {
2284
+				$update_status = __('Required Update not Available', 'tgmpa');
2285 2285
 
2286
-			} elseif ( $this->tgmpa->does_plugin_require_update( $slug ) ) {
2287
-				$update_status = __( 'Requires Update', 'tgmpa' );
2286
+			} elseif ($this->tgmpa->does_plugin_require_update($slug)) {
2287
+				$update_status = __('Requires Update', 'tgmpa');
2288 2288
 
2289
-			} elseif ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2290
-				$update_status = __( 'Update recommended', 'tgmpa' );
2289
+			} elseif (false !== $this->tgmpa->does_plugin_have_update($slug)) {
2290
+				$update_status = __('Update recommended', 'tgmpa');
2291 2291
 			}
2292 2292
 
2293
-			if ( '' === $update_status ) {
2293
+			if ('' === $update_status) {
2294 2294
 				return $install_status;
2295 2295
 			}
2296 2296
 
2297 2297
 			return sprintf(
2298
-				_x( '%1$s, %2$s', '%1$s = install status, %2$s = update status', 'tgmpa' ),
2298
+				_x('%1$s, %2$s', '%1$s = install status, %2$s = update status', 'tgmpa'),
2299 2299
 				$install_status,
2300 2300
 				$update_status
2301 2301
 			);
@@ -2310,17 +2310,17 @@  discard block
 block discarded – undo
2310 2310
 		 *
2311 2311
 		 * @return array Sorted table items.
2312 2312
 		 */
2313
-		public function sort_table_items( $items ) {
2313
+		public function sort_table_items($items) {
2314 2314
 
2315 2315
 			$type = array();
2316 2316
 			$name = array();
2317 2317
 
2318
-			foreach ( $items as $i => $plugin ) {
2319
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2320
-				$name[ $i ] = $plugin['sanitized_plugin'];
2318
+			foreach ($items as $i => $plugin) {
2319
+				$type[$i] = $plugin['type']; // Required / recommended.
2320
+				$name[$i] = $plugin['sanitized_plugin'];
2321 2321
 			}
2322 2322
 
2323
-			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
2323
+			array_multisort($type, SORT_DESC, $name, SORT_ASC, $items);
2324 2324
 
2325 2325
 			return $items;
2326 2326
 
@@ -2337,26 +2337,26 @@  discard block
 block discarded – undo
2337 2337
 
2338 2338
 			$status_links = array();
2339 2339
 
2340
-			foreach ( $this->view_totals as $type => $count ) {
2341
-				if ( $count < 1 ) {
2340
+			foreach ($this->view_totals as $type => $count) {
2341
+				if ($count < 1) {
2342 2342
 					continue;
2343 2343
 				}
2344 2344
 
2345
-				switch ( $type ) {
2345
+				switch ($type) {
2346 2346
 					case 'all':
2347
-						$text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'tgmpa' );
2347
+						$text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'tgmpa');
2348 2348
 						break;
2349 2349
 
2350 2350
 					case 'install':
2351
-						$text = _n( 'To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'tgmpa' );
2351
+						$text = _n('To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'tgmpa');
2352 2352
 						break;
2353 2353
 
2354 2354
 					case 'update':
2355
-						$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'tgmpa' );
2355
+						$text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'tgmpa');
2356 2356
 						break;
2357 2357
 
2358 2358
 					case 'activate':
2359
-						$text = _n( 'To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'tgmpa' );
2359
+						$text = _n('To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'tgmpa');
2360 2360
 						break;
2361 2361
 
2362 2362
 					default:
@@ -2364,13 +2364,13 @@  discard block
 block discarded – undo
2364 2364
 						break;
2365 2365
 				}
2366 2366
 
2367
-				if ( ! empty( $text ) ) {
2367
+				if (!empty($text)) {
2368 2368
 
2369
-					$status_links[ $type ] = sprintf(
2369
+					$status_links[$type] = sprintf(
2370 2370
 						'<a href="%s"%s>%s</a>',
2371
-						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2372
-						( $type === $this->view_context ) ? ' class="current"' : '',
2373
-						sprintf( $text, number_format_i18n( $count ) )
2371
+						esc_url($this->tgmpa->get_tgmpa_status_url($type)),
2372
+						($type === $this->view_context) ? ' class="current"' : '',
2373
+						sprintf($text, number_format_i18n($count))
2374 2374
 					);
2375 2375
 				}
2376 2376
 			}
@@ -2389,9 +2389,9 @@  discard block
 block discarded – undo
2389 2389
 		 *
2390 2390
 		 * @return string
2391 2391
 		 */
2392
-		public function column_default( $item, $column_name ) {
2392
+		public function column_default($item, $column_name) {
2393 2393
 
2394
-			return $item[ $column_name ];
2394
+			return $item[$column_name];
2395 2395
 
2396 2396
 		}
2397 2397
 
@@ -2406,13 +2406,13 @@  discard block
 block discarded – undo
2406 2406
 		 *
2407 2407
 		 * @return string     The input checkbox with all necessary info.
2408 2408
 		 */
2409
-		public function column_cb( $item ) {
2409
+		public function column_cb($item) {
2410 2410
 
2411 2411
 			return sprintf(
2412 2412
 				'<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />',
2413
-				esc_attr( $this->_args['singular'] ),
2414
-				esc_attr( $item['slug'] ),
2415
-				esc_attr( $item['sanitized_plugin'] )
2413
+				esc_attr($this->_args['singular']),
2414
+				esc_attr($item['slug']),
2415
+				esc_attr($item['sanitized_plugin'])
2416 2416
 			);
2417 2417
 
2418 2418
 		}
@@ -2426,12 +2426,12 @@  discard block
 block discarded – undo
2426 2426
 		 *
2427 2427
 		 * @return string     The plugin name and action links.
2428 2428
 		 */
2429
-		public function column_plugin( $item ) {
2429
+		public function column_plugin($item) {
2430 2430
 
2431 2431
 			return sprintf(
2432 2432
 				'%1$s %2$s',
2433 2433
 				$item['plugin'],
2434
-				$this->row_actions( $this->get_row_actions( $item ), true )
2434
+				$this->row_actions($this->get_row_actions($item), true)
2435 2435
 			);
2436 2436
 		}
2437 2437
 
@@ -2444,49 +2444,49 @@  discard block
 block discarded – undo
2444 2444
 		 *
2445 2445
 		 * @return string     HTML-formatted version information.
2446 2446
 		 */
2447
-		public function column_version( $item ) {
2447
+		public function column_version($item) {
2448 2448
 
2449 2449
 			$output = array();
2450 2450
 
2451
-			if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) {
2452
-				$installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' );
2451
+			if ($this->tgmpa->is_plugin_installed($item['slug'])) {
2452
+				$installed = !empty($item['installed_version']) ? $item['installed_version'] : _x('unknown', 'as in: "version nr unknown"', 'tgmpa');
2453 2453
 
2454 2454
 				$color = '';
2455
-				if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) {
2455
+				if (!empty($item['minimum_version']) && $this->tgmpa->does_plugin_require_update($item['slug'])) {
2456 2456
 					$color = ' color: #ff0000; font-weight: bold;';
2457 2457
 				}
2458 2458
 
2459 2459
 				$output[] = sprintf(
2460
-					'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>',
2460
+					'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__('Installed version:', 'tgmpa').'</p>',
2461 2461
 					$color,
2462 2462
 					$installed
2463 2463
 				);
2464 2464
 			}
2465 2465
 
2466
-			if ( ! empty( $item['minimum_version'] ) ) {
2466
+			if (!empty($item['minimum_version'])) {
2467 2467
 				$output[] = sprintf(
2468
-					'<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>',
2468
+					'<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>'.__('Minimum required version:', 'tgmpa').'</p>',
2469 2469
 					$item['minimum_version']
2470 2470
 				);
2471 2471
 			}
2472 2472
 
2473
-			if ( ! empty( $item['available_version'] ) ) {
2473
+			if (!empty($item['available_version'])) {
2474 2474
 				$color = '';
2475
-				if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) {
2475
+				if (!empty($item['minimum_version']) && version_compare($item['available_version'], $item['minimum_version'], '>=')) {
2476 2476
 					$color = ' color: #71C671; font-weight: bold;';
2477 2477
 				}
2478 2478
 
2479 2479
 				$output[] = sprintf(
2480
-					'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>',
2480
+					'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>'.__('Available version:', 'tgmpa').'</p>',
2481 2481
 					$color,
2482 2482
 					$item['available_version']
2483 2483
 				);
2484 2484
 			}
2485 2485
 
2486
-			if ( empty( $output ) ) {
2486
+			if (empty($output)) {
2487 2487
 				return '&nbsp;'; // Let's not break the table layout.
2488 2488
 			} else {
2489
-				return implode( "\n", $output );
2489
+				return implode("\n", $output);
2490 2490
 			}
2491 2491
 		}
2492 2492
 
@@ -2501,7 +2501,7 @@  discard block
 block discarded – undo
2501 2501
 		 */
2502 2502
 		public function no_items() {
2503 2503
 
2504
-			printf( wp_kses_post( __( 'No plugins to install, update or activate. <a href="%1$s">Return to the Dashboard</a>', 'tgmpa' ) ), esc_url( self_admin_url() ) );
2504
+			printf(wp_kses_post(__('No plugins to install, update or activate. <a href="%1$s">Return to the Dashboard</a>', 'tgmpa')), esc_url(self_admin_url()));
2505 2505
 			echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
2506 2506
 
2507 2507
 		}
@@ -2517,17 +2517,17 @@  discard block
 block discarded – undo
2517 2517
 
2518 2518
 			$columns = array(
2519 2519
 				'cb'     => '<input type="checkbox" />',
2520
-				'plugin' => __( 'Plugin', 'tgmpa' ),
2521
-				'source' => __( 'Source', 'tgmpa' ),
2522
-				'type'   => __( 'Type', 'tgmpa' ),
2520
+				'plugin' => __('Plugin', 'tgmpa'),
2521
+				'source' => __('Source', 'tgmpa'),
2522
+				'type'   => __('Type', 'tgmpa'),
2523 2523
 			);
2524 2524
 
2525
-			if ( 'all' === $this->view_context || 'update' === $this->view_context ) {
2526
-				$columns['version'] = __( 'Version', 'tgmpa' );
2527
-				$columns['status']  = __( 'Status', 'tgmpa' );
2525
+			if ('all' === $this->view_context || 'update' === $this->view_context) {
2526
+				$columns['version'] = __('Version', 'tgmpa');
2527
+				$columns['status']  = __('Status', 'tgmpa');
2528 2528
 			}
2529 2529
 
2530
-			return apply_filters( 'tgmpa_table_columns', $columns );
2530
+			return apply_filters('tgmpa_table_columns', $columns);
2531 2531
 
2532 2532
 		}
2533 2533
 
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
 		 */
2554 2554
 		protected function get_primary_column_name() {
2555 2555
 
2556
-			if ( method_exists( 'WP_List_Table', 'get_primary_column_name' ) ) {
2556
+			if (method_exists('WP_List_Table', 'get_primary_column_name')) {
2557 2557
 				return parent::get_primary_column_name();
2558 2558
 			} else {
2559 2559
 				return $this->get_default_primary_column_name();
@@ -2569,53 +2569,53 @@  discard block
 block discarded – undo
2569 2569
 		 *
2570 2570
 		 * @return array      Array with relevant action links.
2571 2571
 		 */
2572
-		protected function get_row_actions( $item ) {
2572
+		protected function get_row_actions($item) {
2573 2573
 
2574 2574
 			$actions      = array();
2575 2575
 			$action_links = array();
2576 2576
 
2577 2577
 			// Display the 'Install' action link if the plugin is not yet available.
2578
-			if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) {
2578
+			if (!$this->tgmpa->is_plugin_installed($item['slug'])) {
2579 2579
 
2580
-				$actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
2580
+				$actions['install'] = _x('Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa');
2581 2581
 
2582 2582
 			} else {
2583 2583
 				// Display the 'Update' action link if an update is available and WP complies with plugin minimum.
2584
-				if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) {
2584
+				if (false !== $this->tgmpa->does_plugin_have_update($item['slug']) && $this->tgmpa->can_plugin_update($item['slug'])) {
2585 2585
 
2586
-					$actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
2586
+					$actions['update'] = _x('Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa');
2587 2587
 				}
2588 2588
 
2589 2589
 				// Display the 'Activate' action link, but only if the plugin meets the minimum version.
2590
-				if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) {
2590
+				if ($this->tgmpa->can_plugin_activate($item['slug'])) {
2591 2591
 
2592
-					$actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
2592
+					$actions['activate'] = _x('Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa');
2593 2593
 				}
2594 2594
 			}
2595 2595
 
2596 2596
 			// Create the actual links.
2597
-			foreach ( $actions as $action => $text ) {
2597
+			foreach ($actions as $action => $text) {
2598 2598
 				$nonce_url = wp_nonce_url(
2599 2599
 					add_query_arg(
2600 2600
 						array(
2601
-							'plugin'           => urlencode( $item['slug'] ),
2602
-							'tgmpa-' . $action => $action . '-plugin',
2601
+							'plugin'           => urlencode($item['slug']),
2602
+							'tgmpa-'.$action => $action.'-plugin',
2603 2603
 						),
2604 2604
 						$this->tgmpa->get_tgmpa_url()
2605 2605
 					),
2606
-					'tgmpa-' . $action,
2606
+					'tgmpa-'.$action,
2607 2607
 					'tgmpa-nonce'
2608 2608
 				);
2609 2609
 
2610
-				$action_links[ $action ] = sprintf(
2611
-					'<a href="%1$s">' . esc_html( $text ) . '</a>',
2612
-					esc_url( $nonce_url ),
2613
-					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
2610
+				$action_links[$action] = sprintf(
2611
+					'<a href="%1$s">'.esc_html($text).'</a>',
2612
+					esc_url($nonce_url),
2613
+					'<span class="screen-reader-text">'.esc_html($item['sanitized_plugin']).'</span>'
2614 2614
 				);
2615 2615
 			}
2616 2616
 
2617
-			$prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : '';
2618
-			return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context );
2617
+			$prefix = (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) ? 'network_admin_' : '';
2618
+			return apply_filters("tgmpa_{$prefix}plugin_action_links", array_filter($action_links), $item['slug'], $item, $this->view_context);
2619 2619
 		}
2620 2620
 
2621 2621
 		/**
@@ -2625,9 +2625,9 @@  discard block
 block discarded – undo
2625 2625
 		 *
2626 2626
 		 * @param object $item The current item.
2627 2627
 		 */
2628
-		public function single_row( $item ) {
2628
+		public function single_row($item) {
2629 2629
 
2630
-			parent::single_row( $item );
2630
+			parent::single_row($item);
2631 2631
 
2632 2632
 			/**
2633 2633
 			 * Fires after each specific row in the TGMPA Plugins list table.
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 			 *
2638 2638
 			 * @since 2.5.0
2639 2639
 			 */
2640
-			do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context );
2640
+			do_action("tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context);
2641 2641
 		}
2642 2642
 
2643 2643
 		/**
@@ -2650,18 +2650,18 @@  discard block
 block discarded – undo
2650 2650
 		 * @param string $slug Plugin slug.
2651 2651
 		 * @param array  $item The information available in this table row.
2652 2652
 		 */
2653
-		public function wp_plugin_update_row( $slug, $item ) {
2653
+		public function wp_plugin_update_row($slug, $item) {
2654 2654
 
2655
-			if ( empty( $item['upgrade_notice'] ) ) {
2655
+			if (empty($item['upgrade_notice'])) {
2656 2656
 				return;
2657 2657
 			}
2658 2658
 
2659 2659
 			echo '
2660 2660
 				<tr class="plugin-update-tr">
2661
-					<td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange">
2661
+					<td colspan="', absint($this->get_column_count()), '" class="plugin-update colspanchange">
2662 2662
 						<div class="update-message">',
2663
-							esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ),
2664
-							' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong>
2663
+							esc_html__('Upgrade message from the plugin author:', 'tgmpa'),
2664
+							' <strong>', wp_kses_data($item['upgrade_notice']), '</strong>
2665 2665
 						</div>
2666 2666
 					</td>
2667 2667
 				</tr>';
@@ -2674,8 +2674,8 @@  discard block
 block discarded – undo
2674 2674
 		 *
2675 2675
 		 * @param string $which 'top' or 'bottom' table navigation.
2676 2676
 		 */
2677
-		public function extra_tablenav( $which ) {
2678
-			if ( 'bottom' === $which ) {
2677
+		public function extra_tablenav($which) {
2678
+			if ('bottom' === $which) {
2679 2679
 				$this->tgmpa->show_tgmpa_version();
2680 2680
 			}
2681 2681
 		}
@@ -2691,18 +2691,18 @@  discard block
 block discarded – undo
2691 2691
 
2692 2692
 			$actions = array();
2693 2693
 
2694
-			if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) {
2695
-				if ( current_user_can( 'install_plugins' ) ) {
2696
-					$actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' );
2694
+			if ('update' !== $this->view_context && 'activate' !== $this->view_context) {
2695
+				if (current_user_can('install_plugins')) {
2696
+					$actions['tgmpa-bulk-install'] = __('Install', 'tgmpa');
2697 2697
 				}
2698 2698
 			}
2699 2699
 
2700
-			if ( 'install' !== $this->view_context ) {
2701
-				if ( current_user_can( 'update_plugins' ) ) {
2702
-					$actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' );
2700
+			if ('install' !== $this->view_context) {
2701
+				if (current_user_can('update_plugins')) {
2702
+					$actions['tgmpa-bulk-update'] = __('Update', 'tgmpa');
2703 2703
 				}
2704
-				if ( current_user_can( 'activate_plugins' ) ) {
2705
-					$actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' );
2704
+				if (current_user_can('activate_plugins')) {
2705
+					$actions['tgmpa-bulk-activate'] = __('Activate', 'tgmpa');
2706 2706
 				}
2707 2707
 			}
2708 2708
 
@@ -2720,87 +2720,87 @@  discard block
 block discarded – undo
2720 2720
 		public function process_bulk_actions() {
2721 2721
 
2722 2722
 			// Bulk installation process.
2723
-			if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) {
2723
+			if ('tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action()) {
2724 2724
 
2725
-				check_admin_referer( 'bulk-' . $this->_args['plural'] );
2725
+				check_admin_referer('bulk-'.$this->_args['plural']);
2726 2726
 
2727 2727
 				$install_type = 'install';
2728
-				if ( 'tgmpa-bulk-update' === $this->current_action() ) {
2728
+				if ('tgmpa-bulk-update' === $this->current_action()) {
2729 2729
 					$install_type = 'update';
2730 2730
 				}
2731 2731
 
2732 2732
 				$plugins_to_install = array();
2733 2733
 
2734 2734
 				// Did user actually select any plugins to install/update ?
2735
-				if ( empty( $_POST['plugin'] ) ) {
2736
-					if ( 'install' === $install_type ) {
2737
-						$message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' );
2735
+				if (empty($_POST['plugin'])) {
2736
+					if ('install' === $install_type) {
2737
+						$message = __('No plugins were selected to be installed. No action taken.', 'tgmpa');
2738 2738
 					} else {
2739
-						$message = __( 'No plugins were selected to be updated. No action taken.', 'tgmpa' );
2739
+						$message = __('No plugins were selected to be updated. No action taken.', 'tgmpa');
2740 2740
 					}
2741 2741
 
2742
-					echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
2742
+					echo '<div id="message" class="error"><p>', esc_html($message), '</p></div>';
2743 2743
 					return false;
2744 2744
 				}
2745 2745
 
2746
-				if ( is_array( $_POST['plugin'] ) ) {
2746
+				if (is_array($_POST['plugin'])) {
2747 2747
 					$plugins_to_install = (array) $_POST['plugin'];
2748 2748
 
2749
-				} elseif ( is_string( $_POST['plugin'] ) ) {
2749
+				} elseif (is_string($_POST['plugin'])) {
2750 2750
 					// Received via Filesystem page - un-flatten array (WP bug #19643).
2751
-					$plugins_to_install = explode( ',', $_POST['plugin'] );
2751
+					$plugins_to_install = explode(',', $_POST['plugin']);
2752 2752
 				}
2753 2753
 
2754 2754
 				// Sanitize the received input.
2755
-				$plugins_to_install = array_map( 'urldecode', $plugins_to_install );
2756
-				$plugins_to_install = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins_to_install );
2755
+				$plugins_to_install = array_map('urldecode', $plugins_to_install);
2756
+				$plugins_to_install = array_map(array($this->tgmpa, 'sanitize_key'), $plugins_to_install);
2757 2757
 
2758 2758
 				// Validate the received input.
2759
-				foreach ( $plugins_to_install as $key => $slug ) {
2759
+				foreach ($plugins_to_install as $key => $slug) {
2760 2760
 					// Check if the plugin was registered with TGMPA and remove if not.
2761
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2762
-						unset( $plugins_to_install[ $key ] );
2761
+					if (!isset($this->tgmpa->plugins[$slug])) {
2762
+						unset($plugins_to_install[$key]);
2763 2763
 						continue;
2764 2764
 					}
2765 2765
 
2766 2766
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2767
-					if ( 'update' === $install_type && ( $this->tgmpa->is_plugin_installed( $slug ) && ( false === $this->tgmpa->does_plugin_have_update( $slug ) || ! $this->tgmpa->can_plugin_update( $slug ) ) ) ) {
2768
-						unset( $plugins_to_install[ $key ] );
2767
+					if ('update' === $install_type && ($this->tgmpa->is_plugin_installed($slug) && (false === $this->tgmpa->does_plugin_have_update($slug) || !$this->tgmpa->can_plugin_update($slug)))) {
2768
+						unset($plugins_to_install[$key]);
2769 2769
 					}
2770 2770
 				}
2771 2771
 
2772 2772
 				// No need to proceed further if we have no plugins to handle.
2773
-				if ( empty( $plugins_to_install ) ) {
2774
-					if ( 'install' === $install_type ) {
2775
-						$message = __( 'No plugins are available to be installed at this time.', 'tgmpa' );
2773
+				if (empty($plugins_to_install)) {
2774
+					if ('install' === $install_type) {
2775
+						$message = __('No plugins are available to be installed at this time.', 'tgmpa');
2776 2776
 					} else {
2777
-						$message = __( 'No plugins are available to be updated at this time.', 'tgmpa' );
2777
+						$message = __('No plugins are available to be updated at this time.', 'tgmpa');
2778 2778
 					}
2779 2779
 
2780
-					echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
2780
+					echo '<div id="message" class="error"><p>', esc_html($message), '</p></div>';
2781 2781
 					return false;
2782 2782
 				}
2783 2783
 
2784 2784
 				// Pass all necessary information if WP_Filesystem is needed.
2785 2785
 				$url = wp_nonce_url(
2786 2786
 					$this->tgmpa->get_tgmpa_url(),
2787
-					'bulk-' . $this->_args['plural']
2787
+					'bulk-'.$this->_args['plural']
2788 2788
 				);
2789 2789
 
2790 2790
 				// Give validated data back to $_POST which is the only place the filesystem looks for extra fields.
2791
-				$_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643.
2791
+				$_POST['plugin'] = implode(',', $plugins_to_install); // Work around for WP bug #19643.
2792 2792
 
2793 2793
 				$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
2794
-				$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
2794
+				$fields = array_keys($_POST); // Extra fields to pass to WP_Filesystem.
2795 2795
 
2796
-				if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
2796
+				if (false === ($creds = request_filesystem_credentials(esc_url_raw($url), $method, false, false, $fields))) {
2797 2797
 				   	return true; // Stop the normal page form from displaying, credential request form will be shown.
2798 2798
 				}
2799 2799
 
2800 2800
 				// Now we have some credentials, setup WP_Filesystem.
2801
-				if ( ! WP_Filesystem( $creds ) ) {
2801
+				if (!WP_Filesystem($creds)) {
2802 2802
 					// Our credentials were no good, ask the user for them again.
2803
-					request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
2803
+					request_filesystem_credentials(esc_url_raw($url), $method, true, false, $fields);
2804 2804
 					return true;
2805 2805
 				}
2806 2806
 
@@ -2813,35 +2813,35 @@  discard block
 block discarded – undo
2813 2813
 				$to_inject  = array(); // Information to inject into the update_plugins transient.
2814 2814
 
2815 2815
 				// Prepare the data for validated plugins for the install/upgrade.
2816
-				foreach ( $plugins_to_install as $slug ) {
2817
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
2818
-					$source = $this->tgmpa->get_download_url( $slug );
2816
+				foreach ($plugins_to_install as $slug) {
2817
+					$name   = $this->tgmpa->plugins[$slug]['name'];
2818
+					$source = $this->tgmpa->get_download_url($slug);
2819 2819
 
2820
-					if ( ! empty( $name ) && ! empty( $source ) ) {
2820
+					if (!empty($name) && !empty($source)) {
2821 2821
 						$names[] = $name;
2822 2822
 
2823
-						switch ( $install_type ) {
2823
+						switch ($install_type) {
2824 2824
 
2825 2825
 							case 'install':
2826 2826
 								$sources[] = $source;
2827 2827
 								break;
2828 2828
 
2829 2829
 							case 'update':
2830
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
2831
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
2832
-								$to_inject[ $slug ]['source'] = $source;
2830
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
2831
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
2832
+								$to_inject[$slug]['source'] = $source;
2833 2833
 								break;
2834 2834
 						}
2835 2835
 					}
2836 2836
 				}
2837
-				unset( $slug, $name, $source );
2837
+				unset($slug, $name, $source);
2838 2838
 
2839 2839
 				// Create a new instance of TGM_Bulk_Installer.
2840 2840
 				$installer = new TGM_Bulk_Installer(
2841 2841
 					new TGM_Bulk_Installer_Skin(
2842 2842
 						array(
2843
-							'url'          => esc_url_raw( $this->tgmpa->get_tgmpa_url() ),
2844
-							'nonce'        => 'bulk-' . $this->_args['plural'],
2843
+							'url'          => esc_url_raw($this->tgmpa->get_tgmpa_url()),
2844
+							'nonce'        => 'bulk-'.$this->_args['plural'],
2845 2845
 							'names'        => $names,
2846 2846
 							'install_type' => $install_type,
2847 2847
 						)
@@ -2850,21 +2850,21 @@  discard block
 block discarded – undo
2850 2850
 
2851 2851
 				// Wrap the install process with the appropriate HTML.
2852 2852
 				echo '<div class="tgmpa wrap">',
2853
-					'<h2>', esc_html( get_admin_page_title() ), '</h2>';
2853
+					'<h2>', esc_html(get_admin_page_title()), '</h2>';
2854 2854
 
2855 2855
 				// Process the bulk installation submissions.
2856
-				add_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1, 3 );
2856
+				add_filter('upgrader_source_selection', array($this->tgmpa, 'maybe_adjust_source_dir'), 1, 3);
2857 2857
 
2858
-				if ( 'tgmpa-bulk-update' === $this->current_action() ) {
2858
+				if ('tgmpa-bulk-update' === $this->current_action()) {
2859 2859
 					// Inject our info into the update transient.
2860
-					$this->tgmpa->inject_update_info( $to_inject );
2860
+					$this->tgmpa->inject_update_info($to_inject);
2861 2861
 
2862
-					$installer->bulk_upgrade( $file_paths );
2862
+					$installer->bulk_upgrade($file_paths);
2863 2863
 				} else {
2864
-					$installer->bulk_install( $sources );
2864
+					$installer->bulk_install($sources);
2865 2865
 				}
2866 2866
 
2867
-				remove_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1, 3 );
2867
+				remove_filter('upgrader_source_selection', array($this->tgmpa, 'maybe_adjust_source_dir'), 1, 3);
2868 2868
 
2869 2869
 				echo '</div>';
2870 2870
 
@@ -2872,71 +2872,71 @@  discard block
 block discarded – undo
2872 2872
 			}
2873 2873
 
2874 2874
 			// Bulk activation process.
2875
-			if ( 'tgmpa-bulk-activate' === $this->current_action() ) {
2875
+			if ('tgmpa-bulk-activate' === $this->current_action()) {
2876 2876
 
2877
-				check_admin_referer( 'bulk-' . $this->_args['plural'] );
2877
+				check_admin_referer('bulk-'.$this->_args['plural']);
2878 2878
 
2879 2879
 				// Did user actually select any plugins to activate ?
2880
-				if ( empty( $_POST['plugin'] ) ) {
2881
-					echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>';
2880
+				if (empty($_POST['plugin'])) {
2881
+					echo '<div id="message" class="error"><p>', esc_html__('No plugins were selected to be activated. No action taken.', 'tgmpa'), '</p></div>';
2882 2882
 					return false;
2883 2883
 				}
2884 2884
 
2885 2885
 				// Grab plugin data from $_POST.
2886 2886
 				$plugins = array();
2887
-				if ( isset( $_POST['plugin'] ) ) {
2888
-					$plugins = array_map( 'urldecode', (array) $_POST['plugin'] );
2889
-					$plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins );
2887
+				if (isset($_POST['plugin'])) {
2888
+					$plugins = array_map('urldecode', (array) $_POST['plugin']);
2889
+					$plugins = array_map(array($this->tgmpa, 'sanitize_key'), $plugins);
2890 2890
 				}
2891 2891
 
2892 2892
 				$plugins_to_activate = array();
2893 2893
 				$plugin_names        = array();
2894 2894
 
2895 2895
 				// Grab the file paths for the selected & inactive plugins from the registration array.
2896
-				foreach ( $plugins as $slug ) {
2897
-					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2898
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
2899
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
2896
+				foreach ($plugins as $slug) {
2897
+					if ($this->tgmpa->can_plugin_activate($slug)) {
2898
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
2899
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
2900 2900
 					}
2901 2901
 				}
2902
-				unset( $slug );
2902
+				unset($slug);
2903 2903
 
2904 2904
 				// Return early if there are no plugins to activate.
2905
-				if ( empty( $plugins_to_activate ) ) {
2906
-					echo '<div id="message" class="error"><p>', esc_html__( 'No plugins are available to be activated at this time.', 'tgmpa' ), '</p></div>';
2905
+				if (empty($plugins_to_activate)) {
2906
+					echo '<div id="message" class="error"><p>', esc_html__('No plugins are available to be activated at this time.', 'tgmpa'), '</p></div>';
2907 2907
 					return false;
2908 2908
 				}
2909 2909
 
2910 2910
 				// Now we are good to go - let's start activating plugins.
2911
-				$activate = activate_plugins( $plugins_to_activate );
2911
+				$activate = activate_plugins($plugins_to_activate);
2912 2912
 
2913
-				if ( is_wp_error( $activate ) ) {
2914
-					echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>';
2913
+				if (is_wp_error($activate)) {
2914
+					echo '<div id="message" class="error"><p>', wp_kses_post($activate->get_error_message()), '</p></div>';
2915 2915
 
2916 2916
 				} else {
2917
-					$count        = count( $plugin_names ); // Count so we can use _n function.
2918
-					$plugin_names = array_map( array( 'TGM_Utils', 'wrap_in_strong' ), $plugin_names );
2919
-					$last_plugin  = array_pop( $plugin_names ); // Pop off last name to prep for readability.
2920
-					$imploded     = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin );
2917
+					$count        = count($plugin_names); // Count so we can use _n function.
2918
+					$plugin_names = array_map(array('TGM_Utils', 'wrap_in_strong'), $plugin_names);
2919
+					$last_plugin  = array_pop($plugin_names); // Pop off last name to prep for readability.
2920
+					$imploded     = empty($plugin_names) ? $last_plugin : (implode(', ', $plugin_names).' '.esc_html_x('and', 'plugin A *and* plugin B', 'tgmpa').' '.$last_plugin);
2921 2921
 
2922 2922
 					printf( // WPCS: xss ok.
2923 2923
 						'<div id="message" class="updated"><p>%1$s %2$s.</p></div>',
2924
-						esc_html( _n( 'The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'tgmpa' ) ),
2924
+						esc_html(_n('The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'tgmpa')),
2925 2925
 						$imploded
2926 2926
 					);
2927 2927
 
2928 2928
 					// Update recently activated plugins option.
2929
-					$recent = (array) get_option( 'recently_activated' );
2930
-					foreach ( $plugins_to_activate as $plugin => $time ) {
2931
-						if ( isset( $recent[ $plugin ] ) ) {
2932
-							unset( $recent[ $plugin ] );
2929
+					$recent = (array) get_option('recently_activated');
2930
+					foreach ($plugins_to_activate as $plugin => $time) {
2931
+						if (isset($recent[$plugin])) {
2932
+							unset($recent[$plugin]);
2933 2933
 						}
2934 2934
 					}
2935
-					update_option( 'recently_activated', $recent );
2935
+					update_option('recently_activated', $recent);
2936 2936
 
2937 2937
 				}
2938 2938
 
2939
-				unset( $_POST ); // Reset the $_POST variable in case user wants to perform one action after another.
2939
+				unset($_POST); // Reset the $_POST variable in case user wants to perform one action after another.
2940 2940
 
2941 2941
 				return true;
2942 2942
 			}
@@ -2955,15 +2955,15 @@  discard block
 block discarded – undo
2955 2955
 			$hidden                = array(); // No columns to hide, but we must set as an array.
2956 2956
 			$sortable              = array(); // No reason to make sortable columns.
2957 2957
 			$primary               = $this->get_primary_column_name(); // Column which has the row actions.
2958
-			$this->_column_headers = array( $columns, $hidden, $sortable, $primary ); // Get all necessary column headers.
2958
+			$this->_column_headers = array($columns, $hidden, $sortable, $primary); // Get all necessary column headers.
2959 2959
 
2960 2960
 			// Process our bulk activations here.
2961
-			if ( 'tgmpa-bulk-activate' === $this->current_action() ) {
2961
+			if ('tgmpa-bulk-activate' === $this->current_action()) {
2962 2962
 				$this->process_bulk_actions();
2963 2963
 			}
2964 2964
 
2965 2965
 			// Store all of our plugin data into $items array so WP_List_Table can use it.
2966
-			$this->items = apply_filters( 'tgmpa_table_data_items', $this->_gather_plugin_data() );
2966
+			$this->items = apply_filters('tgmpa_table_data_items', $this->_gather_plugin_data());
2967 2967
 
2968 2968
 		}
2969 2969
 
@@ -2982,9 +2982,9 @@  discard block
 block discarded – undo
2982 2982
 		 *
2983 2983
 		 * @return string|boolean Plugin slug if found, false otherwise.
2984 2984
 		 */
2985
-		protected function _get_plugin_data_from_name( $name, $data = 'slug' ) {
2986
-			_deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()' );
2987
-			return $this->tgmpa->_get_plugin_data_from_name( $name, $data );
2985
+		protected function _get_plugin_data_from_name($name, $data = 'slug') {
2986
+			_deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()');
2987
+			return $this->tgmpa->_get_plugin_data_from_name($name, $data);
2988 2988
 		}
2989 2989
 
2990 2990
 	}
@@ -3000,22 +3000,22 @@  discard block
 block discarded – undo
3000 3000
  *
3001 3001
  * @since 2.2.0
3002 3002
  */
3003
-add_action( 'admin_init', 'tgmpa_load_bulk_installer' );
3004
-if ( ! function_exists( 'tgmpa_load_bulk_installer' ) ) {
3003
+add_action('admin_init', 'tgmpa_load_bulk_installer');
3004
+if (!function_exists('tgmpa_load_bulk_installer')) {
3005 3005
 	/**
3006 3006
 	 * Load bulk installer
3007 3007
 	 */
3008 3008
 	function tgmpa_load_bulk_installer() {
3009 3009
 		// Get TGMPA class instance.
3010
-		$tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
3010
+		$tgmpa_instance = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
3011 3011
 
3012
-		if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) {
3012
+		if (isset($_GET['page']) && $tgmpa_instance->menu === $_GET['page']) {
3013 3013
 
3014
-			if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
3015
-				require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
3014
+			if (!class_exists('Plugin_Upgrader', false)) {
3015
+				require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
3016 3016
 			}
3017 3017
 
3018
-			if ( ! class_exists( 'TGM_Bulk_Installer' ) ) {
3018
+			if (!class_exists('TGM_Bulk_Installer')) {
3019 3019
 
3020 3020
 				/**
3021 3021
 				 * Installer class to handle bulk plugin installations.
@@ -3076,21 +3076,21 @@  discard block
 block discarded – undo
3076 3076
 					 *
3077 3077
 					 * @param \Bulk_Upgrader_Skin|null $skin Installer skin.
3078 3078
 					 */
3079
-					public function __construct( $skin = null ) {
3079
+					public function __construct($skin = null) {
3080 3080
 						// Get TGMPA class instance.
3081
-						$this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
3081
+						$this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
3082 3082
 
3083
-						parent::__construct( $skin );
3083
+						parent::__construct($skin);
3084 3084
 
3085
-						if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) {
3085
+						if (isset($this->skin->options['install_type']) && 'update' === $this->skin->options['install_type']) {
3086 3086
 							$this->clear_destination = true;
3087 3087
 						}
3088 3088
 
3089
-						if ( $this->tgmpa->is_automatic ) {
3089
+						if ($this->tgmpa->is_automatic) {
3090 3090
 							$this->activate_strings();
3091 3091
 						}
3092 3092
 
3093
-						add_action( 'upgrader_process_complete', array( $this->tgmpa, 'populate_file_path' ) );
3093
+						add_action('upgrader_process_complete', array($this->tgmpa, 'populate_file_path'));
3094 3094
 					}
3095 3095
 
3096 3096
 					/**
@@ -3100,8 +3100,8 @@  discard block
 block discarded – undo
3100 3100
 					 */
3101 3101
 					public function activate_strings() {
3102 3102
 
3103
-						$this->strings['activation_failed']  = __( 'Plugin activation failed.', 'tgmpa' );
3104
-						$this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' );
3103
+						$this->strings['activation_failed']  = __('Plugin activation failed.', 'tgmpa');
3104
+						$this->strings['activation_success'] = __('Plugin activated successfully.', 'tgmpa');
3105 3105
 					}
3106 3106
 
3107 3107
 					/**
@@ -3115,12 +3115,12 @@  discard block
 block discarded – undo
3115 3115
 					 *
3116 3116
 					 * @return null|array Return early if error, array of installation data on success.
3117 3117
 					 */
3118
-					public function run( $options ) {
3119
-						$result = parent::run( $options );
3118
+					public function run($options) {
3119
+						$result = parent::run($options);
3120 3120
 
3121 3121
 						// Reset the strings in case we changed one during automatic activation.
3122
-						if ( $this->tgmpa->is_automatic ) {
3123
-							if ( 'update' === $this->skin->options['install_type'] ) {
3122
+						if ($this->tgmpa->is_automatic) {
3123
+							if ('update' === $this->skin->options['install_type']) {
3124 3124
 								$this->upgrade_strings();
3125 3125
 							} else {
3126 3126
 								$this->install_strings();
@@ -3148,15 +3148,15 @@  discard block
 block discarded – undo
3148 3148
 					 *
3149 3149
 					 * @return string|bool Install confirmation messages on success, false on failure.
3150 3150
 					 */
3151
-					public function bulk_install( $plugins, $args = array() ) {
3151
+					public function bulk_install($plugins, $args = array()) {
3152 3152
 
3153 3153
 						// [TGMPA + ] Hook auto-activation in.
3154
-						add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3154
+						add_filter('upgrader_post_install', array($this, 'auto_activate'), 10);
3155 3155
 
3156 3156
 						$defaults    = array(
3157 3157
 							'clear_update_cache' => true,
3158 3158
 						);
3159
-						$parsed_args = wp_parse_args( $args, $defaults );
3159
+						$parsed_args = wp_parse_args($args, $defaults);
3160 3160
 
3161 3161
 						$this->init();
3162 3162
 						$this->bulk = true;
@@ -3170,8 +3170,8 @@  discard block
 block discarded – undo
3170 3170
 						$this->skin->header();
3171 3171
 
3172 3172
 						// Connect to the Filesystem first.
3173
-						$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) );
3174
-						if ( ! $res ) {
3173
+						$res = $this->fs_connect(array(WP_CONTENT_DIR, WP_PLUGIN_DIR));
3174
+						if (!$res) {
3175 3175
 							$this->skin->footer();
3176 3176
 							return false;
3177 3177
 						}
@@ -3182,22 +3182,22 @@  discard block
 block discarded – undo
3182 3182
 						// - running Multisite and there are one or more plugins specified, OR
3183 3183
 						// - a plugin with an update available is currently active.
3184 3184
 						// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
3185
-						$maintenance = ( is_multisite() && ! empty( $plugins ) );
3185
+						$maintenance = (is_multisite() && !empty($plugins));
3186 3186
 
3187 3187
 						/*
3188 3188
 						[TGMPA - ]
3189 3189
 						foreach ( $plugins as $plugin )
3190 3190
 							$maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) );
3191 3191
 						*/
3192
-						if ( $maintenance ) {
3193
-							$this->maintenance_mode( true );
3192
+						if ($maintenance) {
3193
+							$this->maintenance_mode(true);
3194 3194
 						}
3195 3195
 
3196 3196
 						$results = array();
3197 3197
 
3198
-						$this->update_count   = count( $plugins );
3198
+						$this->update_count   = count($plugins);
3199 3199
 						$this->update_current = 0;
3200
-						foreach ( $plugins as $plugin ) {
3200
+						foreach ($plugins as $plugin) {
3201 3201
 							$this->update_current++;
3202 3202
 
3203 3203
 							/*
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
 							$this->skin->plugin_active = is_plugin_active($plugin);
3220 3220
 							*/
3221 3221
 
3222
-							$result = $this->run( array(
3222
+							$result = $this->run(array(
3223 3223
 								'package'           => $plugin, // [TGMPA + ] adjusted.
3224 3224
 								'destination'       => WP_PLUGIN_DIR,
3225 3225
 								'clear_destination' => false, // [TGMPA + ] adjusted.
@@ -3228,17 +3228,17 @@  discard block
 block discarded – undo
3228 3228
 								'hook_extra'        => array(
3229 3229
 									'plugin' => $plugin,
3230 3230
 								),
3231
-							) );
3231
+							));
3232 3232
 
3233
-							$results[ $plugin ] = $this->result;
3233
+							$results[$plugin] = $this->result;
3234 3234
 
3235 3235
 							// Prevent credentials auth screen from displaying multiple times.
3236
-							if ( false === $result ) {
3236
+							if (false === $result) {
3237 3237
 								break;
3238 3238
 							}
3239 3239
 						} //end foreach $plugins
3240 3240
 
3241
-						$this->maintenance_mode( false );
3241
+						$this->maintenance_mode(false);
3242 3242
 
3243 3243
 						/**
3244 3244
 						 * Fires when the bulk upgrader process is complete.
@@ -3256,12 +3256,12 @@  discard block
 block discarded – undo
3256 3256
 						 *     @type array  $packages Array of plugin, theme, or core packages to update.
3257 3257
 						 * }
3258 3258
 						 */
3259
-						do_action( 'upgrader_process_complete', $this, array(
3259
+						do_action('upgrader_process_complete', $this, array(
3260 3260
 							'action'  => 'install', // [TGMPA + ] adjusted.
3261 3261
 							'type'    => 'plugin',
3262 3262
 							'bulk'    => true,
3263 3263
 							'plugins' => $plugins,
3264
-						) );
3264
+						));
3265 3265
 
3266 3266
 						$this->skin->bulk_footer();
3267 3267
 
@@ -3271,10 +3271,10 @@  discard block
 block discarded – undo
3271 3271
 						/* [TGMPA - ] remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); */
3272 3272
 
3273 3273
 						// [TGMPA + ] Remove our auto-activation hook.
3274
-						remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3274
+						remove_filter('upgrader_post_install', array($this, 'auto_activate'), 10);
3275 3275
 
3276 3276
 						// Force refresh of plugin update information.
3277
-						wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
3277
+						wp_clean_plugins_cache($parsed_args['clear_update_cache']);
3278 3278
 
3279 3279
 						return $results;
3280 3280
 					}
@@ -3291,13 +3291,13 @@  discard block
 block discarded – undo
3291 3291
 					 *
3292 3292
 					 * @return string|bool Install confirmation messages on success, false on failure.
3293 3293
 					 */
3294
-					public function bulk_upgrade( $plugins, $args = array() ) {
3294
+					public function bulk_upgrade($plugins, $args = array()) {
3295 3295
 
3296
-						add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3296
+						add_filter('upgrader_post_install', array($this, 'auto_activate'), 10);
3297 3297
 
3298
-						$result = parent::bulk_upgrade( $plugins, $args );
3298
+						$result = parent::bulk_upgrade($plugins, $args);
3299 3299
 
3300
-						remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
3300
+						remove_filter('upgrader_post_install', array($this, 'auto_activate'), 10);
3301 3301
 
3302 3302
 						return $result;
3303 3303
 					}
@@ -3313,10 +3313,10 @@  discard block
 block discarded – undo
3313 3313
 					 *
3314 3314
 					 * @return bool
3315 3315
 					 */
3316
-					public function auto_activate( $bool ) {
3316
+					public function auto_activate($bool) {
3317 3317
 
3318 3318
 						// Only process the activation of installed plugins if the automatic flag is set to true.
3319
-						if ( $this->tgmpa->is_automatic ) {
3319
+						if ($this->tgmpa->is_automatic) {
3320 3320
 
3321 3321
 							// Flush plugins cache so the headers of the newly installed plugins will be read correctly.
3322 3322
 							wp_clean_plugins_cache();
@@ -3325,14 +3325,14 @@  discard block
 block discarded – undo
3325 3325
 							$plugin_info = $this->plugin_info();
3326 3326
 
3327 3327
 							// Don't try to activate on upgrade of active plugin as WP will do this already.
3328
-							if ( ! is_plugin_active( $plugin_info ) ) {
3329
-								$activate = activate_plugin( $plugin_info );
3328
+							if (!is_plugin_active($plugin_info)) {
3329
+								$activate = activate_plugin($plugin_info);
3330 3330
 
3331 3331
 								// Adjust the success string based on the activation result.
3332
-								$this->strings['process_success'] = $this->strings['process_success'] . "<br />\n";
3332
+								$this->strings['process_success'] = $this->strings['process_success']."<br />\n";
3333 3333
 
3334
-								if ( is_wp_error( $activate ) ) {
3335
-									$this->skin->error( $activate );
3334
+								if (is_wp_error($activate)) {
3335
+									$this->skin->error($activate);
3336 3336
 									$this->strings['process_success'] .= $this->strings['activation_failed'];
3337 3337
 
3338 3338
 								} else {
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
 				}
3347 3347
 			}
3348 3348
 
3349
-			if ( ! class_exists( 'TGM_Bulk_Installer_Skin' ) ) {
3349
+			if (!class_exists('TGM_Bulk_Installer_Skin')) {
3350 3350
 
3351 3351
 				/**
3352 3352
 				 * Installer skin to set strings for the bulk plugin installations..
@@ -3407,9 +3407,9 @@  discard block
 block discarded – undo
3407 3407
 					 *
3408 3408
 					 * @param array $args Arguments to pass for use within the class.
3409 3409
 					 */
3410
-					public function __construct( $args = array() ) {
3410
+					public function __construct($args = array()) {
3411 3411
 						// Get TGMPA class instance.
3412
-						$this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
3412
+						$this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
3413 3413
 
3414 3414
 						// Parse default and new args.
3415 3415
 						$defaults = array(
@@ -3418,13 +3418,13 @@  discard block
 block discarded – undo
3418 3418
 							'names'        => array(),
3419 3419
 							'install_type' => 'install',
3420 3420
 						);
3421
-						$args     = wp_parse_args( $args, $defaults );
3421
+						$args = wp_parse_args($args, $defaults);
3422 3422
 
3423 3423
 						// Set plugin names to $this->plugin_names property.
3424 3424
 						$this->plugin_names = $args['names'];
3425 3425
 
3426 3426
 						// Extract the new args.
3427
-						parent::__construct( $args );
3427
+						parent::__construct($args);
3428 3428
 
3429 3429
 					}
3430 3430
 
@@ -3437,28 +3437,28 @@  discard block
 block discarded – undo
3437 3437
 					 * @since 2.2.0
3438 3438
 					 */
3439 3439
 					public function add_strings() {
3440
-						if ( 'update' === $this->options['install_type'] ) {
3440
+						if ('update' === $this->options['install_type']) {
3441 3441
 							parent::add_strings();
3442
-							$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
3442
+							$this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa');
3443 3443
 
3444 3444
 						} else {
3445 3445
 
3446
-							$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' );
3447
-							$this->upgrader->strings['skin_update_failed']       = __( 'The installation of %1$s failed.', 'tgmpa' );
3446
+							$this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa');
3447
+							$this->upgrader->strings['skin_update_failed']       = __('The installation of %1$s failed.', 'tgmpa');
3448 3448
 
3449
-							if ( $this->tgmpa->is_automatic ) {
3449
+							if ($this->tgmpa->is_automatic) {
3450 3450
 								// Automatic activation strings.
3451
-								$this->upgrader->strings['skin_upgrade_start']        = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
3452
-								$this->upgrader->strings['skin_update_successful']    = __( '%1$s installed and activated successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3453
-								$this->upgrader->strings['skin_upgrade_end']          = __( 'All installations and activations have been completed.', 'tgmpa' );
3454
-								$this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
3451
+								$this->upgrader->strings['skin_upgrade_start']        = __('The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa');
3452
+								$this->upgrader->strings['skin_update_successful']    = __('%1$s installed and activated successfully.', 'tgmpa').' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>'.esc_html__('Show Details', 'tgmpa').'</span><span class="hidden">'.esc_html__('Hide Details', 'tgmpa').'</span>.</a>';
3453
+								$this->upgrader->strings['skin_upgrade_end']          = __('All installations and activations have been completed.', 'tgmpa');
3454
+								$this->upgrader->strings['skin_before_update_header'] = __('Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa');
3455 3455
 
3456 3456
 							} else {
3457 3457
 								// Default installation strings.
3458
-								$this->upgrader->strings['skin_upgrade_start']        = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
3459
-								$this->upgrader->strings['skin_update_successful']    = esc_html__( '%1$s installed successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>';
3460
-								$this->upgrader->strings['skin_upgrade_end']          = __( 'All installations have been completed.', 'tgmpa' );
3461
-								$this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
3458
+								$this->upgrader->strings['skin_upgrade_start']        = __('The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa');
3459
+								$this->upgrader->strings['skin_update_successful']    = esc_html__('%1$s installed successfully.', 'tgmpa').' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>'.esc_html__('Show Details', 'tgmpa').'</span><span class="hidden">'.esc_html__('Hide Details', 'tgmpa').'</span>.</a>';
3460
+								$this->upgrader->strings['skin_upgrade_end']          = __('All installations have been completed.', 'tgmpa');
3461
+								$this->upgrader->strings['skin_before_update_header'] = __('Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa');
3462 3462
 							}
3463 3463
 						}
3464 3464
 					}
@@ -3470,11 +3470,11 @@  discard block
 block discarded – undo
3470 3470
 					 *
3471 3471
 					 * @param string $title Unused in this implementation.
3472 3472
 					 */
3473
-					public function before( $title = '' ) {
3474
-						if ( empty( $title ) ) {
3475
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3473
+					public function before($title = '') {
3474
+						if (empty($title)) {
3475
+							$title = esc_html($this->plugin_names[$this->i]);
3476 3476
 						}
3477
-						parent::before( $title );
3477
+						parent::before($title);
3478 3478
 					}
3479 3479
 
3480 3480
 					/**
@@ -3487,11 +3487,11 @@  discard block
 block discarded – undo
3487 3487
 					 *
3488 3488
 					 * @param string $title Unused in this implementation.
3489 3489
 					 */
3490
-					public function after( $title = '' ) {
3491
-						if ( empty( $title ) ) {
3492
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3490
+					public function after($title = '') {
3491
+						if (empty($title)) {
3492
+							$title = esc_html($this->plugin_names[$this->i]);
3493 3493
 						}
3494
-						parent::after( $title );
3494
+						parent::after($title);
3495 3495
 
3496 3496
 						$this->i++;
3497 3497
 					}
@@ -3514,15 +3514,15 @@  discard block
 block discarded – undo
3514 3514
 						// Display message based on if all plugins are now active or not.
3515 3515
 						$update_actions = array();
3516 3516
 
3517
-						if ( $this->tgmpa->is_tgmpa_complete() ) {
3517
+						if ($this->tgmpa->is_tgmpa_complete()) {
3518 3518
 							// All plugins are active, so we display the complete string and hide the menu to protect users.
3519 3519
 							echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
3520 3520
 							$update_actions['dashboard'] = sprintf(
3521
-								esc_html( $this->tgmpa->strings['complete'] ),
3522
-								'<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>'
3521
+								esc_html($this->tgmpa->strings['complete']),
3522
+								'<a href="'.esc_url(self_admin_url()).'">'.esc_html__('Return to the Dashboard', 'tgmpa').'</a>'
3523 3523
 							);
3524 3524
 						} else {
3525
-							$update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>';
3525
+							$update_actions['tgmpa_page'] = '<a href="'.esc_url($this->tgmpa->get_tgmpa_url()).'" target="_parent">'.esc_html($this->tgmpa->strings['return']).'</a>';
3526 3526
 						}
3527 3527
 
3528 3528
 						/**
@@ -3533,10 +3533,10 @@  discard block
 block discarded – undo
3533 3533
 						 * @param array $update_actions Array of plugin action links.
3534 3534
 						 * @param array $plugin_info    Array of information for the last-handled plugin.
3535 3535
 						 */
3536
-						$update_actions = apply_filters( 'tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
3536
+						$update_actions = apply_filters('tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
3537 3537
 
3538
-						if ( ! empty( $update_actions ) ) {
3539
-							$this->feedback( implode( ' | ', (array) $update_actions ) );
3538
+						if (!empty($update_actions)) {
3539
+							$this->feedback(implode(' | ', (array) $update_actions));
3540 3540
 						}
3541 3541
 					}
3542 3542
 
@@ -3550,7 +3550,7 @@  discard block
 block discarded – undo
3550 3550
 					 * @see        Bulk_Upgrader_Skin::flush_output()
3551 3551
 					 */
3552 3552
 					public function before_flush_output() {
3553
-						_deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
3553
+						_deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()');
3554 3554
 						$this->flush_output();
3555 3555
 					}
3556 3556
 
@@ -3563,7 +3563,7 @@  discard block
 block discarded – undo
3563 3563
 					 * @see        Bulk_Upgrader_Skin::flush_output()
3564 3564
 					 */
3565 3565
 					public function after_flush_output() {
3566
-						_deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
3566
+						_deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()');
3567 3567
 						$this->flush_output();
3568 3568
 						$this->i++;
3569 3569
 					}
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
 }
3576 3576
 
3577 3577
 
3578
-if ( ! class_exists( 'TGM_Utils' ) ) {
3578
+if (!class_exists('TGM_Utils')) {
3579 3579
 
3580 3580
 	/**
3581 3581
 	 * Generic utilities for TGMPA.
@@ -3614,8 +3614,8 @@  discard block
 block discarded – undo
3614 3614
 		 *
3615 3615
 		 * @return string
3616 3616
 		 */
3617
-		public static function wrap_in_em( $string ) {
3618
-			return '<em>' . wp_kses_post( $string ) . '</em>';
3617
+		public static function wrap_in_em($string) {
3618
+			return '<em>'.wp_kses_post($string).'</em>';
3619 3619
 		}
3620 3620
 
3621 3621
 		/**
@@ -3629,8 +3629,8 @@  discard block
 block discarded – undo
3629 3629
 		 *
3630 3630
 		 * @return string
3631 3631
 		 */
3632
-		public static function wrap_in_strong( $string ) {
3633
-			return '<strong>' . wp_kses_post( $string ) . '</strong>';
3632
+		public static function wrap_in_strong($string) {
3633
+			return '<strong>'.wp_kses_post($string).'</strong>';
3634 3634
 		}
3635 3635
 
3636 3636
 		/**
@@ -3644,16 +3644,16 @@  discard block
 block discarded – undo
3644 3644
 		 *
3645 3645
 		 * @return bool
3646 3646
 		 */
3647
-		public static function validate_bool( $value ) {
3648
-			if ( ! isset( self::$has_filters ) ) {
3649
-				self::$has_filters = extension_loaded( 'filter' );
3647
+		public static function validate_bool($value) {
3648
+			if (!isset(self::$has_filters)) {
3649
+				self::$has_filters = extension_loaded('filter');
3650 3650
 			}
3651 3651
 
3652
-			if ( self::$has_filters ) {
3653
-				return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
3652
+			if (self::$has_filters) {
3653
+				return filter_var($value, FILTER_VALIDATE_BOOLEAN);
3654 3654
 
3655 3655
 			} else {
3656
-				return self::emulate_filter_bool( $value );
3656
+				return self::emulate_filter_bool($value);
3657 3657
 			}
3658 3658
 		}
3659 3659
 
@@ -3668,10 +3668,10 @@  discard block
 block discarded – undo
3668 3668
 		 *
3669 3669
 		 * @return bool
3670 3670
 		 */
3671
-		protected static function emulate_filter_bool( $value ) {
3671
+		protected static function emulate_filter_bool($value) {
3672 3672
 
3673 3673
 			// @codingStandardsIgnoreStart
3674
-			static $true  = array(
3674
+			static $true = array(
3675 3675
 				'1',
3676 3676
 				'true', 'True', 'TRUE',
3677 3677
 				'y', 'Y',
@@ -3687,22 +3687,22 @@  discard block
 block discarded – undo
3687 3687
 			);
3688 3688
 			// @codingStandardsIgnoreEnd
3689 3689
 
3690
-			if ( is_bool( $value ) ) {
3690
+			if (is_bool($value)) {
3691 3691
 				return $value;
3692 3692
 
3693
-			} else if ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) {
3693
+			} else if (is_int($value) && (0 === $value || 1 === $value)) {
3694 3694
 				return (bool) $value;
3695 3695
 
3696
-			} else if ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) {
3696
+			} else if ((is_float($value) && !is_nan($value)) && ((float) 0 === $value || (float) 1 === $value)) {
3697 3697
 				return (bool) $value;
3698 3698
 
3699
-			} else if ( is_string( $value ) ) {
3699
+			} else if (is_string($value)) {
3700 3700
 
3701
-				$value = trim( $value );
3702
-				if ( in_array( $value, $true, true ) ) {
3701
+				$value = trim($value);
3702
+				if (in_array($value, $true, true)) {
3703 3703
 					return true;
3704 3704
 
3705
-				} else if ( in_array( $value, $false, true ) ) {
3705
+				} else if (in_array($value, $false, true)) {
3706 3706
 					return false;
3707 3707
 
3708 3708
 				} else {
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin installation and activation for WordPress themes.
4
- *
5
- * Please note that this is a drop-in library for a theme or plugin.
6
- * The authors of this library (Thomas, Gary and Juliette) are NOT responsible
7
- * for the support of your plugin or theme. Please contact the plugin
8
- * or theme author for support.
9
- *
10
- * @package   TGM-Plugin-Activation
11
- * @version   2.5.0
12
- * @link      http://tgmpluginactivation.com/
13
- * @author    Thomas Griffin, Gary Jones, Juliette Reinders Folmer
14
- * @copyright Copyright (c) 2011, Thomas Griffin
15
- * @license   GPL-2.0+
16
- *
17
- * @wordpress-plugin
18
- * Plugin Name: TGM Plugin Activation
19
- * Plugin URI:
20
- * Description: Plugin installation and activation for WordPress themes.
21
- * Version:     2.5.0
22
- * Author:      griffinjt, garyj, jrf
23
- * Author URI:  http://tgmpluginactivation.com/
24
- * Text Domain: tgmpa
25
- * Domain Path: /languages/
26
- * Copyright:   2011, Thomas Griffin
27
- */
3
+	 * Plugin installation and activation for WordPress themes.
4
+	 *
5
+	 * Please note that this is a drop-in library for a theme or plugin.
6
+	 * The authors of this library (Thomas, Gary and Juliette) are NOT responsible
7
+	 * for the support of your plugin or theme. Please contact the plugin
8
+	 * or theme author for support.
9
+	 *
10
+	 * @package   TGM-Plugin-Activation
11
+	 * @version   2.5.0
12
+	 * @link      http://tgmpluginactivation.com/
13
+	 * @author    Thomas Griffin, Gary Jones, Juliette Reinders Folmer
14
+	 * @copyright Copyright (c) 2011, Thomas Griffin
15
+	 * @license   GPL-2.0+
16
+	 *
17
+	 * @wordpress-plugin
18
+	 * Plugin Name: TGM Plugin Activation
19
+	 * Plugin URI:
20
+	 * Description: Plugin installation and activation for WordPress themes.
21
+	 * Version:     2.5.0
22
+	 * Author:      griffinjt, garyj, jrf
23
+	 * Author URI:  http://tgmpluginactivation.com/
24
+	 * Text Domain: tgmpa
25
+	 * Domain Path: /languages/
26
+	 * Copyright:   2011, Thomas Griffin
27
+	 */
28 28
 
29 29
 /*
30 30
 	Copyright 2011 Thomas Griffin (thomasgriffinmedia.com)
@@ -1328,13 +1328,13 @@  discard block
 block discarded – undo
1328 1328
 			$key     = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );
1329 1329
 
1330 1330
 			/**
1331
-			* Filter a sanitized key string.
1332
-			*
1333
-			* @since 3.0.0
1334
-			*
1335
-			* @param string $key     Sanitized key.
1336
-			* @param string $raw_key The key prior to sanitization.
1337
-			*/
1331
+			 * Filter a sanitized key string.
1332
+			 *
1333
+			 * @since 3.0.0
1334
+			 *
1335
+			 * @param string $key     Sanitized key.
1336
+			 * @param string $raw_key The key prior to sanitization.
1337
+			 */
1338 1338
 			return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key );
1339 1339
 		}
1340 1340
 
@@ -2540,7 +2540,7 @@  discard block
 block discarded – undo
2540 2540
 		 * @return string
2541 2541
 		 */
2542 2542
 		protected function get_default_primary_column_name() {
2543
-		    return 'plugin';
2543
+			return 'plugin';
2544 2544
 		}
2545 2545
 
2546 2546
 		/**
Please login to merge, or discard this patch.
admin/includes/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 	 * @uses api_request()
65 65
 	 *
66 66
 	 * @param array   $_transient_data Update array build by WordPress.
67
-	 * @return array Modified update array with custom plugin data.
67
+	 * @return stdClass Modified update array with custom plugin data.
68 68
 	 */
69 69
 	function check_update( $_transient_data ) {
70 70
 
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	 * @param array   $_api_data    Optional data to send with API calls.
27 27
 	 * @return void
28 28
 	 */
29
-	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
30
-		$this->api_url  = trailingslashit( $_api_url );
29
+	function __construct($_api_url, $_plugin_file, $_api_data = null) {
30
+		$this->api_url  = trailingslashit($_api_url);
31 31
 		$this->api_data = $_api_data;
32
-		$this->name     = plugin_basename( $_plugin_file );
33
-		$this->slug     = basename( $_plugin_file, '.php' );
32
+		$this->name     = plugin_basename($_plugin_file);
33
+		$this->slug     = basename($_plugin_file, '.php');
34 34
 		$this->version  = $_api_data['version'];
35 35
 
36 36
 		// Set up hooks.
37 37
 		$this->init();
38
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
38
+		add_action('admin_init', array($this, 'show_changelog'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function init() {
49 49
 
50
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
51
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
50
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
51
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
52 52
 
53
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
53
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
54 54
 	}
55 55
 
56 56
 	/**
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 	 * @param array   $_transient_data Update array build by WordPress.
67 67
 	 * @return array Modified update array with custom plugin data.
68 68
 	 */
69
-	function check_update( $_transient_data ) {
69
+	function check_update($_transient_data) {
70 70
 
71 71
 		global $pagenow;
72 72
 
73
-		if ( ! is_object( $_transient_data ) ) {
73
+		if (!is_object($_transient_data)) {
74 74
 			$_transient_data = new stdClass;
75 75
 		}
76 76
 
77
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
77
+		if ('plugins.php' == $pagenow && is_multisite()) {
78 78
 			return $_transient_data;
79 79
 		}
80 80
 
81
-		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
81
+		if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
82 82
 
83
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
83
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
84 84
 
85
-			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
85
+			if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
86 86
 
87 87
 				$this->did_check = true;
88 88
 
89
-				if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
89
+				if (version_compare($this->version, $version_info->new_version, '<')) {
90 90
 
91
-					$_transient_data->response[ $this->name ] = $version_info;
91
+					$_transient_data->response[$this->name] = $version_info;
92 92
 
93 93
 				}
94 94
 
95 95
 				$_transient_data->last_checked = time();
96
-				$_transient_data->checked[ $this->name ] = $this->version;
96
+				$_transient_data->checked[$this->name] = $this->version;
97 97
 
98 98
 			}
99 99
 
@@ -108,84 +108,84 @@  discard block
 block discarded – undo
108 108
 	 * @param string  $file
109 109
 	 * @param array   $plugin
110 110
 	 */
111
-	public function show_update_notification( $file, $plugin ) {
111
+	public function show_update_notification($file, $plugin) {
112 112
 
113
-		if ( ! current_user_can( 'update_plugins' ) ) {
113
+		if (!current_user_can('update_plugins')) {
114 114
 			return;
115 115
 		}
116 116
 
117
-		if ( ! is_multisite() ) {
117
+		if (!is_multisite()) {
118 118
 			return;
119 119
 		}
120 120
 
121
-		if ( $this->name != $file ) {
121
+		if ($this->name != $file) {
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		// Remove our filter on the site transient
126
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
126
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
127 127
 
128
-		$update_cache = get_site_transient( 'update_plugins' );
128
+		$update_cache = get_site_transient('update_plugins');
129 129
 
130
-		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
130
+		if (!is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
131 131
 
132
-			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
133
-			$version_info = get_transient( $cache_key );
132
+			$cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
133
+			$version_info = get_transient($cache_key);
134 134
 
135
-			if ( false === $version_info ) {
135
+			if (false === $version_info) {
136 136
 
137
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
137
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
138 138
 
139
-				set_transient( $cache_key, $version_info, 3600 );
139
+				set_transient($cache_key, $version_info, 3600);
140 140
 			}
141 141
 
142 142
 
143
-			if ( ! is_object( $version_info ) ) {
143
+			if (!is_object($version_info)) {
144 144
 				return;
145 145
 			}
146 146
 
147
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
147
+			if (version_compare($this->version, $version_info->new_version, '<')) {
148 148
 
149
-				$update_cache->response[ $this->name ] = $version_info;
149
+				$update_cache->response[$this->name] = $version_info;
150 150
 
151 151
 			}
152 152
 
153 153
 			$update_cache->last_checked = time();
154
-			$update_cache->checked[ $this->name ] = $this->version;
154
+			$update_cache->checked[$this->name] = $this->version;
155 155
 
156
-			set_site_transient( 'update_plugins', $update_cache );
156
+			set_site_transient('update_plugins', $update_cache);
157 157
 
158 158
 		} else {
159 159
 
160
-			$version_info = $update_cache->response[ $this->name ];
160
+			$version_info = $update_cache->response[$this->name];
161 161
 
162 162
 		}
163 163
 
164 164
 		// Restore our filter
165
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
165
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
166 166
 
167
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
167
+		if (!empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
168 168
 
169 169
 			// build a plugin list row, with update notification
170
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
171
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
170
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
171
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
172 172
 
173
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
173
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
174 174
 
175
-			if ( empty( $version_info->download_link ) ) {
175
+			if (empty($version_info->download_link)) {
176 176
 				printf(
177
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'lasso' ),
178
-					esc_html( $version_info->name ),
179
-					esc_url( $changelog_link ),
180
-					esc_html( $version_info->new_version )
177
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'lasso'),
178
+					esc_html($version_info->name),
179
+					esc_url($changelog_link),
180
+					esc_html($version_info->new_version)
181 181
 				);
182 182
 			} else {
183 183
 				printf(
184
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'lasso' ),
185
-					esc_html( $version_info->name ),
186
-					esc_url( $changelog_link ),
187
-					esc_html( $version_info->new_version ),
188
-					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
184
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'lasso'),
185
+					esc_html($version_info->name),
186
+					esc_url($changelog_link),
187
+					esc_html($version_info->new_version),
188
+					esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
189 189
 				);
190 190
 			}
191 191
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 	 * @param object  $_args
205 205
 	 * @return object $_data
206 206
 	 */
207
-	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
207
+	function plugins_api_filter($_data, $_action = '', $_args = null) {
208 208
 
209 209
 
210
-		if ( $_action != 'plugin_information' ) {
210
+		if ($_action != 'plugin_information') {
211 211
 
212 212
 			return $_data;
213 213
 
214 214
 		}
215 215
 
216
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
216
+		if (!isset($_args->slug) || ($_args->slug != $this->slug)) {
217 217
 
218 218
 			return $_data;
219 219
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 			)
229 229
 		);
230 230
 
231
-		$api_response = $this->api_request( 'plugin_information', $to_send );
231
+		$api_response = $this->api_request('plugin_information', $to_send);
232 232
 
233
-		if ( false !== $api_response ) {
233
+		if (false !== $api_response) {
234 234
 			$_data = $api_response;
235 235
 		}
236 236
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 	 * @param string  $url
246 246
 	 * @return object $array
247 247
 	 */
248
-	function http_request_args( $args, $url ) {
248
+	function http_request_args($args, $url) {
249 249
 		// If it is an https request and we are performing a package download, disable ssl verification
250
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
250
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
251 251
 			$args['sslverify'] = false;
252 252
 		}
253 253
 		return $args;
@@ -264,40 +264,40 @@  discard block
 block discarded – undo
264 264
 	 * @param array   $_data   Parameters for the API action.
265 265
 	 * @return false||object
266 266
 	 */
267
-	private function api_request( $_action, $_data ) {
267
+	private function api_request($_action, $_data) {
268 268
 
269 269
 		global $wp_version;
270 270
 
271
-		$data = array_merge( $this->api_data, $_data );
271
+		$data = array_merge($this->api_data, $_data);
272 272
 
273
-		if ( $data['slug'] != $this->slug )
273
+		if ($data['slug'] != $this->slug)
274 274
 			return;
275 275
 
276
-		if ( empty( $data['license'] ) )
276
+		if (empty($data['license']))
277 277
 			return;
278 278
 
279
-		if ( $this->api_url == home_url() ) {
279
+		if ($this->api_url == home_url()) {
280 280
 			return false; // Don't allow a plugin to ping itself
281 281
 		}
282 282
 
283 283
 		$api_params = array(
284 284
 			'edd_action' => 'get_version',
285 285
 			'license'    => $data['license'],
286
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
287
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
286
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
287
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
288 288
 			'slug'       => $data['slug'],
289 289
 			'author'     => $data['author'],
290 290
 			'url'        => home_url()
291 291
 		);
292 292
 
293
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
293
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
294 294
 
295
-		if ( ! is_wp_error( $request ) ) {
296
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
295
+		if (!is_wp_error($request)) {
296
+			$request = json_decode(wp_remote_retrieve_body($request));
297 297
 		}
298 298
 
299
-		if ( $request && isset( $request->sections ) ) {
300
-			$request->sections = maybe_unserialize( $request->sections );
299
+		if ($request && isset($request->sections)) {
300
+			$request->sections = maybe_unserialize($request->sections);
301 301
 		} else {
302 302
 			$request = false;
303 303
 		}
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 	public function show_changelog() {
309 309
 
310 310
 
311
-		if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
311
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
312 312
 			return;
313 313
 		}
314 314
 
315
-		if ( empty( $_REQUEST['plugin'] ) ) {
315
+		if (empty($_REQUEST['plugin'])) {
316 316
 			return;
317 317
 		}
318 318
 
319
-		if ( empty( $_REQUEST['slug'] ) ) {
319
+		if (empty($_REQUEST['slug'])) {
320 320
 			return;
321 321
 		}
322 322
 
323
-		if ( ! current_user_can( 'update_plugins' ) ) {
324
-			wp_die( __( 'You do not have permission to install plugin updates', 'lasso' ), __( 'Error', 'lasso' ), array( 'response' => 403 ) );
323
+		if (!current_user_can('update_plugins')) {
324
+			wp_die(__('You do not have permission to install plugin updates', 'lasso'), __('Error', 'lasso'), array('response' => 403));
325 325
 		}
326 326
 
327
-		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
327
+		$response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
328 328
 
329
-		if ( $response && isset( $response->sections['changelog'] ) ) {
330
-			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
329
+		if ($response && isset($response->sections['changelog'])) {
330
+			echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
331 331
 		}
332 332
 
333 333
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -270,11 +270,13 @@
 block discarded – undo
270 270
 
271 271
 		$data = array_merge( $this->api_data, $_data );
272 272
 
273
-		if ( $data['slug'] != $this->slug )
274
-			return;
273
+		if ( $data['slug'] != $this->slug ) {
274
+					return;
275
+		}
275 276
 
276
-		if ( empty( $data['license'] ) )
277
-			return;
277
+		if ( empty( $data['license'] ) ) {
278
+					return;
279
+		}
278 280
 
279 281
 		if ( $this->api_url == home_url() ) {
280 282
 			return false; // Don't allow a plugin to ping itself
Please login to merge, or discard this patch.
includes/lasso_autoloader.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * Loads the class file for a given class name.
63 63
 	 *
64 64
 	 * @param string $class The fully-qualified class name.
65
-	 * @return mixed The mapped file name on success, or boolean false on
65
+	 * @return string|false The mapped file name on success, or boolean false on
66 66
 	 * failure.
67 67
 	 */
68 68
 	public function loadClass($class) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @param string $prefix The namespace prefix.
101 101
 	 * @param string $relative_class The relative class name.
102
-	 * @return mixed Boolean false if no mapped file can be loaded, or the
102
+	 * @return false|string Boolean false if no mapped file can be loaded, or the
103 103
 	 * name of the mapped file that was loaded.
104 104
 	 */
105 105
 	protected function loadMappedFile($prefix, $relative_class) {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@
 block discarded – undo
115 115
 			// replace namespace separators with directory separators
116 116
 			// in the relative class name, append with .php
117 117
 			$file = $base_dir
118
-			        . str_replace('\\', '/', $relative_class)
119
-			        . '.php';
118
+					. str_replace('\\', '/', $relative_class)
119
+					. '.php';
120 120
 
121 121
 			// if the mapped file exists, require it
122 122
 			if ($this->requireFile($file)) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@
 block discarded – undo
40 40
 	 */
41 41
 	public function addNamespace($prefix, $base_dir, $prepend = false) {
42 42
 		// normalize namespace prefix
43
-		$prefix = trim($prefix, '\\') . '\\';
43
+		$prefix = trim($prefix, '\\').'\\';
44 44
 
45 45
 		// normalize the base directory with a trailing separator
46
-		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
46
+		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/';
47 47
 
48 48
 		// initialize the namespace prefix array
49 49
 		if (isset($this->prefixes[$prefix]) === false) {
Please login to merge, or discard this patch.
internal-api/auth.php 4 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,6 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param string $action The AJAX action we are processing.
51 51
 	 * @param string|object $callback_class The class to use for the callback. Either the name of the class or an instance of that class.
52
-	 * @param string $method The name of the callback method.
53 52
 
54 53
 	 */
55 54
 	public function __construct( $action, $callback_class) {
@@ -123,7 +122,7 @@  discard block
 block discarded – undo
123 122
 	 *
124 123
 	 * @access protected
125 124
 	 *
126
-	 * @return bool
125
+	 * @return boolean|null
127 126
 	 */
128 127
 	protected function if_implements() {
129 128
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,28 +52,28 @@  discard block
 block discarded – undo
52 52
 	 * @param string $method The name of the callback method.
53 53
 
54 54
 	 */
55
-	public function __construct( $action, $callback_class) {
56
-		if ( ! is_object( $callback_class ) ) {
55
+	public function __construct($action, $callback_class) {
56
+		if (!is_object($callback_class)) {
57 57
 			$this->callback_instance = new $callback_class;
58
-		}else{
58
+		} else {
59 59
 			$this->callback_instance = $callback_class;
60 60
 		}
61 61
 
62
-		if ( $this->check_nonce() ) {
63
-			if ( is_object( $this->callback_instance ) && $this->if_implements() ) {
64
-				if ( $this->other_auth_checks( $action ) ) {
62
+		if ($this->check_nonce()) {
63
+			if (is_object($this->callback_instance) && $this->if_implements()) {
64
+				if ($this->other_auth_checks($action)) {
65 65
 					$this->status_code = 200;
66 66
 				} else {
67
-					$this->error_message = __( 'Unauthorized action', 'lasso' );
67
+					$this->error_message = __('Unauthorized action', 'lasso');
68 68
 					$this->status_code   = 401;
69 69
 				}
70 70
 			} else {
71
-				$this->error_message = __( 'All callback classes used for processing the Lasso Internal API must implement the lasso\internal_api\api_action interface.', 'lasso' );
71
+				$this->error_message = __('All callback classes used for processing the Lasso Internal API must implement the lasso\internal_api\api_action interface.', 'lasso');
72 72
 				$this->status_code   = 401;
73 73
 			}
74 74
 		} else {
75 75
 			$this->status_code   = 401;
76
-			$this->error_message = __( 'Nonce invalid', 'lasso' );
76
+			$this->error_message = __('Nonce invalid', 'lasso');
77 77
 		}
78 78
 
79 79
 	}
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return bool True if auth checks were all postive.
91 91
 	 */
92
-	protected function other_auth_checks( $action ) {
92
+	protected function other_auth_checks($action) {
93 93
 		$auth_callbacks = $this->callback_instance->auth_callbacks();
94 94
 
95
-		if ( is_array( $auth_callbacks ) && isset( $auth_callbacks[ $action ] ) && is_array( $auth_callbacks[ $action ] ) ) {
96
-			$checks = $auth_callbacks[ $action ];
97
-			if ( is_array( $checks ) ) {
98
-				foreach ( $checks as $check ) {
99
-					if ( is_array( $check ) ) {
100
-						$check = call_user_func( array( $check[0], $check[1] ) );
95
+		if (is_array($auth_callbacks) && isset($auth_callbacks[$action]) && is_array($auth_callbacks[$action])) {
96
+			$checks = $auth_callbacks[$action];
97
+			if (is_array($checks)) {
98
+				foreach ($checks as $check) {
99
+					if (is_array($check)) {
100
+						$check = call_user_func(array($check[0], $check[1]));
101 101
 					} else {
102
-						$check = call_user_func( $check );
102
+						$check = call_user_func($check);
103 103
 					}
104 104
 
105
-					if ( false === $check ) {
105
+					if (false === $check) {
106 106
 						return false;
107 107
 
108 108
 					}
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function if_implements() {
129 129
 
130
-		$implements = class_implements( $this->callback_instance );
131
-		if ( is_array( $implements ) && in_array( 'lasso\internal_api\api_action', $implements ) ) {
130
+		$implements = class_implements($this->callback_instance);
131
+		if (is_array($implements) && in_array('lasso\internal_api\api_action', $implements)) {
132 132
 			return true;
133 133
 
134 134
 		}
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 * @return bool
148 148
 	 */
149 149
 	protected function check_nonce() {
150
-		if ( isset( $this->callback_instance->nonce_action ) ) {
150
+		if (isset($this->callback_instance->nonce_action)) {
151 151
 			$nonce = $this->callback_instance->nonce_action;
152
-		}else{
152
+		} else {
153 153
 			$nonce = 'lasso_editor';
154 154
 		}
155 155
 
156
-		return wp_verify_nonce( $_POST[ 'nonce' ], $nonce );
156
+		return wp_verify_nonce($_POST['nonce'], $nonce);
157 157
 
158 158
 	}
159 159
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function __construct( $action, $callback_class) {
56 56
 		if ( ! is_object( $callback_class ) ) {
57 57
 			$this->callback_instance = new $callback_class;
58
-		}else{
58
+		} else{
59 59
 			$this->callback_instance = $callback_class;
60 60
 		}
61 61
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	protected function check_nonce() {
150 150
 		if ( isset( $this->callback_instance->nonce_action ) ) {
151 151
 			$nonce = $this->callback_instance->nonce_action;
152
-		}else{
152
+		} else{
153 153
 			$nonce = 'lasso_editor';
154 154
 		}
155 155
 
Please login to merge, or discard this patch.
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Check if a request is authorized.
4
- *
5
- * @package   lasso
6
- * @author    Josh Pollock <[email protected]>
7
- * @license   GPL-2.0+
8
- */
3
+	 * Check if a request is authorized.
4
+	 *
5
+	 * @package   lasso
6
+	 * @author    Josh Pollock <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 */
9 9
 
10 10
 namespace lasso\internal_api;
11 11
 
@@ -50,7 +50,6 @@  discard block
 block discarded – undo
50 50
 	 * @param string $action The AJAX action we are processing.
51 51
 	 * @param string|object $callback_class The class to use for the callback. Either the name of the class or an instance of that class.
52 52
 	 * @param string $method The name of the callback method.
53
-
54 53
 	 */
55 54
 	public function __construct( $action, $callback_class) {
56 55
 		if ( ! is_object( $callback_class ) ) {
Please login to merge, or discard this patch.
internal-api/route.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -97,6 +97,7 @@
 block discarded – undo
97 97
 	 *
98 98
 	 * @access protected
99 99
 	 *
100
+	 * @param string $action
100 101
 	 * @return array
101 102
 	 */
102 103
 	protected static function find_callback( $action ) {
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,6 @@
 block discarded – undo
81 81
 	 *
82 82
 	 * @param string $action The AJAX action we are processing.
83 83
 	 * @param string|object $callback The class to use for the callback. Either the name of the class or an instance of that class.
84
-
85 84
 	 *
86 85
 	 * @return \lasso\internal_api\auth
87 86
 	 */
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -24,35 +24,35 @@  discard block
 block discarded – undo
24 24
 		global $wp_query;
25 25
 
26 26
 		//get action, and if set, possibly act
27
-		$action = $wp_query->get( 'action' );
28
-		if ( $action && strpos( $_SERVER['REQUEST_URI'], 'lasso-internal-api' ) ) {
27
+		$action = $wp_query->get('action');
28
+		if ($action && strpos($_SERVER['REQUEST_URI'], 'lasso-internal-api')) {
29 29
 
30
-			$response = __( 'Lasso API Error.', 'lasso' );
30
+			$response = __('Lasso API Error.', 'lasso');
31 31
 			$code = 400;
32 32
 
33 33
 			//see if have a nonce. Will verify it in auth class.
34
-			if ( isset( $_POST[ 'nonce' ] ) ) {
34
+			if (isset($_POST['nonce'])) {
35 35
 
36
-				$callback = self::find_callback( strip_tags( $action ) );
37
-				if ( is_int( $callback )  ) {
36
+				$callback = self::find_callback(strip_tags($action));
37
+				if (is_int($callback)) {
38 38
 					$code = $callback;
39
-				}elseif( ! class_exists( $callback['class'] ) ) {
39
+				}elseif (!class_exists($callback['class'])) {
40 40
 					$code = 415;
41
-				}else {
42
-					$action = str_replace( '-', '_', $action );
41
+				} else {
42
+					$action = str_replace('-', '_', $action);
43 43
 					$callback_instance = new $callback['class'];
44
-					$auth              = self::auth( $action, $callback_instance, $callback['method'] );
45
-					if ( 200 == $auth->status_code && is_array( $callback ) ) {
44
+					$auth              = self::auth($action, $callback_instance, $callback['method']);
45
+					if (200 == $auth->status_code && is_array($callback)) {
46 46
 						$code = 200;
47
-						$data = new find_data( $callback_instance, $action );
48
-						if ( is_array( $data->data ) && ! empty( $data->data ) ) {
49
-							$response = self::route( $action, $callback_instance, $callback['method'], $data->data );
47
+						$data = new find_data($callback_instance, $action);
48
+						if (is_array($data->data) && !empty($data->data)) {
49
+							$response = self::route($action, $callback_instance, $callback['method'], $data->data);
50 50
 						} else {
51 51
 							$code = 500;
52 52
 						}
53 53
 
54 54
 					} else {
55
-						if ( isset( $auth->error_message ) && is_string( $auth->error_message ) ) {
55
+						if (isset($auth->error_message) && is_string($auth->error_message)) {
56 56
 							$response = $auth->error_message;
57 57
 						}
58 58
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
 				}
63 63
 
64
-			}else{
64
+			} else {
65 65
 				$code = 401;
66
-				$response = __( 'Nonce not set.', 'lasso' );
66
+				$response = __('Nonce not set.', 'lasso');
67 67
 			}
68 68
 
69
-			self::respond( $response, $code );
69
+			self::respond($response, $code);
70 70
 
71 71
 		}
72 72
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return \lasso\internal_api\auth
87 87
 	 */
88
-	protected static function auth( $action, $callback ) {
89
-		return new auth( $action, $callback );
88
+	protected static function auth($action, $callback) {
89
+		return new auth($action, $callback);
90 90
 
91 91
 	}
92 92
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return array
101 101
 	 */
102
-	protected static function find_callback( $action ) {
103
-		if ( $action ) {
104
-			$parts = explode( '_', $action );
102
+	protected static function find_callback($action) {
103
+		if ($action) {
104
+			$parts = explode('_', $action);
105 105
 
106
-			if ( isset( $parts[0] ) && isset( $parts[1] ) && isset( $parts[2] ) ) {
107
-				$class     = str_replace( '-', '_', $parts[1] );
106
+			if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) {
107
+				$class     = str_replace('-', '_', $parts[1]);
108 108
 
109 109
 				$class = "\\lasso\\{$parts[0]}\\{$class}";
110
-				$callback  = str_replace( '-', '_', $parts[2] );
110
+				$callback  = str_replace('-', '_', $parts[2]);
111 111
 
112 112
 				return array(
113 113
 					'class'  => $class,
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return mixed
138 138
 	 */
139
-	protected static function route( $action, $callback, $method, $data ) {
140
-		if (  method_exists( $callback, $method ) ) {
141
-			$response = call_user_func( array( $callback, $method ), $data  );
139
+	protected static function route($action, $callback, $method, $data) {
140
+		if (method_exists($callback, $method)) {
141
+			$response = call_user_func(array($callback, $method), $data);
142 142
 
143 143
 			return $response;
144 144
 
@@ -156,29 +156,29 @@  discard block
 block discarded – undo
156 156
 	 * @param array|string $response The response message to send.
157 157
 	 * @param bool|int $code Response code or bool. If is bool, response code will be 200 or 401
158 158
 	 */
159
-	protected static function respond( $response, $code ) {
160
-		if ( true === $code ) {
159
+	protected static function respond($response, $code) {
160
+		if (true === $code) {
161 161
 			$code = 200;
162 162
 		}
163 163
 
164
-		if ( false == $code ) {
164
+		if (false == $code) {
165 165
 			$code = 401;
166 166
 		}
167 167
 
168
-		if ( is_string( $response ) ) {
168
+		if (is_string($response)) {
169 169
 			$data[] = $response;
170
-		}elseif( is_array( $response ) ) {
170
+		}elseif (is_array($response)) {
171 171
 			$data = $response;
172
-		}else{
172
+		} else {
173 173
 			$data[] = $code;
174 174
 		}
175 175
 
176
-		status_header( $code );
176
+		status_header($code);
177 177
 		nocache_headers();
178
-		if ( 200 == $code ) {
179
-			wp_send_json_success( $data );
180
-		}else{
181
-			wp_send_json_error( $data );
178
+		if (200 == $code) {
179
+			wp_send_json_success($data);
180
+		} else {
181
+			wp_send_json_error($data);
182 182
 		}
183 183
 
184 184
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public static function init() {
202 202
 
203
-		if ( ! self::$instance ) {
203
+		if (!self::$instance) {
204 204
 			self::$instance = new self;
205 205
 		}
206 206
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 				$callback = self::find_callback( strip_tags( $action ) );
37 37
 				if ( is_int( $callback )  ) {
38 38
 					$code = $callback;
39
-				}elseif( ! class_exists( $callback['class'] ) ) {
39
+				} elseif( ! class_exists( $callback['class'] ) ) {
40 40
 					$code = 415;
41
-				}else {
41
+				} else {
42 42
 					$action = str_replace( '-', '_', $action );
43 43
 					$callback_instance = new $callback['class'];
44 44
 					$auth              = self::auth( $action, $callback_instance, $callback['method'] );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 				}
63 63
 
64
-			}else{
64
+			} else{
65 65
 				$code = 401;
66 66
 				$response = __( 'Nonce not set.', 'lasso' );
67 67
 			}
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 
168 168
 		if ( is_string( $response ) ) {
169 169
 			$data[] = $response;
170
-		}elseif( is_array( $response ) ) {
170
+		} elseif( is_array( $response ) ) {
171 171
 			$data = $response;
172
-		}else{
172
+		} else{
173 173
 			$data[] = $code;
174 174
 		}
175 175
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		nocache_headers();
178 178
 		if ( 200 == $code ) {
179 179
 			wp_send_json_success( $data );
180
-		}else{
180
+		} else{
181 181
 			wp_send_json_error( $data );
182 182
 		}
183 183
 
Please login to merge, or discard this patch.
public/includes/helpers.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  * If we're on multsite we'll grab the site option which is stored in the main blogs site option tables, otherwise
7 7
  * we'll grab the option which is stored on the single blogs option tables
8 8
  *
9
- * @param unknown $option  string name of the option
10
- * @param unknown $section string name of the section
9
+ * @param string $option  string name of the option
10
+ * @param string $section string name of the section
11 11
  * @param unknown $default string/int default option value
12 12
  * @return the option value
13 13
  * @since 1.0
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  * Return a CSS class of an automatically supported theme
53 53
  *
54 54
  * @since 0.8.6
55
- * @return a css class if the theme is supported, false if nothing
55
+ * @return string|false css class if the theme is supported, false if nothing
56 56
  */
57 57
 function lasso_get_supported_theme_class() {
58 58
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 *	Used internally as a callback to build a tab or content area for modal addons
229 229
 *
230 230
 *	@param $tab object
231
-*	@param $type string tab or content
231
+*	@param string $type string tab or content
232 232
 *	@uses lasso_modal_addons()
233 233
 *	@since 0.9.4
234 234
 */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
 		'public' => true,
201 201
 	), 'objects' );
202 202
 	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
203
-    unset( $post_types[ 'attachment' ] );
203
+	unset( $post_types[ 'attachment' ] );
204 204
 
205 205
 	/**
206 206
 	 * Set which post types are allowed
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@  discard block
 block discarded – undo
12 12
  * @return the option value
13 13
  * @since 1.0
14 14
  */
15
-function lasso_editor_get_option( $option, $section, $default = '' ) {
15
+function lasso_editor_get_option($option, $section, $default = '') {
16 16
 
17
-	if ( empty( $option ) )
17
+	if (empty($option))
18 18
 		return;
19 19
 
20
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
20
+	if (function_exists('is_multisite') && is_multisite()) {
21 21
 
22
-		$options = get_site_option( $section );
22
+		$options = get_site_option($section);
23 23
 
24 24
 	} else {
25 25
 
26
-		$options = get_option( $section );
26
+		$options = get_option($section);
27 27
 	}
28 28
 
29
-	if ( isset( $options[$option] ) ) {
29
+	if (isset($options[$option])) {
30 30
 		return $options[$option];
31 31
 	}
32 32
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function lasso_editor_galleries_exist() {
42 42
 
43
-	$q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) );
43
+	$q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish'));
44 44
 
45
-	if ( $q->have_posts() )
45
+	if ($q->have_posts())
46 46
 		return true;
47 47
 	else
48 48
 		return false;
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 function lasso_get_supported_theme_class() {
58 58
 
59 59
 	$name  	= wp_get_theme()->get('Name');
60
-	$slug  	= lasso_clean_string( $name );
60
+	$slug  	= lasso_clean_string($name);
61 61
 
62
-	switch ( $slug ) {
62
+	switch ($slug) {
63 63
 
64 64
 		case 'twentytwelve': // automattic
65 65
 			$out = '.entry-content';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 	}
114 114
 
115
-	return !empty( $out ) ? $out : false;
115
+	return !empty($out) ? $out : false;
116 116
 }
117 117
 
118 118
 /**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 *	@since 0.8.7
123 123
 *	@return string of comma separated classes
124 124
 */
125
-function lasso_supported_no_save(){
125
+function lasso_supported_no_save() {
126 126
 
127 127
 	return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet');
128 128
 }
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return array|mixed|object|string|void
138 138
  */
139
-function lasso_sanitize_data( $data ) {
140
-	return \lasso\sanatize::do_sanitize( $data );
139
+function lasso_sanitize_data($data) {
140
+	return \lasso\sanatize::do_sanitize($data);
141 141
 
142 142
 }
143 143
 
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
  *	@since 0.9.3
148 148
  *	@return string of comma delimited category slugs
149 149
 */
150
-function lasso_get_post_objects( $postid = '', $taxonomy = 'category') {
150
+function lasso_get_post_objects($postid = '', $taxonomy = 'category') {
151 151
 
152
-	if ( empty( $postid ) )
152
+	if (empty($postid))
153 153
 		$postid = get_the_ID();
154 154
 
155
-	$objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid );
155
+	$objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid);
156 156
 
157
-	if ( empty( $objects) )
157
+	if (empty($objects))
158 158
 		return;
159 159
 
160 160
 	$out = '';
161
-	foreach( $objects as $object ) {
161
+	foreach ($objects as $object) {
162 162
 		$out .= $object->slug.', ';
163 163
 	}
164 164
 
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
  *	@since 0.9.3
173 173
  *	@return array all categoiries
174 174
 */
175
-function lasso_get_objects( $taxonomy = 'category' ) {
175
+function lasso_get_objects($taxonomy = 'category') {
176 176
 
177 177
 	$objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0));
178 178
 
179
-	if ( empty( $objects) )
179
+	if (empty($objects))
180 180
 		return;
181 181
 
182 182
 	$out = array();
183
-	foreach( $objects as $object ) {
183
+	foreach ($objects as $object) {
184 184
 		$out[] = $object->slug;
185 185
 	}
186 186
 
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function lasso_post_types() {
198 198
 
199
-	$post_types = get_post_types( array(
199
+	$post_types = get_post_types(array(
200 200
 		'public' => true,
201
-	), 'objects' );
202
-	$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) );
203
-    unset( $post_types[ 'attachment' ] );
201
+	), 'objects');
202
+	$post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label'));
203
+    unset($post_types['attachment']);
204 204
 
205 205
 	/**
206 206
 	 * Set which post types are allowed
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered.
211 211
 	 */
212
-	$allowed_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page' ) );
213
-	foreach( $post_types as $name => $label ) {
214
-		if ( ! in_array( $name, $allowed_post_types ) ) {
215
-			unset( $post_types[ $name ] );
212
+	$allowed_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page'));
213
+	foreach ($post_types as $name => $label) {
214
+		if (!in_array($name, $allowed_post_types)) {
215
+			unset($post_types[$name]);
216 216
 		}
217 217
 
218 218
 	}
@@ -232,22 +232,22 @@  discard block
 block discarded – undo
232 232
 *	@uses lasso_modal_addons()
233 233
 *	@since 0.9.4
234 234
 */
235
-function lasso_modal_addons_content( $tab = '', $type ){
235
+function lasso_modal_addons_content($tab = '', $type) {
236 236
 
237
-	$name = lasso_clean_string( $tab['name'] );
237
+	$name = lasso_clean_string($tab['name']);
238 238
 
239
-	if ( 'tab' == $type ) {
239
+	if ('tab' == $type) {
240 240
 
241
-		$out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] );
241
+		$out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']);
242 242
 
243
-	} else if ( 'content' == $type ){
243
+	} else if ('content' == $type) {
244 244
 
245
-		$content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false;
246
-		$options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false;
245
+		$content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false;
246
+		$options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false;
247 247
 
248
-		$out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s">
248
+		$out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s">
249 249
 			%s%s
250
-			</div>', $name, $content, lasso_option_form( $name, $options ) );
250
+			</div>', $name, $content, lasso_option_form($name, $options));
251 251
 
252 252
 	}
253 253
 
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 *
263 263
 * @return void|string
264 264
 */
265
-function lasso_clean_string( $string = '' ) {
265
+function lasso_clean_string($string = '') {
266 266
 
267
-	if ( empty( $string ) )
267
+	if (empty($string))
268 268
 		return;
269 269
 
270
-	return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) );
270
+	return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string)));
271 271
 }
272 272
 
273 273
 /**
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return void|string
282 282
  */
283
-function lasso_unclean_string( $string = '' ) {
283
+function lasso_unclean_string($string = '') {
284 284
 
285
-	if ( empty( $string ) ) {
285
+	if (empty($string)) {
286 286
 		return;
287 287
 	}
288 288
 
289
-	return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) );
289
+	return sanitize_text_field(strtolower(str_replace('-', '_', $string)));
290 290
 }
291 291
 
292 292
 
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
  * @param unknown $postid int the id of the post object to check against
302 302
  * @since 1.0
303 303
  */
304
-if ( !function_exists( 'lasso_user_can' ) ):
305
-	function lasso_user_can( $action = '', $postid = 0 ) {
304
+if (!function_exists('lasso_user_can')):
305
+	function lasso_user_can($action = '', $postid = 0) {
306 306
 
307
-		if ( empty( $action ) )
307
+		if (empty($action))
308 308
 			$action = 'edit_posts';
309 309
 
310
-		if ( empty( $postid ) )
310
+		if (empty($postid))
311 311
 			$postid = get_the_ID();
312 312
 
313
-		if ( is_user_logged_in() && current_user_can( $action, $postid ) ) {
313
+		if (is_user_logged_in() && current_user_can($action, $postid)) {
314 314
 
315 315
 			return true;
316 316
 
@@ -328,25 +328,25 @@  discard block
 block discarded – undo
328 328
 *
329 329
 *	@since 0.9.5
330 330
 */
331
-if ( !function_exists('lasso_editor_empty_results') ):
331
+if (!function_exists('lasso_editor_empty_results')):
332 332
 
333
-	function lasso_editor_empty_results( $type = 'posts' ){
333
+	function lasso_editor_empty_results($type = 'posts') {
334 334
 
335
-		if ( 'posts' == $type ) {
335
+		if ('posts' == $type) {
336 336
 
337
-			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') );
337
+			$string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso'));
338 338
 			$icon = 'lasso-icon-file-text2';
339 339
 			$button = false;
340 340
 
341
-		} elseif ( 'revision' == $type ) {
341
+		} elseif ('revision' == $type) {
342 342
 
343
-			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') );
343
+			$string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso'));
344 344
 			$icon = 'lasso-icon-history';
345
-			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') );
345
+			$button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso'));
346 346
 
347 347
 		}
348 348
 
349
-		return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button );
349
+		return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button);
350 350
 	}
351 351
 
352 352
 endif;
Please login to merge, or discard this patch.
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function lasso_editor_get_option( $option, $section, $default = '' ) {
16 16
 
17
-	if ( empty( $option ) )
18
-		return;
17
+	if ( empty( $option ) ) {
18
+			return;
19
+	}
19 20
 
20 21
 	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
21 22
 
@@ -42,11 +43,12 @@  discard block
 block discarded – undo
42 43
 
43 44
 	$q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) );
44 45
 
45
-	if ( $q->have_posts() )
46
-		return true;
47
-	else
48
-		return false;
49
-}
46
+	if ( $q->have_posts() ) {
47
+			return true;
48
+	} else {
49
+			return false;
50
+	}
51
+	}
50 52
 
51 53
 /**
52 54
  * Return a CSS class of an automatically supported theme
@@ -149,13 +151,15 @@  discard block
 block discarded – undo
149 151
 */
150 152
 function lasso_get_post_objects( $postid = '', $taxonomy = 'category') {
151 153
 
152
-	if ( empty( $postid ) )
153
-		$postid = get_the_ID();
154
+	if ( empty( $postid ) ) {
155
+			$postid = get_the_ID();
156
+	}
154 157
 
155 158
 	$objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid );
156 159
 
157
-	if ( empty( $objects) )
158
-		return;
160
+	if ( empty( $objects) ) {
161
+			return;
162
+	}
159 163
 
160 164
 	$out = '';
161 165
 	foreach( $objects as $object ) {
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
 
177 181
 	$objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0));
178 182
 
179
-	if ( empty( $objects) )
180
-		return;
183
+	if ( empty( $objects) ) {
184
+			return;
185
+	}
181 186
 
182 187
 	$out = array();
183 188
 	foreach( $objects as $object ) {
@@ -264,8 +269,9 @@  discard block
 block discarded – undo
264 269
 */
265 270
 function lasso_clean_string( $string = '' ) {
266 271
 
267
-	if ( empty( $string ) )
268
-		return;
272
+	if ( empty( $string ) ) {
273
+			return;
274
+	}
269 275
 
270 276
 	return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) );
271 277
 }
@@ -304,11 +310,13 @@  discard block
 block discarded – undo
304 310
 if ( !function_exists( 'lasso_user_can' ) ):
305 311
 	function lasso_user_can( $action = '', $postid = 0 ) {
306 312
 
307
-		if ( empty( $action ) )
308
-			$action = 'edit_posts';
313
+		if ( empty( $action ) ) {
314
+					$action = 'edit_posts';
315
+		}
309 316
 
310
-		if ( empty( $postid ) )
311
-			$postid = get_the_ID();
317
+		if ( empty( $postid ) ) {
318
+					$postid = get_the_ID();
319
+		}
312 320
 
313 321
 		if ( is_user_logged_in() && current_user_can( $action, $postid ) ) {
314 322
 
Please login to merge, or discard this patch.
public/includes/lasso.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 	 *
67 67
 	 * @since    0.0.1
68 68
 	 *
69
-	 * @return    Plugin slug variable.
69
+	 * @return    string slug variable.
70 70
 	 */
71 71
 	public function get_plugin_slug() {
72 72
 		return $this->plugin_slug;
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 		require_once LASSO_DIR.'/public/includes/option-engine.php';
52 52
 
53 53
 		// Activate plugin when new blog is added
54
-		add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
54
+		add_action('wpmu_new_blog', array($this, 'activate_new_site'));
55 55
 
56 56
 		// Load plugin text domain
57
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
57
+		add_action('init', array($this, 'load_plugin_textdomain'));
58 58
 
59 59
 		//enqueue assets
60 60
 		new assets();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public static function get_instance() {
83 83
 
84 84
 		// If the single instance hasn't been set, set it now.
85
-		if ( null == self::$instance ) {
85
+		if (null == self::$instance) {
86 86
 			self::$instance = new self;
87 87
 		}
88 88
 
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
 	 *                                       WPMU is disabled or plugin is
100 100
 	 *                                       activated on an individual blog.
101 101
 	 */
102
-	public static function activate( $network_wide ) {
102
+	public static function activate($network_wide) {
103 103
 
104
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
104
+		if (function_exists('is_multisite') && is_multisite()) {
105 105
 
106
-			if ( $network_wide  ) {
106
+			if ($network_wide) {
107 107
 
108 108
 				// Get all blog ids
109 109
 				$blog_ids = self::get_blog_ids();
110 110
 
111
-				foreach ( $blog_ids as $blog_id ) {
111
+				foreach ($blog_ids as $blog_id) {
112 112
 
113
-					switch_to_blog( $blog_id );
113
+					switch_to_blog($blog_id);
114 114
 					self::single_activate();
115 115
 				}
116 116
 
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 	 *                                       WPMU is disabled or plugin is
137 137
 	 *                                       deactivated on an individual blog.
138 138
 	 */
139
-	public static function deactivate( $network_wide ) {
139
+	public static function deactivate($network_wide) {
140 140
 
141
-		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
141
+		if (function_exists('is_multisite') && is_multisite()) {
142 142
 
143
-			if ( $network_wide ) {
143
+			if ($network_wide) {
144 144
 
145 145
 				// Get all blog ids
146 146
 				$blog_ids = self::get_blog_ids();
147 147
 
148
-				foreach ( $blog_ids as $blog_id ) {
148
+				foreach ($blog_ids as $blog_id) {
149 149
 
150
-					switch_to_blog( $blog_id );
150
+					switch_to_blog($blog_id);
151 151
 					self::single_deactivate();
152 152
 
153 153
 				}
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @param int     $blog_id ID of the new blog.
173 173
 	 */
174
-	public function activate_new_site( $blog_id ) {
174
+	public function activate_new_site($blog_id) {
175 175
 
176
-		if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
176
+		if (1 !== did_action('wpmu_new_blog')) {
177 177
 			return;
178 178
 		}
179 179
 
180
-		switch_to_blog( $blog_id );
180
+		switch_to_blog($blog_id);
181 181
 		self::single_activate();
182 182
 		restore_current_blog();
183 183
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			WHERE archived = '0' AND spam = '0'
203 203
 			AND deleted = '0'";
204 204
 
205
-		return $wpdb->get_col( $sql );
205
+		return $wpdb->get_col($sql);
206 206
 
207 207
 	}
208 208
 
@@ -213,18 +213,18 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	private static function single_activate() {
215 215
 
216
-		$curr_version = get_option( 'lasso_version' );
216
+		$curr_version = get_option('lasso_version');
217 217
 
218 218
 		// update upgraded from
219
-		if ( $curr_version ) {
220
-			update_option( 'lasso_updated_from', $curr_version );
219
+		if ($curr_version) {
220
+			update_option('lasso_updated_from', $curr_version);
221 221
 		}
222 222
 
223 223
 		// update lasso version option
224
-		update_option( 'lasso_version', LASSO_VERSION );
224
+		update_option('lasso_version', LASSO_VERSION);
225 225
 
226 226
 		// set transietn for activation welcome
227
-		set_transient( '_lasso_welcome_redirect', true, 30 );
227
+		set_transient('_lasso_welcome_redirect', true, 30);
228 228
 
229 229
 
230 230
 	}
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	public function load_plugin_textdomain() {
247 247
 
248 248
 		$domain = $this->plugin_slug;
249
-		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
249
+		$locale = apply_filters('plugin_locale', get_locale(), $domain);
250 250
 
251
-		$out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' );
251
+		$out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo');
252 252
 	}
253 253
 }
Please login to merge, or discard this patch.
admin/includes/load_admin.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	*	Adds an admin notice reminding the user if their license key has not been saved
131
-	*
132
-	*	@since 0.9.7
133
-	*	@todo make dismissible
134
-	*/
130
+	 *	Adds an admin notice reminding the user if their license key has not been saved
131
+	 *
132
+	 *	@since 0.9.7
133
+	 *	@todo make dismissible
134
+	 */
135 135
 	public function license_nag(){
136 136
 
137 137
 		$screen 	= get_current_screen();
@@ -152,26 +152,26 @@  discard block
 block discarded – undo
152 152
 
153 153
 			if ( empty( $license ) ) {
154 154
 
155
-        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
155
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
156 156
 
157
-        	} else if ( 'invalid' == $status ){ // license key entered wrong or something
157
+			} else if ( 'invalid' == $status ){ // license key entered wrong or something
158 158
 
159 159
 				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link );
160 160
 
161
-        	} else if ( empty( $status ) ){ // license key saved but not activated
161
+			} else if ( empty( $status ) ){ // license key saved but not activated
162 162
 
163 163
 				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link );
164 164
 
165
-        	}
165
+			}
166 166
 		}
167 167
 
168 168
 	}
169 169
 
170 170
 	/**
171
-	*  Process hiding the dimiss
172
-	*
173
-	* @since 0.9.7
174
-	*/
171
+	 *  Process hiding the dimiss
172
+	 *
173
+	 * @since 0.9.7
174
+	 */
175 175
 	public function dismiss_nag() {
176 176
 
177 177
 		if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) {
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 		$plugin = lasso::get_instance();
44 44
 		$this->plugin_slug = $plugin->get_plugin_slug();
45 45
 
46
-		add_action( 'admin_head',  			array( $this, 'admin_assets' ) );
47
-		add_action( 'admin_notices', 		array( $this, 'license_nag' ) );
48
-		add_action( 'admin_head', 			array( $this, 'dismiss_nag' ) );
49
-		add_filter( 'plugin_row_meta',    	array( $this, 'plugin_meta' ), 10, 2 );
46
+		add_action('admin_head', array($this, 'admin_assets'));
47
+		add_action('admin_notices', array($this, 'license_nag'));
48
+		add_action('admin_head', array($this, 'dismiss_nag'));
49
+		add_filter('plugin_row_meta', array($this, 'plugin_meta'), 10, 2);
50 50
 
51
-		if ( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
51
+		if (!class_exists('EDD_SL_Plugin_Updater')) {
52 52
 			include LASSO_DIR.'admin/includes/EDD_SL_Plugin_Updater.php';
53 53
 		}
54 54
 
55
-		if ( !class_exists( 'TGM_Plugin_Activation' ) ) {
55
+		if (!class_exists('TGM_Plugin_Activation')) {
56 56
 			include LASSO_DIR.'admin/includes/class-tgm-plugin-activation.php';
57 57
 		}
58 58
 
59 59
 		new menus\welcome();
60 60
 		new menus\settings();
61 61
 
62
-		if ( !defined( 'LASSO_AGENCY_MODE' ) ) {
62
+		if (!defined('LASSO_AGENCY_MODE')) {
63 63
 			new menus\license();
64 64
 		}
65 65
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public static function get_instance() {
76 76
 
77 77
 		// If the single instance hasn't been set, set it now.
78
-		if ( null == self::$instance ) {
78
+		if (null == self::$instance) {
79 79
 			self::$instance = new self;
80 80
 		}
81 81
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 			'dashboard_page_lasso-welcome-screen'
98 98
 		);
99 99
 
100
-		foreach ( $pages as $page ) {
101
-			wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery' ), LASSO_VERSION, true );
102
-			wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION );
100
+		foreach ($pages as $page) {
101
+			wp_enqueue_script('lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array('jquery'), LASSO_VERSION, true);
102
+			wp_enqueue_style('lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION);
103 103
 		}
104 104
 	}
105 105
 
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return array new array of links for our plugin listing on plugins.php
114 114
 	 */
115
-	public function plugin_meta( $links, $file ) {
115
+	public function plugin_meta($links, $file) {
116 116
 
117
-		if ( strpos( $file, 'lasso.php' ) !== false && !defined( 'LASSO_AGENCY_MODE' ) ) {
117
+		if (strpos($file, 'lasso.php') !== false && !defined('LASSO_AGENCY_MODE')) {
118 118
 
119 119
 			$new_links = array(
120 120
 				'<a href="http://edituswp.com/help" target="_blank">Help</a>'
121 121
 			);
122 122
 
123
-			$links = array_merge( $links, $new_links );
123
+			$links = array_merge($links, $new_links);
124 124
 		}
125 125
 
126 126
 		return $links;
@@ -132,35 +132,35 @@  discard block
 block discarded – undo
132 132
 	*	@since 0.9.7
133 133
 	*	@todo make dismissible
134 134
 	*/
135
-	public function license_nag(){
135
+	public function license_nag() {
136 136
 
137
-		$screen 	= get_current_screen();
138
-		$welcome    = 'toplevel_page_lasso-editor' == $screen->id;
139
-		$license  	= get_option( 'lasso_license_key' );
140
-		$status   	= get_option( 'lasso_license_status' );
137
+		$screen = get_current_screen();
138
+		$welcome = 'toplevel_page_lasso-editor' == $screen->id;
139
+		$license  	= get_option('lasso_license_key');
140
+		$status   	= get_option('lasso_license_status');
141 141
 
142
-		$message_empty    = apply_filters('lasso_empty_license_message','Your license key for support and automatic updates for Editus is missing!');
143
-		$message_invalid  = apply_filters('lasso_invalid_license_message','Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
144
-		$message_inactive  = apply_filters('lasso_inactive_license_message','It looks like your license key has not yet been activated.');
142
+		$message_empty    = apply_filters('lasso_empty_license_message', 'Your license key for support and automatic updates for Editus is missing!');
143
+		$message_invalid  = apply_filters('lasso_invalid_license_message', 'Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.');
144
+		$message_inactive = apply_filters('lasso_inactive_license_message', 'It looks like your license key has not yet been activated.');
145 145
 
146
-		$license_link 	  = sprintf('<a href="%s">Update License</a>', esc_url( add_query_arg( array( 'page' => 'lasso-license' ), admin_url('admin.php') ) ) );
147
-		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url( add_query_arg( 'lasso-notice', 'dismiss' ) ), __('Dismiss this notice.','lasso') );
146
+		$license_link = sprintf('<a href="%s">Update License</a>', esc_url(add_query_arg(array('page' => 'lasso-license'), admin_url('admin.php'))));
147
+		$dismiss_link     = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url(add_query_arg('lasso-notice', 'dismiss')), __('Dismiss this notice.', 'lasso'));
148 148
 
149
-		$not_hidden       = get_user_meta( get_current_user_ID(), 'lasso_license_nag_dismissed', true );
149
+		$not_hidden       = get_user_meta(get_current_user_ID(), 'lasso_license_nag_dismissed', true);
150 150
 
151
-		if ( current_user_can('manage_options') && !$welcome && !defined( 'LASSO_AGENCY_MODE') && !$not_hidden ) {
151
+		if (current_user_can('manage_options') && !$welcome && !defined('LASSO_AGENCY_MODE') && !$not_hidden) {
152 152
 
153
-			if ( empty( $license ) ) {
153
+			if (empty($license)) {
154 154
 
155
-        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link );
155
+        		printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link);
156 156
 
157
-        	} else if ( 'invalid' == $status ){ // license key entered wrong or something
157
+        	} else if ('invalid' == $status) { // license key entered wrong or something
158 158
 
159
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link );
159
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link, $dismiss_link);
160 160
 
161
-        	} else if ( empty( $status ) ){ // license key saved but not activated
161
+        	} else if (empty($status)) { // license key saved but not activated
162 162
 
163
-				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link );
163
+				printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link);
164 164
 
165 165
         	}
166 166
 		}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function dismiss_nag() {
176 176
 
177
-		if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) {
178
-			update_user_meta( get_current_user_id(), 'lasso_license_nag_dismissed', 1 );
177
+		if (isset($_GET['lasso-notice']) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options')) {
178
+			update_user_meta(get_current_user_id(), 'lasso_license_nag_dismissed', 1);
179 179
 		}
180 180
 	}
181 181
 }
Please login to merge, or discard this patch.
admin/includes/menus/license.php 2 patches
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,79 +6,79 @@  discard block
 block discarded – undo
6 6
 
7 7
 	function __construct() {
8 8
 
9
-		define( 'LASSO_STORE_ITEM_NAME', 'lasso' );
10
-		define( 'LASSO_STORE_URL', 'https://edituswp.com' );
11
-
12
-		add_action( 'admin_init',  array( $this, 'plugin_updater' ), 0 );
13
-		add_action( 'admin_menu',  array( $this, 'license_menu' ) );
14
-		add_action( 'admin_init',  array( $this, 'register_option' ) );
15
-		add_action( 'admin_init',  array( $this, 'activate_license' ) );
16
-		add_action( 'admin_init',  array( $this, 'deactivate_license' ) );
9
+		define('LASSO_STORE_ITEM_NAME', 'lasso');
10
+		define('LASSO_STORE_URL', 'https://edituswp.com');
11
+
12
+		add_action('admin_init', array($this, 'plugin_updater'), 0);
13
+		add_action('admin_menu', array($this, 'license_menu'));
14
+		add_action('admin_init', array($this, 'register_option'));
15
+		add_action('admin_init', array($this, 'activate_license'));
16
+		add_action('admin_init', array($this, 'deactivate_license'));
17 17
 	}
18 18
 
19 19
 	function plugin_updater() {
20 20
 
21 21
 		// retrieve our license key from the DB
22
-		$license_key = trim( get_option( 'lasso_license_key' ) );
22
+		$license_key = trim(get_option('lasso_license_key'));
23 23
 
24 24
 		// setup the updater
25
-		$edd_updater = new \EDD_SL_Plugin_Updater( LASSO_STORE_URL , LASSO_FILE, array(
25
+		$edd_updater = new \EDD_SL_Plugin_Updater(LASSO_STORE_URL, LASSO_FILE, array(
26 26
 				'version'  => LASSO_VERSION,
27 27
 				'license'  => $license_key,
28 28
 				'item_name' => LASSO_STORE_ITEM_NAME,
29
-				'author'  => __( 'Aesopinteractive LLC', 'lasso' )
29
+				'author'  => __('Aesopinteractive LLC', 'lasso')
30 30
 			)
31 31
 		);
32 32
 
33 33
 	}
34 34
 	function license_menu() {
35 35
 
36
-		if ( function_exists( 'is_multisite' ) && !is_multisite() ) {
37
-			add_submenu_page( 'lasso-editor', __( 'License Key', 'lasso' ), __( 'License', 'lasso' ), 'manage_options', 'lasso-license', array( $this, 'license_page' ) );
36
+		if (function_exists('is_multisite') && !is_multisite()) {
37
+			add_submenu_page('lasso-editor', __('License Key', 'lasso'), __('License', 'lasso'), 'manage_options', 'lasso-license', array($this, 'license_page'));
38 38
 		}
39 39
 	}
40 40
 	function license_page() {
41
-		$license  = get_option( 'lasso_license_key' );
42
-		$status  = get_option( 'lasso_license_status' );
41
+		$license = get_option('lasso_license_key');
42
+		$status = get_option('lasso_license_status');
43 43
 
44 44
 ?>
45 45
 		<div class="wrap">
46
-			<h2><?php _e( 'Editus License', 'lasso' ); ?></h2>
47
-			<p><?php _e( 'Input the license key you recieved with your purchase to ensure your version of Editus stays updated.', 'lasso' );?></p>
46
+			<h2><?php _e('Editus License', 'lasso'); ?></h2>
47
+			<p><?php _e('Input the license key you recieved with your purchase to ensure your version of Editus stays updated.', 'lasso'); ?></p>
48 48
 			<form class="lasso--form-settings" method="post" action="options.php">
49 49
 
50
-				<?php settings_fields( 'lasso_license' ); ?>
50
+				<?php settings_fields('lasso_license'); ?>
51 51
 
52 52
 				<table class="form-table">
53 53
 					<tbody>
54 54
 						<tr valign="top">
55 55
 							<th scope="row" valign="top">
56
-								<?php _e( 'License Key', 'lasso' ); ?>
56
+								<?php _e('License Key', 'lasso'); ?>
57 57
 							</th>
58 58
 							<td>
59
-								<input id="lasso_license_key" name="lasso_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" />
59
+								<input id="lasso_license_key" name="lasso_license_key" type="text" class="regular-text" value="<?php esc_attr_e($license); ?>" />
60 60
 							</td>
61 61
 						</tr>
62
-						<?php if ( false !== $license ) { ?>
62
+						<?php if (false !== $license) { ?>
63 63
 							<tr valign="top">
64 64
 								<th scope="row" valign="top">
65
-									<?php _e( 'Activate License', 'lasso' ); ?>
65
+									<?php _e('Activate License', 'lasso'); ?>
66 66
 								</th>
67 67
 								<td>
68
-									<?php if ( $status !== false && $status == 'valid' ) { ?>
69
-										<span style="color:green;"><?php _e( 'active' ); ?></span>
70
-										<?php wp_nonce_field( 'lasso_license_nonce', 'lasso_license_nonce' ); ?>
71
-										<input type="submit" class="button-secondary" name="edd_license_deactivate" value="<?php esc_attr_e( 'Deactivate License', 'lasso' ); ?>"/>
68
+									<?php if ($status !== false && $status == 'valid') { ?>
69
+										<span style="color:green;"><?php _e('active'); ?></span>
70
+										<?php wp_nonce_field('lasso_license_nonce', 'lasso_license_nonce'); ?>
71
+										<input type="submit" class="button-secondary" name="edd_license_deactivate" value="<?php esc_attr_e('Deactivate License', 'lasso'); ?>"/>
72 72
 									<?php } else {
73
-				wp_nonce_field( 'lasso_license_nonce', 'lasso_license_nonce' ); ?>
74
-										<input type="submit" class="button-secondary" name="edd_license_activate" value="<?php esc_attr_e( 'Activate License', 'lasso' ); ?>"/>
73
+				wp_nonce_field('lasso_license_nonce', 'lasso_license_nonce'); ?>
74
+										<input type="submit" class="button-secondary" name="edd_license_activate" value="<?php esc_attr_e('Activate License', 'lasso'); ?>"/>
75 75
 									<?php } ?>
76 76
 								</td>
77 77
 							</tr>
78 78
 						<?php } ?>
79 79
 					</tbody>
80 80
 				</table>
81
-				<?php submit_button( 'Save License' ); ?>
81
+				<?php submit_button('Save License'); ?>
82 82
 
83 83
 			</form>
84 84
 		<?php
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 	// register option
88 88
 	function register_option() {
89 89
 
90
-		register_setting( 'lasso_license', 'lasso_license_key', array( $this, 'sanitize_license' ) );
90
+		register_setting('lasso_license', 'lasso_license_key', array($this, 'sanitize_license'));
91 91
 	}
92 92
 
93 93
 	// santize
94
-	function sanitize_license( $new ) {
95
-		$old = get_option( 'lasso_license_key' );
96
-		if ( $old && $old != $new ) {
97
-			delete_option( 'lasso_license_status' ); // new license has been entered, so must reactivate
94
+	function sanitize_license($new) {
95
+		$old = get_option('lasso_license_key');
96
+		if ($old && $old != $new) {
97
+			delete_option('lasso_license_status'); // new license has been entered, so must reactivate
98 98
 		}
99 99
 		return $new;
100 100
 	}
@@ -103,36 +103,36 @@  discard block
 block discarded – undo
103 103
 	function activate_license() {
104 104
 
105 105
 		// listen for our activate button to be clicked
106
-		if ( isset( $_POST['edd_license_activate'] ) ) {
106
+		if (isset($_POST['edd_license_activate'])) {
107 107
 
108 108
 			// run a quick security check
109
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
109
+			if (!check_admin_referer('lasso_license_nonce', 'lasso_license_nonce'))
110 110
 				return; // get out if we didn't click the Activate button
111 111
 
112 112
 			// retrieve the license from the database
113
-			$license = trim( get_option( 'lasso_license_key' ) );
113
+			$license = trim(get_option('lasso_license_key'));
114 114
 
115 115
 			// data to send in our API request
116 116
 			$api_params = array(
117 117
 				'edd_action'=> 'activate_license',
118 118
 				'license'  => $license,
119
-				'item_name' => urlencode( LASSO_STORE_ITEM_NAME ), // the name of our product in EDD
119
+				'item_name' => urlencode(LASSO_STORE_ITEM_NAME), // the name of our product in EDD
120 120
 				'url'       => home_url()
121 121
 			);
122 122
 
123 123
 			// Call the custom API.
124
-			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
124
+			$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
125 125
 
126 126
 			// make sure the response came back okay
127
-			if ( is_wp_error( $response ) )
127
+			if (is_wp_error($response))
128 128
 				return false;
129 129
 
130 130
 			// decode the license data
131
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
131
+			$license_data = json_decode(wp_remote_retrieve_body($response));
132 132
 
133 133
 			// $license_data->license will be either "valid" or "invalid"
134 134
 
135
-			update_option( 'lasso_license_status', $license_data->license );
135
+			update_option('lasso_license_status', $license_data->license);
136 136
 
137 137
 		}
138 138
 	}
@@ -140,37 +140,37 @@  discard block
 block discarded – undo
140 140
 	function deactivate_license() {
141 141
 
142 142
 		// listen for our activate button to be clicked
143
-		if ( isset( $_POST['edd_license_deactivate'] ) ) {
143
+		if (isset($_POST['edd_license_deactivate'])) {
144 144
 
145 145
 			// run a quick security check
146
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
146
+			if (!check_admin_referer('lasso_license_nonce', 'lasso_license_nonce'))
147 147
 				return; // get out if we didn't click the Activate button
148 148
 
149 149
 			// retrieve the license from the database
150
-			$license = trim( get_option( 'lasso_license_key' ) );
150
+			$license = trim(get_option('lasso_license_key'));
151 151
 
152 152
 
153 153
 			// data to send in our API request
154 154
 			$api_params = array(
155 155
 				'edd_action'=> 'deactivate_license',
156 156
 				'license'  => $license,
157
-				'item_name' => urlencode( LASSO_STORE_ITEM_NAME ), // the name of our product in EDD
157
+				'item_name' => urlencode(LASSO_STORE_ITEM_NAME), // the name of our product in EDD
158 158
 				'url'       => home_url()
159 159
 			);
160 160
 
161 161
 			// Call the custom API.
162
-			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
162
+			$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
163 163
 
164 164
 			// make sure the response came back okay
165
-			if ( is_wp_error( $response ) )
165
+			if (is_wp_error($response))
166 166
 				return false;
167 167
 
168 168
 			// decode the license data
169
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
169
+			$license_data = json_decode(wp_remote_retrieve_body($response));
170 170
 
171 171
 			// $license_data->license will be either "deactivated" or "failed"
172
-			if ( $license_data->license == 'deactivated' )
173
-				delete_option( 'lasso_license_status' );
172
+			if ($license_data->license == 'deactivated')
173
+				delete_option('lasso_license_status');
174 174
 
175 175
 		}
176 176
 	}
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 
181 181
 		global $wp_version;
182 182
 
183
-		$license = trim( get_option( 'lasso_license_key' ) );
183
+		$license = trim(get_option('lasso_license_key'));
184 184
 
185 185
 		$api_params = array(
186 186
 			'edd_action' => 'check_license',
187 187
 			'license' => $license,
188
-			'item_name' => urlencode( LASSO_STORE_ITEM_NAME ),
188
+			'item_name' => urlencode(LASSO_STORE_ITEM_NAME),
189 189
 			'url'       => home_url()
190 190
 		);
191 191
 
192 192
 		// Call the custom API.
193
-		$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
193
+		$response = wp_remote_post(LASSO_STORE_URL, array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
194 194
 
195
-		if ( is_wp_error( $response ) )
195
+		if (is_wp_error($response))
196 196
 			return false;
197 197
 
198
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
198
+		$license_data = json_decode(wp_remote_retrieve_body($response));
199 199
 
200
-		if ( $license_data->license == 'valid' ) {
200
+		if ($license_data->license == 'valid') {
201 201
 			echo 'valid'; exit;
202 202
 			// this license is still valid
203 203
 		} else {
Please login to merge, or discard this patch.
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -106,8 +106,10 @@  discard block
 block discarded – undo
106 106
 		if ( isset( $_POST['edd_license_activate'] ) ) {
107 107
 
108 108
 			// run a quick security check
109
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
110
-				return; // get out if we didn't click the Activate button
109
+			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) {
110
+							return;
111
+			}
112
+			// get out if we didn't click the Activate button
111 113
 
112 114
 			// retrieve the license from the database
113 115
 			$license = trim( get_option( 'lasso_license_key' ) );
@@ -124,8 +126,9 @@  discard block
 block discarded – undo
124 126
 			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
125 127
 
126 128
 			// make sure the response came back okay
127
-			if ( is_wp_error( $response ) )
128
-				return false;
129
+			if ( is_wp_error( $response ) ) {
130
+							return false;
131
+			}
129 132
 
130 133
 			// decode the license data
131 134
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
@@ -143,8 +146,10 @@  discard block
 block discarded – undo
143 146
 		if ( isset( $_POST['edd_license_deactivate'] ) ) {
144 147
 
145 148
 			// run a quick security check
146
-			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) )
147
-				return; // get out if we didn't click the Activate button
149
+			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) {
150
+							return;
151
+			}
152
+			// get out if we didn't click the Activate button
148 153
 
149 154
 			// retrieve the license from the database
150 155
 			$license = trim( get_option( 'lasso_license_key' ) );
@@ -162,15 +167,17 @@  discard block
 block discarded – undo
162 167
 			$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
163 168
 
164 169
 			// make sure the response came back okay
165
-			if ( is_wp_error( $response ) )
166
-				return false;
170
+			if ( is_wp_error( $response ) ) {
171
+							return false;
172
+			}
167 173
 
168 174
 			// decode the license data
169 175
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
170 176
 
171 177
 			// $license_data->license will be either "deactivated" or "failed"
172
-			if ( $license_data->license == 'deactivated' )
173
-				delete_option( 'lasso_license_status' );
178
+			if ( $license_data->license == 'deactivated' ) {
179
+							delete_option( 'lasso_license_status' );
180
+			}
174 181
 
175 182
 		}
176 183
 	}
@@ -192,8 +199,9 @@  discard block
 block discarded – undo
192 199
 		// Call the custom API.
193 200
 		$response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) );
194 201
 
195
-		if ( is_wp_error( $response ) )
196
-			return false;
202
+		if ( is_wp_error( $response ) ) {
203
+					return false;
204
+		}
197 205
 
198 206
 		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
199 207
 
Please login to merge, or discard this patch.