C:\xampp\htdocs\landing\wp-content\plugins\wp-asset-clean-up\classes\CleanUp.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<?php
namespace WpAssetCleanUp;

use 
WpAssetCleanUp\OptimiseAssets\OptimizeCommon;

/**
 * Class CleanUp
 * @package WpAssetCleanUp
 */
class CleanUp
{
    
/**
     *
     */
    
public function init()
    {
        
// Is "Test Mode" is enabled and the page is viewed by a regular visitor (not administrator with plugin activation privileges)?
        // Stop here as the script will NOT PREVENT any of the elements below to load
        // They will load as they used to for the regular visitor while the admin debugs the website
        
add_action('init', array($this'doClean'), 12);
    }

    
/**
     *
     */
    
public function doClean()
    {
        if ( 
Plugin::preventAnyFrontendOptimization() || Main::instance()->preventAssetsSettings() ) {
            return;
        }

        
$settings Main::instance()->settings;

        
// Remove "Really Simple Discovery (RSD)" link?
        
if ($settings['remove_rsd_link'] == 1) {
            
// <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://yourwebsite.com/xmlrpc.php?rsd" />
            
remove_action('wp_head''rsd_link');
        }

        
// Remove "Windows Live Writer" link?
        
if ($settings['remove_wlw_link'] == 1) {
            
// <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://yourwebsite.com/wp-includes/wlwmanifest.xml">
            
remove_action('wp_head''wlwmanifest_link');
        }

        
// Remove "REST API" link?
        
if ($settings['remove_rest_api_link'] == 1) {
            
// <link rel='https://api.w.org/' href='https://yourwebsite.com/wp-json/' />
            
remove_action('wp_head''rest_output_link_wp_head');

            
// Removes the following printed within "Response headers":
            // <https://yourwebsite.com/wp-json/>; rel="https://api.w.org/"
            
remove_action'template_redirect''rest_output_link_header'11 );
        }

        
// Remove "Shortlink"?
        
if ($settings['remove_shortlink'] == 1) {
            
// <link rel='shortlink' href="https://yourdomain.com/?p=1">
            
remove_action('wp_head''wp_shortlink_wp_head');

            
// link: <https://yourdomainname.com/wp-json/>; rel="https://api.w.org/", <https://yourdomainname.com/?p=[post_id_here]>; rel=shortlink
            
remove_action('template_redirect''wp_shortlink_header'11);
        }

        
// Remove "Post's Relational Links"?
        
if ($settings['remove_posts_rel_links'] == 1) {
            
// <link rel='prev' title='Title of adjacent post' href='https://yourdomain.com/adjacent-post-slug-here/' />
            
remove_action('wp_head''adjacent_posts_rel_link_wp_head');
        }

        
// Remove "WordPress version" tag?
        
if ($settings['remove_wp_version']) {
            
// <meta name="generator" content="WordPress 4.9.8" />
            
remove_action('wp_head''wp_generator');

            
// also hide it from RSS
            
add_filter('the_generator''__return_false');
        }

        
// Remove Main RSS Feed Link?
        
if ($settings['remove_main_feed_link']) {
            
add_filter('feed_links_show_posts_feed''__return_false');
            
remove_action('wp_head''feed_links_extra'3);
        }

        
// Remove Comment RSS Feed Link?
        
if ($settings['remove_comment_feed_link']) {
            
add_filter('feed_links_show_comments_feed''__return_false');
        }

        
// Disable XML-RPC protocol support (partially or completely)
        
if (in_array($settings['disable_xmlrpc'], array('disable_all''disable_pingback'))) {
            
// Partially or Completely Options / Pingback will be disabled
            
$this->disableXmlRpcPingback();

            
// Complete disable the service
            
if ($settings['disable_xmlrpc'] === 'disable_all') {
                
add_filter('xmlrpc_enabled''__return_false');
            }
        }
    }

    
