From 1761ada046c87273622f33599518c0c5025c7fac Mon Sep 17 00:00:00 2001 From: Rami Yushuvaev Date: Thu, 12 Feb 2026 13:42:03 +0200 Subject: [PATCH 1/2] Fix a warning in promotions --- .../Notices/Header_Footer_Code_Manager.php | 12 ++++-------- .../Promotions/Notices/Insert_PHP_Code_Snippet.php | 12 ++++-------- .../Promotions/Notices/Promotion_Base.php | 10 +++++----- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php b/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php index b0faea9a..97209a88 100644 --- a/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php +++ b/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php @@ -2,8 +2,6 @@ namespace Code_Snippets\Integration\Promotions\Notices; -use Code_Snippets\REST_API\Import\Plugins\Header_Footer_Code_Manager_Plugin_Importer; - /** * Promotion class for Header Footer Code Manager. * @@ -53,13 +51,11 @@ public function get_promotion_message(): string { } /** - * Check if the Header Footer Code Manager plugin has any snippets. + * Check if the user should see the migration button. * - * @return bool True if there are snippets, false otherwise. + * @return bool Whether the user should see the migration button. */ - protected function has_snippets(): bool { - $importer = new Header_Footer_Code_Manager_Plugin_Importer(); - $data = $importer->get_data(); - return ! empty( $data ); + public function show_migration_button(): bool { + return true; } } diff --git a/src/php/Integration/Promotions/Notices/Insert_PHP_Code_Snippet.php b/src/php/Integration/Promotions/Notices/Insert_PHP_Code_Snippet.php index 29a79134..196342a4 100644 --- a/src/php/Integration/Promotions/Notices/Insert_PHP_Code_Snippet.php +++ b/src/php/Integration/Promotions/Notices/Insert_PHP_Code_Snippet.php @@ -2,8 +2,6 @@ namespace Code_Snippets\Integration\Promotions\Notices; -use Code_Snippets\REST_API\Import\Plugins\Insert_PHP_Code_Snippet_Plugin_Importer; - /** * Promotion class for Insert PHP Code Snippet plugin. * @@ -53,13 +51,11 @@ public function get_promotion_heading(): string { } /** - * Check if the user has any snippets in the Insert PHP Code Snippet plugin. + * Check if the user should see the migration button. * - * @return bool True if the user has snippets, false otherwise. + * @return bool Whether the user should see the migration button. */ - protected function has_snippets(): bool { - $importer = new Insert_PHP_Code_Snippet_Plugin_Importer(); - $data = $importer->get_data(); - return ! empty( $data ); + public function show_migration_button(): bool { + return true; } } diff --git a/src/php/Integration/Promotions/Notices/Promotion_Base.php b/src/php/Integration/Promotions/Notices/Promotion_Base.php index de70812e..1cb63f04 100644 --- a/src/php/Integration/Promotions/Notices/Promotion_Base.php +++ b/src/php/Integration/Promotions/Notices/Promotion_Base.php @@ -212,21 +212,21 @@ public function dismiss_promotion_ajax_handler() { } /** - * Check if the user has any snippets in the promoted plugin. + * Check if the user should see the migration button. * - * @return bool True if the user has snippets, false otherwise. + * @return bool Whether the user should see the migration button. */ - protected function has_snippets(): bool { + public function show_migration_button(): bool { return false; } /** * Render buttons for the promotion notice. * - * @uses has_snippets() to determine which buttons to show. + * @uses show_migration_button() to determine which buttons to show. */ protected function print_promotion_buttons() { - if ( $this->has_snippets() ) { + if ( $this->show_migration_button() ) { printf( '%s', esc_url( add_query_arg( 'tab', 'plugins', code_snippets()->get_menu_url( 'import' ) ) ), From c8d279623959761cba194fb87c3161a2950ac3ed Mon Sep 17 00:00:00 2001 From: Rami Yushuvaev Date: Thu, 12 Feb 2026 13:46:27 +0200 Subject: [PATCH 2/2] Update text --- .../Promotions/Notices/Header_Footer_Code_Manager.php | 2 +- src/php/Integration/Promotions/Notices/Insert_HTML_Snippet.php | 2 +- src/php/Integration/Promotions/Notices/Insert_PHP.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php b/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php index 97209a88..301c5006 100644 --- a/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php +++ b/src/php/Integration/Promotions/Notices/Header_Footer_Code_Manager.php @@ -47,7 +47,7 @@ public function get_plugin_admin_screens(): array { * @return string The promotion message. */ public function get_promotion_message(): string { - return __( 'Move your functionality to Code Snippets Pro and reduce your dependency on third-party plugins. A leaner dashboard is a more secure dashboard.', 'code-snippets' ); + return __( 'Move your functionality to Code Snippets and reduce your dependency on third-party plugins.', 'code-snippets' ); } /** diff --git a/src/php/Integration/Promotions/Notices/Insert_HTML_Snippet.php b/src/php/Integration/Promotions/Notices/Insert_HTML_Snippet.php index 29572e23..01c33549 100644 --- a/src/php/Integration/Promotions/Notices/Insert_HTML_Snippet.php +++ b/src/php/Integration/Promotions/Notices/Insert_HTML_Snippet.php @@ -47,6 +47,6 @@ public function get_plugin_admin_screens(): array { * @return string The promotion message. */ public function get_promotion_message(): string { - return __( 'Move your functionality to Code Snippets Pro and reduce your dependency on third-party plugins. A leaner dashboard is a more secure dashboard.', 'code-snippets' ); + return __( 'Move your functionality to Code Snippets and reduce your dependency on third-party plugins.', 'code-snippets' ); } } diff --git a/src/php/Integration/Promotions/Notices/Insert_PHP.php b/src/php/Integration/Promotions/Notices/Insert_PHP.php index 2ce12342..0ed7eff1 100644 --- a/src/php/Integration/Promotions/Notices/Insert_PHP.php +++ b/src/php/Integration/Promotions/Notices/Insert_PHP.php @@ -50,6 +50,6 @@ public function get_plugin_admin_screens(): array { * @return string The promotion message. */ public function get_promotion_message(): string { - return __( 'Move your functionality to Code Snippets Pro and reduce your dependency on third-party plugins. A leaner dashboard is a more secure dashboard.', 'code-snippets' ); + return __( 'Move your functionality to Code Snippets and reduce your dependency on third-party plugins.', 'code-snippets' ); } }