PATH:
home
/
ediuae
/
eliteroyalcrown.com
/
wp-content
/
plugins
/
litespeed-cache
/
src
<?php /** * Guest mode management class. * * Handles syncing of Guest Mode IP and UA lists from QUIC.cloud. * * @package LiteSpeed * @since 7.7 */ namespace LiteSpeed; defined( 'WPINC' ) || exit(); /** * Class Guest * * Extends Cloud class to provide Guest Mode related functionality. */ class Guest extends Cloud { const LOG_TAG = '👤'; const TYPE_SYNC = 'sync'; /** * Cron handler for daily Guest Mode sync. * * @since 7.7 * @return void */ public static function cron() { self::debug( 'Cron: starting daily sync' ); self::cls()->sync_lists(); } /** * Sync Guest Mode IP and UA lists. * * Fetches the latest IP and UA lists from QUIC.cloud API and saves them locally. * * @since 7.7 * @return array{success: bool, message: string} */ public function sync_lists() { self::debug( 'Starting Guest Mode lists sync' ); $cloud_dir = LITESPEED_STATIC_DIR . '/cloud'; $results = [ 'ips' => false, 'uas' => false, ]; foreach ( [ 'ips', 'uas' ] as $type ) { $data = $this->_fetch_api( $this->_cloud_server_wp . '/gm_' . $type ); if ( $data && File::save( $cloud_dir . '/gm_' . $type . '.txt', $data, true ) ) { self::debug( 'Guest Mode ' . $type . ' synced' ); $results[ $type ] = true; } } $success = $results['ips'] && $results['uas']; $message = $success ? __( 'Guest Mode lists synced successfully.', 'litespeed-cache' ) : __( 'Failed to sync Guest Mode lists.', 'litespeed-cache' ); return [ 'success' => $success, 'message' => $message, ]; } /** * Fetch data from API. * * @since 7.7 * @param string $url API URL. * @return string|false Data on success, false on failure. */ private function _fetch_api( $url ) { self::debug( 'Fetching: ' . $url ); $response = wp_remote_get( $url, [ 'timeout' => 15, ] ); if ( is_wp_error( $response ) ) { self::debug( 'Fetch error: ' . $response->get_error_message() ); return false; } $code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $code ) { self::debug( 'Fetch failed with code: ' . $code ); return false; } $body = wp_remote_retrieve_body( $response ); if ( empty( $body ) ) { self::debug( 'Empty response body' ); return false; } return $body; } /** * Handle all request actions from main class. * * @since 7.7 * @return void */ public function handler() { $type = Router::verify_type(); switch ( $type ) { case self::TYPE_SYNC: $result = $this->sync_lists(); if ( Router::is_ajax() ) { wp_send_json( $result ); } if ( $result['success'] ) { Admin_Display::success( $result['message'] ); } else { Admin_Display::error( $result['message'] ); } break; default: break; } Admin::redirect(); } }
[-] metabox.cls.php
[edit]
[-] core.cls.php
[edit]
[-] img-optm-pull.trait.php
[edit]
[-] db-optm.cls.php
[edit]
[-] admin-display.cls.php
[edit]
[-] activation.cls.php
[edit]
[+]
..
[-] admin-settings.cls.php
[edit]
[-] img-optm-manage.trait.php
[edit]
[-] cloud-request.trait.php
[edit]
[-] guest.cls.php
[edit]
[-] cloud-misc.trait.php
[edit]
[-] error.cls.php
[edit]
[-] cloud-auth-ip.trait.php
[edit]
[-] utility.cls.php
[edit]
[-] object-cache-wp.cls.php
[edit]
[-] router.cls.php
[edit]
[-] report.cls.php
[edit]
[-] import.preset.cls.php
[edit]
[-] cloud.cls.php
[edit]
[-] health.cls.php
[edit]
[-] lang.cls.php
[edit]
[-] vpi.cls.php
[edit]
[-] base.cls.php
[edit]
[-] cloud-auth-callback.trait.php
[edit]
[+]
data_structure
[-] vary.cls.php
[edit]
[-] object.lib.php
[edit]
[-] media.cls.php
[edit]
[-] root.cls.php
[edit]
[-] ucss.cls.php
[edit]
[-] localization.cls.php
[edit]
[-] css.cls.php
[edit]
[-] task.cls.php
[edit]
[-] cdn.cls.php
[edit]
[-] control.cls.php
[edit]
[-] cloud-auth.trait.php
[edit]
[-] gui.cls.php
[edit]
[-] rest.cls.php
[edit]
[-] placeholder.cls.php
[edit]
[-] file.cls.php
[edit]
[-] debug2.cls.php
[edit]
[-] optimize.cls.php
[edit]
[-] avatar.cls.php
[edit]
[-] optimizer.cls.php
[edit]
[-] cloud-node.trait.php
[edit]
[-] tag.cls.php
[edit]
[-] img-optm-send.trait.php
[edit]
[-] img-optm.cls.php
[edit]
[-] str.cls.php
[edit]
[-] admin.cls.php
[edit]
[-] tool.cls.php
[edit]
[-] htaccess.cls.php
[edit]
[-] api.cls.php
[edit]
[-] purge.cls.php
[edit]
[-] esi.cls.php
[edit]
[-] crawler-map.cls.php
[edit]
[-] import.cls.php
[edit]
[-] data.upgrade.func.php
[edit]
[-] crawler.cls.php
[edit]
[-] object-cache.cls.php
[edit]
[-] data.cls.php
[edit]
[+]
cdn
[-] conf.cls.php
[edit]
[-] doc.cls.php
[edit]