Completed
Pull Request — develop (#689)
by
unknown
01:46
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.
classes/TGM_Plugin_Activation.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -667,11 +667,11 @@  discard block
 block discarded – undo
667 667
 			$args = apply_filters(
668 668
 				'tgmpa_admin_menu_args',
669 669
 				array(
670
-					'parent_slug' => $this->parent_slug,                     // Parent Menu slug.
671
-					'page_title'  => $this->strings['page_title'],           // Page title.
672
-					'menu_title'  => $this->strings['menu_title'],           // Menu title.
673
-					'capability'  => $this->capability,                      // Capability.
674
-					'menu_slug'   => $this->menu,                            // Menu slug.
670
+					'parent_slug' => $this->parent_slug, // Parent Menu slug.
671
+					'page_title'  => $this->strings['page_title'], // Page title.
672
+					'menu_title'  => $this->strings['menu_title'], // Menu title.
673
+					'capability'  => $this->capability, // Capability.
674
+					'menu_slug'   => $this->menu, // Menu slug.
675 675
 					'function'    => array( $this, 'install_plugins_page' ), // Callback.
676 676
 				)
677 677
 			);
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 			// All plugin information will be stored in an array for processing.
785 785
 			$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
786 786
 
787
-			if ( ! isset( $this->plugins[ $slug ] ) ) {
787
+			if ( ! isset( $this->plugins[$slug] ) ) {
788 788
 				return false;
789 789
 			}
790 790
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 				$extra         = array();
830 830
 				$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
831 831
 				$source        = $this->get_download_url( $slug );
832
-				$api           = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
832
+				$api           = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
833 833
 				$api           = ( false !== $api ) ? $api : null;
834 834
 
835 835
 				$url = add_query_arg(
@@ -846,8 +846,8 @@  discard block
 block discarded – undo
846 846
 
847 847
 				$title     = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
848 848
 				$skin_args = array(
849
-					'type'   => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
850
-					'title'  => sprintf( $title, $this->plugins[ $slug ]['name'] ),
849
+					'type'   => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload',
850
+					'title'  => sprintf( $title, $this->plugins[$slug]['name'] ),
851 851
 					'url'    => esc_url_raw( $url ),
852 852
 					'nonce'  => $install_type . '-plugin_' . $slug,
853 853
 					'plugin' => '',
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 				unset( $title );
858 858
 
859 859
 				if ( 'update' === $install_type ) {
860
-					$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
860
+					$skin_args['plugin'] = $this->plugins[$slug]['file_path'];
861 861
 					$skin                = new Plugin_Upgrader_Skin( $skin_args );
862 862
 				} else {
863 863
 					$skin = new Plugin_Installer_Skin( $skin_args );
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
 				if ( 'update' === $install_type ) {
873 873
 					// Inject our info into the update transient.
874 874
 					$to_inject                    = array(
875
-						$slug => $this->plugins[ $slug ],
875
+						$slug => $this->plugins[$slug],
876 876
 					);
877
-					$to_inject[ $slug ]['source'] = $source;
877
+					$to_inject[$slug]['source'] = $source;
878 878
 					$this->inject_update_info( $to_inject );
879 879
 
880
-					$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
880
+					$upgrader->upgrade( $this->plugins[$slug]['file_path'] );
881 881
 				} else {
882 882
 					$upgrader->install( $source );
883 883
 				}
@@ -907,11 +907,11 @@  discard block
 block discarded – undo
907 907
 				}
908 908
 
909 909
 				return true;
910
-			} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
910
+			} elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
911 911
 				// Activate action link was clicked.
912 912
 				check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
913 913
 
914
-				if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
914
+				if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) {
915 915
 					return true; // Finish execution of the function early as we encountered an error.
916 916
 				}
917 917
 			}
@@ -936,17 +936,17 @@  discard block
 block discarded – undo
