Completed
Pull Request — develop (#690)
by
unknown
01:43
created
class-tgm-plugin-activation.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 			$args = apply_filters(
705 705
 				'tgmpa_admin_menu_args',
706 706
 				array(
707
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
708
-					'page_title'  => $this->strings['page_title'],           // Page title.
709
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
710
-					'capability'  => $this->capability,                      // Capability.
711
-					'menu_slug'   => $this->menu,                            // Menu slug.
707
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
708
+					'page_title'  => $this->strings['page_title'], // Page title.
709
+					'menu_title'  => $this->strings['menu_title'], // Menu title.
710
+					'capability'  => $this->capability, // Capability.
711
+					'menu_slug'   => $this->menu, // Menu slug.
712 712
 					'function'    => array( $this, 'install_plugins_page' ), // Callback.
713 713
 				)
714 714
 			);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 			// All plugin information will be stored in an array for processing.
811 811
 			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
812 812
 
813
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
813
+			if ( ! isset( $this->plugins[$slug] ) ) {
814 814
 				return false;
815 815
 			}
816 816
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 				$extra         = array();
856 856
 				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
857 857
 				$source        = $this->get_download_url( $slug );
858
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
858
+				$api           = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
859 859
 				$api           = ( false !== $api ) ? $api : null;
860 860
 
861 861
 				$url = add_query_arg(
@@ -872,8 +872,8 @@  discard block
 block discarded – undo
872 872
 
873 873
 				$title     = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
874 874
 				$skin_args = array(
875
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
876
-					'title'  => sprintf( $title, $this->plugins[ $slug ]['name'] ),
875
+					'type'   => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload',
876
+					'title'  => sprintf( $title, $this->plugins[$slug]['name'] ),
877 877
 					'url'    => esc_url_raw( $url ),
878 878
 					'nonce'  => $install_type . '-plugin_' . $slug,
879 879
 					'plugin' => '',
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 				unset( $title );
884 884
 
885 885
 				if ( 'update' === $install_type ) {
886
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
886
+					$skin_args['plugin'] = $this->plugins[$slug]['file_path'];
887 887
 					$skin                = new Plugin_Upgrader_Skin( $skin_args );
888 888
 				} else {
889 889
 					$skin = new Plugin_Installer_Skin( $skin_args );
@@ -898,12 +898,12 @@  discard block
 block discarded – undo
898 898
 				if ( 'update' === $install_type ) {
899 899
 					// Inject our info into the update transient.
900 900
 					$to_inject                    = array(
901
-						$slug => $this->plugins[ $slug ],
901
+						$slug => $this->plugins[$slug],
902 902
 					);
903
-					$to_inject[ $slug ]['source'] = $source;
903
+					$to_inject[$slug]['source'] = $source;
904 904
 					$this->inject_update_info( $to_inject );
905 905
 
906
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
906
+					$upgrader->upgrade( $this->plugins[$slug]['file_path'] );
907 907
 				} else {
908 908
 					$upgrader->install( $source );
909 909
 				}
@@ -933,11 +933,11 @@  discard block
 block discarded – undo
933 933
 				}
934 934
 
935 935
 				return true;
936
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
936
+			} elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
937 937
 				// Activate action link was clicked.
938 938
 				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
939 939
 
940
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
940
+				if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) {
941 941
 					return true; // Finish execution of the function early as we encountered an error.
942 942
 				}
943 943
 			}
@@ -962,17 +962,17 @@  discard block
 block discarded – undo
962 962
 			foreach ( $plugins as $slug => $plugin ) {
963 963
 				$file_path = $plugin['file_path'];
964 964
 
965
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
966
-					$repo_updates->response[ $file_path ] = new stdClass();
965
+				if ( empty( $repo_updates->response[$file_path] ) ) {
966
+					$repo_updates->response[$file_path] = new stdClass();
967 967
 				}
968 968
 
969 969
 				// We only really need to set package, but let's do all we can in case WP changes something.
970
-				$repo_updates->response[ $file_path ]->slug        = $slug;
971
-				$repo_updates->response[ $file_path ]->plugin      = $file_path;
972
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
973
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
974
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
975
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
970
+				$repo_updates->response[$file_path]->slug        = $slug;
971
+				$repo_updates->response[$file_path]->plugin      = $file_path;
972
+				$repo_updates->response[$file_path]->new_version = $plugin['version'];
973
+				$repo_updates->response[$file_path]->package     = $plugin['source'];
974
+				if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) {
975
+					$repo_updates->response[$file_path]->url = $plugin['external_url'];
976 976
 				}
