Permalink
Browse files

Update code & fix typos.

  • Loading branch information...
bradp committed Jan 9, 2019
1 parent ca0ef2a commit 6c8f4cdd977aa828096596a4aa5a5fc32fdb458a
@@ -1301,6 +1301,31 @@ ul.cat-checklist {
text-decoration: underline;
}

.plugins tr.paused th.check-column {
border-right: 4px solid #d54e21;
}

.plugins tr.paused th,
.plugins tr.paused td {
background-color: #fef7f1;
}

.plugins tr.paused .plugin-title,
.plugins .paused .dashicons-warning {
color: #dc3232;
}

.plugins .paused .error-display p,
.plugins .paused .error-display code {
font-size: 90%;
font-style: italic;
color: rgb( 0, 0, 0, 0.7 );
}

.plugins .resume-link {
color: #dc3232;
}

.plugin-card .update-now:before {
color: #f56e28;
content: "\f463";

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1301,6 +1301,31 @@ ul.cat-checklist {
text-decoration: underline;
}

.plugins tr.paused th.check-column {
border-left: 4px solid #d54e21;
}

.plugins tr.paused th,
.plugins tr.paused td {
background-color: #fef7f1;
}

.plugins tr.paused .plugin-title,
.plugins .paused .dashicons-warning {
color: #dc3232;
}

.plugins .paused .error-display p,
.plugins .paused .error-display code {
font-size: 90%;
font-style: italic;
color: rgb( 0, 0, 0, 0.7 );
}

.plugins .resume-link {
color: #dc3232;
}

.plugin-card .update-now:before {
color: #f56e28;
content: "\f463";

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -123,6 +123,8 @@
add_action( 'load-themes.php', 'wp_theme_update_rows', 20 ); // After wp_update_themes() is called.
add_action( 'admin_notices', 'update_nag', 3 );
add_action( 'admin_notices', 'paused_plugins_notice', 5 );
add_action( 'admin_notices', 'paused_themes_notice', 5 );
add_action( 'admin_notices', 'maintenance_nag', 10 );
add_filter( 'update_footer', 'core_update_footer' );
@@ -40,7 +40,7 @@ public function __construct( $args = array() ) {
);
$status = 'all';
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) {
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ) ) ) {
$status = $_REQUEST['plugin_status'];
}
@@ -99,6 +99,7 @@ public function prepare_items() {
'upgrade' => array(),
'mustuse' => array(),
'dropins' => array(),
'paused' => array(),
);
$screen = $this->screen;
@@ -209,6 +210,9 @@ public function prepare_items() {
if ( $show_network_active ) {
// On the non-network screen, show network-active plugins if allowed
$plugins['active'][ $plugin_file ] = $plugin_data;
if ( is_plugin_paused( $plugin_file ) ) {
$plugins['paused'][ $plugin_file ] = $plugin_data;
}
} else {
// On the non-network screen, filter out network-active plugins
unset( $plugins['all'][ $plugin_file ] );
@@ -218,6 +222,9 @@ public function prepare_items() {
// On the non-network screen, populate the active list with plugins that are individually activated
// On the network-admin screen, populate the active list with plugins that are network activated
$plugins['active'][ $plugin_file ] = $plugin_data;
if ( is_plugin_paused( $plugin_file ) ) {
$plugins['paused'][ $plugin_file ] = $plugin_data;
}
} else {
if ( isset( $recently_activated[ $plugin_file ] ) ) {
// Populate the recently activated list with plugins that have been recently activated
@@ -438,6 +445,10 @@ protected function get_views() {
case 'dropins':
$text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
break;
case 'paused':
/* translators: %s: plugin count */
$text = _n( 'Paused <span class="count">(%s)</span>', 'Paused <span class="count">(%s)</span>', $count );
break;
case 'upgrade':
$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
break;
@@ -625,11 +636,19 @@ public function single_row( $item ) {
/* translators: %s: plugin name */
$actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
}
if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>';
}
} else {
if ( current_user_can( 'manage_network_plugins' ) ) {
/* translators: %s: plugin name */
$actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
}
if ( current_user_can( 'manage_network_plugins' ) && count_paused_plugin_sites_for_network( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Resume' ) . '</a>';
}
if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
@@ -640,6 +659,10 @@ public function single_row( $item ) {
$actions = array(
'network_active' => __( 'Network Active' ),
);
if ( ! $restrict_network_only && current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}
} elseif ( $restrict_network_only ) {
$actions = array(
'network_only' => __( 'Network Only' ),
@@ -649,6 +672,10 @@ public function single_row( $item ) {
/* translators: %s: plugin name */
$actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
}
if ( current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}
} else {
if ( current_user_can( 'activate_plugin', $plugin_file ) ) {
/* translators: %s: plugin name */
@@ -755,6 +782,12 @@ public function single_row( $item ) {
$class .= ' update';
}
$paused = is_plugin_paused( $plugin_file );
$paused_on_network_sites_count = $screen->in_admin( 'network' ) ? count_paused_plugin_sites_for_network( $plugin_file ) : 0;
if ( $paused || $paused_on_network_sites_count ) {
$class .= ' paused';
}
$plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name );
printf(
'<tr class="%s" data-slug="%s" data-plugin="%s">',
@@ -833,12 +866,54 @@ public function single_row( $item ) {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search'.
* 'Drop-ins', 'Search', 'Paused'.
*/
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
echo implode( ' | ', $plugin_meta );
echo '</div></td>';
echo '</div>';
if ( $paused || $paused_on_network_sites_count ) {
$notice_text = __( 'This plugin failed to load properly and was paused within the admin backend.' );
if ( $screen->in_admin( 'network' ) && $paused_on_network_sites_count ) {
$notice_text = sprintf(
/* translators: %s: number of sites */
_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 ),
number_format_i18n( $paused_on_network_sites_count )
);
}
printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text );
$error = wp_get_plugin_error( $plugin_file );
if ( false !== $error ) {
$constants = get_defined_constants( true );
$constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];
foreach ( $constants as $constant => $value ) {
if ( 0 === strpos( $constant, 'E_' ) ) {
$core_errors[ $value ] = $constant;
}
}
$error['type'] = $core_errors[ $error['type'] ];
printf(
'<div class="error-display"><p>%s</p></div>',
sprintf(
/* translators: 1: error type, 2: error line number, 3: error file name, 4: error message */
__( 'The plugin caused an error of type %1$s in line %2$s of the file %3$s. Error message: %4$s' ),
"<code>{$error['type']}</code>",
"<code>{$error['line']}</code>",
"<code>{$error['file']}</code>",
"<code>{$error['message']}</code>"
)
);
}
}
echo '</td>';
break;
default:
$classes = "$column_name column-$column_name $class";
@@ -871,7 +946,7 @@ public function single_row( $item ) {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search'.
* 'Drop-ins', 'Search', 'Paused'.
*/
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
@@ -887,7 +962,7 @@ public function single_row( $item ) {
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search'.
* 'Drop-ins', 'Search', 'Paused'.
*/
do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
}
Oops, something went wrong.

0 comments on commit 6c8f4cd

Please sign in to comment.