Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -49,17 +47,15 @@ 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' );
}

/**
* 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}
2 changes: 1 addition & 1 deletion src/php/Integration/Promotions/Notices/Insert_PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
}
}
10 changes: 5 additions & 5 deletions src/php/Integration/Promotions/Notices/Promotion_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<a href="%s" class="button button-primary">%s</a>',
esc_url( add_query_arg( 'tab', 'plugins', code_snippets()->get_menu_url( 'import' ) ) ),
Expand Down