977 977
 			}
978 978
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 			} else {
1016 1016
 				// Bulk installer contains less info, so fall back on the info registered here.
1017 1017
 				foreach ( $this->plugins as $slug => $plugin ) {
1018
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
1018
+					if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) {
1019 1019
 						$desired_slug = $slug;
1020 1020
 						break;
1021 1021
 					}
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 						// Make sure message doesn't display again if bulk activation is performed
1083 1083
 						// immediately after a single activation.
1084 1084
 						if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
1085
-							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
1085
+							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>';
1086 1086
 						}
1087 1087
 					} else {
1088 1088
 						// Simpler message layout for use on the plugin install page.
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 				echo '<div id="message" class="error"><p>',
1096 1096
 					sprintf(
1097 1097
 						esc_html( $this->strings['plugin_already_active'] ),
1098
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1098
+						'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1099 1099
 					),
1100 1100
 					'</p></div>';
1101 1101
 			} elseif ( $this->does_plugin_require_update( $slug ) ) {
@@ -1106,13 +1106,13 @@  discard block
 block discarded – undo
1106 1106
 						echo '<div id="message" class="error"><p>',
1107 1107
 							sprintf(
1108 1108
 								esc_html( $this->strings['plugin_needs_higher_version'] ),
1109
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1109
+								'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1110 1110
 							),
1111 1111
 							'</p></div>';
1112 1112
 					}
1113 1113
 				} else {
1114 1114
 					// Simpler message layout for use on the plugin install page.
1115
-					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
1115
+					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>';
1116 1116
 				}
1117 1117
 			}
1118 1118
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 						$rendered .= sprintf(
1240 1240
 							$line_template,
1241 1241
 							sprintf(
1242
-								translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ),
1242
+								translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ),
1243 1243
 								$imploded,
1244 1244
 								$count
1245 1245
 							)
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
 			foreach ( (array) $wp_settings_errors as $key => $details ) {
1358 1358
 				if ( 'tgmpa' === $details['setting'] ) {
1359
-					unset( $wp_settings_errors[ $key ] );
1359
+					unset( $wp_settings_errors[$key] );
1360 1360
 					break;
1361 1361
 				}
1362 1362
 			}
@@ -1392,20 +1392,20 @@  discard block
 block discarded – undo
1392 1392
 				return;
1393 1393
 			}
1394 1394
 
1395
-			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1395
+			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) {
1396 1396
 				return;
1397 1397
 			}
1398 1398
 
1399 1399
 			$defaults = array(
1400
-				'name'               => '',      // String
1401
-				'slug'               => '',      // String
1402
-				'source'             => 'repo',  // String
1403
-				'required'           => false,   // Boolean
1404
-				'version'            => '',      // String
1405
-				'force_activation'   => false,   // Boolean
1406
-				'force_deactivation' => false,   // Boolean
1407
-				'external_url'       => '',      // String
1408
-				'is_callable'        => '',      // String|Array.
1400
+				'name'               => '', // String
1401
+				'slug'               => '', // String
1402
+				'source'             => 'repo', // String
1403
+				'required'           => false, // Boolean
1404
+				'version'            => '', // String
1405
+				'force_activation'   => false, // Boolean
1406
+				'force_deactivation' => false, // Boolean
1407
+				'external_url'       => '', // String
1408
+				'is_callable'        => '', // String|Array.
1409 1409
 			);
1410 1410
 
1411 1411
 			// Prepare the received data.
@@ -1426,8 +1426,8 @@  discard block
 block discarded – undo
1426 1426
 			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1427 1427
 
1428 1428
 			// Set the class properties.
1429
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1430
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1429
+			$this->plugins[$plugin['slug']]    = $plugin;
1430
+			$this->sort_order[$plugin['slug']] = $plugin['name'];
1431 1431
 
1432 1432
 			// Should we add the force activation hook ?
1433 1433
 			if ( true === $plugin['force_activation'] ) {
@@ -1511,11 +1511,11 @@  discard block
 block discarded – undo
1511 1511
 			);
