@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | add_action( 'switch_theme', array( $this, 'force_deactivation' ) ); |
453 | 453 | } |
454 | 454 | |
455 | - add_action( 'admin_head', array( $this, 'admin_css' ) ); |
|
455 | + add_action( 'admin_head', array( $this, 'admin_css' ) ); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -700,11 +700,11 @@ discard block |
||
700 | 700 | $args = apply_filters( |
701 | 701 | 'tgmpa_admin_menu_args', |
702 | 702 | array( |
703 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
704 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
705 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
706 | - 'capability' => $this->capability, // Capability. |
|
707 | - 'menu_slug' => $this->menu, // Menu slug. |
|
703 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
704 | + 'page_title' => $this->strings['page_title'], // Page title. |
|
705 | + 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
706 | + 'capability' => $this->capability, // Capability. |
|
707 | + 'menu_slug' => $this->menu, // Menu slug. |
|
708 | 708 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
709 | 709 | ) |
710 | 710 | ); |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | // All plugin information will be stored in an array for processing. |
807 | 807 | $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
808 | 808 | |
809 | - if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
809 | + if ( ! isset( $this->plugins[$slug] ) ) { |
|
810 | 810 | return false; |
811 | 811 | } |
812 | 812 | |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | $extra = array(); |
851 | 851 | $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
852 | 852 | $source = $this->get_download_url( $slug ); |
853 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
853 | + $api = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
854 | 854 | $api = ( false !== $api ) ? $api : null; |
855 | 855 | |
856 | 856 | $url = add_query_arg( |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | |
868 | 868 | $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
869 | 869 | $skin_args = array( |
870 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
871 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
870 | + 'type' => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload', |
|
871 | + 'title' => sprintf( $title, $this->plugins[$slug]['name'] ), |
|
872 | 872 | 'url' => esc_url_raw( $url ), |
873 | 873 | 'nonce' => $install_type . '-plugin_' . $slug, |
874 | 874 | 'plugin' => '', |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | unset( $title ); |
879 | 879 | |
880 | 880 | if ( 'update' === $install_type ) { |
881 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
881 | + $skin_args['plugin'] = $this->plugins[$slug]['file_path']; |
|
882 | 882 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
883 | 883 | } else { |
884 | 884 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -892,11 +892,11 @@ discard block |
||
892 | 892 | |
893 | 893 | if ( 'update' === $install_type ) { |
894 | 894 | // Inject our info into the update transient. |
895 | - $to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
896 | - $to_inject[ $slug ]['source'] = $source; |
|
895 | + $to_inject = array( $slug => $this->plugins[$slug] ); |
|
896 | + $to_inject[$slug]['source'] = $source; |
|
897 | 897 | $this->inject_update_info( $to_inject ); |
898 | 898 | |
899 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
899 | + $upgrader->upgrade( $this->plugins[$slug]['file_path'] ); |
|
900 | 900 | } else { |
901 | 901 | $upgrader->install( $source ); |
902 | 902 | } |
@@ -926,11 +926,11 @@ discard block |
||
926 | 926 | } |
927 | 927 | |
928 | 928 | return true; |
929 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
929 | + } elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
930 | 930 | // Activate action link was clicked. |
931 | 931 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
932 | 932 | |
933 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
933 | + if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) { |
|
934 | 934 | return true; // Finish execution of the function early as we encountered an error. |
935 | 935 | } |
936 | 936 | } |
@@ -955,17 +955,17 @@ discard block |
||
955 | 955 | foreach ( $plugins as $slug => $plugin ) { |
956 | 956 | $file_path = $plugin['file_path']; |
957 | 957 | |
958 | - if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
959 | - $repo_updates->response[ $file_path ] = new stdClass; |
|
958 | + if ( empty( $repo_updates->response[$file_path] ) ) { |
|
959 | + $repo_updates->response[$file_path] = new stdClass; |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | // We only really need to set package, but let's do all we can in case WP changes something. |
963 | - $repo_updates->response[ $file_path ]->slug = $slug; |
|
964 | - $repo_updates->response[ $file_path ]->plugin = $file_path; |
|
965 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
966 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
967 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
968 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
963 | + $repo_updates->response[$file_path]->slug = $slug; |
|
964 | + $repo_updates->response[$file_path]->plugin = $file_path; |
|
965 | + $repo_updates->response[$file_path]->new_version = $plugin['version']; |
|
966 | + $repo_updates->response[$file_path]->package = $plugin['source']; |
|
967 | + if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
968 | + $repo_updates->response[$file_path]->url = $plugin['external_url']; |
|
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | } else { |
1009 | 1009 | // Bulk installer contains less info, so fall back on the info registered here. |
1010 | 1010 | foreach ( $this->plugins as $slug => $plugin ) { |
1011 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
1011 | + if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) { |
|
1012 | 1012 | $desired_slug = $slug; |
1013 | 1013 | break; |
1014 | 1014 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | // Make sure message doesn't display again if bulk activation is performed |
1062 | 1062 | // immediately after a single activation. |
1063 | 1063 | if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
1064 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
1064 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>'; |
|
1065 | 1065 | } |
1066 | 1066 | } else { |
1067 | 1067 | // Simpler message layout for use on the plugin install page. |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | echo '<div id="message" class="error"><p>', |
1075 | 1075 | sprintf( |
1076 | 1076 | esc_html( $this->strings['plugin_already_active'] ), |
1077 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1077 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1078 | 1078 | ), |
1079 | 1079 | '</p></div>'; |
1080 | 1080 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
@@ -1085,13 +1085,13 @@ discard block |
||
1085 | 1085 | echo '<div id="message" class="error"><p>', |
1086 | 1086 | sprintf( |
1087 | 1087 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
1088 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1088 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1089 | 1089 | ), |
1090 | 1090 | '</p></div>'; |
1091 | 1091 | } |
1092 | 1092 | } else { |
1093 | 1093 | // Simpler message layout for use on the plugin install page. |
1094 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1094 | + echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>'; |
|
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | $rendered .= sprintf( |
1219 | 1219 | $line_template, |
1220 | 1220 | sprintf( |
1221 | - translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ), |
|
1221 | + translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ), |
|
1222 | 1222 | $imploded, |
1223 | 1223 | $count |
1224 | 1224 | ) |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1337 | 1337 | if ( 'tgmpa' === $details['setting'] ) { |
1338 | - unset( $wp_settings_errors[ $key ] ); |
|
1338 | + unset( $wp_settings_errors[$key] ); |
|
1339 | 1339 | break; |
1340 | 1340 | } |
1341 | 1341 | } |
@@ -1371,20 +1371,20 @@ discard block |
||
1371 | 1371 | return; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1374 | + if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) { |
|
1375 | 1375 | return; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | $defaults = array( |
1379 | - 'name' => '', // String |
|
1380 | - 'slug' => '', // String |
|
1381 | - 'source' => 'repo', // String |
|
1382 | - 'required' => false, // Boolean |
|
1383 | - 'version' => '', // String |
|
1384 | - 'force_activation' => false, // Boolean |
|
1385 | - 'force_deactivation' => false, // Boolean |
|
1386 | - 'external_url' => '', // String |
|
1387 | - 'is_callable' => '', // String|Array. |
|
1379 | + 'name' => '', // String |
|
1380 | + 'slug' => '', // String |
|
1381 | + 'source' => 'repo', // String |
|
1382 | + 'required' => false, // Boolean |
|
1383 | + 'version' => '', // String |
|
1384 | + 'force_activation' => false, // Boolean |
|
1385 | + 'force_deactivation' => false, // Boolean |
|
1386 | + 'external_url' => '', // String |
|
1387 | + 'is_callable' => '', // String|Array. |
|
1388 | 1388 | ); |
1389 | 1389 | |
1390 | 1390 | // Prepare the received data. |
@@ -1405,8 +1405,8 @@ discard block |
||
1405 | 1405 | $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
1406 | 1406 | |
1407 | 1407 | // Set the class properties. |
1408 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1409 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1408 | + $this->plugins[$plugin['slug']] = $plugin; |
|
1409 | + $this->sort_order[$plugin['slug']] = $plugin['name']; |
|
1410 | 1410 | |
1411 | 1411 | // Should we add the force activation hook ? |
1412 | 1412 | if ( true === $plugin['force_activation'] ) { |
@@ -1490,11 +1490,11 @@ discard block |
||
1490 | 1490 | ); |
1491 | 1491 | |
1492 | 1492 | foreach ( $keys as $key ) { |
1493 | - if ( isset( $config[ $key ] ) ) { |
|
1494 | - if ( is_array( $config[ $key ] ) ) { |
|
1495 | - $this->$key = array_merge( $this->$key, $config[ $key ] ); |
|
1493 | + if ( isset( $config[$key] ) ) { |
|
1494 | + if ( is_array( $config[$key] ) ) { |
|
1495 | + $this->$key = array_merge( $this->$key, $config[$key] ); |
|
1496 | 1496 | } else { |
1497 | - $this->$key = $config[ $key ]; |
|
1497 | + $this->$key = $config[$key]; |
|
1498 | 1498 | } |
1499 | 1499 | } |
1500 | 1500 | } |
@@ -1539,12 +1539,12 @@ discard block |
||
1539 | 1539 | * Parameter added in v2.5.0. |
1540 | 1540 | */ |
1541 | 1541 | public function populate_file_path( $plugin_slug = '' ) { |
1542 | - if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1543 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1542 | + if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) { |
|
1543 | + $this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1544 | 1544 | } else { |
1545 | 1545 | // Add file_path key for all plugins. |
1546 | 1546 | foreach ( $this->plugins as $slug => $values ) { |
1547 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1547 | + $this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | } |
@@ -1584,8 +1584,8 @@ discard block |
||
1584 | 1584 | */ |
1585 | 1585 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1586 | 1586 | foreach ( $this->plugins as $values ) { |
1587 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1588 | - return $values[ $data ]; |
|
1587 | + if ( $name === $values['name'] && isset( $values[$data] ) ) { |
|
1588 | + return $values[$data]; |
|
1589 | 1589 | } |
1590 | 1590 | } |
1591 | 1591 | |
@@ -1603,13 +1603,13 @@ discard block |
||
1603 | 1603 | public function get_download_url( $slug ) { |
1604 | 1604 | $dl_source = ''; |
1605 | 1605 | |
1606 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1606 | + switch ( $this->plugins[$slug]['source_type'] ) { |
|
1607 | 1607 | case 'repo': |
1608 | 1608 | return $this->get_wp_repo_download_url( $slug ); |
1609 | 1609 | case 'external': |
1610 | - return $this->plugins[ $slug ]['source']; |
|
1610 | + return $this->plugins[$slug]['source']; |
|
1611 | 1611 | case 'bundled': |
1612 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1612 | + return $this->default_path . $this->plugins[$slug]['source']; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | 1615 | return $dl_source; // Should never happen. |
@@ -1645,23 +1645,23 @@ discard block |
||
1645 | 1645 | protected function get_plugins_api( $slug ) { |
1646 | 1646 | static $api = array(); // Cache received responses. |
1647 | 1647 | |
1648 | - if ( ! isset( $api[ $slug ] ) ) { |
|
1648 | + if ( ! isset( $api[$slug] ) ) { |
|
1649 | 1649 | if ( ! function_exists( 'plugins_api' ) ) { |
1650 | 1650 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
1651 | 1651 | } |
1652 | 1652 | |
1653 | 1653 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
1654 | 1654 | |
1655 | - $api[ $slug ] = false; |
|
1655 | + $api[$slug] = false; |
|
1656 | 1656 | |
1657 | 1657 | if ( is_wp_error( $response ) ) { |
1658 | 1658 | wp_die( esc_html( $this->strings['oops'] ) ); |
1659 | 1659 | } else { |
1660 | - $api[ $slug ] = $response; |
|
1660 | + $api[$slug] = $response; |
|
1661 | 1661 | } |
1662 | 1662 | } |
1663 | 1663 | |
1664 | - return $api[ $slug ]; |
|
1664 | + return $api[$slug]; |
|
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | /** |
@@ -1674,13 +1674,13 @@ discard block |
||
1674 | 1674 | * or the plugin name if not. |
1675 | 1675 | */ |
1676 | 1676 | public function get_info_link( $slug ) { |
1677 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1677 | + if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) { |
|
1678 | 1678 | $link = sprintf( |
1679 | 1679 | '<a href="%1$s" target="_blank">%2$s</a>', |
1680 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1681 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1680 | + esc_url( $this->plugins[$slug]['external_url'] ), |
|
1681 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1682 | 1682 | ); |
1683 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1683 | + } elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) { |
|
1684 | 1684 | $url = add_query_arg( |
1685 | 1685 | array( |
1686 | 1686 | 'tab' => 'plugin-information', |
@@ -1695,10 +1695,10 @@ discard block |
||
1695 | 1695 | $link = sprintf( |
1696 | 1696 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1697 | 1697 | esc_url( $url ), |
1698 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1698 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1699 | 1699 | ); |
1700 | 1700 | } else { |
1701 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1701 | + $link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink. |
|
1702 | 1702 | } |
1703 | 1703 | |
1704 | 1704 | return $link; |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | public function is_plugin_installed( $slug ) { |
1824 | 1824 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1825 | 1825 | |
1826 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1826 | + return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) ); |
|
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | /** |
@@ -1835,7 +1835,7 @@ discard block |
||
1835 | 1835 | * @return bool True if active, false otherwise. |
1836 | 1836 | */ |
1837 | 1837 | public function is_plugin_active( $slug ) { |
1838 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1838 | + return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) ); |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | 1841 | /** |
@@ -1849,7 +1849,7 @@ discard block |
||
1849 | 1849 | */ |
1850 | 1850 | public function can_plugin_update( $slug ) { |
1851 | 1851 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1852 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1852 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1853 | 1853 | return true; |
1854 | 1854 | } |
1855 | 1855 | |
@@ -1905,8 +1905,8 @@ discard block |
||
1905 | 1905 | public function get_installed_version( $slug ) { |
1906 | 1906 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1907 | 1907 | |
1908 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1909 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1908 | + if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) { |
|
1909 | + return $installed_plugins[$this->plugins[$slug]['file_path']]['Version']; |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | return ''; |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | */ |
1923 | 1923 | public function does_plugin_require_update( $slug ) { |
1924 | 1924 | $installed_version = $this->get_installed_version( $slug ); |
1925 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1925 | + $minimum_version = $this->plugins[$slug]['version']; |
|
1926 | 1926 | |
1927 | 1927 | return version_compare( $minimum_version, $installed_version, '>' ); |
1928 | 1928 | } |
@@ -1937,9 +1937,9 @@ discard block |
||
1937 | 1937 | */ |
1938 | 1938 | public function does_plugin_have_update( $slug ) { |
1939 | 1939 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1940 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1940 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1941 | 1941 | if ( $this->does_plugin_require_update( $slug ) ) { |
1942 | - return $this->plugins[ $slug ]['version']; |
|
1942 | + return $this->plugins[$slug]['version']; |
|
1943 | 1943 | } |
1944 | 1944 | |
1945 | 1945 | return false; |
@@ -1947,8 +1947,8 @@ discard block |
||
1947 | 1947 | |
1948 | 1948 | $repo_updates = get_site_transient( 'update_plugins' ); |
1949 | 1949 | |
1950 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1951 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1950 | + if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) { |
|
1951 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version; |
|
1952 | 1952 | } |
1953 | 1953 | |
1954 | 1954 | return false; |
@@ -1964,14 +1964,14 @@ discard block |
||
1964 | 1964 | */ |
1965 | 1965 | public function get_upgrade_notice( $slug ) { |
1966 | 1966 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1967 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1967 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1968 | 1968 | return ''; |
1969 | 1969 | } |
1970 | 1970 | |
1971 | 1971 | $repo_updates = get_site_transient( 'update_plugins' ); |
1972 | 1972 | |
1973 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1974 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1973 | + if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) { |
|
1974 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice; |
|
1975 | 1975 | } |
1976 | 1976 | |
1977 | 1977 | return ''; |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | */ |
2056 | 2056 | if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) { |
2057 | 2057 | deactivate_plugins( $plugin['file_path'] ); |
2058 | - $deactivated[ $plugin['file_path'] ] = time(); |
|
2058 | + $deactivated[$plugin['file_path']] = time(); |
|
2059 | 2059 | } |
2060 | 2060 | } |
2061 | 2061 | |
@@ -2287,30 +2287,30 @@ discard block |
||
2287 | 2287 | $i = 0; |
2288 | 2288 | |
2289 | 2289 | // Redirect to the 'all' view if no plugins were found for the selected view context. |
2290 | - if ( empty( $plugins[ $this->view_context ] ) ) { |
|
2290 | + if ( empty( $plugins[$this->view_context] ) ) { |
|
2291 | 2291 | $this->view_context = 'all'; |
2292 | 2292 | } |
2293 | 2293 | |
2294 | - foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2295 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2296 | - $table_data[ $i ]['slug'] = $slug; |
|
2297 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2298 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2299 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2300 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2301 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2302 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2303 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2294 | + foreach ( $plugins[$this->view_context] as $slug => $plugin ) { |
|
2295 | + $table_data[$i]['sanitized_plugin'] = $plugin['name']; |
|
2296 | + $table_data[$i]['slug'] = $slug; |
|
2297 | + $table_data[$i]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2298 | + $table_data[$i]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2299 | + $table_data[$i]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2300 | + $table_data[$i]['status'] = $this->get_plugin_status_text( $slug ); |
|
2301 | + $table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2302 | + $table_data[$i]['minimum_version'] = $plugin['version']; |
|
2303 | + $table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2304 | 2304 | |
2305 | 2305 | // Prep the upgrade notice info. |
2306 | 2306 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2307 | 2307 | if ( ! empty( $upgrade_notice ) ) { |
2308 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2308 | + $table_data[$i]['upgrade_notice'] = $upgrade_notice; |
|
2309 | 2309 | |
2310 | 2310 | add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2311 | 2311 | } |
2312 | 2312 | |
2313 | - $table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin ); |
|
2313 | + $table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin ); |
|
2314 | 2314 | |
2315 | 2315 | $i++; |
2316 | 2316 | } |
@@ -2336,17 +2336,17 @@ discard block |
||
2336 | 2336 | // No need to display plugins if they are installed, up-to-date and active. |
2337 | 2337 | continue; |
2338 | 2338 | } else { |
2339 | - $plugins['all'][ $slug ] = $plugin; |
|
2339 | + $plugins['all'][$slug] = $plugin; |
|
2340 | 2340 | |
2341 | 2341 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2342 | - $plugins['install'][ $slug ] = $plugin; |
|
2342 | + $plugins['install'][$slug] = $plugin; |
|
2343 | 2343 | } else { |
2344 | 2344 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2345 | - $plugins['update'][ $slug ] = $plugin; |
|
2345 | + $plugins['update'][$slug] = $plugin; |
|
2346 | 2346 | } |
2347 | 2347 | |
2348 | 2348 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2349 | - $plugins['activate'][ $slug ] = $plugin; |
|
2349 | + $plugins['activate'][$slug] = $plugin; |
|
2350 | 2350 | } |
2351 | 2351 | } |
2352 | 2352 | } |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | */ |
2365 | 2365 | protected function set_view_totals( $plugins ) { |
2366 | 2366 | foreach ( $plugins as $type => $list ) { |
2367 | - $this->view_totals[ $type ] = count( $list ); |
|
2367 | + $this->view_totals[$type] = count( $list ); |
|
2368 | 2368 | } |
2369 | 2369 | } |
2370 | 2370 | |
@@ -2466,8 +2466,8 @@ discard block |
||
2466 | 2466 | $name = array(); |
2467 | 2467 | |
2468 | 2468 | foreach ( $items as $i => $plugin ) { |
2469 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2470 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2469 | + $type[$i] = $plugin['type']; // Required / recommended. |
|
2470 | + $name[$i] = $plugin['sanitized_plugin']; |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | 2473 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2514,7 +2514,7 @@ discard block |
||
2514 | 2514 | |
2515 | 2515 | if ( ! empty( $text ) ) { |
2516 | 2516 | |
2517 | - $status_links[ $type ] = sprintf( |
|
2517 | + $status_links[$type] = sprintf( |
|
2518 | 2518 | '<a href="%s"%s>%s</a>', |
2519 | 2519 | esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ), |
2520 | 2520 | ( $type === $this->view_context ) ? ' class="current"' : '', |
@@ -2537,7 +2537,7 @@ discard block |
||
2537 | 2537 | * @return string |
2538 | 2538 | */ |
2539 | 2539 | public function column_default( $item, $column_name ) { |
2540 | - return $item[ $column_name ]; |
|
2540 | + return $item[$column_name]; |
|
2541 | 2541 | } |
2542 | 2542 | |
2543 | 2543 | /** |
@@ -2737,7 +2737,7 @@ discard block |
||
2737 | 2737 | 'tgmpa-nonce' |
2738 | 2738 | ); |
2739 | 2739 | |
2740 | - $action_links[ $action ] = sprintf( |
|
2740 | + $action_links[$action] = sprintf( |
|
2741 | 2741 | '<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder. |
2742 | 2742 | esc_url( $nonce_url ), |
2743 | 2743 | '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
@@ -2888,19 +2888,19 @@ discard block |
||
2888 | 2888 | // Validate the received input. |
2889 | 2889 | foreach ( $plugins_to_install as $key => $slug ) { |
2890 | 2890 | // Check if the plugin was registered with TGMPA and remove if not. |
2891 | - if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) { |
|
2892 | - unset( $plugins_to_install[ $key ] ); |
|
2891 | + if ( ! isset( $this->tgmpa->plugins[$slug] ) ) { |
|
2892 | + unset( $plugins_to_install[$key] ); |
|
2893 | 2893 | continue; |
2894 | 2894 | } |
2895 | 2895 | |
2896 | 2896 | // For install: make sure this is a plugin we *can* install and not one already installed. |
2897 | 2897 | if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) { |
2898 | - unset( $plugins_to_install[ $key ] ); |
|
2898 | + unset( $plugins_to_install[$key] ); |
|
2899 | 2899 | } |
2900 | 2900 | |
2901 | 2901 | // For updates: make sure this is a plugin we *can* update (update available and WP version ok). |
2902 | 2902 | if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) { |
2903 | - unset( $plugins_to_install[ $key ] ); |
|
2903 | + unset( $plugins_to_install[$key] ); |
|
2904 | 2904 | } |
2905 | 2905 | } |
2906 | 2906 | |
@@ -2951,7 +2951,7 @@ discard block |
||
2951 | 2951 | |
2952 | 2952 | // Prepare the data for validated plugins for the install/upgrade. |
2953 | 2953 | foreach ( $plugins_to_install as $slug ) { |
2954 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2954 | + $name = $this->tgmpa->plugins[$slug]['name']; |
|
2955 | 2955 | $source = $this->tgmpa->get_download_url( $slug ); |
2956 | 2956 | |
2957 | 2957 | if ( ! empty( $name ) && ! empty( $source ) ) { |
@@ -2964,9 +2964,9 @@ discard block |
||
2964 | 2964 | break; |
2965 | 2965 | |
2966 | 2966 | case 'update': |
2967 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
2968 | - $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
2969 | - $to_inject[ $slug ]['source'] = $source; |
|
2967 | + $file_paths[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
2968 | + $to_inject[$slug] = $this->tgmpa->plugins[$slug]; |
|
2969 | + $to_inject[$slug]['source'] = $source; |
|
2970 | 2970 | break; |
2971 | 2971 | } |
2972 | 2972 | } |
@@ -3033,8 +3033,8 @@ discard block |
||
3033 | 3033 | // Grab the file paths for the selected & inactive plugins from the registration array. |
3034 | 3034 | foreach ( $plugins as $slug ) { |
3035 | 3035 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
3036 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3037 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
3036 | + $plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
3037 | + $plugin_names[] = $this->tgmpa->plugins[$slug]['name']; |
|
3038 | 3038 | } |
3039 | 3039 | } |
3040 | 3040 | unset( $slug ); |
@@ -3066,8 +3066,8 @@ discard block |
||
3066 | 3066 | // Update recently activated plugins option. |
3067 | 3067 | $recent = (array) get_option( 'recently_activated' ); |
3068 | 3068 | foreach ( $plugins_to_activate as $plugin => $time ) { |
3069 | - if ( isset( $recent[ $plugin ] ) ) { |
|
3070 | - unset( $recent[ $plugin ] ); |
|
3069 | + if ( isset( $recent[$plugin] ) ) { |
|
3070 | + unset( $recent[$plugin] ); |
|
3071 | 3071 | } |
3072 | 3072 | } |
3073 | 3073 | update_option( 'recently_activated', $recent ); |
@@ -3398,7 +3398,7 @@ discard block |
||
3398 | 3398 | ) |
3399 | 3399 | ); |
3400 | 3400 | |
3401 | - $results[ $plugin ] = $this->result; |
|
3401 | + $results[$plugin] = $this->result; |
|
3402 | 3402 | |
3403 | 3403 | // Prevent credentials auth screen from displaying multiple times. |
3404 | 3404 | if ( false === $result ) { |
@@ -3584,7 +3584,7 @@ discard block |
||
3584 | 3584 | 'names' => array(), |
3585 | 3585 | 'install_type' => 'install', |
3586 | 3586 | ); |
3587 | - $args = wp_parse_args( $args, $defaults ); |
|
3587 | + $args = wp_parse_args( $args, $defaults ); |
|
3588 | 3588 | |
3589 | 3589 | // Set plugin names to $this->plugin_names property. |
3590 | 3590 | $this->plugin_names = $args['names']; |
@@ -3641,7 +3641,7 @@ discard block |
||
3641 | 3641 | */ |
3642 | 3642 | public function before( $title = '' ) { |
3643 | 3643 | if ( empty( $title ) ) { |
3644 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3644 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3645 | 3645 | } |
3646 | 3646 | parent::before( $title ); |
3647 | 3647 | } |
@@ -3658,7 +3658,7 @@ discard block |
||
3658 | 3658 | */ |
3659 | 3659 | public function after( $title = '' ) { |
3660 | 3660 | if ( empty( $title ) ) { |
3661 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3661 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3662 | 3662 | } |
3663 | 3663 | parent::after( $title ); |
3664 | 3664 | |
@@ -3831,7 +3831,7 @@ discard block |
||
3831 | 3831 | */ |
3832 | 3832 | protected static function emulate_filter_bool( $value ) { |
3833 | 3833 | // @codingStandardsIgnoreStart |
3834 | - static $true = array( |
|
3834 | + static $true = array( |
|
3835 | 3835 | '1', |
3836 | 3836 | 'true', 'True', 'TRUE', |
3837 | 3837 | 'y', 'Y', |