Completed
Pull Request — develop (#754)
by
unknown
10:52
created
class-tgm-plugin-activation.php 1 patch
Spacing   +123 added lines, -123 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,22 +1392,22 @@  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.
1409
-				'class_exists'       => '',      // String.
1410
-				'is_defined'         => '',      // String.
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
+				'class_exists'       => '', // String.
1410
+				'is_defined'         => '', // String.
1411 1411
 			);
1412 1412
 
1413 1413
 			// Prepare the received data.
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
 			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1429 1429
 
1430 1430
 			// Set the class properties.
1431
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1432
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1431
+			$this->plugins[$plugin['slug']]    = $plugin;
1432
+			$this->sort_order[$plugin['slug']] = $plugin['name'];
1433 1433
 
1434 1434
 			// Should we add the force activation hook ?
1435 1435
 			if ( true === $plugin['force_activation'] ) {
@@ -1513,11 +1513,11 @@  discard block
 block discarded – undo
1513 1513
 			);
1514 1514
 
1515 1515
 			foreach ( $keys as $key ) {
1516
-				if ( isset( $config[ $key ] ) ) {
1517
-					if ( is_array( $config[ $key ] ) ) {
1518
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1516
+				if ( isset( $config[$key] ) ) {
1517
+					if ( is_array( $config[$key] ) ) {
1518
+						$this->$key = array_merge( $this->$key, $config[$key] );
1519 1519
 					} else {
1520
-						$this->$key = $config[ $key ];
1520
+						$this->$key = $config[$key];
1521 1521
 					}
1522 1522
 				}
1523 1523
 			}
@@ -1562,12 +1562,12 @@  discard block
 block discarded – undo
1562 1562
 		 *                            Parameter added in v2.5.0.
1563 1563
 		 */
1564 1564
 		public function populate_file_path( $plugin_slug = '' ) {
1565
-			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1566
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1565
+			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) {
1566
+				$this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1567 1567
 			} else {
1568 1568
 				// Add file_path key for all plugins.
1569 1569
 				foreach ( $this->plugins as $slug => $values ) {
1570
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1570
+					$this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1571 1571
 				}
1572 1572
 			}
1573 1573
 		}
@@ -1607,8 +1607,8 @@  discard block
 block discarded – undo
1607 1607
 		 */
1608 1608
 		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1609 1609
 			foreach ( $this->plugins as $values ) {
1610
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1611
-					return $values[ $data ];
1610
+				if ( $name === $values['name'] && isset( $values[$data] ) ) {
1611
+					return $values[$data];
1612 1612
 				}
1613 1613
 			}
1614 1614
 
@@ -1626,13 +1626,13 @@  discard block
 block discarded – undo
1626 1626
 		public function get_download_url( $slug ) {
1627 1627
 			$dl_source = '';
1628 1628
 
1629
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1629
+			switch ( $this->plugins[$slug]['source_type'] ) {
1630 1630
 				case 'repo':
1631 1631
 					return $this->get_wp_repo_download_url( $slug );
1632 1632
 				case 'external':
1633
-					return $this->plugins[ $slug ]['source'];
1633
+					return $this->plugins[$slug]['source'];
1634 1634
 				case 'bundled':
1635
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1635
+					return $this->default_path . $this->plugins[$slug]['source'];
1636 1636
 			}
1637 1637
 
1638 1638
 			return $dl_source; // Should never happen.
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 		protected function get_plugins_api( $slug ) {
1669 1669
 			static $api = array(); // Cache received responses.
1670 1670
 
1671
-			if ( ! isset( $api[ $slug ] ) ) {
1671
+			if ( ! isset( $api[$slug] ) ) {
1672 1672
 				if ( ! function_exists( 'plugins_api' ) ) {
1673 1673
 					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1674 1674
 				}
@@ -1683,16 +1683,16 @@  discard block
 block discarded – undo
1683 1683
 					)
1684 1684
 				);
1685 1685
 
1686
-				$api[ $slug ] = false;
1686
+				$api[$slug] = false;
1687 1687
 
1688 1688
 				if ( is_wp_error( $response ) ) {
1689 1689
 					wp_die( esc_html( $this->strings['oops'] ) );
1690 1690
 				} else {
1691
-					$api[ $slug ] = $response;
1691
+					$api[$slug] = $response;
1692 1692
 				}
1693 1693
 			}
1694 1694
 
1695
-			return $api[ $slug ];
1695
+			return $api[$slug];
1696 1696
 		}
1697 1697
 
1698 1698
 		/**
@@ -1705,13 +1705,13 @@  discard block
 block discarded – undo
1705 1705
 		 *                or the plugin name if not.
1706 1706
 		 */
1707 1707
 		public function get_info_link( $slug ) {
1708
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1708
+			if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) {
1709 1709
 				$link = sprintf(
1710 1710
 					'<a href="%1$s" target="_blank">%2$s</a>',
1711
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1712
-					esc_html( $this->plugins[ $slug ]['name'] )
1711
+					esc_url( $this->plugins[$slug]['external_url'] ),
1712
+					esc_html( $this->plugins[$slug]['name'] )
1713 1713
 				);
1714
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1714
+			} elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) {
1715 1715
 				$url = add_query_arg(
1716 1716
 					array(
1717 1717
 						'tab'       => 'plugin-information',
@@ -1726,10 +1726,10 @@  discard block
 block discarded – undo
1726 1726
 				$link = sprintf(
1727 1727
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1728 1728
 					esc_url( $url ),
1729
-					esc_html( $this->plugins[ $slug ]['name'] )
1729
+					esc_html( $this->plugins[$slug]['name'] )
1730 1730
 				);
1731 1731
 			} else {
1732
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1732
+				$link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink.
1733 1733
 			}
1734 1734
 
1735 1735
 			return $link;
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 		public function is_plugin_installed( $slug ) {
1855 1855
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1856 1856
 
1857
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1857
+			return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) );
1858 1858
 		}