1512 1512
 
1513 1513
 			foreach ( $keys as $key ) {
1514
-				if ( isset( $config[ $key ] ) ) {
1515
-					if ( is_array( $config[ $key ] ) ) {
1516
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1514
+				if ( isset( $config[$key] ) ) {
1515
+					if ( is_array( $config[$key] ) ) {
1516
+						$this->$key = array_merge( $this->$key, $config[$key] );
1517 1517
 					} else {
1518
-						$this->$key = $config[ $key ];
1518
+						$this->$key = $config[$key];
1519 1519
 					}
1520 1520
 				}
1521 1521
 			}
@@ -1560,12 +1560,12 @@  discard block
 block discarded – undo
1560 1560
 		 *                            Parameter added in v2.5.0.
1561 1561
 		 */
1562 1562
 		public function populate_file_path( $plugin_slug = '' ) {
1563
-			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1564
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1563
+			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) {
1564
+				$this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1565 1565
 			} else {
1566 1566
 				// Add file_path key for all plugins.
1567 1567
 				foreach ( $this->plugins as $slug => $values ) {
1568
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1568
+					$this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1569 1569
 				}
1570 1570
 			}
1571 1571
 		}
@@ -1605,8 +1605,8 @@  discard block
 block discarded – undo
1605 1605
 		 */
1606 1606
 		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1607 1607
 			foreach ( $this->plugins as $values ) {
1608
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1609
-					return $values[ $data ];
1608
+				if ( $name === $values['name'] && isset( $values[$data] ) ) {
1609
+					return $values[$data];
1610 1610
 				}
1611 1611
 			}
1612 1612
 
@@ -1624,13 +1624,13 @@  discard block
 block discarded – undo
1624 1624
 		public function get_download_url( $slug ) {
1625 1625
 			$dl_source = '';
1626 1626
 
1627
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1627
+			switch ( $this->plugins[$slug]['source_type'] ) {
1628 1628
 				case 'repo':
1629 1629
 					return $this->get_wp_repo_download_url( $slug );
1630 1630
 				case 'external':
1631
-					return $this->plugins[ $slug ]['source'];
1631
+					return $this->plugins[$slug]['source'];
1632 1632
 				case 'bundled':
1633
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1633
+					return $this->default_path . $this->plugins[$slug]['source'];
1634 1634
 			}
1635 1635
 
1636 1636
 			return $dl_source; // Should never happen.
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 		protected function get_plugins_api( $slug ) {
1667 1667
 			static $api = array(); // Cache received responses.
1668 1668
 
1669
-			if ( ! isset( $api[ $slug ] ) ) {
1669
+			if ( ! isset( $api[$slug] ) ) {
1670 1670
 				if ( ! function_exists( 'plugins_api' ) ) {
1671 1671
 					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1672 1672
 				}
@@ -1681,16 +1681,16 @@  discard block
 block discarded – undo
1681 1681
 					)
1682 1682
 				);
1683 1683
 
1684
-				$api[ $slug ] = false;
1684
+				$api[$slug] = false;
1685 1685
 
1686 1686
 				if ( is_wp_error( $response ) ) {
1687 1687
 					wp_die( esc_html( $this->strings['oops'] ) );
1688 1688
 				} else {
1689
-					$api[ $slug ] = $response;
1689
+					$api[$slug] = $response;
1690 1690
 				}
1691 1691
 			}
1692 1692
 
1693
-			return $api[ $slug ];
1693
+			return $api[$slug];
1694 1694
 		}
1695 1695
 
1696 1696
 		/**
@@ -1703,13 +1703,13 @@  discard block
 block discarded – undo
1703 1703
 		 *                or the plugin name if not.
1704 1704
 		 */
1705 1705
 		public function get_info_link( $slug ) {
1706
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1706
+			if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) {
1707 1707
 				$link = sprintf(
1708 1708
 					'<a href="%1$s" target="_blank">%2$s</a>',
1709
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1710
-					esc_html( $this->plugins[ $slug ]['name'] )
1709
+					esc_url( $this->plugins[$slug]['external_url'] ),
1710
+					esc_html( $this->plugins[$slug]['name'] )
1711 1711
 				);
1712
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1712
+			} elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) {
1713 1713
 				$url = add_query_arg(
1714 1714
 					array(
1715 1715
 						'tab'       => 'plugin-information',
@@ -1724,10 +1724,10 @@  discard block
 block discarded – undo
1724 1724
 				$link = sprintf(
1725 1725
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1726 1726
 					esc_url( $url ),
1727
-					esc_html( $this->plugins[ $slug ]['name'] )
1727
+					esc_html( $this->plugins[$slug]['name'] )
1728 1728
 				);
1729 1729
 			} else {
1730
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1730
+				$link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink.
1731 1731
 			}
1732 1732
 
1733 1733
 			return $link;
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 		public function is_plugin_installed( $slug ) {
1853 1853
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1854 1854
 
1855
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1855
+			return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) );
1856 1856
 		}
