Completed
Push — develop ( df4d43...c6de28 )
by Gary
11s
created
class-tgm-plugin-activation.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -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
 			);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 			// All plugin information will be stored in an array for processing.
802 802
 			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
803 803
 
804
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
804
+			if ( ! isset( $this->plugins[$slug] ) ) {
805 805
 				return false;
806 806
 			}
807 807
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 				$extra         = array();
846 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(
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 
863 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 868
 					'nonce'  => $install_type . '-plugin_' . $slug,
869 869
 					'plugin' => '',
@@ -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 );
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 
888 888
 				if ( 'update' === $install_type ) {
889 889
 					// Inject our info into the update transient.
890
-					$to_inject                    = array( $slug => $this->plugins[ $slug ] );
891
-					$to_inject[ $slug ]['source'] = $source;
890
+					$to_inject                    = array( $slug => $this->plugins[$slug] );
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
 				}
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
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
 			}
@@ -950,17 +950,17 @@  discard block
 block discarded – undo
950 950
 			foreach ( $plugins as $slug => $plugin ) {
951 951
 				$file_path = $plugin['file_path'];
952 952
 
953
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
954
-					$repo_updates->response[ $file_path ] = new stdClass;
953
+				if ( empty( $repo_updates->response[$file_path] ) ) {
954
+					$repo_updates->response[$file_path] = new stdClass;
955 955
 				}
956 956
 
957 957
 				// We only really need to set package, but let's do all we can in case WP changes something.
958
-				$repo_updates->response[ $file_path ]->slug        = $slug;
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'];
958
+				$repo_updates->response[$file_path]->slug        = $slug;
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'];
964 964
 				}
965 965
 			}
966 966
 
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
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
 					}
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 						// Make sure message doesn't display again if bulk activation is performed
1057 1057
 						// immediately after a single activation.
1058 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>';
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.
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 				echo '<div id="message" class="error"><p>',
1070 1070
 					sprintf(
1071 1071
 						esc_html( $this->strings['plugin_already_active'] ),
1072
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1072
+						'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1073 1073
 					),
1074 1074
 					'</p></div>';
1075 1075
 			} elseif ( $this->does_plugin_require_update( $slug ) ) {
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
 						echo '<div id="message" class="error"><p>',
1081 1081
 							sprintf(
1082 1082
 								esc_html( $this->strings['plugin_needs_higher_version'] ),
1083
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
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
 
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						$rendered .= sprintf(
1214 1214
 							$line_template,
1215 1215
 							sprintf(
1216
-								translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ),
1216
+								translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ),
1217 1217
 								$imploded,
1218 1218
 								$count
1219 1219
 							)
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 			foreach ( (array) $wp_settings_errors as $key => $details ) {
1332 1332
 				if ( 'tgmpa' === $details['setting'] ) {
1333
-					unset( $wp_settings_errors[ $key ] );
1333
+					unset( $wp_settings_errors[$key] );
1334 1334
 					break;
1335 1335
 				}
1336 1336
 			}
@@ -1366,20 +1366,20 @@  discard block
 block discarded – undo
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.
@@ -1400,8 +1400,8 @@  discard block
 block discarded – undo
1400 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 1407
 			if ( true === $plugin['force_activation'] ) {
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
 			);
1486 1486
 
1487 1487
 			foreach ( $keys as $key ) {
1488
-				if ( isset( $config[ $key ] ) ) {
1489
-					if ( is_array( $config[ $key ] ) ) {
1490
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1488
+				if ( isset( $config[$key] ) ) {
1489
+					if ( is_array( $config[$key] ) ) {
1490
+						$this->$key = array_merge( $this->$key, $config[$key] );
1491 1491
 					} else {
1492
-						$this->$key = $config[ $key ];
1492
+						$this->$key = $config[$key];
1493 1493
 					}
1494 1494
 				}
1495 1495
 			}
@@ -1534,12 +1534,12 @@  discard block
 block discarded – undo
1534 1534
 		 *                            Parameter added in v2.5.0.
1535 1535
 		 */
1536 1536
 		public function populate_file_path( $plugin_slug = '' ) {
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 );
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 );
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
 		}
@@ -1579,8 +1579,8 @@  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 ] ) ) {
1583
-					return $values[ $data ];
1582
+				if ( $name === $values['name'] && isset( $values[$data] ) ) {
1583
+					return $values[$data];
1584 1584
 				}
1585 1585
 			}
1586 1586
 
@@ -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.
@@ -1640,23 +1640,23 @@  discard block
 block discarded – undo
