*/ namespace ThemeAtelier\Darkify\Helpers; /** * The Helpers class to manage all public facing stuffs. * * @since 1.0.0 */ class ReviewNotice { public function __construct() { add_action('admin_notices', [$this, 'display_admin_notice']); add_action('wp_ajax_darkify-never-show-review-notice', [$this, 'dismiss_review_notice']); } public function display_admin_notice() { // Show only to Admins. if (! current_user_can('manage_options')) { return; } // Variable default value. $review = get_option('darkify_review_notice_dismiss'); $time = time(); $load = false; if (! $review) { $review = array( 'time' => $time, 'dismissed' => false, ); add_option('darkify_review_notice_dismiss', $review); } else { // Check if it has been dismissed or not. if ((isset($review['dismissed']) && ! $review['dismissed']) && (isset($review['time']) && (($review['time'] + (DAY_IN_SECONDS * 3)) <= $time))) { $load = true; } } // If we cannot load, return early. if (! $load) { return; } ?>
We hope you had a wonderful experience using Darkify. Please take a moment to leave a review on WordPress.org. Your positive review will help us improve. Thank you! 😊
Ok, you deserve ★★★★★ Nope, maybe later Never show again