1857 1857
 
1858 1858
 		/**
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 		 * @return bool True if active, false otherwise.
1865 1865
 		 */
1866 1866
 		public function is_plugin_active( $slug ) {
1867
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1867
+			return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) );
1868 1868
 		}
1869 1869
 
1870 1870
 		/**
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
 		 */
1879 1879
 		public function can_plugin_update( $slug ) {
1880 1880
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1881
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1881
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1882 1882
 				return true;
1883 1883
 			}
1884 1884
 
@@ -1934,8 +1934,8 @@  discard block
 block discarded – undo
1934 1934
 		public function get_installed_version( $slug ) {
1935 1935
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1936 1936
 
1937
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1938
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1937
+			if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) {
1938
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1939 1939
 			}
1940 1940
 
1941 1941
 			return '';
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 		 */
1952 1952
 		public function does_plugin_require_update( $slug ) {
1953 1953
 			$installed_version = $this->get_installed_version( $slug );
1954
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1954
+			$minimum_version   = $this->plugins[$slug]['version'];
1955 1955
 
1956 1956
 			return version_compare( $minimum_version, $installed_version, '>' );
1957 1957
 		}
@@ -1966,9 +1966,9 @@  discard block
 block discarded – undo
1966 1966
 		 */
1967 1967
 		public function does_plugin_have_update( $slug ) {
1968 1968
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1969
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1969
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1970 1970
 				if ( $this->does_plugin_require_update( $slug ) ) {
1971
-					return $this->plugins[ $slug ]['version'];
1971
+					return $this->plugins[$slug]['version'];
1972 1972
 				}
1973 1973
 
1974 1974
 				return false;
@@ -1976,8 +1976,8 @@  discard block
 block discarded – undo
1976 1976
 
1977 1977
 			$repo_updates = get_site_transient( 'update_plugins' );
1978 1978
 
1979
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1980
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1979
+			if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) {
1980
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1981 1981
 			}
1982 1982
 
1983 1983
 			return false;
@@ -1993,14 +1993,14 @@  discard block
 block discarded – undo
1993 1993
 		 */
1994 1994
 		public function get_upgrade_notice( $slug ) {
1995 1995
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1996
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1996
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1997 1997
 				return '';
1998 1998
 			}
1999 1999
 
2000 2000
 			$repo_updates = get_site_transient( 'update_plugins' );
2001 2001
 
2002
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
2003
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
2002
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
2003
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
2004 2004
 			}
2005 2005
 
2006 2006
 			return '';
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 				 */
2085 2085
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2086 2086
 					deactivate_plugins( $plugin['file_path'] );
2087
-					$deactivated[ $plugin['file_path'] ] = time();
2087
+					$deactivated[$plugin['file_path']] = time();
2088 2088
 				}
2089 2089
 			}
2090 2090
 
@@ -2280,10 +2280,10 @@  discard block
 block discarded – undo
2280 2280
 				require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
2281 2281
 			}
2282 2282
 			// Call the API.
2283
-			$response = plugins_api( 'query_plugins', array( 'user' => $username ,'per_page' => 100 ) );
2283
+			$response = plugins_api( 'query_plugins', array( 'user' => $username, 'per_page' => 100 ) );
2284 2284
 
2285 2285
 			// Make sure there are no errors or there are plugins.