1640 1640
 		protected function get_plugins_api( $slug ) {
1641 1641
 			static $api = array(); // Cache received responses.
1642 1642
 
1643
-			if ( ! isset( $api[ $slug ] ) ) {
1643
+			if ( ! isset( $api[$slug] ) ) {
1644 1644
 				if ( ! function_exists( 'plugins_api' ) ) {
1645 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 ) ) );
1649 1649
 
1650
-				$api[ $slug ] = false;
1650
+				$api[$slug] = false;
1651 1651
 
1652 1652
 				if ( is_wp_error( $response ) ) {
1653 1653
 					wp_die( esc_html( $this->strings['oops'] ) );
1654 1654
 				} else {
1655
-					$api[ $slug ] = $response;
1655
+					$api[$slug] = $response;
1656 1656
 				}
1657 1657
 			}
1658 1658
 
1659
-			return $api[ $slug ];
1659
+			return $api[$slug];
1660 1660
 		}
1661 1661
 
1662 1662
 		/**
@@ -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;
@@ -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;
1947 1947
 			}
1948 1948
 
1949 1949
 			return false;
@@ -1959,14 +1959,14 @@  discard block
 block discarded – undo
1959 1959
 		 */
1960 1960
 		public function get_upgrade_notice( $slug ) {
1961 1961
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1962
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1962
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1963 1963
 				return '';
1964 1964
 			}
1965 1965
 
1966 1966
 			$repo_updates = get_site_transient( 'update_plugins' );
1967 1967
 
1968
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
1969
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
1968
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
1969
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
1970 1970
 			}
1971 1971
 
1972 1972
 			return '';
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
 				 */
2051 2051
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2052 2052
 					deactivate_plugins( $plugin['file_path'] );
2053
-					$deactivated[ $plugin['file_path'] ] = time();
2053
+					$deactivated[$plugin['file_path']] = time();
2054 2054
 				}
2055 2055
 			}
2056 2056
 
@@ -2265,30 +2265,30 @@  discard block
 block discarded – undo
2265 2265
 			$i          = 0;
2266 2266
 
2267 2267
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2268
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2268
+			if ( empty( $plugins[$this->view_context] ) ) {
2269 2269
 				$this->view_context = 'all';
2270 2270
 			}
2271 2271
 
2272
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2273
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2274
-				$table_data[ $i ]['slug']              = $slug;
2275
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2276
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2277
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2278
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2279
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2280
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2281
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2272
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2273
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2274
+				$table_data[$i]['slug']              = $slug;
2275
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2276
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2277
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2278
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2279
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2280
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2281
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2282 2282
 
2283 2283
 				// Prep the upgrade notice info.
2284 2284
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2285 2285
 				if ( ! empty( $upgrade_notice ) ) {
2286
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2286
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2287 2287
 
2288 2288
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2289 2289
 				}
2290 2290
 
2291
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2291
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2292 2292
 
2293 2293
 				$i++;
2294 2294
 			}
@@ -2314,17 +2314,17 @@  discard block
 block discarded – undo
2314 2314
 					// No need to display plugins if they are installed, up-to-date and active.
2315 2315
 					continue;
2316 2316
 				} else {
2317
-					$plugins['all'][ $slug ] = $plugin;
2317
+					$plugins['all'][$slug] = $plugin;
2318 2318
 
2319 2319
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2320
-						$plugins['install'][ $slug ] = $plugin;
2320
+						$plugins['install'][$slug] = $plugin;
2321 2321
 					} else {
2322 2322
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2323
-							$plugins['update'][ $slug ] = $plugin;
2323
+							$plugins['update'][$slug] = $plugin;
2324 2324
 						}
2325 2325
 
2326 2326
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2327
-							$plugins['activate'][ $slug ] = $plugin;
2327
+							$plugins['activate'][$slug] = $plugin;
2328 2328
 						}
2329 2329
 					}
2330 2330
 				}
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 		 */
2343 2343
 		protected function set_view_totals( $plugins ) {
2344 2344
 			foreach ( $plugins as $type => $list ) {
2345
-				$this->view_totals[ $type ] = count( $list );
2345
+				$this->view_totals[$type] = count( $list );
2346 2346
 			}
2347 2347
 		}
2348 2348
 
@@ -2444,8 +2444,8 @@  discard block
 block discarded – undo
2444 2444
 			$name = array();
2445 2445
 
2446 2446
 			foreach ( $items as $i => $plugin ) {
2447
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2448
-				$name[ $i ] = $plugin['sanitized_plugin'];
2447
+				$type[$i] = $plugin['type']; // Required / recommended.
2448
+				$name[$i] = $plugin['sanitized_plugin'];
2449 2449
 			}
2450 2450
 
