Completed
Push — develop ( 13b3c8...9c97e4 )
by Gary
03:06
created
class-tgm-plugin-activation.php 1 patch
Spacing   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		 */
256 256
 		public function __construct() {
257 257
 			// Set the current WordPress version.
258
-			$this->wp_version = $GLOBALS['wp_version'];
258
+			$this->wp_version = $GLOBALS[ 'wp_version' ];
259 259
 
260 260
 			// Announce that the class is ready, and pass the object (for advanced use).
261 261
 			do_action_ref_array( 'tgmpa_init', array( $this ) );
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 			if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) {
471 471
 				// Plugin, we'll need to adjust the file name.
472 472
 				add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 );
473
-				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' );
473
+				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' );
474 474
 				remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 );
475 475
 			} else {
476
-				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' );
476
+				load_theme_textdomain( 'tgmpa', dirname( __FILE__ ).'/languages' );
477 477
 			}
478 478
 		}
479 479
 
@@ -546,15 +546,15 @@  discard block
 block discarded – undo
546 546
 		public function add_plugin_action_link_filters() {
547 547
 			foreach ( $this->plugins as $slug => $plugin ) {
548 548
 				if ( false === $this->can_plugin_activate( $slug ) ) {
549
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
549
+					add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_activate' ), 20 );
550 550
 				}
551 551
 
552
-				if ( true === $plugin['force_activation'] ) {
553
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
552
+				if ( true === $plugin[ 'force_activation' ] ) {
553
+					add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
554 554
 				}
555 555
 
556 556
 				if ( false !== $this->does_plugin_require_update( $slug ) ) {
557
-					add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
557
+					add_filter( 'plugin_action_links_'.$plugin[ 'file_path' ], array( $this, 'filter_plugin_action_links_update' ), 20 );
558 558
 				}
559 559
 			}
560 560
 		}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		 * @return array
570 570
 		 */
571 571
 		public function filter_plugin_action_links_activate( $actions ) {
572
-			unset( $actions['activate'] );
572
+			unset( $actions[ 'activate' ] );
573 573
 
574 574
 			return $actions;
575 575
 		}
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		 * @return array
584 584
 		 */
585 585
 		public function filter_plugin_action_links_deactivate( $actions ) {
586
-			unset( $actions['deactivate'] );
586
+			unset( $actions[ 'deactivate' ] );
587 587
 
588 588
 			return $actions;
589 589
 		}
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 		 * @return array
599 599
 		 */
600 600
 		public function filter_plugin_action_links_update( $actions ) {
601
-			$actions['update'] = sprintf(
601
+			$actions[ 'update' ] = sprintf(
602 602
 				'<a href="%1$s" title="%2$s" class="edit">%3$s</a>',
603 603
 				esc_url( $this->get_tgmpa_status_url( 'update' ) ),
604 604
 				esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ),
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 				return;
637 637
 			}
638 638
 
639
-			if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
639
+			if ( isset( $_REQUEST[ 'tab' ] ) && 'plugin-information' === $_REQUEST[ 'tab' ] ) {
640 640
 				// Needed for install_plugin_information().
641
-				require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
641
+				require_once ABSPATH.'wp-admin/includes/plugin-install.php';
642 642
 
643 643
 				wp_enqueue_style( 'plugin-install' );
644 644
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		 * @since 2.1.0
667 667
 		 */
668 668
 		public function thickbox() {
669
-			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
669
+			if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) ) {
670 670
 				add_thickbox();
671 671
 			}
672 672
 		}
@@ -695,11 +695,11 @@  discard block
 block discarded – undo
695 695
 			$args = apply_filters(
696 696
 				'tgmpa_admin_menu_args',
697 697
 				array(
698
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
699
-					'page_title'  => $this->strings['page_title'],           // Page title.
700
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
701
-					'capability'  => $this->capability,                      // Capability.
702
-					'menu_slug'   => $this->menu,                            // Menu slug.
698
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
699
+					'page_title'  => $this->strings[ 'page_title' ], // Page title.
700
+					'menu_title'  => $this->strings[ 'menu_title' ], // Menu title.
701
+					'capability'  => $this->capability, // Capability.
702
+					'menu_slug'   => $this->menu, // Menu slug.
703 703
 					'function'    => array( $this, 'install_plugins_page' ), // Callback.
704 704
 				)
705 705
 			);
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 			}
724 724
 
725 725
 			if ( 'themes.php' === $this->parent_slug ) {
726
-				$this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
726
+				$this->page_hook = call_user_func( 'add_theme_page', $args[ 'page_title' ], $args[ 'menu_title' ], $args[ 'capability' ], $args[ 'menu_slug' ], $args[ 'function' ] );
727 727
 			} else {
728
-				$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'] );
728
+				$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' ] );
729 729
 			}
730 730
 		}
731 731
 
