Completed
Pull Request — develop (#788)
by
unknown
01:24
created
class-tgm-plugin-activation.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
 		 *
2309 2309
 		 * @since 2.5.0
2310 2310
 		 *
2311
-		 * @return array CSS classnames.
2311
+		 * @return string[] CSS classnames.
2312 2312
 		 */
2313 2313
 		public function get_table_classes() {
2314 2314
 			return array( 'widefat', 'fixed' );
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 		 * @since 2.5.0
2780 2780
 		 *
2781 2781
 		 * @param array $item Array of item data.
2782
-		 * @return array Array with relevant action links.
2782
+		 * @return string[] Array with relevant action links.
2783 2783
 		 */
2784 2784
 		protected function get_row_actions( $item ) {
2785 2785
 			$actions      = array();
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 			$args = apply_filters(
709 709
 				'tgmpa_admin_menu_args',
710 710
 				array(
711
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
712
-					'page_title'  => $this->strings['page_title'],           // Page title.
713
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
714
-					'capability'  => $this->capability,                      // Capability.
715
-					'menu_slug'   => $this->menu,                            // Menu slug.
711
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
712
+					'page_title'  => $this->strings['page_title'], // Page title.
713
+					'menu_title'  => $this->strings['menu_title'], // Menu title.
714
+					'capability'  => $this->capability, // Capability.
715
+					'menu_slug'   => $this->menu, // Menu slug.
716 716
 					'function'    => array( $this, 'install_plugins_page' ), // Callback.
717 717
 				)
718 718
 			);
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 			// All plugin information will be stored in an array for processing.
825 825
 			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
826 826
 
827
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
827
+			if ( ! isset( $this->plugins[$slug] ) ) {
828 828
 				return false;
829 829
 			}
830 830
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 				$extra         = array();
870 870
 				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
871 871
 				$source        = $this->get_download_url( $slug );
872
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
872
+				$api           = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
873 873
 				$api           = ( false !== $api ) ? $api : null;
874 874
 
875 875
 				$url = add_query_arg(
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
 
887 887
 				$title     = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
888 888
 				$skin_args = array(
889
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
890
-					'title'  => sprintf( $title, $this->plugins[ $slug ]['name'] ),
889
+					'type'   => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload',
890
+					'title'  => sprintf( $title, $this->plugins[$slug]['name'] ),
891 891
 					'url'    => esc_url_raw( $url ),
892 892
 					'nonce'  => $install_type . '-plugin_' . $slug,
893 893
 					'plugin' => '',
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 				unset( $title );
898 898
 
899 899
 				if ( 'update' === $install_type ) {
900
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
900
+					$skin_args['plugin'] = $this->plugins[$slug]['file_path'];
901 901
 					$skin                = new Plugin_Upgrader_Skin( $skin_args );
902 902
 				} else {
903 903
 					$skin = new Plugin_Installer_Skin( $skin_args );
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
 				if ( 'update' === $install_type ) {
913 913
 					// Inject our info into the update transient.
914 914
 					$to_inject                    = array(
915
-						$slug => $this->plugins[ $slug ],
915
+						$slug => $this->plugins[$slug],
916 916
 					);
917
-					$to_inject[ $slug ]['source'] = $source;
917
+					$to_inject[$slug]['source'] = $source;
918 918
 					$this->inject_update_info( $to_inject );
919 919
 
920
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
920
+					$upgrader->upgrade( $this->plugins[$slug]['file_path'] );
921 921
 				} else {
922 922
 					$upgrader->install( $source );
923 923
 				}
@@ -947,11 +947,11 @@  discard block
 block discarded – undo
947 947
 				}
948 948
 
949 949
 				return true;
950
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
950
+			} elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
951 951
 				// Activate action link was clicked.
952 952
 				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
953 953
 
954
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
954
+				if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) {
955 955
 					return true; // Finish execution of the function early as we encountered an error.
956 956
 				}
957 957
 			}
@@ -976,17 +976,17 @@  discard block
 block discarded – undo
976 976
 			foreach ( $plugins as $slug => $plugin ) {
977 977
 				$file_path = $plugin['file_path'];
978 978
 
979
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
980
-					$repo_updates->response[ $file_path ] = new stdClass();
979
+				if ( empty( $repo_updates->response[$file_path] ) ) {
980
+					$repo_updates->response[$file_path] = new stdClass();
981 981
 				}
982 982
 
983 983
 				// We only really need to set package, but let's do all we can in case WP changes something.
984
-				$repo_updates->response[ $file_path ]->slug        = $slug;
985
-				$repo_updates->response[ $file_path ]->plugin      = $file_path;
986
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
987
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
988
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
989
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
984
+				$repo_updates->response[$file_path]->slug        = $slug;
985
+				$repo_updates->response[$file_path]->plugin      = $file_path;
986
+				$repo_updates->response[$file_path]->new_version = $plugin['version'];
987
+				$repo_updates->response[$file_path]->package     = $plugin['source'];
988
+				if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) {
989
+					$repo_updates->response[$file_path]->url = $plugin['external_url'];
990 990
 				}
991 991
 			}
992 992
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 			} else {
1030 1030
 				// Bulk installer contains less info, so fall back on the info registered here.
1031 1031
 				foreach ( $this->plugins as $slug => $plugin ) {
1032
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
1032
+					if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) {
1033 1033
 						$desired_slug = $slug;
1034 1034
 						break;
1035 1035
 					}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 						// immediately after a single activation.
1098 1098
 						// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Not using the superglobal.
1099 1099
 						if ( ! isset( $_POST['action'] ) ) {
1100
-							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
1100
+							echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>';
1101 1101
 						}
1102 1102
 					} else {
1103 1103
 						// Simpler message layout for use on the plugin install page.
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 				echo '<div id="message" class="error"><p>',
1111 1111
 					sprintf(
1112 1112
 						esc_html( $this->strings['plugin_already_active'] ),
1113
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1113
+						'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1114 1114
 					),
1115 1115
 					'</p></div>';
1116 1116
 			} elseif ( $this->does_plugin_require_update( $slug ) ) {
@@ -1122,13 +1122,13 @@  discard block
 block discarded – undo
1122 1122
 						echo '<div id="message" class="error"><p>',
1123 1123
 							sprintf(
1124 1124
 								esc_html( $this->strings['plugin_needs_higher_version'] ),
1125
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1125
+								'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1126 1126
 							),
1127 1127
 							'</p></div>';
1128 1128
 					}