1859 1859
 
1860 1860
 		/**
@@ -1866,10 +1866,10 @@  discard block
 block discarded – undo
1866 1866
 		 * @return bool True if active, false otherwise.
1867 1867
 		 */
1868 1868
 		public function is_plugin_active( $slug ) {
1869
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) )
1870
-				|| ( ! empty( $this->plugins[ $slug ]['class_exists'] ) && class_exists( $this->plugins[ $slug ]['class_exists'] ) )
1871
-				|| ( ! empty( $this->plugins[ $slug ]['is_defined'] ) && defined( $this->plugins[ $slug ]['is_defined'] ) )
1872
-				|| is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1869
+			return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) )
1870
+				|| ( ! empty( $this->plugins[$slug]['class_exists'] ) && class_exists( $this->plugins[$slug]['class_exists'] ) )
1871
+				|| ( ! empty( $this->plugins[$slug]['is_defined'] ) && defined( $this->plugins[$slug]['is_defined'] ) )
1872
+				|| is_plugin_active( $this->plugins[$slug]['file_path'] ) );
1873 1873
 		}
1874 1874
 
1875 1875
 		/**
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
 		 */
1884 1884
 		public function can_plugin_update( $slug ) {
1885 1885
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1886
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1886
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1887 1887
 				return true;
1888 1888
 			}
1889 1889
 
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 		public function get_installed_version( $slug ) {
1940 1940
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1941 1941
 
1942
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1943
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1942
+			if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) {
1943
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1944 1944
 			}
1945 1945
 
1946 1946
 			return '';
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 		 */
1957 1957
 		public function does_plugin_require_update( $slug ) {
1958 1958
 			$installed_version = $this->get_installed_version( $slug );
1959
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1959
+			$minimum_version   = $this->plugins[$slug]['version'];
1960 1960
 
1961 1961
 			return version_compare( $minimum_version, $installed_version, '>' );
1962 1962
 		}
@@ -1971,9 +1971,9 @@  discard block
 block discarded – undo
1971 1971
 		 */
1972 1972
 		public function does_plugin_have_update( $slug ) {
1973 1973
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1974
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1974
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1975 1975
 				if ( $this->does_plugin_require_update( $slug ) ) {
1976
-					return $this->plugins[ $slug ]['version'];
1976
+					return $this->plugins[$slug]['version'];
1977 1977
 				}
1978 1978
 
1979 1979
 				return false;
@@ -1981,8 +1981,8 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
 			$repo_updates = get_site_transient( 'update_plugins' );
1983 1983
 
1984
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1985
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1984
+			if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) {
1985
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1986 1986
 			}
1987 1987
 
1988 1988
 			return false;
@@ -1998,14 +1998,14 @@  discard block
 block discarded – undo
1998 1998
 		 */
1999 1999
 		public function get_upgrade_notice( $slug ) {
2000 2000
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
2001
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
2001
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
2002 2002
 				return '';
2003 2003
 			}
2004 2004
 
