Breeze – WordPress Cache Plugin - Version 1.2.6

Version Description

  • Add: Varnish cache will be clear while plugin deactivate.
    • Add: Enable cache for specific user role.
    • Add: Disable Emojis to reduce request
    • Add: Delete breeze options values from database on plugin deletion.
    • Fix: Compatibility issue of map short codes with GeoDirectory plugin.
    • Fix: Compatibility issue with Ad Inserter plugin.
    • Fix: Compatibility issue of minification with Beaver Builder Plugin.
    • Fix: Compatibility issue of JS scripts with AMP Plugin.
    • Fix: Reduce cookie life time span while user posts a comment.
    • Fix: HTML elements filtered from RestAPI end point of lazy-load scripts.
    • Fix: Config file of each subsite save with appropriate ID in advance cache file.
    • Fix: Google Analytics script exclude from Minification.
Download this release

Release Info

Developer adeelkhan
Plugin Icon 128x128 Breeze – WordPress Cache Plugin
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.5 to 1.2.6

breeze.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
- * Version: 1.2.5
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
@@ -37,7 +37,7 @@ if ( ! defined( 'BREEZE_PLUGIN_DIR' ) ) {
37
  define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
38
  }
39
  if ( ! defined( 'BREEZE_VERSION' ) ) {
40
- define( 'BREEZE_VERSION', '1.2.5' );
41
  }
