Completed
Pull Request — develop (#822)
by
unknown
23s
created
example.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -121,16 +121,16 @@
 block discarded – undo
121 121
 	 * Only uncomment the strings in the config array if you want to customize the strings.
122 122
 	 */
123 123
 	$config = array(
124
-		'id'           => 'tgmpa',                 // Unique ID for hashing notices for multiple instances of TGMPA.
125
-		'default_path' => '',                      // Default absolute path to bundled plugins.
124
+		'id'           => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
125
+		'default_path' => '', // Default absolute path to bundled plugins.
126 126
 		'menu'         => 'tgmpa-install-plugins', // Menu slug.
127
-		'parent_slug'  => 'themes.php',            // Parent menu slug.
128
-		'capability'   => 'edit_theme_options',    // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
129
-		'has_notices'  => true,                    // Show admin notices or not.
130
-		'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
131
-		'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
132
-		'is_automatic' => false,                   // Automatically activate plugins after installation or not.
133
-		'message'      => '',                      // Message to output right before the plugins table.
127
+		'parent_slug'  => 'themes.php', // Parent menu slug.
128
+		'capability'   => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
129
+		'has_notices'  => true, // Show admin notices or not.
130
+		'dismissable'  => true, // If false, a user cannot dismiss the nag message.
131
+		'dismiss_msg'  => '', // If 'dismissable' is false, this message will be output at top of nag.
132
+		'is_automatic' => false, // Automatically activate plugins after installation or not.
133
+		'message'      => '', // Message to output right before the plugins table.
134 134
 
135 135
 		/*
136 136
 		'strings'      => array(
Please login to merge, or discard this patch.
class-tgm-plugin-activation.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1768,10 +1768,12 @@
 block discarded – undo
1768 1768
 			if ( 'update-core' === $screen->base ) {
1769 1769
 				// Core update screen.
1770 1770
 				return true;
1771
-			} elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1771
+			} elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) {
1772
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1772 1773
 				// Plugins bulk update screen.
1773 1774
 				return true;
1774
-			} elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1775
+			} elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) {
1776
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1775 1777
 				// Individual updates (ajax call).
1776 1778
 				return true;
1777 1779
 			}
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -709,11 +709,11 @@  discard block
 block discarded – undo
709 709
 			$args = apply_filters(
710 710
 				'tgmpa_admin_menu_args',
711 711
 				array(
712
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
713
-					'page_title'  => $this->strings['page_title'],           // Page title.
714
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
715
-					'capability'  => $this->capability,                      // Capability.
716
-					'menu_slug'   => $this->menu,                            // Menu slug.
712
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
713
+					'page_title'  => $this->strings['page_title'], // Page title.
714
+					'menu_title'  => $this->strings['menu_title'], // Menu title.
715
+					'capability'  => $this->capability, // Capability.
716
+					'menu_slug'   => $this->menu, // Menu slug.
717 717
 					'function'    => array( $this, 'install_plugins_page' ), // Callback.
718 718
 				)
719 719
 			);
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 			// All plugin information will be stored in an array for processing.
816 816
 			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
817 817
 
818
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
818
+			if ( ! isset( $this->plugins[$slug] ) ) {
819 819
 				return false;
820 820
 			}
821 821
 
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 				$extra         = array();
861 861
 				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
862 862
 				$source        = $this->get_download_url( $slug );
863
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
863
+				$api           = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
864 864
 				$api           = ( false !== $api ) ? $api : null;
865 865
 
866 866
 				$url = add_query_arg(
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 
878 878
 				$title     = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
879 879
 				$skin_args = array(
880
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
881
-					'title'  => sprintf( $title, $this->plugins[ $slug ]['name'] ),
880
+					'type'   => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload',
881
+					'title'  => sprintf( $title, $this->plugins[$slug]['name'] ),
882 882
 					'url'    => esc_url_raw( $url ),
883 883
 					'nonce'  => $install_type . '-plugin_' . $slug,
884 884
 					'plugin' => '',
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 				unset( $title );
889 889
 
890 890
 				if ( 'update' === $install_type ) {
891
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
891
+					$skin_args['plugin'] = $this->plugins[$slug]['file_path'];
892 892
 					$skin                = new Plugin_Upgrader_Skin( $skin_args );
893 893
 				} else {
894 894
 					$skin = new Plugin_Installer_Skin( $skin_args );
@@ -903,12 +903,12 @@  discard block
 block discarded – undo
903 903
 				if ( 'update' === $install_type ) {
904 904
 					// Inject our info into the update transient.
905 905
 					$to_inject                    = array(
906
-						$slug => $this->plugins[ $slug ],
906
+						$slug => $this->plugins[$slug],
907 907
 					);
908
-					$to_inject[ $slug ]['source'] = $source;
908
+					$to_inject[$slug]['source'] = $source;
909 909
 					$this->inject_update_info( $to_inject );
910 910
 
911
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
911
+					$upgrader->upgrade( $this->plugins[$slug]['file_path'] );
912 912
 				} else {
913 913
 					$upgrader->install( $source );
914 914
 				}
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 				}
939 939
 
940 940
 				return true;
941
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
941
+			} elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
942 942
 				// Activate action link was clicked.
943 943
 				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
944 944
 
945
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
945
+				if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) {
946 946
 					return true; // Finish execution of the function early as we encountered an error.
947 947
 				}
948 948
 			}
@@ -967,17 +967,17 @@  discard block
 block discarded – undo
967 967
 			foreach ( $plugins as $slug => $plugin ) {
968 968
 				$file_path = $plugin['file_path'];
969 969
 
970
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
971
-					$repo_updates->response[ $file_path ] = new stdClass();
970
+				if ( empty( $repo_updates->response[$file_path] ) ) {
971
+					$repo_updates->response[$file_path] = new stdClass();
972 972
 				}
973 973
 
974 974
 				// We only really need to set package, but let's do all we can in case WP changes something.
975
-				$repo_updates->response[ $file_path ]->slug        = $slug;
976
-				$repo_updates->response[ $file_path ]->plugin      = $file_path;
977
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
978
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
979
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
980
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
975
+				$repo_updates->response[$file_path]->slug        = $slug;
976
+				$repo_updates->response[$file_path]->plugin      = $file_path;
977
+				$repo_updates->response[$file_path]->new_version = $plugin['version'];
978
+				$repo_updates->response[$file_path]->package     = $plugin['source'];
979
+				if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) {
980
+					$repo_updates->response[$file_path]->url = $plugin['external_url'];
981 981
 				}
982 982
 			}
983 983
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 			} else {
1021 1021
 				// Bulk installer contains less info, so fall back on the info registered here.
1022 1022
 				foreach ( $this->plugins as $slug => $plugin ) {
1023
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
1023
+					if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) {
1024 1024
 						$desired_slug = $slug;
1025 1025
 						break;
1026 1026
 					}
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 						// immediately after a single activation.
1088 1088
 						// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Not using the superglobal.
1089 1089
 					if ( ! isset( $_POST['action'] ) ) {
1090
-						echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
1090
+						echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>';
1091 1091
 					}
1092 1092
 				} else {
1093 1093
 					// Simpler message layout for use on the plugin install page.
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 				echo '<div id="message" class="error"><p>',
1100 1100
 					sprintf(
1101 1101
 						esc_html( $this->strings['plugin_already_active'] ),
1102
-						'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1102
+						'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1103 1103
 					),
1104 1104
 					'</p></div>';
1105 1105
 			} elseif ( $this->does_plugin_require_update( $slug ) ) {
@@ -1111,13 +1111,13 @@  discard block
 block discarded – undo
1111 1111
 						echo '<div id="message" class="error"><p>',
1112 1112
 							sprintf(
1113 1113
 								esc_html( $this->strings['plugin_needs_higher_version'] ),
1114
-								'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
1114
+								'<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>'
1115 1115
 							),
1116 1116
 							'</p></div>';
1117 1117
 					}
1118 1118
 				} else {
1119 1119
 					// Simpler message layout for use on the plugin install page.
1120
-					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
1120
+					echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>';
1121 1121
 				}
1122 1122
 			}
1123 1123
 
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 						$rendered .= sprintf(
1245 1245
 							$line_template,
1246 1246
 							sprintf(
1247
-								translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ),
1247
+								translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ),
1248 1248
 								$imploded,
1249 1249
 								$count
1250 1250
 							)
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
 			foreach ( (array) $wp_settings_errors as $key => $details ) {
1361 1361
 				if ( 'tgmpa' === $details['setting'] ) {
1362
-					unset( $wp_settings_errors[ $key ] );
1362
+					unset( $wp_settings_errors[$key] );
1363 1363
 					break;
1364 1364
 				}
1365 1365
 			}
@@ -1395,20 +1395,20 @@  discard block
 block discarded – undo
1395 1395
 				return;
1396 1396
 			}
1397 1397
 
1398
-			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
1398
+			if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) {
1399 1399
 				return;
1400 1400
 			}
1401 1401
 
1402 1402
 			$defaults = array(
1403
-				'name'               => '',      // String.
1404
-				'slug'               => '',      // String.
1405
-				'source'             => 'repo',  // String.
1406
-				'required'           => false,   // Boolean.
1407
-				'version'            => '',      // String.
1408
-				'force_activation'   => false,   // Boolean.
1409
-				'force_deactivation' => false,   // Boolean.
1410
-				'external_url'       => '',      // String.
1411
-				'is_callable'        => '',      // String or array.
1403
+				'name'               => '', // String.
1404
+				'slug'               => '', // String.
1405
+				'source'             => 'repo', // String.
1406
+				'required'           => false, // Boolean.
1407
+				'version'            => '', // String.
1408
+				'force_activation'   => false, // Boolean.
1409
+				'force_deactivation' => false, // Boolean.
1410
+				'external_url'       => '', // String.
1411
+				'is_callable'        => '', // String or array.
1412 1412
 			);
1413 1413
 
1414 1414
 			// Prepare the received data.
@@ -1429,8 +1429,8 @@  discard block
 block discarded – undo
1429 1429
 			$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
1430 1430
 
1431 1431
 			// Set the class properties.
1432
-			$this->plugins[ $plugin['slug'] ]    = $plugin;
1433
-			$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
1432
+			$this->plugins[$plugin['slug']]    = $plugin;
1433
+			$this->sort_order[$plugin['slug']] = $plugin['name'];
1434 1434
 
1435 1435
 			// Should we add the force activation hook ?
1436 1436
 			if ( true === $plugin['force_activation'] ) {
@@ -1514,11 +1514,11 @@  discard block
 block discarded – undo
1514 1514
 			);
1515 1515
 
1516 1516
 			foreach ( $keys as $key ) {
1517
-				if ( isset( $config[ $key ] ) ) {
1518
-					if ( is_array( $config[ $key ] ) ) {
1519
-						$this->$key = array_merge( $this->$key, $config[ $key ] );
1517
+				if ( isset( $config[$key] ) ) {
1518
+					if ( is_array( $config[$key] ) ) {
1519
+						$this->$key = array_merge( $this->$key, $config[$key] );
1520 1520
 					} else {
1521
-						$this->$key = $config[ $key ];
1521
+						$this->$key = $config[$key];
1522 1522
 					}
1523 1523
 				}
1524 1524
 			}
@@ -1563,12 +1563,12 @@  discard block
 block discarded – undo
1563 1563
 		 *                            Parameter added in v2.5.0.
1564 1564
 		 */
1565 1565
 		public function populate_file_path( $plugin_slug = '' ) {
1566
-			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
1567
-				$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1566
+			if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) {
1567
+				$this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
1568 1568
 			} else {
1569 1569
 				// Add file_path key for all plugins.
1570 1570
 				foreach ( $this->plugins as $slug => $values ) {
1571
-					$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1571
+					$this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
1572 1572
 				}
1573 1573
 			}
1574 1574
 		}
@@ -1608,8 +1608,8 @@  discard block
 block discarded – undo
1608 1608
 		 */
1609 1609
 		public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
1610 1610
 			foreach ( $this->plugins as $values ) {
1611
-				if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
1612
-					return $values[ $data ];
1611
+				if ( $name === $values['name'] && isset( $values[$data] ) ) {
1612
+					return $values[$data];
1613 1613
 				}
1614 1614
 			}
1615 1615
 
@@ -1627,13 +1627,13 @@  discard block
 block discarded – undo
1627 1627
 		public function get_download_url( $slug ) {
1628 1628
 			$dl_source = '';
1629 1629
 
1630
-			switch ( $this->plugins[ $slug ]['source_type'] ) {
1630
+			switch ( $this->plugins[$slug]['source_type'] ) {
1631 1631
 				case 'repo':
1632 1632
 					return $this->get_wp_repo_download_url( $slug );
1633 1633
 				case 'external':
1634
-					return $this->plugins[ $slug ]['source'];
1634
+					return $this->plugins[$slug]['source'];
1635 1635
 				case 'bundled':
1636
-					return $this->default_path . $this->plugins[ $slug ]['source'];
1636
+					return $this->default_path . $this->plugins[$slug]['source'];
1637 1637
 			}
1638 1638
 
1639 1639
 			return $dl_source; // Should never happen.
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
 		protected function get_plugins_api( $slug ) {
1670 1670
 			static $api = array(); // Cache received responses.
1671 1671
 
1672
-			if ( ! isset( $api[ $slug ] ) ) {
1672
+			if ( ! isset( $api[$slug] ) ) {
1673 1673
 				if ( ! function_exists( 'plugins_api' ) ) {
1674 1674
 					require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1675 1675
 				}
@@ -1684,16 +1684,16 @@  discard block
 block discarded – undo
1684 1684
 					)
1685 1685
 				);
1686 1686
 
1687
-				$api[ $slug ] = false;
1687
+				$api[$slug] = false;
1688 1688
 
1689 1689
 				if ( is_wp_error( $response ) ) {
1690 1690
 					wp_die( esc_html( $this->strings['oops'] ) );
1691 1691
 				} else {
1692
-					$api[ $slug ] = $response;
1692
+					$api[$slug] = $response;
1693 1693
 				}
1694 1694
 			}
1695 1695
 
1696
-			return $api[ $slug ];
1696
+			return $api[$slug];
1697 1697
 		}
1698 1698
 
1699 1699
 		/**
@@ -1706,13 +1706,13 @@  discard block
 block discarded – undo
1706 1706
 		 *                or the plugin name if not.
1707 1707
 		 */
1708 1708
 		public function get_info_link( $slug ) {
1709
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1709
+			if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) {
1710 1710
 				$link = sprintf(
1711 1711
 					'<a href="%1$s" target="_blank">%2$s</a>',
1712
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1713
-					esc_html( $this->plugins[ $slug ]['name'] )
1712
+					esc_url( $this->plugins[$slug]['external_url'] ),
1713
+					esc_html( $this->plugins[$slug]['name'] )
1714 1714
 				);
1715
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1715
+			} elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) {
1716 1716
 				$url = add_query_arg(
1717 1717
 					array(
1718 1718
 						'tab'       => 'plugin-information',
@@ -1727,10 +1727,10 @@  discard block
 block discarded – undo
1727 1727
 				$link = sprintf(
1728 1728
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1729 1729
 					esc_url( $url ),
1730
-					esc_html( $this->plugins[ $slug ]['name'] )
1730
+					esc_html( $this->plugins[$slug]['name'] )
1731 1731
 				);
1732 1732
 			} else {
1733
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1733
+				$link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink.
1734 1734
 			}
1735 1735
 
1736 1736
 			return $link;
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 		public function is_plugin_installed( $slug ) {
1856 1856
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1857 1857
 
1858
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1858
+			return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) );
1859 1859
 		}
1860 1860
 
1861 1861
 		/**
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 		 * @return bool True if active, false otherwise.
1868 1868
 		 */
1869 1869
 		public function is_plugin_active( $slug ) {
1870
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1870
+			return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) );
1871 1871
 		}
