Server IP : 192.64.118.117 / Your IP : 3.148.113.167 Web Server : LiteSpeed System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : thecgapy ( 1160) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/thecgapy/www/wp-content/plugins/litespeed-cache/src/ |
Upload File : |
<?php /** * The localization class. * * @since 3.3 */ namespace LiteSpeed; defined( 'WPINC' ) || exit; class Localization extends Base { protected static $_instance; /** * Localize Resources * * @since 3.3 */ public function serve_static( $uri ) { $url = 'https://' . $uri; if ( ! Conf::val( Base::O_OPTM_LOCALIZE ) ) { // wp_redirect( $url ); exit( 'Not supported' ); } if ( substr( $url, -3 ) !== '.js' ) { // wp_redirect( $url ); exit( 'Not supported' ); } $match = false; $domains = Conf::val( Base::O_OPTM_LOCALIZE_DOMAINS ); foreach ( $domains as $v ) { if ( ! $v || strpos( $v, '#' ) === 0 ) { continue; } $type = 'js'; $domain = $v; // Try to parse space splitted value if ( strpos( $v, ' ' ) ) { $v = explode( ' ', $v ); if ( ! empty( $v[ 1 ] ) ) { $type = strtolower( $v[ 0 ] ); $domain = $v[ 1 ]; } } if ( strpos( $domain, 'https://' ) !== 0 ) { continue; } if ( $type != 'js' ) { continue; } if ( strpos( $url, $domain ) !== 0 ) { continue; } $match = true; break; } if ( ! $match ) { // wp_redirect( $url ); exit( 'Not supported' ); } Control::set_no_vary(); Control::set_public_forced( 'Localized Resources' ); Tag::add( Tag::TYPE_LOCALRES ); header( 'Content-Type: application/javascript' ); $res = wp_remote_get( $url ); $content = wp_remote_retrieve_body( $res ); if ( ! $content ) { $content = '/* Failed to load ' . $url . ' */'; } echo $content; exit; } /** * Localize JS/Fonts * * @since 3.3 * @access public */ public function finalize( $content ) { if ( ! Conf::val( Base::O_OPTM_LOCALIZE ) ) { return $content; } $domains = Conf::val( Base::O_OPTM_LOCALIZE_DOMAINS ); if ( ! $domains ) { return $content; } foreach ( $domains as $v ) { if ( ! $v || strpos( $v, '#' ) === 0 ) { continue; } $type = 'js'; $domain = $v; // Try to parse space splitted value if ( strpos( $v, ' ' ) ) { $v = explode( ' ', $v ); if ( ! empty( $v[ 1 ] ) ) { $type = strtolower( $v[ 0 ] ); $domain = $v[ 1 ]; } } if ( strpos( $domain, 'https://' ) !== 0 ) { continue; } if ( $type != 'js' ) { continue; } $content = str_replace( $domain, LITESPEED_STATIC_URL . '/localres/' . substr( $domain, 8 ), $content ); } return $content; } }