936 936
 			foreach ( $plugins as $slug => $plugin ) {
937 937
 				$file_path = $plugin['file_path'];
938 938
 
939
-				if ( empty( $repo_updates->response[ $file_path ] ) ) {
940
-					$repo_updates->response[ $file_path ] = new stdClass();
939
+				if ( empty( $repo_updates->response[$file_path] ) ) {
940
+					$repo_updates->response[$file_path] = new stdClass();
941 941
 				}
942 942
 
943 943
 				// We only really need to set package, but let's do all we can in case WP changes something.
944
-				$repo_updates->response[ $file_path ]->slug        = $slug;
945
-				$repo_updates->response[ $file_path ]->plugin      = $file_path;
946
-				$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
947
-				$repo_updates->response[ $file_path ]->package     = $plugin['source'];
948
-				if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
949
-					$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
944
+				$repo_updates->response[$file_path]->slug        = $slug;
945
+				$repo_updates->response[$file_path]->plugin      = $file_path;
946
+				$repo_updates->response[$file_path]->new_version = $plugin['version'];
947
+				$repo_updates->response[$file_path]->package     = $plugin['source'];
948
+				if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) {
949
+					$repo_updates->response[$file_path]->url = $plugin['external_url'];
950 950
 				}
951 951
 			}
952 952
 
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 			} else {
990 990
 				// Bulk installer contains less info, so fall back on the info registered here.
991 991
 				foreach ( $this->plugins as $slug => $plugin ) {
992
-					if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
992
+					if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) {
993 993
 						$desired_slug = $slug;
994 994
 						break;
995 995
 					}
@@ -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,7 +1640,7 @@  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
 				}
@@ -1655,16 +1655,16 @@  discard block
 block discarded – undo
1655 1655
 					)
1656 1656
 				);
1657 1657
 
1658
-				$api[ $slug ] = false;
1658
+				$api[$slug] = false;
1659 1659
 
1660 1660
 				if ( is_wp_error( $response ) ) {
1661 1661
 					wp_die( esc_html( $this->strings['oops'] ) );
1662 1662
 				} else {
1663
-					$api[ $slug ] = $response;
1663
+					$api[$slug] = $response;
1664 1664
 				}
1665 1665
 			}
1666 1666
 
1667
-			return $api[ $slug ];
1667
+			return $api[$slug];
1668 1668
 		}
1669 1669
 
1670 1670
 		/**
@@ -1677,13 +1677,13 @@  discard block
 block discarded – undo
1677 1677
 		 *                or the plugin name if not.
1678 1678
 		 */
1679 1679
 		public function get_info_link( $slug ) {
1680
-			if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
1680
+			if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) {
1681 1681
 				$link = sprintf(
1682 1682
 					'<a href="%1$s" target="_blank">%2$s</a>',
1683
-					esc_url( $this->plugins[ $slug ]['external_url'] ),
1684
-					esc_html( $this->plugins[ $slug ]['name'] )
1683
+					esc_url( $this->plugins[$slug]['external_url'] ),
1684
+					esc_html( $this->plugins[$slug]['name'] )
1685 1685
 				);
1686
-			} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
1686
+			} elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) {
1687 1687
 				$url = add_query_arg(
1688 1688
 					array(
1689 1689
 						'tab'       => 'plugin-information',
@@ -1698,10 +1698,10 @@  discard block
 block discarded – undo
1698 1698
 				$link = sprintf(
1699 1699
 					'<a href="%1$s" class="thickbox">%2$s</a>',
1700 1700
 					esc_url( $url ),
1701
-					esc_html( $this->plugins[ $slug ]['name'] )
1701
+					esc_html( $this->plugins[$slug]['name'] )
1702 1702
 				);
1703 1703
 			} else {
1704
-				$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
1704
+				$link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink.
1705 1705
 			}
1706 1706
 
1707 1707
 			return $link;
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 		public function is_plugin_installed( $slug ) {
1827 1827
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1828 1828
 
1829
-			return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
1829
+			return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) );
1830 1830
 		}
1831 1831
 
1832 1832
 		/**
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 		 * @return bool True if active, false otherwise.
1839 1839
 		 */
1840 1840
 		public function is_plugin_active( $slug ) {
1841
-			return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
1841
+			return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) );
1842 1842
 		}
1843 1843
 
1844 1844
 		/**
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 		 */
1853 1853
 		public function can_plugin_update( $slug ) {
1854 1854
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1855
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1855
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1856 1856
 				return true;
1857 1857
 			}
1858 1858
 
