@@ -703,11 +703,11 @@ discard block |
||
703 | 703 | $args = apply_filters( |
704 | 704 | 'tgmpa_admin_menu_args', |
705 | 705 | array( |
706 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
707 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
708 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
709 | - 'capability' => $this->capability, // Capability. |
|
710 | - 'menu_slug' => $this->menu, // Menu slug. |
|
706 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
707 | + 'page_title' => $this->strings['page_title'], // Page title. |
|
708 | + 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
709 | + 'capability' => $this->capability, // Capability. |
|
710 | + 'menu_slug' => $this->menu, // Menu slug. |
|
711 | 711 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
712 | 712 | ) |
713 | 713 | ); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | // All plugin information will be stored in an array for processing. |
810 | 810 | $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
811 | 811 | |
812 | - if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
812 | + if ( ! isset( $this->plugins[$slug] ) ) { |
|
813 | 813 | return false; |
814 | 814 | } |
815 | 815 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | $extra = array(); |
854 | 854 | $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
855 | 855 | $source = $this->get_download_url( $slug ); |
856 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
856 | + $api = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
857 | 857 | $api = ( false !== $api ) ? $api : null; |
858 | 858 | |
859 | 859 | $url = add_query_arg( |
@@ -870,8 +870,8 @@ discard block |
||
870 | 870 | |
871 | 871 | $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
872 | 872 | $skin_args = array( |
873 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
874 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
873 | + 'type' => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload', |
|
874 | + 'title' => sprintf( $title, $this->plugins[$slug]['name'] ), |
|
875 | 875 | 'url' => esc_url_raw( $url ), |
876 | 876 | 'nonce' => $install_type . '-plugin_' . $slug, |
877 | 877 | 'plugin' => '', |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | unset( $title ); |
882 | 882 | |
883 | 883 | if ( 'update' === $install_type ) { |
884 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
884 | + $skin_args['plugin'] = $this->plugins[$slug]['file_path']; |
|
885 | 885 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
886 | 886 | } else { |
887 | 887 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -895,11 +895,11 @@ discard block |
||
895 | 895 | |
896 | 896 | if ( 'update' === $install_type ) { |
897 | 897 | // Inject our info into the update transient. |
898 | - $to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
899 | - $to_inject[ $slug ]['source'] = $source; |
|
898 | + $to_inject = array( $slug => $this->plugins[$slug] ); |
|
899 | + $to_inject[$slug]['source'] = $source; |
|
900 | 900 | $this->inject_update_info( $to_inject ); |
901 | 901 | |
902 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
902 | + $upgrader->upgrade( $this->plugins[$slug]['file_path'] ); |
|
903 | 903 | } else { |
904 | 904 | $upgrader->install( $source ); |
905 | 905 | } |
@@ -929,11 +929,11 @@ discard block |
||
929 | 929 | } |
930 | 930 | |
931 | 931 | return true; |
932 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
932 | + } elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
933 | 933 | // Activate action link was clicked. |
934 | 934 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
935 | 935 | |
936 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
936 | + if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) { |
|
937 | 937 | return true; // Finish execution of the function early as we encountered an error. |
938 | 938 | } |
939 | 939 | } |
@@ -958,17 +958,17 @@ discard block |
||
958 | 958 | foreach ( $plugins as $slug => $plugin ) { |
959 | 959 | $file_path = $plugin['file_path']; |
960 | 960 | |
961 | - if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
962 | - $repo_updates->response[ $file_path ] = new stdClass; |
|
961 | + if ( empty( $repo_updates->response[$file_path] ) ) { |
|
962 | + $repo_updates->response[$file_path] = new stdClass; |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | // We only really need to set package, but let's do all we can in case WP changes something. |
966 | - $repo_updates->response[ $file_path ]->slug = $slug; |
|
967 | - $repo_updates->response[ $file_path ]->plugin = $file_path; |
|
968 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
969 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
970 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
971 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
966 | + $repo_updates->response[$file_path]->slug = $slug; |
|
967 | + $repo_updates->response[$file_path]->plugin = $file_path; |
|
968 | + $repo_updates->response[$file_path]->new_version = $plugin['version']; |
|
969 | + $repo_updates->response[$file_path]->package = $plugin['source']; |
|
970 | + if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
971 | + $repo_updates->response[$file_path]->url = $plugin['external_url']; |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | } else { |
1012 | 1012 | // Bulk installer contains less info, so fall back on the info registered here. |
1013 | 1013 | foreach ( $this->plugins as $slug => $plugin ) { |
1014 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
1014 | + if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) { |
|
1015 | 1015 | $desired_slug = $slug; |
1016 | 1016 | break; |
1017 | 1017 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | // Make sure message doesn't display again if bulk activation is performed |
1065 | 1065 | // immediately after a single activation. |
1066 | 1066 | if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
1067 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
1067 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>'; |
|
1068 | 1068 | } |
1069 | 1069 | } else { |
1070 | 1070 | // Simpler message layout for use on the plugin install page. |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | echo '<div id="message" class="error"><p>', |
1078 | 1078 | sprintf( |
1079 | 1079 | esc_html( $this->strings['plugin_already_active'] ), |
1080 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1080 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1081 | 1081 | ), |
1082 | 1082 | '</p></div>'; |
1083 | 1083 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
@@ -1088,13 +1088,13 @@ discard block |
||
1088 | 1088 | echo '<div id="message" class="error"><p>', |
1089 | 1089 | sprintf( |
1090 | 1090 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
1091 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1091 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1092 | 1092 | ), |
1093 | 1093 | '</p></div>'; |
1094 | 1094 | } |
1095 | 1095 | } else { |
1096 | 1096 | // Simpler message layout for use on the plugin install page. |
1097 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1097 | + echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>'; |
|
1098 | 1098 | } |
1099 | 1099 | } |
1100 | 1100 | |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $message_output .= sprintf( |
1250 | 1250 | $line_template, |
1251 | 1251 | sprintf( |
1252 | - translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ), |
|
1252 | + translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ), |
|
1253 | 1253 | $imploded, |
1254 | 1254 | $count |
1255 | 1255 | ) |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | |
1356 | 1356 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1357 | 1357 | if ( 'tgmpa' === $details['setting'] ) { |
1358 | - unset( $wp_settings_errors[ $key ] ); |
|
1358 | + unset( $wp_settings_errors[$key] ); |
|
1359 | 1359 | break; |
1360 | 1360 | } |
1361 | 1361 | } |
@@ -1407,20 +1407,20 @@ discard block |
||
1407 | 1407 | return; |
1408 | 1408 | } |
1409 | 1409 | |
1410 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1410 | + if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) { |
|
1411 | 1411 | return; |
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | $defaults = array( |
1415 | - 'name' => '', // String |
|
1416 | - 'slug' => '', // String |
|
1417 | - 'source' => 'repo', // String |
|
1418 | - 'required' => false, // Boolean |
|
1419 | - 'version' => '', // String |
|
1420 | - 'force_activation' => false, // Boolean |
|
1421 | - 'force_deactivation' => false, // Boolean |
|
1422 | - 'external_url' => '', // String |
|
1423 | - 'is_callable' => '', // String|Array. |
|
1415 | + 'name' => '', // String |
|
1416 | + 'slug' => '', // String |
|
1417 | + 'source' => 'repo', // String |
|
1418 | + 'required' => false, // Boolean |
|
1419 | + 'version' => '', // String |
|
1420 | + 'force_activation' => false, // Boolean |
|
1421 | + 'force_deactivation' => false, // Boolean |
|
1422 | + 'external_url' => '', // String |
|
1423 | + 'is_callable' => '', // String|Array. |
|
1424 | 1424 | ); |
1425 | 1425 | |
1426 | 1426 | // Prepare the received data. |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
1442 | 1442 | |
1443 | 1443 | // Set the class properties. |
1444 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1445 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1444 | + $this->plugins[$plugin['slug']] = $plugin; |
|
1445 | + $this->sort_order[$plugin['slug']] = $plugin['name']; |
|
1446 | 1446 | |
1447 | 1447 | // Should we add the force activation hook ? |
1448 | 1448 | if ( true === $plugin['force_activation'] ) { |
@@ -1526,11 +1526,11 @@ discard block |
||
1526 | 1526 | ); |
1527 | 1527 | |
1528 | 1528 | foreach ( $keys as $key ) { |
1529 | - if ( isset( $config[ $key ] ) ) { |
|
1530 | - if ( is_array( $config[ $key ] ) ) { |
|
1531 | - $this->$key = array_merge( $this->$key, $config[ $key ] ); |
|
1529 | + if ( isset( $config[$key] ) ) { |
|
1530 | + if ( is_array( $config[$key] ) ) { |
|
1531 | + $this->$key = array_merge( $this->$key, $config[$key] ); |
|
1532 | 1532 | } else { |
1533 | - $this->$key = $config[ $key ]; |
|
1533 | + $this->$key = $config[$key]; |
|
1534 | 1534 | } |
1535 | 1535 | } |
1536 | 1536 | } |
@@ -1575,12 +1575,12 @@ discard block |
||
1575 | 1575 | * Parameter added in v2.5.0. |
1576 | 1576 | */ |
1577 | 1577 | public function populate_file_path( $plugin_slug = '' ) { |
1578 | - if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1579 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1578 | + if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) { |
|
1579 | + $this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1580 | 1580 | } else { |
1581 | 1581 | // Add file_path key for all plugins. |
1582 | 1582 | foreach ( $this->plugins as $slug => $values ) { |
1583 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1583 | + $this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1584 | 1584 | } |
1585 | 1585 | } |
1586 | 1586 | } |
@@ -1620,8 +1620,8 @@ discard block |
||
1620 | 1620 | */ |
1621 | 1621 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1622 | 1622 | foreach ( $this->plugins as $values ) { |
1623 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1624 | - return $values[ $data ]; |
|
1623 | + if ( $name === $values['name'] && isset( $values[$data] ) ) { |
|
1624 | + return $values[$data]; |
|
1625 | 1625 | } |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1639,13 +1639,13 @@ discard block |
||
1639 | 1639 | public function get_download_url( $slug ) { |
1640 | 1640 | $dl_source = ''; |
1641 | 1641 | |
1642 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1642 | + switch ( $this->plugins[$slug]['source_type'] ) { |
|
1643 | 1643 | case 'repo': |
1644 | 1644 | return $this->get_wp_repo_download_url( $slug ); |
1645 | 1645 | case 'external': |
1646 | - return $this->plugins[ $slug ]['source']; |
|
1646 | + return $this->plugins[$slug]['source']; |
|
1647 | 1647 | case 'bundled': |
1648 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1648 | + return $this->default_path . $this->plugins[$slug]['source']; |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | return $dl_source; // Should never happen. |
@@ -1681,23 +1681,23 @@ discard block |
||
1681 | 1681 | protected function get_plugins_api( $slug ) { |
1682 | 1682 | static $api = array(); // Cache received responses. |
1683 | 1683 | |
1684 | - if ( ! isset( $api[ $slug ] ) ) { |
|
1684 | + if ( ! isset( $api[$slug] ) ) { |
|
1685 | 1685 | if ( ! function_exists( 'plugins_api' ) ) { |
1686 | 1686 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
1690 | 1690 | |
1691 | - $api[ $slug ] = false; |
|
1691 | + $api[$slug] = false; |
|
1692 | 1692 | |
1693 | 1693 | if ( is_wp_error( $response ) ) { |
1694 | 1694 | wp_die( esc_html( $this->strings['oops'] ) ); |
1695 | 1695 | } else { |
1696 | - $api[ $slug ] = $response; |
|
1696 | + $api[$slug] = $response; |
|
1697 | 1697 | } |
1698 | 1698 | } |
1699 | 1699 | |
1700 | - return $api[ $slug ]; |
|
1700 | + return $api[$slug]; |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | /** |
@@ -1710,13 +1710,13 @@ discard block |
||
1710 | 1710 | * or the plugin name if not. |
1711 | 1711 | */ |
1712 | 1712 | public function get_info_link( $slug ) { |
1713 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1713 | + if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) { |
|
1714 | 1714 | $link = sprintf( |
1715 | 1715 | '<a href="%1$s" target="_blank">%2$s</a>', |
1716 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1717 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1716 | + esc_url( $this->plugins[$slug]['external_url'] ), |
|
1717 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1718 | 1718 | ); |
1719 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1719 | + } elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) { |
|
1720 | 1720 | $url = add_query_arg( |
1721 | 1721 | array( |
1722 | 1722 | 'tab' => 'plugin-information', |
@@ -1731,10 +1731,10 @@ discard block |
||
1731 | 1731 | $link = sprintf( |
1732 | 1732 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1733 | 1733 | esc_url( $url ), |
1734 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1734 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1735 | 1735 | ); |
1736 | 1736 | } else { |
1737 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1737 | + $link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink. |
|
1738 | 1738 | } |
1739 | 1739 | |
1740 | 1740 | return $link; |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | public function is_plugin_installed( $slug ) { |
1860 | 1860 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1861 | 1861 | |
1862 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1862 | + return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) ); |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | /** |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | * @return bool True if active, false otherwise. |
1872 | 1872 | */ |
1873 | 1873 | public function is_plugin_active( $slug ) { |
1874 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1874 | + return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) ); |
|
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | /** |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | */ |
1886 | 1886 | public function can_plugin_update( $slug ) { |
1887 | 1887 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1888 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1888 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1889 | 1889 | return true; |
1890 | 1890 | } |
1891 | 1891 | |
@@ -1941,8 +1941,8 @@ discard block |
||
1941 | 1941 | public function get_installed_version( $slug ) { |
1942 | 1942 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1943 | 1943 | |
1944 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1945 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1944 | + if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) { |
|
1945 | + return $installed_plugins[$this->plugins[$slug]['file_path']]['Version']; |
|
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | return ''; |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | */ |
1959 | 1959 | public function does_plugin_require_update( $slug ) { |
1960 | 1960 | $installed_version = $this->get_installed_version( $slug ); |
1961 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1961 | + $minimum_version = $this->plugins[$slug]['version']; |
|
1962 | 1962 | |
1963 | 1963 | return version_compare( $minimum_version, $installed_version, '>' ); |
1964 | 1964 | } |
@@ -1973,9 +1973,9 @@ discard block |
||
1973 | 1973 | */ |
1974 | 1974 | public function does_plugin_have_update( $slug ) { |
1975 | 1975 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1976 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1976 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1977 | 1977 | if ( $this->does_plugin_require_update( $slug ) ) { |
1978 | - return $this->plugins[ $slug ]['version']; |
|
1978 | + return $this->plugins[$slug]['version']; |
|
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | return false; |
@@ -1983,8 +1983,8 @@ discard block |
||
1983 | 1983 | |
1984 | 1984 | $repo_updates = get_site_transient( 'update_plugins' ); |
1985 | 1985 | |
1986 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1987 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1986 | + if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) { |
|
1987 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version; |
|
1988 | 1988 | } |
1989 | 1989 | |
1990 | 1990 | return false; |
@@ -2000,14 +2000,14 @@ discard block |
||
2000 | 2000 | */ |
2001 | 2001 | public function get_upgrade_notice( $slug ) { |
2002 | 2002 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
2003 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
2003 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
2004 | 2004 | return ''; |
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | $repo_updates = get_site_transient( 'update_plugins' ); |
2008 | 2008 | |
2009 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
2010 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
2009 | + if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) { |
|
2010 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice; |
|
2011 | 2011 | } |
2012 | 2012 | |
2013 | 2013 | return ''; |
@@ -2110,7 +2110,7 @@ discard block |
||
2110 | 2110 | */ |
2111 | 2111 | if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) { |
2112 | 2112 | deactivate_plugins( $plugin['file_path'] ); |
2113 | - $deactivated[ $plugin['file_path'] ] = time(); |
|
2113 | + $deactivated[$plugin['file_path']] = time(); |
|
2114 | 2114 | } |
2115 | 2115 | } |
2116 | 2116 | |
@@ -2325,30 +2325,30 @@ discard block |
||
2325 | 2325 | $i = 0; |
2326 | 2326 | |
2327 | 2327 | // Redirect to the 'all' view if no plugins were found for the selected view context. |
2328 | - if ( empty( $plugins[ $this->view_context ] ) ) { |
|
2328 | + if ( empty( $plugins[$this->view_context] ) ) { |
|
2329 | 2329 | $this->view_context = 'all'; |
2330 | 2330 | } |
2331 | 2331 | |
2332 | - foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2333 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2334 | - $table_data[ $i ]['slug'] = $slug; |
|
2335 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2336 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2337 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2338 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2339 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2340 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2341 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2332 | + foreach ( $plugins[$this->view_context] as $slug => $plugin ) { |
|
2333 | + $table_data[$i]['sanitized_plugin'] = $plugin['name']; |
|
2334 | + $table_data[$i]['slug'] = $slug; |
|
2335 | + $table_data[$i]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2336 | + $table_data[$i]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2337 | + $table_data[$i]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2338 | + $table_data[$i]['status'] = $this->get_plugin_status_text( $slug ); |
|
2339 | + $table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2340 | + $table_data[$i]['minimum_version'] = $plugin['version']; |
|
2341 | + $table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2342 | 2342 | |
2343 | 2343 | // Prep the upgrade notice info. |
2344 | 2344 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2345 | 2345 | if ( ! empty( $upgrade_notice ) ) { |
2346 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2346 | + $table_data[$i]['upgrade_notice'] = $upgrade_notice; |
|
2347 | 2347 | |
2348 | 2348 | add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - $table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin ); |
|
2351 | + $table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin ); |
|
2352 | 2352 | |
2353 | 2353 | $i++; |
2354 | 2354 | } |
@@ -2374,17 +2374,17 @@ discard block |
||
2374 | 2374 | // No need to display plugins if they are installed, up-to-date and active. |
2375 | 2375 | continue; |
2376 | 2376 | } else { |
2377 | - $plugins['all'][ $slug ] = $plugin; |
|
2377 | + $plugins['all'][$slug] = $plugin; |
|
2378 | 2378 | |
2379 | 2379 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2380 | - $plugins['install'][ $slug ] = $plugin; |
|
2380 | + $plugins['install'][$slug] = $plugin; |
|
2381 | 2381 | } else { |
2382 | 2382 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2383 | - $plugins['update'][ $slug ] = $plugin; |
|
2383 | + $plugins['update'][$slug] = $plugin; |
|
2384 | 2384 | } |
2385 | 2385 | |
2386 | 2386 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2387 | - $plugins['activate'][ $slug ] = $plugin; |
|
2387 | + $plugins['activate'][$slug] = $plugin; |
|
2388 | 2388 | } |
2389 | 2389 | } |
2390 | 2390 | } |
@@ -2402,7 +2402,7 @@ discard block |
||
2402 | 2402 | */ |
2403 | 2403 | protected function set_view_totals( $plugins ) { |
2404 | 2404 | foreach ( $plugins as $type => $list ) { |
2405 | - $this->view_totals[ $type ] = count( $list ); |
|
2405 | + $this->view_totals[$type] = count( $list ); |
|
2406 | 2406 | } |
2407 | 2407 | } |
2408 | 2408 | |
@@ -2504,8 +2504,8 @@ discard block |
||
2504 | 2504 | $name = array(); |
2505 | 2505 | |
2506 | 2506 | foreach ( $items as $i => $plugin ) { |
2507 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2508 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2507 | + $type[$i] = $plugin['type']; // Required / recommended. |
|
2508 | + $name[$i] = $plugin['sanitized_plugin']; |
|
2509 | 2509 | } |
2510 | 2510 | |
2511 | 2511 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2552,7 +2552,7 @@ discard block |
||
2552 | 2552 | |
2553 | 2553 | if ( ! empty( $text ) ) { |
2554 | 2554 | |
2555 | - $status_links[ $type ] = sprintf( |
|
2555 | + $status_links[$type] = sprintf( |
|
2556 | 2556 | '<a href="%s"%s>%s</a>', |
2557 | 2557 | esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ), |
2558 | 2558 | ( $type === $this->view_context ) ? ' class="current"' : '', |
@@ -2575,7 +2575,7 @@ discard block |
||
2575 | 2575 | * @return string |
2576 | 2576 | */ |
2577 | 2577 | public function column_default( $item, $column_name ) { |
2578 | - return $item[ $column_name ]; |
|
2578 | + return $item[$column_name]; |
|
2579 | 2579 | } |
2580 | 2580 | |
2581 | 2581 | /** |
@@ -2775,7 +2775,7 @@ discard block |
||
2775 | 2775 | 'tgmpa-nonce' |
2776 | 2776 | ); |
2777 | 2777 | |
2778 | - $action_links[ $action ] = sprintf( |
|
2778 | + $action_links[$action] = sprintf( |
|
2779 | 2779 | '<a href="%1$s">' . esc_html( $text ) . '</a>', |
2780 | 2780 | esc_url( $nonce_url ), |
2781 | 2781 | '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
@@ -2924,19 +2924,19 @@ discard block |
||
2924 | 2924 | // Validate the received input. |
2925 | 2925 | foreach ( $plugins_to_install as $key => $slug ) { |
2926 | 2926 | // Check if the plugin was registered with TGMPA and remove if not. |
2927 | - if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) { |
|
2928 | - unset( $plugins_to_install[ $key ] ); |
|
2927 | + if ( ! isset( $this->tgmpa->plugins[$slug] ) ) { |
|
2928 | + unset( $plugins_to_install[$key] ); |
|
2929 | 2929 | continue; |
2930 | 2930 | } |
2931 | 2931 | |
2932 | 2932 | // For install: make sure this is a plugin we *can* install and not one already installed. |
2933 | 2933 | if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) { |
2934 | - unset( $plugins_to_install[ $key ] ); |
|
2934 | + unset( $plugins_to_install[$key] ); |
|
2935 | 2935 | } |
2936 | 2936 | |
2937 | 2937 | // For updates: make sure this is a plugin we *can* update (update available and WP version ok). |
2938 | 2938 | if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) { |
2939 | - unset( $plugins_to_install[ $key ] ); |
|
2939 | + unset( $plugins_to_install[$key] ); |
|
2940 | 2940 | } |
2941 | 2941 | } |
2942 | 2942 | |
@@ -2987,7 +2987,7 @@ discard block |
||
2987 | 2987 | |
2988 | 2988 | // Prepare the data for validated plugins for the install/upgrade. |
2989 | 2989 | foreach ( $plugins_to_install as $slug ) { |
2990 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2990 | + $name = $this->tgmpa->plugins[$slug]['name']; |
|
2991 | 2991 | $source = $this->tgmpa->get_download_url( $slug ); |
2992 | 2992 | |
2993 | 2993 | if ( ! empty( $name ) && ! empty( $source ) ) { |
@@ -3000,9 +3000,9 @@ discard block |
||
3000 | 3000 | break; |
3001 | 3001 | |
3002 | 3002 | case 'update': |
3003 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3004 | - $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
3005 | - $to_inject[ $slug ]['source'] = $source; |
|
3003 | + $file_paths[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
3004 | + $to_inject[$slug] = $this->tgmpa->plugins[$slug]; |
|
3005 | + $to_inject[$slug]['source'] = $source; |
|
3006 | 3006 | break; |
3007 | 3007 | } |
3008 | 3008 | } |
@@ -3069,8 +3069,8 @@ discard block |
||
3069 | 3069 | // Grab the file paths for the selected & inactive plugins from the registration array. |
3070 | 3070 | foreach ( $plugins as $slug ) { |
3071 | 3071 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
3072 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3073 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
3072 | + $plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
3073 | + $plugin_names[] = $this->tgmpa->plugins[$slug]['name']; |
|
3074 | 3074 | } |
3075 | 3075 | } |
3076 | 3076 | unset( $slug ); |
@@ -3102,8 +3102,8 @@ discard block |
||
3102 | 3102 | // Update recently activated plugins option. |
3103 | 3103 | $recent = (array) get_option( 'recently_activated' ); |
3104 | 3104 | foreach ( $plugins_to_activate as $plugin => $time ) { |
3105 | - if ( isset( $recent[ $plugin ] ) ) { |
|
3106 | - unset( $recent[ $plugin ] ); |
|
3105 | + if ( isset( $recent[$plugin] ) ) { |
|
3106 | + unset( $recent[$plugin] ); |
|
3107 | 3107 | } |
3108 | 3108 | } |
3109 | 3109 | update_option( 'recently_activated', $recent ); |
@@ -3424,7 +3424,7 @@ discard block |
||
3424 | 3424 | ) |
3425 | 3425 | ); |
3426 | 3426 | |
3427 | - $results[ $plugin ] = $this->result; |
|
3427 | + $results[$plugin] = $this->result; |
|
3428 | 3428 | |
3429 | 3429 | // Prevent credentials auth screen from displaying multiple times. |
3430 | 3430 | if ( false === $result ) { |
@@ -3610,7 +3610,7 @@ discard block |
||
3610 | 3610 | 'names' => array(), |
3611 | 3611 | 'install_type' => 'install', |
3612 | 3612 | ); |
3613 | - $args = wp_parse_args( $args, $defaults ); |
|
3613 | + $args = wp_parse_args( $args, $defaults ); |
|
3614 | 3614 | |
3615 | 3615 | // Set plugin names to $this->plugin_names property. |
3616 | 3616 | $this->plugin_names = $args['names']; |
@@ -3667,7 +3667,7 @@ discard block |
||
3667 | 3667 | */ |
3668 | 3668 | public function before( $title = '' ) { |
3669 | 3669 | if ( empty( $title ) ) { |
3670 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3670 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3671 | 3671 | } |
3672 | 3672 | parent::before( $title ); |
3673 | 3673 | } |
@@ -3684,7 +3684,7 @@ discard block |
||
3684 | 3684 | */ |
3685 | 3685 | public function after( $title = '' ) { |
3686 | 3686 | if ( empty( $title ) ) { |
3687 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3687 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3688 | 3688 | } |
3689 | 3689 | parent::after( $title ); |
3690 | 3690 | |
@@ -3857,7 +3857,7 @@ discard block |
||
3857 | 3857 | */ |
3858 | 3858 | protected static function emulate_filter_bool( $value ) { |
3859 | 3859 | // @codingStandardsIgnoreStart |
3860 | - static $true = array( |
|
3860 | + static $true = array( |
|
3861 | 3861 | '1', |
3862 | 3862 | 'true', 'True', 'TRUE', |
3863 | 3863 | 'y', 'Y', |