1129 1129
 				} else {
1130 1130
 					// Simpler message layout for use on the plugin install page.
1131
-					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
1131
+					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>';
1132 1132
 				}
1133 1133
 			}
1134 1134
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 						$rendered .= sprintf(
1256 1256
 							$line_template,
1257 1257
 							sprintf(
1258
-								translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ),
1258
+								translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ),
1259 1259
 								$imploded,
1260 1260
 								$count
1261 1261
 							)
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 
1373 1373
 			foreach ( (array) $wp_settings_errors as $key => $details ) {
1374 1374
 				if ( 'tgmpa' === $details['setting'] ) {
1375
-					unset( $wp_settings_errors[ $key ] );
1375
+					unset( $wp_settings_errors[$key] );
1376 1376
 					break;
1377 1377
 				}
1378 1378
 			}
@@ -1408,20 +1408,20 @@  discard block
 block discarded – undo
1408 1408
 				return;
1409 1409
 			}
1410 1410
 
1411
-			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1411
+			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) {
1412 1412
 				return;
1413 1413
 			}
1414 1414
 
1415 1415
 			$defaults = array(
1416
-				'name'               => '',      // String.
1417
-				'slug'               => '',      // String.
1418
-				'source'             => 'repo',  // String.
1419
-				'required'           => false,   // Boolean.
1420
-				'version'            => '',      // String.
1421
-				'force_activation'   => false,   // Boolean.
1422
-				'force_deactivation' => false,   // Boolean.
1423
-				'external_url'       => '',      // String.
1424
-				'is_callable'        => '',      // String or array.
1416
+				'name'               => '', // String.
1417
+				'slug'               => '', // String.
1418
+				'source'             => 'repo', // String.
1419
+				'required'           => false, // Boolean.
1420
+				'version'            => '', // String.
1421
+				'force_activation'   => false, // Boolean.
1422
+				'force_deactivation' => false, // Boolean.
1423
+				'external_url'       => '', // String.
1424
+				'is_callable'        => '', // String or array.
1425 1425
 			);