@@ -1908,8 +1908,8 @@  discard block
 block discarded – undo
1908 1908
 		public function get_installed_version( $slug ) {
1909 1909
 			$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
1910 1910
 
1911
-			if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
1912
-				return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
1911
+			if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) {
1912
+				return $installed_plugins[$this->plugins[$slug]['file_path']]['Version'];
1913 1913
 			}
1914 1914
 
1915 1915
 			return '';
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 		 */
1926 1926
 		public function does_plugin_require_update( $slug ) {
1927 1927
 			$installed_version = $this->get_installed_version( $slug );
1928
-			$minimum_version   = $this->plugins[ $slug ]['version'];
1928
+			$minimum_version   = $this->plugins[$slug]['version'];
1929 1929
 
1930 1930
 			return version_compare( $minimum_version, $installed_version, '>' );
1931 1931
 		}
@@ -1940,9 +1940,9 @@  discard block
 block discarded – undo
1940 1940
 		 */
1941 1941
 		public function does_plugin_have_update( $slug ) {
1942 1942
 			// Presume bundled and external plugins will point to a package which meets the minimum required version.
1943
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1943
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1944 1944
 				if ( $this->does_plugin_require_update( $slug ) ) {
1945
-					return $this->plugins[ $slug ]['version'];
1945
+					return $this->plugins[$slug]['version'];
1946 1946
 				}
1947 1947
 
1948 1948
 				return false;
@@ -1950,8 +1950,8 @@  discard block
 block discarded – undo
1950 1950
 
1951 1951
 			$repo_updates = get_site_transient( 'update_plugins' );
1952 1952
 
1953
-			if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
1954
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
1953
+			if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) {
1954
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version;
1955 1955
 			}
1956 1956
 
1957 1957
 			return false;
@@ -1967,14 +1967,14 @@  discard block
 block discarded – undo
1967 1967
 		 */
1968 1968
 		public function get_upgrade_notice( $slug ) {
1969 1969
 			// We currently can't get reliable info on non-WP-repo plugins - issue #380.
1970
-			if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
1970
+			if ( 'repo' !== $this->plugins[$slug]['source_type'] ) {
1971 1971
 				return '';
1972 1972
 			}
1973 1973
 
1974 1974
 			$repo_updates = get_site_transient( 'update_plugins' );
1975 1975
 
1976
-			if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
1977
-				return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
1976
+			if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) {
1977
+				return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice;
1978 1978
 			}
1979 1979
 
1980 1980
 			return '';
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 				 */
2059 2059
 				if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
2060 2060
 					deactivate_plugins( $plugin['file_path'] );
2061
-					$deactivated[ $plugin['file_path'] ] = time();
2061
+					$deactivated[$plugin['file_path']] = time();
2062 2062
 				}
2063 2063
 			}
2064 2064
 
