WordPress Page Builder – Beaver Builder - Version 2.1.6.3

Version Description

Download this release

Release Info

Developer pross
Plugin Icon 128x128 WordPress Page Builder – Beaver Builder
Version 2.1.6.3
Comparing to
See all releases

Code changes from version 2.1.4.5 to 2.1.6.3

Files changed (69) hide show
  1. changelog.txt +114 -0
  2. classes/class-fl-builder-admin-settings.php +11 -5
  3. classes/class-fl-builder-admin.php +21 -1
  4. classes/class-fl-builder-ajax-layout.php +10 -3
  5. classes/class-fl-builder-ajax.php +8 -6
  6. classes/class-fl-builder-debug.php +16 -9
  7. classes/class-fl-builder-fonts.php +132 -41
  8. classes/class-fl-builder-loader.php +2 -1
  9. classes/class-fl-builder-loop.php +28 -4
  10. classes/class-fl-builder-model.php +76 -5
  11. classes/class-fl-builder-revisions.php +8 -0
  12. classes/class-fl-builder-service-activecampaign.php +27 -4
  13. classes/class-fl-builder-service-mailchimp.php +2 -2
  14. classes/class-fl-builder-service-mailerlite.php +1 -1
  15. classes/class-fl-builder-ui-settings-forms.php +29 -11
  16. classes/class-fl-builder-usage.php +94 -97
  17. classes/class-fl-builder-user-access.php +1 -1
  18. classes/class-fl-builder.php +28 -23
  19. css/fl-builder.css +18 -1
  20. css/fl-builder.min.css +1 -1
  21. css/jquery.magnificpopup.min.css +1 -0
  22. extensions/fl-builder-cache-helper/classes/class-fl-builder-cache-helper.php +147 -0
  23. extensions/fl-builder-cache-helper/fl-builder-cache-helper.php +9 -0
  24. extensions/fl-builder-cache-helper/includes/admin-settings-cache-plugins.php +47 -0
  25. extensions/fl-builder-cache-helper/plugins/autooptimize.php +19 -0
  26. extensions/fl-builder-cache-helper/plugins/breeze.php +13 -0
  27. extensions/fl-builder-cache-helper/plugins/cacheenabler.php +13 -0
  28. extensions/fl-builder-cache-helper/plugins/defines.php +13 -0
  29. extensions/fl-builder-cache-helper/plugins/fastest.php +14 -0
  30. extensions/fl-builder-cache-helper/plugins/godaddy.php +14 -0
  31. extensions/fl-builder-cache-helper/plugins/hummingbird.php +16 -0
  32. extensions/fl-builder-cache-helper/plugins/kinsta.php +14 -0
  33. extensions/fl-builder-cache-helper/plugins/litespeed.php +13 -0
  34. extensions/fl-builder-cache-helper/plugins/pagely.php +14 -0
  35. extensions/fl-builder-cache-helper/plugins/siteground.php +13 -0
  36. extensions/fl-builder-cache-helper/plugins/supercache.php +13 -0
  37. extensions/fl-builder-cache-helper/plugins/swift.php +13 -0
  38. extensions/fl-builder-cache-helper/plugins/varnish.php +16 -0
  39. extensions/fl-builder-cache-helper/plugins/w3cache.php +13 -0
  40. extensions/fl-builder-cache-helper/plugins/wpengine.php +15 -0
  41. fl-builder.php +1 -1
  42. fonts/fontawesome/css/all.min.css +3 -3
  43. fonts/fontawesome/webfonts/fa-brands-400.eot +0 -0
  44. fonts/fontawesome/webfonts/fa-brands-400.svg +39 -6
  45. fonts/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  46. fonts/fontawesome/webfonts/fa-brands-400.woff +0 -0
  47. fonts/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  48. fonts/fontawesome/webfonts/fa-regular-400.eot +0 -0
  49. fonts/fontawesome/webfonts/fa-regular-400.svg +3 -3
  50. fonts/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  51. fonts/fontawesome/webfonts/fa-regular-400.woff +0 -0
  52. fonts/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  53. fonts/fontawesome/webfonts/fa-solid-900.eot +0 -0
  54. fonts/fontawesome/webfonts/fa-solid-900.svg +274 -19
  55. fonts/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  56. fonts/fontawesome/webfonts/fa-solid-900.woff +0 -0
  57. fonts/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  58. includes/admin-settings-tools.php +7 -2
  59. includes/compatibility.php +84 -14
  60. includes/row-js.php +1 -0
  61. includes/row-settings.php +1 -1
  62. includes/ui-field-link.php +1 -1
  63. includes/ui-field-photo.php +14 -6
  64. includes/ui-js-config.php +81 -78
  65. includes/ui-js-templates.php +3 -3
  66. includes/updater-config.php +1 -1
  67. includes/updater/classes/class-fl-updater.php +12 -1
  68. includes/vendor/mailchimp/mailchimp.php +7 -3
  69. js/build/builder.bundle.min.js +8 -13
changelog.txt CHANGED
@@ -1,3 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>2.1.4.5 - 09/10/2018</h4>
2
  <p><strong>HotFix</strong></p>
3
  <ul>
1
+ <h4>2.1.6.3 - 10/30/2018</h4>
2
+ <p><strong>Halloween Hot Fix</strong></p>
3
+ <ul>
4
+ <li>Update Font Awesome to 5.4.2</li>
5
+ <li>Fix PHP error with Hummingbird cache plugin.</li>
6
+ <li>Force Imagesloaded to have jQuery as a dependency.</li>
7
+ </ul>
8
+
9
+ <h4>2.1.6.2 - 10/23/2018</h4>
10
+ <p><strong>Hot Fix</strong></p>
11
+ <ul>
12
+ <li>Fixed an issue with shortcodes in rich text module.</li>
13
+ </ul>
14
+
15
+ <h4>2.1.6.1 - 10/22/2018</h4>
16
+ <p><strong>Hot Fix</strong></p>
17
+ <ul>
18
+ <li>Revert ImageLoaded fix, its breaking row backgrounds.</li>
19
+ </ul>
20
+
21
+ <h4>2.1.6 - 10/22/2018</h4>
22
+ <p><strong>Enhancements</strong></p>
23
+ <ul>
24
+ <li>Updated Font Awesome to 5.4.1 which includes nearly 400 new icons!</li>
25
+ <li>Add Product ID As a "Sort By" Field in the WooCommerce Module</li>
26
+ <li>Accordion labels can now be navigated and receive focus by tapping the Tab key.</li>
27
+ <li>Added Kinsta, Godaddy and Hummingbird to supported caches.</li>
28
+ <li>Set aria-hidden for row background slideshow images for screenreader users.</li>
29
+ <li>Improved anonymous statistics.</li>
30
+ <li>Show if MODSEC fix is enabled on the debug screen.</li>
31
+ <li>Added support for 5 & 6 columns in woocommerce module.</li>
32
+ <li>Whitelist files that will throw false positives in PHP Compatibility Checker plugin.</li>
33
+ <li>Minify magnificpopup css file.</li>
34
+ <li>Increase memory limit for the settings_config JS.</li>
35
+ </ul>
36
+ <p><strong>Bug Fixes</strong></p>
37
+ <ul>
38
+ <li>Global and layout css was not being applied in preview mode.</li>
39
+ <li>Fix ImagesLoaded and ultimate member issue.</li>
40
+ <li>Fix page headings issue on pages with themer layouts.</li>
41
+ <li>Fixed the pagination on first posts module where it inherits the main WP query which results to 404</li>
42
+ <li>Fixed Multiple Select Field not showing defaults when Add Item is clicked.</li>
43
+ <li>Fix Posts module's title alignment on some themes.</li>
44
+ <li>Fixed JS error thrown if two or more Video modules with embedded video code on same layout.</li>
45
+ <li>Fixed slideshow embedded in accordion via shortcode.</li>
46
+ <li>Fixed node templates without featured image throwing a JS error in the content panel.</li>
47
+ <li>Fixed module alias settings not being rendered when dropping on a page.</li>
48
+ <li>Renamed class MailChimp to FLBuilderMailChimp to avoid conflict with other plugins.</li>
49
+ <li>Fixed the menu item spacing caused by inline-block in menu module.</li>
50
+ <li>Fixed undefined font weight strings in the theme.</li>
51
+ <li>Fixed issue with Templator, Prevent Direct Access Gold and wp-smush-it plugins.</li>
52
+ </ul>
53
+
54
+ <h4>2.1.5.2 - 10/04/2018</h4>
55
+ <p><strong>Hot Fix</strong></p>
56
+ <ul>
57
+ <li>Fixed Pagely cache clear code.</li>
58
+ <li>Fixed small issue with Google italic fonts.</li>
59
+ <li>Fixed issue with Enfold theme causing javascript error when builder is open.</li>
60
+ <li>Updated Events Calender Widget compatibility code.</li>
61
+ <li>New filter added <code>fl_get_edit_url</code>.</li>
62
+ <li>New filter added <code>fl_widget_module_args</code>.</li>
63
+ </ul>
64
+
65
+ <h4>2.1.5.1 - 09/26/2018</h4>
66
+ <p><strong>Hot Fix</strong></p>
67
+ <ul>
68
+ <li>Fixed ImagesLoaded script not being enqueued in Gallery Module.</li>
69
+ <li>Fixed a PHP warning when using Events shortcodes.</li>
70
+ <li>Added Swift to list of supported cache plugins.</li>
71
+ </ul>
72
+
73
+ <h4>2.1.5 - 09/24/2018</h4>
74
+ <p><strong>Enhancements</strong></p>
75
+ <ul>
76
+ <li>Revisions are now saved whenever any rows, columns, modules or layouts are published and are limited to 25.</li>
77
+ <li>Cache helper plugin is now merged into Beaver Builder. See https://kb.wpbeaverbuilder.com/article/549-cache-clearing-tool for details.</li>
78
+ <li>Update bundled Font Awesome to version 5.3.1.</li>
79
+ <li>Native Google italics are now supported.</li>
80
+ <li>Pre-connect to Google fonts to speed up font rendering.</li>
81
+ <li>Added caption on lightbox of the Photo Module.</li>
82
+ <li>More fl_builder_render_assets_inline fixes.</li>
83
+ <li>Changed delete_users capability to manage_options for builder UI and added <code>fl_builder_admin_settings_capability</code> filter.</li>
84
+ <li>Changed connections type to photo for row’s background fallback photo.</li>
85
+ <li>Added aria-hidden attribute to icons for better screenreader experience.</li>
86
+ <li>Added placeholder support for link field type.</li>
87
+ <li>New filter <code>fl_builder_google_fonts_pre_enqueue</code> makes it possible to dequeue any fonts added by modules.</li>
88
+ <li>New filter <code>fl_builder_load_modules_paths</code> to add/remove modules before they are loaded.</li>
89
+ </ul>
90
+
91
+ <p><strong>Bug Fixes</strong></p>
92
+ <ul>
93
+ <li>Fixed javascript error if invalid color preset is saved.</li>
94
+ <li>Fixed license not saving properly if pasted licence contains non-alphanumeric chars.</li>
95
+ <li>Fixed compatibility with lodash >4 contains is not a function error.</li>
96
+ <li>Fixed post icon color option incorrectly appearing for grid layout in Posts Carousel module.</li>
97
+ <li>Fixed Subscribe Module: Active Campaign - When form is the type, user does not get re-subscribed.</li>
98
+ <li>Fixed Event Calendar widget not loading assets when added as a widget module.</li>
99
+ <li>Fixed Audio Module not properly refreshing when adding multiple items.</li>
100
+ <li>Fixed nodes being duplicated turning into global when they shouldn't be.</li>
101
+ <li>Fixed margin issue on media library thumbnails.</li>
102
+ <li>Fixed attachment JS config doesn't account for fields with multiple set to true.</li>
103
+ <li>Fixed issue with post-grid infinite scroll if post slug contains numbers.</li>
104
+ <li>Fixed Subscribe Form module - mailchimp only shows 10 groups within a list, limit changed to 50.</li>
105
+ <li>Fixed 404 pagination on archive when taxonomy has custom slug.</li>
106
+ <li>Fixed blurry checkbox in Subscribe and Contact Form modules.</li>
107
+ <li>Fixed thumbs layout in gallery module.</li>
108
+ <li>Fixed video where it keeps playing even if not in an active slide in Content Slider.</li>
109
+ <li>Fixed menu module spacing when there are multiple menu items.</li>
110
+ <li>Fixed colors and fonts affecting the media uploader popup.</li>
111
+ <li>Fixed CORS issue on Pantheon hosting.</li>
112
+ </ul>
113
+
114
+
115
  <h4>2.1.4.5 - 09/10/2018</h4>