1426 1426
 
1427 1427
 			// Prepare the received data.
@@ -1442,8 +1442,8 @@  discard block
 block discarded – undo
1442 1442
 			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1443 1443
 
1444 1444
 			// Set the class properties.
1445
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1446
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1445
+			$this->plugins[$plugin['slug']]    = $plugin;
1446
+			$this->sort_order[$plugin['slug']] = $plugin['name'];
1447 1447
 
1448 1448
 			// Should we add the force activation hook ?
1449 1449
 			if ( true === $plugin['force_activation'] ) {
@@ -1527,11 +1527,11 @@  discard block
 block discarded – undo
1527 1527
 			);
1528 1528
 
1529 1529
 			foreach ( $keys as $key ) {
1530
-				if ( isset( $config[ $key ] ) ) {
1531
-					if ( is_array( $config[ $key ] ) ) {
1532
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1530
+				if ( isset( $config[$key] ) ) {
1531
+					if ( is_array( $config[$key] ) ) {
1532
+						$this->$key = array_merge( $this->$key, $config[$key] );
1533 1533
 					} else {
1534
-						$this->$key = $config[ $key ];
1534
+						$this->$key = $config[$key];
1535 1535
 					}
1536 1536
 				}
1537 1537
 			}
@@ -1576,12 +1576,12 @@  discard block
 block discarded – undo
1576 1576
 		 *                            Parameter added in v2.5.0.
1577 1577
 		 */
1578 1578
 		public function populate_file_path( $plugin_slug = '' ) {
1579
-			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1580
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1579
+			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) {
1580
+				$this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1581 1581
 			} else {
1582 1582
 				// Add file_path key for all plugins.
1583 1583
 				foreach ( $this->plugins as $slug => $values ) {
1584
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1584
+					$this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1585 1585
 				}
1586 1586
 			}
1587 1587
 		}
@@ -1621,8 +1621,8 @@  discard block
 block discarded – undo
1621 1621
 		 */
1622 1622
 		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1623 1623
 			foreach ( $this->plugins as $values ) {
1624
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1625
-					return $values[ $data ];
1624
+				if ( $name === $values['name'] && isset( $values[$data] ) ) {
1625
+					return $values[$data];
1626 1626
 				}
1627 1627
 			}
1628 1628
 
@@ -1640,13 +1640,13 @@  discard block
 block discarded – undo
1640 1640
 		public function get_download_url( $slug ) {
1641 1641
 			$dl_source = '';
1642 1642
 
1643
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1643
+			switch ( $this->plugins[$slug]['source_type'] ) {
1644 1644
 				case 'repo':
1645 1645
 					return $this->get_wp_repo_download_url( $slug );
1646 1646
 				case 'external':
1647
-					return $this->plugins[ $slug ]['source'];
1647
+					return $this->plugins[$slug]['source'];
1648 1648
 				case 'bundled':
1649
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1649
+					return $this->default_path . $this->plugins[$slug]['source'];
1650 1650
 			}
1651 1651
 
1652 1652
 			return $dl_source; // Should never happen.
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 		protected function get_plugins_api( $slug ) {
1683 1683
 			static $api = array(); // Cache received responses.
1684 1684
 
1685
-			if ( ! isset( $api[ $slug ] ) ) {
1685
+			if ( ! isset( $api[$slug] ) ) {
1686 1686
 				if ( ! function_exists( 'plugins_api' ) ) {
1687 1687
 					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1688 1688
 				}
@@ -1697,16 +1697,16 @@  discard block
 block discarded – undo
1697 1697
 					)
1698 1698
 				);
1699 1699
 
1700
-				$api[ $slug ] = false;
1700
+				$api[$slug] = false;
1701 1701
 
1702 1702
 				if ( is_wp_error( $response ) ) {
1703 1703
 					wp_die( esc_html( $this->strings['oops'] ) );
1704 1704
 				} else {
1705
-					$api[ $slug ] = $response;
1705
+					$api[$slug] = $response;
1706 1706
 				}
1707 1707
 			}
1708 1708
 
1709
-			return $api[ $slug ];
1709
+			return $api[$slug];
1710 1710
 		}
1711 1711
 
1712 1712
 		/**
@@ -1719,13 +1719,13 @@  discard block
 block discarded – undo
1719 1719
 		 *                or the plugin name if not.
1720 1720
 		 */
1721 1721
 		public function get_info_link( $slug ) {
1722
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1722
+			if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) {
1723 1723
 				$link = sprintf(
1724 1724
 					'<a href="%1$s" target="_blank">%2$s</a>',
1725
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1726
-					esc_html( $this->plugins[ $slug ]['name'] )
1725
+					esc_url( $this->plugins[$slug]['external_url'] ),
1726
+					esc_html( $this->plugins[$slug]['name'] )
1727 1727
 				);
1728
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1728
+			} elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) {
1729 1729
 				$url = add_query_arg(
1730 1730
 					array(
1731 1731
 						'tab'       => 'plugin-information',
@@ -1740,10 +1740,10 @@  discard block
 block discarded – undo
1740 1740
 				$link = sprintf(
1741 1741
 					'<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>',
1742 1742
 					esc_url( $url ),
1743
-					esc_html( $this->plugins[ $slug ]['name'] )
1743
+					esc_html( $this->plugins[$slug]['name'] )
1744 1744
 				);
1745 1745
 			} else {
1746
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1746
+				$link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink.
1747 1747
 			}
1748 1748
 
1749 1749
 			return $link;
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 		public function is_plugin_installed( $slug ) {
1869 1869
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1870 1870
 
1871
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1871
+			return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) );
1872 1872
 		}