1872 1872
 
1873 1873
 		/**
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 		 */
1882 1882
 		public function can_plugin_update( $slug ) {
1883 1883
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1884
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1884
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1885 1885
 				return true;
1886 1886
 			}
1887 1887
 
@@ -1937,8 +1937,8 @@  discard block
 block discarded – undo
1937 1937
 		public function get_installed_version( $slug ) {
1938 1938
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1939 1939
 
1940
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1941
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1940
+			if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) {
1941
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1942 1942
 			}
1943 1943
 
1944 1944
 			return '';
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 		 */
1955 1955
 		public function does_plugin_require_update( $slug ) {
1956 1956
 			$installed_version = $this->get_installed_version( $slug );
1957
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1957
+			$minimum_version   = $this->plugins[$slug]['version'];
1958 1958
 
1959 1959
 			return version_compare( $minimum_version, $installed_version, '>' );
1960 1960
 		}
@@ -1969,9 +1969,9 @@  discard block
 block discarded – undo
1969 1969
 		 */
1970 1970
 		public function does_plugin_have_update( $slug ) {
1971 1971
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1972
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1972
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1973 1973
 				if ( $this->does_plugin_require_update( $slug ) ) {
1974
-					return $this->plugins[ $slug ]['version'];
1974
+					return $this->plugins[$slug]['version'];
1975 1975
 				}
1976 1976
 
1977 1977
 				return false;
@@ -1979,8 +1979,8 @@  discard block
 block discarded – undo
1979 1979
 
1980 1980
 			$repo_updates = get_site_transient( 'update_plugins' );
1981 1981
 
1982
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1983
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1982
+			if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) {
1983
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1984 1984
 			}
