From 579994e318be6bdabc2e94481e7178fdbecc3afd Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Mon, 22 Jan 2024 11:49:31 +0200 Subject: [PATCH 01/19] Change textdomain --- .phpcs.xml.dist | 2 +- admin/admin.php | 24 ++++---- admin/views/comment-parent-box.php | 2 +- admin/views/config-page.php | 96 +++++++++++++++--------------- inc/clean-emails.php | 42 ++++++------- inc/email-links.php | 4 +- inc/forms.php | 2 +- inc/hacks.php | 20 +++---- inc/length.php | 2 +- package.json | 2 +- readme.txt | 2 +- yoast-comment-hacks.php | 2 +- 12 files changed, 100 insertions(+), 100 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 29e6e4c..e045110 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -65,7 +65,7 @@ - + diff --git a/admin/admin.php b/admin/admin.php index c7e8e96..a436f02 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -74,7 +74,7 @@ public function show_forward_status( $comment_text, $comment ): string { $ch_forwarded = \get_comment_meta( $comment->comment_ID, 'ch_forwarded' ); if ( $ch_forwarded ) { /* translators: %s is replaced by the name you're forwarding to. */ - $pre = '

' . \sprintf( \esc_html__( 'This comment was forwarded to %s.', 'yoast-comment-hacks' ), \esc_html( $this->options['forward_name'] ) ) . '

'; + $pre = '

' . \sprintf( \esc_html__( 'This comment was forwarded to %s.', 'comment-hacks' ), \esc_html( $this->options['forward_name'] ) ) . '

'; $comment_text = $pre . $comment_text; } @@ -100,7 +100,7 @@ public function forward_comment(): void { $comment = \get_comment( $comment_id ); /* translators: %1$s is replaced by (a link to) the blog's name, %2$s by (a link to) the title of the blogpost. */ - echo '

' . \sprintf( \esc_html__( 'Forwarding comment from %1$s to %2$s.', 'yoast-comment-hacks' ), '' . \esc_html( $comment->comment_author ) . '', \esc_html( $this->options['forward_name'] ) ) . '

'; + echo '

' . \sprintf( \esc_html__( 'Forwarding comment from %1$s to %2$s.', 'comment-hacks' ), '' . \esc_html( $comment->comment_author ) . '', \esc_html( $this->options['forward_name'] ) ) . '

'; $intro = \sprintf( 'This comment was forwarded from %s where it was left on: %s.', '' . \esc_html( \get_bloginfo( 'name' ) ) . '', '' . \get_the_title( $comment->comment_post_ID ) . '' ) . "\n\n"; @@ -111,7 +111,7 @@ public function forward_comment(): void { $intro .= '---------- Forwarded message --------- From: ' . \esc_html( $comment->comment_author ) . ' <' . \esc_html( $comment->comment_author_email ) . '> Date: ' . \gmdate( 'D, M j, Y \a\t h:i A', \strtotime( $comment->comment_date ) ) . ' -Subject: ' . \esc_html__( 'Comment on', 'yoast-comment-hacks' ) . ' ' . \esc_html( \get_bloginfo( 'name' ) ) . ' +Subject: ' . \esc_html__( 'Comment on', 'comment-hacks' ) . ' ' . \esc_html( \get_bloginfo( 'name' ) ) . ' To: ' . \esc_html( \get_bloginfo( 'name' ) ) . ' <' . \esc_html( $this->options['forward_from_email'] ) . '>'; $intro .= "\n\n"; @@ -142,11 +142,11 @@ public function forward_to_support_action_link( $actions, $comment ): array { return $actions; } - $label = \esc_html__( 'Forward to support', 'yoast-comment-hacks' ); + $label = \esc_html__( 'Forward to support', 'comment-hacks' ); // '1' === approved, 'trash' === trashed. if ( $comment->comment_approved !== '1' && $comment->comment_approved !== 'trash' ) { - $label = \esc_html__( 'Forward to support & trash', 'yoast-comment-hacks' ); + $label = \esc_html__( 'Forward to support & trash', 'comment-hacks' ); } $actions['ch_forward'] = '' . $label . ''; @@ -160,7 +160,7 @@ public function forward_to_support_action_link( $actions, $comment ): array { public function register_meta_boxes(): void { \add_meta_box( 'comment-hacks-reroute', - \__( 'Comment Hacks', 'yoast-comment-hacks' ), + \__( 'Comment Hacks', 'comment-hacks' ), [ $this, 'meta_box_callback', @@ -177,7 +177,7 @@ public function register_meta_boxes(): void { */ public function meta_box_callback( $post ): void { echo ''; - echo '
'; + echo '
'; /** * This filter allows filtering which roles should be shown in the dropdown for notifications. @@ -325,7 +325,7 @@ public function options_validate( array $input ): array { if ( ( $this->absolute_min + 1 ) > $input['mincomlength'] || empty( $input['mincomlength'] ) ) { /* translators: %d is replaced with the minimum number of characters */ - \add_settings_error( $this->hook, 'min_length_invalid', \sprintf( \__( 'The minimum length you entered is invalid, please enter a minimum length above %d.', 'yoast-comment-hacks' ), $this->absolute_min ) ); + \add_settings_error( $this->hook, 'min_length_invalid', \sprintf( \__( 'The minimum length you entered is invalid, please enter a minimum length above %d.', 'comment-hacks' ), $this->absolute_min ) ); $input['mincomlength'] = 15; } @@ -369,8 +369,8 @@ private function sanitize_string( $value, $default ) { */ public function add_config_page() { \add_options_page( - \__( 'Comment Hacks', 'yoast-comment-hacks' ), - \__( 'Comment Hacks', 'yoast-comment-hacks' ), + \__( 'Comment Hacks', 'comment-hacks' ), + \__( 'Comment Hacks', 'comment-hacks' ), 'manage_options', $this->hook, [ @@ -394,7 +394,7 @@ public function filter_plugin_actions( $links, $file ): array { } if ( $file === $this_plugin ) { - $settings_link = '' . \__( 'Settings', 'yoast-comment-hacks' ) . ''; + $settings_link = '' . \__( 'Settings', 'comment-hacks' ) . ''; // Put our link before other links. \array_unshift( $links, $settings_link ); } @@ -410,7 +410,7 @@ public function config_page(): void { // Show the content of the options array when debug is enabled. if ( \defined( 'WP_DEBUG' ) && \WP_DEBUG ) { - echo '

', \esc_html__( 'Options debug', 'yoast-comment-hacks' ), '

'; + echo '

', \esc_html__( 'Options debug', 'comment-hacks' ), '

'; echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Debug output. echo \str_replace( diff --git a/admin/views/comment-parent-box.php b/admin/views/comment-parent-box.php index b79401d..788b760 100644 --- a/admin/views/comment-parent-box.php +++ b/admin/views/comment-parent-box.php @@ -7,7 +7,7 @@
- +
diff --git a/admin/views/config-page.php b/admin/views/config-page.php index 1e4418f..605e6dc 100644 --- a/admin/views/config-page.php +++ b/admin/views/config-page.php @@ -8,35 +8,35 @@ $yoast_comment_option_name = Hacks::$option_name; ?>
-

+

-

+

-

+

@@ -257,7 +256,7 @@ for="forward-emails-name"> @@ -266,7 +265,7 @@ @@ -275,7 +274,7 @@ @@ -284,7 +283,7 @@
- @@ -48,7 +48,7 @@
- + @@ -144,18 +144,18 @@
+ name="">options['forward_extra'] ) ? esc_html( $this->options['forward_extra'] ) : ''; ?>
@@ -300,7 +299,7 @@ options['disable_email_all_commenters'] ); ?> /> + name="" options['disable_email_all_commenters'] ); ?> /> From a9d639ca56700192e1d42c237992f5bd27a1eaa6 Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Mon, 22 Jan 2024 12:18:31 +0200 Subject: [PATCH 05/19] Unnecessary var --- tests/bootstrap.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 33617db..087dfe9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,11 +14,8 @@ require_once \dirname( __DIR__ ) . '/vendor/yoast/wp-test-utils/src/WPIntegration/bootstrap-functions.php'; -// Determine the WP_TEST_DIR. -$yoast_comment_tests_dir = WPIntegration\get_path_to_wp_test_dir(); - // Give access to tests_add_filter() function. -require_once \rtrim( $yoast_comment_tests_dir, '/' ) . '/includes/functions.php'; +require_once \rtrim( WPIntegration\get_path_to_wp_test_dir(), '/' ) . '/includes/functions.php'; /** * Manually load the plugin being tested. From 8c2370dd0ceae250194d6ae5e17b736375bc16fe Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Mon, 22 Jan 2024 12:19:35 +0200 Subject: [PATCH 06/19] Rename yoasttab to emiliaprojectstab --- admin/assets/css/src/comment-hacks-rtl.css | 2 +- admin/assets/css/src/comment-hacks.css | 2 +- admin/assets/js/yoast-comment-hacks.js | 4 ++-- admin/views/config-page.php | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/admin/assets/css/src/comment-hacks-rtl.css b/admin/assets/css/src/comment-hacks-rtl.css index 24f1db5..1f1e23c 100644 --- a/admin/assets/css/src/comment-hacks-rtl.css +++ b/admin/assets/css/src/comment-hacks-rtl.css @@ -1,2 +1,2 @@ -.yoasttab{display:none;margin-top:15px}.yoasttab.active{display:block}.yoasttab strong{font-size:115%}.yoasttab .dashicons-email-alt{color:#00f} +.emiliaprojectstab{display:none;margin-top:15px}.emiliaprojectstab.active{display:block}.emiliaprojectstab strong{font-size:115%}.emiliaprojectstab .dashicons-email-alt{color:#00f} /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbW1lbnQtaGFja3MuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQ0MsYUFBYyxlQUNHLENBQ2pCLGlCQUdBLGFBQWUsQ0FDZixpQkFHQSxjQUFnQixDQUNoQiwrQkFHQSxVQUFZLENBQ1oiLCJmaWxlIjoiY29tbWVudC1oYWNrcy1ydGwuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnlvYXN0dGFiIHtcblx0ZGlzcGxheTogbm9uZTtcblx0bWFyZ2luLXRvcDogMTVweDtcbn1cblxuLnlvYXN0dGFiLmFjdGl2ZSB7XG5cdGRpc3BsYXk6IGJsb2NrO1xufVxuXG4ueW9hc3R0YWIgc3Ryb25nIHtcblx0Zm9udC1zaXplOiAxMTUlO1xufVxuXG4ueW9hc3R0YWIgLmRhc2hpY29ucy1lbWFpbC1hbHQge1xuXHRjb2xvcjogYmx1ZTtcbn1cbiJdfQ== */ \ No newline at end of file diff --git a/admin/assets/css/src/comment-hacks.css b/admin/assets/css/src/comment-hacks.css index dc2ae77..e2bfb7c 100644 --- a/admin/assets/css/src/comment-hacks.css +++ b/admin/assets/css/src/comment-hacks.css @@ -1,2 +1,2 @@ -.yoasttab{display:none;margin-top:15px}.yoasttab.active{display:block}.yoasttab strong{font-size:115%}.yoasttab .dashicons-email-alt{color:#00f} +.emiliaprojectstab{display:none;margin-top:15px}.emiliaprojectstab.active{display:block}.emiliaprojectstab strong{font-size:115%}.emiliaprojectstab .dashicons-email-alt{color:#00f} /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbW1lbnQtaGFja3MuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQ0MsYUFBYyxlQUNHLENBQ2pCLGlCQUdBLGFBQWUsQ0FDZixpQkFHQSxjQUFnQixDQUNoQiwrQkFHQSxVQUFZLENBQ1oiLCJmaWxlIjoiY29tbWVudC1oYWNrcy5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIueW9hc3R0YWIge1xuXHRkaXNwbGF5OiBub25lO1xuXHRtYXJnaW4tdG9wOiAxNXB4O1xufVxuXG4ueW9hc3R0YWIuYWN0aXZlIHtcblx0ZGlzcGxheTogYmxvY2s7XG59XG5cbi55b2FzdHRhYiBzdHJvbmcge1xuXHRmb250LXNpemU6IDExNSU7XG59XG5cbi55b2FzdHRhYiAuZGFzaGljb25zLWVtYWlsLWFsdCB7XG5cdGNvbG9yOiBibHVlO1xufVxuIl19 */ \ No newline at end of file diff --git a/admin/assets/js/yoast-comment-hacks.js b/admin/assets/js/yoast-comment-hacks.js index 00aeb6b..b889c9f 100644 --- a/admin/assets/js/yoast-comment-hacks.js +++ b/admin/assets/js/yoast-comment-hacks.js @@ -2,7 +2,7 @@ jQuery( document ).ready( function() { jQuery( "#yoast-tabs" ).find( "a" ).click( function() { jQuery( "#yoast-tabs" ).find( "a" ).removeClass( "nav-tab-active" ); - jQuery( ".yoasttab" ).removeClass( "active" ); + jQuery( ".emiliaprojectstab" ).removeClass( "active" ); var id = jQuery( this ).attr( "id" ).replace( "-tab", "" ); jQuery( "#" + id ).addClass( "active" ); @@ -47,7 +47,7 @@ jQuery( document ).ready( function() { * Reminder: jQuery attr() gets the attribute value for only the first * element in the matched set so this will always be the first tab id. */ - activeTabId = jQuery( ".yoasttab" ).attr( "id" ); + activeTabId = jQuery( ".emiliaprojectstab" ).attr( "id" ); } jQuery( "#" + activeTabId ).addClass( "active" ); diff --git a/admin/views/config-page.php b/admin/views/config-page.php index 52ee96b..3361798 100644 --- a/admin/views/config-page.php +++ b/admin/views/config-page.php @@ -28,7 +28,7 @@ -
+

@@ -86,7 +86,7 @@
-
+

@@ -142,7 +142,7 @@
-