2451 2451
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 
2493 2493
 				if ( ! empty( $text ) ) {
2494 2494
 
2495
-					$status_links[ $type ] = sprintf(
2495
+					$status_links[$type] = sprintf(
2496 2496
 						'<a href="%s"%s>%s</a>',
2497 2497
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2498 2498
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2515,7 +2515,7 @@  discard block
 block discarded – undo
2515 2515
 		 * @return string
2516 2516
 		 */
2517 2517
 		public function column_default( $item, $column_name ) {
2518
-			return $item[ $column_name ];
2518
+			return $item[$column_name];
2519 2519
 		}
2520 2520
 
2521 2521
 		/**
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
 					'tgmpa-nonce'
2716 2716
 				);
2717 2717
 
2718
-				$action_links[ $action ] = sprintf(
2718
+				$action_links[$action] = sprintf(
2719 2719
 					'<a href="%1$s">' . esc_html( $text ) . '</a>',
2720 2720
 					esc_url( $nonce_url ),
2721 2721
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -2864,19 +2864,19 @@  discard block
 block discarded – undo
2864 2864
 				// Validate the received input.
2865 2865
 				foreach ( $plugins_to_install as $key => $slug ) {
2866 2866
 					// Check if the plugin was registered with TGMPA and remove if not.
2867
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2868
-						unset( $plugins_to_install[ $key ] );
2867
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
2868
+						unset( $plugins_to_install[$key] );
2869 2869
 						continue;
2870 2870
 					}
2871 2871
 
2872 2872
 					// For install: make sure this is a plugin we *can* install and not one already installed.
2873 2873
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
2874
-						unset( $plugins_to_install[ $key ] );
2874
+						unset( $plugins_to_install[$key] );
2875 2875
 					}
2876 2876
 
2877 2877
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2878 2878
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
2879
-						unset( $plugins_to_install[ $key ] );
2879
+						unset( $plugins_to_install[$key] );
2880 2880
 					}
2881 2881
 				}
2882 2882
 
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
 
2928 2928
 				// Prepare the data for validated plugins for the install/upgrade.
2929 2929
 				foreach ( $plugins_to_install as $slug ) {
2930
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
2930
+					$name   = $this->tgmpa->plugins[$slug]['name'];
2931 2931
 					$source = $this->tgmpa->get_download_url( $slug );
2932 2932
 
2933 2933
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -2940,9 +2940,9 @@  discard block
 block discarded – undo
2940 2940
 								break;
2941 2941
 
2942 2942
 							case 'update':
2943
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
2944
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
2945
-								$to_inject[ $slug ]['source'] = $source;
2943
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
2944
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
2945
+								$to_inject[$slug]['source'] = $source;
2946 2946
 								break;
2947 2947
 						}
2948 2948
 					}
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3010 3010
 				foreach ( $plugins as $slug ) {
3011 3011
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3012
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3013
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3012
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3013
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3014 3014
 					}
3015 3015
 				}
3016 3016
 				unset( $slug );
@@ -3042,8 +3042,8 @@  discard block
 block discarded – undo
3042 3042
 					// Update recently activated plugins option.
3043 3043
 					$recent = (array) get_option( 'recently_activated' );
3044 3044
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3045
-						if ( isset( $recent[ $plugin ] ) ) {
3046
-							unset( $recent[ $plugin ] );
3045
+						if ( isset( $recent[$plugin] ) ) {
3046
+							unset( $recent[$plugin] );
3047 3047
 						}
3048 3048
 					}
3049 3049
 					update_option( 'recently_activated', $recent );
@@ -3364,7 +3364,7 @@  discard block
 block discarded – undo
3364 3364
 								)
3365 3365
 							);
3366 3366
 
3367
-							$results[ $plugin ] = $this->result;
3367
+							$results[$plugin] = $this->result;
3368 3368
 
3369 3369
 							// Prevent credentials auth screen from displaying multiple times.
3370 3370
 							if ( false === $result ) {
@@ -3550,7 +3550,7 @@  discard block
 block discarded – undo
3550 3550
 							'names'        => array(),
3551 3551
 							'install_type' => 'install',
3552 3552
 						);
3553
-						$args     = wp_parse_args( $args, $defaults );
3553
+						$args = wp_parse_args( $args, $defaults );
3554 3554
 
3555 3555
 						// Set plugin names to $this->plugin_names property.
3556 3556
 						$this->plugin_names = $args['names'];
@@ -3607,7 +3607,7 @@  discard block
 block discarded – undo
3607 3607
 					 */
3608 3608
 					public function before( $title = '' ) {
3609 3609
 						if ( empty( $title ) ) {
3610
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3610
+							$title = esc_html( $this->plugin_names[$this->i] );
3611 3611
 						}
3612 3612
 						parent::before( $title );
3613 3613
 					}
@@ -3624,7 +3624,7 @@  discard block
 block discarded – undo
3624 3624
 					 */
3625 3625
 					public function after( $title = '' ) {
3626 3626
 						if ( empty( $title ) ) {
3627
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3627
+							$title = esc_html( $this->plugin_names[$this->i] );
3628 3628
 						}
3629 3629
 						parent::after( $title );
3630 3630
 
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
 		 */
3798 3798
 		protected static function emulate_filter_bool( $value ) {
3799 3799
 			// @codingStandardsIgnoreStart
3800
-			static $true  = array(
3800
+			static $true = array(
3801 3801
 				'1',
3802 3802
 				'true', 'True', 'TRUE',
3803 3803
 				'y', 'Y',
Please login to merge, or discard this patch.