@@ -794,37 +794,37 @@  discard block
 block discarded – undo
794 794
 		 * @return boolean True on success, false on failure.
795 795
 		 */
796 796
 		protected function do_plugin_install() {
797
-			if ( empty( $_GET['plugin'] ) ) {
797
+			if ( empty( $_GET[ 'plugin' ] ) ) {
798 798
 				return false;
799 799
 			}
800 800
 
801 801
 			// All plugin information will be stored in an array for processing.
802
-			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
802
+			$slug = $this->sanitize_key( urldecode( $_GET[ 'plugin' ] ) );
803 803
 
804 804
 			if ( ! isset( $this->plugins[ $slug ] ) ) {
805 805
 				return false;
806 806
 			}
807 807
 
808 808
 			// Was an install or upgrade action link clicked?
809
-			if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) {
809
+			if ( ( isset( $_GET[ 'tgmpa-install' ] ) && 'install-plugin' === $_GET[ 'tgmpa-install' ] ) || ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) ) {
810 810
 
811 811
 				$install_type = 'install';
812
-				if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) {
812
+				if ( isset( $_GET[ 'tgmpa-update' ] ) && 'update-plugin' === $_GET[ 'tgmpa-update' ] ) {
813 813
 					$install_type = 'update';
814 814
 				}
815 815
 
816
-				check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' );
816
+				check_admin_referer( 'tgmpa-'.$install_type, 'tgmpa-nonce' );
817 817
 
818 818
 				// Pass necessary information via URL if WP_Filesystem is needed.
819 819
 				$url = wp_nonce_url(
820 820
 					add_query_arg(
821 821
 						array(
822 822
 							'plugin'                 => urlencode( $slug ),
823
-							'tgmpa-' . $install_type => $install_type . '-plugin',
823
+							'tgmpa-'.$install_type => $install_type.'-plugin',
824 824
 						),
825 825
 						$this->get_tgmpa_url()
826 826
 					),
827
-					'tgmpa-' . $install_type,
827
+					'tgmpa-'.$install_type,
828 828
 					'tgmpa-nonce'
829 829
 				);
830 830
 
@@ -843,29 +843,29 @@  discard block
 block discarded – undo
843 843
 
844 844
 				// Prep variables for Plugin_Installer_Skin class.
845 845
 				$extra         = array();
846
-				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
846
+				$extra[ 'slug' ] = $slug; // Needed for potentially renaming of directory name.
847 847
 				$source        = $this->get_download_url( $slug );
848
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
848
+				$api           = ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) ? $this->get_plugins_api( $slug ) : null;
849 849
 				$api           = ( false !== $api ) ? $api : null;
850 850
 
851 851
 				$url = add_query_arg(
852 852
 					array(
853
-						'action' => $install_type . '-plugin',
853
+						'action' => $install_type.'-plugin',
854 854
 						'plugin' => urlencode( $slug ),
855 855
 					),
856 856
 					'update.php'
857 857
 				);
858 858
 
859 859
 				if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
860
-					require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
860
+					require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
861 861
 				}
862 862
 
863
-				$title     = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
863
+				$title     = ( 'update' === $install_type ) ? $this->strings[ 'updating' ] : $this->strings[ 'installing' ];
864 864
 				$skin_args = array(
865
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
866
-					'title'  => sprintf( $title, $this->plugins[ $slug ]['name'] ),
865
+					'type'   => ( 'bundled' !== $this->plugins[ $slug ][ 'source_type' ] ) ? 'web' : 'upload',
866
+					'title'  => sprintf( $title, $this->plugins[ $slug ][ 'name' ] ),
867 867
 					'url'    => esc_url_raw( $url ),
868
-					'nonce'  => $install_type . '-plugin_' . $slug,
868
+					'nonce'  => $install_type.'-plugin_'.$slug,
869 869
 					'plugin' => '',
870 870
 					'api'    => $api,
871 871
 					'extra'  => $extra,
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 				unset( $title );
874 874
 
875 875
 				if ( 'update' === $install_type ) {
876
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
876
+					$skin_args[ 'plugin' ] = $this->plugins[ $slug ][ 'file_path' ];
877 877
 					$skin                = new Plugin_Upgrader_Skin( $skin_args );
878 878
 				} else {
879 879
 					$skin = new Plugin_Installer_Skin( $skin_args );
@@ -888,10 +888,10 @@  discard block
 block discarded – undo
888 888
 				if ( 'update' === $install_type ) {
889 889
 					// Inject our info into the update transient.
890 890
 					$to_inject                    = array( $slug => $this->plugins[ $slug ] );
891
-					$to_inject[ $slug ]['source'] = $source;
891
+					$to_inject[ $slug ][ 'source' ] = $source;
892 892
 					$this->inject_update_info( $to_inject );
893 893
 
894
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
894
+					$upgrader->upgrade( $this->plugins[ $slug ][ 'file_path' ] );
895 895
 				} else {
896 896
 					$upgrader->install( $source );
897 897
 				}
@@ -914,18 +914,18 @@  discard block
 block discarded – undo
914 914
 
915 915
 				// Display message based on if all plugins are now active or not.
916 916
 				if ( $this->is_tgmpa_complete() ) {
917
-					echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>';
917
+					echo '<p>', sprintf( esc_html( $this->strings[ 'complete' ] ), '<a href="'.esc_url( self_admin_url() ).'">'.esc_html__( 'Return to the Dashboard', 'tgmpa' ).'</a>' ), '</p>';
918 918
 					echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
919 919
 				} else {
920
-					echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
920
+					echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>';
921 921
 				}
922 922
 
923 923
 				return true;
924
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
924
+			} elseif ( isset( $this->plugins[ $slug ][ 'file_path' ], $_GET[ 'tgmpa-activate' ] ) && 'activate-plugin' === $_GET[ 'tgmpa-activate' ] ) {
925 925
 				// Activate action link was clicked.
926 926
 				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
927 927
 
928
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
928
+				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ][ 'file_path' ], $slug ) ) {
929 929
 					return true; // Finish execution of the function early as we encountered an error.
930 930
 				}
