diff --git a/src/css/manage.scss b/src/css/manage.scss index f3a4a373..173c5596 100644 --- a/src/css/manage.scss +++ b/src/css/manage.scss @@ -137,6 +137,26 @@ #wpbody-content & .column-name { white-space: nowrap; /* prevents wrapping of snippet title */ } + + td.column-date, th.column-date { + white-space: nowrap; + inline-size: 130px; /* fixed column width */ + min-inline-size: 130px; + max-inline-size: 130px; + text-align: right; + padding-inline-start: 8px; + padding-inline-end: 8px; + overflow: hidden; + text-overflow: ellipsis; + } + + /* Ensure the name column can shrink/ellipsis instead of pushing the date. */ + td.column-name, th.column-name { + max-inline-size: calc(100% - 140px); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } td.column-description { diff --git a/src/php/admin-menus/class-import-menu.php b/src/php/admin-menus/class-import-menu.php index 3c3b2565..5c018342 100644 --- a/src/php/admin-menus/class-import-menu.php +++ b/src/php/admin-menus/class-import-menu.php @@ -128,30 +128,36 @@ protected function print_messages() { echo '
'; } - if ( isset( $_REQUEST['imported'] ) ) { - echo ''; - - $imported = intval( $_REQUEST['imported'] ); - - if ( 0 === $imported ) { - esc_html_e( 'No snippets were imported.', 'code-snippets' ); - - } else { - /* translators: %d: amount of snippets imported */ - printf( - _n( - 'Successfully imported %d snippet.', - 'Successfully imported %d snippets.', - $imported, - 'code-snippets' - ), - '' . number_format_i18n( $imported ) . '', - ); - - printf( - ' %s', - esc_url( code_snippets()->get_menu_url( 'manage' ) ), - esc_html__( 'Have fun!', 'code-snippets' ) + if ( isset( $_REQUEST['imported'] ) ) { + echo '
';
+
+ $imported = intval( $_REQUEST['imported'] );
+
+ if ( 0 === $imported ) {
+ esc_html_e( 'No snippets were imported.', 'code-snippets' );
+
+ } else {
+ $imported_count = sprintf( '%s', esc_html( number_format_i18n( $imported ) ) );
+ printf(
+ '%s',
+ wp_kses_post(
+ sprintf(
+ /* translators: %s: number of snippets imported. */
+ _n(
+ 'Successfully imported %s snippet.',
+ 'Successfully imported %s snippets.',
+ $imported,
+ 'code-snippets'
+ ),
+ $imported_count
+ )
+ )
+ );
+
+ printf(
+ ' %s',
+ esc_url( code_snippets()->get_menu_url( 'manage' ) ),
+ esc_html__( 'Have fun!', 'code-snippets' )
);
}
diff --git a/src/php/class-list-table.php b/src/php/class-list-table.php
index 41ed1379..bdae02de 100644
--- a/src/php/class-list-table.php
+++ b/src/php/class-list-table.php
@@ -618,17 +618,21 @@ public function get_views(): array {
continue 2;
}
- $shared_label_template = $this->is_network
- ? _n_noop(
+ if ( $this->is_network ) {
+ /* translators: %s: total number of snippets shared with subsites. */
+ $shared_label_template = _n_noop(
'Shared with Subsites (%s)',
'Shared with Subsites (%s)',
'code-snippets'
- )
- : _n_noop(
+ );
+ } else {
+ /* translators: %s: total number of network snippets. */
+ $shared_label_template = _n_noop(
'Network Snippets (%s)',
'Network Snippets (%s)',
'code-snippets'
);
+ }
$template = translate_nooped_plural( $shared_label_template, $count, 'code-snippets' );
break;
@@ -663,16 +667,16 @@ public function get_views(): array {
* @since 2.0
*/
public function get_current_tags() {
- global $snippets, $status;
+ global $code_snippets_snippets, $status;
// If we're not viewing a snippets table, get all used tags instead.
- if ( ! isset( $snippets, $status ) ) {
+ if ( ! isset( $code_snippets_snippets, $status ) ) {
$tags = get_all_snippet_tags();
} else {
$tags = array();
// Merge all tags into a single array.
- foreach ( $snippets[ $status ] as $snippet ) {
+ foreach ( $code_snippets_snippets[ $status ] as $snippet ) {
$tags = array_merge( $snippet->tags, $tags );
}
@@ -1088,12 +1092,12 @@ public function prepare_items() {
/**
* Global variables.
*
- * @var string $status Current status view.
- * @var array
process_description( $item->description ) ); ?>
- All Snippets page to activate the imported snippets.', 'code-snippets' ); - $url = esc_url( code_snippets()->get_menu_url( 'manage' ) ); - - echo wp_kses( - sprintf( $text, $url ), - array( - 'a' => array( - 'href' => array(), - 'target' => array(), +
+ All Snippets page to activate the imported snippets.', 'code-snippets' ); + $code_snippets_manage_url = esc_url( code_snippets()->get_menu_url( 'manage' ) ); + + echo wp_kses( + sprintf( $code_snippets_import_notice, $code_snippets_manage_url ), + array( + 'a' => array( + 'href' => array(), + 'target' => array(), ), ) ); @@ -98,17 +99,17 @@
++ + + + + +
+ __( 'All Snippets', 'code-snippets' ) ], Plugin::get_types() ); -$current_type = $this->get_current_type(); +$code_snippets_types = array_merge( [ 'all' => __( 'All Snippets', 'code-snippets' ) ], Plugin::get_types() ); +$code_snippets_current_type = $this->get_current_type(); if ( false !== strpos( code_snippets()->version, 'beta' ) ) { echo ''; @@ -54,9 +54,9 @@ print_messages(); ?>
%s %s
', - esc_html( $info[0] ), - esc_url( $info[2] ), - esc_html( $info[1] ) - ); - } + printf( + '%s %s
', + esc_html( $code_snippets_current_type_info[0] ), + esc_url( $code_snippets_current_type_info[2] ), + esc_html( $code_snippets_current_type_info[1] ) + ); + } do_action( 'code_snippets/admin/manage/before_list_table' ); $this->list_table->views(); - switch ( $current_type ) { - case 'cloud_search': - include_once 'partials/cloud-search.php'; - break; + switch ( $code_snippets_current_type ) { + case 'cloud_search': + include_once 'partials/cloud-search.php'; + break; - default: - include_once 'partials/list-table.php'; - break; - } + default: + include_once 'partials/list-table.php'; + break; + } - do_action( 'code_snippets/admin/manage', $current_type ); + do_action( 'code_snippets/admin/manage', $code_snippets_current_type ); ?>