1985 1985
 
1986 1986
 			return false;
@@ -1996,14 +1996,14 @@  discard block
 block discarded – undo
1996 1996
 		 */
1997 1997
 		public function get_upgrade_notice( $slug ) {
1998 1998
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1999
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1999
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
2000 2000
 				return '';
2001 2001
 			}
2002 2002
 
2003 2003
 			$repo_updates = get_site_transient( 'update_plugins' );
2004 2004
 
2005
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
2006
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
2005
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
2006
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
2007 2007
 			}
2008 2008
 
2009 2009
 			return '';
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 				 */
2088 2088
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2089 2089
 					deactivate_plugins( $plugin['file_path'] );
2090
-					$deactivated[ $plugin['file_path'] ] = time();
2090
+					$deactivated[$plugin['file_path']] = time();
2091 2091
 				}
2092 2092
 			}
2093 2093
 
@@ -2324,30 +2324,30 @@  discard block
 block discarded – undo
2324 2324
 			$i          = 0;
2325 2325
 
2326 2326
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
2327
-			if ( empty( $plugins[ $this->view_context ] ) ) {
2327
+			if ( empty( $plugins[$this->view_context] ) ) {
2328 2328
 				$this->view_context = 'all';
2329 2329
 			}
2330 2330
 
2331
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
2332
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
2333
-				$table_data[ $i ]['slug']              = $slug;
2334
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2335
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2336
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2337
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
2338
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2339
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
2340
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2331
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
2332
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
2333
+				$table_data[$i]['slug']              = $slug;
2334
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
2335
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
2336
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
2337
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
2338
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
2339
+				$table_data[$i]['minimum_version']   = $plugin['version'];
2340
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
2341 2341
 
2342 2342
 				// Prep the upgrade notice info.
2343 2343
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
2344 2344
 				if ( ! empty( $upgrade_notice ) ) {
2345
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
2345
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
2346 2346
 
2347 2347
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
2348 2348
 				}
2349 2349
 
2350
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
2350
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
2351 2351
 
2352 2352
 				++$i;
2353 2353
 			}
