'https://aeonwp.com/aeonblock-plus/', ); return $theme_lists; } /** * Set upgrade time and display the admin notice as required. */ public function pro_theme_notice() { global $current_user; $this->current_user_data = $current_user; $this->active_theme = wp_get_theme(); // In case user is using child theme, we need to show `Upgrade To Pro` notice too. if ( is_child_theme() ) { $this->active_theme = wp_get_theme()->parent()->get( 'Name' ); } $option = get_option( 'aeonblock_theme_notice_start_time' ); if ( ! $option ) { update_option( 'aeonblock_theme_notice_start_time', time() ); } add_action( 'admin_notices', array( $this, 'pro_theme_notice_markup' ), 0 ); add_action( 'admin_init', array( $this, 'pro_theme_notice_partial_ignore' ), 0 ); add_action( 'admin_init', array( $this, 'pro_theme_notice_ignore' ), 0 ); } /** * Enqueue the required scripts. */ public function enqueue_scripts() { wp_enqueue_style( 'aeonblock-notice', get_template_directory_uri() . '/css/upgrade-pro.css', array(), '4.5.0' ); } /** * Display the `Upgrade To Pro` admin notice. */ public function pro_theme_notice_markup() { $theme_lists = self::get_theme_lists(); $current_theme = strtolower( $this->active_theme ); $theme_notice_start_time = get_option( 'aeonblock_theme_notice_start_time' ); $ignore_notice_permanent = get_user_meta( $this->current_user_data->ID, 'aeonblock_upgrade_pro_theme_notice_ignore', true ); $ignore_notice_partially = get_user_meta( $this->current_user_data->ID, 'aeonblock_upgrade_pro_theme_notice_partial_ignore', true ); // Return if the theme is not available in theme lists. if ( ! array_key_exists( $current_theme, $theme_lists ) ) { return; } /** * Return from notice display if: * * 1. The theme installed is less than 10 days ago. * 2. If the user has ignored the message partially for 2 days. * 3. Dismiss always if clicked on 'Dismiss' button. */ if ( ( $theme_notice_start_time > strtotime( '-5 days' ) ) || ( $ignore_notice_partially > strtotime( '-2 days' ) ) || ( $ignore_notice_permanent ) ) { return; } ?>
' . esc_html__( 'upgrade to pro', 'aeonblock' ) . '';
printf(
esc_html__(
/* Translators: %1$s current user display name., %2$s Currently activated theme., %3$s Pro theme link., %4$s Coupon code. */
'Howdy, %1$s! You\'ve been using %2$s theme for a while now, and we hope you\'re happy with it. If you need more options and access to the premium features, you can %3$s. Also, you can use the coupon code %4$s to get 20 percent discount while making the purchase. Enjoy!', 'aeonblock'
),
'' . esc_html( $this->current_user_data->display_name ) . '',
$this->active_theme,
$pro_link,
'upgrade20'
);
?>