__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace WP_Statistics\Service\Admin;
use WP_Statistics\Components\Ajax;
use WP_Statistics\Utils\Request;
use WP_STATISTICS\Option;
use Exception;
use WP_STATISTICS\User;
/**
* @todo Send responses in a standard format using Ajax::success() or Ajax::error()
*/
class AjaxOptionUpdater
{
/**
* Initializes registering the AJAX handler for the admin area.
*
* @return void
*/
public function init()
{
if (!is_admin()) {
return;
}
Ajax::register('option_updater', [$this, 'optionUpdater']);
}
/**
* Handles the AJAX request for updating a specified option in the system.
*
* @return void JSON response will be sent with either success or error message.
* @throws Exception If the nonce is invalid, the option is missing, or any other error occurs.
*
*/
public function optionUpdater()
{
try {
if (Request::isFrom('ajax') && User::Access('manage')) {
check_ajax_referer('wp_rest', 'wps_nonce');
$option = Request::get('option');
$value = Request::get('value');
if ($value === 'true') {
$value = true;
} elseif ($value === 'false') {
$value = false;
}
Option::update($option, $value);
wp_send_json_success(['message' => __('Update option success.', 'wp-statistics')]);
}
} catch (Exception $e) {
wp_send_json_error($e->getMessage());
}
exit();
}
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AnonymizedUsageData | Folder | 0755 |
|
|
| AuthorAnalytics | Folder | 0755 |
|
|
| CategoryAnalytics | Folder | 0755 |
|
|
| ContentAnalytics | Folder | 0755 |
|
|
| Devices | Folder | 0755 |
|
|
| Exclusions | Folder | 0755 |
|
|
| ExportImport | Folder | 0755 |
|
|
| FilterHandler | Folder | 0755 |
|
|
| Geographic | Folder | 0755 |
|
|
| HelpCenter | Folder | 0755 |
|
|
| LicenseManagement | Folder | 0755 |
|
|
| MarketingCampaign | Folder | 0755 |
|
|
| Metabox | Folder | 0755 |
|
|
| MiniChart | Folder | 0755 |
|
|
| ModalHandler | Folder | 0755 |
|
|
| NoticeHandler | Folder | 0755 |
|
|
| Notification | Folder | 0755 |
|
|
| Optimization | Folder | 0755 |
|
|
| Overview | Folder | 0755 |
|
|
| PageInsights | Folder | 0755 |
|
|
| Posts | Folder | 0755 |
|
|
| PrivacyAudit | Folder | 0755 |
|
|
| Referrals | Folder | 0755 |
|
|
| TrackerDebugger | Folder | 0755 |
|
|
| VisitorInsights | Folder | 0755 |
|
|
| WebsitePerformance | Folder | 0755 |
|
|
| AdminManager.php | File | 2.56 KB | 0644 |
|
| AjaxOptionUpdater.php | File | 1.58 KB | 0644 |
|
| ConditionTagEvaluator.php | File | 6.29 KB | 0644 |
|
| SiteHealthInfo.php | File | 30.83 KB | 0644 |
|