- Timestamp:
- 01/30/2019 11:00:30 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r44541 r44717 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' , 'paused') ) ) {43 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) { 44 44 $status = $_REQUEST['plugin_status']; 45 45 } … … 100 100 'mustuse' => array(), 101 101 'dropins' => array(), 102 'paused' => array(),103 102 ); 104 103 … … 211 210 // On the non-network screen, show network-active plugins if allowed 212 211 $plugins['active'][ $plugin_file ] = $plugin_data; 213 if ( is_plugin_paused( $plugin_file ) ) {214 $plugins['paused'][ $plugin_file ] = $plugin_data;215 }216 212 } else { 217 213 // On the non-network screen, filter out network-active plugins … … 223 219 // On the network-admin screen, populate the active list with plugins that are network activated 224 220 $plugins['active'][ $plugin_file ] = $plugin_data; 225 if ( is_plugin_paused( $plugin_file ) ) {226 $plugins['paused'][ $plugin_file ] = $plugin_data;227 }228 221 } else { 229 222 if ( isset( $recently_activated[ $plugin_file ] ) ) { … … 453 446 $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); 454 447 break; 455 case 'paused':456 /* translators: %s: plugin count */457 $text = _n( 'Paused <span class="count">(%s)</span>', 'Paused <span class="count">(%s)</span>', $count );458 break;459 448 case 'upgrade': 460 449 /* translators: %s: plugin count */ … … 645 634 $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>'; 646 635 } 647 if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {648 /* translators: %s: plugin name */649 $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>';650 }651 636 } else { 652 637 if ( current_user_can( 'manage_network_plugins' ) ) { 653 638 /* translators: %s: plugin name */ 654 639 $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>'; 655 }656 if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {657 /* translators: %s: plugin name */658 $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>';659 640 } 660 641 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { … … 668 649 'network_active' => __( 'Network Active' ), 669 650 ); 670 if ( ! $restrict_network_only && current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {671 /* translators: %s: plugin name */672 $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>';673 }674 651 } elseif ( $restrict_network_only ) { 675 652 $actions = array( … … 681 658 $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>'; 682 659 } 683 if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {684 /* translators: %s: plugin name */685 $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>';686 }687 660 } else { 688 661 if ( current_user_can( 'activate_plugin', $plugin_file ) ) { … … 790 763 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { 791 764 $class .= ' update'; 792 }793 794 $paused = is_plugin_paused( $plugin_file );795 $paused_on_network_sites_count = $screen->in_admin( 'network' ) ? count_paused_plugin_sites_for_network( $plugin_file ) : 0;796 if ( $paused || $paused_on_network_sites_count ) {797 $class .= ' paused';798 765 } 799 766 … … 879 846 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 880 847 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 881 * 'Drop-ins', 'Search' , 'Paused'.848 * 'Drop-ins', 'Search'. 882 849 */ 883 850 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); … … 885 852 886 853 echo '</div>'; 887 888 if ( $paused || $paused_on_network_sites_count ) {889 $notice_text = __( 'This plugin failed to load properly and was paused within the admin backend.' );890 if ( $screen->in_admin( 'network' ) && $paused_on_network_sites_count ) {891 $notice_text = sprintf(892 /* translators: %s: number of sites */893 _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 ),894 number_format_i18n( $paused_on_network_sites_count )895 );896 }897 898 printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text );899 900 $error = wp_get_plugin_error( $plugin_file );901 902 if ( false !== $error ) {903 $constants = get_defined_constants( true );904 $constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];905 906 foreach ( $constants as $constant => $value ) {907 if ( 0 === strpos( $constant, 'E_' ) ) {908 $core_errors[ $value ] = $constant;909 }910 }911 912 $error['type'] = $core_errors[ $error['type'] ];913 914 printf(915 '<div class="error-display"><p>%s</p></div>',916 sprintf(917 /* translators: 1: error type, 2: error line number, 3: error file name, 4: error message */918 __( 'The plugin caused an error of type %1$s in line %2$s of the file %3$s. Error message: %4$s' ),919 "<code>{$error['type']}</code>",920 "<code>{$error['line']}</code>",921 "<code>{$error['file']}</code>",922 "<code>{$error['message']}</code>"923 )924 );925 }926 }927 854 928 855 echo '</td>'; … … 959 886 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 960 887 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 961 * 'Drop-ins', 'Search' , 'Paused'.888 * 'Drop-ins', 'Search'. 962 889 */ 963 890 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); … … 975 902 * @param string $status Status of the plugin. Defaults are 'All', 'Active', 976 903 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', 977 * 'Drop-ins', 'Search' , 'Paused'.904 * 'Drop-ins', 'Search'. 978 905 */ 979 906 do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
Note: See TracChangeset
for help on using the changeset viewer.