2286
-			if ( is_wp_error( $response ) ||  empty( $response->plugins ) ) {
2286
+			if ( is_wp_error( $response ) || empty( $response->plugins ) ) {
2287 2287
 				return array();
2288 2288
 			}
2289 2289
 
@@ -2427,30 +2427,30 @@  discard block
 block discarded – undo
2427 2427
 			$i          = 0;
2428 2428
 
2429 2429
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2430
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2430
+			if ( empty( $plugins[$this->view_context] ) ) {
2431 2431
 				$this->view_context = 'all';
2432 2432
 			}
2433 2433
 
2434
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2435
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2436
-				$table_data[ $i ]['slug']              = $slug;
2437
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2438
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2439
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2440
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2441
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2442
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2443
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2434
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2435
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2436
+				$table_data[$i]['slug']              = $slug;
2437
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2438
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2439
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2440
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2441
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2442
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2443
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2444 2444
 
2445 2445
 				// Prep the upgrade notice info.
2446 2446
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2447 2447
 				if ( ! empty( $upgrade_notice ) ) {
2448
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2448
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2449 2449
 
2450 2450
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2451 2451
 				}
2452 2452
 
2453
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2453
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2454 2454
 
2455 2455
 				$i++;
2456 2456
 			}
@@ -2476,17 +2476,17 @@  discard block
 block discarded – undo
2476 2476
 					// No need to display plugins if they are installed, up-to-date and active.
2477 2477
 					continue;
2478 2478
 				} else {
2479
-					$plugins['all'][ $slug ] = $plugin;
2479
+					$plugins['all'][$slug] = $plugin;
2480 2480
 
2481 2481
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2482
-						$plugins['install'][ $slug ] = $plugin;
2482
+						$plugins['install'][$slug] = $plugin;
2483 2483
 					} else {
2484 2484
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2485
-							$plugins['update'][ $slug ] = $plugin;
2485
+							$plugins['update'][$slug] = $plugin;
2486 2486
 						}
2487 2487
 
2488 2488
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2489
-							$plugins['activate'][ $slug ] = $plugin;
2489
+							$plugins['activate'][$slug] = $plugin;
2490 2490
 						}
2491 2491
 					}
2492 2492
 				}
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
 		 */
2505 2505
 		protected function set_view_totals( $plugins ) {
2506 2506
 			foreach ( $plugins as $type => $list ) {
2507
-				$this->view_totals[ $type ] = count( $list );
2507
+				$this->view_totals[$type] = count( $list );
2508 2508
 			}
2509 2509
 		}
2510 2510
 
@@ -2606,8 +2606,8 @@  discard block
 block discarded – undo
2606 2606
 			$name = array();
2607 2607
 
2608 2608
 			foreach ( $items as $i => $plugin ) {
2609
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2610
-				$name[ $i ] = $plugin['sanitized_plugin'];
2609
+				$type[$i] = $plugin['type']; // Required / recommended.
2610
+				$name[$i] = $plugin['sanitized_plugin'];
2611 2611
 			}
2612 2612
 
2613 2613
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2654,7 +2654,7 @@  discard block
 block discarded – undo
2654 2654
 