931 931
 			}
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 			}
949 949
 
950 950
 			foreach ( $plugins as $slug => $plugin ) {
951
-				$file_path = $plugin['file_path'];
951
+				$file_path = $plugin[ 'file_path' ];
952 952
 
953 953
 				if ( empty( $repo_updates->response[ $file_path ] ) ) {
954 954
 					$repo_updates->response[ $file_path ] = new stdClass;
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
 				// We only really need to set package, but let's do all we can in case WP changes something.
958 958
 				$repo_updates->response[ $file_path ]->slug        = $slug;
959 959
 				$repo_updates->response[ $file_path ]->plugin      = $file_path;
960
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
961
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
962
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
963
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
960
+				$repo_updates->response[ $file_path ]->new_version = $plugin[ 'version' ];
961
+				$repo_updates->response[ $file_path ]->package     = $plugin[ 'source' ];
962
+				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin[ 'external_url' ] ) ) {
963
+					$repo_updates->response[ $file_path ]->url = $plugin[ 'external_url' ];
964 964
 				}
965 965
 			}
966 966
 
@@ -984,13 +984,13 @@  discard block
 block discarded – undo
984 984
 		 * @return string $source
985 985
 		 */
986 986
 		public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
987
-			if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) {
987
+			if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS[ 'wp_filesystem' ] ) ) {
988 988
 				return $source;
989 989
 			}
990 990
 
991 991
 			// Check for single file plugins.
992
-			$source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) );
993
-			if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) {
992
+			$source_files = array_keys( $GLOBALS[ 'wp_filesystem' ]->dirlist( $remote_source ) );
993
+			if ( 1 === count( $source_files ) && false === $GLOBALS[ 'wp_filesystem' ]->is_dir( $source ) ) {
994 994
 				return $source;
995 995
 			}
996 996
 
@@ -998,12 +998,12 @@  discard block
 block discarded – undo
998 998
 			$desired_slug = '';
999 999
 
1000 1000
 			// Figure out what the slug is supposed to be.
1001
-			if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) {
1002
-				$desired_slug = $upgrader->skin->options['extra']['slug'];
1001
+			if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options[ 'extra' ][ 'slug' ] ) ) {
1002
+				$desired_slug = $upgrader->skin->options[ 'extra' ][ 'slug' ];
1003 1003
 			} else {
1004 1004
 				// Bulk installer contains less info, so fall back on the info registered here.
1005 1005
 				foreach ( $this->plugins as $slug => $plugin ) {
1006
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
1006
+					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin[ 'name' ] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
1007 1007
 						$desired_slug = $slug;
1008 1008
 						break;
1009 1009
 					}
@@ -1016,15 +1016,15 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 				if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
1018 1018
 					$from = untrailingslashit( $source );
1019
-					$to   = trailingslashit( $remote_source ) . $desired_slug;
1019
+					$to   = trailingslashit( $remote_source ).$desired_slug;
1020 1020
 
1021
-					if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) {
1021
+					if ( true === $GLOBALS[ 'wp_filesystem' ]->move( $from, $to ) ) {
1022 1022
 						return trailingslashit( $to );
1023 1023
 					} else {
1024
-						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 ) );
1024
+						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 ) );
1025 1025
 					}
1026 1026
 				} elseif ( empty( $subdir_name ) ) {
1027
-					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 ) );
1027
+					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 ) );
1028 1028
 				}
1029 1029
 			}
1030 1030
 
