checklist = $checklist;
$this->promos = $promos;
$this->growth_tools = $growth_tools;
}
/**
* Register hooks, only while the current request is the checklist page.
*
* @since 4.10.0
*/
public function hooks(): void {
if ( ! wp_mail_smtp()->get_admin()->is_admin_page( 'setup-checklist' ) ) {
return;
}
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_action( 'in_admin_header', [ $this, 'hide_admin_notices' ], PHP_INT_MAX );
}
/**
* Suppress all admin notices on the checklist page.
*
* WordPress relocates a notice printed after the first
into the title bar, so
* this runs on `in_admin_header`, before the `admin_notices` hooks fire.
*
* @since 4.10.0
*/
public function hide_admin_notices(): void {
remove_all_actions( 'admin_notices' );
remove_all_actions( 'all_admin_notices' );
}
/**
* Get the page's stable admin URL.
*
* @since 4.10.0
*
* @return string
*/
public static function get_url(): string {
return wp_mail_smtp()->get_admin()->get_admin_page_url( self::SLUG );
}
/**
* Enqueue the page assets.
*
* @since 4.10.0
*/
public function enqueue_assets(): void {
wp_enqueue_style(
'wp-mail-smtp-setup-checklist',
wp_mail_smtp()->assets_url . '/css/smtp-setup-checklist.min.css',
[ 'wp-mail-smtp-admin' ],
WPMS_PLUGIN_VER
);
wp_enqueue_script(
'wp-mail-smtp-setup-checklist',
wp_mail_smtp()->assets_url . '/js/smtp-setup-checklist.min.js',
[ 'jquery', 'wp-mail-smtp-admin', 'wp-mail-smtp-admin-jconfirm' ],
WPMS_PLUGIN_VER,
true
);
wp_localize_script(
'wp-mail-smtp-setup-checklist',
'wp_mail_smtp_setup_checklist',
[
'ajax_url' => admin_url( 'admin-ajax.php' ),
'error' => esc_html__( 'Something went wrong. Please try again.', 'wp-mail-smtp' ),
'dismiss' => [
'title' => esc_html__( 'Are you sure?', 'wp-mail-smtp' ),
'content' => esc_html__( 'This will permanently dismiss the Setup Checklist, and you will not be able to bring it back. This cannot be undone.', 'wp-mail-smtp' ),
'confirm' => esc_html__( 'Yes, dismiss', 'wp-mail-smtp' ),
'cancel' => esc_html__( 'Cancel', 'wp-mail-smtp' ),
'error' => esc_html__( 'Something went wrong dismissing the checklist. Please try again.', 'wp-mail-smtp' ),
],
'plugins' => [
'installing' => esc_html__( 'Installing…', 'wp-mail-smtp' ),
'activating' => esc_html__( 'Activating…', 'wp-mail-smtp' ),
'activate' => esc_html__( 'Activate', 'wp-mail-smtp' ),
'installed' => esc_html__( 'Installed', 'wp-mail-smtp' ),
],
]
);
}
/**
* Render the page.
*
* @since 4.10.0
*/
public function output(): void {
echo '
promos->render_header(
'wpms-setup-checklist-promo-growth-tools',
__( 'Set Up Recommended Growth Tools', 'wp-mail-smtp' ),
__( 'Take your website to the next level with our sister plugins.', 'wp-mail-smtp' )
);
?>