/**
     * Called in OptimiseAssets/OptimizeCommon.php
     *
     * @param $htmlSource
     *
     * @return string|string[]|null
     */
    
public static function cleanPingbackLinkRel($htmlSource)
    {
        
$pingBackUrl get_bloginfo('pingback_url');

        
$matchRegExps = array(
            
'#<link rel=("|\')pingback("|\') href=("|\')'.$pingBackUrl.'("|\')( /|)>#',
            
'#<link href=("|\')'.$pingBackUrl.'("|\') rel=("|\')pingback("|\')( /|)>#'
        
);

        foreach (
$matchRegExps as $matchRegExp) {
            
$htmlSource preg_replace($matchRegExp''$htmlSource);
        }

        return 
$htmlSource;
    }

    
/**
     *
     */
    
public function disableXmlRpcPingback()
    {
        
// Disable Pingback method
        
add_filter('xmlrpc_methods', static function ($methods) {
            unset(
$methods['pingback.ping'], $methods['pingback.extensions.getPingbacks']);
            return 
$methods;
        } );

        
// Remove X-Pingback HTTP header
        
add_filter('wp_headers', static function ($headers) {
            unset(
$headers['X-Pingback']);
            return 
$headers;
        });
    }

    
/**
     * @param $htmlSource
     *
     * @return mixed
     */
    
public static function removeMetaGenerators($htmlSource)
    {
        
$fetchMethod 'dom'// 'regex' or 'dom'

        
if ($fetchMethod === 'regex') {
            
preg_match_all(
                
'/<meta.*name=(|\'|")generator(\\1).*content=(|\'|")(.*?)(|\'|").*?>/i',
                
$htmlSource,
                
$matchesSourcesFromTags,
                
PREG_SET_ORDER
            
);

            
preg_match_all(
                
'/<meta.*content=(|\'|")(.*?)(\\1).*name=(|\'|")generator(\\2).*?>/i',
                
$htmlSource,
                
$matchesSourcesFromTagsTwo,
                
PREG_SET_ORDER
            
);

            
$matchesSourcesFromTags array_merge($matchesSourcesFromTags$matchesSourcesFromTagsTwo);

            if (empty(
$matchesSourcesFromTags)) {
                return 
$htmlSource;
            }

            
$metaTagsToStrip = array();

            foreach (
$matchesSourcesFromTags as $matchesResults) {
                if (isset(
$matchesResults[0]) && ($matchedTag $matchesResults[0])) {
                    if (
strip_tags($matchedTag) !== '') { // Needs to be a proper match (very rare cases, but it can happen)
                        
continue;
                    }

                    
$metaTagsToStrip[$matchedTag] = '';
                }
            }

            
$htmlSource strtr($htmlSource$metaTagsToStrip);
        } elseif (
$fetchMethod === 'dom') {
            if ( 
function_exists'libxml_use_internal_errors' ) && function_exists'libxml_clear_errors' ) && class_exists'\DOMDocument' ) ) {
                if (
$htmlSource === '') {
                    return 
$htmlSource;
                }

                
$domTag OptimizeCommon::getDomLoadedTag($htmlSource'removeMetaGenerators');

                
$metaTagsToStrip = array();

                foreach ( 
$domTag->getElementsByTagName'meta' ) as $tagObject ) {
                    
$nameAttrValue $tagObject->getAttribute'name' );

                    if ( 
$nameAttrValue === 'generator' ) {
                        
$outerTag $outerTagRegExp trimself::getOuterHTML$tagObject ) );

                        
// As DOMDocument doesn't retrieve the exact string, some alterations to the RegEx have to be made
                        // Leave no room for errors as all sort of characters can be within the "content" attribute
                        
$last2Chars substr$outerTag, - );

                        if ( 
$last2Chars === '">' || $last2Chars === "'>" ) {
                            
$tagWithoutLastChar substr$outerTag0, - );
                            
$outerTagRegExp     preg_quote$tagWithoutLastChar'/' ) . '(.*?)>';
                        }

                        
