option_name . '_state' ); $time = (int) get_site_option( $this->option_name . '_time' ); if ( 'yes' === $state || 'already' === $state ) { return false; } // Save current time if nothing saved. if ( ! $time ) { $time = time(); update_site_option( $this->option_name . '_time', $time ); } // Allow notice if plugin used for more then 2 weeks. if ( $time < strtotime( '-14 days' ) ) { return true; } return false; } /** * Display admin notice if needed. */ public function admin_notices() { if ( ! $this->is_notice_allowed() ) { return; } ?>

' . _x( 'Visual Portfolio', 'plugin name inside the review notice', 'visual-portfolio' ) . '' ) ); ?>



wp_create_nonce( $this->option_name ), ) ); } /** * Handles Ajax request to persist notices dismissal. * Uses check_ajax_referer to verify nonce. */ public function ajax_vpf_dismiss_ask_review_notice() { check_ajax_referer( $this->option_name, 'nonce' ); $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : 'yes'; update_site_option( $this->option_name . '_state', $type ); // Update time if user clicked "No, maybe later" button. if ( 'later' === $type ) { $time = time(); update_site_option( $this->option_name . '_time', $time ); } wp_die(); } } new Visual_Portfolio_Ask_Review_Notice();