- Timestamp:
- 01/09/2019 08:04:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r43571 r44524 41 41 42 42 $status = 'all'; 43 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) {43 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ) ) ) { 44 44 $status = $_REQUEST['plugin_status']; 45 45 } … … 100 100 'mustuse' => array(), 101 101 'dropins' => array(), 102 'paused' => array(), 102 103 ); 103 104 … … 210 211 // On the non-network screen, show network-active plugins if allowed 211 212 $plugins['active'][ $plugin_file ] = $plugin_data; 213 if ( is_plugin_paused( $plugin_file ) ) { 214 $plugins['paused'][ $plugin_file ] = $plugin_data; 215 } 212 216 } else { 213 217 // On the non-network screen, filter out network-active plugins … … 219 223 // On the network-admin screen, populate the active list with plugins that are network activated 220 224 $plugins['active'][ $plugin_file ] = $plugin_data; 225 if ( is_plugin_paused( $plugin_file ) ) { 226 $plugins['paused'][ $plugin_file ] = $plugin_data; 227 } 221 228 } else { 222 229 if ( isset( $recently_activated[ $plugin_file ] ) ) { … … 438 445 case 'dropins': 439 446 $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); 447 break; 448 case 'paused': 449 /* translators: %s: plugin count */ 450 $text = _n( 'Paused <span class="count">(%s)</span>', 'Paused <span class="count">(%s)</span>', $count ); 440 451 break; 441 452 case 'upgrade': … … 626 637 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; 627 638 } 639 if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) { 640 /* translators: %s: plugin name */ 641 $actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>'; 642 } 628 643 } else { 629 644 if ( current_user_can( 'manage_network_plugins' ) ) { 630 645 /* translators: %s: plugin name */ 631 646 $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; 647 } 648 if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) { 649 /* translators: %s: plugin name */ 650 $actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>'; 632 651 } 633 652 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { … … 641 660 'network_active' => __( 'Network Active' ), 642 661 ); 662 if ( ! $restrict_network_only && current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) { 663 /* translators: %s: plugin name */ 664 $actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>'; 665 } 643 666 } elseif ( $restrict_network_only ) { 644 667 $actions = array( … … 649 672 /* translators: %s: plugin name */ 650 673 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; 674 } 675 if ( current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) { 676 /* translators: %s: plugin name */ 677 $actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>'; 651 678 } 652 679 } else { … … 754 781 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { 755 782 $class .= ' update'; 783 } 784 785 $paused = is_plugin_paused( $plugin_file ); 786 $paused_on_network_sites_count = $screen->in_admin( 'network' ) ? count_paused_plugin_sites_for_network( $plugin_file ) : 0; 787 if ( $paused || $paused_on_network_sites_count ) { 788 $class .= ' paused'; 756 789 } 757 790 … … 834 867 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 835 868 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 836 * 'Drop-ins', 'Search' .869 * 'Drop-ins', 'Search', 'Paused'. 837 870 */ 838 871 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); 839 872 echo implode( ' | ', $plugin_meta ); 840 873 841 echo '</div></td>'; 874 echo '</div>'; 875 876 if ( $paused || $paused_on_network_sites_count ) { 877 $notice_text = __( 'This plugin failed to load properly and was paused within the admin backend.' ); 878 if ( $screen->in_admin( 'network' ) && $paused_on_network_sites_count ) { 879 $notice_text = sprintf( 880 /* translators: %s: number of sites */ 881 _n( 'This plugin failed to load properly and was paused within the admin backend for %s site.', 'This plugin failed to load properly and was paused within the admin backend for %s sites.', $paused_on_network_sites_count ), 882 number_format_i18n( $paused_on_network_sites_count ) 883 ); 884 } 885 886 printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text ); 887 888 $error = wp_get_plugin_error( $plugin_file ); 889 890 if ( false !== $error ) { 891 $constants = get_defined_constants( true ); 892 $constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal']; 893 894 foreach ( $constants as $constant => $value ) { 895 if ( 0 === strpos( $constant, 'E_' ) ) { 896 $core_errors[ $value ] = $constant; 897 } 898 } 899 900 $error['type'] = $core_errors[ $error['type'] ]; 901 902 printf( 903 '<div class="error-display"><p>%s</p></div>', 904 sprintf( 905 /* translators: 1: error type, 2: error line number, 3: error file name, 4: error message */ 906 __( 'The plugin caused an error of type %1$s in line %2$s of the file %3$s. Error message: %4$s' ), 907 "<code>{$error['type']}</code>", 908 "<code>{$error['line']}</code>", 909 "<code>{$error['file']}</code>", 910 "<code>{$error['message']}</code>" 911 ) 912 ); 913 } 914 } 915 916 echo '</td>'; 842 917 break; 843 918 default: … … 872 947 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 873 948 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 874 * 'Drop-ins', 'Search' .949 * 'Drop-ins', 'Search', 'Paused'. 875 950 */ 876 951 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); … … 888 963 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 889 964 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 890 * 'Drop-ins', 'Search' .965 * 'Drop-ins', 'Search', 'Paused'. 891 966 */ 892 967 do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
Note: See TracChangeset
for help on using the changeset viewer.