diff --git a/src/js/components/SnippetForm/SnippetEditor/SnippetEditor.tsx b/src/js/components/SnippetForm/SnippetEditor/SnippetEditor.tsx index 5873d2994..36b68a7cc 100644 --- a/src/js/components/SnippetForm/SnippetEditor/SnippetEditor.tsx +++ b/src/js/components/SnippetForm/SnippetEditor/SnippetEditor.tsx @@ -109,14 +109,12 @@ const SnippetTypeTabs: React.FC = ({ ? { event.preventDefault() openUpgradeDialog() }} > - {_x('Upgrade to ', 'Upgrade to Pro', 'code-snippets')} - {_x('Pro', 'Upgrade to Pro', 'code-snippets')} + {__('Upgrade to Pro', 'code-snippets')} : null} diff --git a/src/js/components/SnippetForm/fields/ScopeInput.tsx b/src/js/components/SnippetForm/fields/ScopeInput.tsx index 27f05b9d5..408fa9507 100644 --- a/src/js/components/SnippetForm/fields/ScopeInput.tsx +++ b/src/js/components/SnippetForm/fields/ScopeInput.tsx @@ -110,7 +110,7 @@ const ShortcodeInfo: React.FC = () => { : __('After saving, you can copy a shortcode, or use the Classic Editor button, Block editor (Pro) or Elementor widget (Pro).', 'code-snippets')} {' '} {__('Learn more', 'code-snippets')} diff --git a/src/php/admin-menus/class-import-menu.php b/src/php/admin-menus/class-import-menu.php index c321356a1..016bf3e9c 100644 --- a/src/php/admin-menus/class-import-menu.php +++ b/src/php/admin-menus/class-import-menu.php @@ -137,15 +137,22 @@ protected function print_messages() { esc_html_e( 'No snippets were imported.', 'code-snippets' ); } else { - /* translators: 1: amount of snippets imported, 2: link to Snippets menu */ - $text = _n( - 'Successfully imported %1$d snippet. Have fun!', - 'Successfully imported %1$d snippets. Have fun!', - $imported, - 'code-snippets' + /* translators: %d: amount of snippets imported */ + printf( + _n( + 'Successfully imported %d snippet.', + 'Successfully imported %d snippets.', + $imported, + 'code-snippets' + ), + '' . number_format_i18n(( $imported ) . '', ); - printf( wp_kses_post( $text ), esc_html( $imported ), esc_url( code_snippets()->get_menu_url( 'manage' ) ) ); + printf( + ' %s', + esc_url( code_snippets()->get_menu_url( 'manage' ) ) + esc_html__( 'Have fun!', 'code-snippets' ); + ); } echo '

'; diff --git a/src/php/class-admin.php b/src/php/class-admin.php index cc4f77ec1..bd0c60fff 100644 --- a/src/php/class-admin.php +++ b/src/php/class-admin.php @@ -110,13 +110,13 @@ public function plugin_action_links( array $actions, string $plugin_file ): arra sprintf( $format, esc_url( code_snippets()->get_menu_url( 'settings' ) ), - esc_html__( 'Change plugin settings', 'code-snippets' ), + esc_attr__( 'Change plugin settings', 'code-snippets' ), esc_html__( 'Settings', 'code-snippets' ) ), sprintf( $format, esc_url( code_snippets()->get_menu_url() ), - esc_html__( 'Manage your existing snippets', 'code-snippets' ), + esc_attr__( 'Manage your existing snippets', 'code-snippets' ), esc_html__( 'Snippets', 'code-snippets' ) ), ], @@ -128,7 +128,7 @@ public function plugin_action_links( array $actions, string $plugin_file ): arra '%3$s', 'https://snipco.de/JE2i', esc_attr__( 'Upgrade to Code Snippets Pro', 'code-snippets' ), - esc_html__( 'Get Pro', 'code-snippets' ) + esc_attr__( 'Upgrade to Pro', 'code-snippets' ) ); } return $actions; @@ -297,7 +297,7 @@ public function print_notices() { printf( '%s', esc_url( wp_nonce_url( add_query_arg( $meta_key, $notice ), $meta_key ) ), - esc_attr__( 'Dismiss', 'code-snippets' ) + esc_html__( 'Dismiss', 'code-snippets' ) ); echo '

'; diff --git a/src/php/class-contextual-help.php b/src/php/class-contextual-help.php index 8dc7156cd..80261324a 100644 --- a/src/php/class-contextual-help.php +++ b/src/php/class-contextual-help.php @@ -72,7 +72,7 @@ private function load_help_sidebar() { 'https://codesnippets.pro' => __( 'Plugin Website', 'code-snippets' ), ]; - $contents = '

' . __( 'For more information:', 'code-snippets' ) . "

\n"; + $contents = sprintf( "

%s

\n", esc_html__( 'For more information:', 'code-snippets' ) ); foreach ( $sidebar_links as $url => $label ) { $contents .= "\n" . sprintf( '

%s

', esc_url( $url ), esc_html( $label ) ); @@ -136,7 +136,8 @@ private function load_manage_help() { [ __( 'Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.', 'code-snippets' ), __( "If something goes wrong with a snippet, and you can't use WordPress, you can cause all snippets to stop executing by turning on safe mode.", 'code-snippets' ), - __( 'You can find out how to enable safe mode in the Code Snippets Pro Docs.', 'code-snippets' ), + /* translators: %s: URL to Code Snippets Pro Docs */ + sprintf( __( 'You can find out how to enable safe mode in the Code Snippets Pro Docs.', 'code-snippets' ), 'https://help.codesnippets.pro/article/12-safe-mode' ) ] ); } @@ -151,7 +152,8 @@ private function load_edit_help() { [ $this->get_intro_text() . __( 'Here you can add a new snippet, or edit an existing one.', 'code-snippets' ), - __( "If you're not sure about the types of snippets you can add, take a look at the Code Snippets Pro Docs for inspiration.", 'code-snippets' ), + /* translators: %s: URL to Code Snippets Pro Docs */ + sprintf( __( "If you're not sure about the types of snippets you can add, take a look at the Code Snippets Pro Docs for inspiration.", 'code-snippets' ), 'https://help.codesnippets.pro/collection/2-adding-snippets' ), ] ); @@ -160,7 +162,7 @@ private function load_edit_help() { __( 'Adding Snippets', 'code-snippets' ), [ __( 'You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.', 'code-snippets' ), - __( 'Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site.', 'code-snippets' ), + __( 'Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimize the chance of a faulty snippet becoming active on your site.', 'code-snippets' ), ] ); } diff --git a/src/php/class-list-table.php b/src/php/class-list-table.php index ecb020170..9ec9010d1 100644 --- a/src/php/class-list-table.php +++ b/src/php/class-list-table.php @@ -292,7 +292,7 @@ protected function column_activate( Snippet $snippet ): string { } return sprintf( - '  ', + '  ', esc_attr( $class ), esc_url( $this->get_action_link( $action, $snippet ) ), esc_attr( $label ) diff --git a/src/php/cloud/class-cloud-search-list-table.php b/src/php/cloud/class-cloud-search-list-table.php index 69068510c..1b22b0fa8 100644 --- a/src/php/cloud/class-cloud-search-list-table.php +++ b/src/php/cloud/class-cloud-search-list-table.php @@ -117,7 +117,7 @@ public function display_rows() { */ foreach ( $this->items as $item ) { ?> -
+
%s', + '%s %s', + esc_html__( 'Codevault:', 'code-snippets' ); esc_url( sprintf( 'https://codesnippets.cloud/codevault/%s', $item->codevault ) ), esc_html( $item->codevault ) ); - ?>

@@ -250,14 +248,22 @@ public function display_rows() {
- + ', esc_html__( 'Not indicated by author', 'code-snippets' ), ''; + printf( + '%s', + esc_html__( 'Not indicated by author', 'code-snippets' ) + ); } else { - // translators: tested status. - $text = sprintf( __( 'Author states %s', 'code-snippets' ), $wp_tested ); - echo '', esc_html( $text ), ''; + printf( + '%s', + sprintf( + // translators: %s: tested status. + __( 'Author states %s', 'code-snippets' ), + $wp_tested + ) + ); } ?>
diff --git a/src/php/cloud/list-table-shared-ops.php b/src/php/cloud/list-table-shared-ops.php index 2623f979f..1a6ab2bc7 100644 --- a/src/php/cloud/list-table-shared-ops.php +++ b/src/php/cloud/list-table-shared-ops.php @@ -125,7 +125,7 @@ function cloud_lts_build_action_links( Cloud_Snippet $cloud_snippet, string $sou $thickbox_url = '#TB_inline?&width=700&height=500&inlineId=show-code-preview'; $thickbox_link = sprintf( - '%s', + '%s', esc_url( $thickbox_url ), esc_attr( $cloud_snippet->name ), $additional_classes, @@ -224,7 +224,7 @@ function cloud_lts_pagination( string $which, string $source, int $total_items, $page_links[] = sprintf( '%s', esc_url( add_query_arg( $source . '_page', min( $total_pages, $current + 1 ), $current_url ) ), - __( 'Next page' ), + esc_html__( 'Next page', 'code-snippets' ), '›' ); } @@ -235,7 +235,7 @@ function cloud_lts_pagination( string $which, string $source, int $total_items, $page_links[] = sprintf( '%s', esc_url( add_query_arg( $source . '_page', $total_pages, $current_url ) ), - __( 'Last page', 'code-snippets' ), + esc_html__( 'Last page', 'code-snippets' ), '»' ); } diff --git a/src/php/front-end/class-front-end.php b/src/php/front-end/class-front-end.php index 21d823fc5..8d76ae8a9 100644 --- a/src/php/front-end/class-front-end.php +++ b/src/php/front-end/class-front-end.php @@ -303,11 +303,12 @@ public function render_content_shortcode( array $atts ): string { } /* translators: 1: snippet name, 2: snippet edit link */ - $text = __( '%1$s is currently inactive. You can edit this snippet to activate it and make it visible. This message will not appear in the published post.', 'code-snippets' ); - + $text = __( '%1$s is currently inactive. You can edit this snippet to activate it and make it visible. This message will not appear in the published post.', 'code-snippets' ); + $snippet_name = '' . $snippet->name . ''; $edit_url = add_query_arg( 'id', $snippet->id, code_snippets()->get_menu_url( 'edit' ) ); + return wp_kses( - sprintf( $text, $snippet->name, $edit_url ), + sprintf( $text, $snippet_name, $edit_url ), [ 'strong' => [], 'a' => [ diff --git a/src/php/views/manage.php b/src/php/views/manage.php index 8a76ac791..2e1572ecf 100644 --- a/src/php/views/manage.php +++ b/src/php/views/manage.php @@ -28,8 +28,11 @@ [ 'span' => [ 'class' => [ 'highlight-yellow' ] ] ] ); - $feedback_url = __( 'mailto:team@codesnippets.pro?subject=Code Snippet Beta Test Feedback', 'code-snippets' ); - printf( ' %s', esc_url( $feedback_url ), esc_html__( 'Click here to submit your feedback', 'code-snippets' ) ); + printf( + ' %s', + esc_url( __( 'mailto:team@codesnippets.pro?subject=Code Snippet Beta Test Feedback', 'code-snippets' ) ), + esc_html__( 'Click here to submit your feedback', 'code-snippets' ) + ); echo '

'; } @@ -58,7 +61,7 @@ ?> + aria-label=""> Pro', 'code-snippets' ), [ 'span' => [ 'class' => 'badge' ] ] ); ?> @@ -79,7 +82,7 @@ ], 'css' => [ __( 'Style snippets are written in CSS and loaded in the admin area or on the site front-end, just like the theme style.css.', 'code-snippets' ), - esc_html__( 'Learn more about style snippets →', 'code-snippets' ), + __( 'Learn more about style snippets →', 'code-snippets' ), 'https://codesnippets.pro/learn-css/', ], 'js' => [ diff --git a/src/php/views/partials/cloud-search.php b/src/php/views/partials/cloud-search.php index 29ee9b7a1..078399ed1 100644 --- a/src/php/views/partials/cloud-search.php +++ b/src/php/views/partials/cloud-search.php @@ -53,7 +53,7 @@ + placeholder="">