3600*24*7) { // Check if the notice has been dismissed $dismissal_date = get_option('aiwa_wp_plugin_dismissal_date'); if (!$dismissal_date || (time() - $dismissal_date) > 3600*24*7) { // Check if the notice has been closed forever $notice_closed = get_option('aiwa_wp_plugin_notice_closed'); if (!$notice_closed) { // Display the notice $review_url = 'https://wordpress.org/support/plugin/ai-content-writing-assistant/reviews/#new-post'; $notice_text = __('Help us to help you! Hope you liked our "AI Content Writing Assistant" plugin! Please help us improve the plugin by leaving a five start ratings and review. Your feedback is greatly appreciated.', 'ai-writing-assistant'); $notice_html = '

' . wp_kses_post($notice_text) . '

' . __('Ok, you deserved it', 'ai-writing-assistant') . ' ' . __('Dismiss', 'ai-writing-assistant') . ' ' . __('Close Forever', 'ai-writing-assistant') . '

'; echo $notice_html; } } } } add_action('admin_notices', 'aiwa_wp_plugin_admin_notice'); function aiwa_wp_plugin_dismiss_notice() { if (is_admin() && wp_verify_nonce(sanitize_key($_REQUEST['rc_nonce']), 'rc-nonce')) { update_option('aiwa_wp_plugin_dismissal_date', time()); wp_send_json_success(); } else { wp_send_json_error(); } } add_action('wp_ajax_aiwa_wp_plugin_dismiss_notice', 'aiwa_wp_plugin_dismiss_notice'); function aiwa_wp_plugin_close_notice() { if (is_admin() && wp_verify_nonce(sanitize_key($_REQUEST['rc_nonce']), 'rc-nonce')) { update_option('aiwa_wp_plugin_notice_closed', true); wp_send_json_success(); } else { wp_send_json_error(); } } add_action('wp_ajax_aiwa_wp_plugin_close_notice', 'aiwa_wp_plugin_close_notice'); function aiwa_admin_print_footer_scripts(){ ?>