2005 2005
 			$repo_updates = get_site_transient( 'update_plugins' );
2006 2006
 
2007
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
2008
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
2007
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
2008
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
2009 2009
 			}
2010 2010
 
2011 2011
 			return '';
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
 				 */
2090 2090
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2091 2091
 					deactivate_plugins( $plugin['file_path'] );
2092
-					$deactivated[ $plugin['file_path'] ] = time();
2092
+					$deactivated[$plugin['file_path']] = time();
2093 2093
 				}
2094 2094
 			}
2095 2095
 
@@ -2326,30 +2326,30 @@  discard block
 block discarded – undo
2326 2326
 			$i          = 0;
2327 2327
 
2328 2328
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2329
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2329
+			if ( empty( $plugins[$this->view_context] ) ) {
2330 2330
 				$this->view_context = 'all';
2331 2331
 			}
2332 2332
 
2333
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2334
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2335
-				$table_data[ $i ]['slug']              = $slug;
2336
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2337
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2338
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2339
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2340
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2341
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2342
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2333
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2334
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2335
+				$table_data[$i]['slug']              = $slug;
2336
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2337
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2338
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2339
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2340
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2341
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2342
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2343 2343
 
2344 2344
 				// Prep the upgrade notice info.
2345 2345
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2346 2346
 				if ( ! empty( $upgrade_notice ) ) {
2347
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2347
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2348 2348
 
2349 2349
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2350 2350
 				}
2351 2351
 
2352
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2352
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2353 2353
 
2354 2354
 				$i++;
2355 2355
 			}
@@ -2375,17 +2375,17 @@  discard block
 block discarded – undo
2375 2375
 					// No need to display plugins if they are installed, up-to-date and active.
2376 2376
 					continue;
2377 2377
 				} else {
2378
-					$plugins['all'][ $slug ] = $plugin;
2378
+					$plugins['all'][$slug] = $plugin;
2379 2379
 
2380 2380
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2381
-						$plugins['install'][ $slug ] = $plugin;
2381
+						$plugins['install'][$slug] = $plugin;
2382 2382
 					} else {
2383 2383
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2384
-							$plugins['update'][ $slug ] = $plugin;
2384
+							$plugins['update'][$slug] = $plugin;
2385 2385
 						}
2386 2386
 
2387 2387
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2388
-							$plugins['activate'][ $slug ] = $plugin;
2388
+							$plugins['activate'][$slug] = $plugin;
2389 2389
 						}
2390 2390
 					}
2391 2391
 				}
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
 		 */
2404 2404
 		protected function set_view_totals( $plugins ) {
2405 2405
 			foreach ( $plugins as $type => $list ) {
2406
-				$this->view_totals[ $type ] = count( $list );
2406
+				$this->view_totals[$type] = count( $list );
2407 2407
 			}
2408 2408
 		}
2409 2409
 
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 			$name = array();
2506 2506
 
2507 2507
 			foreach ( $items as $i => $plugin ) {
2508
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2509
-				$name[ $i ] = $plugin['sanitized_plugin'];
2508
+				$type[$i] = $plugin['type']; // Required / recommended.
2509
+				$name[$i] = $plugin['sanitized_plugin'];
2510 2510
 			}
2511 2511
 
2512 2512
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
 