@@ -1048,19 +1048,19 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 				if ( is_wp_error( $activate ) ) {
1050 1050
 					echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>',
1051
-						'<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
1051
+						'<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings[ 'return' ] ), '</a></p>';
1052 1052
 
1053 1053
 					return false; // End it here if there is an error with activation.
1054 1054
 				} else {
1055 1055
 					if ( ! $automatic ) {
1056 1056
 						// Make sure message doesn't display again if bulk activation is performed
1057 1057
 						// immediately after a single activation.
1058
-						if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
1059
-							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
1058
+						if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK.
1059
+							echo '<div id="message" class="updated"><p>', esc_html( $this->strings[ 'activated_successfully' ] ), ' <strong>', esc_html( $this->plugins[ $slug ][ 'name' ] ), '.</strong></p></div>';
1060 1060
 						}
1061 1061
 					} else {
1062 1062
 						// Simpler message layout for use on the plugin install page.
1063
-						echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>';
1063
+						echo '<p>', esc_html( $this->strings[ 'plugin_activated' ] ), '</p>';
1064 1064
 					}
1065 1065
 				}
1066 1066
 			} elseif ( $this->is_plugin_active( $slug ) ) {
@@ -1068,25 +1068,25 @@  discard block
 block discarded – undo
1068 1068
 				// on the plugin install page.
1069 1069
 				echo '<div id="message" class="error"><p>',
1070 1070
 					sprintf(
1071
-						esc_html( $this->strings['plugin_already_active'] ),
1072
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1071
+						esc_html( $this->strings[ 'plugin_already_active' ] ),
1072
+						'<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>'
1073 1073
 					),
1074 1074
 					'</p></div>';
1075 1075
 			} elseif ( $this->does_plugin_require_update( $slug ) ) {
1076 1076
 				if ( ! $automatic ) {
1077 1077
 					// Make sure message doesn't display again if bulk activation is performed
1078 1078
 					// immediately after a single activation.
1079
-					if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
1079
+					if ( ! isset( $_POST[ 'action' ] ) ) { // WPCS: CSRF OK.
1080 1080
 						echo '<div id="message" class="error"><p>',
1081 1081
 							sprintf(
1082
-								esc_html( $this->strings['plugin_needs_higher_version'] ),
1083
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1082
+								esc_html( $this->strings[ 'plugin_needs_higher_version' ] ),
1083
+								'<strong>'.esc_html( $this->plugins[ $slug ][ 'name' ] ).'</strong>'
1084 1084
 							),
1085 1085
 							'</p></div>';
1086 1086
 					}
1087 1087
 				} else {
1088 1088
 					// Simpler message layout for use on the plugin install page.
1089
-					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
1089
+					echo '<p>', sprintf( esc_html( $this->strings[ 'plugin_needs_higher_version' ] ), esc_html( $this->plugins[ $slug ][ 'name' ] ) ), '</p>';
1090 1090
 				}
1091 1091
 			}
1092 1092
 
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 		 */
1111 1111
 		public function notices() {
1112 1112
 			// Remove nag on the install page / Return early if the nag message has been dismissed or user < author.
1113
-			if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) {
1113
+			if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) {
1114 1114
 				return;
1115 1115
 			}
1116 1116
 
@@ -1132,13 +1132,13 @@  discard block
 block discarded – undo
1132 1132
 					if ( current_user_can( 'install_plugins' ) ) {
1133 1133
 						$install_link_count++;
1134 1134
 
1135
-						if ( true === $plugin['required'] ) {
1136
-							$message['notice_can_install_required'][] = $slug;
1135
+						if ( true === $plugin[ 'required' ] ) {
1136
+							$message[ 'notice_can_install_required' ][ ] = $slug;
1137 1137
 						} else {
1138
-							$message['notice_can_install_recommended'][] = $slug;
1138
+							$message[ 'notice_can_install_recommended' ][ ] = $slug;
1139 1139
 						}
1140 1140
 					}
1141
-					if ( true === $plugin['required'] ) {
1141
+					if ( true === $plugin[ 'required' ] ) {
1142 1142
 						$total_required_action_count++;
1143 1143
 					}
1144 1144
 				} else {
@@ -1146,13 +1146,13 @@  discard block
 block discarded – undo
1146 1146
 						if ( current_user_can( 'activate_plugins' ) ) {
1147 1147
 							$activate_link_count++;
1148 1148
 
1149
-							if ( true === $plugin['required'] ) {
1150
-								$message['notice_can_activate_required'][] = $slug;
1149
+							if ( true === $plugin[ 'required' ] ) {
1150
+								$message[ 'notice_can_activate_required' ][ ] = $slug;
1151 1151
 							} else {
1152
-								$message['notice_can_activate_recommended'][] = $slug;
1152
+								$message[ 'notice_can_activate_recommended' ][ ] = $slug;
1153 1153
 							}
1154 1154
 						}
1155
-						if ( true === $plugin['required'] ) {
1155
+						if ( true === $plugin[ 'required' ] ) {
1156 1156
 							$total_required_action_count++;
1157 1157
 						}
1158 1158
 					}
@@ -1163,12 +1163,12 @@  discard block
 block discarded – undo
1163 1163
 							$update_link_count++;
1164 1164
 
1165 1165
 							if ( $this->does_plugin_require_update( $slug ) ) {
1166
-								$message['notice_ask_to_update'][] = $slug;
1166
+								$message[ 'notice_ask_to_update' ][ ] = $slug;
1167 1167
 							} elseif ( false !== $this->does_plugin_have_update( $slug ) ) {
1168
-								$message['notice_ask_to_update_maybe'][] = $slug;
1168
+								$message[ 'notice_ask_to_update_maybe' ][ ] = $slug;
1169 1169
 							}
1170 1170
 						}
1171
-						if ( true === $plugin['required'] ) {
1171
+						if ( true === $plugin[ 'required' ] ) {
1172 1172
 							$total_required_action_count++;
1173 1173
 						}
1174 1174
 					}
@@ -1183,10 +1183,10 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
 				// As add_settings_error() wraps the final message in a <p> and as the final message can't be
1185 1185
 				// filtered, using <p>'s in our html would render invalid html output.
1186
-				$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n";
1186
+				$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>'."\n";
1187 1187
 
1188 1188
 				if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) {
1189
-					$rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] );
1189
+					$rendered = esc_html__( $this->strings[ 'notice_cannot_install_activate' ] ).' '.esc_html__( $this->strings[ 'contact_admin' ] );
1190 1190
 					$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template );