Please login to merge, or discard this patch.
classes/TGMPA_Utils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		 */
91 91
 		protected static function emulate_filter_bool( $value ) {
92 92
 			// @codingStandardsIgnoreStart
93
-			static $true  = array(
93
+			static $true = array(
94 94
 				'1',
95 95
 				'true', 'True', 'TRUE',
96 96
 				'y', 'Y',
Please login to merge, or discard this patch.
classes/TGMPA_Bulk_Installer_Skin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	      'names'        => array(),
76 76
 	      'install_type' => 'install',
77 77
 	    );
78
-	    $args     = wp_parse_args( $args, $defaults );
78
+	    $args = wp_parse_args( $args, $defaults );
79 79
 	
80 80
 	    // Set plugin names to $this->plugin_names property.
81 81
 	    $this->plugin_names = $args['names'];
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	   */
138 138
 	  public function before( $title = '' ) {
139 139
 	    if ( empty( $title ) ) {
140
-	      $title = esc_html( $this->plugin_names[ $this->i ] );
140
+	      $title = esc_html( $this->plugin_names[$this->i] );
141 141
 	    }
142 142
 	    parent::before( $title );
143 143
 	  }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	   */
155 155
 	  public function after( $title = '' ) {
156 156
 	    if ( empty( $title ) ) {
157
-	      $title = esc_html( $this->plugin_names[ $this->i ] );
157
+	      $title = esc_html( $this->plugin_names[$this->i] );
158 158
 	    }
159 159
 	    parent::after( $title );
160 160
 	
Please login to merge, or discard this patch.
classes/TGMPA_Bulk_Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@
 block discarded – undo
218 218
 	        )
219 219
 	      );
220 220
 	
221
-	      $results[ $plugin ] = $this->result;
221
+	      $results[$plugin] = $this->result;
222 222
 	
223 223
 	      // Prevent credentials auth screen from displaying multiple times.
224 224
 	      if ( false === $result ) {
Please login to merge, or discard this patch.
classes/TGMPA_List_Table.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -111,30 +111,30 @@  discard block
 block discarded – undo
111 111
 			$i          = 0;
112 112
 
113 113
 			// Redirect to the 'all' view if no plugins were found for the selected view context.
114
-			if ( empty( $plugins[ $this->view_context ] ) ) {
114
+			if ( empty( $plugins[$this->view_context] ) ) {
115 115
 				$this->view_context = 'all';
116 116
 			}
117 117
 
118
-			foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
119
-				$table_data[ $i ]['sanitized_plugin']  = $plugin['name'];
120
-				$table_data[ $i ]['slug']              = $slug;
121
-				$table_data[ $i ]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
122
-				$table_data[ $i ]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
123
-				$table_data[ $i ]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
124
-				$table_data[ $i ]['status']            = $this->get_plugin_status_text( $slug );
125
-				$table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
126
-				$table_data[ $i ]['minimum_version']   = $plugin['version'];
127
-				$table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
118
+			foreach ( $plugins[$this->view_context] as $slug => $plugin ) {
119
+				$table_data[$i]['sanitized_plugin']  = $plugin['name'];
120
+				$table_data[$i]['slug']              = $slug;
121
+				$table_data[$i]['plugin']            = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>';
122
+				$table_data[$i]['source']            = $this->get_plugin_source_type_text( $plugin['source_type'] );
123
+				$table_data[$i]['type']              = $this->get_plugin_advise_type_text( $plugin['required'] );
124
+				$table_data[$i]['status']            = $this->get_plugin_status_text( $slug );
125
+				$table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug );
126
+				$table_data[$i]['minimum_version']   = $plugin['version'];
127
+				$table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug );
128 128
 
129 129
 				// Prep the upgrade notice info.
130 130
 				$upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug );
131 131
 				if ( ! empty( $upgrade_notice ) ) {
132
-					$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
132
+					$table_data[$i]['upgrade_notice'] = $upgrade_notice;
133 133
 
134 134
 					add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
135 135
 				}
136 136
 
137
-				$table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin );
137
+				$table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin );
138 138
 
139 139
 				$i++;
140 140
 			}
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 					// No need to display plugins if they are installed, up-to-date and active.
161 161
 					continue;
162 162
 				} else {
163
-					$plugins['all'][ $slug ] = $plugin;
163
+					$plugins['all'][$slug] = $plugin;
164 164
 
165 165
 					if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) {
166
-						$plugins['install'][ $slug ] = $plugin;
166
+						$plugins['install'][$slug] = $plugin;
167 167
 					} else {
168 168
 						if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) {
169
-							$plugins['update'][ $slug ] = $plugin;
169
+							$plugins['update'][$slug] = $plugin;
170 170
 						}
171 171
 
172 172
 						if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
173
-							$plugins['activate'][ $slug ] = $plugin;
173
+							$plugins['activate'][$slug] = $plugin;
174 174
 						}
175 175
 					}
176 176
 				}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		protected function set_view_totals( $plugins ) {
190 190
 			foreach ( $plugins as $type => $list ) {
191
-				$this->view_totals[ $type ] = count( $list );
191
+				$this->view_totals[$type] = count( $list );
192 192
 			}
193 193
 		}
194 194
 
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
 			$name = array();
291 291
 
292 292
 			foreach ( $items as $i => $plugin ) {
293
-				$type[ $i ] = $plugin['type']; // Required / recommended.
294
-				$name[ $i ] = $plugin['sanitized_plugin'];
293
+				$type[$i] = $plugin['type']; // Required / recommended.
294
+				$name[$i] = $plugin['sanitized_plugin'];
295 295
 			}