@@ -2373,17 +2373,17 @@  discard block
 block discarded – undo
2373 2373
 					// No need to display plugins if they are installed, up-to-date and active.
2374 2374
 					continue;
2375 2375
 				} else {
2376
-					$plugins['all'][ $slug ] = $plugin;
2376
+					$plugins['all'][$slug] = $plugin;
2377 2377
 
2378 2378
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
2379
-						$plugins['install'][ $slug ] = $plugin;
2379
+						$plugins['install'][$slug] = $plugin;
2380 2380
 					} else {
2381 2381
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
2382
-							$plugins['update'][ $slug ] = $plugin;
2382
+							$plugins['update'][$slug] = $plugin;
2383 2383
 						}
2384 2384
 
2385 2385
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
2386
-							$plugins['activate'][ $slug ] = $plugin;
2386
+							$plugins['activate'][$slug] = $plugin;
2387 2387
 						}
2388 2388
 					}
2389 2389
 				}
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
 		 */
2402 2402
 		protected function set_view_totals( $plugins ) {
2403 2403
 			foreach ( $plugins as $type => $list ) {
2404
-				$this->view_totals[ $type ] = count( $list );
2404
+				$this->view_totals[$type] = count( $list );
2405 2405
 			}
2406 2406
 		}
2407 2407
 
