run:R W Run
DIR
2026-04-15 19:02:18
R W Run
DIR
2026-04-15 19:02:18
R W Run
DIR
2026-04-15 19:02:18
R W Run
761 By
2026-04-15 19:02:18
R W Run
3.3 KB
2026-04-15 19:02:18
R W Run
25.47 KB
2026-04-15 19:02:18
R W Run
10.69 KB
2026-04-15 19:02:18
R W Run
5.14 KB
2026-04-15 19:02:18
R W Run
16.87 KB
2026-04-15 19:02:18
R W Run
1.65 KB
2026-04-15 19:02:18
R W Run
6.16 KB
2026-04-15 19:02:18
R W Run
4.88 KB
2026-04-15 19:02:18
R W Run
1.31 KB
2026-04-15 19:02:18
R W Run
1.4 KB
2026-04-15 19:02:18
R W Run
15.24 KB
2026-04-15 19:02:18
R W Run
2.84 KB
2026-04-15 19:02:18
R W Run
5.5 KB
2026-04-15 19:02:18
R W Run
2 KB
2026-04-15 19:02:18
R W Run
3.28 KB
2026-04-15 19:02:18
R W Run
3.79 KB
2026-04-15 19:02:18
R W Run
2.1 KB
2026-04-15 19:02:18
R W Run
791 By
2026-04-15 19:02:18
R W Run
15.03 KB
2026-04-15 19:02:18
R W Run
6.5 KB
2026-04-15 19:02:18
R W Run
1.5 KB
2026-04-15 19:02:18
R W Run
8.61 KB
2026-04-15 19:02:18
R W Run
27.78 KB
2026-04-15 19:02:18
R W Run
2.03 KB
2026-04-15 19:02:18
R W Run
7.79 KB
2026-04-15 19:02:18
R W Run
9.9 KB
2026-04-15 19:02:18
R W Run
1.81 KB
2026-04-15 19:02:18
R W Run
7.42 KB
2026-04-15 19:02:18
R W Run
10.74 KB
2026-04-15 19:02:18
R W Run
1.28 KB
2026-04-15 19:02:18
R W Run
8.11 KB
2026-04-15 19:02:18
R W Run
1.79 KB
2026-04-15 19:02:18
R W Run
2.77 KB
2026-04-15 19:02:18
R W Run
780 By
2026-04-15 19:02:18
R W Run
5.37 KB
2026-04-15 19:02:18
R W Run
2.91 KB
2026-04-15 19:02:18
R W Run
794 By
2026-04-15 19:02:18
R W Run
3.69 KB
2026-04-15 19:02:18
R W Run
2.8 KB
2026-04-15 19:02:18
R W Run
37.06 KB
2026-04-15 19:02:18
R W Run
486 By
2026-04-15 19:02:18
R W Run
error_log
📄class-cdn.php
1<?php
2
3namespace WPaaS;
4
5if ( ! defined( 'ABSPATH' ) ) {
6
7 exit;
8
9}
10final class CDN {
11
12 use Helpers;
13 private static $file_ext = [ '7z', 'aac', 'ai', 'asf', 'avi', 'bmp', 'bz2', 'css', 'doc', 'docx', 'eot', 'eps', 'fla', 'flv', 'gif', 'gz', 'ico', 'indd', 'jpeg', 'jpg', 'js', 'm4a', 'm4v', 'mkv', 'mov', 'mp3', 'mp4', 'mpeg', 'mpg', 'oga', 'ogg', 'ogv', 'ogx', 'otf', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'rtf', 's7z', 'svg', 'svgz', 'tar', 'tgz', 'tiff', 'ttf', 'txt', 'wav', 'webp', 'woff', 'woff2', 'xls', 'xlsx', 'xml', 'zip', 'zipx' ];
14
15 private static $base_url;
16
17 private $pattern;
18
19 public function __construct() {
20
21 self::full_page_cdn_notice();
22
23 if ( self::is_wpaas_v2() || ! self::is_enabled() || ( defined('GD_CDN_FULLPAGE') && true === GD_CDN_FULLPAGE ) ) {
24
25 return;
26
27 }
28
29 self::set_cdn_base();
30
31 if ( empty(self::$base_url) ) {
32 return;
33 }
34
35 add_action( 'init', function () {
36
37 $hosts = [
38 filter_input( INPUT_SERVER, 'HTTP_HOST' ),
39 wp_parse_url( home_url(), PHP_URL_HOST ),
40 wp_parse_url( site_url(), PHP_URL_HOST ),
41 GD_TEMP_DOMAIN,
42 ];
43
44 $preg_quote_callback = function ( $string ) {
45
46 return preg_quote( $string, '~' );
47
48 };
49
50 $this->pattern = sprintf(
51 '~(?:(?:https?:)?//(?:%s))/(\S+?\.(?:%s))~i',
52 implode( '|', array_map( $preg_quote_callback, array_unique( array_filter( $hosts ) ) ) ),
53 implode( '|', array_map( $preg_quote_callback, self::get_file_ext() ) )
54 );
55
56 }, 0 );
57
58 add_action( 'template_redirect', [ $this, 'template_redirect' ] );
59 add_action( 'wp_head', [ $this, 'wp_head' ], 2 );
60
61 add_filter( 'script_loader_src', [ $this, 'replace_base_url' ] );
62 add_filter( 'style_loader_src', [ $this, 'replace_base_url' ] );
63 add_filter( 'wp_get_attachment_url', [ $this, 'replace_base_url' ] );
64 add_filter( 'theme_file_uri', [ $this, 'replace_base_url' ] );
65 add_filter( 'includes_url', [ $this, 'replace_base_url' ] );
66
67 }
68
69 /**
70 * @return void
71 */
72 public static function full_page_cdn_notice() {
73
74 if ( defined( 'GD_CDN_FULLPAGE' ) && true === GD_CDN_FULLPAGE && Plugin::is_reseller_brand()) {
75 new Admin\Notice(
76 self::get_notice_text(),
77 array( 'notice-success' ),
78 'activate_plugins',
79 true
80 );
81 }
82 }
83
84 public static function get_cdn_base() {
85
86 if ( false === self::get_dc_full_id() || ! defined( 'GD_TEMP_DOMAIN' ) ) {
87 return;
88 }
89
90 $dc = strtolower( substr( self::get_dc_full_id(), 0, 2 ) );
91
92 $domain_suffix = '.secureserver.net';
93 $temp_domain = explode( '.', GD_TEMP_DOMAIN );
94 $new_host = null;
95
96 if ( 'myftpupload' === $temp_domain[2] ) {
97 $new_host = sprintf( '%scdn1%s', $dc, $domain_suffix );
98 }
99
100 if ( 'mwp' === $temp_domain[2] && 'accessdomain' === $temp_domain[3] ) {
101 $new_host = sprintf( '%scdn2%s', $dc, $domain_suffix );
102 }
103
104 if ( empty( $new_host ) ) {
105 return;
106 }
107
108 return sprintf( 'https://%s%s.%s', $temp_domain[0], $temp_domain[1], $new_host );
109 }
110
111 public static function set_cdn_base() {
112
113 $cdn_base = self::get_cdn_base();
114
115 if ( ! empty( $cdn_base ) ) {
116 self::$base_url = $cdn_base;
117 }
118
119 }
120
121 /**
122 * Return one of DC strings
123 *
124 * @return false|string
125 */
126 public static function get_dc_full_id() {
127 if ( defined('GD_DC_ID') ) {
128 return GD_DC_ID;
129 }
130 if ( ! empty($_ENV['WPAAS_POD']) ) {
131 return $_ENV['WPAAS_POD'];
132 }
133 if ( ! empty($_SERVER['WPAAS_POD']) ) {
134 return $_SERVER['WPAAS_POD'];
135 }
136
137 return false;
138 }
139
140 public static function get_file_ext() {
141
142 return (array) apply_filters( 'wpaas_cdn_file_ext', self::$file_ext );
143
144 }
145
146 public static function get_base_url() {
147
148 return apply_filters( 'wpaas_cdn_base_url', self::$base_url );
149
150 }
151
152 public static function is_enabled( $skip_admin_check = false ) {
153
154 global $pagenow;
155
156 $vip = defined( 'GD_VIP' ) ? GD_VIP : null;
157 $temp_domain = defined( 'GD_TEMP_DOMAIN' ) ? GD_TEMP_DOMAIN : null;
158 $is_rest = defined( 'REST_REQUEST' ) ? REST_REQUEST : false;
159 $is_nocache = (bool) filter_input( INPUT_GET, 'nocache' );
160 $is_gddebug = (bool) filter_input( INPUT_GET, 'gddebug' );
161 $is_bb = ! is_null( filter_input( INPUT_GET, 'fl_builder' ) ); // Beaver Builder.
162 $cdn_enabled = (bool) apply_filters( 'wpaas_cdn_enabled', defined( 'GD_CDN_ENABLED' ) ? GD_CDN_ENABLED : false );
163 $is_admin = (bool) $skip_admin_check ? false : is_admin();
164 $is_login = ( ! empty( $_SERVER['REQUEST_URI'] ) && wp_parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) === wp_parse_url( wp_login_url(), PHP_URL_PATH ) );
165 $is_debug = defined('GD_WP_DEBUG_CDN') ? GD_WP_DEBUG_CDN : WP_DEBUG;
166
167 return ( $vip && $temp_domain && $cdn_enabled && self::get_file_ext() && ! $is_debug && ! $is_admin && ! $is_login && ! $is_rest && ! $is_nocache && ! $is_gddebug && ! $is_bb );
168
169 }
170
171 public function template_redirect() {
172
173 if ( ! self::is_enabled() || ! $this->pattern ) {
174
175 return;
176
177 }
178
179 ob_start( function ( $content ) {
180
181 $base_url = self::get_base_url();
182
183 return preg_replace( $this->pattern, "{$base_url}/$1", $content );
184
185 } );
186
187 }
188
189 public function wp_head() {
190
191 if ( ! self::is_enabled() ) {
192
193 return;
194
195 }
196
197 $url = wp_parse_url( self::get_base_url() );
198
199 if ( ! empty( $url['scheme'] ) && ! empty( $url['host'] ) ) {
200
201 printf( // xss ok.
202 "<link rel='preconnect' href='%s://%s' crossorigin />\n",
203 $url['scheme'],
204 $url['host']
205 );
206
207 }
208
209 }
210
211 public function replace_base_url( $url ) {
212
213 if ( ! self::is_enabled() || ! $this->pattern ) {
214
215 return $url;
216
217 }
218
219 $base_url = self::get_base_url();
220
221 $url = preg_replace( $this->pattern, "{$base_url}/$1", $url, -1, $count );
222 $time = Plugin::last_cache_flush_date();
223
224 return ( $count && $time ) ? add_query_arg( 'time', $time, $url ) : $url;
225
226 }
227
228 /**
229 * Provide the correct wording for the notice
230 *
231 * @return string
232 */
233 public static function get_notice_text() {
234
235 /**
236 * For GoDaddy customer.
237 */
238
239 $title = __('Your website just got a boost!');
240 $message = __('We have updated your CDN with new features that make your site faster and safer.');
241
242 $format = '
243 <div>
244 <div>
245 <div><strong>'.$title.'</strong></div>
246 ' . $message . '
247 </div>
248 </div>
249 ';
250 return $format;
251 }
252
253
254
255
256
257}
258