116
  <p><strong>HotFix</strong></p>
117
  <ul>
classes/class-fl-builder-admin-settings.php CHANGED
@@ -76,10 +76,10 @@ final class FLBuilderAdminSettings {
76
  * @return void
77
  */
78
  static public function menu() {
79
- if ( current_user_can( 'delete_users' ) ) {
80
 
81
  $title = FLBuilderModel::get_branding();
82
- $cap = 'delete_users';
83
  $slug = 'fl-builder-settings';
84
  $func = __CLASS__ . '::render';
85
 
@@ -335,7 +335,7 @@ final class FLBuilderAdminSettings {
335
  */
336
  static public function save() {
337
  // Only admins can save settings.
338
- if ( ! current_user_can( 'delete_users' ) ) {
339
  return;
340
  }
341
 
@@ -463,6 +463,12 @@ final class FLBuilderAdminSettings {
463
 
464
  $unzipped = unzip_file( $path, $new_path );
465
 
 
 
 
 
 
 
466
  // Unzip failed.
467
  if ( ! $unzipped ) {
468
  self::add_error( __( 'Error! Could not unzip file.', 'fl-builder' ) );
@@ -557,7 +563,7 @@ final class FLBuilderAdminSettings {
557
  * @return void
558
  */
559
  static private function clear_cache() {
560
- if ( ! current_user_can( 'delete_users' ) ) {
561
  return;
562
  } elseif ( isset( $_POST['fl-cache-nonce'] ) && wp_verify_nonce( $_POST['fl-cache-nonce'], 'cache' ) ) {
563
  if ( is_network_admin() ) {
@@ -584,7 +590,7 @@ final class FLBuilderAdminSettings {
584
  * @return void
585
  */
586
  static private function debug() {
587
- if ( ! current_user_can( 'delete_users' ) ) {
588
  return;
589
  } elseif ( isset( $_POST['fl-debug-nonce'] ) && wp_verify_nonce( $_POST['fl-debug-nonce'], 'debug' ) ) {
590
  $debugmode = get_option( 'fl_debug_mode', false );
76
  * @return void
77
  */
78
  static public function menu() {
79
+ if ( FLBuilderAdmin::current_user_can_access_settings() ) {
80
 
81
  $title = FLBuilderModel::get_branding();
82
+ $cap = FLBuilderAdmin::admin_settings_capability();
83
  $slug = 'fl-builder-settings';
84
  $func = __CLASS__ . '::render';
85
 
335
  */
336
  static public function save() {
337
  // Only admins can save settings.
338
+ if ( ! FLBuilderAdmin::current_user_can_access_settings() ) {
339
  return;
340
  }
341
 
463
 
464
  $unzipped = unzip_file( $path, $new_path );
465
 
466
+ // unzip returned a WP_Error
467
+ if ( is_wp_error( $unzipped ) ) {
468
+ self::add_error( sprintf( __( 'Unzip Error: %s', 'fl-builder' ), $unzipped->get_error_message() ) );
469
+ return;
470
+ }
471
+
472
  // Unzip failed.
473
  if ( ! $unzipped ) {
474
  self::add_error( __( 'Error! Could not unzip file.', 'fl-builder' ) );
563
  * @return void
564
  */
565
  static private function clear_cache() {
566
+ if ( ! FLBuilderAdmin::current_user_can_access_settings() ) {
567
  return;
568
  } elseif ( isset( $_POST['fl-cache-nonce'] ) && wp_verify_nonce( $_POST['fl-cache-nonce'], 'cache' ) ) {
569
  if ( is_network_admin() ) {
590
  * @return void
591
  */
592
  static private function debug() {
593
+ if ( ! FLBuilderAdmin::current_user_can_access_settings() ) {
594
  return;
595
  } elseif ( isset( $_POST['fl-debug-nonce'] ) && wp_verify_nonce( $_POST['fl-debug-nonce'], 'debug' ) ) {
596
  $debugmode = get_option( 'fl_debug_mode', false );
classes/class-fl-builder-admin.php CHANGED
@@ -73,6 +73,26 @@ final class FLBuilderAdmin {
73
  }
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Show a message if there is an activation error and
78
  * deactivates the plugin.
@@ -113,7 +133,7 @@ final class FLBuilderAdmin {
113
  * @return void
114
  */
115
  static public function trigger_activate_notice() {
116
- if ( current_user_can( 'delete_users' ) ) {
117
  set_transient( '_fl_builder_activation_admin_notice', true, 30 );
118
  }
119
  }
73
  }
74
  }
75
 
76
+ /**
77
+ * Restrict builder settings accessibility based on the defined capability.
78
+ *
79
+ * @since 2.0.6
80
+ * @return void
81
+ */
82
+ static public function current_user_can_access_settings() {
83
+ return current_user_can( self::admin_settings_capability() );
84
+ }
85
+
86
+ /**
87
+ * Define capability.
88
+ *
89
+ * @since 2.0.6
90
+ * @return string
91
+ */
92
+ static public function admin_settings_capability() {
93
+ return apply_filters( 'fl_builder_admin_settings_capability', 'manage_options' );
94
+ }
95
+
96
  /**
97
  * Show a message if there is an activation error and
98
  * deactivates the plugin.
133
  * @return void
134
  */
135
  static public function trigger_activate_notice() {
136
+ if ( self::current_user_can_access_settings() ) {
137
  set_transient( '_fl_builder_activation_admin_notice', true, 30 );
138
  }
139
  }
classes/class-fl-builder-ajax-layout.php CHANGED
@@ -291,7 +291,7 @@ final class FLBuilderAJAXLayout {
291
  'parentId' => $module->parent,
292
  'global' => FLBuilderModel::is_node_global( $module ),
293
  'layout' => self::render( $render_id ),
294
- 'settings' => null === $template_id ? null : $module->settings,
295
  'legacy' => FLBuilderUISettingsForms::pre_render_legacy_module_settings( $module->settings->type, $module->settings ),
296
  );
297
  }
@@ -489,6 +489,7 @@ final class FLBuilderAJAXLayout {
489
  $partial_refresh_data = self::get_partial_refresh_data();
490
  $asset_info = FLBuilderModel::get_asset_info();
491
  $asset_ver = FLBuilderModel::get_asset_version();
 
492
  $assets = array(
493
  'js' => '',
494
  'css' => '',
@@ -529,14 +530,20 @@ final class FLBuilderAJAXLayout {
529
  if ( $min ) {
530
  $assets['js'] = $min;
531
  }
 
 
532
  } else {
533
  FLBuilder::render_js();
534
  $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
535
  }
536
 
537
  // Render the CSS.
538
- FLBuilder::render_css();
539
- $assets['css'] = $asset_info['css_url'] . '?ver=' . $asset_ver;
 
 
 
 
540
 
541
  // Return the assets.
542
  return $assets;
291
  'parentId' => $module->parent,
292
  'global' => FLBuilderModel::is_node_global( $module ),
293
  'layout' => self::render( $render_id ),
294
+ 'settings' => null === $template_id && ! $alias ? null : $module->settings,
295
  'legacy' => FLBuilderUISettingsForms::pre_render_legacy_module_settings( $module->settings->type, $module->settings ),
296
  );
297
  }
489
  $partial_refresh_data = self::get_partial_refresh_data();
490
  $asset_info = FLBuilderModel::get_asset_info();
491
  $asset_ver = FLBuilderModel::get_asset_version();
492
+ $enqueuemethod = FLBuilderModel::get_asset_enqueue_method();
493
  $assets = array(
494
  'js' => '',
495
  'css' => '',
530
  if ( $min ) {
531
  $assets['js'] = $min;
532
  }
533
+ } elseif ( 'inline' === $enqueuemethod ) {
534
+ $assets['js'] = FLBuilder::render_js();
535
  } else {
536
  FLBuilder::render_js();
537
  $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
538
  }
539
 
540
  // Render the CSS.
541
+ if ( 'inline' === $enqueuemethod ) {
542
+ $assets['css'] = FLBuilder::render_css();
543
+ } else {
544
+ FLBuilder::render_css();
545
+ $assets['css'] = $asset_info['css_url'] . '?ver=' . $asset_ver;
546
+ }
547
 
548
  // Return the assets.
549
  return $assets;
classes/class-fl-builder-ajax.php CHANGED
@@ -55,7 +55,7 @@ final class FLBuilderAJAX {
55
  self::$actions[ $action ] = array(
56
  'action' => $action,
57
  'method' => $method,
58
- 'args' => $args,
59
  );
60
  }
61
 
@@ -138,6 +138,8 @@ final class FLBuilderAJAX {
138
  // FLBuilderAutoSuggest
139
  self::add_action( 'fl_builder_autosuggest', 'FLBuilderAutoSuggest::init' );
140
  self::add_action( 'get_autosuggest_values', 'FLBuilderAutoSuggest::get_values', array( 'fields' ) );
 
 
141
  }
142
 
143
  /**
@@ -195,9 +197,9 @@ final class FLBuilderAJAX {
195
  }
196
 
197
  // Get the action data.
198
- $action = self::$actions[ $action ];
199
- $args = array();
200
- $keys_args = array();
201
 
202
  // Build the args array.
203
  foreach ( $action['args'] as $arg ) {
@@ -245,8 +247,8 @@ final class FLBuilderAJAX {
245
  * @return bool
246
  */
247
  static private function verify_nonce() {
248
- $post_data = FLBuilderModel::get_post_data();
249
- $nonce = false;
250
 
251
  if ( isset( $post_data['_wpnonce'] ) ) {
252
  $nonce = $post_data['_wpnonce'];
55
  self::$actions[ $action ] = array(
56
  'action' => $action,
57
  'method' => $method,
58
+ 'args' => $args,
59
  );
60
  }
61
 
138
  // FLBuilderAutoSuggest
139
  self::add_action( 'fl_builder_autosuggest', 'FLBuilderAutoSuggest::init' );
140
  self::add_action( 'get_autosuggest_values', 'FLBuilderAutoSuggest::get_values', array( 'fields' ) );
141
+
142
+ self::add_action( 'save_browser_stats', 'FLBuilderUsage::browser_stats', array( 'browser_data' ) );
143
  }
144
 
145
  /**
197
  }
198
 
199
  // Get the action data.
200
+ $action = self::$actions[ $action ];
201
+ $args = array();
202
+ $keys_args = array();
203
 
204
  // Build the args array.
205
  foreach ( $action['args'] as $arg ) {
247
  * @return bool
248
  */
249
  static private function verify_nonce() {
250
+ $post_data = FLBuilderModel::get_post_data();
251
+ $nonce = false;
252
 
253
  if ( isset( $post_data['_wpnonce'] ) ) {
254
  $nonce = $post_data['_wpnonce'];
classes/class-fl-builder-debug.php CHANGED
@@ -45,7 +45,7 @@ final class FL_Debug {
45
  }
46
 
47
  private static function formatbytes( $size, $precision = 2 ) {
48
- $base = log( $size, 1024 );
49
  $suffixes = array( '', 'K', 'M', 'G', 'T' );
50
 
51
  return round( pow( 1024, $base - floor( $base ) ), $precision ) . $suffixes[ floor( $base ) ];
@@ -71,7 +71,7 @@ final class FL_Debug {
71
 
72
  private static function get_mu_plugins() {
73
  $plugins_data = get_mu_plugins();
74
- $plugins = array();
75
 
76
  foreach ( $plugins_data as $plugin_path => $plugin ) {
77
  $plugins[] = sprintf( '%s version %s by %s', $plugin['Name'], $plugin['Version'], $plugin['Author'] );
@@ -87,6 +87,7 @@ final class FL_Debug {
87
  return '----------------------------------------------';
88
  }
89
 
 
90
  private static function prepare_tests() {
91
 
92
  global $wpdb, $wp_version;
@@ -127,6 +128,12 @@ final class FL_Debug {
127
  );
128
  self::register( 'fl_debug', $args );
129
 
 
 
 
 
 
 
130
  $args = array(
131
  'name' => 'SSL Enabled',
132
  'data' => is_ssl() ? 'Yes' : 'No',
@@ -158,7 +165,7 @@ final class FL_Debug {
158
  self::register( 'themes', $args );
159
 
160
  $theme = wp_get_theme();
161
- $args = array(
162
  'name' => 'Active Theme',
163
  'data' => array(
164
  sprintf( '%s - v%s', $theme->get( 'Name' ), $theme->get( 'Version' ) ),
@@ -180,12 +187,12 @@ final class FL_Debug {
180
  self::register( 'wp_plugins', $args );
181
 
182
  $defaults = array(
183
- 'active' => array(),
184
  'deactive' => array(),
185
  );
186
 
187
  $plugins = wp_parse_args( self::get_plugins(), $defaults );
188
- $args = array(
189
  'name' => 'Active Plugins',
190
  'data' => $plugins['active'],
191
  );
@@ -345,7 +352,7 @@ final class FL_Debug {
345
 
346
  } elseif ( class_exists( 'FLUpdater' ) ) {
347
  $subscription = FLUpdater::get_subscription_info();
348
- $args = array(
349
  'name' => 'Beaver Builder License',
350
  'data' => ( $subscription->active ) ? 'Active' : 'Not Active',
351
  );
@@ -393,7 +400,7 @@ final class FL_Debug {
393
  self::register( 'up_htaccess', $args );
394
 
395
  // detect uploads folder .htaccess file and display it if found.
396
- $uploads = wp_upload_dir( null, false );
397
  $uploads_htaccess = trailingslashit( $uploads['basedir'] ) . '.htaccess';
398
  $root_htaccess = trailingslashit( ABSPATH ) . '.htaccess';
399
 
@@ -401,7 +408,7 @@ final class FL_Debug {
401
  ob_start();
402
  readfile( $root_htaccess );
403
  $htaccess = ob_get_clean();
404
- $args = array(
405
  'name' => $root_htaccess . "\n",
406
  'data' => $htaccess,
407
  );
@@ -411,7 +418,7 @@ final class FL_Debug {
411
  ob_start();
412
  readfile( $uploads_htaccess );
413
  $htaccess = ob_get_clean();
414
- $args = array(
415
  'name' => $uploads_htaccess . "\n",
416
  'data' => $htaccess,
417
  );
45
  }
46
 
47
  private static function formatbytes( $size, $precision = 2 ) {
48
+ $base = log( $size, 1024 );
49
  $suffixes = array( '', 'K', 'M', 'G', 'T' );
50
 
51
  return round( pow( 1024, $base - floor( $base ) ), $precision ) . $suffixes[ floor( $base ) ];
71
 
72
  private static function get_mu_plugins() {
73
  $plugins_data = get_mu_plugins();
74
+ $plugins = array();
75
 
76
  foreach ( $plugins_data as $plugin_path => $plugin ) {
77
  $plugins[] = sprintf( '%s version %s by %s', $plugin['Name'], $plugin['Version'], $plugin['Author'] );
87
  return '----------------------------------------------';
88
  }
89
 
90
+
91
  private static function prepare_tests() {
92
 
93
  global $wpdb, $wp_version;
128
  );
129
  self::register( 'fl_debug', $args );
130
 
131
+ $args = array(
132
+ 'name' => 'FL Modsec Fix',
133
+ 'data' => defined( 'FL_BUILDER_MODSEC_FIX' ) && FL_BUILDER_MODSEC_FIX ? 'Yes' : 'No',
134
+ );
135
+ self::register( 'fl_modsec', $args );
136
+
137
  $args = array(
138
  'name' => 'SSL Enabled',
139
  'data' => is_ssl() ? 'Yes' : 'No',
165
  self::register( 'themes', $args );
166
 
167
  $theme = wp_get_theme();
168
+ $args = array(
169
  'name' => 'Active Theme',
170
  'data' => array(
171
  sprintf( '%s - v%s', $theme->get( 'Name' ), $theme->get( 'Version' ) ),
187
  self::register( 'wp_plugins', $args );
188
 
189
  $defaults = array(
190
+ 'active' => array(),
191
  'deactive' => array(),
192
  );
193
 
194
  $plugins = wp_parse_args( self::get_plugins(), $defaults );
195
+ $args = array(
196
  'name' => 'Active Plugins',
197
  'data' => $plugins['active'],
198
  );
352
 
353
  } elseif ( class_exists( 'FLUpdater' ) ) {
354
  $subscription = FLUpdater::get_subscription_info();
355
+ $args = array(
356
  'name' => 'Beaver Builder License',
357
  'data' => ( $subscription->active ) ? 'Active' : 'Not Active',
358
  );
400
  self::register( 'up_htaccess', $args );
401
 
402
  // detect uploads folder .htaccess file and display it if found.
403
+ $uploads = wp_upload_dir( null, false );
404
  $uploads_htaccess = trailingslashit( $uploads['basedir'] ) . '.htaccess';
405
  $root_htaccess = trailingslashit( ABSPATH ) . '.htaccess';
406
 
408
  ob_start();
409
  readfile( $root_htaccess );
410
  $htaccess = ob_get_clean();
411
+ $args = array(
412
  'name' => $root_htaccess . "\n",
413
  'data' => $htaccess,
414
  );
418
  ob_start();
419
  readfile( $uploads_htaccess );
420
  $htaccess = ob_get_clean();
421
+ $args = array(
422
  'name' => $uploads_htaccess . "\n",
423
  'data' => $htaccess,
424
  );
classes/class-fl-builder-fonts.php CHANGED
@@ -14,6 +14,8 @@ final class FLBuilderFonts {
14
  */
15
  static private $fonts = array();
16
 
 
 
17
  /**
18
  * @since 1.9.5
19
  * @return void
@@ -21,6 +23,7 @@ final class FLBuilderFonts {
21
  static public function init() {
22
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::combine_google_fonts', 10000 );
23
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::enqueue_google_fonts', 9999 );
 
24
  }
25
 
26
  /**
@@ -99,23 +102,49 @@ final class FLBuilderFonts {
99
  */
100
  static public function get_weight_string( $weight ) {
101
 
102
- $weight_string = apply_filters( 'fl_builder_font_weight_strings', array(
103
- 'default' => __( 'Default', 'fl-builder' ),
104
- 'regular' => __( 'Regular', 'fl-builder' ),
105
- '100' => 'Thin 100',
106
- '200' => 'Extra-Light 200',
107
- '300' => 'Light 300',
108
- '400' => 'Normal 400',
109
- '500' => 'Medium 500',
110
- '600' => 'Semi-Bold 600',
111
- '700' => 'Bold 700',
112
- '800' => 'Extra-Bold 800',
113
- '900' => 'Ultra-Bold 900',
114
- ) );
115
 
116
  return $weight_string[ $weight ];
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Helper function to render css styles for a selected font.
121
  *
@@ -126,6 +155,7 @@ final class FLBuilderFonts {
126
  static public function font_css( $font ) {
127
 
128
  $system_fonts = apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system );
 
129
 
130
  $css = '';
131
 
@@ -133,6 +163,8 @@ final class FLBuilderFonts {
133
 
134
  $css .= 'font-family: "' . $font['family'] . '",' . $system_fonts[ $font['family'] ]['fallback'] . ';';
135
 
 
 
136
  } else {
137
  $css .= 'font-family: "' . $font['family'] . '", sans-serif;';
138
  }
@@ -143,6 +175,8 @@ final class FLBuilderFonts {
143
  if ( 'i' == substr( $font['weight'], -1 ) ) {
144
  $css .= 'font-weight: ' . substr( $font['weight'], 0, -1 ) . ';';
145
  $css .= 'font-style: italic;';
 
 
146
  } else {
147
  $css .= 'font-weight: ' . $font['weight'] . ';';
148
  }
@@ -212,9 +246,15 @@ final class FLBuilderFonts {
212
  */
213
  static public function enqueue_google_fonts() {
214
  $google_fonts_domain = apply_filters( 'fl_builder_google_fonts_domain', '//fonts.googleapis.com/' );
215
- $google_url = $google_fonts_domain . 'css?family=';
216
 
217
- if ( count( self::$fonts ) > 0 ) {
 
 
 
 
 
 
218
 
219
  foreach ( self::$fonts as $family => $weights ) {
220
  $google_url .= $family . ':' . implode( ',', $weights ) . '|';
@@ -272,11 +312,11 @@ final class FLBuilderFonts {
272
  // Check for any enqueued `fonts.googleapis.com` from BB theme or plugin
273
  if ( isset( $wp_styles->queue ) ) {
274
 
275
- $google_fonts_domain = 'https://fonts.googleapis.com/css';
276
  $enqueued_google_fonts = array();
277
- $families = array();
278
- $subsets = array();
279
- $font_args = array();
280
 
281
  // Collect all enqueued google fonts
282
  foreach ( $wp_styles->queue as $key => $handle ) {
@@ -307,18 +347,18 @@ final class FLBuilderFonts {
307
 
308
  // Extract the font data
309
  if ( isset( $get_font[0] ) && ! empty( $get_font[0] ) ) {
310
- $family = $get_font[0];
311
  $weights = isset( $get_font[1] ) && ! empty( $get_font[1] ) ? explode( ',', $get_font[1] ) : array();
312
 
313
  // Combine weights if family has been enqueued
314
  if ( isset( $enqueued_google_fonts[ $family ] ) && $weights != $enqueued_google_fonts[ $family ]['weights'] ) {
315
- $combined_weights = array_merge( $weights, $enqueued_google_fonts[ $family ]['weights'] );
316
  $enqueued_google_fonts[ $family ]['weights'] = array_unique( $combined_weights );
317
  } else {
318
  $enqueued_google_fonts[ $family ] = array(
319
- 'handle' => $handle,
320
- 'family' => $family,
321
- 'weights' => $weights,
322
  );
323
 
324
  }
@@ -358,7 +398,7 @@ final class FLBuilderFonts {
358
  $src,
359
  array()
360
  );
361
-
362
  // Clears data
363
  $enqueued_google_fonts = array();
364
  }
@@ -366,6 +406,20 @@ final class FLBuilderFonts {
366
  }
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  }
370
 
371
  FLBuilderFonts::init();
@@ -378,6 +432,17 @@ FLBuilderFonts::init();
378
  */
379
  final class FLBuilderFontFamilies {
380
 
 
 
 
 
 
 
 
 
 
 
 
381
  /**
382
  * Parse fonts.json to get all possible Google fonts.
383
  * @since 1.10.7
@@ -386,31 +451,57 @@ final class FLBuilderFontFamilies {
386
  static function google() {
387
 
388
  $fonts = array();
389
- $json = (array) json_decode( file_get_contents( FL_BUILDER_DIR . 'json/fonts.json' ), true );
390
 
391
  foreach ( $json as $k => $font ) {
392
 
393
  $name = key( $font );
394
 
395
- foreach ( $font[ $name ] as $key => $variant ) {
396
- if ( stristr( $variant, 'italic' ) ) {
397
- unset( $font[ $name ][ $key ] );
398
  }
399
  if ( 'regular' == $variant ) {
400
- $font[ $name ][ $key ] = '400';
401
  }
402
  }
403
 
404
- $fonts[ $name ] = $font[ $name ];
405
  }
406
  return $fonts;
407
  }
408
 
409
- static public $default = array(
410
- 'Default' => array(
411
- 'default'
412
- ),
413
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
415
  /**
416
  * Array with a list of system fonts.
@@ -425,7 +516,7 @@ final class FLBuilderFontFamilies {
425
  '700',
426
  ),
427
  ),
428
- 'Verdana' => array(
429
  'fallback' => 'Helvetica, Arial, sans-serif',
430
  'weights' => array(
431
  '300',
@@ -433,7 +524,7 @@ final class FLBuilderFontFamilies {
433
  '700',
434
  ),
435
  ),
436
- 'Arial' => array(
437
  'fallback' => 'Helvetica, Verdana, sans-serif',
438
  'weights' => array(
439
  '300',
@@ -441,7 +532,7 @@ final class FLBuilderFontFamilies {
441
  '700',
442
  ),
443
  ),
444
- 'Times' => array(
445
  'fallback' => 'Georgia, serif',
446
  'weights' => array(
447
  '300',
@@ -449,7 +540,7 @@ final class FLBuilderFontFamilies {
449
  '700',
450
  ),
451
  ),
452
- 'Georgia' => array(
453
  'fallback' => 'Times, serif',
454
  'weights' => array(
455
  '300',
@@ -457,7 +548,7 @@ final class FLBuilderFontFamilies {
457
  '700',
458
  ),
459
  ),
460
- 'Courier' => array(
461
  'fallback' => 'monospace',
462
  'weights' => array(
463
  '300',
14
  */
15
  static private $fonts = array();
16
 
17
+ static private $enqueued_google_fonts_done = false;
18
+
19
  /**
20
  * @since 1.9.5
21
  * @return void
23
  static public function init() {
24
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::combine_google_fonts', 10000 );
25
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::enqueue_google_fonts', 9999 );
26
+ add_filter( 'wp_resource_hints', __CLASS__ . '::resource_hints', 10, 2 );
27
  }
28
 
29
  /**
102
  */
103
  static public function get_weight_string( $weight ) {
104
 
105
+ $weight_string = self::get_font_weight_strings();
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  return $weight_string[ $weight ];
108
  }
109
 
110
+ /**
111
+ * Return font weight strings.
112
+ */
113
+ static public function get_font_weight_strings() {
114
+ return apply_filters( 'fl_builder_font_weight_strings', array(
115
+ 'default' => __( 'Default', 'fl-builder' ),
116
+ 'regular' => __( 'Regular', 'fl-builder' ),
117
+ 'italic' => __( 'Italic', 'fl-builder' ),
118
+ '100' => __( 'Thin', 'fl-builder' ),
119
+ '100i' => __( 'Thin Italic', 'fl-builder' ),
120
+ '100italic' => __( 'Thin Italic', 'fl-builder' ),
121
+ '200' => __( 'Extra-Light', 'fl-builder' ),
122
+ '200i' => __( 'Extra-Light Italic', 'fl-builder' ),
123
+ '200italic' => __( 'Extra-Light Italic', 'fl-builder' ),
124
+ '300' => __( 'Light', 'fl-builder' ),
125
+ '300i' => __( 'Light Italic', 'fl-builder' ),
126
+ '300italic' => __( 'Light Italic', 'fl-builder' ),
127
+ '400' => __( 'Normal', 'fl-builder' ),
128
+ '400i' => __( 'Normal Italic', 'fl-builder' ),
129
+ '400italic' => __( 'Normal Italic', 'fl-builder' ),
130
+ '500' => __( 'Medium', 'fl-builder' ),
131
+ '500i' => __( 'Medium Italic', 'fl-builder' ),
132
+ '500italic' => __( 'Medium Italic', 'fl-builder' ),
133
+ '600' => __( 'Semi-Bold', 'fl-builder' ),
134
+ '600i' => __( 'Semi-Bold Italic', 'fl-builder' ),
135
+ '600italic' => __( 'Semi-Bold Italic', 'fl-builder' ),
136
+ '700' => __( 'Bold', 'fl-builder' ),
137
+ '700i' => __( 'Bold Italic', 'fl-builder' ),
138
+ '700italic' => __( 'Bold Italic', 'fl-builder' ),
139
+ '800' => __( 'Extra-Bold', 'fl-builder' ),
140
+ '800i' => __( 'Extra-Bold Italic', 'fl-builder' ),
141
+ '800italic' => __( 'Extra-Bold Italic', 'fl-builder' ),
142
+ '900' => __( 'Ultra-Bold', 'fl-builder' ),
143
+ '900i' => __( 'Ultra-Bold Italic', 'fl-builder' ),
144
+ '900italic' => __( 'Ultra-Bold Italic', 'fl-builder' ),
145
+ ) );
146
+ }
147
+
148
  /**
149
  * Helper function to render css styles for a selected font.
150
  *
155
  static public function font_css( $font ) {
156
 
157
  $system_fonts = apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system );
158
+ $google = FLBuilderFontFamilies::get_google_fallback( $font['family'] );
159
 
160
  $css = '';
161
 
163
 
164
  $css .= 'font-family: "' . $font['family'] . '",' . $system_fonts[ $font['family'] ]['fallback'] . ';';
165
 
166
+ } elseif ( $google ) {
167
+ $css .= 'font-family: "' . $font['family'] . '", ' . $google . ';';
168
  } else {
169
  $css .= 'font-family: "' . $font['family'] . '", sans-serif;';
170
  }
175
  if ( 'i' == substr( $font['weight'], -1 ) ) {
176
  $css .= 'font-weight: ' . substr( $font['weight'], 0, -1 ) . ';';
177
  $css .= 'font-style: italic;';
178
+ } elseif ( 'italic' == $font['weight'] ) {
179
+ $css .= 'font-style: italic;';
180
  } else {
181
  $css .= 'font-weight: ' . $font['weight'] . ';';
182
  }
246
  */
247
  static public function enqueue_google_fonts() {
248
  $google_fonts_domain = apply_filters( 'fl_builder_google_fonts_domain', '//fonts.googleapis.com/' );
249
+ $google_url = $google_fonts_domain . 'css?family=';
250
 
251
+ /**
252
+ * Allow users to control what fonts are enqueued by modules.
253
+ * Returning array() will disable all enqueues.
254
+ * @see fl_builder_google_fonts_pre_enqueue
255
+ * @link https://kb.wpbeaverbuilder.com/article/648-load-google-fonts-and-font-awesome-icons-locally-gdpr
256
+ */
257
+ if ( count( apply_filters( 'fl_builder_google_fonts_pre_enqueue', self::$fonts ) ) > 0 ) {
258
 
259
  foreach ( self::$fonts as $family => $weights ) {
260
  $google_url .= $family . ':' . implode( ',', $weights ) . '|';
312
  // Check for any enqueued `fonts.googleapis.com` from BB theme or plugin
313
  if ( isset( $wp_styles->queue ) ) {
314
 
315
+ $google_fonts_domain = 'https://fonts.googleapis.com/css';
316
  $enqueued_google_fonts = array();
317
+ $families = array();
318
+ $subsets = array();
319
+ $font_args = array();
320
 
321
  // Collect all enqueued google fonts
322
  foreach ( $wp_styles->queue as $key => $handle ) {
347
 
348
  // Extract the font data
349
  if ( isset( $get_font[0] ) && ! empty( $get_font[0] ) ) {
350
+ $family = $get_font[0];
351
  $weights = isset( $get_font[1] ) && ! empty( $get_font[1] ) ? explode( ',', $get_font[1] ) : array();
352
 
353
  // Combine weights if family has been enqueued
354
  if ( isset( $enqueued_google_fonts[ $family ] ) && $weights != $enqueued_google_fonts[ $family ]['weights'] ) {
355
+ $combined_weights = array_merge( $weights, $enqueued_google_fonts[ $family ]['weights'] );
356
  $enqueued_google_fonts[ $family ]['weights'] = array_unique( $combined_weights );
357
  } else {
358
  $enqueued_google_fonts[ $family ] = array(
359
+ 'handle' => $handle,
360
+ 'family' => $family,
361
+ 'weights' => $weights,
362
  );
363
 
364
  }
398
  $src,
399
  array()
400
  );
401
+ self::$enqueued_google_fonts_done = true;
402
  // Clears data
403
  $enqueued_google_fonts = array();
404
  }
406
  }
407
  }
408
 
409
+ /**
410
+ * Preconnect to fonts.gstatic.com to speed up google fonts.
411
+ * @since 2.1.5
412
+ */
413
+ static public function resource_hints( $urls, $relation_type ) {
414
+ if ( true == self::$enqueued_google_fonts_done && 'preconnect' === $relation_type ) {
415
+ $urls[] = array(
416
+ 'href' => 'https://fonts.gstatic.com',
417
+ 'crossorigin',
418
+ );
419
+ }
420
+ return $urls;
421
+ }
422
+
423
  }
424
 
425
  FLBuilderFonts::init();
432
  */
433
  final class FLBuilderFontFamilies {
434
 
435
+ /**
436
+ * Cache for google fonts
437
+ */
438
+ static private $_google_json = array();
439
+
440
+ static public $default = array(
441
+ 'Default' => array(
442
+ 'default',
443
+ ),
444
+ );
445
+
446
  /**
447
  * Parse fonts.json to get all possible Google fonts.
448
  * @since 1.10.7
451
  static function google() {
452
 
453
  $fonts = array();
454
+ $json = self::_get_json();
455
 
456
  foreach ( $json as $k => $font ) {
457
 
458
  $name = key( $font );
459
 
460
+ foreach ( $font[ $name ]['variants'] as $key => $variant ) {
461
+ if ( stristr( $variant, 'italic' ) && 'italic' !== $variant ) {
462
+ $font[ $name ]['variants'][ $key ] = str_replace( 'talic', '', $variant );
463
  }
464
  if ( 'regular' == $variant ) {
465
+ $font[ $name ]['variants'][ $key ] = '400';
466
  }
467
  }
468
 
469
+ $fonts[ $name ] = $font[ $name ]['variants'];
470
  }
471
  return $fonts;
472
  }
473
 
474
+ /**
475
+ * @since 2.1.5
476
+ */
477
+ static private function _get_json() {
478
+ if ( ! empty( self::$_google_json ) ) {
479
+ $json = self::$_google_json;
480
+ } else {
481
+ $json = (array) json_decode( file_get_contents( trailingslashit( FL_BUILDER_DIR ) . 'json/fonts.json' ), true );
482
+ }
483
+ /**
484
+ * Filter raw google json data
485
+ * @see fl_builder_get_google_json
486
+ */
487
+ return apply_filters( 'fl_builder_get_google_json', $json );
488
+ }
489
+
490
+
491
+ /**
492
+ * @since 2.1.5
493
+ */
494
+ static public function get_google_fallback( $font ) {
495
+ $json = self::_get_json();
496
+ foreach ( $json as $k => $google ) {
497
+ $name = key( $google );
498
+ if ( $name == $font ) {
499
+ return $google[ $name ]['fallback'];
500
+ }
501
+ }
502
+ return false;
503
+ }
504
+
505
 
506
  /**
507
  * Array with a list of system fonts.
516
  '700',
517
  ),
518
  ),
519
+ 'Verdana' => array(
520
  'fallback' => 'Helvetica, Arial, sans-serif',
521
  'weights' => array(
522
  '300',
524
  '700',
525
  ),
526
  ),
527
+ 'Arial' => array(
528
  'fallback' => 'Helvetica, Verdana, sans-serif',
529
  'weights' => array(
530
  '300',
532
  '700',
533
  ),
534
  ),
535
+ 'Times' => array(
536
  'fallback' => 'Georgia, serif',
537
  'weights' => array(
538
  '300',
540
  '700',
541
  ),
542
  ),
543
+ 'Georgia' => array(
544
  'fallback' => 'Times, serif',
545
  'weights' => array(
546
  '300',
548
  '700',
549
  ),
550
  ),
551
+ 'Courier' => array(
552
  'fallback' => 'monospace',
553
  'weights' => array(
554
  '300',
classes/class-fl-builder-loader.php CHANGED
@@ -46,7 +46,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
46
  * @return void
47
  */
48
  static private function define_constants() {
49
- define( 'FL_BUILDER_VERSION', '2.1.4.5' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
@@ -66,6 +66,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
66
  * @return void
67
  */
68
  static private function load_files() {
 
69
  /* Classes */
70
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-filesystem.php';
71
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder.php';
46
  * @return void
47
  */
48
  static private function define_constants() {
49
+ define( 'FL_BUILDER_VERSION', '2.1.6.3' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
66
  * @return void
67
  */
68
  static private function load_files() {
69
+
70
  /* Classes */
71
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-filesystem.php';
72
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder.php';
classes/class-fl-builder-loop.php CHANGED
@@ -541,7 +541,11 @@ final class FLBuilderLoop {
541
 
542
  // Add rewrite to the registered tax only.
543
  if ( isset( $custom_paged['parent_page'] ) && $custom_paged['parent_page'] != $taxonomy ) {
544
- return;
 
 
 
 
545
  }
546
 
547
  // Make sure we have a valid term.
@@ -664,8 +668,10 @@ final class FLBuilderLoop {
664
  return false;
665
  }
666
 
667
- if ( $query->is_archive && $query->is_category && $query->post_count < 1 ) {
668
- return false;
 
 
669
  }
670
 
671
  $is_global_hack = false;
@@ -714,6 +720,7 @@ final class FLBuilderLoop {
714
  $permalink_structure = get_option( 'permalink_structure' );
715
  $paged = self::get_paged();
716
  $base = html_entity_decode( get_pagenum_link() );
 
717
 
718
  if ( $total_pages > 1 ) {
719
 
@@ -724,12 +731,23 @@ final class FLBuilderLoop {
724
  $base = self::build_base_url( $permalink_structure, $base );
725
  $format = self::paged_format( $permalink_structure, $base );
726
 
 
 
 
 
 
 
 
 
 
 
727
  echo paginate_links(array(
728
  'base' => $base . '%_%',
729
  'format' => $format,
730
  'current' => $current_page,
731
  'total' => $total_pages,
732
  'type' => 'list',
 
733
  ));
734
  }
735
  }
@@ -745,6 +763,7 @@ final class FLBuilderLoop {
745
  static public function filter_paginate_links( $link ) {
746
  $permalink_structure = get_option( 'permalink_structure' );
747
  $base = html_entity_decode( get_pagenum_link() );
 
748
 
749
  if ( empty( $permalink_structure ) && strrpos( $base, 'paged-' ) ) {
750
 
@@ -757,13 +776,18 @@ final class FLBuilderLoop {
757
  $current_flpaged = $current_paged_args[0];
758
  $current_paged_param = $current_flpaged . '=' . $base_args[ $current_flpaged ];
759
 
760
- $link_params = wp_parse_url( $link, PHP_URL_QUERY );
761
  $link_params = str_replace( $current_paged_param, '' , $link_params );
762
  wp_parse_str( $link_params, $link_args );
763
 
764
  $link = strtok( $link, '?' );
765
  $link = add_query_arg( $link_args, $link );
766
  }
 
 
 
 
 
 
767
  }
768
 
769
  return $link;
541
 
542
  // Add rewrite to the registered tax only.
543
  if ( isset( $custom_paged['parent_page'] ) && $custom_paged['parent_page'] != $taxonomy ) {
544
+
545
+ // Check also for custom taxonomy slug.
546
+ if ( $custom_paged['parent_page'] != $args['rewrite']['slug'] ) {
547
+ return;
548
+ }
549
  }
550
 
551
  // Make sure we have a valid term.
668
  return false;
669
  }
670
 
671
+ if ( $query->is_archive && $query->is_category ) {
672
+ if ( $query->post_count < 1 && ! isset( $_GET['flpaging'] ) ) {
673
+ return false;
674
+ }
675
  }
676
 
677
  $is_global_hack = false;
720
  $permalink_structure = get_option( 'permalink_structure' );
721
  $paged = self::get_paged();
722
  $base = html_entity_decode( get_pagenum_link() );
723
+ $add_args = false;
724
 
725
  if ( $total_pages > 1 ) {
726
 
731
  $base = self::build_base_url( $permalink_structure, $base );
732
  $format = self::paged_format( $permalink_structure, $base );
733
 
734
+ // Flag if it's a first posts module in an archive page.
735
+ // Fix pagination issues in archive page since it's using the main WP query for pagination.
736
+ if ( $query->is_archive && 1 === self::$loop_counter ) {
737
+ if ( isset( $query->query['settings']->data_source ) && 'custom_query' == $query->query['settings']->data_source ) {
738
+ $add_args = array(
739
+ 'flpaging' => 1,
740
+ );
741
+ }
742
+ }
743
+
744
  echo paginate_links(array(
745
  'base' => $base . '%_%',
746
  'format' => $format,
747
  'current' => $current_page,
748
  'total' => $total_pages,
749
  'type' => 'list',
750
+ 'add_args' => $add_args,
751
  ));
752
  }
753
  }
763
  static public function filter_paginate_links( $link ) {
764
  $permalink_structure = get_option( 'permalink_structure' );
765
  $base = html_entity_decode( get_pagenum_link() );
766
+ $link_params = wp_parse_url( $link, PHP_URL_QUERY );
767
 
768
  if ( empty( $permalink_structure ) && strrpos( $base, 'paged-' ) ) {
769
 
776
  $current_flpaged = $current_paged_args[0];
777
  $current_paged_param = $current_flpaged . '=' . $base_args[ $current_flpaged ];
778
 
 
779
  $link_params = str_replace( $current_paged_param, '' , $link_params );
780
  wp_parse_str( $link_params, $link_args );
781
 
782
  $link = strtok( $link, '?' );
783
  $link = add_query_arg( $link_args, $link );
784
  }
785
+ } elseif ( false !== strpos( $link, 'flpaging' ) && self::$loop_counter > 1 ) {
786
+ $link_params = str_replace( 'flpaging=1', '', $link_params );
787
+ wp_parse_str( $link_params, $link_args );
788
+
789
+ $link = strtok( $link, '?' );
790
+ $link = add_query_arg( $link_args, $link );
791
  }
792
 
793
  return $link;
classes/class-fl-builder-model.php CHANGED
@@ -185,10 +185,13 @@ final class FLBuilderModel {
185
  add_action( 'save_post', __CLASS__ . '::save_revision' );
186
  add_action( 'save_post', __CLASS__ . '::set_node_template_default_type', 10, 3 );
187
  add_action( 'wp_restore_post_revision', __CLASS__ . '::restore_revision', 10, 2 );
 
 
188
 
189
  /* Filters */
190
  add_filter( 'heartbeat_received', __CLASS__ . '::lock_post', 10, 2 );
191
- add_filter( 'fl_builder_register_settings_form', __CLASS__ . '::filter_row_settings_for_resize', 10, 2 );
 
192
 
193
  /* Core Templates */
194
  self::register_core_templates();
@@ -212,7 +215,13 @@ final class FLBuilderModel {
212
 
213
  $scheme = ( isset( $matches[1] ) ) ? $matches[1] : false;
214
 
215
- return set_url_scheme( add_query_arg( 'fl_builder', '', get_permalink( $post->ID ) ), $scheme );
 
 
 
 
 
 
216
  }
217
 
218
  /**
@@ -792,6 +801,19 @@ final class FLBuilderModel {
792
  return $info;
793
  }
794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  /**
796
  * Deletes either the preview, draft or live CSS and/or JS asset cache
797
  * for the current post based on the data returned from get_asset_info.
@@ -802,6 +824,11 @@ final class FLBuilderModel {
802
  * @return void
803
  */
804
  static public function delete_asset_cache( $type = false ) {
 
 
 
 
 
805
  $info = self::get_asset_info();
806
  $types = $type ? array( $type ) : array( 'css', 'css_partial', 'js', 'js_partial' );
807
 
@@ -826,7 +853,7 @@ final class FLBuilderModel {
826
  $post_id = $post_id ? $post_id : self::get_post_id();
827
  $cache_dir = self::get_cache_dir();
828
 
829
- if ( $post_id ) {
830
 
831
  $paths = array(
832
  $cache_dir['path'] . $post_id . '-layout.css',
@@ -2655,6 +2682,7 @@ final class FLBuilderModel {
2655
  */
2656
  static public function load_modules() {
2657
  $paths = glob( FL_BUILDER_DIR . 'modules/*' );
 
2658
  $module_path = '';
2659
 
2660
  // Make sure we have an array.
@@ -3701,7 +3729,7 @@ final class FLBuilderModel {
3701
 
3702
  $default = isset( $field['default'] ) ? $field['default'] : '';
3703
  $is_multiple = isset( $field['multiple'] ) && true === $field['multiple'];
3704
- $supports_multiple = 'editor' != $field['type'] && 'photo' != $field['type'];
3705
  $responsive = isset( $field['responsive'] ) && $field['responsive'] ? $field['responsive'] : false;
3706
  $responsive_name = '';
3707
 
@@ -4016,7 +4044,9 @@ final class FLBuilderModel {
4016
 
4017
  // Update template ID and template node ID
4018
  $template_id = get_post_meta( $new_post_id, '_fl_builder_template_id', true );
4019
- if ( $template_id ) {
 
 
4020
  foreach ( $data as $node_id => $node ) {
4021
  $data[ $node_id ]->template_id = $template_id;
4022
  $data[ $node_id ]->template_node_id = $node_id;
@@ -4060,6 +4090,7 @@ final class FLBuilderModel {
4060
  * @return void
4061
  */
4062
  static public function save_revision( $post_id ) {
 
4063
  $parent_id = wp_is_post_revision( $post_id );
4064
 
4065
  if ( $parent_id ) {
@@ -4075,6 +4106,46 @@ final class FLBuilderModel {
4075
  }
4076
  }
4077
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4078
  /**
4079
  * Restore a revision of a builder layout.
4080
  *
185
  add_action( 'save_post', __CLASS__ . '::save_revision' );
186
  add_action( 'save_post', __CLASS__ . '::set_node_template_default_type', 10, 3 );
187
  add_action( 'wp_restore_post_revision', __CLASS__ . '::restore_revision', 10, 2 );
188
+ add_action( 'fl_builder_after_save_layout', __CLASS__ . '::save_layout_revision' );
189
+ add_action( 'fl_builder_after_save_user_template', __CLASS__ . '::save_layout_revision' );
190
 
191
  /* Filters */
192
  add_filter( 'heartbeat_received', __CLASS__ . '::lock_post', 10, 2 );
193
+ add_filter( 'fl_builder_register_settings_form', __CLASS__ . '::filter_row_settings_for_resize', 10, 2 );
194
+ add_filter( 'wp_revisions_to_keep', __CLASS__ . '::limit_revisions', 10, 2 );
195
 
196
  /* Core Templates */
197
  self::register_core_templates();
215
 
216
  $scheme = ( isset( $matches[1] ) ) ? $matches[1] : false;
217
 
218
+ $url = set_url_scheme( add_query_arg( 'fl_builder', '', get_permalink( $post->ID ) ), $scheme );
219
+
220
+ /**
221
+ * Filter the bb edit url, 2 args, $url and $post.
222
+ * @see fl_get_edit_url
223
+ */
224
+ return apply_filters( 'fl_get_edit_url', $url, $post );
225
  }
226
 
227
  /**
801
  return $info;
802
  }
803
 
804
+ /**
805
+ * Returns the method used to enqueue layout css and js assets.
806
+ * Possible values are 'file' and 'inline'. By default, the file
807
+ * method is used. Return true for the fl_builder_render_assets_inline
808
+ * filter to enable inline enqueuing.
809
+ *
810
+ * @since 2.1.5
811
+ * @return string
812
+ */
813
+ static public function get_asset_enqueue_method() {
814
+ return apply_filters( 'fl_builder_render_assets_inline', false ) ? 'inline' : 'file';
815
+ }
816
+
817
  /**
818
  * Deletes either the preview, draft or live CSS and/or JS asset cache
819
  * for the current post based on the data returned from get_asset_info.
824
  * @return void
825
  */
826
  static public function delete_asset_cache( $type = false ) {
827
+
828
+ if ( 'inline' === FLBuilderModel::get_asset_enqueue_method() ) {
829
+ return false;
830
+ }
831
+
832
  $info = self::get_asset_info();
833
  $types = $type ? array( $type ) : array( 'css', 'css_partial', 'js', 'js_partial' );
834
 
853
  $post_id = $post_id ? $post_id : self::get_post_id();
854
  $cache_dir = self::get_cache_dir();
855
 
856
+ if ( $post_id && 'file' === FLBuilderModel::get_asset_enqueue_method() ) {
857
 
858
  $paths = array(
859
  $cache_dir['path'] . $post_id . '-layout.css',
2682
  */
2683
  static public function load_modules() {
2684
  $paths = glob( FL_BUILDER_DIR . 'modules/*' );
2685
+ $paths = apply_filters( 'fl_builder_load_modules_paths', $paths );
2686
  $module_path = '';
2687
 
2688
  // Make sure we have an array.
3729
 
3730
  $default = isset( $field['default'] ) ? $field['default'] : '';
3731
  $is_multiple = isset( $field['multiple'] ) && true === $field['multiple'];
3732
+ $supports_multiple = 'editor' != $field['type'] && 'service' != $field['type'];
3733
  $responsive = isset( $field['responsive'] ) && $field['responsive'] ? $field['responsive'] : false;
3734
  $responsive_name = '';
3735
 
4044
 
4045
  // Update template ID and template node ID
4046
  $template_id = get_post_meta( $new_post_id, '_fl_builder_template_id', true );
4047
+ $global = get_post_meta( $post_id, '_fl_builder_template_global', true );
4048
+
4049
+ if ( $template_id && $global ) {
4050
  foreach ( $data as $node_id => $node ) {
4051
  $data[ $node_id ]->template_id = $template_id;
4052
  $data[ $node_id ]->template_node_id = $node_id;
4090
  * @return void
4091
  */
4092
  static public function save_revision( $post_id ) {
4093
+
4094
  $parent_id = wp_is_post_revision( $post_id );
4095
 
4096
  if ( $parent_id ) {
4106
  }
4107
  }
4108
 
4109
+ /**
4110
+ * Limit the amount of revisions possible for fl-builder-template type.
4111
+ * @since 2.1.5
4112
+ */
4113
+ static public function limit_revisions( $num, $post ) {
4114
+
4115
+ if ( 'fl-builder-template' == $post->post_type ) {
4116
+ /**
4117
+ * Limit the ammount of revisions for the fl-builder-template type.
4118
+ * @see fl_builder_template_revisions
4119
+ */
4120
+ $num = apply_filters( 'fl_builder_template_revisions', 25 );
4121
+ }
4122
+ return $num;
4123
+ }
4124
+
4125
+ /**
4126
+ * Maybe save a post revision when templates/rows etc are published.
4127
+ * @since 2.1.5
4128
+ */
4129
+ static public function save_layout_revision( $post_id ) {
4130
+ add_filter( 'wp_save_post_revision_post_has_changed', array( __CLASS__, 'save_layout_revision_changed_filter' ), 10, 3 );
4131
+ wp_save_post_revision( $post_id );
4132
+ remove_filter( 'wp_save_post_revision_post_has_changed', array( __CLASS__, 'save_layout_revision_changed_filter' ), 10, 3 );
4133
+ }
4134
+
4135
+ /**
4136
+ * Filter save_layout_revision_changed_filter return true here if the builder data has $post_has_changed
4137
+ * this forces a post revision.
4138
+ * @since 2.1.5
4139
+ */
4140
+ static public function save_layout_revision_changed_filter( $post_has_changed, $last_revision, $post ) {
4141
+
4142
+ // get builder data for compare
4143
+ $old = serialize( get_post_meta( $last_revision->ID, '_fl_builder_data', true ) );
4144
+ $new = serialize( get_post_meta( $post->ID, '_fl_builder_data', true ) );
4145
+
4146
+ return $old != $new;
4147
+ }
4148
+
4149
  /**
4150
  * Restore a revision of a builder layout.
4151
  *
classes/class-fl-builder-revisions.php CHANGED
@@ -48,10 +48,14 @@ final class FLBuilderRevisions {
48
  'authors' => array(),
49
  );
50
 
 
 
51
  if ( count( $revisions ) > 1 ) {
52
 
53
  foreach ( $revisions as $revision ) {
54
 
 
 
55
  if ( ! current_user_can( 'read_post', $revision->ID ) ) {
56
  continue;
57
  }
@@ -59,6 +63,10 @@ final class FLBuilderRevisions {
59
  continue;
60
  }
61
 
 
 
 
 
62
  $timestamp = strtotime( $revision->post_date );
63
 
64
  $config['posts'][] = array(
48
  'authors' => array(),
49
  );
50
 
51
+ $current_data = serialize( get_post_meta( $post_id, '_fl_builder_data', true ) );
52
+
53
  if ( count( $revisions ) > 1 ) {
54
 
55
  foreach ( $revisions as $revision ) {
56
 
57
+ $revision_data = serialize( get_post_meta( $revision->ID, '_fl_builder_data', true ) );
58
+
59
  if ( ! current_user_can( 'read_post', $revision->ID ) ) {
60
  continue;
61
  }
63
  continue;
64
  }
65
 
66
+ if ( $revision_data == $current_data ) {
67
+ continue;
68
+ }
69
+
70
  $timestamp = strtotime( $revision->post_date );
71
 
72
  $config['posts'][] = array(
classes/class-fl-builder-service-activecampaign.php CHANGED
@@ -313,13 +313,36 @@ final class FLBuilderServiceActiveCampaign extends FLBuilderService {
313
  $data['email'] = $email;
314
  if ( isset( $settings->list_type ) && 'form' == $settings->list_type ) {
315
  $data['form'] = $settings->form_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  } else {
317
- $data['p'] = array( $settings->list_id );
318
- $data['status'] = array(
319
- $settings->list_id => 1,
 
 
 
 
320
  );
321
  $data['instantresponders'] = array(
322
- $settings->list_id => 1,
323
  );
324
  }
325
 
313
  $data['email'] = $email;
314
  if ( isset( $settings->list_type ) && 'form' == $settings->list_type ) {
315
  $data['form'] = $settings->form_id;
316
+
317
+ // Get list ID associated with the form.
318
+ $forms = $api->api( 'form/getforms' );
319
+
320
+ if ( $forms ) {
321
+ foreach ( $forms as $form ) {
322
+ if ( is_object( $form ) ) {
323
+ if ( $settings->form_id != $form->id ) {
324
+ continue;
325
+ }
326
+
327
+ if ( ! isset( $form->lists ) || 0 === count( (array) $form->lists ) ) {
328
+ continue;
329
+ }
330
+
331
+ $list_id = $form->lists[0];
332
+ }
333
+ }
334
+ }
335
  } else {
336
+ $data['p'] = array( $settings->list_id );
337
+ $list_id = $settings->list_id;
338
+ }
339
+
340
+ if ( $list_id ) {
341
+ $data['status'] = array(
342
+ $list_id => 1,
343
  );
344
  $data['instantresponders'] = array(
345
+ $list_id => 1,
346
  );
347
  }
348
 
classes/class-fl-builder-service-mailchimp.php CHANGED
@@ -33,11 +33,11 @@ final class FLBuilderServiceMailChimp extends FLBuilderService {
33
  if ( $this->api_instance ) {
34
  return $this->api_instance;
35
  }
36
- if ( ! class_exists( 'Mailchimp' ) ) {
37
  require_once FL_BUILDER_DIR . 'includes/vendor/mailchimp/mailchimp.php';
38
  }
39
 
40
- $this->api_instance = new Mailchimp( $api_key );
41
 
42
  return $this->api_instance;
43
  }
33
  if ( $this->api_instance ) {
34
  return $this->api_instance;
35
  }
36
+ if ( ! class_exists( 'FLBuilderMailChimp' ) ) {
37
  require_once FL_BUILDER_DIR . 'includes/vendor/mailchimp/mailchimp.php';
38
  }
39
 
40
+ $this->api_instance = new FLBuilderMailChimp( $api_key );
41
 
42
  return $this->api_instance;
43
  }
classes/class-fl-builder-service-mailerlite.php CHANGED
@@ -169,7 +169,7 @@ final class FLBuilderServiceMailerLite extends FLBuilderService {
169
  'row_class' => 'fl-builder-service-field-row',
170
  'class' => 'fl-builder-service-list-select',
171
  'type' => 'select',
172
- 'label' => _x( 'List', 'An email list from a third party provider.', 'fl-builder' ),
173
  'options' => $options,
174
  'preview' => array(
175
  'type' => 'none',
169
  'row_class' => 'fl-builder-service-field-row',
170
  'class' => 'fl-builder-service-list-select',
171
  'type' => 'select',
172
+ 'label' => _x( 'Group', 'An email list from a third party provider.', 'fl-builder' ),
173
  'options' => $options,
174
  'preview' => array(
175
  'type' => 'none',
classes/class-fl-builder-ui-settings-forms.php CHANGED
@@ -61,6 +61,11 @@ class FLBuilderUISettingsForms {
61
  static public function render_settings_config() {
62
  if ( FLBuilderModel::is_builder_active() && isset( $_GET['fl_builder_load_settings_config'] ) ) {
63
 
 
 
 
 
 
64
  $type = sanitize_key( $_GET['fl_builder_load_settings_config'] );
65
  $handler = 'FLBuilderUISettingsForms::compress_settings_config';
66
 
@@ -409,13 +414,21 @@ class FLBuilderUISettingsForms {
409
 
410
  $base = str_replace( '_src', '', $key );
411
 
412
- if ( isset( $node->settings->$base ) && is_numeric( $node->settings->$base ) ) {
413
-
414
- $id = $node->settings->$base;
415
- $data = self::prep_attachment_for_js_config( $id );
416
-
417
- if ( $data ) {
418
- $attachments[ $id ] = $data;
 
 
 
 
 
 
 
 
419
  }
420
  }
421
  }
@@ -424,13 +437,18 @@ class FLBuilderUISettingsForms {
424
  if ( isset( $fields[ $key ] ) && 'video' === $fields[ $key ]['type'] ) {
425
 
426
  if ( is_numeric( $value ) ) {
427
-
428
  $id = $value;
429
  $data = self::prep_attachment_for_js_config( $id );
430
-
431
  if ( $data ) {
432
  $attachments[ $id ] = $data;
433
  }
 
 
 
 
 
 
 
434
  }
435
  }
436
  }
@@ -647,7 +665,7 @@ class FLBuilderUISettingsForms {
647
  $value = isset( $settings->$name ) ? $settings->$name : '';
648
  $is_multiple = isset( $field['multiple'] ) ? $field['multiple'] : false;
649
 
650
- if ( $is_multiple ) {
651
  $before = array();
652
  $after = array();
653
  foreach ( $value as $repeater_item_value ) {
@@ -815,7 +833,7 @@ class FLBuilderUISettingsForms {
815
  $field = apply_filters( 'fl_builder_render_settings_field', $field, $name, $settings ); // Allow field settings filtering first
816
  $i = null;
817
  $is_multiple = isset( $field['multiple'] ) && true === (bool) $field['multiple'];
818
- $supports_multiple = 'editor' != $field['type'] && 'photo' != $field['type'] && 'service' != $field['type'];
819
  $settings = ! $settings ? new stdClass() : $settings;
820
  $preview = isset( $field['preview'] ) ? json_encode( $field['preview'] ) : json_encode( array(
821
  'type' => 'refresh',
61
  static public function render_settings_config() {
62
  if ( FLBuilderModel::is_builder_active() && isset( $_GET['fl_builder_load_settings_config'] ) ) {
63
 
64
+ // Increase available memory.
65
+ if ( function_exists( 'wp_raise_memory_limit' ) ) {
66
+ wp_raise_memory_limit( 'bb-plugin' );
67
+ }
68
+
69
  $type = sanitize_key( $_GET['fl_builder_load_settings_config'] );
70
  $handler = 'FLBuilderUISettingsForms::compress_settings_config';
71
 
414
 
415
  $base = str_replace( '_src', '', $key );
416
 
417
+ if ( isset( $node->settings->$base ) ) {
418
+
419
+ if ( is_numeric( $node->settings->$base ) ) {
420
+ $id = $node->settings->$base;
421
+ $data = self::prep_attachment_for_js_config( $id );
422
+ if ( $data ) {
423
+ $attachments[ $id ] = $data;
424
+ }
425
+ } elseif ( is_array( $node->settings->$base ) ) {
426
+ foreach ( $node->settings->$base as $id ) {
427
+ $data = self::prep_attachment_for_js_config( $id );
428
+ if ( $data ) {
429
+ $attachments[ $id ] = $data;
430
+ }
431
+ }
432
  }
433
  }
434
  }
437
  if ( isset( $fields[ $key ] ) && 'video' === $fields[ $key ]['type'] ) {
438
 
439
  if ( is_numeric( $value ) ) {
 
440
  $id = $value;
441
  $data = self::prep_attachment_for_js_config( $id );
 
442
  if ( $data ) {
443
  $attachments[ $id ] = $data;
444
  }
445
+ } elseif ( is_array( $value ) ) {
446
+ foreach ( $value as $id ) {
447
+ $data = self::prep_attachment_for_js_config( $id );
448
+ if ( $data ) {
449
+ $attachments[ $id ] = $data;
450
+ }
451
+ }
452
  }
453
  }
454
  }
665
  $value = isset( $settings->$name ) ? $settings->$name : '';
666
  $is_multiple = isset( $field['multiple'] ) ? $field['multiple'] : false;
667
 
668
+ if ( $is_multiple && is_array( $value ) ) {
669
  $before = array();
670
  $after = array();
671
  foreach ( $value as $repeater_item_value ) {
833
  $field = apply_filters( 'fl_builder_render_settings_field', $field, $name, $settings ); // Allow field settings filtering first
834
  $i = null;
835
  $is_multiple = isset( $field['multiple'] ) && true === (bool) $field['multiple'];
836
+ $supports_multiple = 'editor' != $field['type'] && 'service' != $field['type'];
837
  $settings = ! $settings ? new stdClass() : $settings;
838
  $preview = isset( $field['preview'] ) ? json_encode( $field['preview'] ) : json_encode( array(
839
  'type' => 'refresh',
classes/class-fl-builder-usage.php CHANGED
@@ -14,10 +14,10 @@ final class FLBuilderUsage {
14
  $hook = is_network_admin() ? 'network_admin_notices' : 'admin_notices';
15
 
16
  add_action( 'admin_init', array( 'FLBuilderUsage', 'enable_disable' ) );
17
- add_action( 'init', array( 'FLBuilderUsage', 'set_schedule' ) );
18
- add_action( $hook, array( 'FLBuilderUsage', 'render_notification' ) );
19
- add_action( 'admin_enqueue_scripts', array( 'FLBuilderUsage', 'scripts' ) );
20
- add_action( 'fl_builder_usage_event', array( 'FLBuilderUsage', 'send_stats' ) );
21
  add_action( 'wp_ajax_fl_usage_toggle', array( 'FLBuilderUsage', 'callback' ) );
22
  }
23
 
@@ -32,6 +32,12 @@ final class FLBuilderUsage {
32
  wp_die();
33
  }
34
 
 
 
 
 
 
 
35
  public static function scripts() {
36
 
37
  wp_enqueue_style( 'fl-builder-admin-usage', FL_BUILDER_URL . 'css/fl-builder-admin-usage.css', array(), FL_BUILDER_VERSION );
@@ -61,7 +67,8 @@ final class FLBuilderUsage {
61
  return false;
62
  }
63
  $request = wp_remote_post( self::$url, array(
64
- 'body' => json_encode( self::get_data() ),
 
65
  ) );
66
  }
67
 
@@ -176,35 +183,35 @@ final class FLBuilderUsage {
176
  */
177
  public static function data_demo() {
178
 
179
- $data = self::get_data( true );
180
- $output = '';
181
- $txt = '';
182
  $settings = array(
183
- 'server' => array(
184
  'name' => __( 'Server Type', 'fl-builder' ),
185
  'data' => $data['data']['server'],
186
  ),
187
- 'php' => array(
188
  'name' => __( 'PHP Version', 'fl-builder' ),
189
  'data' => $data['data']['php'],
190
  ),
191
- 'wp' => array(
192
  'name' => __( 'WP Version', 'fl-builder' ),
193
  'data' => $data['data']['wp'],
194
  ),
195
- 'mu' => array(
196
  'name' => __( 'WP Multisite', 'fl-builder' ),
197
  'data' => $data['data']['multisite'],
198
  ),
199
- 'locale' => array(
200
  'name' => __( 'Locale', 'fl-builder' ),
201
  'data' => $data['data']['locale'],
202
  ),
203
- 'plugins' => array(
204
  'name' => __( 'Plugins Count', 'fl-builder' ),
205
  'data' => $data['data']['plugins'],
206
  ),
207
- 'modules' => array(
208
  'name' => __( 'Modules Used', 'fl-builder' ),
209
  'data' => __( 'Which modules are used and how many times.', 'fl-builder' ),
210
  ),
@@ -240,25 +247,25 @@ final class FLBuilderUsage {
240
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
241
  }
242
 
243
- $data = array(
244
  'modules' => array(),
245
  'license' => array(),
246
  'themer' => array(
247
- 'header' => 0,
248
- 'footer' => 0,
249
- 'part' => 0,
250
- '404' => 0,
251
  'singular' => 0,
252
  ),
253
- 'pinned' => array(
254
- 'left' => 0,
255
- 'right' => 0,
256
  'unpinned' => 0,
257
  ),
258
  );
259
- $users = count_users();
260
- $plugins_data = get_plugins();
261
- $data['plugins'] = count( $plugins_data );
262
  $data['plugins_active'] = 0;
263
 
264
  foreach ( (array) $plugins_data as $plugin_slug => $plugin ) {
@@ -271,7 +278,7 @@ final class FLBuilderUsage {
271
  * Setup an array of post types to query
272
  */
273
  $post_types = get_post_types( array(
274
- 'public' => true,
275
  '_builtin' => true,
276
  ) );
277
 
@@ -283,31 +290,31 @@ final class FLBuilderUsage {
283
  /**
284
  * Get a count of all posts/pages that are *not* builder enabled.
285
  */
286
- $args = array(
287
- 'post_type' => $post_types,
288
- 'post_status' => 'publish',
289
- 'meta_query' => array(
290
- 'key' => '_fl_builder_enabled',
291
- 'value' => '1',
292
- 'compare' => '!=',
293
- ),
294
- 'posts_per_page' => -1,
295
  );
296
- $query = new WP_Query( $args );
297
  $data['not-enabled'] = count( $query->posts );
298
 
299
  /**
300
  * Get a count of all posts pages that are using the builder.
301
  */
302
  $args = array(
303
- 'post_type' => $post_types,
304
- 'post_status' => 'publish',
305
- 'meta_key' => '_fl_builder_enabled',
306
- 'meta_value' => '1',
307
  'posts_per_page' => -1,
308
  );
309
 
310
- $query = new WP_Query( $args );
311
  $data['enabled'] = count( $query->posts );
312
 
313
  /**
@@ -329,14 +336,14 @@ final class FLBuilderUsage {
329
  }
330
 
331
  // themer settings.
332
- $args = array(
333
- 'post_type' => 'fl-theme-layout',
334
- 'post_status' => 'publish',
335
- 'meta_key' => '_fl_builder_enabled',
336
- 'meta_value' => '1',
337
  'posts_per_page' => -1,
338
  );
339
- $query = new WP_Query( $args );
340
  $data['themer']['total'] = count( $query->posts );
341
  if ( is_array( $query->posts ) && ! empty( $query->posts ) ) {
342
  foreach ( $query->posts as $post ) {
@@ -354,58 +361,48 @@ final class FLBuilderUsage {
354
  /**
355
  * Find all users that are using the builder.
356
  */
357
- $args = array(
358
- 'meta_key' => 'fl_builder_user_settings',
359
- 'meta_value' => 'null',
 
 
 
 
 
 
 
 
 
 
 
 
360
  'meta_compare' => '!=',
361
  );
362
  $query = new WP_User_Query( $args );
363
 
364
- /**
365
- * Using array of users collect their builder settings, pinned, skin etc.
366
- */
367
- if ( ! empty( $query->results ) ) {
368
- foreach ( $query->results as $user ) {
369
- $meta = get_user_meta( $user->ID, 'fl_builder_user_settings', true );
370
- if ( isset( $meta['skin'] ) ) {
371
- if ( ! isset( $data['skin'][ $meta['skin'] ] ) ) {
372
- $data['skin'][ $meta['skin'] ] = 1;
373
- } else {
374
- $data['skin'][ $meta['skin'] ] ++;
375
- }
376
- }
377
- if ( isset( $meta['pinned']['position'] ) ) {
378
- if ( '' == $meta['pinned']['position'] ) {
379
- if ( ! isset( $data['pinned']['unpinned'] ) ) {
380
- $data['pinned']['unpinned'] = 1;
381
- } else {
382
- $data['pinned']['unpinned'] ++;
383
- }
384
- } else {
385
- if ( ! isset( $data['pinned'][ $meta['pinned']['position'] ] ) ) {
386
- $data['pinned'][ $meta['pinned']['position'] ] = 1;
387
- } else {
388
- $data['pinned'][ $meta['pinned']['position'] ] ++;
389
- }
390
- }
391
- }
392
- }
393
  }
394
 
395
  /**
396
  * General data
397
  */
398
- $data['server'] = $_SERVER['SERVER_SOFTWARE'];
399
- $data['database'] = ( ! empty( $wpdb->is_mysql ) ? $wpdb->db_version() : 'Unknown' );
400
- $data['multisite'] = is_multisite() ? 'Yes' : 'No';
401
- $data['subsites'] = is_multisite() ? get_blog_count() : '';
402
- $data['locale'] = get_locale();
403
- $data['users'] = $users['total_users'];
404
- $data['php'] = phpversion();
405
- $data['wp'] = $wp_version;
406
- $data['fl-builder'] = FL_BUILDER_VERSION;
407
- $data['fl-theme'] = ( defined( 'FL_THEME_VERSION' ) ) ? FL_THEME_VERSION : false;
408
- $data['fl-themer'] = ( defined( 'FL_THEME_BUILDER_VERSION' ) ) ? FL_THEME_BUILDER_VERSION : false;
 
 
409
 
410
  $settings_orig = FLBuilderModel::get_global_settings();
411
 
@@ -421,8 +418,8 @@ final class FLBuilderUsage {
421
 
422
  $theme = wp_get_theme();
423
  if ( $theme->get( 'Template' ) ) {
424
- $parent = wp_get_theme( $theme->get( 'Template' ) );
425
- $data['theme'] = $parent->get( 'Name' );
426
  $data['theme_child'] = $theme->get( 'Name' );
427
  } else {
428
  $data['theme'] = $theme->get( 'Name' );
@@ -433,8 +430,9 @@ final class FLBuilderUsage {
433
  $subscription = FLUpdater::get_subscription_info();
434
 
435
  if ( ! $subscription->active ) {
436
- $data['license'][] = 'none';
437
  } else {
 
438
  foreach ( (array) $subscription->subscriptions as $subscription ) {
439
  if ( false !== strpos( $subscription->name, 'Beaver Builder' ) ) {
440
  $data['license']['bb-plugin'] = $subscription->name;
@@ -445,11 +443,10 @@ final class FLBuilderUsage {
445
  }
446
  }
447
  } else {
448
- $data['license'][] = 'none';
449
  }
450
-
451
  $output = array(
452
- 'id' => md5( get_bloginfo( 'url' ) . get_bloginfo( 'admin_email' ) ),
453
  'data' => $data,
454
  );
455
  return $output;
14
  $hook = is_network_admin() ? 'network_admin_notices' : 'admin_notices';
15
 
16
  add_action( 'admin_init', array( 'FLBuilderUsage', 'enable_disable' ) );
17
+ add_action( 'init', array( 'FLBuilderUsage', 'set_schedule' ) );
18
+ add_action( $hook, array( 'FLBuilderUsage', 'render_notification' ) );
19
+ add_action( 'admin_enqueue_scripts', array( 'FLBuilderUsage', 'scripts' ) );
20
+ add_action( 'fl_builder_usage_event', array( 'FLBuilderUsage', 'send_stats' ) );
21
  add_action( 'wp_ajax_fl_usage_toggle', array( 'FLBuilderUsage', 'callback' ) );
22
  }
23
 
32
  wp_die();
33
  }
34
 
35
+ public static function browser_stats( $browser_data ) {
36
+
37
+ update_user_meta( get_current_user_id(), 'fl_builder_browser_stats', $browser_data );
38
+ exit();
39
+ }
40
+
41
  public static function scripts() {
42
 
43
  wp_enqueue_style( 'fl-builder-admin-usage', FL_BUILDER_URL . 'css/fl-builder-admin-usage.css', array(), FL_BUILDER_VERSION );
67
  return false;
68
  }
69
  $request = wp_remote_post( self::$url, array(
70
+ 'body' => json_encode( self::get_data() ),
71
+ 'timeout' => 30,
72
  ) );
73
  }
74
 
183
  */
184
  public static function data_demo() {
185
 
186
+ $data = self::get_data( true );
187
+ $output = '';
188
+ $txt = '';
189
  $settings = array(
190
+ 'server' => array(
191
  'name' => __( 'Server Type', 'fl-builder' ),
192
  'data' => $data['data']['server'],
193
  ),
194
+ 'php' => array(
195
  'name' => __( 'PHP Version', 'fl-builder' ),
196
  'data' => $data['data']['php'],
197
  ),
198
+ 'wp' => array(
199
  'name' => __( 'WP Version', 'fl-builder' ),
200
  'data' => $data['data']['wp'],
201
  ),
202
+ 'mu' => array(
203
  'name' => __( 'WP Multisite', 'fl-builder' ),
204
  'data' => $data['data']['multisite'],
205
  ),
206
+ 'locale' => array(
207
  'name' => __( 'Locale', 'fl-builder' ),
208
  'data' => $data['data']['locale'],
209
  ),
210
+ 'plugins' => array(
211
  'name' => __( 'Plugins Count', 'fl-builder' ),
212
  'data' => $data['data']['plugins'],
213
  ),
214
+ 'modules' => array(
215
  'name' => __( 'Modules Used', 'fl-builder' ),
216
  'data' => __( 'Which modules are used and how many times.', 'fl-builder' ),
217
  ),
247
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
248
  }
249
 
250
+ $data = array(
251
  'modules' => array(),
252
  'license' => array(),
253
  'themer' => array(
254
+ 'header' => 0,
255
+ 'footer' => 0,
256
+ 'part' => 0,
257
+ '404' => 0,
258
  'singular' => 0,
259
  ),
260
+ 'pinned' => array(
261
+ 'left' => 0,
262
+ 'right' => 0,
263
  'unpinned' => 0,
264
  ),
265
  );
266
+ $users = count_users();
267
+ $plugins_data = get_plugins();
268
+ $data['plugins'] = count( $plugins_data );
269
  $data['plugins_active'] = 0;
270
 
271
  foreach ( (array) $plugins_data as $plugin_slug => $plugin ) {
278
  * Setup an array of post types to query
279
  */
280
  $post_types = get_post_types( array(
281
+ 'public' => true,
282
  '_builtin' => true,
283
  ) );
284
 
290
  /**
291
  * Get a count of all posts/pages that are *not* builder enabled.
292
  */
293
+ $args = array(
294
+ 'post_type' => $post_types,
295
+ 'post_status' => 'publish',
296
+ 'meta_query' => array(
297
+ 'key' => '_fl_builder_enabled',
298
+ 'value' => '1',
299
+ 'compare' => '!=',
300
+ ),
301
+ 'posts_per_page' => -1,
302
  );
303
+ $query = new WP_Query( $args );
304
  $data['not-enabled'] = count( $query->posts );
305
 
306
  /**
307
  * Get a count of all posts pages that are using the builder.
308
  */
309
  $args = array(
310
+ 'post_type' => $post_types,
311
+ 'post_status' => 'publish',
312
+ 'meta_key' => '_fl_builder_enabled',
313
+ 'meta_value' => '1',
314
  'posts_per_page' => -1,
315
  );
316
 
317
+ $query = new WP_Query( $args );
318
  $data['enabled'] = count( $query->posts );
319
 
320
  /**
336
  }
337
 
338
  // themer settings.
339
+ $args = array(
340
+ 'post_type' => 'fl-theme-layout',
341
+ 'post_status' => 'publish',
342
+ 'meta_key' => '_fl_builder_enabled',
343
+ 'meta_value' => '1',
344
  'posts_per_page' => -1,
345
  );
346
+ $query = new WP_Query( $args );
347
  $data['themer']['total'] = count( $query->posts );
348
  if ( is_array( $query->posts ) && ! empty( $query->posts ) ) {
349
  foreach ( $query->posts as $post ) {
361
  /**
362
  * Find all users that are using the builder.
363
  */
364
+ $args = array(
365
+ 'meta_key' => 'fl_builder_user_settings',
366
+ 'meta_value' => 'null',
367
+ 'meta_compare' => '!=',
368
+ );
369
+ $query = new WP_User_Query( $args );
370
+ $user_settings = array();
371
+ foreach ( $query->results as $user ) {
372
+ $meta = get_user_meta( $user->ID, 'fl_builder_user_settings', true );
373
+ $user_settings[ $user->ID ] = $meta;
374
+ }
375
+
376
+ $args = array(
377
+ 'meta_key' => 'fl_builder_browser_stats',
378
+ 'meta_value' => 'null',
379
  'meta_compare' => '!=',
380
  );
381
  $query = new WP_User_Query( $args );
382
 
383
+ $browsers = array();
384
+
385
+ foreach ( $query->results as $user ) {
386
+ $meta = get_user_meta( $user->ID, 'fl_builder_browser_stats', true );
387
+ $browsers[ $user->ID ] = $meta;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  }
389
 
390
  /**
391
  * General data
392
  */
393
+ $data['server'] = $_SERVER['SERVER_SOFTWARE'];
394
+ $data['database'] = ( ! empty( $wpdb->is_mysql ) ? $wpdb->db_version() : 'Unknown' );
395
+ $data['multisite'] = is_multisite() ? 'Yes' : 'No';
396
+ $data['subsites'] = is_multisite() ? get_blog_count() : '';
397
+ $data['locale'] = get_locale();
398
+ $data['users'] = $users['total_users'];
399
+ $data['php'] = phpversion();
400
+ $data['wp'] = $wp_version;
401
+ $data['fl-builder'] = FL_BUILDER_VERSION;
402
+ $data['fl-theme'] = ( defined( 'FL_THEME_VERSION' ) ) ? FL_THEME_VERSION : false;
403
+ $data['fl-themer'] = ( defined( 'FL_THEME_BUILDER_VERSION' ) ) ? FL_THEME_BUILDER_VERSION : false;
404
+ $data['browsers'] = $browsers;
405
+ $data['user_settings'] = $user_settings;
406
 
407
  $settings_orig = FLBuilderModel::get_global_settings();
408
 
418
 
419
  $theme = wp_get_theme();
420
  if ( $theme->get( 'Template' ) ) {
421
+ $parent = wp_get_theme( $theme->get( 'Template' ) );
422
+ $data['theme'] = $parent->get( 'Name' );
423
  $data['theme_child'] = $theme->get( 'Name' );
424
  } else {
425
  $data['theme'] = $theme->get( 'Name' );
430
  $subscription = FLUpdater::get_subscription_info();
431
 
432
  if ( ! $subscription->active ) {
433
+ $data['license'] = 'none';
434
  } else {
435
+ $data['license'] = array();
436
  foreach ( (array) $subscription->subscriptions as $subscription ) {
437
  if ( false !== strpos( $subscription->name, 'Beaver Builder' ) ) {
438
  $data['license']['bb-plugin'] = $subscription->name;
443
  }
444
  }
445
  } else {
446
+ $data['license'] = 'none';
447
  }
 
448
  $output = array(
449
+ 'id' => md5( get_bloginfo( 'url' ) . get_bloginfo( 'admin_email' ) ),
450
  'data' => $data,
451
  );
452
  return $output;
classes/class-fl-builder-user-access.php CHANGED
@@ -252,7 +252,7 @@ final class FLBuilderUserAccess {
252
  }
253
 
254
  // Make sure super admins have administrator access.
255
- if ( is_super_admin() && ! in_array( 'administrator', $user->roles ) ) {
256
  $user->roles[] = 'administrator';
257
  }
258
 
252
  }
253
 
254
  // Make sure super admins have administrator access.
255
+ if ( is_multisite() && is_super_admin() && ! in_array( 'administrator', $user->roles ) ) {
256
  $user->roles[] = 'administrator';
257
  }
258
 
classes/class-fl-builder.php CHANGED
@@ -62,7 +62,7 @@ final class FLBuilder {
62
  * @since 2.1
63
  */
64
  static public $fa4_url = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
65
- static public $fa5_pro_url = 'https://pro.fontawesome.com/releases/v5.2.0/css/all.css';
66
 
67
  /**
68
  * Initializes hooks.
@@ -380,8 +380,8 @@ final class FLBuilder {
380
  // Register additional CSS
381
  wp_register_style( 'fl-slideshow', $css_url . 'fl-slideshow.css', array( 'yui3' ), $ver );
382
  wp_register_style( 'jquery-bxslider', $css_url . 'jquery.bxslider.css', array(), $ver );
383
- wp_register_style( 'jquery-magnificpopup', $css_url . 'jquery.magnificpopup.css', array(), $ver );
384
- wp_register_style( 'yui3', $css_url . 'yui3.css', array(), $ver );
385
 
386
  // Register icon CDN CSS
387
  wp_register_style( 'font-awesome', self::$fa4_url, array(), $ver );
@@ -394,16 +394,16 @@ final class FLBuilder {
394
  wp_register_script( 'jquery-bxslider', $js_url . 'jquery.bxslider.js', array( 'jquery-easing', 'jquery-fitvids' ), $ver, true );
395
  wp_register_script( 'jquery-easing', $js_url . 'jquery.easing.min.js', array( 'jquery' ), '1.4', true );
396
  wp_register_script( 'jquery-fitvids', $js_url . 'jquery.fitvids.min.js', array( 'jquery' ), '1.2', true );
397
- wp_register_script( 'jquery-imagesloaded', $js_url . 'jquery.imagesloaded.min.js', array( 'jquery' ), $ver, true );
398
  wp_register_script( 'jquery-infinitescroll', $js_url . 'jquery.infinitescroll.min.js', array( 'jquery' ), $ver, true );
399
  wp_register_script( 'jquery-magnificpopup', $js_url . 'jquery.magnificpopup.min.js', array( 'jquery' ), $ver, true );
400
  wp_register_script( 'jquery-mosaicflow', $js_url . 'jquery.mosaicflow.min.js', array( 'jquery' ), $ver, true );
401
  wp_register_script( 'jquery-waypoints', $js_url . 'jquery.waypoints.min.js', array( 'jquery' ), $ver, true );
402
  wp_register_script( 'jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array( 'jquery' ), $ver, true );
403
  wp_register_script( 'yui3', $js_url . 'yui3.min.js', array(), $ver, true );
404
-
405
  wp_register_script( 'youtube-player', 'https://www.youtube.com/iframe_api', array(), $ver, true );
406
  wp_register_script( 'vimeo-player', 'https://player.vimeo.com/api/player.js', array(), $ver, true );
 
 
407
  }
408
 
409
  /**
@@ -464,10 +464,10 @@ final class FLBuilder {
464
  if ( 'slideshow' == $row->settings->bg_type ) {
465
  wp_enqueue_script( 'yui3' );
466
  wp_enqueue_script( 'fl-slideshow' );
467
- wp_enqueue_script( 'jquery-imagesloaded' );
468
  wp_enqueue_style( 'fl-slideshow' );
469
  } elseif ( 'video' == $row->settings->bg_type ) {
470
- wp_enqueue_script( 'jquery-imagesloaded' );
471
  if ( 'video_service' == $row->settings->bg_video_source ) {
472
 
473
  $video_data = FLBuilderUtils::get_video_data( $row->settings->bg_video_service_url );
@@ -561,20 +561,22 @@ final class FLBuilder {
561
  }
562
 
563
  // Render the asset inline instead of enqueuing the file?
564
- if ( ! $active && apply_filters( 'fl_builder_render_assets_inline', false ) ) {
565
 
566
  // Bail if we've already rendered this.
567
  if ( in_array( $path, self::$rendered_assets ) ) {
568
  return;
 
 
569
  }
570
 
571
  // Enqueue inline.
572
  if ( 'css' === $type ) {
573
  wp_register_style( $handle, false, $css_deps, $asset_ver, $css_media );
574
  wp_enqueue_style( $handle );
575
- wp_add_inline_style( $handle, self::render_css( $global, false ) );
576
  } else {
577
- self::$inline_js .= self::render_js( $global, false );
578
  if ( ! has_action( 'wp_footer', __CLASS__ . '::render_inline_js' ) ) {
579
  add_action( 'wp_footer', __CLASS__ . '::render_inline_js', PHP_INT_MAX );
580
  }
@@ -886,11 +888,11 @@ final class FLBuilder {
886
  // Enable editing if the builder is active.
887
  if ( FLBuilderModel::is_builder_active() && ! FLBuilderAJAX::doing_ajax() ) {
888
 
889
- // Tell W3TC not to minify while the builder is active.
890
- define( 'DONOTMINIFY', true );
891
-
892
- // Tell Autoptimize not to minify while the builder is active.
893
- add_filter( 'autoptimize_filter_noptimize', '__return_true' );
894
 
895
  // Remove 3rd party editor buttons.
896
  remove_all_actions( 'media_buttons', 999999 );
@@ -2290,7 +2292,8 @@ final class FLBuilder {
2290
  * @return void
2291
  */
2292
  static public function render_custom_css_for_editing() {
2293
- if ( ! FLBuilderModel::is_builder_active() ) {
 
2294
  return;
2295
  }
2296
 
@@ -2306,15 +2309,15 @@ final class FLBuilder {
2306
  *
2307
  * @since 1.0
2308
  * @param bool $include_global
2309
- * @param bool $save
2310
  * @return string
2311
  */
2312
- static public function render_css( $include_global = true, $save = true ) {
2313
  // Get info on the new file.
2314
  $nodes = FLBuilderModel::get_categorized_nodes();
2315
  $node_status = FLBuilderModel::get_node_status();
2316
  $global_settings = FLBuilderModel::get_global_settings();
2317
  $asset_info = FLBuilderModel::get_asset_info();
 
2318
  $post_id = FLBuilderModel::get_post_id();
2319
  $post = get_post( $post_id );
2320
  $css = '';
@@ -2436,7 +2439,7 @@ final class FLBuilder {
2436
  }
2437
 
2438
  // Save the CSS.
2439
- if ( $save ) {
2440
  fl_builder_filesystem()->file_put_contents( $path, $css );
2441
  }
2442
 
@@ -2534,7 +2537,9 @@ final class FLBuilder {
2534
  }
2535
 
2536
  // Default page heading
2537
- if ( FLBuilderModel::is_builder_enabled() ) {
 
 
2538
  if ( ! $global_settings->show_default_heading && ! empty( $global_settings->default_heading_selector ) ) {
2539
  $heading_selector = esc_attr( $global_settings->default_heading_selector );
2540
 
@@ -2812,16 +2817,16 @@ final class FLBuilder {
2812
  *
2813
  * @since 1.0
2814
  * @param bool $include_global
2815
- * @param bool $save
2816
  * @return string
2817
  */
2818
- static public function render_js( $include_global = true, $save = true ) {
2819
  // Get info on the new file.
2820
  $nodes = FLBuilderModel::get_categorized_nodes();
2821
  $global_settings = FLBuilderModel::get_global_settings();
2822
  $layout_settings = FLBuilderModel::get_layout_settings();
2823
  $rows = FLBuilderModel::get_nodes( 'row' );
2824
  $asset_info = FLBuilderModel::get_asset_info();
 
2825
  $js = '';
2826
  $path = $include_global ? $asset_info['js'] : $asset_info['js_partial'];
2827
 
@@ -2878,7 +2883,7 @@ final class FLBuilder {
2878
  }
2879
 
2880
  // Save the JS.
2881
- if ( $save ) {
2882
  fl_builder_filesystem()->file_put_contents( $path, $js );
2883
  }
2884
 
62
  * @since 2.1
63
  */
64
  static public $fa4_url = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
65
+ static public $fa5_pro_url = 'https://pro.fontawesome.com/releases/v5.4.2/css/all.css';
66
 
67
  /**
68
  * Initializes hooks.
380
  // Register additional CSS
381
  wp_register_style( 'fl-slideshow', $css_url . 'fl-slideshow.css', array( 'yui3' ), $ver );