Completed
Pull Request — develop (#571)
by Juliette
02:19
created
class-tgm-plugin-activation.php 2 patches
Spacing   +117 added lines, -117 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 '';
@@ -2255,30 +2255,30 @@  discard block
 block discarded – undo
2255 2255
 			$i          = 0;
2256 2256
 
2257 2257
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2258
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2258
+			if ( empty( $plugins[$this->view_context] ) ) {
2259 2259
 				$this->view_context = 'all';
2260 2260
 			}
2261 2261
 
2262
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2263
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2264
-				$table_data[ $i ]['slug']              = $slug;
2265
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2266
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2267
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2268
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2269
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2270
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2271
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2262
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2263
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2264
+				$table_data[$i]['slug']              = $slug;
2265
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2266
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2267
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2268
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2269
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2270
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2271
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2272 2272
 
2273 2273
 				// Prep the upgrade notice info.
2274 2274
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2275 2275
 				if ( ! empty( $upgrade_notice ) ) {
2276
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2276
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2277 2277
 
2278 2278
 					add_action( "tgmpa_after_plugin_row_$slug", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2279 2279
 				}
2280 2280
 
2281
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2281
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2282 2282
 
2283 2283
 				$i++;
2284 2284
 			}
@@ -2304,17 +2304,17 @@  discard block
 block discarded – undo
2304 2304
 					// No need to display plugins if they are installed, up-to-date and active.
2305 2305
 					continue;
2306 2306
 				} else {
2307
-					$plugins['all'][ $slug ] = $plugin;
2307
+					$plugins['all'][$slug] = $plugin;
2308 2308
 
2309 2309
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2310
-						$plugins['install'][ $slug ] = $plugin;
2310
+						$plugins['install'][$slug] = $plugin;
2311 2311
 					} else {
2312 2312
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2313
-							$plugins['update'][ $slug ] = $plugin;
2313
+							$plugins['update'][$slug] = $plugin;
2314 2314
 						}
2315 2315
 
2316 2316
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2317
-							$plugins['activate'][ $slug ] = $plugin;
2317
+							$plugins['activate'][$slug] = $plugin;
2318 2318
 						}
2319 2319
 					}
2320 2320
 				}
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
 		 */
2333 2333
 		protected function set_view_totals( $plugins ) {
2334 2334
 			foreach ( $plugins as $type => $list ) {
2335
-				$this->view_totals[ $type ] = count( $list );
2335
+				$this->view_totals[$type] = count( $list );
2336 2336
 			}
2337 2337
 		}
2338 2338
 
@@ -2434,8 +2434,8 @@  discard block
 block discarded – undo
2434 2434
 			$name = array();
2435 2435
 
2436 2436
 			foreach ( $items as $i => $plugin ) {
2437
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2438
-				$name[ $i ] = $plugin['sanitized_plugin'];
2437
+				$type[$i] = $plugin['type']; // Required / recommended.
2438
+				$name[$i] = $plugin['sanitized_plugin'];
2439 2439
 			}
2440 2440
 
2441 2441
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
 
