* @license : GPL2 * */ if (defined('ABSPATH') === false) { exit; } class Chaty_Affiliate_Program { /** * The Name of this plugin. * * @var string $pluginName The Name of this plugin. * @since 1.0.0 * @access public */ public $pluginName = "Chaty"; /** * The Slug of this plugin. * * @var string $pluginSlug The Slug of this plugin. * @since 1.0.0 * @access public */ public $pluginSlug = "chaty"; /** * Define the core functionality of the plugin. * * Set the plugin name and the plugin version that can be used throughout the plugin. * Load the dependencies, define the locale, and set the hooks for the admin area and * the public-facing side of the site. * * @since 1.0.0 */ public function __construct() { add_action("wp_ajax_".$this->pluginSlug."_affiliate_program", [$this, "affiliate_program"]); add_action('admin_notices', [$this, 'admin_notices']); }//end __construct() /** * Updates settings for Affiliate Box * * @since 1.0.0 * @access public * @return status */ public function affiliate_program() { if (current_user_can('manage_options')) { $nonce = filter_input(INPUT_POST, 'nonce'); $days = filter_input(INPUT_POST, 'days'); if (!empty($nonce) && wp_verify_nonce($nonce, $this->pluginSlug."_affiliate_program")) { if ($days == -1) { add_option($this->pluginSlug."_hide_affiliate_box", "1"); } else { $date = date("Y-m-d", strtotime("+".$days." days")); update_option($this->pluginSlug."_show_affiliate_box_after", $date); } } die; } }//end affiliate_program() /** * Display Affiliate box * * @since 1.0.0 * @access public * @return html */ public function admin_notices() { if (current_user_can('manage_options')) { $isHidden = get_option($this->pluginSlug."_hide_affiliate_box"); if ($isHidden !== false) { return; } $dateToShow = get_option($this->pluginSlug."_show_affiliate_box_after"); if ($dateToShow === false || empty($dateToShow)) { $date = date("Y-m-d", strtotime("+5 days")); update_option($this->pluginSlug."_show_affiliate_box_after", $date); return; } $currentDate = date("Y-m-d"); if ($currentDate < $dateToShow) { return; } ?>

".$this->pluginName."", "".$this->pluginName."", "25% lifetime commission") ?>