1191 1191
 				} else {
1192 1192
 
@@ -1201,14 +1201,14 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 						// Get the external info link for a plugin if one is available.
1203 1203
 						foreach ( $plugin_group as $plugin_slug ) {
1204
-							$linked_plugins[] = $this->get_info_link( $plugin_slug );
1204
+							$linked_plugins[ ] = $this->get_info_link( $plugin_slug );
1205 1205
 						}
1206 1206
 						unset( $plugin_slug );
1207 1207
 
1208 1208
 						$count          = count( $plugin_group );
1209 1209
 						$linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins );
1210 1210
 						$last_plugin    = array_pop( $linked_plugins ); // Pop off last name to prep for readability.
1211
-						$imploded       = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin );
1211
+						$imploded       = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ).' '.esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ).' '.$last_plugin );
1212 1212
 
1213 1213
 						$rendered .= sprintf(
1214 1214
 							$line_template,
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 			}
1231 1231
 
1232 1232
 			// Admin options pages already output settings_errors, so this is to avoid duplication.
1233
-			if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) {
1233
+			if ( 'options-general' !== $GLOBALS[ 'current_screen' ]->parent_base ) {
1234 1234
 				$this->display_settings_errors();
1235 1235
 			}
1236 1236
 		}
@@ -1252,32 +1252,32 @@  discard block
 block discarded – undo
1252 1252
 				'install'  => '',
1253 1253
 				'update'   => '',
1254 1254
 				'activate' => '',
1255
-				'dismiss'  => $this->dismissable ? '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-' . get_current_user_id() ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '',
1255
+				'dismiss'  => $this->dismissable ? '<a href="'.esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-'.get_current_user_id() ) ).'" class="dismiss-notice" target="_parent">'.esc_html( $this->strings[ 'dismiss' ] ).'</a>' : '',
1256 1256
 			);
1257 1257
 
1258 1258
 			$link_template = '<a href="%2$s">%1$s</a>';
1259 1259
 
1260 1260
 			if ( current_user_can( 'install_plugins' ) ) {
1261 1261
 				if ( $install_count > 0 ) {
1262
-					$action_links['install'] = sprintf(
1262
+					$action_links[ 'install' ] = sprintf(
1263 1263
 						$link_template,
1264
-						translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ),
1264
+						translate_nooped_plural( $this->strings[ 'install_link' ], $install_count, 'tgmpa' ),
1265 1265
 						esc_url( $this->get_tgmpa_status_url( 'install' ) )
1266 1266
 					);
1267 1267
 				}
1268 1268
 				if ( $update_count > 0 ) {
1269
-					$action_links['update'] = sprintf(
1269
+					$action_links[ 'update' ] = sprintf(
1270 1270
 						$link_template,
1271
-						translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ),
1271
+						translate_nooped_plural( $this->strings[ 'update_link' ], $update_count, 'tgmpa' ),
1272 1272
 						esc_url( $this->get_tgmpa_status_url( 'update' ) )
1273 1273
 					);
1274 1274
 				}
1275 1275
 			}
1276 1276
 