296 296
 
297 297
 			array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
 				if ( ! empty( $text ) ) {
340 340
 
341
-					$status_links[ $type ] = sprintf(
341
+					$status_links[$type] = sprintf(
342 342
 						'<a href="%s"%s>%s</a>',
343 343
 						esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ),
344 344
 						( $type === $this->view_context ) ? ' class="current"' : '',
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		 * @return string
362 362
 		 */
363 363
 		public function column_default( $item, $column_name ) {
364
-			return $item[ $column_name ];
364
+			return $item[$column_name];
365 365
 		}
366 366
 
367 367
 		/**
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 					'tgmpa-nonce'
562 562
 				);
563 563
 
564
-				$action_links[ $action ] = sprintf(
564
+				$action_links[$action] = sprintf(
565 565
 					'<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
566 566
 					esc_url( $nonce_url ),
567 567
 					'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
@@ -712,19 +712,19 @@  discard block
 block discarded – undo
712 712
 				// Validate the received input.
713 713
 				foreach ( $plugins_to_install as $key => $slug ) {
714 714
 					// Check if the plugin was registered with TGMPA and remove if not.
715
-					if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) {
716
-						unset( $plugins_to_install[ $key ] );
715
+					if ( ! isset( $this->tgmpa->plugins[$slug] ) ) {
716
+						unset( $plugins_to_install[$key] );
717 717
 						continue;
718 718
 					}
719 719
 
720 720
 					// For install: make sure this is a plugin we *can* install and not one already installed.
721 721
 					if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) {
722
-						unset( $plugins_to_install[ $key ] );
722
+						unset( $plugins_to_install[$key] );
723 723
 					}
724 724
 
725 725
 					// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
726 726
 					if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) {
727
-						unset( $plugins_to_install[ $key ] );
727
+						unset( $plugins_to_install[$key] );
728 728
 					}
729 729
 				}
730 730
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 
777 777
 				// Prepare the data for validated plugins for the install/upgrade.
778 778
 				foreach ( $plugins_to_install as $slug ) {
779
-					$name   = $this->tgmpa->plugins[ $slug ]['name'];
779
+					$name   = $this->tgmpa->plugins[$slug]['name'];
780 780
 					$source = $this->tgmpa->get_download_url( $slug );
781 781
 
782 782
 					if ( ! empty( $name ) && ! empty( $source ) ) {
@@ -789,9 +789,9 @@  discard block
 block discarded – undo
789 789
 								break;
790 790
 
791 791
 							case 'update':
792
-								$file_paths[]                 = $this->tgmpa->plugins[ $slug ]['file_path'];
793
-								$to_inject[ $slug ]           = $this->tgmpa->plugins[ $slug ];
794
-								$to_inject[ $slug ]['source'] = $source;
792
+								$file_paths[]                 = $this->tgmpa->plugins[$slug]['file_path'];
793
+								$to_inject[$slug]           = $this->tgmpa->plugins[$slug];
794
+								$to_inject[$slug]['source'] = $source;
795 795
 								break;
796 796
 						}
797 797
 					}
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 				// Grab the file paths for the selected & inactive plugins from the registration array.
863 863
 				foreach ( $plugins as $slug ) {
864 864
 					if ( $this->tgmpa->can_plugin_activate( $slug ) ) {
865
-						$plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path'];
866
-						$plugin_names[]        = $this->tgmpa->plugins[ $slug ]['name'];
865
+						$plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path'];
866
+						$plugin_names[]        = $this->tgmpa->plugins[$slug]['name'];
867 867
 					}
868 868
 				}
869 869
 				unset( $slug );
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 					// Update recently activated plugins option.
896 896
 					$recent = (array) get_option( 'recently_activated' );
897 897
 					foreach ( $plugins_to_activate as $plugin => $time ) {
898
-						if ( isset( $recent[ $plugin ] ) ) {
899
-							unset( $recent[ $plugin ] );
898
+						if ( isset( $recent[$plugin] ) ) {
899
+							unset( $recent[$plugin] );
900 900
 						}
901 901
 					}
902 902
 					update_option( 'recently_activated', $recent );
Please login to merge, or discard this patch.