admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce(self::NONCE_ACTION), 'pluginBasename' => plugin_basename(SKYINPO_PLUGIN_FILE), 'strings' => array( 'submitting' => __('Submitting...', '7sky-internal-post-linker'), ), ) ); } /** * Render the deactivation feedback modal HTML. */ public static function render_modal() { if (!current_user_can('activate_plugins')) { return; } $reasons = array( 'not_working' => __("I couldn't get it working", '7sky-internal-post-linker'), 'missing_features' => __('Missing features', '7sky-internal-post-linker'), 'better_alternative' => __('Found a better alternative', '7sky-internal-post-linker'), 'temporary' => __('Temporary deactivation', '7sky-internal-post-linker'), 'other' => __('Other', '7sky-internal-post-linker'), ); ?> esc_html__('Permission denied.', '7sky-internal-post-linker')), 403); } $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : ''; if (!wp_verify_nonce($nonce, self::NONCE_ACTION)) { wp_send_json_error(array('message' => esc_html__('Security check failed.', '7sky-internal-post-linker')), 403); } $reason = isset($_POST['reason']) ? sanitize_key(wp_unslash($_POST['reason'])) : ''; $details = isset($_POST['details']) ? sanitize_textarea_field(wp_unslash($_POST['details'])) : ''; $allowed_reasons = array('not_working', 'missing_features', 'better_alternative', 'temporary', 'other'); if (!in_array($reason, $allowed_reasons, true)) { $reason = 'not_provided'; } update_option( self::FEEDBACK_OPTION, array( 'reason' => $reason, 'details' => $details, 'submitted_at' => current_time('mysql'), 'version' => SKYINPO_VERSION, ), false ); wp_send_json_success(array('message' => esc_html__('Feedback saved.', '7sky-internal-post-linker'))); } }