# woo-additional-terms/1.6.2/src/Ajax/Rate.php

Additional Terms Lite for WooCommerce, version 1.6.2. 68 lines.

- Page: https://pluginprobe.com/plugins/woo-additional-terms/1.6.2/code/src/Ajax/Rate.php
- Raw: https://pluginprobe.com/plugins/woo-additional-terms/1.6.2/raw/src/Ajax/Rate.php
- Modified: 2023-07-27T11:37:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woo-additional-terms/1.6.2/code/src/Ajax/Rate.php#L10-L20`.

```php
<?php
/**
 * Dismiss rate the plugin admin notice.
 *
 * @author MyPreview (Github: @mahdiyazdani, @gooklani, @mypreview)
 *
 * @since 1.4.1
 *
 * @package woo-additional-terms
 */

namespace Woo_Additional_Terms\Ajax;

use Woo_Additional_Terms\Enhancements;

/**
 * Rate admin notice class.
 */
class Rate extends Ajax {

	/**
	 * Setup hooks and filters.
	 *
	 * @since 1.4.1
	 *
	 * @return void
	 */
	public function __construct() {

		// Parent constructor.
		parent::__construct(
			'dismiss_rate',
			Enhancements\Notices::DISMISS_NONCE_NAME
		);
	}

	/**
	 * Setup hooks and filters.
	 *
	 * @since 1.4.1
	 *
	 * @return void
	 */
	public function setup() {

		// Register the AJAX action.
		$this->register_admin();
	}

	/**
	 * AJAX dismiss the admin notice.
	 *
	 * @since 1.4.1
	 *
	 * @return void
	 */
	public function ajax_callback() {

		// Bail early if the nonce is invalid.
		$this->verify_nonce();

		// Set the rate transient.
		set_transient( Enhancements\Rate::TRANSIENT_NAME, true, 3 * MONTH_IN_SECONDS );

		exit();
	}
}

```