42
  if ( ! defined( 'BREEZE_SITEURL' ) ) {
43
  define( 'BREEZE_SITEURL', get_site_url() );
@@ -71,6 +71,8 @@ define( 'BREEZE_ROOT_DIR', str_replace( BREEZE_WP_CONTENT_NAME, '', WP_CONTENT_D
71
  require_once BREEZE_PLUGIN_DIR . 'inc/plugin-incompatibility/class-breeze-incompatibility-plugins.php';
72
  // Check for if folder/files are writable.
73
  require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-file-permissions.php';
 
 
74
 
75
  // Helper functions.
76
  require_once BREEZE_PLUGIN_DIR . 'inc/helpers.php';
@@ -82,6 +84,8 @@ require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-cache.php' );
82
  require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-per-time.php' );
83
  // Handle post exclude if shortcode.
84
  require_once( BREEZE_PLUGIN_DIR . 'inc/class-exclude-pages-by-shortcode.php' );
 
 
85
 
86
  // Activate plugin hook
87
  register_activation_hook( __FILE__, array( 'Breeze_Admin', 'plugin_active_hook' ) );
@@ -340,6 +344,27 @@ function breeze_check_for_new_version() {
340
 
341
  // If the WP install is multi-site
342
  if ( is_multisite() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  $advanced_network = get_site_option( 'breeze_advanced_settings' );
344
  $is_advanced = get_site_option( 'breeze_advanced_settings_120' );
345
 
@@ -372,14 +397,40 @@ function breeze_check_for_new_version() {
372
  switch_to_blog( $blog_id );
373
 
374
  // if the settings are inherited, then we do not need to refresh the config file.
375
- $inherit_option = get_blog_option( $blog_id, 'breeze_inherit_settings' );
 
 
 
 
376
  $inherit_option = filter_var( $inherit_option, FILTER_VALIDATE_BOOLEAN );
377
 
378
  // If the settings are not inherited from parent blog, then refresh the config file.
379
  if ( false === $inherit_option ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  $advanced_options = get_blog_option( $blog_id, 'breeze_advanced_settings' );
381
  $is_advanced = get_blog_option( $blog_id, 'breeze_advanced_settings_120' );
382
 
 
383
  if ( empty( $is_advanced ) && empty( $advanced_options['breeze-delay-js-scripts'] ) ) {
384
  $advanced_options['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
385
 
@@ -410,6 +461,29 @@ function breeze_check_for_new_version() {
410
  }
411
  }
412
  } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  // For single site.
414
  $advanced = breeze_get_option( 'advanced_settings' );
415
  $is_advanced = get_option( 'breeze_advanced_settings_120' );
@@ -438,6 +512,7 @@ function breeze_check_for_new_version() {
438
 
439
  delete_option( 'breeze_new_update' );
440
  }
 
441
  }
442
  }
443
 
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
+ * Version: 1.2.6
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
37
  define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
38
  }
39
  if ( ! defined( 'BREEZE_VERSION' ) ) {
40
+ define( 'BREEZE_VERSION', '1.2.6' );
41
  }
42
  if ( ! defined( 'BREEZE_SITEURL' ) ) {
43
  define( 'BREEZE_SITEURL', get_site_url() );
71
  require_once BREEZE_PLUGIN_DIR . 'inc/plugin-incompatibility/class-breeze-incompatibility-plugins.php';
72
  // Check for if folder/files are writable.
73
  require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-file-permissions.php';
74
+ // AMP compatibility.
75
+ require_once BREEZE_PLUGIN_DIR . 'inc/plugin-incompatibility/breeze-amp-compatibility.php';
76
 
77
  // Helper functions.
78
  require_once BREEZE_PLUGIN_DIR . 'inc/helpers.php';
84
  require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-per-time.php' );
85
  // Handle post exclude if shortcode.
86
  require_once( BREEZE_PLUGIN_DIR . 'inc/class-exclude-pages-by-shortcode.php' );
87
+ // Handle the WP emoji library.
88
+ require_once( BREEZE_PLUGIN_DIR . 'inc/class-breeze-disable-emoji-option.php' );
89
 
90
  // Activate plugin hook
91
  register_activation_hook( __FILE__, array( 'Breeze_Admin', 'plugin_active_hook' ) );
344
 
345
  // If the WP install is multi-site
346
  if ( is_multisite() ) {
347
+ $basic = get_site_option( 'breeze_basic_settings' );
348
+ if ( isset( $basic['breeze-disable-admin'] ) && ! is_array( $basic['breeze-disable-admin'] ) ) {
349
+ $all_user_roles = breeze_all_wp_user_roles();
350
+ $active_cache_users = array();
351
+ foreach ( $all_user_roles as $usr_role ) {
352
+ $active_cache_users[ $usr_role ] = 0;
353
+
354
+ }
355
+
356
+ $old_user_cache = filter_var( $basic['breeze-disable-admin'], FILTER_VALIDATE_BOOLEAN );
357
+
358
+ $basic['breeze-disable-admin'] = $active_cache_users;
359
+
360
+ if ( false === $old_user_cache ) {
361
+ $basic['breeze-disable-admin']['administrator'] = 1;
362
+ unset( $old_user_cache );
363
+ }
364
+
365
+ update_site_option( 'breeze_basic_settings', $basic );
366
+ }
367
+
368
  $advanced_network = get_site_option( 'breeze_advanced_settings' );
369
  $is_advanced = get_site_option( 'breeze_advanced_settings_120' );
370
 
397
  switch_to_blog( $blog_id );
398
 
399
  // if the settings are inherited, then we do not need to refresh the config file.
400
+ $inherit_option = get_blog_option( $blog_id, 'breeze_inherit_settings', '' );
401
+ if ( '' === $inherit_option ) {
402
+ $inherit_option = '1';
403
+ update_blog_option( $blog_id, 'breeze_inherit_settings', $inherit_option );
404
+ }
405
  $inherit_option = filter_var( $inherit_option, FILTER_VALIDATE_BOOLEAN );
406
 
407
  // If the settings are not inherited from parent blog, then refresh the config file.
408
  if ( false === $inherit_option ) {
409
+ // update cache for logged-in users from administrator only to all user roles.
410
+ $basic = get_blog_option( $blog_id, 'breeze_basic_settings' );
411
+ if ( isset( $basic['breeze-disable-admin'] ) && ! is_array( $basic['breeze-disable-admin'] ) ) {
412
+ $all_user_roles = breeze_all_wp_user_roles();
413
+ $active_cache_users = array();
414
+ foreach ( $all_user_roles as $usr_role ) {
415
+ $active_cache_users[ $usr_role ] = 0;
416
+
417
+ }
418
+ $old_user_cache = filter_var( $basic['breeze-disable-admin'], FILTER_VALIDATE_BOOLEAN );
419
+
420
+ $basic['breeze-disable-admin'] = $active_cache_users;
421
+
422
+ if ( false === $old_user_cache ) {
423
+ $basic['breeze-disable-admin']['administrator'] = 1;
424
+ unset( $old_user_cache );
425
+ }
426
+
427
+ update_blog_option( $blog_id, 'breeze_basic_settings', $basic );
428
+ }
429
+
430
  $advanced_options = get_blog_option( $blog_id, 'breeze_advanced_settings' );
431
  $is_advanced = get_blog_option( $blog_id, 'breeze_advanced_settings_120' );
432
 
433
+
434
  if ( empty( $is_advanced ) && empty( $advanced_options['breeze-delay-js-scripts'] ) ) {
435
  $advanced_options['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
436
 
461
  }
462
  }
463
  } else {
464
+ // update cache for logged-in users from administrator only to all user roles.
465
+ $basic = get_option( 'breeze_basic_settings' );
466
+ if ( isset( $basic['breeze-disable-admin'] ) && ! is_array( $basic['breeze-disable-admin'] ) ) {
467
+
468
+ $all_user_roles = breeze_all_wp_user_roles();
469
+ $active_cache_users = array();
470
+ foreach ( $all_user_roles as $usr_role ) {
471
+ $active_cache_users[ $usr_role ] = 0;
472
+
473
+ }
474
+ $old_user_cache = filter_var( $basic['breeze-disable-admin'], FILTER_VALIDATE_BOOLEAN );
475
+
476
+ $basic['breeze-disable-admin'] = $active_cache_users;
477
+
478
+ if ( false === $old_user_cache ) {
479
+ $basic['breeze-disable-admin']['administrator'] = 1;
480
+ unset( $old_user_cache );
481
+ }
482
+
483
+
484
+ update_option( 'breeze_basic_settings', $basic );
485
+ }
486
+
487
  // For single site.
488
  $advanced = breeze_get_option( 'advanced_settings' );
489
  $is_advanced = get_option( 'breeze_advanced_settings_120' );
512
 
513
  delete_option( 'breeze_new_update' );
514
  }
515
+ Breeze_ConfigCache::factory()->write();
516
  }
517
  }
518
 
inc/breeze-admin.php CHANGED
@@ -333,6 +333,14 @@ class Breeze_Admin {
333
  if ( empty( $basic ) ) {
334
  $basic = array();
335
  }
 
 
 
 
 
 
 
 
336
  $default_basic = array(
337
  'breeze-active' => '1',
338
  'breeze-ttl' => '',
@@ -344,7 +352,7 @@ class Breeze_Admin {
344
  'breeze-desktop-cache' => '1',
345
  'breeze-browser-cache' => '1',
346
  'breeze-mobile-cache' => '1',
347
- 'breeze-disable-admin' => '1',
348
  'breeze-display-clean' => '1',
349
  'breeze-include-inline-js' => '0',
350
  'breeze-include-inline-css' => '0',
@@ -445,6 +453,12 @@ class Breeze_Admin {
445
 
446
  $blogs = get_sites();
447
  foreach ( $blogs as $blog ) {
 
 
 
 
 
 
448
  $blog_basic = get_blog_option( (int) $blog->blog_id, 'breeze_basic_settings', '' );
449
  if ( empty( $blog_basic ) ) {
450
  update_blog_option( (int) $blog->blog_id, 'breeze_basic_settings', $basic );
@@ -510,6 +524,8 @@ class Breeze_Admin {
510
  breeze_update_option( 'varnish_cache', $varnish );
511
  }
512
  }
 
 
513
  } else {
514
  $singe_network_basic = breeze_get_option( 'basic_settings' );
515
  if ( ! $singe_network_basic ) {
@@ -563,8 +579,95 @@ class Breeze_Admin {
563
  Breeze_ConfigCache::factory()->clean_config();
564
  Breeze_ConfigCache::factory()->toggle_caching( false );
565
  Breeze_Configuration::update_htaccess( true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  }
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  /*
569
  * Render tab for the settings in back-end.
570
  */
333
  if ( empty( $basic ) ) {
334
  $basic = array();
335
  }
336
+
337
+ $all_user_roles = breeze_all_wp_user_roles();
338
+ $active_cache_users = array();
339
+ foreach ( $all_user_roles as $usr_role ) {
340
+ $active_cache_users[ $usr_role ] = 0;
341
+
342
+ }
343
+
344
  $default_basic = array(
345
  'breeze-active' => '1',
346
  'breeze-ttl' => '',
352
  'breeze-desktop-cache' => '1',
353
  'breeze-browser-cache' => '1',
354
  'breeze-mobile-cache' => '1',
355
+ 'breeze-disable-admin' => $active_cache_users,
356
  'breeze-display-clean' => '1',
357
  'breeze-include-inline-js' => '0',
358
  'breeze-include-inline-css' => '0',
453
 
454
  $blogs = get_sites();
455
  foreach ( $blogs as $blog ) {
456
+ $is_inherit_already = get_blog_option( (int) $blog->blog_id, 'breeze_inherit_settings', '' );
457
+ if ( '' === $is_inherit_already ) {
458
+ update_blog_option( (int) $blog->blog_id, 'breeze_inherit_settings', '1' );
459
+ }
460
+
461
+
462
  $blog_basic = get_blog_option( (int) $blog->blog_id, 'breeze_basic_settings', '' );
463
  if ( empty( $blog_basic ) ) {
464
  update_blog_option( (int) $blog->blog_id, 'breeze_basic_settings', $basic );
524
  breeze_update_option( 'varnish_cache', $varnish );
525
  }
526
  }
527
+
528
+ Breeze_ConfigCache::factory()->write_config_cache( true );
529
  } else {
530
  $singe_network_basic = breeze_get_option( 'basic_settings' );
531
  if ( ! $singe_network_basic ) {
579
  Breeze_ConfigCache::factory()->clean_config();
580
  Breeze_ConfigCache::factory()->toggle_caching( false );
581
  Breeze_Configuration::update_htaccess( true );
582
+
583
+ $check_varnish = is_varnish_cache_started();
584
+ if ( $check_varnish ) {
585
+ if ( is_multisite() ) {
586
+ $sites = get_sites();
587
+ foreach ( $sites as $site ) {
588
+ switch_to_blog( $site->blog_id );
589
+ do_action( 'breeze_clear_varnish' );
590
+ restore_current_blog();
591
+ }
592
+ } else {
593
+ do_action( 'breeze_clear_varnish' );
594
+ }
595
+ }
596
  }
597
 
598
+ /**
599
+ * Removed the files and the database settings when plugin is uninstalled
600
+ * @since 1.1.6
601
+ * @static
602
+ * @access public
603
+ */
604
+ public static function plugin_uninstall_hook() {
605
+ // Remove config files and update .htaccess.
606
+ self::plugin_deactive_hook();
607
+ // Remove data from the database.
608
+ self::purge_local_options();
609
+ }
610
+
611
+ public static function purge_local_options() {
612
+ if ( ( is_admin() || 'cli' === php_sapi_name() ) ) {
613
+ if ( is_multisite() ) {
614
+ $sites = get_sites(
615
+ array(
616
+ 'fields' => 'ids',
617
+ )
618
+ );
619
+
620
+ // Delete NETWORK level options.
621
+ $network_id = get_current_network_id();
622
+ delete_network_option( $network_id, 'breeze_basic_settings' );
623
+ delete_network_option( $network_id, 'breeze_advanced_settings' );
624
+ delete_network_option( $network_id, 'breeze_cdn_integration' );
625
+ delete_network_option( $network_id, 'breeze_varnish_cache' );
626
+ delete_network_option( $network_id, 'breeze_inherit_settings' );
627
+ delete_network_option( $network_id, 'breeze_show_incompatibility' );
628
+ delete_network_option( $network_id, 'breeze_first_install' );
629
+ delete_network_option( $network_id, 'breeze_advanced_settings_120' );
630
+ delete_network_option( $network_id, 'breeze_new_update' );
631
+ delete_network_option( $network_id, 'breeze_ecommerce_detect' );
632
+ delete_network_option( $network_id, 'breeze_exclude_url_pages' );
633
+ delete_network_option( $network_id, 'breeze_hide_notice' );
634
+
635
+ // Delete options for each sub-blog.
636
+ foreach ( $sites as $blog_id ) {
637
+ switch_to_blog( $blog_id );
638
+ delete_option( 'breeze_basic_settings' );
639
+ delete_option( 'breeze_advanced_settings' );
640
+ delete_option( 'breeze_cdn_integration' );
641
+ delete_option( 'breeze_varnish_cache' );
642
+ delete_option( 'breeze_inherit_settings' );
643
+ delete_option( 'breeze_show_incompatibility' );
644
+ delete_option( 'breeze_first_install' );
645
+ delete_option( 'breeze_advanced_settings_120' );
646
+ delete_option( 'breeze_new_update' );
647
+ delete_option( 'breeze_ecommerce_detect' );
648
+ delete_option( 'breeze_exclude_url_pages' );
649
+ delete_option( 'breeze_hide_notice' );
650
+ restore_current_blog();
651
+ }
652
+ } else {
653
+ // Delete options for each sub-blog.
654
+ delete_option( 'breeze_basic_settings' );
655
+ delete_option( 'breeze_advanced_settings' );
656
+ delete_option( 'breeze_cdn_integration' );
657
+ delete_option( 'breeze_varnish_cache' );
658
+ delete_option( 'breeze_inherit_settings' );
659
+ delete_option( 'breeze_show_incompatibility' );
660
+ delete_option( 'breeze_first_install' );
661
+ delete_option( 'breeze_advanced_settings_120' );
662
+ delete_option( 'breeze_new_update' );
663
+ delete_option( 'breeze_ecommerce_detect' );
664
+ delete_option( 'breeze_exclude_url_pages' );
665
+ delete_option( 'breeze_hide_notice' );
666
+ }
667
+ }
668
+ }
669
+
670
+
671
  /*
672
  * Render tab for the settings in back-end.
673
  */
inc/breeze-configuration.php CHANGED
@@ -39,21 +39,53 @@ class Breeze_Configuration {
39
  isset( $_POST['breeze_inherit_settings_nonce'] ) &&
40
  wp_verify_nonce( $_POST['breeze_inherit_settings_nonce'], 'breeze_inherit_settings' )
41
  ) {
42
- $inherit_settings = ( 1 == $_REQUEST['inherit-settings'] ? '1' : '0' );
 
43
  update_option( 'breeze_inherit_settings', $inherit_settings );
44
  Breeze_ConfigCache::factory()->write();
45
 
 
 
 
 
 
 
46
  if ( ! isset( $_REQUEST['breeze_basic_action'], $_REQUEST['breeze_advanced_action'] ) ) {
47
  WP_Filesystem();
48
  Breeze_ConfigCache::factory()->write_config_cache();
49
  }
 
 
 
 
 
 
 
50
  }
51
 
 
52
  // Basic options tab
53
  if ( isset( $_REQUEST['breeze_basic_action'] ) && $_REQUEST['breeze_basic_action'] == 'breeze_basic_settings' ) {
54
  if ( isset( $_POST['breeze_settings_basic_nonce'] ) && wp_verify_nonce( $_POST['breeze_settings_basic_nonce'], 'breeze_settings_basic' ) ) {
55
  WP_Filesystem();
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  $basic = array(
58
  'breeze-active' => ( isset( $_POST['cache-system'] ) ? '1' : '0' ),
59
  'breeze-cross-origin' => ( isset( $_POST['safe-cross-origin'] ) ? '1' : '0' ),
@@ -66,10 +98,11 @@ class Breeze_Configuration {
66
  'breeze-browser-cache' => ( isset( $_POST['browser-cache'] ) ? '1' : '0' ),
67
  'breeze-desktop-cache' => (int) $_POST['desktop-cache'],
68
  'breeze-mobile-cache' => (int) $_POST['mobile-cache'],
69
- 'breeze-disable-admin' => ( isset( $_POST['breeze-admin-cache'] ) ? '0' : '1' ), // 0 is enable, 1 is disable in this case.
70
  'breeze-display-clean' => '1',
71
  'breeze-include-inline-js' => ( isset( $_POST['include-inline-js'] ) ? '1' : '0' ),
72
  'breeze-include-inline-css' => ( isset( $_POST['include-inline-css'] ) ? '1' : '0' ),
 
73
  );
74
 
75
  breeze_update_option( 'basic_settings', $basic, true );
@@ -101,12 +134,12 @@ class Breeze_Configuration {
101
  // Advanced options tab
102
  if ( isset( $_REQUEST['breeze_advanced_action'] ) && $_REQUEST['breeze_advanced_action'] == 'breeze_advanced_settings' ) {
103
  if ( isset( $_POST['breeze_settings_advanced_nonce'] ) && wp_verify_nonce( $_POST['breeze_settings_advanced_nonce'], 'breeze_settings_advanced' ) ) {
104
- $exclude_urls = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-urls'] ) );
105
- $exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
106
- $exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
107
- $delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
108
  $cache_query_str = $this->string_convert_arr( sanitize_textarea_field( $_POST['cache-query-str'] ) );
109
- $preload_fonts = $move_to_footer_js = $defer_js = array();
110
 
111
  if ( ! empty( $exclude_js ) ) {
112
  $exclude_js = array_unique( $exclude_js );
39
  isset( $_POST['breeze_inherit_settings_nonce'] ) &&
40
  wp_verify_nonce( $_POST['breeze_inherit_settings_nonce'], 'breeze_inherit_settings' )
41
  ) {
42
+
43
+ $inherit_settings = ( true === filter_var( $_REQUEST['inherit-settings'], FILTER_VALIDATE_BOOLEAN ) ? '1' : '0' );
44
  update_option( 'breeze_inherit_settings', $inherit_settings );
45
  Breeze_ConfigCache::factory()->write();
46
 
47
+ Breeze_ConfigCache::factory()->write_config_cache( true );
48
+ $is_inherit_settings_change = filter_var( $inherit_settings, FILTER_VALIDATE_BOOLEAN );
49
+ if ( ! is_network_admin() && true === $is_inherit_settings_change ) {
50
+ do_action( 'breeze_clear_all_cache' );
51
+ }
52
+
53
  if ( ! isset( $_REQUEST['breeze_basic_action'], $_REQUEST['breeze_advanced_action'] ) ) {
54
  WP_Filesystem();
55
  Breeze_ConfigCache::factory()->write_config_cache();
56
  }
57
+
58
+ //return current page
59
+ if ( ! is_network_admin() && true === $is_inherit_settings_change && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
60
+ $url = remove_query_arg( 'database-cleanup', $_REQUEST['_wp_http_referer'] );
61
+ wp_safe_redirect( add_query_arg( 'save-settings', 'success', $url ) );
62
+ exit;
63
+ }
64
  }
65
 
66
+
67
  // Basic options tab
68
  if ( isset( $_REQUEST['breeze_basic_action'] ) && $_REQUEST['breeze_basic_action'] == 'breeze_basic_settings' ) {
69
  if ( isset( $_POST['breeze_settings_basic_nonce'] ) && wp_verify_nonce( $_POST['breeze_settings_basic_nonce'], 'breeze_settings_basic' ) ) {
70
  WP_Filesystem();
71
 
72
+ $is_inherit_settings_on = filter_var( get_option( 'breeze_inherit_settings', '' ), FILTER_VALIDATE_BOOLEAN );
73
+ if ( ! is_network_admin() && true === $is_inherit_settings_on && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
74
+ $url = remove_query_arg( 'database-cleanup', $_REQUEST['_wp_http_referer'] );
75
+ wp_safe_redirect( add_query_arg( 'save-settings', 'success', $url ) );
76
+ exit;
77
+ }
78
+
79
+ $post_activate_cache = isset( $_POST['breeze-admin-cache'] ) ? $_POST['breeze-admin-cache'] : array();
80
+ $all_user_roles = breeze_all_wp_user_roles();
81
+ $active_cache_users = array();
82
+ foreach ( $all_user_roles as $usr_role ) {
83
+ $active_cache_users[ $usr_role ] = 0;
84
+ if ( isset( $post_activate_cache[ $usr_role ] ) ) {
85
+ $active_cache_users[ $usr_role ] = 1;
86
+ }
87
+ }
88
+
89
  $basic = array(
90
  'breeze-active' => ( isset( $_POST['cache-system'] ) ? '1' : '0' ),
91
  'breeze-cross-origin' => ( isset( $_POST['safe-cross-origin'] ) ? '1' : '0' ),
98
  'breeze-browser-cache' => ( isset( $_POST['browser-cache'] ) ? '1' : '0' ),
99
  'breeze-desktop-cache' => (int) $_POST['desktop-cache'],
100
  'breeze-mobile-cache' => (int) $_POST['mobile-cache'],
101
+ 'breeze-disable-admin' => $active_cache_users, // 0 is enable, 1 is disable in this case. @TODO remove this text.
102
  'breeze-display-clean' => '1',
103
  'breeze-include-inline-js' => ( isset( $_POST['include-inline-js'] ) ? '1' : '0' ),
104
  'breeze-include-inline-css' => ( isset( $_POST['include-inline-css'] ) ? '1' : '0' ),
105
+ 'breeze-wp-emoji' => ( isset( $_POST['breeze-wpjs-emoji'] ) ? '1' : '0' ),
106
  );
107
 
108
  breeze_update_option( 'basic_settings', $basic, true );
134
  // Advanced options tab
135
  if ( isset( $_REQUEST['breeze_advanced_action'] ) && $_REQUEST['breeze_advanced_action'] == 'breeze_advanced_settings' ) {
136
  if ( isset( $_POST['breeze_settings_advanced_nonce'] ) && wp_verify_nonce( $_POST['breeze_settings_advanced_nonce'], 'breeze_settings_advanced' ) ) {
137
+ $exclude_urls = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-urls'] ) );
138
+ $exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
139
+ $exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
140
+ $delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
141
  $cache_query_str = $this->string_convert_arr( sanitize_textarea_field( $_POST['cache-query-str'] ) );
142
+ $preload_fonts = $move_to_footer_js = $defer_js = array();
143
 
144
  if ( ! empty( $exclude_js ) ) {
145
  $exclude_js = array_unique( $exclude_js );
inc/cache/config-cache.php CHANGED
@@ -51,8 +51,8 @@ class Breeze_ConfigCache {
51
 
52
  foreach ( $blogs as $blog_id ) {
53
  switch_to_blog( $blog_id );
54
- $config = breeze_get_option( 'basic_settings' );
55
- if ( ! empty( $config['breeze-active'] ) ) {
56
  $inherit_option = get_blog_option( $blog_id, 'breeze_inherit_settings', '0' );
57
  $inherit_option = filter_var( $inherit_option, FILTER_VALIDATE_BOOLEAN );
58
  if ( false === $inherit_option ) {
@@ -62,7 +62,7 @@ class Breeze_ConfigCache {
62
  // Site uses global configuration.
63
  $cache_configs['breeze-config'][ $blog_id ] = preg_replace( '(^https?://)', '', site_url() );
64
  }
65
- }
66
  restore_current_blog();
67
  }
68
  } else {
@@ -131,7 +131,7 @@ class Breeze_ConfigCache {
131
  $the_blog_id = (int) $e[2];
132
  }
133
 
134
- }
135
 
136
  $define_blog_identity = "\n\t\t\$config['blog_id']={$the_blog_id};";
137
  $file_string .= "\n\t\t\$config['config_path'] = '$blog_file';" . $define_blog_identity . "\n\t\tbreak;";
@@ -146,9 +146,9 @@ class Breeze_ConfigCache {
146
  $file_string .= "\n\t" . 'return $config;';
147
  $file_string .= "\n}";
148
  $file_string .= "\n" . '$config = breeze_fetch_configuration_data( $site_url );';
149
- $file_string .= "\n" . 'if ( empty( $config ) && false === filter_var( SUBDOMAIN_INSTALL, FILTER_VALIDATE_BOOLEAN ) && true === filter_var( MULTISITE, FILTER_VALIDATE_BOOLEAN ) ) {';
150
- $file_string .= "\n\t" . '$config = breeze_fetch_configuration_data( $domain );';
151
- $file_string .= "\n" . '}';
152
  }
153
 
154
  $file_string .= "\nif ( empty( \$config ) || ! isset( \$config['config_path'] ) || ! @file_exists( \$config['config_path'] ) ) { return; }" .
@@ -186,7 +186,7 @@ class Breeze_ConfigCache {
186
  $storage = array(
187
  'homepage' => $homepage_url,
188
  'cache_options' => $settings,
189
- 'disable_per_adminuser' => 0,
190
  'exclude_url' => array(),
191
  );
192
 
@@ -194,6 +194,8 @@ class Breeze_ConfigCache {
194
  $storage['blog_id'] = get_current_blog_id();
195
  }
196
 
 
 
197
  $storage['enabled-lazy-load'] = ( isset( $config['breeze-lazy-load'] ) ? $config['breeze-lazy-load'] : 0 );
198
  $storage['use-lazy-load-native'] = ( isset( $config['breeze-lazy-load-native'] ) ? $config['breeze-lazy-load-native'] : 0 );
199
  $storage['breeze-preload-links'] = ( isset( $config['breeze-preload-links'] ) ? $config['breeze-preload-links'] : 0 );
@@ -208,6 +210,7 @@ class Breeze_ConfigCache {
208
  // permalink_structure
209
  if ( is_multisite() ) {
210
  if ( is_network_admin() ) {
 
211
  // network oes not have this setting.
212
  // we save for each sub-site.
213
  $blogs = get_sites();
@@ -216,7 +219,8 @@ class Breeze_ConfigCache {
216
  $blog_id = $blog_data->blog_id;
217
  switch_to_blog( $blog_id );
218
 
219
- $storage['permalink_structure'][ 'blog_' . $blog_id ] = get_blog_option( $blog_id, 'permalink_structure', '' );
 
220
 
221
  restore_current_blog();
222
  }
@@ -419,6 +423,14 @@ class Breeze_ConfigCache {
419
  * @return bool|void
420
  */
421
  public function toggle_caching( $status ) {
 
 
 
 
 
 
 
 
422
 
423
  global $wp_filesystem;
424
  if ( defined( 'WP_CACHE' ) && WP_CACHE === $status ) {
51
 
52
  foreach ( $blogs as $blog_id ) {
53
  switch_to_blog( $blog_id );
54
+ //$config = breeze_get_option( 'basic_settings' );
55
+ //if ( ! empty( $config['breeze-active'] ) ) {
56
  $inherit_option = get_blog_option( $blog_id, 'breeze_inherit_settings', '0' );
57
  $inherit_option = filter_var( $inherit_option, FILTER_VALIDATE_BOOLEAN );
58
  if ( false === $inherit_option ) {
62
  // Site uses global configuration.
63
  $cache_configs['breeze-config'][ $blog_id ] = preg_replace( '(^https?://)', '', site_url() );
64
  }
65
+ //}
66
  restore_current_blog();
67
  }
68
  } else {
131
  $the_blog_id = (int) $e[2];
132
  }
133
 
134
+ }
135
 
136
  $define_blog_identity = "\n\t\t\$config['blog_id']={$the_blog_id};";
137
  $file_string .= "\n\t\t\$config['config_path'] = '$blog_file';" . $define_blog_identity . "\n\t\tbreak;";
146
  $file_string .= "\n\t" . 'return $config;';
147
  $file_string .= "\n}";
148
  $file_string .= "\n" . '$config = breeze_fetch_configuration_data( $site_url );';
149
+ //$file_string .= "\n" . 'if ( empty( $config ) && false === filter_var( SUBDOMAIN_INSTALL, FILTER_VALIDATE_BOOLEAN ) && true === filter_var( MULTISITE, FILTER_VALIDATE_BOOLEAN ) ) {';
150
+ //$file_string .= "\n\t" . '$config = breeze_fetch_configuration_data( $domain );';
151
+ //$file_string .= "\n" . '}';
152
  }
153
 
154
  $file_string .= "\nif ( empty( \$config ) || ! isset( \$config['config_path'] ) || ! @file_exists( \$config['config_path'] ) ) { return; }" .
186
  $storage = array(
187
  'homepage' => $homepage_url,
188
  'cache_options' => $settings,
189
+ 'disable_per_adminuser' => array(),
190
  'exclude_url' => array(),
191
  );
192
 
194
  $storage['blog_id'] = get_current_blog_id();
195
  }
196
 
197
+ $storage['wp-user-roles'] = breeze_all_wp_user_roles();
198
+
199
  $storage['enabled-lazy-load'] = ( isset( $config['breeze-lazy-load'] ) ? $config['breeze-lazy-load'] : 0 );
200
  $storage['use-lazy-load-native'] = ( isset( $config['breeze-lazy-load-native'] ) ? $config['breeze-lazy-load-native'] : 0 );
201
  $storage['breeze-preload-links'] = ( isset( $config['breeze-preload-links'] ) ? $config['breeze-preload-links'] : 0 );
210
  // permalink_structure
211
  if ( is_multisite() ) {
212
  if ( is_network_admin() ) {
213
+ unset( $storage['woocommerce_geolocation_ajax'] );
214
  // network oes not have this setting.
215
  // we save for each sub-site.
216
  $blogs = get_sites();
219
  $blog_id = $blog_data->blog_id;
220
  switch_to_blog( $blog_id );
221
 
222
+ $storage['woocommerce_geolocation_ajax_inherit'][ 'subsite_' . $blog_id ] = ( 'geolocation_ajax' === get_blog_option( $blog_id, 'woocommerce_default_customer_address', '' ) ) ? 1 : 0;
223
+ $storage['permalink_structure'][ 'blog_' . $blog_id ] = get_blog_option( $blog_id, 'permalink_structure', '' );
224
 
225
  restore_current_blog();
226
  }
423
  * @return bool|void
424
  */
425
  public function toggle_caching( $status ) {
426
+ $allow_cache_toggle = true;
427
+ if ( is_multisite() && ! is_network_admin() ) {
428
+ $allow_cache_toggle = false;
429
+ }
430
+
431
+ if ( false === $allow_cache_toggle ) {
432
+ return false;
433
+ }
434
 
435
  global $wp_filesystem;
436
  if ( defined( 'WP_CACHE' ) && WP_CACHE === $status ) {
inc/cache/execute-cache.php CHANGED
@@ -4,27 +4,54 @@
4
  */
5
  defined( 'ABSPATH' ) || exit;
6
 
7
- if ( isset( $GLOBALS['breeze_config'], $GLOBALS['breeze_config']['disable_per_adminuser'] ) ) {
8
- $breeze_is_cache_disabled = $GLOBALS['breeze_config']['disable_per_adminuser'];
9
- $breeze_is_cache_disabled = filter_var( $breeze_is_cache_disabled, FILTER_VALIDATE_BOOLEAN );
 
 
 
 
 
 
 
10
 
 
11
  $wp_cookies = array( 'wordpressuser_', 'wordpresspass_', 'wordpress_sec_', 'wordpress_logged_in_' );
12
 
13
- $breeze_user_logged = false;
 
 
14
  foreach ( $_COOKIE as $key => $value ) {
15
  // Logged in!
16
  if ( strpos( $key, 'wordpress_logged_in_' ) !== false ) {
17
  $breeze_user_logged = true;
18
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
 
21
- if ( true === $breeze_user_logged && true === $breeze_is_cache_disabled ) {
22
  return;
23
  }
24
 
25
  }
26
- // Load helper functions.
27
- require_once dirname( __DIR__ ) . '/functions.php';
28
 
29
  // Load lazy Load class.
30
  require_once dirname( __DIR__ ) . '/class-breeze-lazy-load.php';
@@ -38,6 +65,10 @@ if ( strpos( $_SERVER['REQUEST_URI'], 'robots.txt' ) !== false || strpos( $_SERV
38
  return;
39
  }
40
 
 
 
 
 
41
  if (
42
  strpos( $_SERVER['REQUEST_URI'], 'breeze-minification' ) !== false ||
43
  strpos( $_SERVER['REQUEST_URI'], 'favicon.ico' ) !== false
@@ -163,6 +194,7 @@ if ( ! $check_exclude ) {
163
  * @since 1.0
164
  */
165
  function breeze_cache( $buffer, $flags ) {
 
166
  // No cache for pages without 200 response status
167
  if ( http_response_code() !== 200 ) {
168
  return $buffer;
@@ -171,13 +203,8 @@ function breeze_cache( $buffer, $flags ) {
171
  require_once 'Mobile-Detect-2.8.25/Mobile_Detect.php';
172
  $detect = new \Cloudways\Breeze\Mobile_Detect\Mobile_Detect;
173
  //not cache per administrator if option disable optimization for admin users clicked
174
- if ( ! empty( $GLOBALS['breeze_config'] ) && (int) $GLOBALS['breeze_config']['disable_per_adminuser'] ) {
175
- if ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) {
176
- $current_user = wp_get_current_user();
177
- if ( in_array( 'administrator', $current_user->roles ) ) {
178
- return $buffer;
179
- }
180
- }
181
  }
182
 
183
  if ( strlen( $buffer ) < 255 ) {
@@ -477,6 +504,11 @@ function check_exclude_page( $opts_config, $current_url ) {
477
  return true;
478
  }
479
 
 
 
 
 
 
480
  //check disable cache for page
481
  if ( ! empty( $opts_config['exclude_url'] ) ) {
482
 
4
  */
5
  defined( 'ABSPATH' ) || exit;
6
 
7
+ if ( isset( $GLOBALS['breeze_config'], $GLOBALS['breeze_config']['cache_options'], $GLOBALS['breeze_config']['cache_options']['breeze-active'] ) ) {
8
+ $is_caching_active = filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-active'], FILTER_VALIDATE_BOOLEAN );
9
+ if ( false === $is_caching_active ) {
10
+ return;
11
+ }
12
+ }
13
+
14
+
15
+ // Load helper functions.
16
+ require_once dirname( __DIR__ ) . '/functions.php';
17
 
18
+ if ( isset( $GLOBALS['breeze_config'], $GLOBALS['breeze_config']['disable_per_adminuser'] ) ) {
19
  $wp_cookies = array( 'wordpressuser_', 'wordpresspass_', 'wordpress_sec_', 'wordpress_logged_in_' );
20
 
21
+ $breeze_user_logged = false;
22
+ $breeze_use_cache_system = filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-active'], FILTER_VALIDATE_BOOLEAN );
23
+ $folder_cache = '';
24
  foreach ( $_COOKIE as $key => $value ) {
25
  // Logged in!
26
  if ( strpos( $key, 'wordpress_logged_in_' ) !== false ) {
27
  $breeze_user_logged = true;
28
  }
29
+
30
+ if ( BREEZE_WP_COOKIE === $key ) {
31
+ $folder_cache = breeze_which_role_folder( $value );
32
+ }
33
+
34
+ }
35
+
36
+ if ( ! empty( $folder_cache ) ) {
37
+ $is_active = false;
38
+ foreach ( $folder_cache as $cache_role ) {
39
+ if (
40
+ isset( $GLOBALS['breeze_config']['disable_per_adminuser'][ $cache_role ] ) &&
41
+ true === filter_var( $GLOBALS['breeze_config']['disable_per_adminuser'][ $cache_role ], FILTER_VALIDATE_BOOLEAN )
42
+ ) {
43
+ $is_active = true;
44
+ }
45
+ }
46
+
47
+ $breeze_use_cache_system = $is_active;
48
  }
49
 
50
+ if ( true === $breeze_user_logged && false === $breeze_use_cache_system ) {
51
  return;
52
  }
53
 
54
  }
 
 
55
 
56
  // Load lazy Load class.
57
  require_once dirname( __DIR__ ) . '/class-breeze-lazy-load.php';
65
  return;
66
  }
67
 
68
+ if ( strpos( $_SERVER['REQUEST_URI'], '/wp-json/geodir/' ) !== false ) {
69
+ return;
70
+ }
71
+
72
  if (
73
  strpos( $_SERVER['REQUEST_URI'], 'breeze-minification' ) !== false ||
74
  strpos( $_SERVER['REQUEST_URI'], 'favicon.ico' ) !== false
194
  * @since 1.0
195
  */
196
  function breeze_cache( $buffer, $flags ) {
197
+ global $breeze_user_logged, $breeze_use_cache_system;
198
  // No cache for pages without 200 response status
199
  if ( http_response_code() !== 200 ) {
200
  return $buffer;
203
  require_once 'Mobile-Detect-2.8.25/Mobile_Detect.php';
204
  $detect = new \Cloudways\Breeze\Mobile_Detect\Mobile_Detect;
205
  //not cache per administrator if option disable optimization for admin users clicked
206
+ if ( true === $breeze_user_logged && false === $breeze_use_cache_system ) {
207
+ return $buffer;
 
 
 
 
 
208
  }
209
 
210
  if ( strlen( $buffer ) < 255 ) {
504
  return true;
505
  }
506
 
507
+ $is_amp = breeze_uri_amp_check( $current_url );
508
+ if ( true === $is_amp ) {
509
+ return true;
510
+ }
511
+
512
  //check disable cache for page
513
  if ( ! empty( $opts_config['exclude_url'] ) ) {
514
 
inc/cache/purge-cache.php CHANGED
@@ -46,7 +46,7 @@ class Breeze_PurgeCache {
46
 
47
  $post_id = $comment->comment_post_ID;
48
 
49
- setcookie( 'breeze_commented_posts[' . $post_id . ']', parse_url( get_permalink( $post_id ), PHP_URL_PATH ), ( time() + HOUR_IN_SECONDS * 24 * 30 ) );
50
  }
51
  }
52
 
46
 
47
  $post_id = $comment->comment_post_ID;
48
 
49
+ setcookie( 'breeze_commented_posts[' . $post_id . ']', parse_url( get_permalink( $post_id ), PHP_URL_PATH ), ( time() + HOUR_IN_SECONDS * 24 * 7 ) );
50
  }
51
  }
52
 
inc/class-breeze-disable-emoji-option.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
7
+
8
+ if ( ! class_exists( 'Breeze_Disable_Emoji_Option' ) ) {
9
+ /**
10
+ * Disable the emoji library in WordPress.
11
+ *
12
+ * Class Breeze_Disable_Emoji_Option
13
+ * @since 1.1.9
14
+ */
15
+ class Breeze_Disable_Emoji_Option {
16
+
17
+ private $emoji_status = false;
18
+
19
+ function __construct() {
20
+ $basic = breeze_get_option( 'basic_settings' );
21
+ $this->emoji_status = isset( $basic['breeze-wp-emoji'] ) ? filter_var( $basic['breeze-wp-emoji'], FILTER_VALIDATE_BOOLEAN ) : false;
22
+
23
+ if ( true === $this->emoji_status ) {
24
+ add_action( 'init', array( &$this, 'disable_emoji_wp_wide' ) );
25
+ remove_action( 'init', 'smilies_init', 5 );
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Remove the emoji functionalities from multiple locations in WordPress.
31
+ * @since 1.1.9
32
+ * @access public
33
+ */
34
+ public function disable_emoji_wp_wide() {
35
+ /**
36
+ * Remove the print of inline Emoji detection script.
37
+ *
38
+ * @see print_emoji_detection_script()
39
+ */
40
+ remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
41
+ remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
42
+
43
+ /**(
44
+ * Remove the printed the important emoji-related CSS styles.
45
+ * @see print_emoji_styles()
46
+ */
47
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
48
+ remove_action( 'admin_print_styles', 'print_emoji_styles' );
49
+
50
+
51
+ /**
52
+ * Remove the script that converts the emoji to a static img element.
53
+ * @see wp_staticize_emoji()
54
+ */
55
+ remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
56
+ remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
57
+
58
+ /**
59
+ * Remove the script that converts emoji in emails into static images.
60
+ * @see wp_staticize_emoji_for_email()
61
+ */
62
+ remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
63
+
64
+ /**
65
+ * Disable Emoji DNS prefetch.
66
+ */
67
+ add_filter( 'emoji_svg_url', '__return_false' );
68
+
69
+ /**
70
+ * Disable the emoji library from TinyMce editor.
71
+ */
72
+ add_filter( 'tiny_mce_plugins', array( &$this, 'disable_tinymce_emojis_script' ) );
73
+
74
+ add_filter( 'wp_resource_hints', array( &$this, 'disable_prefetch' ), 10, 2 );
75
+ add_filter( 'smilies', array( &$this, 'remove_conversion' ) );
76
+ }
77
+
78
+ public function remove_conversion() {
79
+ return array();
80
+ }
81
+
82
+ /**
83
+ * Disable the emoji library from TinyMce editor.
84
+ *
85
+ * @param array $plugins
86
+ *
87
+ * @return array
88
+ * @access public
89
+ * @since 1.1.9
90
+ */
91
+ public function disable_tinymce_emojis_script( $plugins = array() ) {
92
+ if ( is_array( $plugins ) && ! empty( $plugins ) ) {
93
+ return array_diff( $plugins, array( 'wpemoji' ) );
94
+ } else {
95
+ return array();
96
+ }
97
+ }
98
+
99
+ public function disable_prefetch( $url_list, $type ) {
100
+ if ( 'dns-prefetch' === mb_strtolower( $type ) ) {
101
+ // Strip out any URLs referencing the WordPress.org emoji location
102
+ $emoji_svg_url_bit = 'https://s.w.org/images/core/emoji/';
103
+ foreach ( $url_list as $key => $url ) {
104
+ if ( strpos( $url, $emoji_svg_url_bit ) !== false ) {
105
+ unset( $url_list[ $key ] );
106
+ }
107
+ }
108
+ }
109
+
110
+ return $url_list;
111
+ }
112
+ }
113
+
114
+ new Breeze_Disable_Emoji_Option();
115
+ }
inc/class-breeze-lazy-load.php CHANGED
@@ -84,6 +84,10 @@ class Breeze_Lazy_Load {
84
  public function apply_lazy_load_feature() {
85
  $content = $this->content;
86
 
 
 
 
 
87
  if ( false === $this->lazy_load_enabled ) {
88
  return $content;
89
  }
84
  public function apply_lazy_load_feature() {
85
  $content = $this->content;
86
 
87
+ if ( defined( 'REST_REQUEST' ) || is_feed() || is_admin() || is_comment_feed() || is_preview() || is_robots() || is_trackback() ) {
88
+ return $content;
89
+ }
90
+
91
  if ( false === $this->lazy_load_enabled ) {
92
  return $content;
93
  }
inc/class-breeze-query-strings-rules.php CHANGED
@@ -109,7 +109,18 @@ class Breeze_Query_Strings_Rules {
109
  $this->always_cache_query = apply_filters( 'breeze_always_cache_query_strings', $this->always_cache_query );
110
 
111
  // woocommerce_geolocation_ajax
112
- if ( isset( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) && 1 === (int) $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) {
 
 
 
 
 
 
 
 
 
 
 
113
  $this->always_cache_query[] = 'v';
114
  }
115
 
109
  $this->always_cache_query = apply_filters( 'breeze_always_cache_query_strings', $this->always_cache_query );
110
 
111
  // woocommerce_geolocation_ajax
112
+ if ( isset( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax_inherit'] ) && ! empty( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax_inherit'] ) ) {
113
+ $sub_blog_id = $GLOBALS['breeze_config']['blog_id'];
114
+
115
+ if (
116
+ isset( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax_inherit'][ 'subsite_' . $sub_blog_id ] )
117
+ &&
118
+ 1 === (int) $GLOBALS['breeze_config']['woocommerce_geolocation_ajax_inherit'][ 'subsite_' . $sub_blog_id ]
119
+ ) {
120
+ $this->always_cache_query[] = 'v';
121
+ }
122
+
123
+ } else if ( isset( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) && 1 === (int) $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) {
124
  $this->always_cache_query[] = 'v';
125
  }
126
 
inc/functions.php CHANGED
@@ -82,30 +82,69 @@ function breeze_get_directory_size( $dir, $exclude = array() ) {
82
  }
83
 
84
  function breeze_current_user_type( $as_dir = true ) {
 
 
 
 
85
 
86
- if ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) {
87
- if ( current_user_can( 'administrator' ) ) {
88
- return 'administrator' . ( true === $as_dir ? '/' : '' );
89
- } elseif ( current_user_can( 'editor' ) ) {
90
- return 'editor' . ( true === $as_dir ? '/' : '' );
91
- } elseif ( current_user_can( 'author' ) ) {
92
- return 'author' . ( true === $as_dir ? '/' : '' );
93
- } elseif ( current_user_can( 'contributor' ) ) {
94
- return 'contributor' . ( true === $as_dir ? '/' : '' );
95
  }
96
  }
97
 
 
98
  return '';
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  function breeze_all_user_folders() {
102
- return array(
 
 
 
103
  '',
104
  'administrator',
105
  'editor',
106
  'author',
107
  'contributor',
108
  );
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
  function breeze_is_feed( $url ) {
@@ -127,3 +166,141 @@ function breeze_is_feed( $url ) {
127
  return false;
128
 
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  function breeze_current_user_type( $as_dir = true ) {
85
+ $all_roles = array();
86
+ if ( isset( $GLOBALS['breeze_config']['wp-user-roles'] ) ) {
87
+ $all_roles = $GLOBALS['breeze_config']['wp-user-roles'];
88
+ }
89
 
90
+ foreach ( $all_roles as $user_role ) {
91
+ if ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) {
92
+ if ( current_user_can( $user_role ) ) {
93
+ return $user_role . ( true === $as_dir ? '/' : '' );
94
+ }
 
 
 
 
95
  }
96
  }
97
 
98
+
99
  return '';
100
  }
101
 
102
+
103
+ /**
104
+ * Fetches all the current user roles in the wp install, including custom user roles.
105
+ *
106
+ * @return array
107
+ * @since 1.2.5
108
+ */
109
+ function breeze_all_wp_user_roles() {
110
+ global $wp_roles;
111
+
112
+ if ( empty( $wp_roles ) || is_wp_error( $wp_roles ) ) {
113
+ return array();
114
+ }
115
+
116
+ $current_roles = array();
117
+ $roles = $wp_roles->roles;
118
+
119
+ foreach ( $roles as $defined_user_role => $data ) {
120
+ $current_roles[] = $defined_user_role;
121
+ }
122
+
123
+ return $current_roles;
124
+
125
+ }
126
+
127
  function breeze_all_user_folders() {
128
+ $all_roles = breeze_all_wp_user_roles();
129
+
130
+
131
+ $roles = array(
132
  '',
133
  'administrator',
134
  'editor',
135
  'author',
136
  'contributor',
137
  );
138
+
139
+ if ( ! empty( $all_roles ) ) {
140
+ foreach ( $all_roles as $role ) {
141
+ if ( ! in_array( $role, $roles, true ) ) {
142
+ $roles[] = $role;
143
+ }
144
+ }
145
+ }
146
+
147
+ return $roles;
148
  }
149
 
150
  function breeze_is_feed( $url ) {
166
  return false;
167
 
168
  }
169
+
170
+
171
+ function breeze_treat_exceptions( $content ) {
172
+ preg_match_all( '/<ins(.*)>/', $content, $matches );
173
+ if ( ! empty( $matches ) && ( isset( $matches[0] ) && ! empty( $matches[0] ) ) ) {
174
+ foreach ( $matches[0] as $html_tag ) {
175
+ $decode = html_entity_decode( $html_tag );
176
+ $decode = str_replace( '”', '', $decode );
177
+ $content = str_replace( $html_tag, $decode, $content );
178
+ }
179
+ }
180
+
181
+ return $content;
182
+
183
+ }
184
+
185
+ /**
186
+ * Check for AMP based on URL.
187
+ *
188
+ * @param string $url Given url.
189
+ *
190
+ * @return bool
191
+ */
192
+ function breeze_uri_amp_check( $url = '' ) {
193
+
194
+ if (
195
+ false !== strpos( $url, '/amp/' ) ||
196
+ false !== strpos( $url, 'amp=1' ) ||
197
+ false !== strpos( $url, '?amp' )
198
+ ) {
199
+ return true;
200
+ }
201
+
202
+ return false;
203
+ }
204
+
205
+
206
+ if ( defined( 'AUTH_SALT' ) && ! empty( AUTH_SALT ) ) {
207
+ define( 'BREEZE_WP_COOKIE_SALT', AUTH_SALT );
208
+ } else {
209
+ define( 'BREEZE_WP_COOKIE_SALT', 'cQCDC6Z^R#FE*WpRHqfaWOfw!1baSb*NxeOP1B1^u9@X7x*%ah' );
210
+ }
211
+ define( 'BREEZE_WP_COOKIE', 'breeze_folder_name' );
212
+
213
+ add_action( 'set_auth_cookie', 'breeze_auth_cookie_set', 15, 6 );
214
+ function breeze_auth_cookie_set( $auth_cookie, $expire, $expiration, $user_id, $scheme, $token ) {
215
+
216
+ if ( ! apply_filters( 'send_auth_cookies', true ) ) {
217
+ return;
218
+ }
219
+
220
+ // get_userdata
221
+ $current_user_roles = (array) get_userdata( $user_id )->roles;
222
+ //$role = reset( $current_user_roles );
223
+
224
+ $all_roles = array();
225
+ foreach ( $current_user_roles as $index => $one_role ) {
226
+ $all_roles[] = sha1( BREEZE_WP_COOKIE_SALT . $one_role );
227
+ }
228
+ $role = implode( '|&&&|', $all_roles );
229
+ $secure = is_ssl();
230
+
231
+ // Front-end cookie is secure when the auth cookie is secure and the site's home URL uses HTTPS.
232
+ $secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
233
+ $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure );
234
+
235
+ setcookie( BREEZE_WP_COOKIE, $role, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
236
+ }
237
+
238
+ add_action( 'clear_auth_cookie', 'breeze_auth_cookie_clear' );
239
+
240
+ function breeze_auth_cookie_clear() {
241
+ /** This filter is documented in wp-includes/pluggable.php */
242
+ if ( ! apply_filters( 'send_auth_cookies', true ) ) {
243
+ return;
244
+ }
245
+ setcookie( BREEZE_WP_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
246
+
247
+ }
248
+
249
+ add_action( 'init', 'breeze_auth_cookie_set_init', 5 );
250
+
251
+ function breeze_auth_cookie_set_init() {
252
+
253
+ if ( is_user_logged_in() && ! isset( $_COOKIE[ BREEZE_WP_COOKIE ] ) || empty( BREEZE_WP_COOKIE ) ) {
254
+
255
+ if ( ! apply_filters( 'send_auth_cookies', true ) ) {
256
+ return;
257
+ }
258
+
259
+ $current_user = wp_get_current_user();
260
+ $current_user_roles = (array) $current_user->roles;
261
+ //$role = reset( $current_user_roles );
262
+ $all_roles = array();
263
+ foreach ( $current_user_roles as $index => $one_role ) {
264
+ $all_roles[] = sha1( BREEZE_WP_COOKIE_SALT . $one_role );
265
+ }
266
+ $role = implode( '|&&&|', $all_roles );
267
+ $secure = is_ssl();
268
+
269
+ // Front-end cookie is secure when the auth cookie is secure and the site's home URL uses HTTPS.
270
+ $secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
271
+ $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $current_user->ID, $secure );
272
+ $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $current_user->ID, true );
273
+ $expire = $expiration + ( 12 * HOUR_IN_SECONDS );
274
+
275
+ setcookie( BREEZE_WP_COOKIE, $role, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
276
+ }
277
+ }
278
+
279
+
280
+ function breeze_which_role_folder( $hash = '' ) {
281
+ if ( empty( $hash ) ) {
282
+ return false;
283
+ }
284
+
285
+ if ( isset( $GLOBALS['breeze_config'] ) && isset( $GLOBALS['breeze_config']['wp-user-roles'] ) ) {
286
+ $cache_folders = $GLOBALS['breeze_config']['wp-user-roles'];
287
+ } else {
288
+ return '';
289
+ }
290
+
291
+ $hash_roles = explode( '|&&&|', $hash );
292
+
293
+ $user_has_roles = array();
294
+
295
+ if ( ! empty( $cache_folders ) ) {
296
+ foreach ( $cache_folders as $folder ) {
297
+ $coded = sha1( BREEZE_WP_COOKIE_SALT . $folder );
298
+
299
+ if ( in_array( $coded, $hash_roles ) ) {
300
+ $user_has_roles[] = $folder;
301
+ }
302
+ }
303
+ }
304
+
305
+ return $user_has_roles;
306
+ }
inc/helpers.php CHANGED
@@ -827,3 +827,16 @@ function breeze_is_delayjs_changed( $is_network = false, $blog_id = 0, $root = f
827
 
828
  return true;
829
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
827
 
828
  return true;
829
  }
830
+
831
+ /**
832
+ * The Page is AMP so don't minifiy stuff.
833
+ * @return bool
834
+ * @since 1.2.3
835
+ */
836
+ function breeze_is_amp_page() {
837
+ if ( function_exists( 'amp_is_request' ) && amp_is_request() ) {
838
+ return true;
839
+ }
840
+
841
+ return false;
842
+ }
inc/minification/breeze-js-deferred-loading.php CHANGED
@@ -243,6 +243,11 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
243
 
244
  if ( preg_match_all( '#<script.*</script>#Usmi', $content, $matches ) ) {
245
  foreach ( $matches[0] as $tag ) {
 
 
 
 
 
246
  // only consider aggregation whitelisted in should_aggregate-function
247
  if ( ! $this->should_aggregate( $tag ) ) {
248
  $tag = '';
@@ -334,8 +339,6 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
334
  $tag = '';
335
  }
336
  }
337
- //Remove the original script tag
338
- $content = str_replace( $tag, '', $content );
339
  } else {
340
  if ( breeze_validate_url_via_regexp( $url ) ) {
341
 
@@ -427,47 +430,6 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
427
  }
428
  }
429
 
430
- // handle the 3rd party defer scripts in header.
431
- if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['header'] ) ) {
432
- $replace_tag = array( '</head>', 'before' );
433
- $js_head_defer = array();
434
- $defer = 'defer ';
435
- foreach ( $this->delay_scripts['header'] as $js_url => $js_script ) {
436
- if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
437
- if ( ! empty( $js_script['version'] ) ) {
438
- $js_url .= '?' . $js_script['version'];
439
- }
440
- $js_head_defer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
441
- } else {
442
- $js_head_defer[] = "<script type='module'>{$js_script}</script>\n";
443
- }
444
- }
445
- $js_replacement = '';
446
- $js_replacement .= implode( '', $js_head_defer );
447
- $this->inject_in_html( $js_replacement, $replace_tag );
448
- }
449
-
450
- // handle the 3rd party defer scripts in footer.
451
- if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['footer'] ) ) {
452
- $replace_tag = array( '</body>', 'before' );
453
- $js_footer_defer = array();
454
- $defer = 'defer ';
455
- foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
456
- if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
457
- if ( ! empty( $js_script['version'] ) ) {
458
- $js_url .= '?' . $js_script['version'];
459
- }
460
- $js_footer_defer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
461
- } else {
462
- $js_footer_defer[] = "<script type='module'>{$js_script}</script>\n";
463
- }
464
- }
465
-
466
- $js_replacement = '';
467
- $js_replacement .= implode( '', $js_footer_defer );
468
- $this->inject_in_html( $js_replacement, $replace_tag );
469
- }
470
-
471
  // Load inline JS to html
472
  if ( ! empty( $this->head_scripts ) ) {
473
 
@@ -531,6 +493,58 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
531
  $this->inject_in_html( $js_replacement, $replaceTag );
532
  }
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  // restore comments
535
  $this->content = $this->restore_comments( $this->content );
536
 
243
 
244
  if ( preg_match_all( '#<script.*</script>#Usmi', $content, $matches ) ) {
245
  foreach ( $matches[0] as $tag ) {
246
+ if ( ! empty( $tag ) ) {
247
+ $tag = str_replace( '”', '"', $tag );
248
+ }
249
+
250
+
251
  // only consider aggregation whitelisted in should_aggregate-function
252
  if ( ! $this->should_aggregate( $tag ) ) {
253
  $tag = '';
339
  $tag = '';
340
  }
341
  }
 
 
342
  } else {
343
  if ( breeze_validate_url_via_regexp( $url ) ) {
344
 
430
  }
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  // Load inline JS to html
434
  if ( ! empty( $this->head_scripts ) ) {
435
 
493
  $this->inject_in_html( $js_replacement, $replaceTag );
494
  }
495
 
496
+
497
+ // handle the 3rd party defer scripts in header.
498
+ if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['header'] ) ) {
499
+ $replace_tag = array( '</head>', 'before' );
500
+ $js_head_defer = array();
501
+ $defer = 'defer';
502
+ foreach ( $this->delay_scripts['header'] as $js_url => $js_script ) {
503
+ if ( is_string( $js_url ) ) {
504
+ $js_url = trim( $js_url, '”' );
505
+ }
506
+
507
+ if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
508
+ if ( ! empty( $js_script['version'] ) ) {
509
+ $js_url_add = '?' . $js_script['version'];
510
+ $js_url_add = trim( $js_url_add, "'" );
511
+ }
512
+ $js_head_defer[] = "<script type='application/javascript' {$defer} src='{$js_url_add}'></script>\n";
513
+ } else {
514
+ $js_head_defer[] = "<script type='module'>{$js_script}</script>\n";
515
+ }
516
+ }
517
+ $js_replacement = '';
518
+ $js_replacement .= implode( '', $js_head_defer );
519
+ $this->inject_in_html( $js_replacement, $replace_tag );
520
+ }
521
+
522
+ // handle the 3rd party defer scripts in footer.
523
+ if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['footer'] ) ) {
524
+ $replace_tag = array( '</body>', 'before' );
525
+ $js_footer_defer = array();
526
+ $defer = 'defer';
527
+ foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
528
+ if ( is_string( $js_url ) ) {
529
+ $js_url = trim( $js_url, '”' );
530
+ }
531
+
532
+ if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
533
+ if ( ! empty( $js_script['version'] ) ) {
534
+ $js_url_add = $js_url . '?' . $js_script['version'];
535
+ $js_url_add = trim( $js_url_add, "'" );
536
+ }
537
+ $js_footer_defer[] = "<script type=\"application/javascript\" {$defer} src=\"{$js_url_add}\"></script>\n";
538
+ } else {
539
+ $js_footer_defer[] = "<script type='module'>{$js_script}</script>\n";
540
+ }
541
+ }
542
+
543
+ $js_replacement = '';
544
+ $js_replacement .= implode( '', $js_footer_defer );
545
+ $this->inject_in_html( $js_replacement, $replace_tag );
546
+ }
547
+
548
  // restore comments
549
  $this->content = $this->restore_comments( $this->content );
550
 
inc/minification/breeze-minification-scripts.php CHANGED
@@ -255,6 +255,12 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
255
  }
256
 
257
  foreach ( $matches[0] as $tag ) {
 
 
 
 
 
 
258
  // only consider aggregation whitelisted in should_aggregate-function
259
  if ( ! $this->should_aggregate( $tag ) ) {
260
  $tag = '';
@@ -796,6 +802,11 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
796
  $js_head_defer = array();
797
  $defer = 'defer ';
798
  foreach ( $this->delay_scripts['header'] as $js_url => $js_script ) {
 
 
 
 
 
799
  if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
800
  if ( ! empty( $js_script['version'] ) ) {
801
  $js_url .= '?' . $js_script['version'];
@@ -816,7 +827,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
816
  $js_footer_defer = array();
817
  $defer = 'defer ';
818
  foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
 
819
  $js_url = trim( $js_url, '”' );
 
820
 
821
  if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
822
  if ( ! empty( $js_script['version'] ) ) {
255
  }
256
 
257
  foreach ( $matches[0] as $tag ) {
258
+
259
+ if ( false !== strpos( $tag, 'ga(' ) || false !== strpos( $tag, 'google-analytics.com/analytics.js' ) ) {
260
+ $tag = '';
261
+ continue;
262
+ }
263
+
264
  // only consider aggregation whitelisted in should_aggregate-function
265
  if ( ! $this->should_aggregate( $tag ) ) {
266
  $tag = '';
802
  $js_head_defer = array();
803
  $defer = 'defer ';
804
  foreach ( $this->delay_scripts['header'] as $js_url => $js_script ) {
805
+ if ( is_string( $js_url ) ) {
806
+ $js_url = trim( $js_url, '”' );
807
+ }
808
+
809
+
810
  if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
811
  if ( ! empty( $js_script['version'] ) ) {
812
  $js_url .= '?' . $js_script['version'];
827
  $js_footer_defer = array();
828
  $defer = 'defer ';
829
  foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
830
+ if ( is_string( $js_url ) ) {
831
  $js_url = trim( $js_url, '”' );
832
+ }
833
 
834
  if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
835
  if ( ! empty( $js_script['version'] ) ) {
inc/minification/breeze-minify-main.php CHANGED
@@ -23,6 +23,15 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
23
  class Breeze_Minify {
24
 
25
  public function __construct() {
 
 
 
 
 
 
 
 
 
26
  //check disable cache for page
27
  $http_host_breeze = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
28
  $domain = ( ( ( isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' ) . $http_host_breeze;
@@ -59,7 +68,7 @@ class Breeze_Minify {
59
  }
60
  }
61
  }
62
-
63
  }
64
 
65
  /**
@@ -279,12 +288,22 @@ class Breeze_Minify {
279
 
280
  $content = apply_filters( 'breeze_filter_html_before_minify', $content );
281
 
282
- if ( ! isset( $conf['breeze-disable-admin'] ) ) {
283
- $conf['breeze-disable-admin'] = true;
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
 
286
- $breeze_is_cache_disabled = filter_var( $conf['breeze-disable-admin'], FILTER_VALIDATE_BOOLEAN );
287
- if ( ! empty( $conf ) && true === $breeze_is_cache_disabled && is_user_logged_in() ) {
288
  $content = apply_filters( 'breeze_html_after_minify', $content );
289
 
290
  } else {
23
  class Breeze_Minify {
24
 
25
  public function __construct() {
26
+ $conf = breeze_get_option( 'basic_settings' );
27
+ $is_caching_active = filter_var( $conf['breeze-active'], FILTER_VALIDATE_BOOLEAN );
28
+
29
+ if ( defined( 'WP_CACHE' ) && false === WP_CACHE ) {
30
+ $is_caching_active = false;
31
+ }
32
+
33
+ if ( true === $is_caching_active ) {
34
+
35
  //check disable cache for page
36
  $http_host_breeze = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
37
  $domain = ( ( ( isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' ) . $http_host_breeze;
68
  }
69
  }
70
  }
71
+ }
72
  }
73
 
74
  /**
288
 
289
  $content = apply_filters( 'breeze_filter_html_before_minify', $content );
290
 
291
+ $is_caching_on = filter_var( $conf['breeze-active'], FILTER_VALIDATE_BOOLEAN );
292
+ if ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) {
293
+ $current_user = wp_get_current_user();
294
+ $current_user_roles = (array) $current_user->roles;
295
+ //$one_role = reset( $current_user_roles );
296
+ $is_found = false;
297
+ foreach ( $current_user_roles as $index => $one_role ) {
298
+ if ( isset( $conf['breeze-disable-admin'][ $one_role ] ) && true === filter_var( $conf['breeze-disable-admin'][ $one_role ], FILTER_VALIDATE_BOOLEAN ) ) {
299
+ $is_found = true;
300
+ }
301
+ }
302
+
303
+ $is_caching_on = $is_found;
304
  }
305
 
306
+ if ( ! empty( $conf ) && false === $is_caching_on && is_user_logged_in() ) {
 
307
  $content = apply_filters( 'breeze_html_after_minify', $content );
308
 
309
  } else {
inc/plugin-incompatibility/breeze-amp-compatibility.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Disabled minification for HTML, CSS and JS.
5
+ */
6
+
7
+ function amp_breeze_compat() {
8
+
9
+ if ( true === breeze_is_amp_page() ) {
10
+ // Disable html minification.
11
+ add_filter( 'breeze_filter_html_noptimize', '__return_true' );
12
+
13
+ // Disable script minification.
14
+ add_filter( 'breeze_filter_js_noptimize', '__return_true' );
15
+
16
+ // Disable style minification.
17
+ add_filter( 'breeze_filter_css_noptimize', '__return_true' );
18
+
19
+ // Force native lazy loading on AMP.
20
+ add_filter( 'breeze_use_native_lazy_load', '__return_true' );
21
+ }
22
+
23
+ }
24
+
25
+ add_action( 'wp', 'amp_breeze_compat' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.8
6
- Stable tag: 1.2.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -145,6 +145,22 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  = 1.2.5 =
149
 
150
 
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.8
6
+ Stable tag: 1.2.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
145
 
146
  == Changelog ==
147
 
148
+ = 1.2.6 =
149
+
150
+ * Add: Varnish cache will be clear while plugin deactivate.
151
+ * Add: Enable cache for specific user role.
152
+ * Add: Disable Emojis to reduce request
153
+ * Add: Delete breeze options values from database on plugin deletion.
154
+ * Fix: Compatibility issue of map short codes with GeoDirectory plugin.
155
+ * Fix: Compatibility issue with Ad Inserter plugin.
156
+ * Fix: Compatibility issue of minification with Beaver Builder Plugin.
157
+ * Fix: Compatibility issue of JS scripts with AMP Plugin.
158
+ * Fix: Reduce cookie life time span while user posts a comment.
159
+ * Fix: HTML elements filtered from RestAPI end point of lazy-load scripts.
160
+ * Fix: Config file of each subsite save with appropriate ID in advance cache file.
161
+ * Fix: Google Analytics script exclude from Minification.
162
+
163
+
164
  = 1.2.5 =
165
 
166
 
uninstall.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // if uninstall.php is not called by WordPress, die
3
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
+ die;
5
+ }
6
+
7
+ if ( ! defined( 'BREEZE_PLUGIN_DIR' ) ) {
8
+ define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
9
+ }
10
+
11
+ // Helper functions.
12
+ require_once BREEZE_PLUGIN_DIR . 'inc/helpers.php';
13
+ require_once BREEZE_PLUGIN_DIR . 'inc/functions.php';
14
+ require_once( BREEZE_PLUGIN_DIR . 'inc/breeze-configuration.php' );
15
+ //config to cache
16
+ require_once( BREEZE_PLUGIN_DIR . 'inc/cache/config-cache.php' );
17
+
18
+ require_once( BREEZE_PLUGIN_DIR . 'inc/breeze-admin.php' );
19
+
20
+ Breeze_Admin::plugin_uninstall_hook();
views/tabs/basic.php CHANGED
@@ -184,13 +184,26 @@ $basic = breeze_get_option( 'basic_settings', true );
184
  <td>
185
  <ul>
186
  <li>
187
- <input type="checkbox" name="breeze-admin-cache" id="breeze-admin-cache"
188
- value="0" <?php ( isset( $basic['breeze-disable-admin'] ) ) ? checked( $basic['breeze-disable-admin'], '0' ) : ''; ?> />
189
- <label class="breeze_tool_tip" for="breeze-admin-cache">
190
- <?php _e( 'Enable/Disable cache for authenticated users.', 'breeze' ); ?>
191
 
 
 
 
 
 
 
 
 
 
 
 
192
  </label>
193
  <br/>
 
 
 
194
  <span>
195
  <b><?php esc_html_e( 'Note', 'breeze' ); ?>:&nbsp;</b>
196
  <span style="color: #ff0000"><?php echo esc_html__( 'This option might not work properly with some page builders.', 'breeze' ); ?></span>
@@ -199,4 +212,21 @@ $basic = breeze_get_option( 'basic_settings', true );
199
  </ul>
200
  </td>
201
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  </table>
184
  <td>
185
  <ul>
186
  <li>
187
+ <?php
188
+ global $wp_roles;
189
+ $roles = $wp_roles->roles;
 
190
 
191
+ foreach ( $roles as $user_role => $user_role_data ) {
192
+ $is_checked_role = 0;
193
+ if ( is_array( $basic['breeze-disable-admin'] ) && isset( $basic['breeze-disable-admin'] ) && isset( $basic['breeze-disable-admin'][ $user_role ] ) ) {
194
+ $is_checked_role = (int) $basic['breeze-disable-admin'][ $user_role ];
195
+ }
196
+
197
+ ?>
198
+ <input type="checkbox" name="breeze-admin-cache[<?php echo esc_attr( $user_role ); ?>]" id="breeze-admin-cache-<?php echo esc_attr( $user_role ); ?>"
199
+ value="1" <?php ( isset( $is_checked_role ) && 1 === $is_checked_role ) ? checked( $is_checked_role, '1' ) : ''; ?> />
200
+ <label class="breeze_tool_tip" for="breeze-admin-cache-<?php echo esc_attr( $user_role ); ?>">
201
+ <?php echo esc_html( $user_role_data['name'] ); ?>
202
  </label>
203
  <br/>
204
+ <?php
205
+ }
206
+ ?>
207
  <span>
208
  <b><?php esc_html_e( 'Note', 'breeze' ); ?>:&nbsp;</b>
209
  <span style="color: #ff0000"><?php echo esc_html__( 'This option might not work properly with some page builders.', 'breeze' ); ?></span>
212
  </ul>
213
  </td>
214
  </tr>
215
+
216
+ <tr>
217
+ <td>
218
+ <label class="breeze_tool_tip"><?php _e( 'Disable emoji', 'breeze' ); ?></label>
219
+ </td>
220
+ <td>
221
+ <ul>
222
+ <li>
223
+ <input type="checkbox" name="breeze-wpjs-emoji" id="breeze-wpjs-emoji" value="1" <?php if(isset($basic['breeze-wp-emoji'])){checked( $basic['breeze-wp-emoji'], '1' ); }?>/>
224
+ <label class="breeze_tool_tip" for="breeze-wpjs-emoji">
225
+ <?php _e( 'Disable the emoji library loaded by default in WrodPress to reduce HTTP requests.', 'breeze' ); ?>
226
+
227
+ </label>
228
+ </li>
229
+ </ul>
230
+ </td>
231
+ </tr>
232
  </table>