@@ -949,7 +949,8 @@ discard block |
||
949 | 949 | if ( ! $automatic ) { |
950 | 950 | // Make sure message doesn't display again if bulk activation is performed |
951 | 951 | // immediately after a single activation. |
952 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
952 | + if ( ! isset( $_POST['action'] ) ) { |
|
953 | +// WPCS: CSRF OK. |
|
953 | 954 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
954 | 955 | } |
955 | 956 | } else { |
@@ -970,7 +971,8 @@ discard block |
||
970 | 971 | if ( ! $automatic ) { |
971 | 972 | // Make sure message doesn't display again if bulk activation is performed |
972 | 973 | // immediately after a single activation. |
973 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
974 | + if ( ! isset( $_POST['action'] ) ) { |
|
975 | +// WPCS: CSRF OK. |
|
974 | 976 | echo '<div id="message" class="error"><p>', |
975 | 977 | sprintf( |
976 | 978 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -1621,10 +1623,12 @@ discard block |
||
1621 | 1623 | if ( 'update-core' === $screen->base ) { |
1622 | 1624 | // Core update screen. |
1623 | 1625 | return true; |
1624 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1626 | + } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1627 | +// WPCS: CSRF ok. |
|
1625 | 1628 | // Plugins bulk update screen. |
1626 | 1629 | return true; |
1627 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1630 | + } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1631 | +// WPCS: CSRF ok. |
|
1628 | 1632 | // Individual updates (ajax call). |
1629 | 1633 | return true; |
1630 | 1634 | } |
@@ -2226,7 +2226,7 @@ |
||
2226 | 2226 | * |
2227 | 2227 | * @since 2.5.0 |
2228 | 2228 | * |
2229 | - * @return array CSS classnames. |
|
2229 | + * @return string[] CSS classnames. |
|
2230 | 2230 | */ |
2231 | 2231 | public function get_table_classes() { |
2232 | 2232 | return array( 'widefat', 'fixed' ); |
@@ -704,11 +704,11 @@ discard block |
||
704 | 704 | $args = apply_filters( |
705 | 705 | 'tgmpa_admin_menu_args', |
706 | 706 | array( |
707 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
708 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
709 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
710 | - 'capability' => $this->capability, // Capability. |
|
711 | - 'menu_slug' => $this->menu, // Menu slug. |
|
707 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
708 | + 'page_title' => $this->strings['page_title'], // Page title. |
|
709 | + 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
710 | + 'capability' => $this->capability, // Capability. |
|
711 | + 'menu_slug' => $this->menu, // Menu slug. |
|
712 | 712 | 'function' => array( $this, 'install_plugins_page' ), // Callback. |
713 | 713 | ) |
714 | 714 | ); |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | // All plugin information will be stored in an array for processing. |
811 | 811 | $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
812 | 812 | |
813 | - if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
813 | + if ( ! isset( $this->plugins[$slug] ) ) { |
|
814 | 814 | return false; |
815 | 815 | } |
816 | 816 | |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $extra = array(); |
856 | 856 | $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
857 | 857 | $source = $this->get_download_url( $slug ); |
858 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
858 | + $api = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
859 | 859 | $api = ( false !== $api ) ? $api : null; |
860 | 860 | |
861 | 861 | $url = add_query_arg( |
@@ -872,8 +872,8 @@ discard block |
||
872 | 872 | |
873 | 873 | $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
874 | 874 | $skin_args = array( |
875 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
876 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
875 | + 'type' => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload', |
|
876 | + 'title' => sprintf( $title, $this->plugins[$slug]['name'] ), |
|
877 | 877 | 'url' => esc_url_raw( $url ), |
878 | 878 | 'nonce' => $install_type . '-plugin_' . $slug, |
879 | 879 | 'plugin' => '', |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | unset( $title ); |
884 | 884 | |
885 | 885 | if ( 'update' === $install_type ) { |
886 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
886 | + $skin_args['plugin'] = $this->plugins[$slug]['file_path']; |
|
887 | 887 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
888 | 888 | } else { |
889 | 889 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | if ( 'update' === $install_type ) { |
899 | 899 | // Inject our info into the update transient. |
900 | 900 | $to_inject = array( |
901 | - $slug => $this->plugins[ $slug ], |
|
901 | + $slug => $this->plugins[$slug], |
|
902 | 902 | ); |
903 | - $to_inject[ $slug ]['source'] = $source; |
|
903 | + $to_inject[$slug]['source'] = $source; |
|
904 | 904 | $this->inject_update_info( $to_inject ); |
905 | 905 | |
906 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
906 | + $upgrader->upgrade( $this->plugins[$slug]['file_path'] ); |
|
907 | 907 | } else { |
908 | 908 | $upgrader->install( $source ); |
909 | 909 | } |
@@ -933,11 +933,11 @@ discard block |
||
933 | 933 | } |
934 | 934 | |
935 | 935 | return true; |
936 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
936 | + } elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
937 | 937 | // Activate action link was clicked. |
938 | 938 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
939 | 939 | |
940 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
940 | + if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) { |
|
941 | 941 | return true; // Finish execution of the function early as we encountered an error. |
942 | 942 | } |
943 | 943 | } |
@@ -962,17 +962,17 @@ discard block |
||
962 | 962 | foreach ( $plugins as $slug => $plugin ) { |
963 | 963 | $file_path = $plugin['file_path']; |
964 | 964 | |
965 | - if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
966 | - $repo_updates->response[ $file_path ] = new stdClass(); |
|
965 | + if ( empty( $repo_updates->response[$file_path] ) ) { |
|
966 | + $repo_updates->response[$file_path] = new stdClass(); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | // We only really need to set package, but let's do all we can in case WP changes something. |
970 | - $repo_updates->response[ $file_path ]->slug = $slug; |
|
971 | - $repo_updates->response[ $file_path ]->plugin = $file_path; |
|
972 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
973 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
974 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
975 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
970 | + $repo_updates->response[$file_path]->slug = $slug; |
|
971 | + $repo_updates->response[$file_path]->plugin = $file_path; |
|
972 | + $repo_updates->response[$file_path]->new_version = $plugin['version']; |
|
973 | + $repo_updates->response[$file_path]->package = $plugin['source']; |
|
974 | + if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
975 | + $repo_updates->response[$file_path]->url = $plugin['external_url']; |
|
976 | 976 | } |
977 | 977 | } |
978 | 978 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | } else { |
1016 | 1016 | // Bulk installer contains less info, so fall back on the info registered here. |
1017 | 1017 | foreach ( $this->plugins as $slug => $plugin ) { |
1018 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
1018 | + if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) { |
|
1019 | 1019 | $desired_slug = $slug; |
1020 | 1020 | break; |
1021 | 1021 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | // Make sure message doesn't display again if bulk activation is performed |
1083 | 1083 | // immediately after a single activation. |
1084 | 1084 | if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
1085 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
1085 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>'; |
|
1086 | 1086 | } |
1087 | 1087 | } else { |
1088 | 1088 | // Simpler message layout for use on the plugin install page. |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | echo '<div id="message" class="error"><p>', |
1096 | 1096 | sprintf( |
1097 | 1097 | esc_html( $this->strings['plugin_already_active'] ), |
1098 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1098 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1099 | 1099 | ), |
1100 | 1100 | '</p></div>'; |
1101 | 1101 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
@@ -1106,13 +1106,13 @@ discard block |
||
1106 | 1106 | echo '<div id="message" class="error"><p>', |
1107 | 1107 | sprintf( |
1108 | 1108 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
1109 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1109 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1110 | 1110 | ), |
1111 | 1111 | '</p></div>'; |
1112 | 1112 | } |
1113 | 1113 | } else { |
1114 | 1114 | // Simpler message layout for use on the plugin install page. |
1115 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1115 | + echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>'; |
|
1116 | 1116 | } |
1117 | 1117 | } |
1118 | 1118 | |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | $rendered .= sprintf( |
1240 | 1240 | $line_template, |
1241 | 1241 | sprintf( |
1242 | - translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ), |
|
1242 | + translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ), |
|
1243 | 1243 | $imploded, |
1244 | 1244 | $count |
1245 | 1245 | ) |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | |
1357 | 1357 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1358 | 1358 | if ( 'tgmpa' === $details['setting'] ) { |
1359 | - unset( $wp_settings_errors[ $key ] ); |
|
1359 | + unset( $wp_settings_errors[$key] ); |
|
1360 | 1360 | break; |
1361 | 1361 | } |
1362 | 1362 | } |
@@ -1392,20 +1392,20 @@ discard block |
||
1392 | 1392 | return; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1395 | + if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) { |
|
1396 | 1396 | return; |
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | $defaults = array( |
1400 | - 'name' => '', // String |
|
1401 | - 'slug' => '', // String |
|
1402 | - 'source' => 'repo', // String |
|
1403 | - 'required' => false, // Boolean |
|
1404 | - 'version' => '', // String |
|
1405 | - 'force_activation' => false, // Boolean |
|
1406 | - 'force_deactivation' => false, // Boolean |
|
1407 | - 'external_url' => '', // String |
|
1408 | - 'is_callable' => '', // String|Array. |
|
1400 | + 'name' => '', // String |
|
1401 | + 'slug' => '', // String |
|
1402 | + 'source' => 'repo', // String |
|
1403 | + 'required' => false, // Boolean |
|
1404 | + 'version' => '', // String |
|
1405 | + 'force_activation' => false, // Boolean |
|
1406 | + 'force_deactivation' => false, // Boolean |
|
1407 | + 'external_url' => '', // String |
|
1408 | + 'is_callable' => '', // String|Array. |
|
1409 | 1409 | ); |
1410 | 1410 | |
1411 | 1411 | // Prepare the received data. |
@@ -1426,8 +1426,8 @@ discard block |
||
1426 | 1426 | $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
1427 | 1427 | |
1428 | 1428 | // Set the class properties. |
1429 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1430 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1429 | + $this->plugins[$plugin['slug']] = $plugin; |
|
1430 | + $this->sort_order[$plugin['slug']] = $plugin['name']; |
|
1431 | 1431 | |
1432 | 1432 | // Should we add the force activation hook ? |
1433 | 1433 | if ( true === $plugin['force_activation'] ) { |
@@ -1511,11 +1511,11 @@ discard block |
||
1511 | 1511 | ); |
1512 | 1512 | |
1513 | 1513 | foreach ( $keys as $key ) { |
1514 | - if ( isset( $config[ $key ] ) ) { |
|
1515 | - if ( is_array( $config[ $key ] ) ) { |
|
1516 | - $this->$key = array_merge( $this->$key, $config[ $key ] ); |
|
1514 | + if ( isset( $config[$key] ) ) { |
|
1515 | + if ( is_array( $config[$key] ) ) { |
|
1516 | + $this->$key = array_merge( $this->$key, $config[$key] ); |
|
1517 | 1517 | } else { |
1518 | - $this->$key = $config[ $key ]; |
|
1518 | + $this->$key = $config[$key]; |
|
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | } |
@@ -1560,12 +1560,12 @@ discard block |
||
1560 | 1560 | * Parameter added in v2.5.0. |
1561 | 1561 | */ |
1562 | 1562 | public function populate_file_path( $plugin_slug = '' ) { |
1563 | - if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1564 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1563 | + if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) { |
|
1564 | + $this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1565 | 1565 | } else { |
1566 | 1566 | // Add file_path key for all plugins. |
1567 | 1567 | foreach ( $this->plugins as $slug => $values ) { |
1568 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1568 | + $this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | } |
@@ -1605,8 +1605,8 @@ discard block |
||
1605 | 1605 | */ |
1606 | 1606 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1607 | 1607 | foreach ( $this->plugins as $values ) { |
1608 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1609 | - return $values[ $data ]; |
|
1608 | + if ( $name === $values['name'] && isset( $values[$data] ) ) { |
|
1609 | + return $values[$data]; |
|
1610 | 1610 | } |
1611 | 1611 | } |
1612 | 1612 | |
@@ -1624,13 +1624,13 @@ discard block |
||
1624 | 1624 | public function get_download_url( $slug ) { |
1625 | 1625 | $dl_source = ''; |
1626 | 1626 | |
1627 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1627 | + switch ( $this->plugins[$slug]['source_type'] ) { |
|
1628 | 1628 | case 'repo': |
1629 | 1629 | return $this->get_wp_repo_download_url( $slug ); |
1630 | 1630 | case 'external': |
1631 | - return $this->plugins[ $slug ]['source']; |
|
1631 | + return $this->plugins[$slug]['source']; |
|
1632 | 1632 | case 'bundled': |
1633 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1633 | + return $this->default_path . $this->plugins[$slug]['source']; |
|
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | return $dl_source; // Should never happen. |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | protected function get_plugins_api( $slug ) { |
1667 | 1667 | static $api = array(); // Cache received responses. |
1668 | 1668 | |
1669 | - if ( ! isset( $api[ $slug ] ) ) { |
|
1669 | + if ( ! isset( $api[$slug] ) ) { |
|
1670 | 1670 | if ( ! function_exists( 'plugins_api' ) ) { |
1671 | 1671 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
1672 | 1672 | } |
@@ -1681,16 +1681,16 @@ discard block |
||
1681 | 1681 | ) |
1682 | 1682 | ); |
1683 | 1683 | |
1684 | - $api[ $slug ] = false; |
|
1684 | + $api[$slug] = false; |
|
1685 | 1685 | |
1686 | 1686 | if ( is_wp_error( $response ) ) { |
1687 | 1687 | wp_die( esc_html( $this->strings['oops'] ) ); |
1688 | 1688 | } else { |
1689 | - $api[ $slug ] = $response; |
|
1689 | + $api[$slug] = $response; |
|
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | |
1693 | - return $api[ $slug ]; |
|
1693 | + return $api[$slug]; |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | /** |
@@ -1703,13 +1703,13 @@ discard block |
||
1703 | 1703 | * or the plugin name if not. |
1704 | 1704 | */ |
1705 | 1705 | public function get_info_link( $slug ) { |
1706 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1706 | + if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) { |
|
1707 | 1707 | $link = sprintf( |
1708 | 1708 | '<a href="%1$s" target="_blank">%2$s</a>', |
1709 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1710 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1709 | + esc_url( $this->plugins[$slug]['external_url'] ), |
|
1710 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1711 | 1711 | ); |
1712 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1712 | + } elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) { |
|
1713 | 1713 | $url = add_query_arg( |
1714 | 1714 | array( |
1715 | 1715 | 'tab' => 'plugin-information', |
@@ -1724,10 +1724,10 @@ discard block |
||
1724 | 1724 | $link = sprintf( |
1725 | 1725 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1726 | 1726 | esc_url( $url ), |
1727 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1727 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1728 | 1728 | ); |
1729 | 1729 | } else { |
1730 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1730 | + $link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink. |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | 1733 | return $link; |
@@ -1852,7 +1852,7 @@ discard block |
||
1852 | 1852 | public function is_plugin_installed( $slug ) { |
1853 | 1853 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1854 | 1854 | |
1855 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1855 | + return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) ); |
|
1856 | 1856 | } |
1857 | 1857 | |
1858 | 1858 | /** |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | * @return bool True if active, false otherwise. |
1865 | 1865 | */ |
1866 | 1866 | public function is_plugin_active( $slug ) { |
1867 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1867 | + return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) ); |
|
1868 | 1868 | } |
1869 | 1869 | |
1870 | 1870 | /** |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | */ |
1879 | 1879 | public function can_plugin_update( $slug ) { |
1880 | 1880 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1881 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1881 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1882 | 1882 | return true; |
1883 | 1883 | } |
1884 | 1884 | |
@@ -1934,8 +1934,8 @@ discard block |
||
1934 | 1934 | public function get_installed_version( $slug ) { |
1935 | 1935 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1936 | 1936 | |
1937 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1938 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1937 | + if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) { |
|
1938 | + return $installed_plugins[$this->plugins[$slug]['file_path']]['Version']; |
|
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | return ''; |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | */ |
1952 | 1952 | public function does_plugin_require_update( $slug ) { |
1953 | 1953 | $installed_version = $this->get_installed_version( $slug ); |
1954 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1954 | + $minimum_version = $this->plugins[$slug]['version']; |
|
1955 | 1955 | |
1956 | 1956 | return version_compare( $minimum_version, $installed_version, '>' ); |
1957 | 1957 | } |
@@ -1966,9 +1966,9 @@ discard block |
||
1966 | 1966 | */ |
1967 | 1967 | public function does_plugin_have_update( $slug ) { |
1968 | 1968 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1969 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1969 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1970 | 1970 | if ( $this->does_plugin_require_update( $slug ) ) { |
1971 | - return $this->plugins[ $slug ]['version']; |
|
1971 | + return $this->plugins[$slug]['version']; |
|
1972 | 1972 | } |
1973 | 1973 | |
1974 | 1974 | return false; |
@@ -1976,8 +1976,8 @@ discard block |
||
1976 | 1976 | |
1977 | 1977 | $repo_updates = get_site_transient( 'update_plugins' ); |
1978 | 1978 | |
1979 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1980 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1979 | + if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) { |
|
1980 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version; |
|
1981 | 1981 | } |
1982 | 1982 | |
1983 | 1983 | return false; |
@@ -1993,14 +1993,14 @@ discard block |
||
1993 | 1993 | */ |
1994 | 1994 | public function get_upgrade_notice( $slug ) { |
1995 | 1995 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1996 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1996 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1997 | 1997 | return ''; |
1998 | 1998 | } |
1999 | 1999 | |
2000 | 2000 | $repo_updates = get_site_transient( 'update_plugins' ); |
2001 | 2001 | |
2002 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
2003 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
2002 | + if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) { |
|
2003 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice; |
|
2004 | 2004 | } |
2005 | 2005 | |
2006 | 2006 | return ''; |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | */ |
2085 | 2085 | if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) { |
2086 | 2086 | deactivate_plugins( $plugin['file_path'] ); |
2087 | - $deactivated[ $plugin['file_path'] ] = time(); |
|
2087 | + $deactivated[$plugin['file_path']] = time(); |
|
2088 | 2088 | } |
2089 | 2089 | } |
2090 | 2090 | |
@@ -2323,30 +2323,30 @@ discard block |
||
2323 | 2323 | $i = 0; |
2324 | 2324 | |
2325 | 2325 | // Redirect to the 'all' view if no plugins were found for the selected view context. |
2326 | - if ( empty( $plugins[ $this->view_context ] ) ) { |
|
2326 | + if ( empty( $plugins[$this->view_context] ) ) { |
|
2327 | 2327 | $this->view_context = 'all'; |
2328 | 2328 | } |
2329 | 2329 | |
2330 | - foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
2331 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
2332 | - $table_data[ $i ]['slug'] = $slug; |
|
2333 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2334 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2335 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2336 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
2337 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2338 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
2339 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2330 | + foreach ( $plugins[$this->view_context] as $slug => $plugin ) { |
|
2331 | + $table_data[$i]['sanitized_plugin'] = $plugin['name']; |
|
2332 | + $table_data[$i]['slug'] = $slug; |
|
2333 | + $table_data[$i]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
2334 | + $table_data[$i]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
2335 | + $table_data[$i]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
2336 | + $table_data[$i]['status'] = $this->get_plugin_status_text( $slug ); |
|
2337 | + $table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
2338 | + $table_data[$i]['minimum_version'] = $plugin['version']; |
|
2339 | + $table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
2340 | 2340 | |
2341 | 2341 | // Prep the upgrade notice info. |
2342 | 2342 | $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
2343 | 2343 | if ( ! empty( $upgrade_notice ) ) { |
2344 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
2344 | + $table_data[$i]['upgrade_notice'] = $upgrade_notice; |
|
2345 | 2345 | |
2346 | 2346 | add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
2347 | 2347 | } |
2348 | 2348 | |
2349 | - $table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin ); |
|
2349 | + $table_data[$i] = apply_filters( 'tgmpa_table_data_item', $table_data[$i], $plugin ); |
|
2350 | 2350 | |
2351 | 2351 | $i++; |
2352 | 2352 | } |
@@ -2372,17 +2372,17 @@ discard block |
||
2372 | 2372 | // No need to display plugins if they are installed, up-to-date and active. |
2373 | 2373 | continue; |
2374 | 2374 | } else { |
2375 | - $plugins['all'][ $slug ] = $plugin; |
|
2375 | + $plugins['all'][$slug] = $plugin; |
|
2376 | 2376 | |
2377 | 2377 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2378 | - $plugins['install'][ $slug ] = $plugin; |
|
2378 | + $plugins['install'][$slug] = $plugin; |
|
2379 | 2379 | } else { |
2380 | 2380 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2381 | - $plugins['update'][ $slug ] = $plugin; |
|
2381 | + $plugins['update'][$slug] = $plugin; |
|
2382 | 2382 | } |
2383 | 2383 | |
2384 | 2384 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
2385 | - $plugins['activate'][ $slug ] = $plugin; |
|
2385 | + $plugins['activate'][$slug] = $plugin; |
|
2386 | 2386 | } |
2387 | 2387 | } |
2388 | 2388 | } |
@@ -2400,7 +2400,7 @@ discard block |
||
2400 | 2400 | */ |
2401 | 2401 | protected function set_view_totals( $plugins ) { |
2402 | 2402 | foreach ( $plugins as $type => $list ) { |
2403 | - $this->view_totals[ $type ] = count( $list ); |
|
2403 | + $this->view_totals[$type] = count( $list ); |
|
2404 | 2404 | } |
2405 | 2405 | } |
2406 | 2406 | |
@@ -2502,8 +2502,8 @@ discard block |
||
2502 | 2502 | $name = array(); |
2503 | 2503 | |
2504 | 2504 | foreach ( $items as $i => $plugin ) { |
2505 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
2506 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
2505 | + $type[$i] = $plugin['type']; // Required / recommended. |
|
2506 | + $name[$i] = $plugin['sanitized_plugin']; |
|
2507 | 2507 | } |
2508 | 2508 | |
2509 | 2509 | array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | |
2551 | 2551 | if ( ! empty( $text ) ) { |
2552 | 2552 | |
2553 | - $status_links[ $type ] = sprintf( |
|
2553 | + $status_links[$type] = sprintf( |
|
2554 | 2554 | '<a href="%s"%s>%s</a>', |
2555 | 2555 | esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ), |
2556 | 2556 | ( $type === $this->view_context ) ? ' class="current"' : '', |
@@ -2573,7 +2573,7 @@ discard block |
||
2573 | 2573 | * @return string |
2574 | 2574 | */ |
2575 | 2575 | public function column_default( $item, $column_name ) { |
2576 | - return $item[ $column_name ]; |
|
2576 | + return $item[$column_name]; |
|
2577 | 2577 | } |
2578 | 2578 | |
2579 | 2579 | /** |
@@ -2773,7 +2773,7 @@ discard block |
||
2773 | 2773 | 'tgmpa-nonce' |
2774 | 2774 | ); |
2775 | 2775 | |
2776 | - $action_links[ $action ] = sprintf( |
|
2776 | + $action_links[$action] = sprintf( |
|
2777 | 2777 | '<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder. |
2778 | 2778 | esc_url( $nonce_url ), |
2779 | 2779 | '<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 | |
@@ -2988,7 +2988,7 @@ discard block |
||
2988 | 2988 | |
2989 | 2989 | // Prepare the data for validated plugins for the install/upgrade. |
2990 | 2990 | foreach ( $plugins_to_install as $slug ) { |
2991 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
2991 | + $name = $this->tgmpa->plugins[$slug]['name']; |
|
2992 | 2992 | $source = $this->tgmpa->get_download_url( $slug ); |
2993 | 2993 | |
2994 | 2994 | if ( ! empty( $name ) && ! empty( $source ) ) { |
@@ -3001,9 +3001,9 @@ discard block |
||
3001 | 3001 | break; |
3002 | 3002 | |
3003 | 3003 | case 'update': |
3004 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3005 | - $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
3006 | - $to_inject[ $slug ]['source'] = $source; |
|
3004 | + $file_paths[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
3005 | + $to_inject[$slug] = $this->tgmpa->plugins[$slug]; |
|
3006 | + $to_inject[$slug]['source'] = $source; |
|
3007 | 3007 | break; |
3008 | 3008 | } |
3009 | 3009 | } |
@@ -3070,8 +3070,8 @@ discard block |
||
3070 | 3070 | // Grab the file paths for the selected & inactive plugins from the registration array. |
3071 | 3071 | foreach ( $plugins as $slug ) { |
3072 | 3072 | if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
3073 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
3074 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
3073 | + $plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
3074 | + $plugin_names[] = $this->tgmpa->plugins[$slug]['name']; |
|
3075 | 3075 | } |
3076 | 3076 | } |
3077 | 3077 | unset( $slug ); |
@@ -3103,8 +3103,8 @@ discard block |
||
3103 | 3103 | // Update recently activated plugins option. |
3104 | 3104 | $recent = (array) get_option( 'recently_activated' ); |
3105 | 3105 | foreach ( $plugins_to_activate as $plugin => $time ) { |
3106 | - if ( isset( $recent[ $plugin ] ) ) { |
|
3107 | - unset( $recent[ $plugin ] ); |
|
3106 | + if ( isset( $recent[$plugin] ) ) { |
|
3107 | + unset( $recent[$plugin] ); |
|
3108 | 3108 | } |
3109 | 3109 | } |
3110 | 3110 | update_option( 'recently_activated', $recent ); |
@@ -3199,7 +3199,7 @@ discard block |
||
3199 | 3199 | * @since 2.2.0 |
3200 | 3200 | */ |
3201 | 3201 | |
3202 | -if( function_exists( 'add_action' ) ) { |
|
3202 | +if ( function_exists( 'add_action' ) ) { |
|
3203 | 3203 | |
3204 | 3204 | add_action( 'admin_init', 'tgmpa_load_bulk_installer' ); |
3205 | 3205 | |
@@ -3441,7 +3441,7 @@ discard block |
||
3441 | 3441 | ) |
3442 | 3442 | ); |
3443 | 3443 | |
3444 | - $results[ $plugin ] = $this->result; |
|
3444 | + $results[$plugin] = $this->result; |
|
3445 | 3445 | |
3446 | 3446 | // Prevent credentials auth screen from displaying multiple times. |
3447 | 3447 | if ( false === $result ) { |
@@ -3631,7 +3631,7 @@ discard block |
||
3631 | 3631 | 'names' => array(), |
3632 | 3632 | 'install_type' => 'install', |
3633 | 3633 | ); |
3634 | - $args = wp_parse_args( $args, $defaults ); |
|
3634 | + $args = wp_parse_args( $args, $defaults ); |
|
3635 | 3635 | |
3636 | 3636 | // Set plugin names to $this->plugin_names property. |
3637 | 3637 | $this->plugin_names = $args['names']; |
@@ -3693,7 +3693,7 @@ discard block |
||
3693 | 3693 | */ |
3694 | 3694 | public function before( $title = '' ) { |
3695 | 3695 | if ( empty( $title ) ) { |
3696 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3696 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3697 | 3697 | } |
3698 | 3698 | parent::before( $title ); |
3699 | 3699 | } |
@@ -3710,7 +3710,7 @@ discard block |
||
3710 | 3710 | */ |
3711 | 3711 | public function after( $title = '' ) { |
3712 | 3712 | if ( empty( $title ) ) { |
3713 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
3713 | + $title = esc_html( $this->plugin_names[$this->i] ); |
|
3714 | 3714 | } |
3715 | 3715 | parent::after( $title ); |
3716 | 3716 | |
@@ -3883,7 +3883,7 @@ discard block |
||
3883 | 3883 | */ |
3884 | 3884 | protected static function emulate_filter_bool( $value ) { |
3885 | 3885 | // @codingStandardsIgnoreStart |
3886 | - static $true = array( |
|
3886 | + static $true = array( |
|
3887 | 3887 | '1', |
3888 | 3888 | 'true', 'True', 'TRUE', |
3889 | 3889 | 'y', 'Y', |
@@ -121,16 +121,16 @@ |
||
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( |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | // All plugin information will be stored in an array for processing. |
770 | 770 | $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
771 | 771 | |
772 | - if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
772 | + if ( ! isset( $this->plugins[$slug] ) ) { |
|
773 | 773 | return false; |
774 | 774 | } |
775 | 775 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | $extra = array(); |
815 | 815 | $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
816 | 816 | $source = $this->get_download_url( $slug ); |
817 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
817 | + $api = ( 'repo' === $this->plugins[$slug]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
818 | 818 | $api = ( false !== $api ) ? $api : null; |
819 | 819 | |
820 | 820 | $url = add_query_arg( |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | |
832 | 832 | $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
833 | 833 | $skin_args = array( |
834 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
835 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
834 | + 'type' => ( 'bundled' !== $this->plugins[$slug]['source_type'] ) ? 'web' : 'upload', |
|
835 | + 'title' => sprintf( $title, $this->plugins[$slug]['name'] ), |
|
836 | 836 | 'url' => esc_url_raw( $url ), |
837 | 837 | 'nonce' => $install_type . '-plugin_' . $slug, |
838 | 838 | 'plugin' => '', |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | unset( $title ); |
843 | 843 | |
844 | 844 | if ( 'update' === $install_type ) { |
845 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
845 | + $skin_args['plugin'] = $this->plugins[$slug]['file_path']; |
|
846 | 846 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
847 | 847 | } else { |
848 | 848 | $skin = new Plugin_Installer_Skin( $skin_args ); |
@@ -857,12 +857,12 @@ discard block |
||
857 | 857 | if ( 'update' === $install_type ) { |
858 | 858 | // Inject our info into the update transient. |
859 | 859 | $to_inject = array( |
860 | - $slug => $this->plugins[ $slug ], |
|
860 | + $slug => $this->plugins[$slug], |
|
861 | 861 | ); |
862 | - $to_inject[ $slug ]['source'] = $source; |
|
862 | + $to_inject[$slug]['source'] = $source; |
|
863 | 863 | $this->inject_update_info( $to_inject ); |
864 | 864 | |
865 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
865 | + $upgrader->upgrade( $this->plugins[$slug]['file_path'] ); |
|
866 | 866 | } else { |
867 | 867 | $upgrader->install( $source ); |
868 | 868 | } |
@@ -892,11 +892,11 @@ discard block |
||
892 | 892 | } |
893 | 893 | |
894 | 894 | return true; |
895 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
895 | + } elseif ( isset( $this->plugins[$slug]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
896 | 896 | // Activate action link was clicked. |
897 | 897 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
898 | 898 | |
899 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
899 | + if ( false === $this->activate_single_plugin( $this->plugins[$slug]['file_path'], $slug ) ) { |
|
900 | 900 | return true; // Finish execution of the function early as we encountered an error. |
901 | 901 | } |
902 | 902 | } |
@@ -921,17 +921,17 @@ discard block |
||
921 | 921 | foreach ( $plugins as $slug => $plugin ) { |
922 | 922 | $file_path = $plugin['file_path']; |
923 | 923 | |
924 | - if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
925 | - $repo_updates->response[ $file_path ] = new stdClass(); |
|
924 | + if ( empty( $repo_updates->response[$file_path] ) ) { |
|
925 | + $repo_updates->response[$file_path] = new stdClass(); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | // We only really need to set package, but let's do all we can in case WP changes something. |
929 | - $repo_updates->response[ $file_path ]->slug = $slug; |
|
930 | - $repo_updates->response[ $file_path ]->plugin = $file_path; |
|
931 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
932 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
933 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
934 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
929 | + $repo_updates->response[$file_path]->slug = $slug; |
|
930 | + $repo_updates->response[$file_path]->plugin = $file_path; |
|
931 | + $repo_updates->response[$file_path]->new_version = $plugin['version']; |
|
932 | + $repo_updates->response[$file_path]->package = $plugin['source']; |
|
933 | + if ( empty( $repo_updates->response[$file_path]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
934 | + $repo_updates->response[$file_path]->url = $plugin['external_url']; |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | } else { |
975 | 975 | // Bulk installer contains less info, so fall back on the info registered here. |
976 | 976 | foreach ( $this->plugins as $slug => $plugin ) { |
977 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
977 | + if ( ! empty( $upgrader->skin->plugin_names[$upgrader->skin->i] ) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i] ) { |
|
978 | 978 | $desired_slug = $slug; |
979 | 979 | break; |
980 | 980 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | // Make sure message doesn't display again if bulk activation is performed |
1042 | 1042 | // immediately after a single activation. |
1043 | 1043 | if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
1044 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
1044 | + echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[$slug]['name'] ), '.</strong></p></div>'; |
|
1045 | 1045 | } |
1046 | 1046 | } else { |
1047 | 1047 | // Simpler message layout for use on the plugin install page. |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | echo '<div id="message" class="error"><p>', |
1055 | 1055 | sprintf( |
1056 | 1056 | esc_html( $this->strings['plugin_already_active'] ), |
1057 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1057 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1058 | 1058 | ), |
1059 | 1059 | '</p></div>'; |
1060 | 1060 | } elseif ( $this->does_plugin_require_update( $slug ) ) { |
@@ -1065,13 +1065,13 @@ discard block |
||
1065 | 1065 | echo '<div id="message" class="error"><p>', |
1066 | 1066 | sprintf( |
1067 | 1067 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
1068 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
1068 | + '<strong>' . esc_html( $this->plugins[$slug]['name'] ) . '</strong>' |
|
1069 | 1069 | ), |
1070 | 1070 | '</p></div>'; |
1071 | 1071 | } |
1072 | 1072 | } else { |
1073 | 1073 | // Simpler message layout for use on the plugin install page. |
1074 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
1074 | + echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[$slug]['name'] ) ), '</p>'; |
|
1075 | 1075 | } |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | $rendered .= sprintf( |
1199 | 1199 | $line_template, |
1200 | 1200 | sprintf( |
1201 | - translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ), |
|
1201 | + translate_nooped_plural( $this->strings[$type], $count, 'tgmpa' ), |
|
1202 | 1202 | $imploded, |
1203 | 1203 | $count |
1204 | 1204 | ) |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | foreach ( (array) $wp_settings_errors as $key => $details ) { |
1317 | 1317 | if ( 'tgmpa' === $details['setting'] ) { |
1318 | - unset( $wp_settings_errors[ $key ] ); |
|
1318 | + unset( $wp_settings_errors[$key] ); |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | } |
@@ -1351,20 +1351,20 @@ discard block |
||
1351 | 1351 | return; |
1352 | 1352 | } |
1353 | 1353 | |
1354 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
1354 | + if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[$plugin['slug']] ) ) { |
|
1355 | 1355 | return; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | $defaults = array( |
1359 | - 'name' => '', // String |
|
1360 | - 'slug' => '', // String |
|
1361 | - 'source' => 'repo', // String |
|
1362 | - 'required' => false, // Boolean |
|
1363 | - 'version' => '', // String |
|
1364 | - 'force_activation' => false, // Boolean |
|
1365 | - 'force_deactivation' => false, // Boolean |
|
1366 | - 'external_url' => '', // String |
|
1367 | - 'is_callable' => '', // String|Array. |
|
1359 | + 'name' => '', // String |
|
1360 | + 'slug' => '', // String |
|
1361 | + 'source' => 'repo', // String |
|
1362 | + 'required' => false, // Boolean |
|
1363 | + 'version' => '', // String |
|
1364 | + 'force_activation' => false, // Boolean |
|
1365 | + 'force_deactivation' => false, // Boolean |
|
1366 | + 'external_url' => '', // String |
|
1367 | + 'is_callable' => '', // String|Array. |
|
1368 | 1368 | ); |
1369 | 1369 | |
1370 | 1370 | // Prepare the received data. |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
1386 | 1386 | |
1387 | 1387 | // Set the class properties. |
1388 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
1389 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
1388 | + $this->plugins[$plugin['slug']] = $plugin; |
|
1389 | + $this->sort_order[$plugin['slug']] = $plugin['name']; |
|
1390 | 1390 | |
1391 | 1391 | // Should we add the force activation hook ? |
1392 | 1392 | if ( true === $plugin['force_activation'] ) { |
@@ -1470,11 +1470,11 @@ discard block |
||
1470 | 1470 | ); |
1471 | 1471 | |
1472 | 1472 | foreach ( $keys as $key ) { |
1473 | - if ( isset( $config[ $key ] ) ) { |
|
1474 | - if ( is_array( $config[ $key ] ) ) { |
|
1475 | - $this->$key = array_merge( $this->$key, $config[ $key ] ); |
|
1473 | + if ( isset( $config[$key] ) ) { |
|
1474 | + if ( is_array( $config[$key] ) ) { |
|
1475 | + $this->$key = array_merge( $this->$key, $config[$key] ); |
|
1476 | 1476 | } else { |
1477 | - $this->$key = $config[ $key ]; |
|
1477 | + $this->$key = $config[$key]; |
|
1478 | 1478 | } |
1479 | 1479 | } |
1480 | 1480 | } |
@@ -1519,12 +1519,12 @@ discard block |
||
1519 | 1519 | * Parameter added in v2.5.0. |
1520 | 1520 | */ |
1521 | 1521 | public function populate_file_path( $plugin_slug = '' ) { |
1522 | - if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
1523 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1522 | + if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[$plugin_slug] ) ) { |
|
1523 | + $this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
1524 | 1524 | } else { |
1525 | 1525 | // Add file_path key for all plugins. |
1526 | 1526 | foreach ( $this->plugins as $slug => $values ) { |
1527 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1527 | + $this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | 1530 | } |
@@ -1564,8 +1564,8 @@ discard block |
||
1564 | 1564 | */ |
1565 | 1565 | public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
1566 | 1566 | foreach ( $this->plugins as $values ) { |
1567 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
1568 | - return $values[ $data ]; |
|
1567 | + if ( $name === $values['name'] && isset( $values[$data] ) ) { |
|
1568 | + return $values[$data]; |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | |
@@ -1583,13 +1583,13 @@ discard block |
||
1583 | 1583 | public function get_download_url( $slug ) { |
1584 | 1584 | $dl_source = ''; |
1585 | 1585 | |
1586 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
1586 | + switch ( $this->plugins[$slug]['source_type'] ) { |
|
1587 | 1587 | case 'repo': |
1588 | 1588 | return $this->get_wp_repo_download_url( $slug ); |
1589 | 1589 | case 'external': |
1590 | - return $this->plugins[ $slug ]['source']; |
|
1590 | + return $this->plugins[$slug]['source']; |
|
1591 | 1591 | case 'bundled': |
1592 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
1592 | + return $this->default_path . $this->plugins[$slug]['source']; |
|
1593 | 1593 | } |
1594 | 1594 | |
1595 | 1595 | return $dl_source; // Should never happen. |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | protected function get_plugins_api( $slug ) { |
1626 | 1626 | static $api = array(); // Cache received responses. |
1627 | 1627 | |
1628 | - if ( ! isset( $api[ $slug ] ) ) { |
|
1628 | + if ( ! isset( $api[$slug] ) ) { |
|
1629 | 1629 | if ( ! function_exists( 'plugins_api' ) ) { |
1630 | 1630 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
1631 | 1631 | } |
@@ -1640,16 +1640,16 @@ discard block |
||
1640 | 1640 | ) |
1641 | 1641 | ); |
1642 | 1642 | |
1643 | - $api[ $slug ] = false; |
|
1643 | + $api[$slug] = false; |
|
1644 | 1644 | |
1645 | 1645 | if ( is_wp_error( $response ) ) { |
1646 | 1646 | wp_die( esc_html( $this->strings['oops'] ) ); |
1647 | 1647 | } else { |
1648 | - $api[ $slug ] = $response; |
|
1648 | + $api[$slug] = $response; |
|
1649 | 1649 | } |
1650 | 1650 | } |
1651 | 1651 | |
1652 | - return $api[ $slug ]; |
|
1652 | + return $api[$slug]; |
|
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | /** |
@@ -1662,13 +1662,13 @@ discard block |
||
1662 | 1662 | * or the plugin name if not. |
1663 | 1663 | */ |
1664 | 1664 | public function get_info_link( $slug ) { |
1665 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
1665 | + if ( ! empty( $this->plugins[$slug]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[$slug]['external_url'] ) ) { |
|
1666 | 1666 | $link = sprintf( |
1667 | 1667 | '<a href="%1$s" target="_blank">%2$s</a>', |
1668 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
1669 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1668 | + esc_url( $this->plugins[$slug]['external_url'] ), |
|
1669 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1670 | 1670 | ); |
1671 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1671 | + } elseif ( 'repo' === $this->plugins[$slug]['source_type'] ) { |
|
1672 | 1672 | $url = add_query_arg( |
1673 | 1673 | array( |
1674 | 1674 | 'tab' => 'plugin-information', |
@@ -1683,10 +1683,10 @@ discard block |
||
1683 | 1683 | $link = sprintf( |
1684 | 1684 | '<a href="%1$s" class="thickbox">%2$s</a>', |
1685 | 1685 | esc_url( $url ), |
1686 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
1686 | + esc_html( $this->plugins[$slug]['name'] ) |
|
1687 | 1687 | ); |
1688 | 1688 | } else { |
1689 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
1689 | + $link = esc_html( $this->plugins[$slug]['name'] ); // No hyperlink. |
|
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | return $link; |
@@ -1811,7 +1811,7 @@ discard block |
||
1811 | 1811 | public function is_plugin_installed( $slug ) { |
1812 | 1812 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1813 | 1813 | |
1814 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
1814 | + return ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']] ) ); |
|
1815 | 1815 | } |
1816 | 1816 | |
1817 | 1817 | /** |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | * @return bool True if active, false otherwise. |
1824 | 1824 | */ |
1825 | 1825 | public function is_plugin_active( $slug ) { |
1826 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
1826 | + return ( ( ! empty( $this->plugins[$slug]['is_callable'] ) && is_callable( $this->plugins[$slug]['is_callable'] ) ) || is_plugin_active( $this->plugins[$slug]['file_path'] ) ); |
|
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | /** |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | */ |
1838 | 1838 | public function can_plugin_update( $slug ) { |
1839 | 1839 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1840 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1840 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1841 | 1841 | return true; |
1842 | 1842 | } |
1843 | 1843 | |
@@ -1893,8 +1893,8 @@ discard block |
||
1893 | 1893 | public function get_installed_version( $slug ) { |
1894 | 1894 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
1895 | 1895 | |
1896 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
1897 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
1896 | + if ( ! empty( $installed_plugins[$this->plugins[$slug]['file_path']]['Version'] ) ) { |
|
1897 | + return $installed_plugins[$this->plugins[$slug]['file_path']]['Version']; |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return ''; |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | */ |
1911 | 1911 | public function does_plugin_require_update( $slug ) { |
1912 | 1912 | $installed_version = $this->get_installed_version( $slug ); |
1913 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
1913 | + $minimum_version = $this->plugins[$slug]['version']; |
|
1914 | 1914 | |
1915 | 1915 | return version_compare( $minimum_version, $installed_version, '>' ); |
1916 | 1916 | } |
@@ -1925,9 +1925,9 @@ discard block |
||
1925 | 1925 | */ |
1926 | 1926 | public function does_plugin_have_update( $slug ) { |
1927 | 1927 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
1928 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1928 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1929 | 1929 | if ( $this->does_plugin_require_update( $slug ) ) { |
1930 | - return $this->plugins[ $slug ]['version']; |
|
1930 | + return $this->plugins[$slug]['version']; |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | 1933 | return false; |
@@ -1935,8 +1935,8 @@ discard block |
||
1935 | 1935 | |
1936 | 1936 | $repo_updates = get_site_transient( 'update_plugins' ); |
1937 | 1937 | |
1938 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
1939 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
1938 | + if ( isset( $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version ) ) { |
|
1939 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version; |
|
1940 | 1940 | } |
1941 | 1941 | |
1942 | 1942 | return false; |
@@ -1952,14 +1952,14 @@ discard block |
||
1952 | 1952 | */ |
1953 | 1953 | public function get_upgrade_notice( $slug ) { |
1954 | 1954 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
1955 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
1955 | + if ( 'repo' !== $this->plugins[$slug]['source_type'] ) { |
|
1956 | 1956 | return ''; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | 1959 | $repo_updates = get_site_transient( 'update_plugins' ); |
1960 | 1960 | |
1961 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
1962 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
1961 | + if ( ! empty( $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice ) ) { |
|
1962 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice; |
|
1963 | 1963 | } |
1964 | 1964 | |
1965 | 1965 | return ''; |
@@ -2043,7 +2043,7 @@ discard block |
||
2043 | 2043 | */ |
2044 | 2044 | if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) { |
2045 | 2045 | deactivate_plugins( $plugin['file_path'] ); |
2046 | - $deactivated[ $plugin['file_path'] ] = time(); |
|
2046 | + $deactivated[$plugin['file_path']] = time(); |
|
2047 | 2047 | } |
2048 | 2048 | } |
2049 | 2049 |
@@ -949,7 +949,8 @@ discard block |
||
949 | 949 | if ( ! $automatic ) { |
950 | 950 | // Make sure message doesn't display again if bulk activation is performed |
951 | 951 | // immediately after a single activation. |
952 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
952 | + if ( ! isset( $_POST['action'] ) ) { |
|
953 | +// WPCS: CSRF OK. |
|
953 | 954 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
954 | 955 | } |
955 | 956 | } else { |
@@ -970,7 +971,8 @@ discard block |
||
970 | 971 | if ( ! $automatic ) { |
971 | 972 | // Make sure message doesn't display again if bulk activation is performed |
972 | 973 | // immediately after a single activation. |
973 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
974 | + if ( ! isset( $_POST['action'] ) ) { |
|
975 | +// WPCS: CSRF OK. |
|
974 | 976 | echo '<div id="message" class="error"><p>', |
975 | 977 | sprintf( |
976 | 978 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -1621,10 +1623,12 @@ discard block |
||
1621 | 1623 | if ( 'update-core' === $screen->base ) { |
1622 | 1624 | // Core update screen. |
1623 | 1625 | return true; |
1624 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1626 | + } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1627 | +// WPCS: CSRF ok. |
|
1625 | 1628 | // Plugins bulk update screen. |
1626 | 1629 | return true; |
1627 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1630 | + } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1631 | +// WPCS: CSRF ok. |
|
1628 | 1632 | // Individual updates (ajax call). |
1629 | 1633 | return true; |
1630 | 1634 | } |