WordPress Page Builder – Beaver Builder - Version 2.3.1.1

Version Description

Download this release

Release Info

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

Code changes from version 2.2.6.3 to 2.3.1.1

Files changed (72) hide show
  1. changelog.txt +112 -3
  2. classes/class-fl-builder-admin-posts.php +10 -1
  3. classes/class-fl-builder-admin-settings.php +38 -3
  4. classes/class-fl-builder-admin.php +8 -0
  5. classes/class-fl-builder-ajax-layout.php +9 -1
  6. classes/class-fl-builder-ajax.php +6 -1
  7. classes/class-fl-builder-art.php +4 -0
  8. classes/class-fl-builder-color.php +3 -3
  9. classes/class-fl-builder-compatibility.php +720 -0
  10. classes/class-fl-builder-css.php +9 -5
  11. classes/class-fl-builder-debug.php +28 -0
  12. classes/class-fl-builder-export.php +4 -0
  13. classes/class-fl-builder-filesystem.php +8 -0
  14. classes/class-fl-builder-fonts.php +43 -7
  15. classes/class-fl-builder-history-manager.php +311 -0
  16. classes/class-fl-builder-icons.php +17 -5
  17. classes/class-fl-builder-loader.php +3 -1
  18. classes/class-fl-builder-loop.php +3 -1
  19. classes/class-fl-builder-model.php +143 -13
  20. classes/class-fl-builder-revisions.php +2 -2
  21. classes/class-fl-builder-service-sendy.php +3 -2
  22. classes/class-fl-builder-ui-settings-forms.php +39 -1
  23. classes/class-fl-builder-wp-blocks.php +5 -0
  24. classes/class-fl-builder.php +203 -16
  25. css/fl-builder-ui-skin-dark.css +14 -1
  26. css/fl-builder.css +157 -33
  27. css/fl-builder.min.css +1 -1
  28. css/fl-color-picker.css +3 -2
  29. css/fl-icon-selector.css +4 -5
  30. css/select2.min.css +1 -0
  31. extensions/fl-builder-cache-helper/plugins/kinsta.php +27 -3
  32. fl-builder.php +1 -1
  33. fonts/fontawesome/5.12.0/css/all.min.css +5 -0
  34. fonts/fontawesome/5.12.0/css/v4-shims.min.css +5 -0
  35. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-brands-400.eot +0 -0
  36. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-brands-400.svg +175 -82
  37. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-brands-400.ttf +0 -0
  38. fonts/fontawesome/5.12.0/webfonts/fa-brands-400.woff +0 -0
  39. fonts/fontawesome/5.12.0/webfonts/fa-brands-400.woff2 +0 -0
  40. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-regular-400.eot +0 -0
  41. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-regular-400.svg +11 -11
  42. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-regular-400.ttf +0 -0
  43. fonts/fontawesome/5.12.0/webfonts/fa-regular-400.woff +0 -0
  44. fonts/fontawesome/5.12.0/webfonts/fa-regular-400.woff2 +0 -0
  45. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-solid-900.eot +0 -0
  46. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-solid-900.svg +177 -126
  47. fonts/fontawesome/{webfonts → 5.12.0/webfonts}/fa-solid-900.ttf +0 -0
  48. fonts/fontawesome/5.12.0/webfonts/fa-solid-900.woff +0 -0
  49. fonts/fontawesome/5.12.0/webfonts/fa-solid-900.woff2 +0 -0
  50. fonts/fontawesome/css/all.min.css +0 -5
  51. fonts/fontawesome/css/v4-shims.min.css +0 -5
  52. fonts/fontawesome/webfonts/fa-brands-400.woff +0 -0
  53. fonts/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  54. fonts/fontawesome/webfonts/fa-regular-400.woff +0 -0
  55. fonts/fontawesome/webfonts/fa-regular-400.woff2 +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-modules.php +60 -3
  59. includes/admin-settings-tools.php +1 -1
  60. includes/admin-settings-welcome.php +7 -7
  61. includes/compatibility.php +7 -729
  62. includes/export.php +2 -2
  63. includes/module-settings.php +17 -0
  64. includes/row-settings.php +1 -1
  65. includes/ui-extras.php +2 -2
  66. includes/ui-js-config.php +10 -1
  67. includes/ui-js-templates.php +13 -3
  68. includes/ui-settings-form-row.php +1 -1
  69. includes/ui-settings-form.php +2 -2
  70. includes/updater-config.php +1 -1
  71. includes/updater/classes/class-fl-updater.php +28 -4
  72. js/build/builder.bundle.js +1433 -1035
changelog.txt CHANGED
@@ -1,7 +1,116 @@
1
- <h4>2.2.6.3 - 11/27/2019</h4>
2
- <p><strong>Hot Fix</strong></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  <ul>
4
- <li>Fixed Importer issues.</li>
 
5
  </ul>
6
 
7
  <h4>2.2.6.2 - 11/18/2019</h4>
1
+ <h4>2.3.1.1 - 01/21/2020</h4>
2
+ <strong>Hot Fix</strong>
3
+ <ul>
4
+ <li>Fixed Icon Group spacing issue.</li>
5
+ </ul>
6
+
7
+ <h4>2.3.1 - 01/16/2020</h4>
8
+ <strong>Enhancements</strong>
9
+ <ul>
10
+ <li>Added responsive alignment controls to Icon Group.</li>
11
+ <li>Added available downloads to debug info.</li>
12
+ <li>Whe using Youtube video for row background, use fallback as start image then fade in when video loads.</li>
13
+ <li>Respect <code>fl_builder_render_admin_edit_ui</code> filter if using Block Editor.</li>
14
+ </ul>
15
+ <strong>Bug Fixes</strong>
16
+ <ul>
17
+ <li>Fixed cache clearing on Kinsta.</li>
18
+ <li>Fixed Block Editor builder links broken in WP 5.0-5.2</li>
19
+ <li>Style hardening in Builder UI.</li>
20
+ <li>Fixed Font Awesome Pro multisite issue on subsites.</li>
21
+ <li>Added missing Node ID to the Callout Module's icon.</li>
22
+ <li>Fixed submenu toggle on mobile devices.</li>
23
+ <li>Fixed background-clip issue on row borders.</li>
24
+ <li>Fixed post slider thumbnails disappearing if you exclude a post.</li>
25
+ <li>Fixed safemode JS error FLBuilderLayout not defined.</li>
26
+ </ul>
27
+
28
+ <h4>2.3.0.3 - 01/09/2020</h4>
29
+ <strong>Hot Fix</strong>
30
+ <ul>
31
+ <li>Fixed typography slider controls when using touch enabled devices.</li>
32
+ <li>Fixed fatal PHP error if using slideshow row background and slideshow module is disabled.</li>
33
+ <li>Fixed rare PHP error when determining template type. </li>
34
+ <li>Fixed Builder not opening issue when using Yoast and Block Editor.</li>
35
+ <li>Added dependency checks for disabled modules.</li>
36
+ <li>Added <code>fl_select2_enabled</code> filter to disable select2.</li>
37
+ </ul>
38
+
39
+ <h4>2.3.0.2 - 01/02/2020</h4>
40
+ <strong>Hot Fix</strong>
41
+ <ul>
42
+ <li>Use Select2 library for font selection.</li>
43
+ <li>Update Font Awesome to 5.12</li>
44
+ <li>Fixed PHP warning to make sure the post object is an instance of WP_Post.</li>
45
+ <li>Fixed <code>fl_builder_pre_render_css_rules</code> filter.</li>
46
+ <li>Style hardening for builder UI when using 2020 theme.</li>
47
+ </ul>
48
+
49
+ <h4>2.3.0.1 - 12/11/2019</h4>
50
+ <strong>Hot Fix</strong>
51
+ <ul>
52
+ <li>Fix Launch BB button so that it does not prompt you to leave/cancel when using WordPress 5.3</li>
53
+ <li>Subscribe Module: Update for compatibility with Sendy 4</li>
54
+ </ul>
55
+
56
+ <h4>2.3 - 12/3/2019</h4>
57
+ <strong>Enhancements</strong>
58
+ <ul>
59
+ <li>You can now re-arrange your color presets</li>
60
+ <li>New filter <code>fl_remember_settings_tabs_enabled</code> to disable the UI remembering the last tab</li>
61
+ </ul>
62
+ <strong>Bug Fixes</strong>
63
+ <ul>
64
+ <li>Reduce memory consumption in WP admin by limiting the scope of data we request for the sorting feature</li>
65
+ <li>Prevent our data validation inside the UI from applying to widgets</li>
66
+ <li>Fixed recently used fonts not being applied properly.</li>
67
+ </ul>
68
+
69
+ <h4>2.3 Beta 3 - 11/27/2019</h4>
70
+ <strong>Bug Fix</strong>
71
+ <ul>
72
+ <li>Fixed Importer issues.</li>
73
+ <li>Fixed Font Awesome Shim CSS.</li>
74
+ </ul>
75
+ <h4>2.3 Beta 2 - 11/25/2019</h4>
76
+ <strong>Enhancements</strong>
77
+ <ul>
78
+ <li>Remember which settings tab was last open when opening new settings windows.</li>
79
+ <li>Debug Info: Show modules and includes folder paths if used in child theme and what modules are being overridden.</li>
80
+ <li>Sort the Template Category in the Page Builder UI when override is enabled</li>
81
+ </ul>
82
+ <strong>Bug Fixes</strong>
83
+ <ul>
84
+ <li>Fixed DuoTone icon issues with Icon Group Module
85
+ Fixed default text still appearing even after being removed</li>
86
+ <li>Fixed Accordion label background icon css issue</li>
87
+ <li>Fixed Accordion issue where DuoTone options were showing when they shouldn't be</li>
88
+ </ul>
89
+ <strong>Compatibility</strong>
90
+ <ul>
91
+ <li>Fixed issue where EventEspresso stylesheet hides Text Editor module tabs and Add Media Button</li>
92
+ </ul>
93
+ <h4>2.3 Beta 1 - 11/13/2019</h4>
94
+ <a href="https://kb.wpbeaverbuilder.com/category/769-23-beta">Please review the docs</a>
95
+
96
+ <strong>Enhancements</strong>
97
+ <ul>
98
+ <li>Undo/Redo</li>
99
+ <li>History Manager</li>
100
+ <li>Touch Support: Use BB on a mobile device.</li>
101
+ <li>Module Copy/Paste Settings (in Advanced tab)</li>
102
+ <li>New BigCommerce module to display content from BigCommerce (<strong>BigCommerce plugin required</strong>)</li>
103
+ <li>Body classes added based on device size <code>fl-builder-breakpoint-small</code></li>
104
+ <li>New filter to completely disable modules from loading <code>is_module_disable_enabled</code></li>
105
+ <li>Visibility icon now shows what rule is active (e.g. logged in / out)</li>
106
+ <li>FontAwesome: Update FontAwesome icons and Enable Pro in settings as well as added support for Kits and the DuoTone icon set</li>
107
+ <li>Added new filter to enable shortcodes in layout/global CSS and JS <code>fl_enable_shortcode_css_js</code></li>
108
+ <li>Decreased page load by approximately 20% by caching internal variables.</li>
109
+ </ul>
110
+ <strong>Bug Fixes</strong>
111
  <ul>