1873 1873
 
1874 1874
 		/**
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
 		 * @return bool True if active, false otherwise.
1881 1881
 		 */
1882 1882
 		public function is_plugin_active( $slug ) {
1883
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1883
+			return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) );
1884 1884
 		}
1885 1885
 
1886 1886
 		/**
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 		 */
1895 1895
 		public function can_plugin_update( $slug ) {
1896 1896
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1897
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1897
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1898 1898
 				return true;
1899 1899
 			}
1900 1900
 
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 		public function get_installed_version( $slug ) {
1951 1951
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1952 1952
 
1953
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1954
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1953
+			if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) {
1954
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1955 1955
 			}
1956 1956
 
1957 1957
 			return '';
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 		 */
1968 1968
 		public function does_plugin_require_update( $slug ) {
1969 1969
 			$installed_version = $this->get_installed_version( $slug );
1970
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1970
+			$minimum_version   = $this->plugins[$slug]['version'];
1971 1971
 
1972 1972
 			return version_compare( $minimum_version, $installed_version, '>' );
1973 1973
 		}
@@ -1982,9 +1982,9 @@  discard block
 block discarded – undo
1982 1982
 		 */
1983 1983
 		public function does_plugin_have_update( $slug ) {
1984 1984
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1985
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1985
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1986 1986
 				if ( $this->does_plugin_require_update( $slug ) ) {
1987
-					return $this->plugins[ $slug ]['version'];
1987
+					return $this->plugins[$slug]['version'];
1988 1988
 				}
1989 1989
 
1990 1990
 				return false;
@@ -1992,8 +1992,8 @@  discard block
 block discarded – undo
1992 1992
 
1993 1993
 			$repo_updates = get_site_transient( 'update_plugins' );
1994 1994
 
1995
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1996
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1995
+			if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) {
1996
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1997 1997
 			}
1998 1998
 
1999 1999
 			return false;
@@ -2009,14 +2009,14 @@  discard block
 block discarded – undo
2009 2009
 		 */
2010 2010
 		public function get_upgrade_notice( $slug ) {
2011 2011
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
2012
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
2012
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
2013 2013
 				return '';
2014 2014
 			}
2015 2015
 
2016 2016
 			$repo_updates = get_site_transient( 'update_plugins' );
2017 2017
 
2018
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
2019
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
2018
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
2019
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
2020 2020
 			}
2021 2021
 
2022 2022
 			return '';
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 				 */
2101 2101
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2102 2102
 					deactivate_plugins( $plugin['file_path'] );
2103
-					$deactivated[ $plugin['file_path'] ] = time();
2103
+					$deactivated[$plugin['file_path']] = time();
2104 2104
 				}
2105 2105
 			}
2106 2106
 
@@ -2337,30 +2337,30 @@  discard block
 block discarded – undo
2337 2337
 			$i          = 0;
2338 2338
 