2655 2655
 				if ( ! empty( $text ) ) {
2656 2656
 
2657
-					$status_links[ $type ] = sprintf(
2657
+					$status_links[$type] = sprintf(
2658 2658
 						'<a href="%s"%s>%s</a>',
2659 2659
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2660 2660
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
 		 * @return string
2678 2678
 		 */
2679 2679
 		public function column_default( $item, $column_name ) {
2680
-			return $item[ $column_name ];
2680
+			return $item[$column_name];
2681 2681
 		}
2682 2682
 
2683 2683
 		/**
@@ -2877,7 +2877,7 @@  discard block
 block discarded – undo
2877 2877
 					'tgmpa-nonce'
2878 2878
 				);
2879 2879
 
2880
-				$action_links[ $action ] = sprintf(
2880
+				$action_links[$action] = sprintf(
2881 2881
 					'<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
2882 2882
 					esc_url( $nonce_url ),
2883 2883
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -3028,19 +3028,19 @@  discard block
 block discarded – undo
3028 3028
 				// Validate the received input.
3029 3029
 				foreach ( $plugins_to_install as $key => $slug ) {
3030 3030
 					// Check if the plugin was registered with TGMPA and remove if not.
3031
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
3032
-						unset( $plugins_to_install[ $key ] );
3031
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
3032
+						unset( $plugins_to_install[$key] );
3033 3033
 						continue;
3034 3034
 					}
3035 3035
 
3036 3036
 					// For install: make sure this is a plugin we *can* install and not one already installed.
3037 3037
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
3038
-						unset( $plugins_to_install[ $key ] );
3038
+						unset( $plugins_to_install[$key] );
3039 3039
 					}
3040 3040
 
3041 3041
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
3042 3042
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
3043
-						unset( $plugins_to_install[ $key ] );
3043
+						unset( $plugins_to_install[$key] );
3044 3044
 					}
3045 3045
 				}
3046 3046
 
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
 
3093 3093
 				// Prepare the data for validated plugins for the install/upgrade.
3094 3094
 				foreach ( $plugins_to_install as $slug ) {
3095
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
3095
+					$name   = $this->tgmpa->plugins[$slug]['name'];
3096 3096
 					$source = $this->tgmpa->get_download_url( $slug );
3097 3097
 
3098 3098
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -3105,9 +3105,9 @@  discard block
 block discarded – undo
3105 3105
 								break;
3106 3106
 
3107 3107
 							case 'update':
3108
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
3109
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
3110
-								$to_inject[ $slug ]['source'] = $source;
3108
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
3109
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
3110
+								$to_inject[$slug]['source'] = $source;
3111 3111
 								break;
3112 3112
 						}
3113 3113
 					}
@@ -3174,8 +3174,8 @@  discard block
 block discarded – undo
3174 3174
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3175 3175
 				foreach ( $plugins as $slug ) {
3176 3176
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3177
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3178
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3177
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3178
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3179 3179
 					}
3180 3180
 				}
3181 3181
 				unset( $slug );
@@ -3207,8 +3207,8 @@  discard block
 block discarded – undo
3207 3207
 					// Update recently activated plugins option.
3208 3208
 					$recent = (array) get_option( 'recently_activated' );
3209 3209
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3210
-						if ( isset( $recent[ $plugin ] ) ) {
3211
-							unset( $recent[ $plugin ] );
3210
+						if ( isset( $recent[$plugin] ) ) {
3211
+							unset( $recent[$plugin] );
3212 3212
 						}
3213 3213
 					}
3214 3214
 					update_option( 'recently_activated', $recent );
@@ -3539,7 +3539,7 @@  discard block
 block discarded – undo
3539 3539
 								)
3540 3540
 							);
3541 3541
 
3542
-							$results[ $plugin ] = $this->result;
3542
+							$results[$plugin] = $this->result;
3543 3543
 
3544 3544
 							// Prevent credentials auth screen from displaying multiple times.
3545 3545
 							if ( false === $result ) {
@@ -3729,7 +3729,7 @@  discard block
 block discarded – undo
3729 3729
 							'names'        => array(),
3730 3730
 							'install_type' => 'install',
3731 3731
 						);
3732
-						$args     = wp_parse_args( $args, $defaults );
3732
+						$args = wp_parse_args( $args, $defaults );
3733 3733
 
3734 3734
 						// Set plugin names to $this->plugin_names property.
3735 3735
 						$this->plugin_names = $args['names'];
@@ -3791,7 +3791,7 @@  discard block
 block discarded – undo
3791 3791
 					 */
3792 3792
 					public function before( $title = '' ) {
3793 3793
 						if ( empty( $title ) ) {
3794
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3794
+							$title = esc_html( $this->plugin_names[$this->i] );
3795 3795
 						}
3796 3796
 						parent::before( $title );
3797 3797
 					}
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 					 */
3809 3809
 					public function after( $title = '' ) {
3810 3810
 						if ( empty( $title ) ) {
3811
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3811
+							$title = esc_html( $this->plugin_names[$this->i] );
3812 3812
 						}
3813 3813
 						parent::after( $title );
3814 3814
 
@@ -3981,7 +3981,7 @@  discard block
 block discarded – undo
3981 3981
 		 */
3982 3982
 		protected static function emulate_filter_bool( $value ) {
3983 3983
 			// @codingStandardsIgnoreStart
3984
-			static $true  = array(
3984
+			static $true = array(
3985 3985
 				'1',
3986 3986
 				'true', 'True', 'TRUE',
3987 3987
 				'y', 'Y',
Please login to merge, or discard this patch.