112
+ <li>Fixed scrolling not working when trying to move elements while Responsive Editing is enabled</li>
113
+ <li>Subscribe Form Module: Fixed HTML being stripped out of success message</li>
114
  </ul>
115
 
116
  <h4>2.2.6.2 - 11/18/2019</h4>
classes/class-fl-builder-admin-posts.php CHANGED
@@ -92,6 +92,10 @@ final class FLBuilderAdminPosts {
92
 
93
  if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
94
 
 
 
 
 
95
  $render_ui = apply_filters( 'fl_builder_render_admin_edit_ui', true );
96
  $post_type = self::get_post_type();
97
  $post_types = FLBuilderModel::get_post_types();
@@ -123,6 +127,7 @@ final class FLBuilderAdminPosts {
123
  $args = array(
124
  'post_type' => $post_type,
125
  'posts_per_page' => -1,
 
126
  'meta_query' => array(
127
  array(
128
  'key' => '_fl_builder_enabled',
@@ -137,7 +142,7 @@ final class FLBuilderAdminPosts {
137
  wp_localize_script( 'fl-builder-admin-posts-list',
138
  'fl_builder_enabled_count',
139
  array(
140
- 'count' => $count,
141
  'brand' => FLBuilderModel::get_branding(),
142
  'clicked' => $clicked,
143
  'type' => $post_type,
@@ -220,6 +225,10 @@ final class FLBuilderAdminPosts {
220
 
221
  if ( 'trash' != $post->post_status && current_user_can( 'edit_post', $post->ID ) && wp_check_post_lock( $post->ID ) === false ) {
222
 
 
 
 
 
223
  $is_post_editable = (bool) apply_filters( 'fl_builder_is_post_editable', true, $post );
224
  $user_access = FLBuilderUserAccess::current_user_can( 'builder_access' );
225
  $post_types = FLBuilderModel::get_post_types();
92
 
93
  if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
94
 
95
+ /**
96
+ * Enable/disable builder edit UI buttons
97
+ * @see fl_builder_render_admin_edit_ui
98
+ */
99
  $render_ui = apply_filters( 'fl_builder_render_admin_edit_ui', true );
100
  $post_type = self::get_post_type();
101
  $post_types = FLBuilderModel::get_post_types();
127
  $args = array(
128
  'post_type' => $post_type,
129
  'posts_per_page' => -1,
130
+ 'fields' => 'ids',
131
  'meta_query' => array(
132
  array(
133
  'key' => '_fl_builder_enabled',
142
  wp_localize_script( 'fl-builder-admin-posts-list',
143
  'fl_builder_enabled_count',
144
  array(
145
+ 'count' => number_format_i18n( $count ),
146
  'brand' => FLBuilderModel::get_branding(),
147
  'clicked' => $clicked,
148
  'type' => $post_type,
225
 
226
  if ( 'trash' != $post->post_status && current_user_can( 'edit_post', $post->ID ) && wp_check_post_lock( $post->ID ) === false ) {
227
 
228
+ /**
229
+ * Is post editable from admin post list
230
+ * @see fl_builder_is_post_editable
231
+ */
232
  $is_post_editable = (bool) apply_filters( 'fl_builder_is_post_editable', true, $post );
233
  $user_access = FLBuilderUserAccess::current_user_can( 'builder_access' );
234
  $post_types = FLBuilderModel::get_post_types();
classes/class-fl-builder-admin-settings.php CHANGED
@@ -92,6 +92,14 @@ final class FLBuilderAdminSettings {
92
  wp_enqueue_style( 'jquery-multiselect', FL_BUILDER_URL . 'css/jquery.multiselect.css', array(), FL_BUILDER_VERSION );
93
  wp_enqueue_style( 'jquery-tiptip', FL_BUILDER_URL . 'css/jquery.tiptip.css', array(), FL_BUILDER_VERSION );
94
 
 
 
 
 
 
 
 
 
95
  // Scripts
96
  wp_enqueue_script( 'fl-builder-admin-settings', FL_BUILDER_URL . 'js/fl-builder-admin-settings.js', array(), FL_BUILDER_VERSION );
97
  wp_enqueue_script( 'jquery-actual', FL_BUILDER_URL . 'js/jquery.actual.min.js', array( 'jquery' ), FL_BUILDER_VERSION );
@@ -185,6 +193,10 @@ final class FLBuilderAdminSettings {
185
  * @return void
186
  */
187
  static public function render_nav_items() {
 
 
 
 
188
  $item_data = apply_filters( 'fl_builder_admin_settings_nav_items', array(
189
  'welcome' => array(
190
  'title' => __( 'Welcome', 'fl-builder' ),
@@ -468,6 +480,15 @@ final class FLBuilderAdminSettings {
468
  // Update the enabled sets.
469
  self::update_enabled_icons( $enabled_icons );
470
 
 
 
 
 
 
 
 
 
 
471
  // Delete a set?
472
  if ( ! empty( $_POST['fl-delete-icon-set'] ) ) {
473
 
@@ -492,9 +513,16 @@ final class FLBuilderAdminSettings {
492
  // Upload a new set?
493
  if ( ! empty( $_POST['fl-new-icon-set'] ) ) {
494
 
495
- $dir = FLBuilderModel::get_cache_dir( 'icons' );
496
- $id = (int) $_POST['fl-new-icon-set'];
497
- $path = apply_filters( 'fl_builder_icon_set_upload_path', get_attached_file( $id ) );
 
 
 
 
 
 
 
498
  $new_path = apply_filters( 'fl_builder_icon_set_new_path', $dir['path'] . 'icon-' . time() . '/' );
499
 
500
  fl_builder_filesystem()->get_filesystem();
@@ -549,6 +577,9 @@ final class FLBuilderAdminSettings {
549
  */
550
  do_action( 'fl_builder_after_unzip_icon_set', $new_path );
551
 
 
 
 
552
  $check_path = apply_filters( 'fl_builder_icon_set_check_path', $new_path );
553
 
554
  // Check for supported sets.
@@ -708,6 +739,10 @@ final class FLBuilderAdminSettings {
708
  return;
709
  } elseif ( isset( $_POST['fl-uninstall'] ) && wp_verify_nonce( $_POST['fl-uninstall'], 'uninstall' ) ) {
710
 
 
 
 
 
711
  $uninstall = apply_filters( 'fl_builder_uninstall', true );
712
 
713
  if ( $uninstall ) {
92
  wp_enqueue_style( 'jquery-multiselect', FL_BUILDER_URL . 'css/jquery.multiselect.css', array(), FL_BUILDER_VERSION );
93
  wp_enqueue_style( 'jquery-tiptip', FL_BUILDER_URL . 'css/jquery.tiptip.css', array(), FL_BUILDER_VERSION );
94
 
95
+ if ( FLBuilder::fa5_pro_enabled() ) {
96
+ if ( '' !== get_option( '_fl_builder_kit_fa_pro' ) ) {
97
+ wp_enqueue_script( 'fa5-kit', get_option( '_fl_builder_kit_fa_pro' ) );
98
+ } else {
99
+ wp_register_style( 'font-awesome-5', FLBuilder::get_fa5_url() );
100
+ wp_enqueue_style( 'font-awesome-5' );
101
+ }
102
+ }
103
  // Scripts
104
  wp_enqueue_script( 'fl-builder-admin-settings', FL_BUILDER_URL . 'js/fl-builder-admin-settings.js', array(), FL_BUILDER_VERSION );
105
  wp_enqueue_script( 'jquery-actual', FL_BUILDER_URL . 'js/jquery.actual.min.js', array( 'jquery' ), FL_BUILDER_VERSION );
193
  * @return void
194
  */
195
  static public function render_nav_items() {
196
+ /**
197
+ * Builder admin nav items
198
+ * @see fl_builder_admin_settings_nav_items
199
+ */
200
  $item_data = apply_filters( 'fl_builder_admin_settings_nav_items', array(
201
  'welcome' => array(
202
  'title' => __( 'Welcome', 'fl-builder' ),
480
  // Update the enabled sets.
481
  self::update_enabled_icons( $enabled_icons );
482
 
483
+ // Enable pro?
484
+ $enable_fa_pro = isset( $_POST['fl-enable-fa-pro'] ) ? true : false;
485
+ update_option( '_fl_builder_enable_fa_pro', $enable_fa_pro );
486
+ do_action( 'fl_builder_fa_pro_save', $enable_fa_pro );
487
+ // Update KIT url
488
+ $kit_url = isset( $_POST['fl-fa-pro-kit'] ) ? $_POST['fl-fa-pro-kit'] : '';
489
+
490
+ update_option( '_fl_builder_kit_fa_pro', $kit_url );
491
+
492
  // Delete a set?
493
  if ( ! empty( $_POST['fl-delete-icon-set'] ) ) {
494
 
513
  // Upload a new set?
514
  if ( ! empty( $_POST['fl-new-icon-set'] ) ) {
515
 
516
+ $dir = FLBuilderModel::get_cache_dir( 'icons' );
517
+ $id = (int) $_POST['fl-new-icon-set'];
518
+ /**
519
+ * Icon upload path
520
+ * @see fl_builder_icon_set_upload_path
521
+ */
522
+ $path = apply_filters( 'fl_builder_icon_set_upload_path', get_attached_file( $id ) );
523
+ /**
524
+ * @see fl_builder_icon_set_new_path
525
+ */
526
  $new_path = apply_filters( 'fl_builder_icon_set_new_path', $dir['path'] . 'icon-' . time() . '/' );
527
 
528
  fl_builder_filesystem()->get_filesystem();
577
  */
578
  do_action( 'fl_builder_after_unzip_icon_set', $new_path );
579
 
580
+ /**
581
+ * @see fl_builder_icon_set_check_path
582
+ */
583
  $check_path = apply_filters( 'fl_builder_icon_set_check_path', $new_path );
584
 
585
  // Check for supported sets.
739
  return;
740
  } elseif ( isset( $_POST['fl-uninstall'] ) && wp_verify_nonce( $_POST['fl-uninstall'], 'uninstall' ) ) {
741
 
742
+ /**
743
+ * Disable Uninstall ( default true )
744
+ * @see fl_builder_uninstall
745
+ */
746
  $uninstall = apply_filters( 'fl_builder_uninstall', true );
747
 
748
  if ( $uninstall ) {
classes/class-fl-builder-admin.php CHANGED
@@ -99,6 +99,10 @@ final class FLBuilderAdmin {
99
  * @return string
100
  */
101
  static public function admin_settings_capability() {
 
 
 
 
102
  return apply_filters( 'fl_builder_admin_settings_capability', 'manage_options' );
103
  }
104
 
@@ -192,6 +196,10 @@ final class FLBuilderAdmin {
192
  $message = __( 'Beaver Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
193
  }
194
 
 
 
 
 
195
  $url = apply_filters( 'fl_builder_activate_redirect_url', admin_url( '/options-general.php?page=fl-builder-settings' . $hash ) );
196
 
197
  echo '<div class="updated" style="background: #d3ebc1;">';
99
  * @return string
100
  */
101
  static public function admin_settings_capability() {
102
+ /**
103
+ * Default admin settings capability ( manage_options )
104
+ * @see fl_builder_admin_settings_capability
105
+ */
106
  return apply_filters( 'fl_builder_admin_settings_capability', 'manage_options' );
107
  }
108
 
196
  $message = __( 'Beaver Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
197
  }
198
 
199
+ /**
200
+ * Url to redirect to on activation
201
+ * @see fl_builder_activate_redirect_url
202
+ */
203
  $url = apply_filters( 'fl_builder_activate_redirect_url', admin_url( '/options-general.php?page=fl-builder-settings' . $hash ) );
204
 
205
  echo '<div class="updated" style="background: #d3ebc1;">';
classes/class-fl-builder-ajax-layout.php CHANGED
@@ -68,6 +68,7 @@ final class FLBuilderAJAXLayout {
68
  'partial' => $partial_refresh_data['is_partial_refresh'],
69
  'nodeId' => $partial_refresh_data['node_id'],
70
  'nodeType' => $partial_refresh_data['node_type'],
 
71
  'oldNodeId' => $old_node_id,
72
  'html' => $html,
73
  'scriptsStyles' => $scripts_styles,
@@ -355,6 +356,7 @@ final class FLBuilderAJAXLayout {
355
  $post_data = FLBuilderModel::get_post_data();
356
  $partial_refresh = false;
357
  $node_type = null;
 
358
 
359
  // Check for partial refresh if we have a node ID.
360
  if ( isset( $post_data['node_id'] ) ) {
@@ -368,6 +370,7 @@ final class FLBuilderAJAXLayout {
368
  if ( $node && 'module' == $node->type ) {
369
  $node = FLBuilderModel::get_module( $node_id );
370
  $node_type = 'module';
 
371
  $partial_refresh = $node->partial_refresh;
372
  } elseif ( $node ) {
373
  $node_type = $node->type;
@@ -385,6 +388,7 @@ final class FLBuilderAJAXLayout {
385
  'node_id' => $node_id,
386
  'node' => $node,
387
  'node_type' => $node_type,
 
388
  );
389
  }
390
 
@@ -497,11 +501,15 @@ final class FLBuilderAJAXLayout {
497
 
498
  /**
499
  * Use this filter to prevent the builder from rendering shortcodes.
500
- * It is useful if you dont want shortcodes rendering while the builder UI is active.
501
  * @see fl_builder_render_shortcodes
502
  * @link https://kb.wpbeaverbuilder.com/article/117-plugin-filter-reference
503
  */
504
  if ( apply_filters( 'fl_builder_render_shortcodes', true ) ) {
 
 
 
 
505
  $html = apply_filters( 'fl_builder_before_render_shortcodes', $html );
506
  ob_start();
507
  echo do_shortcode( $html );
68
  'partial' => $partial_refresh_data['is_partial_refresh'],
69
  'nodeId' => $partial_refresh_data['node_id'],
70
  'nodeType' => $partial_refresh_data['node_type'],
71
+ 'moduleType' => $partial_refresh_data['module_type'],
72
  'oldNodeId' => $old_node_id,
73
  'html' => $html,
74
  'scriptsStyles' => $scripts_styles,
356
  $post_data = FLBuilderModel::get_post_data();
357
  $partial_refresh = false;
358
  $node_type = null;
359
+ $module_type = null;
360
 
361
  // Check for partial refresh if we have a node ID.
362
  if ( isset( $post_data['node_id'] ) ) {
370
  if ( $node && 'module' == $node->type ) {
371
  $node = FLBuilderModel::get_module( $node_id );
372
  $node_type = 'module';
373
+ $module_type = $node->settings->type;
374
  $partial_refresh = $node->partial_refresh;
375
  } elseif ( $node ) {
376
  $node_type = $node->type;
388
  'node_id' => $node_id,
389
  'node' => $node,
390
  'node_type' => $node_type,
391
+ 'module_type' => $module_type,
392
  );
393
  }
394
 
501
 
502
  /**
503
  * Use this filter to prevent the builder from rendering shortcodes.
504
+ * It is useful if you don't want shortcodes rendering while the builder UI is active.
505
  * @see fl_builder_render_shortcodes
506
  * @link https://kb.wpbeaverbuilder.com/article/117-plugin-filter-reference
507
  */
508
  if ( apply_filters( 'fl_builder_render_shortcodes', true ) ) {
509
+ /**
510
+ * Used with fl_builder_render_shortcodes shortcode.
511
+ * @see fl_builder_before_render_shortcodes
512
+ */
513
  $html = apply_filters( 'fl_builder_before_render_shortcodes', $html );
514
  ob_start();
515
  echo do_shortcode( $html );
classes/class-fl-builder-ajax.php CHANGED
@@ -100,7 +100,7 @@ final class FLBuilderAJAX {
100
  self::add_action( 'duplicate_wpml_layout', 'FLBuilderModel::duplicate_wpml_layout', array( 'original_post_id', 'post_id' ) );
101
  self::add_action( 'apply_user_template', 'FLBuilderModel::apply_user_template', array( 'template_id', 'append' ) );
102
  self::add_action( 'apply_template', 'FLBuilderModel::apply_template', array( 'template_id', 'append' ) );
103
- self::add_action( 'save_layout', 'FLBuilderModel::save_layout' );
104
  self::add_action( 'save_draft', 'FLBuilderModel::save_draft' );
105
  self::add_action( 'clear_draft_layout', 'FLBuilderModel::clear_draft_layout' );
106
  self::add_action( 'disable_builder', 'FLBuilderModel::disable' );
@@ -129,6 +129,11 @@ final class FLBuilderAJAX {
129
  self::add_action( 'restore_revision', 'FLBuilderRevisions::restore', array( 'revision_id' ) );
130
  self::add_action( 'refresh_revision_items', 'FLBuilderRevisions::get_config', array( 'post_id' ) );
131
 
 
 
 
 
 
132
  // FLBuilderServices
133
  self::add_action( 'render_service_settings', 'FLBuilderServices::render_settings' );
134
  self::add_action( 'render_service_fields', 'FLBuilderServices::render_fields' );
100
  self::add_action( 'duplicate_wpml_layout', 'FLBuilderModel::duplicate_wpml_layout', array( 'original_post_id', 'post_id' ) );
101
  self::add_action( 'apply_user_template', 'FLBuilderModel::apply_user_template', array( 'template_id', 'append' ) );
102
  self::add_action( 'apply_template', 'FLBuilderModel::apply_template', array( 'template_id', 'append' ) );
103
+ self::add_action( 'save_layout', 'FLBuilderModel::save_layout', array( 'publish', 'exit' ) );
104
  self::add_action( 'save_draft', 'FLBuilderModel::save_draft' );
105
  self::add_action( 'clear_draft_layout', 'FLBuilderModel::clear_draft_layout' );
106
  self::add_action( 'disable_builder', 'FLBuilderModel::disable' );
129
  self::add_action( 'restore_revision', 'FLBuilderRevisions::restore', array( 'revision_id' ) );
130
  self::add_action( 'refresh_revision_items', 'FLBuilderRevisions::get_config', array( 'post_id' ) );
131
 
132
+ // FLBuilderHistoryManager
133
+ self::add_action( 'save_history_state', 'FLBuilderHistoryManager::save_current_state', array( 'label', 'module_type' ) );
134
+ self::add_action( 'render_history_state', 'FLBuilderHistoryManager::render_state', array( 'position' ) );
135
+ self::add_action( 'clear_history_states', 'FLBuilderHistoryManager::delete_states', array( 'post_id' ) );
136
+
137
  // FLBuilderServices
138
  self::add_action( 'render_service_settings', 'FLBuilderServices::render_settings' );
139
  self::add_action( 'render_service_fields', 'FLBuilderServices::render_fields' );
classes/class-fl-builder-art.php CHANGED
@@ -171,6 +171,10 @@ class FLBuilderArt {
171
  * @return Array
172
  */
173
  static public function get_art( $key = null ) {
 
 
 
 
174
  $art = apply_filters( 'fl_shape_artwork', self::$artwork );
175
 
176
  if ( $key && isset( $art[ $key ] ) ) {
171
  * @return Array
172
  */
173
  static public function get_art( $key = null ) {
174
+ /**
175
+ * Array of all registered shapes
176
+ * @see fl_shape_artwork
177
+ */
178
  $art = apply_filters( 'fl_shape_artwork', self::$artwork );
179
 
180
  if ( $key && isset( $art[ $key ] ) ) {
classes/class-fl-builder-color.php CHANGED
@@ -159,13 +159,13 @@ final class FLBuilderColor {
159
 
160
  if ( isset( $setting['color'] ) && '' !== $setting['color'] ) {
161
 
162
- if ( '' === $setting['horizontal'] ) {
163
  $setting['horizontal'] = 0;
164
  }
165
- if ( '' === $setting['vertical'] ) {
166
  $setting['vertical'] = 0;
167
  }
168
- if ( '' === $setting['blur'] ) {
169
  $setting['blur'] = 0;
170
  }
171
  if ( isset( $setting['spread'] ) && '' === $setting['spread'] ) {
159
 
160
  if ( isset( $setting['color'] ) && '' !== $setting['color'] ) {
161
 
162
+ if ( ! isset( $setting['horizontal'] ) || '' === $setting['horizontal'] ) {
163
  $setting['horizontal'] = 0;
164
  }
165
+ if ( ! isset( $setting['vertical'] ) || '' === $setting['vertical'] ) {
166
  $setting['vertical'] = 0;
167
  }
168
+ if ( ! isset( $setting['blur'] ) || '' === $setting['blur'] ) {
169
  $setting['blur'] = 0;
170
  }
171
  if ( isset( $setting['spread'] ) && '' === $setting['spread'] ) {
classes/class-fl-builder-compatibility.php ADDED
@@ -0,0 +1,720 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Various fixes for various plugins.
5
+ *
6
+ * @since 2.3
7
+ */
8
+ final class FLBuilderCompatibility {
9
+
10
+ public static function init() {
11
+
12
+ // Actions
13
+ add_action( 'after_setup_theme', array( __CLASS__, 'pro_icons_enable' ) );
14
+ add_action( 'fl_builder_photo_cropped', array( __CLASS__, 'tinypng_support' ), 10, 2 );
15
+ add_action( 'plugins_loaded', array( __CLASS__, 'wc_memberships_support' ), 11 );
16
+ add_action( 'plugins_loaded', array( __CLASS__, 'admin_ssl_upload_fix' ), 11 );
17
+ add_action( 'added_post_meta', array( __CLASS__, 'template_meta_add' ), 10, 4 );
18
+ add_action( 'fl_builder_insert_layout_render', array( __CLASS__, 'insert_layout_render_search' ), 10, 3 );
19
+ add_action( 'fl_builder_fa_pro_save', array( __CLASS__, 'clear_theme_cache' ) );
20
+ add_action( 'wp', array( __CLASS__, 'ee_suppress_notices' ) );
21
+ add_action( 'fl_ajax_before_call_action', array( __CLASS__, 'ee_before_ajax' ) );
22
+ add_action( 'plugins_loaded', array( __CLASS__, 'fix_nextgen_gallery' ) );
23
+ add_action( 'template_redirect', array( __CLASS__, 'fix_tasty_recipes' ) );
24
+ add_action( 'template_redirect', array( __CLASS__, 'fix_generatepress_fa5' ) );
25
+ add_action( 'template_redirect', array( __CLASS__, 'fix_hummingbird' ) );
26
+ add_action( 'template_redirect', array( __CLASS__, 'fix_enjoy_instagram' ) );
27
+ add_action( 'template_redirect', array( __CLASS__, 'fix_templator' ) );
28
+ add_action( 'template_redirect', array( __CLASS__, 'fix_protector_gold' ) );
29
+ add_action( 'template_redirect', array( __CLASS__, 'fix_smush_it' ) );
30
+ add_action( 'template_redirect', array( __CLASS__, 'fix_frontend_dashboard_plugin' ), 1000 );
31
+ add_action( 'template_redirect', array( __CLASS__, 'fix_um_switcher' ) );
32
+ add_action( 'template_redirect', array( __CLASS__, 'fix_pipedrive' ) );
33
+ add_action( 'template_redirect', array( __CLASS__, 'aggiungi_script_instafeed_owl' ), 1000 );
34
+ add_action( 'tribe_events_pro_widget_render', array( __CLASS__, 'tribe_events_pro_widget_render_fix' ), 10, 3 );
35
+ add_action( 'wp_footer', array( __CLASS__, 'fix_woo_short_description_footer' ) );
36
+ add_action( 'save_post', array( __CLASS__, 'fix_seopress' ), 9 );
37
+ add_action( 'admin_init', array( __CLASS__, 'fix_posttypeswitcher' ) );
38
+ add_action( 'widgets_init', array( __CLASS__, 'fix_google_reviews_business_widget' ), 11 );
39
+ add_action( 'init', array( __CLASS__, 'fix_google_reviews_business_shortcode' ) );
40
+ add_action( 'pre_get_posts', array( __CLASS__, 'gute_links_fix' ) );
41
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'fa_kit_support' ), 99999 );
42
+ add_action( 'fl_theme_builder_before_render_header', array( __CLASS__, 'fix_lazyload_header_start' ) );
43
+ add_action( 'fl_theme_builder_after_render_header', array( __CLASS__, 'fix_lazyload_header_end' ) );
44
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'ee_remove_stylesheet' ), 99999 );
45
+
46
+ // Filters
47
+ add_filter( 'fl_builder_is_post_editable', array( __CLASS__, 'bp_pages_support' ), 11, 2 );
48
+ add_filter( 'jetpack_photon_skip_image', array( __CLASS__, 'photo_photon_exception' ), 10, 3 );
49
+ add_filter( 'fl_builder_render_module_content', array( __CLASS__, 'render_module_content_filter' ), 10, 2 );
50
+ add_filter( 'bwp_minify_is_loadable', array( __CLASS__, 'bwp_minify_is_loadable_filter' ) );
51
+ add_filter( 'fl_builder_editor_content', array( __CLASS__, 'activemember_shortcode_fix' ) );
52
+ add_filter( 'fl_builder_editor_content', array( __CLASS__, 'imember_shortcode_fix' ) );
53
+ add_filter( 'fl_builder_ajax_layout_response', array( __CLASS__, 'render_ninja_forms_js' ) );
54
+ add_filter( 'avf_enqueue_wp_mediaelement', array( __CLASS__, 'not_load_mediaelement' ), 10, 2 );
55
+ add_filter( 'phpcompat_whitelist', array( __CLASS__, 'bb_compat_fix' ) );
56
+ add_filter( 'fl_builder_editor_content', array( __CLASS__, 'theme_post_content_fix' ) );
57
+ add_filter( 'fl_builder_admin_settings_post_types', array( __CLASS__, 'admin_settings_post_types_popup' ) );
58
+ add_filter( 'woocommerce_product_get_short_description', array( __CLASS__, 'fix_woo_short_description' ) );
59
+ add_filter( 'enlighter_startup', array( __CLASS__, 'enlighter_frontend_editing' ) );
60
+ add_filter( 'option_sumome_site_id', array( __CLASS__, 'fix_sumo' ) );
61
+ add_filter( 'fl_builder_admin_edit_sort_blocklist', array( __CLASS__, 'admin_edit_sort_blocklist_edd' ) );
62
+ add_filter( 'option_cookiebot-nooutput', array( __CLASS__, 'fix_cookiebot' ) );
63
+ add_filter( 'fl_select2_enabled', array( __CLASS__, 'fix_memberium' ) );
64
+ }
65
+
66
+ public static function fix_memberium( $enabled ) {
67
+ if ( defined( 'MEMBERIUM_VERSION' ) ) {
68
+ return false;
69
+ }
70
+
71
+ return $enabled;
72
+ }
73
+
74
+ public static function clear_theme_cache( $enabled ) {
75
+ if ( class_exists( 'FLCustomizer' ) ) {
76
+ if ( $enabled ) {
77
+ add_filter( 'fl_enable_fa5_pro', '__return_true' );
78
+ }
79
+ FLCustomizer::refresh_css();
80
+ if ( $enabled ) {
81
+ remove_filter( 'fl_enable_fa5_pro', '__return_true' );
82
+ }
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Theme and themer rely on this filter.
88
+ */
89
+ public static function pro_icons_enable() {
90
+ if ( get_option( '_fl_builder_enable_fa_pro', false ) && ! is_admin() ) {
91
+ add_filter( 'fl_enable_fa5_pro', '__return_true' );
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Fix cookiebot plugin
97
+ * @since 2.2.6
98
+ */
99
+ public static function fix_cookiebot( $arg ) {
100
+ if ( isset( $_GET['fl_builder'] ) ) {
101
+ return true;
102
+ }
103
+ return $arg;
104
+ }
105
+
106
+ /**
107
+ * Add data-no-lazy to photo modules in themer header area.
108
+ * Fixes wp-rocket lazy load issue with shrink header.
109
+ * @since 2.2.3
110
+ */
111
+ public static function fix_lazyload_header_start() {
112
+ add_filter( 'fl_builder_photo_attributes', array( __CLASS__, 'fix_lazyload_header_attributes' ) );
113
+ }
114
+ public static function fix_lazyload_header_end() {
115
+ remove_filter( 'fl_builder_photo_attributes', array( __CLASS__, 'fix_lazyload_header_attributes' ) );
116
+ }
117
+ public static function fix_lazyload_header_attributes( $attrs ) {
118
+ return $attrs . ' data-no-lazy="1"';
119
+ }
120
+
121
+ /**
122
+ * Font Awesome KIT support
123
+ * @since 2.3
124
+ */
125
+ public static function fa_kit_support() {
126
+ if ( FLBuilder::fa5_pro_enabled() && '' !== get_option( '_fl_builder_kit_fa_pro' ) ) {
127
+ wp_dequeue_style( 'font-awesome' );
128
+ wp_dequeue_style( 'font-awesome-5' );
129
+ wp_deregister_style( 'font-awesome' );
130
+ wp_deregister_style( 'font-awesome-5' );
131
+ wp_enqueue_script( 'fa5-kit', get_option( '_fl_builder_kit_fa_pro' ) );
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Remove BB Template types from Gute Editor suggested urls
137
+ * @since 2.2.5
138
+ */
139
+ public static function gute_links_fix( $query ) {
140
+ if ( defined( 'REST_REQUEST' ) && $query->is_search() ) {
141
+ $types = (array) $query->get( 'post_type' );
142
+ $key = array_search( 'fl-builder-template', $types, true );
143
+ if ( $key ) {
144
+ unset( $types[ $key ] );
145
+ $query->set( 'post_type', $types );
146
+ }
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Remove sorting from download type if EDD is active.
152
+ * @since 2.2.5
153
+ */
154
+
155
+ public static function admin_edit_sort_blocklist_edd( $blocklist ) {
156
+ $types = FLBuilderModel::get_post_types();
157
+ if ( in_array( 'download', $types ) && class_exists( 'Easy_Digital_Downloads' ) ) {
158
+ $blocklist[] = 'download';
159
+ }
160
+ return $blocklist;
161
+ }
162
+
163
+ /**
164
+ * Fixes for Google Reviews Business Plugin shortcode
165
+ * @since 2.2.4
166
+ */
167
+ public static function fix_google_reviews_business_shortcode() {
168
+ if ( isset( $_GET['fl_builder'] ) ) {
169
+ remove_shortcode( 'google-reviews-pro' );
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Fixes for Google Reviews Business Plugin widget
175
+ * @since 2.2.4
176
+ */
177
+ public static function fix_google_reviews_business_widget() {
178
+ if ( isset( $_GET['fl_builder'] ) ) {
179
+ unregister_widget( 'Goog_Reviews_Pro' );
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Fix post type switcher
185
+ * @since 2.2.4
186
+ */
187
+ public static function fix_posttypeswitcher() {
188
+ global $pagenow;
189
+ $disable = false;
190
+ if ( 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && 'fl-theme-layout' === $_GET['post_type'] ) {
191
+ $disable = true;
192
+ }
193
+ if ( 'post.php' === $pagenow && isset( $_GET['post'] ) && ( 'fl-theme-layout' === get_post_type( $_GET['post'] ) || 'fl-builder-template' === get_post_type( $_GET['post'] ) ) ) {
194
+ $disable = true;
195
+ }
196
+ if ( $disable ) {
197
+ add_filter( 'pts_allowed_pages', '__return_empty_array' );
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Fix pipedrive chat popup
203
+ * @since 2.2.4
204
+ */
205
+ public static function fix_pipedrive() {
206
+ if ( isset( $_GET['fl_builder'] ) ) {
207
+ remove_action( 'wp_head', 'pipedrive_add_embed_code' );
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Fix JS error caused by UM-Switcher plugin
213
+ * @since 2.2.3
214
+ */
215
+ public static function fix_um_switcher() {
216
+ if ( isset( $_GET['fl_builder'] ) ) {
217
+ remove_action( 'wp_footer', 'umswitcher_profile_subscription_expiration_footer' );
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Fix icon issues with Frontend Dashboard version 1.3.4+
223
+ * @since 2.2.3
224
+ */
225
+ public static function fix_frontend_dashboard_plugin() {
226
+ if ( FLBuilderModel::is_builder_active() ) {
227
+ remove_action( 'wp_enqueue_scripts', 'fed_script_front_end', 99 );
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Remove Sumo JS when builder is open.
233
+ * @since 2.2.1
234
+ */
235
+ public static function fix_sumo( $option ) {
236
+ if ( isset( $_GET['fl_builder'] ) ) {
237
+ return false;
238
+ }
239
+ return $option;
240
+ }
241
+
242
+ /**
243
+ * Enlighter stops builder from loading.
244
+ * @since 2.2
245
+ */
246
+ public static function enlighter_frontend_editing( $enabled ) {
247
+ if ( isset( $_GET['fl_builder'] ) ) {
248
+ return false;
249
+ }
250
+ return $enabled;
251
+ }
252
+
253
+ /**
254
+ * Fix fatal error on adding Themer layouts and Templates with seopress.
255
+ * @since 2.1.8
256
+ */
257
+ public static function fix_seopress() {
258
+ if ( isset( $_POST['fl-template'] ) ) {
259
+ remove_action( 'save_post', 'seopress_bulk_quick_edit_save_post' );
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Footer action for fl_fix_woo_short_description to print foundf css.
265
+ * @since 2.1.7
266
+ */
267
+ public static function fix_woo_short_description_footer() {
268
+ global $fl_woo_description_fix;
269
+ if ( is_array( $fl_woo_description_fix ) && ! empty( $fl_woo_description_fix ) ) {
270
+ echo implode( "\n", $fl_woo_description_fix );
271
+ }
272
+ }
273
+
274
+ /**
275
+ * If short description is blank and there is a layout in the product content
276
+ * css will not be enqueued because woocommerce adds the css to the json+ld
277
+ * @since 2.1.7
278
+ */
279
+ public static function fix_woo_short_description( $content ) {
280
+
281
+ global $post, $fl_woo_description_fix;
282
+
283
+ // if there is a short description no need to carry on.
284
+ if ( '' !== $content ) {
285
+ return $content;
286
+ }
287
+
288
+ // if the product content contains a layout shortcode then extract any css to add to footer later.
289
+ if ( isset( $post->post_content ) && false !== strpos( $post->post_content, '[fl_builder_insert_layout' ) ) {
290
+ $dummy = do_shortcode( $post->post_content );
291
+ $scripts = preg_match_all( "#<link rel='stylesheet'.*#", $dummy, $out );
292
+ if ( is_array( $out ) ) {
293
+ if ( ! is_array( $fl_woo_description_fix ) ) {
294
+ $fl_woo_description_fix = array();
295
+ }
296
+ foreach ( $out[0] as $script ) {
297
+ $fl_woo_description_fix[] = $script;
298
+ }
299
+ }
300
+ // now we will use the content as the short description.
301
+ $content = strip_shortcodes( wp_strip_all_tags( $post->post_content ) );
302
+ }
303
+ return $content;
304
+ }
305
+
306
+ /**
307
+ * Remove Popup-Maker post-type from admin settings post-types.
308
+ * @since 2.1.7
309
+ */
310
+ public static function admin_settings_post_types_popup( $types ) {
311
+ if ( class_exists( 'Popup_Maker' ) && isset( $types['popup'] ) ) {
312
+ unset( $types['popup'] );
313
+ }
314
+ return $types;
315
+ }
316
+
317
+ /**
318
+ * Remove wpbb post:content from post_content as it causes inception.
319
+ * @since 2.1.7
320
+ */
321
+ public static function theme_post_content_fix( $content ) {
322
+ return preg_replace( '#\[wpbb\s?post:content.*\]#', '', $content );
323
+ }
324
+
325
+ /**
326
+ * Whitelist files in bb-theme and bb-theme-builder in PHPCompatibility Checker plugin.
327
+ * @since 2.1.6
328
+ */
329
+ public static function bb_compat_fix( $folders ) {
330
+ // Theme
331
+ $folders[] = '*/bb-theme/includes/vendor/Less/*';
332
+ // Themer
333
+ $folders[] = '*/bb-theme-builder/includes/post-grid-default-html.php';
334
+ $folders[] = '*/bb-theme-builder/includes/post-grid-default-css.php';
335
+ // bb-plugin
336
+ $folders[] = '*/bb-plugin/includes/ui-field*.php';
337
+ $folders[] = '*/bb-plugin/includes/ui-settings-form*.php';
338
+ // lite
339
+ $folders[] = '*/beaver-builder-lite-version/includes/ui-field*.php';
340
+ $folders[] = '*/beaver-builder-lite-version/includes/ui-settings-form*.php';
341
+ return $folders;
342
+ }
343
+
344
+ /**
345
+ * Fix issue with WPMUDEV Smush It.
346
+ * @since 2.1.6
347
+ */
348
+ public static function fix_smush_it() {
349
+ if ( FLBuilderModel::is_builder_active() ) {
350
+ add_filter( 'wp_smush_enqueue', '__return_false' );
351
+ }
352
+ }
353
+
354
+ /**
355
+ * Fix issue with Prevent Direct Access Gold.
356
+ * @since 2.1.6
357
+ */
358
+ public static function fix_protector_gold() {
359
+ if ( FLBuilderModel::is_builder_active() && class_exists( 'Prevent_Direct_Access_Gold' ) && ! function_exists( 'get_current_screen' ) ) {
360
+ function get_current_screen() {
361
+ $args = new StdClass;
362
+ $args->id = 'Beaver';
363
+ $args->action = 'Builder';
364
+ return $args;
365
+ }
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Fix issue with Templator plugin.
371
+ * @since 2.1.6
372
+ */
373
+ public static function fix_templator() {
374
+ if ( FLBuilderModel::is_builder_active() && class_exists( 'Templator_Import' ) ) {
375
+ remove_action( 'media_buttons', array( Templator_Import::get_instance(), 'import_template_button' ) );
376
+ }
377
+ }
378
+
379
+ /**
380
+ * Fix for Enfold theme always loading wp-mediaelement
381
+ * @since 2.1.5
382
+ */
383
+ public static function not_load_mediaelement( $condition, $options ) {
384
+ if ( FLBuilderModel::is_builder_active() ) {
385
+ $condition = true;
386
+ }
387
+ return $condition;
388
+ }
389
+
390
+ /**
391
+ * Fix Event Calendar widget not loading assets when added as a widget module.
392
+ * @since 2.1.5
393
+ */
394
+ public static function tribe_events_pro_widget_render_fix( $class, $args, $instance ) {
395
+ if ( isset( $args['widget_id'] ) && false !== strpos( $args['widget_id'], 'fl_builder_widget' ) ) {
396
+ if ( class_exists( 'Tribe__Events__Pro__Mini_Calendar' ) ) {
397
+ if ( method_exists( Tribe__Events__Pro__Mini_Calendar::instance(), 'register_assets' ) ) {
398
+ Tribe__Events__Pro__Mini_Calendar::instance()->register_assets();
399
+ } else {
400
+ if ( class_exists( 'Tribe__Events__Pro__Widgets' ) && method_exists( 'Tribe__Events__Pro__Widgets', 'enqueue_calendar_widget_styles' ) ) {
401
+ Tribe__Events__Pro__Widgets::enqueue_calendar_widget_styles();
402
+ }
403
+ }
404
+ }
405
+ }
406
+ }
407
+
408
+ /**
409
+ * Fix Enjoy Instagram feed on website with WordPress Widget and Shortcode issues with the builder.
410
+ * @since 2.0.6
411
+ */
412
+ public static function fix_enjoy_instagram() {
413
+ if ( FLBuilderModel::is_builder_active() ) {
414
+ remove_action( 'wp_head', 'funzioni_in_head' );
415
+ }
416
+ }
417
+
418
+ /**
419
+ * Turn off Hummingbird minification
420
+ * @since 2.1
421
+ */
422
+ public static function fix_hummingbird() {
423
+ if ( FLBuilderModel::is_builder_active() ) {
424
+ add_filter( 'wp_hummingbird_is_active_module_minify', '__return_false', 500 );
425
+ }
426
+ }
427
+
428
+ /**
429
+ * Support for tinyPNG.
430
+ *
431
+ * Runs cropped photos stored in cache through tinyPNG.
432
+ */
433
+ public static function tinypng_support( $cropped_path, $editor ) {
434
+
435
+ if ( class_exists( 'Tiny_Settings' ) ) {
436
+ try {
437
+ $settings = new Tiny_Settings();
438
+ $settings->xmlrpc_init();
439
+ $compressor = $settings->get_compressor();
440
+ if ( $compressor ) {
441
+ $compressor->compress_file( $cropped_path['path'], false, false );
442
+ }
443
+ } catch ( Exception $e ) {
444
+ //
445
+ }
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Support for WooCommerce Memberships.
451
+ *
452
+ * Makes sure builder content isn't rendered for protected posts.
453
+ */
454
+ public static function wc_memberships_support() {
455
+
456
+ if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
457
+ add_filter( 'fl_builder_do_render_content', function( $do_render, $post_id ) {
458
+ if ( wc_memberships_is_post_content_restricted() ) {
459
+ // check if user has access to restricted content
460
+ if ( ! current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
461
+ $do_render = false;
462
+ } elseif ( ! current_user_can( 'wc_memberships_view_delayed_post_content', $post_id ) ) {
463
+ $do_render = false;
464
+ }
465
+ }
466
+ return $do_render;
467
+ }, 10, 2 );
468
+ }
469
+ }
470
+
471
+ /**
472
+ * If FORCE_SSL_ADMIN is enabled but the frontend is not SSL fixes a CORS error when trying to upload a photo.
473
+ * `add_filter( 'fl_admin_ssl_upload_fix', '__return_false' );` will disable.
474
+ *
475
+ * @since 1.10.2
476
+ */
477
+ public static function admin_ssl_upload_fix() {
478
+ if ( defined( 'FORCE_SSL_ADMIN' ) && ! is_ssl() && is_admin() && FLBuilderAJAX::doing_ajax() ) {
479
+ /**
480
+ * Disable CORS upload fix when FORCE_SSL_ADMIN is enabled.
481
+ * @see fl_admin_ssl_upload_fix
482
+ */
483
+ if ( isset( $_POST['action'] ) && 'upload-attachment' === $_POST['action'] && true === apply_filters( 'fl_admin_ssl_upload_fix', true ) ) {
484
+ force_ssl_admin( false );
485
+ }
486
+ }
487
+ }
488
+
489
+ /**
490
+ * Disable support Buddypress pages since it's causing conflicts with `the_content` filter
491
+ *
492
+ * @param bool $is_editable Wether the post is editable or not
493
+ * @param $post The post to check from
494
+ * @return bool
495
+ */
496
+ public static function bp_pages_support( $is_editable, $post = false ) {
497
+ // Frontend check
498
+ if ( ! is_admin() && class_exists( 'BuddyPress' ) && ! bp_is_blog_page() ) {
499
+ $is_editable = false;
500
+ }
501
+ // Admin rows action link check and applies to page list
502
+ if ( is_admin() && class_exists( 'BuddyPress' ) && $post && 'page' == $post->post_type ) {
503
+ $bp = buddypress();
504
+ if ( $bp->pages ) {
505
+ foreach ( $bp->pages as $page ) {
506
+ if ( $post->ID == $page->id ) {
507
+ $is_editable = false;
508
+ break;
509
+ }
510
+ }
511
+ }
512
+ }
513
+ return $is_editable;
514
+ }
515
+
516
+ /**
517
+ * There is an issue with Jetpack Photon and circle cropped photo module
518
+ * returning the wrong image sizes from the bb cache folder.
519
+ * This filter disables photon for circle cropped photo module images.
520
+ */
521
+ public static function photo_photon_exception( $val, $src, $tag ) {
522
+
523
+ // Make sure its a bb cached image.
524
+ if ( false !== strpos( $src, 'bb-plugin/cache' ) ) {
525
+
526
+ // now make sure its a circle cropped image.
527
+ if ( false !== strpos( basename( $src ), '-circle' ) ) {
528
+ /**
529
+ * Disable photon circle imgae fix default ( true )
530
+ * @see fl_photo_photon_exception
531
+ */
532
+ return apply_filters( 'fl_photo_photon_exception', true );
533
+ }
534
+ }
535
+ // return original val
536
+ return $val;
537
+ }
538
+
539
+ /**
540
+ * Filter rendered module content and if safemode is active safely display a message.
541
+ * @since 1.10.7
542
+ */
543
+ public static function render_module_content_filter( $contents, $module ) {
544
+ if ( isset( $_GET['safemode'] ) && FLBuilderModel::is_builder_active() ) {
545
+ return sprintf( '<h3>[%1$s] %2$s %3$s</h3>', __( 'SAFEMODE', 'fl-builder' ), $module->name, __( 'module', 'fl-builder' ) );
546
+ } else {
547
+ return $contents;
548
+ }
549
+ }
550
+
551
+ /**
552
+ * Duplicate posts plugin fixes when cloning BB template.
553
+ *
554
+ * @since 1.10.8
555
+ * @param int $meta_id The newly added meta ID
556
+ * @param int $object_id ID of the object metadata is for.
557
+ * @param string $meta_key Metadata key
558
+ * @param string $meta_value Metadata value
559
+ * @return void
560
+ */
561
+ public static function template_meta_add( $meta_id, $object_id, $meta_key, $meta_value ) {
562
+ global $pagenow;
563
+
564
+ if ( 'admin.php' != $pagenow ) {
565
+ return;
566
+ }
567
+
568
+ if ( ! isset( $_REQUEST['action'] ) || 'duplicate_post_save_as_new_post' != $_REQUEST['action'] ) {
569
+ return;
570
+ }
571
+
572
+ $post_type = get_post_type( $object_id );
573
+ if ( 'fl-builder-template' != $post_type || '_fl_builder_template_id' != $meta_key ) {
574
+ return;
575
+ }
576
+
577
+ // Generate new template ID;
578
+ $template_id = FLBuilderModel::generate_node_id();
579
+ update_post_meta( $object_id, '_fl_builder_template_id', $template_id );
580
+ }
581
+
582
+ /**
583
+ * Stop bw-minify from optimizing when builder is open.
584
+ * @since 1.10.9
585
+ */
586
+ public static function bwp_minify_is_loadable_filter( $args ) {
587
+ if ( FLBuilderModel::is_builder_active() ) {
588
+ return false;
589
+ }
590
+ return $args;
591
+ }
592
+
593
+ /**
594
+ * Fixes an issue on search archives if one of the results contains same shortcode
595
+ * as is currently trying to render.
596
+ *
597
+ * @since 1.10.9
598
+ * @param bool $render Render shortcode.
599
+ * @param array $attrs Shortcode attributes.
600
+ * @param array $args Passed to FLBuilder::render_query
601
+ * @return bool
602
+ */
603
+ public static function insert_layout_render_search( $render, $attrs, $args ) {
604
+ global $post, $wp_query;
605
+ if ( is_search() && is_object( $post ) && is_array( $wp_query->posts ) ) {
606
+ foreach ( $wp_query->posts as $queried_post ) {
607
+ if ( $post->ID === $queried_post->ID ) {
608
+ preg_match( '#(?<=fl_builder_insert_layout).*[id|slug]=[\'"]?([0-9a-z-]+)#', $post->post_content, $matches );
609
+ if ( isset( $matches[1] ) ) {
610
+ return false;
611
+ }
612
+ }
613
+ }
614
+ }
615
+ return $render;
616
+ }
617
+
618
+ /**
619
+ * Fixes ajax issues with Event Espresso plugin when builder is open.
620
+ * @since 2.1
621
+ */
622
+ public static function ee_suppress_notices() {
623
+ if ( FLBuilderModel::is_builder_active() ) {
624
+ add_filter( 'FHEE__EE_Front_Controller__display_errors', '__return_false' );
625
+ }
626
+ }
627
+
628
+ /**
629
+ * Stops ee from outputting HTML into our ajax responses.
630
+ * @since 2.1
631
+ */
632
+ public static function ee_before_ajax() {
633
+ add_filter( 'FHEE__EE_Front_Controller__display_errors', '__return_false' );
634
+ }
635
+
636
+ /**
637
+ * Stops ee from loading espresso_default.css stylesheet in the builder to prevent hiding of buttons/tabs in TinyMCE
638
+ * @since 2.3
639
+ */
640
+ public static function ee_remove_stylesheet() {
641
+ if ( class_exists( 'FLBuilderModel' ) && ( FLBuilderModel::is_builder_active() ) ) {
642
+ wp_deregister_style( 'espresso_default' );
643
+ }
644
+ }
645
+
646
+ /**
647
+ * Plugin Enjoy Instagram loads its js and css on all frontend pages breaking the builder.
648
+ * @since 2.0.1
649
+ */
650
+ public static function aggiungi_script_instafeed_owl() {
651
+ if ( FLBuilderModel::is_builder_active() ) {
652
+ remove_action( 'wp_enqueue_scripts', 'aggiungi_script_instafeed_owl' );
653
+ }
654
+ }
655
+
656
+ /**
657
+ * Remove Activemember360 shortcodes from saved post content to stop them rendering twice.
658
+ * @since 2.0.6
659
+ */
660
+ public static function activemember_shortcode_fix( $content ) {
661
+ return preg_replace( '#\[mbr.*?\]#', '', $content );
662
+ }
663
+
664
+ /**
665
+ * Remove iMember360 shortcodes from saved post content to stop them rendering twice.
666
+ * @since 2.0.6
667
+ */
668
+ public static function imember_shortcode_fix( $content ) {
669
+ return preg_replace( '#\[i4w.*?\]#', '', $content );
670
+ }
671
+
672
+ /**
673
+ * Fix javascript issue caused by nextgen gallery when adding modules in the builder.
674
+ * @since 2.0.6
675
+ */
676
+ public static function fix_nextgen_gallery() {
677
+ if ( isset( $_GET['fl_builder'] ) || isset( $_POST['fl_builder_data'] ) || FLBuilderAJAX::doing_ajax() ) {
678
+ if ( ! defined( 'NGG_DISABLE_RESOURCE_MANAGER' ) ) {
679
+ define( 'NGG_DISABLE_RESOURCE_MANAGER', true );
680
+ }
681
+ }
682
+ }
683
+
684
+ /**
685
+ * Fix Tasty Recipes compatibility issues with the builder.
686
+ * @since 2.0.6
687
+ */
688
+ public static function fix_tasty_recipes() {
689
+ if ( FLBuilderModel::is_builder_active() ) {
690
+ remove_action( 'wp_enqueue_editor', array( 'Tasty_Recipes\Assets', 'action_wp_enqueue_editor' ) );
691
+ remove_action( 'media_buttons', array( 'Tasty_Recipes\Editor', 'action_media_buttons' ) );
692
+ }
693
+ }
694
+
695
+ /**
696
+ * Dequeue GeneratePress fa5 js when builder is open.
697
+ * @since 2.1
698
+ */
699
+ public static function fix_generatepress_fa5() {
700
+ if ( FLBuilderModel::is_builder_active() ) {
701
+ add_filter( 'generate_fontawesome_essentials', '__return_true' );
702
+ }
703
+ }
704
+
705
+ /**
706
+ * Try to render Ninja Forms JS templates when rendering an AJAX layout
707
+ * in case the layout includes one of their shortcodes. This won't do
708
+ * anything if no templates need to be rendered.
709
+ * @since 2.1
710
+ */
711
+ public static function render_ninja_forms_js( $response ) {
712
+ if ( class_exists( 'NF_Display_Render' ) ) {
713
+ ob_start();
714
+ NF_Display_Render::output_templates();
715
+ $response['html'] .= ob_get_clean();
716
+ }
717
+ return $response;
718
+ }
719
+ }
720
+ FLBuilderCompatibility::init();
classes/class-fl-builder-css.php CHANGED
@@ -223,7 +223,7 @@ final class FLBuilderCSS {
223
  if ( isset( $setting['style'] ) && ! empty( $setting['style'] ) ) {
224
  $props['border-style'] = $setting['style'];
225
  $props['border-width'] = '0'; // Default to zero.
226
- $props['background-clip'] = 'padding-box';
227
  }
228
  if ( isset( $setting['color'] ) && ! empty( $setting['color'] ) ) {
229
  $props['border-color'] = $setting['color'];
@@ -243,16 +243,16 @@ final class FLBuilderCSS {
243
  }
244
  }
245
  if ( isset( $setting['radius'] ) && is_array( $setting['radius'] ) ) {
246
- if ( '' !== $setting['radius']['top_left'] ) {
247
  $props['border-top-left-radius'] = $setting['radius']['top_left'] . 'px';
248
  }
249
  if ( '' !== $setting['radius']['top_right'] ) {
250
  $props['border-top-right-radius'] = $setting['radius']['top_right'] . 'px';
251
  }
252
- if ( '' !== $setting['radius']['bottom_left'] ) {
253
  $props['border-bottom-left-radius'] = $setting['radius']['bottom_left'] . 'px';
254
  }
255
- if ( '' !== $setting['radius']['bottom_right'] ) {
256
  $props['border-bottom-right-radius'] = $setting['radius']['bottom_right'] . 'px';
257
  }
258
  }
@@ -353,9 +353,13 @@ final class FLBuilderCSS {
353
  $rendered[ $media ] = array();
354
  }
355
 
 
 
 
 
356
  $rules = apply_filters( 'fl_builder_pre_render_css_rules', self::$rules );
357
 
358
- foreach ( self::$rules as $args ) {
359
  $defaults = array(
360
  'media' => '',
361
  'selector' => '',
223
  if ( isset( $setting['style'] ) && ! empty( $setting['style'] ) ) {
224
  $props['border-style'] = $setting['style'];
225
  $props['border-width'] = '0'; // Default to zero.
226
+ $props['background-clip'] = 'border-box';
227
  }
228
  if ( isset( $setting['color'] ) && ! empty( $setting['color'] ) ) {
229
  $props['border-color'] = $setting['color'];
243
  }
244
  }
245
  if ( isset( $setting['radius'] ) && is_array( $setting['radius'] ) ) {
246
+ if ( isset( $setting['radius']['top_left'] ) && '' !== $setting['radius']['top_left'] ) {
247
  $props['border-top-left-radius'] = $setting['radius']['top_left'] . 'px';
248
  }
249
  if ( '' !== $setting['radius']['top_right'] ) {
250
  $props['border-top-right-radius'] = $setting['radius']['top_right'] . 'px';
251
  }
252
+ if ( isset( $setting['radius']['bottom_left'] ) && '' !== $setting['radius']['bottom_left'] ) {
253
  $props['border-bottom-left-radius'] = $setting['radius']['bottom_left'] . 'px';
254
  }
255
+ if ( isset( $setting['radius']['bottom_right'] ) && '' !== $setting['radius']['bottom_right'] ) {
256
  $props['border-bottom-right-radius'] = $setting['radius']['bottom_right'] . 'px';
257
  }
258
  }
353
  $rendered[ $media ] = array();
354
  }
355
 
356
+ /**
357
+ * Filter all responsive css rules before css is rendered
358
+ * @see fl_builder_pre_render_css_rules
359
+ */
360
  $rules = apply_filters( 'fl_builder_pre_render_css_rules', self::$rules );
361
 
362
+ foreach ( $rules as $args ) {
363
  $defaults = array(
364
  'media' => '',
365
  'selector' => '',
classes/class-fl-builder-debug.php CHANGED
@@ -201,6 +201,27 @@ final class FL_Debug {
201
  );
202
  self::register( 'active_theme', $args );
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  $args = array(
205
  'name' => 'Plugins',
206
  'data' => self::divider(),
@@ -432,6 +453,13 @@ final class FL_Debug {
432
  );
433
  self::register( 'bb_sub_domain', $args );
434
  }
 
 
 
 
 
 
 
435
  }
436
 
437
  $args = array(
201
  );
202
  self::register( 'active_theme', $args );
203
 
204
+ if ( 'bb-theme' === $theme->get( 'Template' ) ) {
205
+ if ( is_dir( trailingslashit( get_stylesheet_directory() ) . 'includes' ) ) {
206
+ $args = array(
207
+ 'name' => 'Child Theme includes folder detected.',
208
+ 'data' => trailingslashit( get_stylesheet_directory() ) . 'includes/',
209
+ );
210
+ self::register( 'child_includes', $args );
211
+ }
212
+
213
+ if ( is_dir( trailingslashit( get_stylesheet_directory() ) . 'fl-builder/modules' ) ) {
214
+ $modules = glob( trailingslashit( get_stylesheet_directory() ) . 'fl-builder/modules/*' );
215
+ if ( ! empty( $modules ) ) {
216
+ $args = array(
217
+ 'name' => 'Child Theme builder modules folder detected.',
218
+ 'data' => implode( '<br>', $modules ),
219
+ );
220
+ self::register( 'child_bb_modules', $args );
221
+ }
222
+ }
223
+ }
224
+
225
  $args = array(
226
  'name' => 'Plugins',
227
  'data' => self::divider(),
453
  );
454
  self::register( 'bb_sub_domain', $args );
455
  }
456
+ if ( isset( $subscription->downloads ) && is_array( $subscription->downloads ) && ! empty( $subscription->downloads ) ) {
457
+ $args = array(
458
+ 'name' => 'Available Downloads',
459
+ 'data' => implode( "\n", $subscription->downloads ),
460
+ );
461
+ self::register( 'av_downloads', $args );
462
+ }
463
  }
464
 
465
  $args = array(
classes/class-fl-builder-export.php CHANGED
@@ -87,6 +87,10 @@ final class FLBuilderExport {
87
  * @return void
88
  */
89
  static public function export( $args ) {
 
 
 
 
90
  $allowed_types = apply_filters( 'fl_builder_export_allowed_post_types', array(
91
  'fl-builder-template',
92
  'fl-theme-layout',
87
  * @return void
88
  */
89
  static public function export( $args ) {
90
+ /**
91
+ * Allowed types for export
92
+ * @see fl_builder_export_allowed_post_types
93
+ */
94
  $allowed_types = apply_filters( 'fl_builder_export_allowed_post_types', array(
95
  'fl-builder-template',
96
  'fl-theme-layout',
classes/class-fl-builder-filesystem.php CHANGED
@@ -9,6 +9,10 @@ class FL_Filesystem {
9
 
10
  public static function instance() {
11
  if ( is_null( self::$_instance ) ) {
 
 
 
 
12
  $filtered = apply_filters( 'fl_filesystem_instance', null );
13
  self::$_instance = $filtered instanceof FL_Filesystem ? $filtered : new self();
14
  }
@@ -133,6 +137,10 @@ class FL_Filesystem {
133
  if ( ! $wp_filesystem || 'direct' != $wp_filesystem->method ) {
134
  require_once ABSPATH . '/wp-admin/includes/file.php';
135
 
 
 
 
 
136
  $context = apply_filters( 'request_filesystem_credentials_context', false );
137
 
138
  add_filter( 'filesystem_method', array( $this, 'filesystem_method' ) );
9
 
10
  public static function instance() {
11
  if ( is_null( self::$_instance ) ) {
12
+ /**
13
+ * Make Filesystem Instance filterable.
14
+ * @see fl_filesystem_instance
15
+ */
16
  $filtered = apply_filters( 'fl_filesystem_instance', null );
17
  self::$_instance = $filtered instanceof FL_Filesystem ? $filtered : new self();
18
  }
137
  if ( ! $wp_filesystem || 'direct' != $wp_filesystem->method ) {
138
  require_once ABSPATH . '/wp-admin/includes/file.php';
139
 
140
+ /**
141
+ * Context for filesystem, default false.
142
+ * @see request_filesystem_credentials_context
143
+ */
144
  $context = apply_filters( 'request_filesystem_credentials_context', false );
145
 
146
  add_filter( 'filesystem_method', array( $this, 'filesystem_method' ) );
classes/class-fl-builder-fonts.php CHANGED
@@ -33,9 +33,18 @@ final class FLBuilderFonts {
33
  * @return void
34
  */
35
  static public function js() {
 
 
 
36
  $default = json_encode( apply_filters( 'fl_builder_font_families_default', FLBuilderFontFamilies::$default ) );
37
- $system = json_encode( apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system ) );
38
- $google = json_encode( apply_filters( 'fl_builder_font_families_google', self::prepare_google_fonts( FLBuilderFontFamilies::google() ) ) );
 
 
 
 
 
 
39
 
40
  echo 'var FLBuilderFontFamilies = { default: ' . $default . ', system: ' . $system . ', google: ' . $google . ' };';
41
  }
@@ -134,6 +143,10 @@ final class FLBuilderFonts {
134
  * Return font weight strings.
135
  */
136
  static public function get_font_weight_strings() {
 
 
 
 
137
  return apply_filters( 'fl_builder_font_weight_strings', array(
138
  'default' => __( 'Default', 'fl-builder' ),
139
  'regular' => __( 'Regular', 'fl-builder' ),
@@ -292,6 +305,10 @@ final class FLBuilderFonts {
292
  * @since 2.1.3
293
  */
294
  static public function enqueue_google_fonts() {
 
 
 
 
295
  $google_fonts_domain = apply_filters( 'fl_builder_google_fonts_domain', '//fonts.googleapis.com/' );
296
  $google_url = $google_fonts_domain . 'css?family=';
297
 
@@ -372,7 +389,10 @@ final class FLBuilderFonts {
372
  // Check for any enqueued `fonts.googleapis.com` from BB theme or plugin
373
  if ( isset( $wp_styles->queue ) ) {
374
 
375
- $google_fonts_domain = apply_filters( 'fl_builder_google_fonts_domain', '//fonts.googleapis.com/css' );
 
 
 
376
  $enqueued_google_fonts = array();
377
  $families = array();
378
  $subsets = array();
@@ -450,6 +470,10 @@ final class FLBuilderFonts {
450
  $font_args['subset'] = implode( ',', $subsets );
451
  }
452
 
 
 
 
 
453
  $font_args = apply_filters( 'fl_builder_google_font_args', $font_args );
454
 
455
  $src = add_query_arg( $font_args, $google_fonts_domain );
@@ -524,7 +548,9 @@ final class FLBuilderFontFamilies {
524
  /**
525
  * Cache for google fonts
526
  */
527
- static private $_google_json = array();
 
 
528
 
529
  /**
530
  * Array with a list of default font weights.
@@ -607,6 +633,10 @@ final class FLBuilderFontFamilies {
607
  */
608
  static function google() {
609
 
 
 
 
 
610
  $fonts = array();
611
  $json = self::_get_json();
612
 
@@ -615,16 +645,22 @@ final class FLBuilderFontFamilies {
615
  $name = key( $font );
616
 
617
  foreach ( $font[ $name ]['variants'] as $key => $variant ) {
618
- if ( stristr( $variant, 'italic' ) && 'italic' !== $variant ) {
619
- $font[ $name ]['variants'][ $key ] = str_replace( 'talic', '', $variant );
 
 
620
  }
621
  if ( 'regular' == $variant ) {
622
  $font[ $name ]['variants'][ $key ] = '400';
623
  }
624
  }
625
-
626
  $fonts[ $name ] = $font[ $name ]['variants'];
627
  }
 
 
 
 
 
628
  return $fonts;
629
  }
630
 
33
  * @return void
34
  */
35
  static public function js() {
36
+ /**
37
+ * @see fl_builder_font_families_default
38
+ */
39
  $default = json_encode( apply_filters( 'fl_builder_font_families_default', FLBuilderFontFamilies::$default ) );
40
+ /**
41
+ * @see fl_builder_font_families_system
42
+ */
43
+ $system = json_encode( apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system ) );
44
+ /**
45
+ * @see fl_builder_font_families_google
46
+ */
47
+ $google = json_encode( apply_filters( 'fl_builder_font_families_google', self::prepare_google_fonts( FLBuilderFontFamilies::google() ) ) );
48
 
49
  echo 'var FLBuilderFontFamilies = { default: ' . $default . ', system: ' . $system . ', google: ' . $google . ' };';
50
  }
143
  * Return font weight strings.
144
  */
145
  static public function get_font_weight_strings() {
146
+ /**
147
+ * Array of font weights
148
+ * @see fl_builder_font_weight_strings
149
+ */
150
  return apply_filters( 'fl_builder_font_weight_strings', array(
151
  'default' => __( 'Default', 'fl-builder' ),
152
  'regular' => __( 'Regular', 'fl-builder' ),
305
  * @since 2.1.3
306
  */
307
  static public function enqueue_google_fonts() {
308
+ /**
309
+ * Google fonts domain
310
+ * @see fl_builder_google_fonts_domain
311
+ */
312
  $google_fonts_domain = apply_filters( 'fl_builder_google_fonts_domain', '//fonts.googleapis.com/' );
313
  $google_url = $google_fonts_domain . 'css?family=';
314
 
389
  // Check for any enqueued `fonts.googleapis.com` from BB theme or plugin
390
  if ( isset( $wp_styles->queue ) ) {
391
 
392
+ /**
393
+ * @see fl_builder_combine_google_fonts_domain
394
+ */
395
+ $google_fonts_domain = apply_filters( 'fl_builder_combine_google_fonts_domain', '//fonts.googleapis.com/css' );
396
  $enqueued_google_fonts = array();
397
  $families = array();
398
  $subsets = array();
470
  $font_args['subset'] = implode( ',', $subsets );
471
  }
472
 
473
+ /**
474
+ * Array of extra args passed to google fonts.
475
+ * @see fl_builder_google_font_args
476
+ */
477
  $font_args = apply_filters( 'fl_builder_google_font_args', $font_args );
478
 
479
  $src = add_query_arg( $font_args, $google_fonts_domain );
548
  /**
549
  * Cache for google fonts
550
  */
551
+ static private $_google_json = array();
552
+ static private $_google_fonts = false;
553
+ static private $_google_run = 0;
554
 
555
  /**
556
  * Array with a list of default font weights.
633
  */
634
  static function google() {
635
 
636
+ if ( false !== self::$_google_fonts ) {
637
+ return self::$_google_fonts;
638
+ }
639
+
640
  $fonts = array();
641
  $json = self::_get_json();
642
 
645
  $name = key( $font );
646
 
647
  foreach ( $font[ $name ]['variants'] as $key => $variant ) {
648
+ if ( 'italic' !== $variant ) {
649
+ if ( stristr( $variant, 'italic' ) ) {
650
+ $font[ $name ]['variants'][ $key ] = str_replace( 'talic', '', $variant );
651
+ }
652
  }
653
  if ( 'regular' == $variant ) {
654
  $font[ $name ]['variants'][ $key ] = '400';
655
  }
656
  }
 
657
  $fonts[ $name ] = $font[ $name ]['variants'];
658
  }
659
+ // only cache after 1st run to save rams.
660
+ if ( self::$_google_run > 0 ) {
661
+ self::$_google_fonts = $fonts;
662
+ }
663
+ self::$_google_run++;
664
  return $fonts;
665
  }
666
 
classes/class-fl-builder-history-manager.php ADDED
@@ -0,0 +1,311 @@