2339 2339
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2340
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2340
+			if ( empty( $plugins[$this->view_context] ) ) {
2341 2341
 				$this->view_context = 'all';
2342 2342
 			}
2343 2343
 
2344
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2345
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2346
-				$table_data[ $i ]['slug']              = $slug;
2347
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2348
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2349
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2350
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2351
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2352
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2353
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2344
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2345
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2346
+				$table_data[$i]['slug']              = $slug;
2347
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2348
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2349
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2350
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2351
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2352
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2353
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2354 2354
 
2355 2355
 				// Prep the upgrade notice info.
2356 2356
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2357 2357
 				if ( ! empty( $upgrade_notice ) ) {
2358
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2358
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2359 2359
 
2360 2360
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2361 2361
 				}
2362 2362
 
2363
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2363
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2364 2364
 
2365 2365
 				$i++;
2366 2366
 			}
@@ -2386,17 +2386,17 @@  discard block
 block discarded – undo
2386 2386
 					// No need to display plugins if they are installed, up-to-date and active.
2387 2387
 					continue;
2388 2388
 				} else {
2389
-					$plugins['all'][ $slug ] = $plugin;
2389
+					$plugins['all'][$slug] = $plugin;
2390 2390
 
2391 2391
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2392
-						$plugins['install'][ $slug ] = $plugin;
2392
+						$plugins['install'][$slug] = $plugin;
2393 2393
 					} else {
2394 2394
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2395
-							$plugins['update'][ $slug ] = $plugin;
2395
+							$plugins['update'][$slug] = $plugin;
2396 2396
 						}
2397 2397
 
2398 2398
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2399
-							$plugins['activate'][ $slug ] = $plugin;
2399
+							$plugins['activate'][$slug] = $plugin;
2400 2400
 						}
2401 2401
 					}
2402 2402
 				}
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 		 */
2415 2415
 		protected function set_view_totals( $plugins ) {
2416 2416
 			foreach ( $plugins as $type => $list ) {
2417
-				$this->view_totals[ $type ] = count( $list );
2417
+				$this->view_totals[$type] = count( $list );
2418 2418
 			}
2419 2419
 		}
2420 2420
 
@@ -2516,8 +2516,8 @@  discard block
 block discarded – undo
2516 2516
 			$name = array();
2517 2517
 
2518 2518
 			foreach ( $items as $i => $plugin ) {
2519
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2520
-				$name[ $i ] = $plugin['sanitized_plugin'];
2519
+				$type[$i] = $plugin['type']; // Required / recommended.
2520
+				$name[$i] = $plugin['sanitized_plugin'];
2521 2521
 			}
2522 2522
 
2523 2523
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2564,7 +2564,7 @@  discard block
 block discarded – undo
2564 2564
 