1277 1277
 			if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) {
1278
-				$action_links['activate'] = sprintf(
1278
+				$action_links[ 'activate' ] = sprintf(
1279 1279
 					$link_template,
1280
-					translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ),
1280
+					translate_nooped_plural( $this->strings[ 'activate_link' ], $activate_count, 'tgmpa' ),
1281 1281
 					esc_url( $this->get_tgmpa_status_url( 'activate' ) )
1282 1282
 				);
1283 1283
 			}
@@ -1305,8 +1305,8 @@  discard block
 block discarded – undo
1305 1305
 		 * @return string
1306 1306
 		 */
1307 1307
 		protected function get_admin_notice_class() {
1308
-			if ( ! empty( $this->strings['nag_type'] ) ) {
1309
-				return sanitize_html_class( strtolower( $this->strings['nag_type'] ) );
1308
+			if ( ! empty( $this->strings[ 'nag_type' ] ) ) {
1309
+				return sanitize_html_class( strtolower( $this->strings[ 'nag_type' ] ) );
1310 1310
 			} else {
1311 1311
 				if ( version_compare( $this->wp_version, '4.2', '>=' ) ) {
1312 1312
 					return 'notice-warning';
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 			settings_errors( 'tgmpa' );
1330 1330
 
1331 1331
 			foreach ( (array) $wp_settings_errors as $key => $details ) {
1332
-				if ( 'tgmpa' === $details['setting'] ) {
1332
+				if ( 'tgmpa' === $details[ 'setting' ] ) {
1333 1333
 					unset( $wp_settings_errors[ $key ] );
1334 1334
 					break;
1335 1335
 				}
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
 		 * @since 2.1.0
1346 1346
 		 */
1347 1347
 		public function dismiss() {
1348
-			if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) {
1349
-				update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 );
1348
+			if ( isset( $_GET[ 'tgmpa-dismiss' ] ) && check_admin_referer( 'tgmpa-dismiss-'.get_current_user_id() ) ) {
1349
+				update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_'.$this->id, 1 );
1350 1350
 			}
1351 1351
 		}
1352 1352
 
@@ -1362,54 +1362,54 @@  discard block
 block discarded – undo
1362 1362
 		 * @return null Return early if incorrect argument.
1363 1363
 		 */
1364 1364
 		public function register( $plugin ) {
1365
-			if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) {
1365
+			if ( empty( $plugin[ 'slug' ] ) || empty( $plugin[ 'name' ] ) ) {
1366 1366
 				return;
1367 1367
 			}
1368 1368
 
1369
-			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1369
+			if ( empty( $plugin[ 'slug' ] ) || ! is_string( $plugin[ 'slug' ] ) || isset( $this->plugins[ $plugin[ 'slug' ] ] ) ) {
1370 1370
 				return;
1371 1371
 			}
1372 1372
 
1373 1373
 			$defaults = array(
1374
-				'name'               => '',      // String
1375
-				'slug'               => '',      // String
1376
-				'source'             => 'repo',  // String
1377
-				'required'           => false,   // Boolean
1378
-				'version'            => '',      // String
1379
-				'force_activation'   => false,   // Boolean
1380
-				'force_deactivation' => false,   // Boolean
1381
-				'external_url'       => '',      // String
1382
-				'is_callable'        => '',      // String|Array.
1374
+				'name'               => '', // String
1375
+				'slug'               => '', // String
1376
+				'source'             => 'repo', // String
1377
+				'required'           => false, // Boolean
1378
+				'version'            => '', // String
1379
+				'force_activation'   => false, // Boolean
1380
+				'force_deactivation' => false, // Boolean
1381
+				'external_url'       => '', // String
1382
+				'is_callable'        => '', // String|Array.
1383 1383
 			);
1384 1384
 
1385 1385
 			// Prepare the received data.
1386 1386
 			$plugin = wp_parse_args( $plugin, $defaults );
1387 1387
 
1388 1388
 			// Standardize the received slug.
1389
-			$plugin['slug'] = $this->sanitize_key( $plugin['slug'] );
1389
+			$plugin[ 'slug' ] = $this->sanitize_key( $plugin[ 'slug' ] );
1390 1390
 
1391 1391
 			// Forgive users for using string versions of booleans or floats for version number.
1392
-			$plugin['version']            = (string) $plugin['version'];
1393
-			$plugin['source']             = empty( $plugin['source'] ) ? 'repo' : $plugin['source'];
1394
-			$plugin['required']           = TGMPA_Utils::validate_bool( $plugin['required'] );
1395
-			$plugin['force_activation']   = TGMPA_Utils::validate_bool( $plugin['force_activation'] );
1396
-			$plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] );
1392
+			$plugin[ 'version' ]            = (string) $plugin[ 'version' ];
1393
+			$plugin[ 'source' ]             = empty( $plugin[ 'source' ] ) ? 'repo' : $plugin[ 'source' ];
1394
+			$plugin[ 'required' ]           = TGMPA_Utils::validate_bool( $plugin[ 'required' ] );
1395
+			$plugin[ 'force_activation' ]   = TGMPA_Utils::validate_bool( $plugin[ 'force_activation' ] );
1396
+			$plugin[ 'force_deactivation' ] = TGMPA_Utils::validate_bool( $plugin[ 'force_deactivation' ] );
1397 1397
 
1398 1398
 			// Enrich the received data.
1399
-			$plugin['file_path']   = $this->_get_plugin_basename_from_slug( $plugin['slug'] );
1400
-			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1399
+			$plugin[ 'file_path' ]   = $this->_get_plugin_basename_from_slug( $plugin[ 'slug' ] );
1400
+			$plugin[ 'source_type' ] = $this->get_plugin_source_type( $plugin[ 'source' ] );
1401 1401
 
1402 1402
 			// Set the class properties.
1403
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1404
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1403
+			$this->plugins[ $plugin[ 'slug' ] ]    = $plugin;
1404
+			$this->sort_order[ $plugin[ 'slug' ] ] = $plugin[ 'name' ];
1405 1405
 
1406 1406
 			// Should we add the force activation hook ?
1407
-			if ( true === $plugin['force_activation'] ) {
1407
+			if ( true === $plugin[ 'force_activation' ] ) {
1408 1408
 				$this->has_forced_activation = true;
1409 1409
 			}
1410 1410
 
1411 1411
 			// Should we add the force deactivation hook ?
1412
-			if ( true === $plugin['force_deactivation'] ) {
1412
+			if ( true === $plugin[ 'force_deactivation' ] ) {
1413 1413
 				$this->has_forced_deactivation = true;
1414 1414
 			}
1415 1415
 		}
@@ -1535,11 +1535,11 @@  discard block
 block discarded – undo
1535 1535
 		 */
1536 1536
 		public function populate_file_path( $plugin_slug = '' ) {
1537 1537
 			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1538
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1538
+				$this->plugins[ $plugin_slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1539 1539
 			} else {
1540 1540
 				// Add file_path key for all plugins.
1541 1541
 				foreach ( $this->plugins as $slug => $values ) {
1542
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1542
+					$this->plugins[ $slug ][ 'file_path' ] = $this->_get_plugin_basename_from_slug( $slug );
1543 1543
 				}
1544 1544
 			}
1545 1545
 		}
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 			$keys = array_keys( $this->get_plugins() );
1558 1558
 
1559 1559
 			foreach ( $keys as $key ) {
1560
-				if ( preg_match( '|^' . $slug . '/|', $key ) ) {
1560
+				if ( preg_match( '|^'.$slug.'/|', $key ) ) {
1561 1561
 					return $key;
1562 1562
 				}
1563 1563
 			}
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 		 */
1580 1580
 		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1581 1581
 			foreach ( $this->plugins as $values ) {
1582
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1582
+				if ( $name === $values[ 'name' ] && isset( $values[ $data ] ) ) {
1583 1583
 					return $values[ $data ];
1584 1584
 				}
1585 1585
 			}
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
 		public function get_download_url( $slug ) {
1599 1599
 			$dl_source = '';
1600 1600
 
1601
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1601
+			switch ( $this->plugins[ $slug ][ 'source_type' ] ) {
1602 1602
 				case 'repo':
1603 1603
 					return $this->get_wp_repo_download_url( $slug );
1604 1604
 				case 'external':
1605
-					return $this->plugins[ $slug ]['source'];
1605
+					return $this->plugins[ $slug ][ 'source' ];
1606 1606
 				case 'bundled':
1607
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1607
+					return $this->default_path.$this->plugins[ $slug ][ 'source' ];
1608 1608
 			}
1609 1609
 
1610 1610
 			return $dl_source; // Should never happen.
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 
1643 1643
 			if ( ! isset( $api[ $slug ] ) ) {
1644 1644
 				if ( ! function_exists( 'plugins_api' ) ) {
1645
-					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1645
+					require_once ABSPATH.'wp-admin/includes/plugin-install.php';
1646 1646
 				}
1647 1647
 
1648 1648
 				$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 				$api[ $slug ] = false;
1651 1651
 
1652 1652
 				if ( is_wp_error( $response ) ) {
1653
-					wp_die( esc_html( $this->strings['oops'] ) );
1653
+					wp_die( esc_html( $this->strings[ 'oops' ] ) );
1654 1654
 				} else {
1655 1655
 					$api[ $slug ] = $response;
1656 1656
 				}
@@ -1669,13 +1669,13 @@  discard block
 block discarded – undo
1669 1669
 		 *                or the plugin name if not.
1670 1670
 		 */
1671 1671
 		public function get_info_link( $slug ) {
1672
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1672
+			if ( ! empty( $this->plugins[ $slug ][ 'external_url' ] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ][ 'external_url' ] ) ) {
1673 1673
 				$link = sprintf(
1674 1674
 					'<a href="%1$s" target="_blank">%2$s</a>',
1675
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1676
-					esc_html( $this->plugins[ $slug ]['name'] )
1675
+					esc_url( $this->plugins[ $slug ][ 'external_url' ] ),
1676
+					esc_html( $this->plugins[ $slug ][ 'name' ] )
1677 1677
 				);
1678
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1678
+			} elseif ( 'repo' === $this->plugins[ $slug ][ 'source_type' ] ) {
1679 1679
 				$url = add_query_arg(
1680 1680
 					array(
1681 1681
 						'tab'       => 'plugin-information',
@@ -1690,10 +1690,10 @@  discard block
 block discarded – undo
1690 1690
 				$link = sprintf(
1691 1691
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1692 1692
 					esc_url( $url ),
1693
-					esc_html( $this->plugins[ $slug ]['name'] )
1693
+					esc_html( $this->plugins[ $slug ][ 'name' ] )
1694 1694
 				);
1695 1695
 			} else {
1696
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1696
+				$link = esc_html( $this->plugins[ $slug ][ 'name' ] ); // No hyperlink.
1697 1697
 			}
1698 1698
 
1699 1699
 			return $link;
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
 		 * @return boolean True when on the TGMPA page, false otherwise.
1708 1708
 		 */
1709 1709
 		protected function is_tgmpa_page() {
1710
-			return isset( $_GET['page'] ) && $this->menu === $_GET['page'];
1710
+			return isset( $_GET[ 'page' ] ) && $this->menu === $_GET[ 'page' ];
1711 1711
 		}
1712 1712
 
1713 1713
 		/**
@@ -1728,10 +1728,10 @@  discard block
 block discarded – undo
1728 1728
 			if ( 'update-core' === $screen->base ) {
1729 1729
 				// Core update screen.
1730 1730
 				return true;
1731
-			} elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
1731
+			} elseif ( 'plugins' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok.
1732 1732
 				// Plugins bulk update screen.
1733 1733
 				return true;
1734
-			} elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
1734
+			} elseif ( 'update' === $screen->base && ! empty( $_POST[ 'action' ] ) ) { // WPCS: CSRF ok.
1735 1735
 				// Individual updates (ajax call).
1736 1736
 				return true;
1737 1737
 			}
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
 		public function is_plugin_installed( $slug ) {
1819 1819
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1820 1820
 
1821
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1821
+			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ] ) );
1822 1822
 		}
1823 1823
 
1824 1824
 		/**
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 		 * @return bool True if active, false otherwise.
1831 1831
 		 */
1832 1832
 		public function is_plugin_active( $slug ) {
1833
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1833
+			return ( ( ! empty( $this->plugins[ $slug ][ 'is_callable' ] ) && is_callable( $this->plugins[ $slug ][ 'is_callable' ] ) ) || is_plugin_active( $this->plugins[ $slug ][ 'file_path' ] ) );
1834 1834
 		}
1835 1835
 
1836 1836
 		/**
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 		 */
1845 1845
 		public function can_plugin_update( $slug ) {
1846 1846
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1847
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1847
+			if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) {
1848 1848
 				return true;
1849 1849
 			}
1850 1850
 
@@ -1900,8 +1900,8 @@  discard block
 block discarded – undo
1900 1900
 		public function get_installed_version( $slug ) {
1901 1901
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1902 1902
 
1903
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1904
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1903
+			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ] ) ) {
1904
+				return $installed_plugins[ $this->plugins[ $slug ][ 'file_path' ] ][ 'Version' ];
1905 1905
 			}
1906 1906
 
1907 1907
 			return '';
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 		 */
1918 1918
 		public function does_plugin_require_update( $slug ) {
1919 1919
 			$installed_version = $this->get_installed_version( $slug );
1920
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1920
+			$minimum_version   = $this->plugins[ $slug ][ 'version' ];
1921 1921
 
1922 1922
 			return version_compare( $minimum_version, $installed_version, '>' );
1923 1923
 		}
@@ -1932,9 +1932,9 @@  discard block
 block discarded – undo
1932 1932
 		 */
1933 1933
 		public function does_plugin_have_update( $slug ) {
1934 1934
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1935
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1935
+			if ( 'repo' !== $this->plugins[ $slug ][ 'source_type' ] ) {
1936 1936
 				if ( $this->does_plugin_require_update( $slug ) ) {
1937
-					return $this->plugins[ $slug ]['version'];
1937
+					return $this->plugins[ $slug ][ 'version' ];
1938 1938
 				}
1939 1939
 
1940 1940
 				return false;
@@ -1942,8 +1942,8 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 			$repo_updates = get_site_transient( 'update_plugins' );
1944 1944
 
1945
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1946
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1945
+			if ( isset( $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version ) ) {
1946
+				return $repo_updates->response[ $this->plugins[ $slug ][ 'file_path' ] ]->new_version;