| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/xxxupdates.com/public_html/wp-content/plugins/age-gate/src/Admin/Tools/ |
Upload File : |
<?php
namespace AgeGate\Admin\Tools;
use AgeGate\Update\Activate;
use AgeGate\Common\Admin\Helper;
use AgeGate\Common\Immutable\Constants as Immutable;
class Reset
{
use Helper;
public const PERMISSION = Immutable::HARD_RESET;
public function __construct()
{
add_action('admin_post_age_gate_reset', [$this, 'resetSettings']);
add_action('admin_post_age_gate_reset_post', [$this, 'resetPosts']);
}
private function auth($password)
{
$user = get_user_by('ID', get_current_user_id( ));
return wp_check_password( $password, $user->data->user_pass, get_current_user_id());
}
public function resetSettings()
{
$postData = wp_unslash($_POST ?? []);
if (!current_user_can(self::PERMISSION) || !wp_verify_nonce($postData['ag_reset_settings'] ?? '', 'ag_reset_settings')) {
wp_die('Disallowed action');
}
if (!$this->auth($postData['pwd'])) {
$this->redirect($postData['_wp_http_referer'], 0, 'tools');
}
foreach (Immutable::AGE_GATE_OPTIONS as $option) {
delete_option($option);
}
delete_option('age_gate_version');
Activate::activate();
$this->redirect($postData['_wp_http_referer'], 1, 'tools');
}
public function resetPosts()
{
$postData = wp_unslash($_POST ?? []);
if (!current_user_can(self::PERMISSION) || !wp_verify_nonce($postData['ag_reset_post'] ?? '', 'ag_reset_post')) {
wp_die('Disallowed action');
}
if (!$this->auth($postData['pwd'])) {
$this->redirect($postData['_wp_http_referer'], 0, 'tools');
}
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->query("DELETE FROM {$wpdb->termmeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$this->redirect($postData['_wp_http_referer'], 1, 'tools');
}
}