$outerTagRegExp str_replace(
                            array( 
'"''&lt;''&gt;' ),
                            array( 
'("|\'|)''(<|&lt;)''(>|&gt;)' ),
                            
$outerTagRegExp
                        
);

                        if ( 
strpos$outerTagRegExp'<meta' ) !== false ) {
                            
$outerTagRegExp str_replace('#''\#'$outerTagRegExp);
                            
preg_match_all'#' $outerTagRegExp '#si'$htmlSource$matches );

                            if ( isset( 
$matches[0][0] ) && ! empty( $matches[0][0] ) && strip_tags$matches[0][0] ) === '' ) {
                                
$metaTagsToStrip[$matches[0][0]] = '';
                            }
                        }
                    }
                }

                
$htmlSource strtr($htmlSource$metaTagsToStrip);

                
libxml_clear_errors();
            }
        }

        
/* [wpacu_timing] */
        
Misc::scriptExecTimer'alter_html_source_for_remove_meta_generators',
            
'end' ); /* [/wpacu_timing] */
        
return $htmlSource;
    }

    
/**
     * @param $htmlSource
     * @param bool $ignoreExceptions
     * @param $for
     *
     * @return string|string[]
     */
    
public static function removeHtmlComments($htmlSource$ignoreExceptions false)
    {
        
// No comments? Do not continue
        
if (strpos($htmlSource'<!--') === false) {
            return 
$htmlSource;
        }

        if (! (
function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('\DOMDocument'))) {
            return 
$htmlSource;
        }

        
$domTag OptimizeCommon::getDomLoadedTag($htmlSource'removeHtmlComments');

        if (! 
$domTag) {
            return 
$htmlSource;
        }

        
$xpathComments = new \DOMXPath($domTag);
        
$comments $xpathComments->query('//comment()');

        
libxml_clear_errors();

        if (
$comments === null) {
            return 
$htmlSource;
        }

        
preg_match_all('#<!--(.*?)-->#s'$htmlSource$matchesRegExpComments);

        
// "comments" within tag attributes or script tags?
        // e.g. <script>var type='<!-- A comment here -->';</script>
        // e.g. <div data-info="This is just a <!-- comment --> text">Content here</div>
        
$commentsWithinQuotes = array();

        if (isset(
$matchesRegExpComments[1]) && count($matchesRegExpComments[1]) !== count($comments)) {
            
preg_match_all('#=(|\s+)([\'"])(|\s+)<!--(.*?)-->(|\s+)([\'"])#s'$htmlSource$matchesCommentsWithinQuotes);

            if (isset(
$matchesCommentsWithinQuotes[0]) && ! empty($matchesCommentsWithinQuotes[0])) {
                foreach (
$matchesCommentsWithinQuotes[0] as $matchedDataOriginal) {
                    
$matchedDataUpdated str_replace(
                        array(
'''<!--''-->'),
                        array(
'--wpacu-space-del--''--wpacu-start-comm--''--wpacu-end-comm--'),
                        
$matchedDataOriginal
                    
);

                    
$htmlSource str_replace($matchedDataOriginal$matchedDataUpdated$htmlSource);

                    
$commentsWithinQuotes[] = array(
                        
'original' => $matchedDataOriginal,
                        
'updated'  => $matchedDataUpdated
                    
);
                }
            }
        }

        
$stripCommentsList = array();

        foreach (
$comments as $comment) {
            
$entireComment '<!--' $comment->nodeValue '-->';

            
// Do not strip MSIE conditional comments
            
if ( strpos$entireComment'<!--<![endif]-->' ) !== false ||
                 
preg_match'#<!--\[if(.*?)]>(.*?)<!-->#si'$entireComment ) ||
                 
preg_match'#<!--\[if(.*?)\[endif]-->#si'$entireComment ) ) {
                continue;
            }

            
// Any exceptions set in "Strip HTML comments?" textarea?
            // $ignoreExceptions has to be set to false (as it is by default)
            
if (! $ignoreExceptions && Main::instance()->settings['remove_html_comments_exceptions']) {
                
$removeHtmlCommentsExceptions trim(Main::instance()->settings['remove_html_comments_exceptions']);

                if (
strpos($removeHtmlCommentsExceptions"\n") !== false) {
                    foreach (
explode("\n"$removeHtmlCommentsExceptions) as $removeCommExceptionPattern) {
                        
$removeCommExceptionPattern trim($removeCommExceptionPattern);

                        if (
stripos($entireComment$removeCommExceptionPattern) !== false) {
                            continue 
2;
                        }
                    }
                } elseif (
stripos($entireComment$removeHtmlCommentsExceptions) !== false) {
                    continue;
                }
            }

            if (
strlen($entireComment) < 200) {
                
$stripCommentsList$entireComment ] = '';
            } else {
                
$htmlSource str_replace($entireComment''$htmlSource);
            }
        }

        if (! empty(
$stripCommentsList)) {
            
$htmlSource strtr$htmlSource$stripCommentsList );
        }

        if (! empty(
$commentsWithinQuotes)) {
            foreach (
$commentsWithinQuotes as $commentQuote) {
                
$htmlSource str_replace($commentQuote['updated'], $commentQuote['original'], $htmlSource);
            }
        }

        return 
$htmlSource;
    }

    
/**
     * @param $e
     *
     * @return mixed
     */
    
public static function getOuterHTML($e)
    {
        
$doc = new \DOMDocument();
        
libxml_use_internal_errorstrue );

        
$doc->appendChild($doc->importNode($etrue));

        return 
trim($doc->saveHTML());
    }

    
/**
     * @param $strContains
     * @param $htmlSource
     *
     * @return mixed
     */
    
public static function cleanLinkTagFromHtmlSource($strContains$htmlSource)
    {
        if (! 
is_array($strContains)) {
            
$strContains = array($strContains);
        }

        
$strContains array_map(function($value) { return preg_quote($value'/'); }, $strContains);

        
preg_match_all(
            
'#<link[^>]*('.implode('|'$strContains).')[^>].*(>)#Usmi',
            
$htmlSource,
            
$matchesSourcesFromTags
        
);

        if (empty(
$matchesSourcesFromTags)) {
            return 
$htmlSource;
        }

        foreach (
$matchesSourcesFromTags as $matchesFromTag) {
            if (! (isset(
$matchesFromTag[0]) && $matchesFromTag[0])) {
                continue;
            }

            
$linkTag $matchesFromTag[0];

            if (
stripos($linkTag'<link') === && substr($linkTag, -1) === '>' && strip_tags($linkTag) === '') {
                
$htmlSource str_replace($linkTag''$htmlSource);
            }
        }

        return 
$htmlSource;
    }

    
/**
     * @param $strContains
     * @param $htmlSource
     *
     * @return mixed
     */
    
public static function cleanScriptTagFromHtmlSource($strContains$htmlSource)
    {
        if (! 
is_array($strContains)) {
            
$strContains = array($strContains);
        }

        
$strContains array_map(function($value) { return preg_quote($value'/'); }, $strContains);

        
preg_match_all(
            
'#<script[^>]*('.implode('|'$strContains).')[^>].*(>)#Usmi',
            
$htmlSource,
            
$matchesSourcesFromTags
        
);

        if (empty(
$matchesSourcesFromTags)) {
            return 
$htmlSource;
        }

        foreach (
$matchesSourcesFromTags as $matchesFromTag) {
            if (isset(
$matchesFromTag[0]) && $matchesFromTag[0] && strip_tags($matchesFromTag[0]) === '') {
                
$htmlSource str_replace($matchesFromTag[0] . '</script>'''$htmlSource);
            }
        }

        return 
$htmlSource;
    }

    
/**
     *
     */
    
public function doDisableEmojis()
    {
        
// Emojis Actions and Filters
        
remove_action('admin_print_styles''print_emoji_styles');
        
remove_action('wp_head''print_emoji_detection_script'7);
        
remove_action('admin_print_scripts''print_emoji_detection_script');
        
remove_action('wp_print_styles''print_emoji_styles');

        
remove_filter('wp_mail''wp_staticize_emoji_for_email');
        
remove_filter('the_content_feed''wp_staticize_emoji');
        
remove_filter('comment_text_rss''wp_staticize_emoji');

        
// TinyMCE Emojis
        
add_filter('tiny_mce_plugins', array($this'removeEmojisTinymce'));

        
add_filter('emoji_svg_url''__return_false');
    }

    
/**
     * @param $plugins
     *
     * @return array
     */
    
public function removeEmojisTinymce($plugins)
    {
        if (
is_array($plugins)) {
            return 
array_diff($plugins, array('wpemoji'));
        }

        return array();
    }

    
/**
     *
     */
    
public function doDisableOembed()
    {
        
add_action('init', static function() {
            
// Remove the REST API endpoint.
            
remove_action('rest_api_init''wp_oembed_register_route');

            
// Turn off oEmbed auto discovery.
            
add_filter('embed_oembed_discover''__return_false');

            
// Don't filter oEmbed results.
            
remove_filter('oembed_dataparse''wp_filter_oembed_result');

            
// Remove oEmbed discovery links.
            
remove_action('wp_head''wp_oembed_add_discovery_links');

            
// Remove oEmbed-specific JavaScript from the front-end and back-end.
            
remove_action('wp_head''wp_oembed_add_host_js');

            
add_filter('tiny_mce_plugins', static function ($plugins) {
                return 
array_diff($plugins, array('wpembed'));
            });

            
// Remove all embeds rewrite rules.
            
add_filter('rewrite_rules_array', static function ($rules) {
                foreach(
$rules as $rule => $rewrite) {
                    if (
false !== strpos($rewrite'embed=true')) {
                        unset(
$rules[$rule]);
                    }
                }
                return 
$rules;
            });

            
// Remove filter of the oEmbed result before any HTTP requests are made.
            
remove_filter('pre_oembed_result''wp_filter_pre_oembed_result');
        }, 
9999 );
    }

    
/**
     *
     */
    
public function cleanUpHtmlOutputForAssetsCall()
    {
        if (
array_key_exists('wpacu_clean_load'$_GET)) {
            
// No Admin Bar
            
add_filter('show_admin_bar''__return_false'PHP_INT_MAX);
        }

        
// No Autoptimize
        
if (! defined('AUTOPTIMIZE_NOBUFFER_OPTIMIZE')) {
            
define'AUTOPTIMIZE_NOBUFFER_OPTIMIZE'true );
        }
        
add_filter('autoptimize_filter_noptimize''__return_false');

        
// Use less resources during CSS/JS fetching by preventing other plugins to interfere with the HTML output as it's completely unnecessary in this instance
        
if (Misc::isPluginActive('autoptimize/autoptimize.php')) {
            foreach (array(
'autoptimize_html''autoptimize_css''autoptimize_js''autoptimize_cdn_url''autoptimize_optimize_logged') as $aoOption) {
                
add_filter('pre_option_'.$aoOption, static function($value) { return ''; });
            }
        }

        
// No Fast Velocity Minify
        
add_action('plugins_loaded', static function() {
            
remove_action'setup_theme''fastvelocity_process_frontend' );
        }, 
PHP_INT_MAX);

        
// No WP Rocket (Minify / Concatenate)
        
add_filter('get_rocket_option_minify_css''__return_false');
        
add_filter('get_rocket_option_minify_concatenate_css''__return_false');

        
add_filter('get_rocket_option_minify_js''__return_false');
        
add_filter('get_rocket_option_minify_concatenate_js''__return_false');

        
// No W3 Total Cache: Minify
        
add_filter('w3tc_minify_enable''__return_false');

        
// [NO SG Optimiser]
        
self::filterSGOptions();

        
// Emulate page builder param to view page with no SG Optimiser on request
        // Extra params to be used in case 'SG Optimiser' is called before Asset CleanUp: 'fl_builder', 'vcv-action', 'et_fb', 'ct_builder', 'tve'
        
add_filter('sgo_pb_params', static function($pbParams) {
            
$pbParams[] = WPACU_LOAD_ASSETS_REQ_KEY// fetching assets
            
$pbParams[] = 'wpacu_clean_load'// loading the page unoptimized for debugging purposes
            
return $pbParams;
        });

        
// Fallback in case SG Optimizer is triggered BEFORE Asset CleanUp and the filter above will not work
        
add_filter('sgo_css_combine_exclude', array($this'allCssHandles'));
        
add_filter('sgo_css_minify_exclude',  array($this'allCssHandles'));
        
add_filter('sgo_js_minify_exclude',   array($this'allJsHandles'));
        
add_filter('sgo_js_async_exclude',    array($this'allJsHandles'));

        
add_filter('sgo_html_minify_exclude_params', static function ($excludeParams) {
            
$excludeParams[] = WPACU_LOAD_ASSETS_REQ_KEY// fetching assets
            
$excludeParams[] = 'wpacu_clean_load'// loading the page unoptimized for debugging purposes
            
return $excludeParams;
        });
        
// [/NO SG Optimiser]
    
}

    
/**
     *
     */
    