2565 2565
 				if ( ! empty( $text ) ) {
2566 2566
 
2567
-					$status_links[ $type ] = sprintf(
2567
+					$status_links[$type] = sprintf(
2568 2568
 						'<a href="%s"%s>%s</a>',
2569 2569
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2570 2570
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
 		 * @return string
2588 2588
 		 */
2589 2589
 		public function column_default( $item, $column_name ) {
2590
-			return $item[ $column_name ];
2590
+			return $item[$column_name];
2591 2591
 		}
2592 2592
 
2593 2593
 		/**
@@ -2824,7 +2824,7 @@  discard block
 block discarded – undo
2824 2824
 					$class = 'class="activate-now" ';
2825 2825
 				}
2826 2826
 
2827
-				$action_links[ $action ] = sprintf(
2827
+				$action_links[$action] = sprintf(
2828 2828
 					'<a ' . $class . 'href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
2829 2829
 					esc_url( $nonce_url ),
2830 2830
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -2975,19 +2975,19 @@  discard block
 block discarded – undo
2975 2975
 				// Validate the received input.
2976 2976
 				foreach ( $plugins_to_install as $key => $slug ) {
2977 2977
 					// Check if the plugin was registered with TGMPA and remove if not.
2978
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2979
-						unset( $plugins_to_install[ $key ] );
2978
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
2979
+						unset( $plugins_to_install[$key] );
2980 2980
 						continue;
2981 2981
 					}
2982 2982
 
2983 2983
 					// For install: make sure this is a plugin we *can* install and not one already installed.
2984 2984
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
2985
-						unset( $plugins_to_install[ $key ] );
2985
+						unset( $plugins_to_install[$key] );
2986 2986
 					}
2987 2987
 
2988 2988
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2989 2989
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
2990
-						unset( $plugins_to_install[ $key ] );
2990
+						unset( $plugins_to_install[$key] );
2991 2991
 					}
2992 2992
 				}
2993 2993
 
@@ -3039,7 +3039,7 @@  discard block
 block discarded – undo
3039 3039
 
3040 3040
 				// Prepare the data for validated plugins for the install/upgrade.
3041 3041
 				foreach ( $plugins_to_install as $slug ) {
3042
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
3042
+					$name   = $this->tgmpa->plugins[$slug]['name'];
3043 3043
 					$source = $this->tgmpa->get_download_url( $slug );
3044 3044
 
3045 3045
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -3052,9 +3052,9 @@  discard block
 block discarded – undo
3052 3052
 								break;
3053 3053
 
3054 3054
 							case 'update':
3055
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
3056
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
3057
-								$to_inject[ $slug ]['source'] = $source;
3055
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
3056
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
3057
+								$to_inject[$slug]['source'] = $source;
3058 3058
 								break;
3059 3059
 						}
3060 3060
 					}
@@ -3121,8 +3121,8 @@  discard block
 block discarded – undo
3121 3121
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3122 3122
 				foreach ( $plugins as $slug ) {
3123 3123
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3124
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3125
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3124
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3125
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3126 3126
 					}
3127 3127
 				}
3128 3128
 				unset( $slug );
@@ -3155,8 +3155,8 @@  discard block
 block discarded – undo
3155 3155
 					// Update recently activated plugins option.
3156 3156
 					$recent = (array) get_option( 'recently_activated' );
3157 3157
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3158
-						if ( isset( $recent[ $plugin ] ) ) {
3159
-							unset( $recent[ $plugin ] );
3158
+						if ( isset( $recent[$plugin] ) ) {
3159
+							unset( $recent[$plugin] );
3160 3160
 						}
3161 3161
 					}
3162 3162
 					update_option( 'recently_activated', $recent );
@@ -3487,7 +3487,7 @@  discard block
 block discarded – undo
3487 3487
 								)
3488 3488
 							);
3489 3489
 
3490
-							$results[ $plugin ] = $this->result;
3490
+							$results[$plugin] = $this->result;
3491 3491
 
3492 3492
 							// Prevent credentials auth screen from displaying multiple times.
3493 3493
 							if ( false === $result ) {
@@ -3678,7 +3678,7 @@  discard block
 block discarded – undo
3678 3678
 							'names'        => array(),
3679 3679
 							'install_type' => 'install',
3680 3680
 						);
3681
-						$args     = wp_parse_args( $args, $defaults );
3681
+						$args = wp_parse_args( $args, $defaults );
3682 3682
 
3683 3683
 						// Set plugin names to $this->plugin_names property.
3684 3684
 						$this->plugin_names = $args['names'];
@@ -3740,7 +3740,7 @@  discard block
 block discarded – undo
3740 3740
 					 */
3741 3741
 					public function before( $title = '' ) {
3742 3742
 						if ( empty( $title ) ) {
3743
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3743
+							$title = esc_html( $this->plugin_names[$this->i] );
3744 3744
 						}
3745 3745
 						parent::before( $title );
3746 3746
 					}
@@ -3757,7 +3757,7 @@  discard block
 block discarded – undo
3757 3757
 					 */
3758 3758
 					public function after( $title = '' ) {
3759 3759
 						if ( empty( $title ) ) {
3760
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3760
+							$title = esc_html( $this->plugin_names[$this->i] );
3761 3761
 						}
3762 3762
 						parent::after( $title );
3763 3763
 
@@ -3930,7 +3930,7 @@  discard block
 block discarded – undo
3930 3930
 		 */
3931 3931
 		protected static function emulate_filter_bool( $value ) {
3932 3932
 			// phpcs:disable WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
3933
-			static $true  = array(
3933
+			static $true = array(
3934 3934
 				'1',
3935 3935
 				'true', 'True', 'TRUE',
3936 3936
 				'y', 'Y',
Please login to merge, or discard this patch.