| 1 |
<?php |
| 2 |
|
| 3 |
namespace Code_Snippets\Integration\Promotions\Notices; |
| 4 |
|
| 5 |
use Code_Snippets\REST_API\Import\Plugins\Header_Footer_Code_Manager_Plugin_Importer; |
| 6 |
|
| 7 |
/** |
| 8 |
* Promotion class for Header Footer Code Manager. |
| 9 |
* |
| 10 |
* @link https://wordpress.org/plugins/header-footer-code-manager/ |
| 11 |
*/ |
| 12 |
class Header_Footer_Code_Manager extends Promotion_Base { |
| 13 |
|
| 14 |
/** |
| 15 |
* Get the name of the plugin being promoted. |
| 16 |
* |
| 17 |
* @return string The plugin name. |
| 18 |
*/ |
| 19 |
public function get_plugin_name(): string { |
| 20 |
return __( 'Header Footer Code Manager', 'code-snippets' ); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Get the slug of the plugin being promoted. |
| 25 |
* |
| 26 |
* @return string The plugin slug. |
| 27 |
*/ |
| 28 |
public function get_plugin_slug(): string { |
| 29 |
return 'header-footer-code-manager'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get the admin screens where the promotion should be displayed. |
| 34 |
* |
| 35 |
* @return array An array of admin screen IDs. |
| 36 |
*/ |
| 37 |
public function get_plugin_admin_screens(): array { |
| 38 |
return [ |
| 39 |
'toplevel_page_hfcm-list', |
| 40 |
'hfcm_page_hfcm-tools', |
| 41 |
'hfcm_page_hfcm-create', |
| 42 |
'admin_page_hfcm-update', |
| 43 |
]; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Get the message text for the promotion notice. |
| 48 |
* |
| 49 |
* @return string The promotion message. |
| 50 |
*/ |
| 51 |
public function get_promotion_message(): string { |
| 52 |
return __( 'Move your functionality to Code Snippets and reduce your dependency on third-party plugins.', 'code-snippets' ); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Check if the user should see the migration button. |
| 57 |
* |
| 58 |
* @return bool Whether the user should see the migration button. |
| 59 |
*/ |
| 60 |
public function show_migration_button(): bool { |
| 61 |
$importer = new Header_Footer_Code_Manager_Plugin_Importer(); |
| 62 |
$data = $importer->get_data(); |
| 63 |
return ! empty( $data ); |
| 64 |
} |
| 65 |
} |
| 66 |
|