/home/techb158/balacoffee.com/wp-content/plugins/chaty/includes
Edit: /home/techb158/balacoffee.com/wp-content/plugins/chaty/includes/class-upgrade-box.php (14740B)
pluginSlug."_upgrade_hide_box", [$this, "upgrade_to_pro"]);
add_action('admin_notices', [$this, 'admin_notices']);
}//end __construct()
/**
* Upgrade the plugin to the pro version.
*
* This method handles the upgrade process when the user wants to upgrade the plugin to the pro version.
* It checks for a valid nonce and processes the upgrade request accordingly.
*
* @return void
*/
public function upgrade_to_pro()
{
$nonce = filter_input(INPUT_POST, 'nonce');
$days = filter_input(INPUT_POST, 'days');
if (!empty($nonce) && wp_verify_nonce($nonce, $this->pluginSlug."_upgrade_box")) {
if ($days == -1) {
add_option($this->pluginSlug."_hide_upgrade_box", "1");
} else {
$date = gmdate("Y-m-d", strtotime("+".$days." days"));
update_option($this->pluginSlug."_show_upgrade_box_after", $date);
}
}
die;
}//end upgrade_to_pro()
/**
* Display admin notices for the Chaty plugin.
*
* This method is responsible for displaying admin notices related to the Chaty plugin.
* It checks for query parameters and options to determine when to display the notices.
* It also includes style inline CSS for the notices.
*
* @return void
*/
public function admin_notices()
{
$chatyNotice = filter_input(INPUT_GET, 'hide_chaty_notice');
if($chatyNotice == 1) {
add_option($this->pluginSlug."_hide_upgrade_box", "1");
return;
}
$is_hidden = get_option($this->pluginSlug."_hide_upgrade_box");
if ($is_hidden !== false) {
return;
}
$current_count = get_option($this->pluginSlug."_show_upgrade_box_after");
if ($current_count === false) {
$date = gmdate("Y-m-d", strtotime("+15 days"));
add_option($this->pluginSlug."_show_upgrade_box_after", $date);
return;
} else if ($current_count < 35) {
return;
}
$date_to_show = get_option($this->pluginSlug."_show_upgrade_box_after");
if ($date_to_show !== false) {
$current_date = gmdate("Y-m-d");
if ($current_date < $date_to_show) {
return;
}
}
?>
".esc_html__("Upgrade to ", 'chaty')." ".esc_attr($this->plugin_name)." Pro") ?>
" target="_blank" >