2554 2554
 				if ( ! empty( $text ) ) {
2555 2555
 
2556
-					$status_links[ $type ] = sprintf(
2556
+					$status_links[$type] = sprintf(
2557 2557
 						'<a href="%s"%s>%s</a>',
2558 2558
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2559 2559
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2576,7 +2576,7 @@  discard block
 block discarded – undo
2576 2576
 		 * @return string
2577 2577
 		 */
2578 2578
 		public function column_default( $item, $column_name ) {
2579
-			return $item[ $column_name ];
2579
+			return $item[$column_name];
2580 2580
 		}
2581 2581
 
2582 2582
 		/**
@@ -2776,7 +2776,7 @@  discard block
 block discarded – undo
2776 2776
 					'tgmpa-nonce'
2777 2777
 				);
2778 2778
 
2779
-				$action_links[ $action ] = sprintf(
2779
+				$action_links[$action] = sprintf(
2780 2780
 					'<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
2781 2781
 					esc_url( $nonce_url ),
2782 2782
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -2927,19 +2927,19 @@  discard block
 block discarded – undo
2927 2927
 				// Validate the received input.
2928 2928
 				foreach ( $plugins_to_install as $key => $slug ) {
2929 2929
 					// Check if the plugin was registered with TGMPA and remove if not.
2930
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2931
-						unset( $plugins_to_install[ $key ] );
2930
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
2931
+						unset( $plugins_to_install[$key] );
2932 2932
 						continue;
2933 2933
 					}
2934 2934
 
2935 2935
 					// For install: make sure this is a plugin we *can* install and not one already installed.
2936 2936
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
2937
-						unset( $plugins_to_install[ $key ] );
2937
+						unset( $plugins_to_install[$key] );
2938 2938
 					}
2939 2939
 
2940 2940
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2941 2941
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
2942
-						unset( $plugins_to_install[ $key ] );
2942
+						unset( $plugins_to_install[$key] );
2943 2943
 					}
2944 2944
 				}
2945 2945
 
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 
2992 2992
 				// Prepare the data for validated plugins for the install/upgrade.
2993 2993
 				foreach ( $plugins_to_install as $slug ) {
2994
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
2994
+					$name   = $this->tgmpa->plugins[$slug]['name'];
2995 2995
 					$source = $this->tgmpa->get_download_url( $slug );
2996 2996
 
2997 2997
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -3004,9 +3004,9 @@  discard block
 block discarded – undo
3004 3004
 								break;
3005 3005
 
3006 3006
 							case 'update':
3007
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
3008
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
3009
-								$to_inject[ $slug ]['source'] = $source;
3007
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
3008
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
3009
+								$to_inject[$slug]['source'] = $source;
3010 3010
 								break;
3011 3011
 						}
3012 3012
 					}
@@ -3073,8 +3073,8 @@  discard block
 block discarded – undo
3073 3073
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3074 3074
 				foreach ( $plugins as $slug ) {
3075 3075
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3076
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3077
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3076
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3077
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3078 3078
 					}
3079 3079
 				}
3080 3080
 				unset( $slug );
@@ -3106,8 +3106,8 @@  discard block
 block discarded – undo
3106 3106
 					// Update recently activated plugins option.
3107 3107
 					$recent = (array) get_option( 'recently_activated' );
3108 3108
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3109
-						if ( isset( $recent[ $plugin ] ) ) {
3110
-							unset( $recent[ $plugin ] );
3109
+						if ( isset( $recent[$plugin] ) ) {
3110
+							unset( $recent[$plugin] );
3111 3111
 						}
3112 3112
 					}
3113 3113
 					update_option( 'recently_activated', $recent );
@@ -3438,7 +3438,7 @@  discard block
 block discarded – undo
3438 3438
 								)
3439 3439
 							);
3440 3440
 
3441
-							$results[ $plugin ] = $this->result;
3441
+							$results[$plugin] = $this->result;
3442 3442
 
3443 3443
 							// Prevent credentials auth screen from displaying multiple times.
3444 3444
 							if ( false === $result ) {
@@ -3628,7 +3628,7 @@  discard block
 block discarded – undo
3628 3628
 							'names'        => array(),
3629 3629
 							'install_type' => 'install',
3630 3630
 						);
3631
-						$args     = wp_parse_args( $args, $defaults );
3631
+						$args = wp_parse_args( $args, $defaults );
3632 3632
 
3633 3633
 						// Set plugin names to $this->plugin_names property.
3634 3634
 						$this->plugin_names = $args['names'];
@@ -3690,7 +3690,7 @@  discard block
 block discarded – undo
3690 3690
 					 */
3691 3691
 					public function before( $title = '' ) {
3692 3692
 						if ( empty( $title ) ) {
3693
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3693
+							$title = esc_html( $this->plugin_names[$this->i] );
3694 3694
 						}
3695 3695
 						parent::before( $title );
3696 3696
 					}
@@ -3707,7 +3707,7 @@  discard block
 block discarded – undo
3707 3707
 					 */
3708 3708
 					public function after( $title = '' ) {
3709 3709
 						if ( empty( $title ) ) {
3710
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3710
+							$title = esc_html( $this->plugin_names[$this->i] );
3711 3711
 						}
3712 3712
 						parent::after( $title );
3713 3713
 
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
 		 */
3881 3881
 		protected static function emulate_filter_bool( $value ) {
3882 3882
 			// @codingStandardsIgnoreStart
3883
-			static $true  = array(
3883
+			static $true = array(
3884 3884
 				'1',
3885 3885
 				'true', 'True', 'TRUE',
3886 3886
 				'y', 'Y',
Please login to merge, or discard this patch.