2483 2483
 				if ( ! empty( $text ) ) {
2484 2484
 
2485
-					$status_links[ $type ] = sprintf(
2485
+					$status_links[$type] = sprintf(
2486 2486
 						'<a href="%s"%s>%s</a>',
2487 2487
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2488 2488
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
 		 * @return string
2506 2506
 		 */
2507 2507
 		public function column_default( $item, $column_name ) {
2508
-			return $item[ $column_name ];
2508
+			return $item[$column_name];
2509 2509
 		}
2510 2510
 
2511 2511
 		/**
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 					'tgmpa-nonce'
2706 2706
 				);
2707 2707
 
2708
-				$action_links[ $action ] = sprintf(
2708
+				$action_links[$action] = sprintf(
2709 2709
 					'<a href="%1$s">' . esc_html( $text ) . '</a>',
2710 2710
 					esc_url( $nonce_url ),
2711 2711
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -2854,19 +2854,19 @@  discard block
 block discarded – undo
2854 2854
 				// Validate the received input.
2855 2855
 				foreach ( $plugins_to_install as $key => $slug ) {
2856 2856
 					// Check if the plugin was registered with TGMPA and remove if not.
2857
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2858
-						unset( $plugins_to_install[ $key ] );
2857
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
2858
+						unset( $plugins_to_install[$key] );
2859 2859
 						continue;
2860 2860
 					}
2861 2861
 
2862 2862
 					// For install: make sure this is a plugin we *can* install and not one already installed.
2863 2863
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
2864
-						unset( $plugins_to_install[ $key ] );
2864
+						unset( $plugins_to_install[$key] );
2865 2865
 					}
2866 2866
 
2867 2867
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2868 2868
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
2869
-						unset( $plugins_to_install[ $key ] );
2869
+						unset( $plugins_to_install[$key] );
2870 2870
 					}
2871 2871
 				}
2872 2872
 
@@ -2917,7 +2917,7 @@  discard block
 block discarded – undo
2917 2917
 
2918 2918
 				// Prepare the data for validated plugins for the install/upgrade.
2919 2919
 				foreach ( $plugins_to_install as $slug ) {
2920
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
2920
+					$name   = $this->tgmpa->plugins[$slug]['name'];
2921 2921
 					$source = $this->tgmpa->get_download_url( $slug );
2922 2922
 
2923 2923
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -2930,9 +2930,9 @@  discard block
 block discarded – undo
2930 2930
 								break;
2931 2931
 
2932 2932
 							case 'update':
2933
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
2934
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
2935
-								$to_inject[ $slug ]['source'] = $source;
2933
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
2934
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
2935
+								$to_inject[$slug]['source'] = $source;
2936 2936
 								break;
2937 2937
 						}
2938 2938
 					}
@@ -2999,8 +2999,8 @@  discard block
 block discarded – undo
2999 2999
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3000 3000
 				foreach ( $plugins as $slug ) {
3001 3001
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3002
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3003
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3002
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3003
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3004 3004
 					}
3005 3005
 				}
3006 3006
 				unset( $slug );
@@ -3032,8 +3032,8 @@  discard block
 block discarded – undo
3032 3032
 					// Update recently activated plugins option.
3033 3033
 					$recent = (array) get_option( 'recently_activated' );
3034 3034
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3035
-						if ( isset( $recent[ $plugin ] ) ) {
3036
-							unset( $recent[ $plugin ] );
3035
+						if ( isset( $recent[$plugin] ) ) {
3036
+							unset( $recent[$plugin] );
3037 3037
 						}
3038 3038
 					}
3039 3039
 					update_option( 'recently_activated', $recent );
@@ -3354,7 +3354,7 @@  discard block
 block discarded – undo
3354 3354
 								)
3355 3355
 							);
3356 3356
 
3357
-							$results[ $plugin ] = $this->result;
3357
+							$results[$plugin] = $this->result;
3358 3358
 
3359 3359
 							// Prevent credentials auth screen from displaying multiple times.
3360 3360
 							if ( false === $result ) {
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 							'names'        => array(),
3541 3541
 							'install_type' => 'install',
3542 3542
 						);
3543
-						$args     = wp_parse_args( $args, $defaults );
3543
+						$args = wp_parse_args( $args, $defaults );
3544 3544
 
3545 3545
 						// Set plugin names to $this->plugin_names property.
3546 3546
 						$this->plugin_names = $args['names'];
@@ -3597,7 +3597,7 @@  discard block
 block discarded – undo
3597 3597
 					 */
3598 3598
 					public function before( $title = '' ) {
3599 3599
 						if ( empty( $title ) ) {
3600
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3600
+							$title = esc_html( $this->plugin_names[$this->i] );
3601 3601
 						}
3602 3602
 						parent::before( $title );
3603 3603
 					}
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 					 */
3615 3615
 					public function after( $title = '' ) {
3616 3616
 						if ( empty( $title ) ) {
3617
-							$title = esc_html( $this->plugin_names[ $this->i ] );
3617
+							$title = esc_html( $this->plugin_names[$this->i] );
3618 3618
 						}
3619 3619
 						parent::after( $title );
3620 3620
 
@@ -3787,7 +3787,7 @@  discard block
 block discarded – undo
3787 3787
 		 */
3788 3788
 		protected static function emulate_filter_bool( $value ) {
3789 3789
 			// @codingStandardsIgnoreStart
3790
-			static $true  = array(
3790
+			static $true = array(
3791 3791
 				'1',
3792 3792
 				'true', 'True', 'TRUE',
3793 3793
 				'y', 'Y',
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2226,7 +2226,7 @@
 block discarded – undo
2226 2226
 		 *
2227 2227
 		 * @since 2.5.0
2228 2228
 		 *
2229
-		 * @return array CSS classnames.
2229
+		 * @return string[] CSS classnames.
2230 2230
 		 */
2231 2231
 		public function get_table_classes() {
2232 2232
 			return array( 'widefat', 'fixed' );
Please login to merge, or discard this patch.