@@ -2503,8 +2503,8 @@  discard block
 block discarded – undo
2503 2503
 			$name = array();
2504 2504
 
2505 2505
 			foreach ( $items as $i => $plugin ) {
2506
-				$type[ $i ] = $plugin['type']; // Required / recommended.
2507
-				$name[ $i ] = $plugin['sanitized_plugin'];
2506
+				$type[$i] = $plugin['type']; // Required / recommended.
2507
+				$name[$i] = $plugin['sanitized_plugin'];
2508 2508
 			}
2509 2509
 
2510 2510
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 
2552 2552
 				if ( ! empty( $text ) ) {
2553 2553
 
2554
-					$status_links[ $type ] = sprintf(
2554
+					$status_links[$type] = sprintf(
2555 2555
 						'<a href="%s"%s>%s</a>',
2556 2556
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
2557 2557
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
 		 * @return string
2575 2575
 		 */
2576 2576
 		public function column_default( $item, $column_name ) {
2577
-			return $item[ $column_name ];
2577
+			return $item[$column_name];
2578 2578
 		}
2579 2579
 
2580 2580
 		/**
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
 					'tgmpa-nonce'
2775 2775
 				);
2776 2776
 
2777
-				$action_links[ $action ] = sprintf(
2777
+				$action_links[$action] = sprintf(
2778 2778
 					'<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
2779 2779
 					esc_url( $nonce_url ),
2780 2780
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -2925,19 +2925,19 @@  discard block
 block discarded – undo
2925 2925
 				// Validate the received input.
2926 2926
 				foreach ( $plugins_to_install as $key => $slug ) {
2927 2927
 					// Check if the plugin was registered with TGMPA and remove if not.
2928
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
2929
-						unset( $plugins_to_install[ $key ] );
2928
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
2929
+						unset( $plugins_to_install[$key] );
2930 2930
 						continue;
2931 2931
 					}
2932 2932
 
2933 2933
 					// For install: make sure this is a plugin we *can* install and not one already installed.
2934 2934
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
2935
-						unset( $plugins_to_install[ $key ] );
2935
+						unset( $plugins_to_install[$key] );
2936 2936
 					}
2937 2937
 
2938 2938
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
2939 2939
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
2940
-						unset( $plugins_to_install[ $key ] );
2940
+						unset( $plugins_to_install[$key] );
2941 2941
 					}
2942 2942
 				}
2943 2943
 
@@ -2989,7 +2989,7 @@  discard block
 block discarded – undo
2989 2989
 
2990 2990
 				// Prepare the data for validated plugins for the install/upgrade.
2991 2991
 				foreach ( $plugins_to_install as $slug ) {
2992
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
2992
+					$name   = $this->tgmpa->plugins[$slug]['name'];
2993 2993
 					$source = $this->tgmpa->get_download_url( $slug );
2994 2994
 
2995 2995
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -3002,9 +3002,9 @@  discard block
 block discarded – undo
3002 3002
 								break;
3003 3003
 
3004 3004
 							case 'update':
3005
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
3006
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
3007
-								$to_inject[ $slug ]['source'] = $source;
3005
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
3006
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
3007
+								$to_inject[$slug]['source'] = $source;
3008 3008
 								break;
3009 3009
 						}
3010 3010
 					}
@@ -3071,8 +3071,8 @@  discard block
 block discarded – undo
3071 3071
 				// Grab the file paths for the selected & inactive plugins from the registration array.
3072 3072
 				foreach ( $plugins as $slug ) {
3073 3073
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
3074
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
3075
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
3074
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
3075
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
3076 3076
 					}
3077 3077
 				}
3078 3078
 				unset( $slug );
@@ -3105,8 +3105,8 @@  discard block
 block discarded – undo
3105 3105
 					// Update recently activated plugins option.
3106 3106
 					$recent = (array) get_option( 'recently_activated' );
3107 3107
 					foreach ( $plugins_to_activate as $plugin => $time ) {
3108
-						if ( isset( $recent[ $plugin ] ) ) {
3109
-							unset( $recent[ $plugin ] );
3108
+						if ( isset( $recent[$plugin] ) ) {
3109
+							unset( $recent[$plugin] );
3110 3110
 						}
3111 3111
 					}
3112 3112
 					update_option( 'recently_activated', $recent );
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 								)
3438 3438
 							);
3439 3439
 
3440
-							$results[ $plugin ] = $this->result;
3440
+							$results[$plugin] = $this->result;
3441 3441
 
3442 3442
 							// Prevent credentials auth screen from displaying multiple times.
3443 3443
 							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
 			// phpcs:disable WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
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.