init_hooks(); } /** * Get singleton instance * * @return Metasync_Review_Notice */ public static function get_instance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } /** * Initialize WordPress hooks */ private function init_hooks() { add_action('admin_notices', [$this, 'display_review_notice']); add_action('wp_ajax_metasync_dismiss_review_notice', [$this, 'ajax_dismiss_notice']); add_action('wp_ajax_metasync_remind_later_review_notice', [$this, 'ajax_remind_later']); add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']); } /** * Check if the review notice should be displayed * * @return bool */ private function should_display() { // Don't show if whitelabel is enabled if (class_exists('Metasync') && Metasync::is_whitelabel_enabled()) { return false; } // Don't show if permanently dismissed if (get_option('metasync_review_notice_dismissed', false)) { return false; } // Check "remind me later" postponement $remind_later = get_option('metasync_review_notice_remind_later', 0); if ($remind_later && time() < (int) $remind_later) { return false; } // Check if enough time has passed since first activation $first_activation = get_option('metasync_first_activation_time', ''); if (empty($first_activation)) { return false; } $activation_time = strtotime($first_activation); if ($activation_time === false) { return false; } $days_since_activation = (time() - $activation_time) / DAY_IN_SECONDS; if ($days_since_activation < self::DAYS_BEFORE_SHOWING) { return false; } return true; } /** * Display the review notice */ public function display_review_notice() { if (!$this->should_display()) { return; } if (!current_user_can('manage_options')) { return; } $plugin_name = class_exists('Metasync') ? Metasync::get_effective_plugin_name() : 'Search Atlas'; $review_url = self::REVIEW_URL; $nonce = wp_create_nonce('metasync_review_notice'); ?>
Enjoying ? Please consider leaving a rating to help us spread the word!