public static function filterSGOptions()
    {
        
// SG Optimizer Plugin
        
$sgOptimizerMapping = array(
            
'autoflush'            => 'siteground_optimizer_autoflush_cache',
            
'dynamic-cache'        => 'siteground_optimizer_enable_cache',
            
'memcache'             => 'siteground_optimizer_enable_memcached',
            
'ssl-fix'              => 'siteground_optimizer_fix_insecure_content',
            
'html'                 => 'siteground_optimizer_optimize_html',
            
'js'                   => 'siteground_optimizer_optimize_javascript',
            
'js-async'             => 'siteground_optimizer_optimize_javascript_async',
            
'css'                  => 'siteground_optimizer_optimize_css',
            
'combine-css'          => 'siteground_optimizer_combine_css',
            
'querystring'          => 'siteground_optimizer_remove_query_strings',
            
'emojis'               => 'siteground_optimizer_disable_emojis',
            
'images'               => 'siteground_optimizer_optimize_images',
            
'lazyload_images'      => 'siteground_optimizer_lazyload_images',
            
'lazyload_gravatars'   => 'siteground_optimizer_lazyload_gravatars',
            
'lazyload_thumbnails'  => 'siteground_optimizer_lazyload_thumbnails',
            
'lazyload_responsive'  => 'siteground_optimizer_lazyload_responsive',
            
'lazyload_textwidgets' => 'siteground_optimizer_lazyload_textwidgets',
            
'ssl'                  => 'siteground_optimizer_ssl_enabled',
            
'gzip'                 => 'siteground_optimizer_enable_gzip_compression',
            
'browser-caching'      => 'siteground_optimizer_enable_browser_caching',
        );

        foreach (
$sgOptimizerMapping as $optionName) {
            
add_filter('pre_option_'.$optionName'__return_false');
        }
    }

    
/**
     * @return array
     */
    
public function allCssHandles()
    {
        global 
$wp_styles;

        
$allCssHandles = array();

        if (isset(
$wp_styles->registered) && ! empty($wp_styles->registered)) {
            
$allCssHandles array_keys($wp_styles->registered);
        }

        return 
$allCssHandles;
    }

    
/**
     * @return array
     */
    
public function allJsHandles()
    {
        global 
$wp_scripts;

        
$allJsHandles = array();

        if (isset(
$wp_scripts->registered) && ! empty($wp_scripts->registered)) {
            
$allJsHandles array_keys($wp_scripts->registered);
        }

        return 
$allJsHandles;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586