WordPress Page Builder – Beaver Builder - Version 2.4.0.5

Version Description

Download this release

Release Info

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

Code changes from version 2.3.2.8 to 2.4.0.5

Files changed (42) hide show
  1. changelog.txt +147 -1
  2. classes/class-fl-builder-admin-posts.php +111 -0
  3. classes/class-fl-builder-admin-settings.php +35 -3
  4. classes/class-fl-builder-admin.php +11 -0
  5. classes/class-fl-builder-auto-suggest.php +7 -5
  6. classes/class-fl-builder-compatibility.php +110 -0
  7. classes/class-fl-builder-debug.php +21 -0
  8. classes/class-fl-builder-history-manager.php +12 -5
  9. classes/class-fl-builder-icons.php +58 -9
  10. classes/class-fl-builder-importer.php +46 -274
  11. classes/class-fl-builder-loader.php +2 -1
  12. classes/class-fl-builder-loop.php +43 -14
  13. classes/class-fl-builder-model.php +39 -10
  14. classes/class-fl-builder-notifications.php +1 -1
  15. classes/class-fl-builder-privacy.php +2 -2
  16. classes/class-fl-builder-service-activecampaign.php +1 -1
  17. classes/class-fl-builder-service-groundhogg.php +160 -0
  18. classes/class-fl-builder-service-mautic.php +1 -1
  19. classes/class-fl-builder-service-sendy.php +9 -3
  20. classes/class-fl-builder-services.php +6 -0
  21. classes/class-fl-builder-ui-content-panel.php +4 -0
  22. classes/class-fl-builder-ui-settings-forms.php +4 -4
  23. classes/class-fl-builder-usage.php +1 -1
  24. classes/class-fl-builder-utils.php +7 -0
  25. classes/class-fl-builder-wp-blocks.php +1 -1
  26. classes/class-fl-builder.php +83 -20
  27. css/build/builder.bundle.css +179 -63
  28. css/build/builder.bundle.min.css +1 -1
  29. css/build/fluid.bundle.css +320 -0
  30. css/build/fluid.bundle.min.css +1 -0
  31. css/build/wp-editor.bundle.css +2 -0
  32. css/fl-builder-layout.css +24 -5
  33. css/fl-builder.css +199 -64
  34. css/fl-builder.min.css +1 -1
  35. css/fl-icon-selector.css +6 -0
  36. css/fl-slideshow.min.css +1 -1
  37. css/jquery.magnificpopup.min.css +1 -1
  38. data/layout-00-Blank-lite.dat +1 -0
  39. data/layout-01-Home-lite.dat +1 -0
  40. data/layout-02-Landing-lite.dat +1 -0
  41. data/layout-03-Maintenance-lite.dat +1 -0
  42. data/layout-32-About-lite.dat +1 -0
changelog.txt CHANGED
@@ -1,4 +1,70 @@
1
- <h4>2.3.2.8 - 08/11/2020</h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <strong>Hot Fix</strong>
3
  <ul>
4
  <li>Added support for WP 5.5 auto updates system for plugins and themes.</li>
@@ -6,6 +72,86 @@
6
  <li>Fixed broken image cropping on Flywheel hosting.</li>
7
  </ul>
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  <h4>2.3.2.7 - 07/29/2020</h4>
10
  <strong>Hot Fix</strong>
11
  <ul>
1
+ <h4>2.4.0.5</h4> - 09/28/2020</h4>
2
+ <strong>Hot Fix</strong>
3
+ <ul>
4
+ <li>Button Module: Fix lightbox not working if ID specified in module settings</li>
5
+ <li>Callout Module: fix links not working on icons</li>
6
+ <li>Login Module: Make strings translateable</li>
7
+ <li>Photo Module & Callout Module: Fix cropping hanging with unreachable URLs</li>
8
+ <li>Photo Module: new filter <code>fl_builder_photo_noimage</code></li>
9
+ <li>Post Carousel Module: Fix equal height issue on some themes</li>
10
+ <li>Fix Content Panel button animation</li>
11
+ <li>Fix Themer field connection button not showing in TwentyTwenty theme</li>
12
+ <li>Fix layout shortcode CSS issue</li>
13
+ <li>Fix fatal error for KeyCDN Cache Enabler users</li>
14
+ <li>WooCommerce Product Filters Add-on - fix conflict</li>
15
+ <li>Add tiptip a dependency for admin JS</li>
16
+ </ul>
17
+
18
+ <h4>2.4.0.4 - 09/15/2020</h4>
19
+ <strong>Hot Fix</strong>
20
+ <ul>
21
+ <li>Fixed UI CSS issues</li>
22
+ </ul>
23
+
24
+ <h4>2.4.0.3 - 09/14/2020</h4>
25
+ <strong>Hot Fix</strong>
26
+ <ul>
27
+ <li>Added pagination compatibility with Yoast SEO when category prefix is removed</li>
28
+ <li>Fixed WordPress not redirecting Post URLs that do not exist when BB is active</li>
29
+ <li>Fixed button group text hover global style not working for focus</li>
30
+ <li>Fixed one.com detection on Settings page</li>
31
+ <li>Fixed limit being bypassed on repeater fields</li>
32
+ <li>Fixed undefined offset with <code>wp_print_styles</code></li>
33
+ <li>Fixed Responsive Preview due to a bug in Chrome. Bug detailed here: https://bugs.chromium.org/p/chromium/issues/detail?id=843887</li>
34
+ <li>Fixed JS error when using Vimeo video in a row background when audio is enabled</li>
35
+ <li>Fixed Callout Module Icon links not working</li>
36
+ <li>Fixed Posts Module buttons being broken when using jQuery 3.5.1</li>
37
+ <li>Fixed compatibility with WordPress versions below 5.2 and ClassicPress</li>
38
+ </ul>
39
+
40
+ <h4>2.4.0.2 - 08/24/2020</h4>
41
+ <strong>Hot Fix</strong>
42
+ <ul>
43
+ <li>Button Group Module: fix tabbing to button does not show text hover color</li>
44
+ <li>Fix undefined variable $premium relating to Templates</li>
45
+ <li>List Module: Fix string for Ordered List saying ul in tooltip for selecting an Icon </li>
46
+ <li>Fix styling failing to load when using Woocommerce, Yoast Seo and its Woo add-on, and fl_builder_insert_layout in products</li>
47
+ <li>Fix WP Foundation icons not showing after publish</li>
48
+ <li>List Module: add padding option to list items globally and individual list items</li>
49
+ <li>Fix "No plugin found" error on View Details modal on plugin page</li>
50
+ <li>Fix Slideshow module images not rendering alt text </li>
51
+ <li>Fix Post Carousel Lazy load issues with WordPress 5.5</li>
52
+ <li>Set responsive preview default to No in global settings to avoid affecting existing sites</li>
53
+ <li>Fix notice on BB Settings page when the jQuery Migrate Helper Plugin is active</li>
54
+ </ul>
55
+
56
+ <h4>2.4.0.1 - 08/12/2020</h4>
57
+ <strong>Hot Fix</strong>
58
+ <ul>
59
+ <li>Fixed Contact Form module: Labels still display even when set to "Show Placeholders only".</li>
60
+ <li>Fixed PHP warning when using layout shortcodes.</li>
61
+ <li>Fixed ACF issue where CSS was not being purged after updating ACF fields.</li>
62
+ <li>Fixed default settings not being used in Responsive Editing and Preview when Responsive settings in Previews is set to No.</li>
63
+ <li>Fixed lazy loading issues in post slider and contentslider modules.</li>
64
+ <li>Includes all fixes from 2.3.2.8</li>
65
+ </ul>
66
+
67
+ <h4>2.3.2.9 - 08/11/2020</h4>
68
  <strong>Hot Fix</strong>
69
  <ul>
70
  <li>Added support for WP 5.5 auto updates system for plugins and themes.</li>
72
  <li>Fixed broken image cropping on Flywheel hosting.</li>
73
  </ul>
74
 
75
+ <h4>2.4 "O'Shaughnessy" Aug 5 2020</h4>
76
+ Beaver Builder 2.4 is here! This is a major update and will be released as the official download on the My Account page first. Remote updates to all existing sites will begin soon!
77
+
78
+ <strong>Enhancements</strong>
79
+ <ul>
80
+ <li>NEW: List Module</li>
81
+ <li>NEW: Search Module</li>
82
+ <li>NEW: Login Module</li>
83
+ <li>NEW: Button Group Module</li>
84
+ <li>NEW: Integration with Assistant</li>
85
+ <li>BB Lite now has 3 additional modules: Button, Heading & Icon as well as a select few pre-made page Templates.</li>
86
+ <li>The same new templates that were added to Lite are available in all paid versions</li>
87
+ <li>WooCommerce Module - add ability to sort and include specific category IDs.</li>
88
+ <li>Video Module: Add new options to show video in a Lightbox, hide player settings, and sticky positioning and embed option now renders shortcodes</li>
89
+ <li>Row Backgrounds: Now you can use embed codes. Use html to embed videos from other sources or show sliders from other plugins using shortcodes</li>
90
+ <li>Subscribe Module: Added GroundHogg integration. GroundHogg WP Plugin required to use.</li>
91
+ <li>Added <code>main</code> as an option to row/column/module container element options.</li>
92
+ <li>Responsive Editing/Preview: In global settings, you can toggle to use your actual settings for responsive editing & preview instead of the default fixed with. The breakpoint width is also displayed during Responsive Editing/Preview</li>
93
+ <li>Add attachments to our link field search</li>
94
+ <li>When using layout shortcodes, move the css needed to the head instead of the body to avoid validation errors.</li>
95
+ <li>Update editor used for code editing</li>
96
+ <li>Font Awesome Pro subset support added! See https://blog.fontawesome.com/desktop-subsetter-beta/ for more info.</li>
97
+ <li>Keep lightbox open when Publish Shortcut Key is pressed.</li>
98
+ <li>Posts Module: Add option to change the Post Title tag.</li>
99
+ <li>History can now be completely disabled by setting FL_BUILDER_HISTORY_STATES to 0 or false.</li>
100
+ <li>LiteSpeed plugin added native support for Beaver Builder so litespeed removed from supported plugins in cache extension.</li>
101
+ <li>Add SpinupWP to cache clearing tool.</li>
102
+ <li>Alert on BB Settings page for <code>One.com</code> hosting users when htaccess blocks all JS in uploads folder.</li>
103
+ <li>Style hardening for UI tables, select 2 dropdowns, setting modal headings, and the media library modal.</li>
104
+ <li>Content Slider - if transition and delay are equal or if transition is higher than delay, prevent save.</li>
105
+ <li>Subscribe Module: Using terms and conditions check box now activates the Sendy GDPR flag for the contact</li>
106
+ <li>Add post classes to Post Slider and Post Carousel Modules so they are consistent with the Post Module</li>
107
+ <li>Countdown Module: Update to use a date picker and add field connection for Themer</li>
108
+ <li>New Filter: <code>fl_tabs_id_in_label</code> to allow Tab module IDs to be used as a prefix in the module output.</li>
109
+ <li>New filter: <code>fl_loop_paginate_links_args</code> to allow changing of the text in pagination.</li>
110
+ <li>New filter <code>fl_media_modal_types</code> to change the file types that show in the media library for photo and video modules</li>
111
+ <li>Accessibility: Add screen reader only text option to Icons</li>
112
+ <li>Accessibility: Add for labels to Subscribe Module</li>
113
+ <li>Accessibility: Allow choice of placeholders, labels or both for form elements and allow spacebar and enter to submit the form</li>
114
+ <li>Accessibility: Testimonials Module - flip controls so markup matches display</li>
115
+ <li>Accessibility: Menu Module - Fix accessibility issue with Flyout layout close button</li>
116
+ <li>Debug Mode - show phpinfo() if available, add content of child theme functions.php to debug output and allow editing of Layout CSS/JS and Global JS/CSS in WP Admin if debug is enabled</li>
117
+ </ul>
118
+
119
+ <strong>Bugs</strong>
120
+ <ul>
121
+ <li>Menu Module: Fix line height not working for link items</li>
122
+ <li>Fix deprecated notice in PHP 7.2 or higher with InfusionSoft Library</li>
123
+ <li>Fix a PHP Notice (offset undefined) when dropping a Posts Module on the page</li>
124
+ <li>Remove autoload from options that we can, like fl_notifications</li>
125
+ <li>Fix a fatal error in certain cases when a used module goes missing</li>
126
+ <li>Fixed lodash issue when using Events Calendar and Assistant plugins.</li>
127
+ <li>Fixe Importer issues: imported items not showing the layout CSS/JS and other minor fixes</li>
128
+ <li>Fixed Import/Export not working with custom modules with _ in slug.</li>
129
+ <li>Fixed MultiSite domain mapping causing responsive settings to go full screen.</li>
130
+ <li>Fixed Autoptimize aggregate CSS causing responsive settings to go full screen.</li>
131
+ <li>SlideShow Module: Fixed notice for alt tag displaying</li>
132
+ <li>Hide Block Editor Inserter when editing a BB-enabled post</li>
133
+ <li>Fixed JS error of Post Spacing left blank in post Carousel</li>
134
+ <li>Fixed incorrect history order on sites running the MyISAM database engine.</li>
135
+ <li>Make sure mediaelementplayer library is available before trying to access.</li>
136
+ <li>Fixed typo error which resulted to incorrect editing status message.</li>
137
+ <li>Links to CSS files were sometimes broken when loading via shortcode.</li>
138
+ <li>Fix for Parallax on Safari iPadOS. Parallax is now disabled to avoid unwanted zoom on parallax images.</li>
139
+ <li>Fix for Video background not sized properly on the TwentyTwenty theme.</li>
140
+ <li>Add Sanitation for row background slider speed and transition settings</li>
141
+ <li>Fix for conflict with Mailster plugin where post data did not show in WP Admin.</li>
142
+ <li>Fix z-index issue with Menu Module sub-menu and Content Slider Arrows</li>
143
+ <li>Fixed using Template in BB Categories causing Saved Templates item not to show in content panel</li>
144
+ <li>Fix column and row text color settings overriding module set text colors</li>
145
+ <li>Fix color picker order not being saved after publish</li>
146
+ <li>Fix conflict with Pop-up Builder plugin and Text Editor module</li>
147
+ <li>Fix Post Slider text background color not displaying</li>
148
+ <li>Fix typos/capitalization issues in some strings</li>
149
+ <li>Fix form fields not showing correct responsive editing device</li>
150
+ <li>Fix row background custom position fields not toggling properly</li>
151
+ <li>Fix callout module links not properly showing as nofollow when selected</li>
152
+ <li>Fix callout link text alignment</li>
153
+ </ul>
154
+
155
  <h4>2.3.2.7 - 07/29/2020</h4>
156
  <strong>Hot Fix</strong>
157
  <ul>
classes/class-fl-builder-admin-posts.php CHANGED
@@ -17,6 +17,11 @@ final class FLBuilderAdminPosts {
17
  /* Actions */
18
  add_action( 'current_screen', __CLASS__ . '::init_rendering' );
19
 
 
 
 
 
 
20
  /* Filters */
21
  add_filter( 'redirect_post_location', __CLASS__ . '::redirect_post_location' );
22
  add_filter( 'page_row_actions', __CLASS__ . '::render_row_actions_link' );
@@ -24,6 +29,112 @@ final class FLBuilderAdminPosts {
24
  add_action( 'pre_get_posts', __CLASS__ . '::sort_builder_enabled' );
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  /**
28
  * WordPress doesn't have a "right way" to get the current
29
  * post type being edited and the new editor doesn't make
17
  /* Actions */
18
  add_action( 'current_screen', __CLASS__ . '::init_rendering' );
19
 
20
+ if ( get_transient( 'fl_debug_mode' ) || ( defined( 'FL_ENABLE_META_CSS_EDIT' ) && FL_ENABLE_META_CSS_EDIT ) ) {
21
+ add_action( 'add_meta_boxes', array( __CLASS__, 'add_meta_box' ) );
22
+ add_action( 'save_post', array( __CLASS__, 'save_meta' ) );
23
+ }
24
+
25
  /* Filters */
26
  add_filter( 'redirect_post_location', __CLASS__ . '::redirect_post_location' );
27
  add_filter( 'page_row_actions', __CLASS__ . '::render_row_actions_link' );
29
  add_action( 'pre_get_posts', __CLASS__ . '::sort_builder_enabled' );
30
  }
31
 
32
+ /**
33
+ * @since 2.4
34
+ */
35
+ public static function add_meta_box( $post_type ) {
36
+ // Limit meta box to certain post types.
37
+ $post_types = array( 'post', 'page' );
38
+
39
+ if ( in_array( $post_type, FLBuilderModel::get_post_types() ) ) {
40
+ add_meta_box(
41
+ 'fl_css_js',
42
+ __( 'Builder CSS/JS', 'fl-builder' ),
43
+ array( __CLASS__, 'render_meta_box_content' ),
44
+ $post_type,
45
+ 'advanced',
46
+ 'high'
47
+ );
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @since 2.4
53
+ * @param WP_Post $post The post object.
54
+ */
55
+ public static function render_meta_box_content( $post ) {
56
+
57
+ // Add an nonce field so we can check for it later.
58
+ wp_nonce_field( 'fl_css_js', 'fl_css_js_nonce' );
59
+
60
+ // Use get_post_meta to retrieve an existing value from the database.
61
+ $data = get_post_meta( $post->ID, '_fl_builder_data_settings', true );
62
+
63
+ if ( ! isset( $data->css ) ) {
64
+ $css = '';
65
+ } else {
66
+ $css = $data->css;
67
+ }
68
+ if ( ! isset( $data->js ) ) {
69
+ $js = '';
70
+ } else {
71
+ $js = $data->js;
72
+ }
73
+ ?>
74
+ <label for="fl_css">
75
+ <?php _e( 'CSS', 'fl-builder' ); ?>
76
+ </label><br />
77
+ <textarea style="width:100%" rows=10 id="fl_css" name="fl_css" value="<?php echo esc_attr( $css ); ?>"><?php echo esc_attr( $css ); ?></textarea><br />
78
+
79
+ <label for="fl_js">
80
+ <?php _e( 'JS', 'fl-builder' ); ?>
81
+ </label><br />
82
+ <textarea style="width:100%" rows=10 id="fl_js" name="fl_js" value="<?php echo esc_attr( $js ); ?>"><?php echo esc_attr( $js ); ?></textarea>
83
+ <?php
84
+ }
85
+
86
+ /**
87
+ * Save the meta when the post is saved.
88
+ *
89
+ * @param int $post_id The ID of the post being saved.
90
+ */
91
+ public static function save_meta( $post_id ) {
92
+
93
+ // Check if our nonce is set.
94
+ if ( ! isset( $_POST['fl_css_js_nonce'] ) ) {
95
+ return $post_id;
96
+ }
97
+
98
+ $nonce = $_POST['fl_css_js_nonce'];
99
+
100
+ // Verify that the nonce is valid.
101
+ if ( ! wp_verify_nonce( $nonce, 'fl_css_js' ) ) {
102
+ return $post_id;
103
+ }
104
+
105
+ /*
106
+ * If this is an autosave, our form has not been submitted,
107
+ * so we don't want to do anything.
108
+ */
109
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
110
+ return $post_id;
111
+ }
112
+
113
+ // Check the user's permissions.
114
+ if ( 'page' == $_POST['post_type'] ) {
115
+ if ( ! current_user_can( 'edit_page', $post_id ) ) {
116
+ return $post_id;
117
+ }
118
+ } else {
119
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
120
+ return $post_id;
121
+ }
122
+ }
123
+
124
+ $data = get_post_meta( $post_id, '_fl_builder_data_settings', true );
125
+
126
+ if ( ! is_object( $data ) ) {
127
+ $data = new StdClass;
128
+ }
129
+ $data->css = $_POST['fl_css'];
130
+ $data->js = $_POST['fl_js'];
131
+
132
+ // Update the meta field.
133
+ update_post_meta( $post_id, '_fl_builder_data_settings', $data );
134
+ update_post_meta( $post_id, '_fl_builder_draft_settings', $data );
135
+
136
+ }
137
+
138
  /**
139
  * WordPress doesn't have a "right way" to get the current
140
  * post type being edited and the new editor doesn't make
classes/class-fl-builder-admin-settings.php CHANGED
@@ -101,7 +101,7 @@ final class FLBuilderAdminSettings {
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 );
106
  wp_enqueue_script( 'jquery-multiselect', FL_BUILDER_URL . 'js/jquery.multiselect.js', array( 'jquery' ), FL_BUILDER_VERSION );
107
  wp_enqueue_script( 'jquery-tiptip', FL_BUILDER_URL . 'js/jquery.tiptip.min.js', array( 'jquery' ), FL_BUILDER_VERSION, true );
@@ -393,6 +393,7 @@ final class FLBuilderAdminSettings {
393
  self::save_user_access();
394
  self::clear_cache();
395
  self::debug();
 
396
  self::uninstall();
397
 
398
  /**
@@ -585,11 +586,12 @@ final class FLBuilderAdminSettings {
585
  // Check for supported sets.
586
  $is_icomoon = fl_builder_filesystem()->file_exists( $check_path . 'selection.json' );
587
  $is_fontello = fl_builder_filesystem()->file_exists( $check_path . 'config.json' );
 
588
 
589
  // Show an error if we don't have a supported icon set.
590
- if ( ! $is_icomoon && ! $is_fontello ) {
591
  fl_builder_filesystem()->rmdir( $new_path, true );
592
- self::add_error( __( 'Error! Please upload an icon set from either Icomoon or Fontello.', 'fl-builder' ) );
593
  return;
594
  }
595
 
@@ -603,6 +605,14 @@ final class FLBuilderAdminSettings {
603
  }
604
  }
605
 
 
 
 
 
 
 
 
 
606
  // Enable the new set.
607
  if ( is_array( $enabled_icons ) ) {
608
  $key = FLBuilderIcons::get_key_from_path( $check_path );
@@ -691,6 +701,28 @@ final class FLBuilderAdminSettings {
691
  }
692
  }
693
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  /**
695
  * Clears the builder cache for all sites on a network.
696
  *
101
  }
102
  }
103
  // Scripts
104
+ wp_enqueue_script( 'fl-builder-admin-settings', FL_BUILDER_URL . 'js/fl-builder-admin-settings.js', array( 'jquery-tiptip' ), FL_BUILDER_VERSION );
105
  wp_enqueue_script( 'jquery-actual', FL_BUILDER_URL . 'js/jquery.actual.min.js', array( 'jquery' ), FL_BUILDER_VERSION );
106
  wp_enqueue_script( 'jquery-multiselect', FL_BUILDER_URL . 'js/jquery.multiselect.js', array( 'jquery' ), FL_BUILDER_VERSION );
107
  wp_enqueue_script( 'jquery-tiptip', FL_BUILDER_URL . 'js/jquery.tiptip.min.js', array( 'jquery' ), FL_BUILDER_VERSION, true );
393
  self::save_user_access();
394
  self::clear_cache();
395
  self::debug();
396
+ self::global_edit();
397
  self::uninstall();
398
 
399
  /**
586
  // Check for supported sets.
587
  $is_icomoon = fl_builder_filesystem()->file_exists( $check_path . 'selection.json' );
588
  $is_fontello = fl_builder_filesystem()->file_exists( $check_path . 'config.json' );
589
+ $is_awesome = fl_builder_filesystem()->file_exists( $check_path . '/metadata/icons.json' );
590
 
591
  // Show an error if we don't have a supported icon set.
592
+ if ( ! $is_icomoon && ! $is_fontello && ! $is_awesome ) {
593
  fl_builder_filesystem()->rmdir( $new_path, true );
594
+ self::add_error( __( 'Error! Please upload an icon set from either Icomoon, Fontello or Font Awesome Pro Subset.', 'fl-builder' ) );
595
  return;
596
  }
597
 
605
  }
606
  }
607
 
608
+ // we need to patch the all.css file because _reasons_
609
+ if ( $is_awesome ) {
610
+ $search = array( '.fa,.fas{font-family:', '.fad{', '.fal,.far{font-family' );
611
+ $replace = array( '.subset.fa,.subset.fas{font-family:', '.subset.fad{', '.subset.fal,.subset.far{font-family' );
612
+ $css = str_replace( $search, $replace, fl_builder_filesystem()->file_get_contents( $check_path . 'css/all.min.css' ) );
613
+ fl_builder_filesystem()->file_put_contents( $check_path . 'css/all.min.css', $css );
614
+ }
615
+
616
  // Enable the new set.
617
  if ( is_array( $enabled_icons ) ) {
618
  $key = FLBuilderIcons::get_key_from_path( $check_path );
701
  }
702
  }
703
 
704
+ /**
705
+ * Update global js/css
706
+ *
707
+ * @since 2.4
708
+ * @access private
709
+ * @return void
710
+ */
711
+ static private function global_edit() {
712
+ if ( ! FLBuilderAdmin::current_user_can_access_settings() ) {
713
+ return;
714
+ } elseif ( isset( $_POST['fl-css-js-nonce'] ) && wp_verify_nonce( $_POST['fl-css-js-nonce'], 'debug' ) ) {
715
+ if ( get_transient( 'fl_debug_mode' ) || ( defined( 'FL_ENABLE_META_CSS_EDIT' ) && FL_ENABLE_META_CSS_EDIT ) ) {
716
+ $css = $_POST['css'];
717
+ $js = $_POST['js'];
718
+ $options = get_option( '_fl_builder_settings' );
719
+ $options->css = $css;
720
+ $options->js = $js;
721
+ update_option( '_fl_builder_settings', $options );
722
+ }
723
+ }
724
+ }
725
+
726
  /**
727
  * Clears the builder cache for all sites on a network.
728
  *
classes/class-fl-builder-admin.php CHANGED
@@ -136,6 +136,17 @@ final class FLBuilderAdmin {
136
  }
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  /**
136
  }
137
  }
138
 
139
+ //Check for one.com htaccess file in uploads that breaks everything.
140
+ $upload_dir = wp_upload_dir();
141
+ $file = trailingslashit( $upload_dir['basedir'] ) . '.htaccess';
142
+ if ( file_exists( $file ) ) {
143
+ $htaccess = file_get_contents( $file );
144
+ if ( false !== strpos( $htaccess, 'Block javascript except for visualcomposer (VC) plugin' ) ) {
145
+ FLBuilderAdminSettings::add_error(
146
+ /* translators: %s formatted .htaccess */
147
+ sprintf( __( 'Install Error! You appear to have a %s file in your uploads folder that will block all javascript files resulting in 403 errors. If you did not add this file please consult your host.', 'fl-builder' ), '<code>.htaccess</code>' ) );
148
+ }
149
+ }
150
  }
151
 
152
  /**
classes/class-fl-builder-auto-suggest.php CHANGED
@@ -303,17 +303,17 @@ final class FLBuilderAutoSuggest {
303
  $data = array();
304
  $like = self::get_like();
305
  $types = FLBuilderLoop::post_types();
306
- $slugs = array();
307
 
308
  foreach ( $types as $slug => $type ) {
309
  $slugs[] = esc_sql( $slug );
310
  }
311
 
312
  // we cant use an array of arrays for prepare() so use sprintf 1st.
313
- $query = sprintf( "SELECT ID, post_title FROM {$wpdb->posts}
314
  WHERE post_title LIKE %%s
315
  AND post_type IN ('%s')
316
- AND post_status = 'publish'",
317
  implode( "', '", $slugs )
318
  );
319
 
@@ -322,9 +322,11 @@ final class FLBuilderAutoSuggest {
322
  // @codingStandardsIgnoreEnd
323
 
324
  foreach ( $posts as $post ) {
 
325
  $data[] = array(
326
- 'name' => $post->post_title,
327
- 'value' => get_permalink( $post->ID ),
 
328
  );
329
  }
330
 
303
  $data = array();
304
  $like = self::get_like();
305
  $types = FLBuilderLoop::post_types();
306
+ $slugs = array( 'attachment' );
307
 
308
  foreach ( $types as $slug => $type ) {
309
  $slugs[] = esc_sql( $slug );
310
  }
311
 
312
  // we cant use an array of arrays for prepare() so use sprintf 1st.
313
+ $query = sprintf( "SELECT ID, post_title, post_type FROM {$wpdb->posts}
314
  WHERE post_title LIKE %%s
315
  AND post_type IN ('%s')
316
+ AND post_status IN ('publish', 'inherit')",
317
  implode( "', '", $slugs )
318
  );
319
 
322
  // @codingStandardsIgnoreEnd
323
 
324
  foreach ( $posts as $post ) {
325
+
326
  $data[] = array(
327
+ 'name' => ( 'attachment' === $post->post_type ) ? basename( wp_get_attachment_url( $post->ID ) ) : esc_html( $post->post_title ),
328
+ 'value' => ( 'attachment' === $post->post_type ) ? wp_get_attachment_url( $post->ID ) : get_permalink( $post->ID ),
329
+ 'type' => ucfirst( $post->post_type ),
330
  );
331
  }
332
 
classes/class-fl-builder-compatibility.php CHANGED
@@ -14,6 +14,7 @@ final class FLBuilderCompatibility {
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' ) );
@@ -42,6 +43,7 @@ final class FLBuilderCompatibility {
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 );
@@ -62,6 +64,20 @@ final class FLBuilderCompatibility {
62
  add_filter( 'option_cookiebot-nooutput', array( __CLASS__, 'fix_cookiebot' ) );
63
  add_filter( 'fl_select2_enabled', array( __CLASS__, 'fix_memberium' ) );
64
  add_filter( 'option_wp-smush-lazy_load', array( __CLASS__, 'fix_smush' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
67
  public static function fix_smush( $option ) {
@@ -724,5 +740,99 @@ final class FLBuilderCompatibility {
724
  }
725
  return $response;
726
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
  }
728
  FLBuilderCompatibility::init();
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( 'plugins_loaded', __CLASS__ . '::popup_builder' );
18
  add_action( 'added_post_meta', array( __CLASS__, 'template_meta_add' ), 10, 4 );
19
  add_action( 'fl_builder_insert_layout_render', array( __CLASS__, 'insert_layout_render_search' ), 10, 3 );
20
  add_action( 'fl_builder_fa_pro_save', array( __CLASS__, 'clear_theme_cache' ) );
43
  add_action( 'fl_theme_builder_before_render_header', array( __CLASS__, 'fix_lazyload_header_start' ) );
44
  add_action( 'fl_theme_builder_after_render_header', array( __CLASS__, 'fix_lazyload_header_end' ) );
45
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'ee_remove_stylesheet' ), 99999 );
46
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'fix_woocommerce_products_filter' ), 12 );
47
 
48
  // Filters
49
  add_filter( 'fl_builder_is_post_editable', array( __CLASS__, 'bp_pages_support' ), 11, 2 );
64
  add_filter( 'option_cookiebot-nooutput', array( __CLASS__, 'fix_cookiebot' ) );
65
  add_filter( 'fl_select2_enabled', array( __CLASS__, 'fix_memberium' ) );
66
  add_filter( 'option_wp-smush-lazy_load', array( __CLASS__, 'fix_smush' ) );
67
+ add_filter( 'fl_row_bg_video_wrapper_class', array( __CLASS__, 'fix_twenty_twenty_video' ) );
68
+ add_filter( 'fl_builder_loop_rewrite_rules', array( __CLASS__, 'fix_wpseo_category_pagination_rule' ) );
69
+ }
70
+
71
+ /**
72
+ * @since 2.4
73
+ */
74
+ public static function popup_builder() {
75
+ if ( isset( $_GET['fl_builder'] ) ) {
76
+ if ( class_exists( '\sgpb\PopupBuilderInit' ) ) {
77
+ $instance = sgpb\PopupBuilderInit::getInstance();
78
+ self::remove_filters_with_method_name( 'media_buttons', 'popupMediaButton', 10 );
79
+ }
80
+ }
81
  }
82
 
83
  public static function fix_smush( $option ) {
740
  }
741
  return $response;
742
  }
743
+
744
+ /**
745
+ * Helper function
746
+ * @see https://github.com/herewithme/wp-filters-extras/blob/master/wp-filters-extras.php
747
+ */
748
+ public static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) {
749
+ global $wp_filter;
750
+
751
+ // Take only filters on right hook name and priority
752
+ if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) {
753
+ return false;
754
+ }
755
+
756
+ // Loop on filters registered
757
+ foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) {
758
+ // Test if filter is an array ! (always for class/method)
759
+ if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) {
760
+ // Test if object is a class and method is equal to param !
761
+ if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) {
762
+ // Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/)
763
+ if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) {
764
+ unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] );
765
+ } else {
766
+ unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ] );
767
+ }
768
+ }
769
+ }
770
+ }
771
+ return false;
772
+ }
773
+
774
+ /**
775
+ * Fix row background video on Twenty Twenty theme.
776
+ * @since 2.4
777
+ */
778
+ public static function fix_twenty_twenty_video( $classes ) {
779
+ if ( 'twentytwenty' == get_option( 'template' ) && ! in_array( 'intrinsic-ignore', $classes ) ) {
780
+ $classes[] = 'intrinsic-ignore';
781
+ }
782
+
783
+ return $classes;
784
+ }
785
+
786
+ /**
787
+ * Fix compatibility issue with Yoast SEO when category prefix is removed
788
+ * in the settings.
789
+ *
790
+ * @since 2.4
791
+ */
792
+ public static function fix_wpseo_category_pagination_rule( $rewrite_rules ) {
793
+ if ( ! class_exists( 'WPSEO_Rewrite' ) ) {
794
+ return $rewrite_rules;
795
+ }
796
+
797
+ if ( ! isset( $GLOBALS['wpseo_rewrite'] ) ) {
798
+ return $rewrite_rules;
799
+ }
800
+
801
+ if ( ! method_exists( $GLOBALS['wpseo_rewrite'], 'category_rewrite_rules' ) ) {
802
+ return $rewrite_rules;
803
+ }
804
+
805
+ global $wp_rewrite;
806
+
807
+ $wpseo_rewrite_rules = $GLOBALS['wpseo_rewrite']->category_rewrite_rules();
808
+ $page_base = $wp_rewrite->pagination_base;
809
+ $flpaged_base = 'paged-[0-9]{1,}';
810
+ $flpaged_rules = array();
811
+
812
+ foreach ( $wpseo_rewrite_rules as $regex => $redirect ) {
813
+ if ( strpos( $regex, '/' . $page_base . '/' ) !== false ) {
814
+ $flregex = str_replace( $page_base, $flpaged_base, $regex );
815
+
816
+ // Adds our custom paged rule.
817
+ $flpaged_rules[ $flregex ] = 'index.php?category_name=$matches[1]&flpaged=$matches[2]';
818
+ }
819
+ }
820
+ $rewrite_rules = array_merge( $flpaged_rules, $rewrite_rules );
821
+
822
+ return $rewrite_rules;
823
+ }
824
+ /**
825
+ * Fix compatibility issue Woocommerce Products Filter Add-on
826
+ *
827
+ * @since 2.4.1
828
+ */
829
+ public static function fix_woocommerce_products_filter() {
830
+ if ( class_exists( 'WooCommerce' )
831
+ && class_exists( 'WooCommerce_Product_Filter_Plugin\Plugin' )
832
+ && class_exists( 'FLBuilderModel' )
833
+ && ( FLBuilderModel::is_builder_active() ) ) {
834
+ wp_deregister_script( 'wcpf-plugin-polyfills-script' );
835
+ }
836
+ }
837
  }
838
  FLBuilderCompatibility::init();
classes/class-fl-builder-debug.php CHANGED
@@ -6,6 +6,10 @@ final class FL_Debug {
6
 
7
  public static function init() {
8
  if ( isset( $_GET['fldebug'] ) && get_transient( 'fl_debug_mode', false ) === $_GET['fldebug'] ) {
 
 
 
 
9
  add_action( 'init', array( 'FL_Debug', 'display_tests' ) );
10
  }
11
 
@@ -112,6 +116,12 @@ final class FL_Debug {
112
  );
113
  self::register( 'site_url', $args );
114
 
 
 
 
 
 
 
115
  $args = array(
116
  'name' => 'WP Version',
117
  'data' => $wp_version,
@@ -230,6 +240,17 @@ final class FL_Debug {
230
  }
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
233
  $args = array(
234
  'name' => 'Plugins',
235
  'data' => self::divider(),
6
 
7
  public static function init() {
8
  if ( isset( $_GET['fldebug'] ) && get_transient( 'fl_debug_mode', false ) === $_GET['fldebug'] ) {
9
+ if ( isset( $_GET['info'] ) ) {
10
+ phpinfo();
11
+ exit;
12
+ }
13
  add_action( 'init', array( 'FL_Debug', 'display_tests' ) );
14
  }
15
 
116
  );
117
  self::register( 'site_url', $args );
118
 
119
+ $args = array(
120
+ 'name' => 'IP',
121
+ 'data' => $_SERVER['SERVER_ADDR'],
122
+ );
123
+ self::register( 'wp_ip', $args );
124
+
125
  $args = array(
126
  'name' => 'WP Version',
127
  'data' => $wp_version,
240
  }
241
  }
242
 
243
+ // child theme functions
244
+ if ( $theme->get( 'Template' ) ) {
245
+ $functions_file = trailingslashit( get_stylesheet_directory() ) . 'functions.php';
246
+ $contents = file_get_contents( $functions_file );
247
+ $args = array(
248
+ 'name' => 'Child Theme Functions',
249
+ 'data' => $contents,
250
+ );
251
+ self::register( 'child_funcs', $args );
252
+ }
253
+
254
  $args = array(
255
  'name' => 'Plugins',
256
  'data' => self::divider(),
classes/class-fl-builder-history-manager.php CHANGED
@@ -73,6 +73,7 @@ final class FLBuilderHistoryManager {
73
  'template_applied' => esc_attr__( 'Template Applied', 'fl-builder' ),
74
  'row_template_applied' => esc_attr__( 'Row Template Added', 'fl-builder' ),
75
  'column_template_applied' => esc_attr__( 'Column Template Added', 'fl-builder' ),
 
76
  );
77
 
78
  $hooks = array(
@@ -125,8 +126,8 @@ final class FLBuilderHistoryManager {
125
  'position' => self::get_position(),
126
  'hooks' => $hooks,
127
  'labels' => $labels,
 
128
  );
129
-
130
  return $config;
131
  }
132
 
@@ -134,6 +135,7 @@ final class FLBuilderHistoryManager {
134
  * Adds history data to the main menu config.
135
  */
136
  static public function main_menu_config( $config ) {
 
137
  $config['main']['items'][36] = array(
138
  'label' => __( 'History', 'fl-builder' ),
139
  'type' => 'view',
@@ -155,10 +157,15 @@ final class FLBuilderHistoryManager {
155
  * when the builder is active.
156
  */
157
  static public function init_states() {
158
- $states = self::get_states();
 
159
 
160
- if ( empty( $states ) ) {
161
- self::save_current_state( 'draft_created' );
 
 
 
 
162
  }
163
  }
164
 
@@ -169,7 +176,7 @@ final class FLBuilderHistoryManager {
169
  global $wpdb;
170
 
171
  $post_id = FLBuilderModel::get_post_id();
172
- $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key LIKE %s AND post_id = %d", '%_fl_builder_history_state%', $post_id ) );
173
  $states = array();
174
 
175
  foreach ( $results as $result ) {
73
  'template_applied' => esc_attr__( 'Template Applied', 'fl-builder' ),
74
  'row_template_applied' => esc_attr__( 'Row Template Added', 'fl-builder' ),
75
  'column_template_applied' => esc_attr__( 'Column Template Added', 'fl-builder' ),
76
+ 'history_disabled' => __( 'Undo/Redo history is currently disabled.', 'fl-builder' ),
77
  );
78
 
79
  $hooks = array(
126
  'position' => self::get_position(),
127
  'hooks' => $hooks,
128
  'labels' => $labels,
129
+ 'enabled' => FL_BUILDER_HISTORY_STATES && FL_BUILDER_HISTORY_STATES > 0 ? true : false,
130
  );
 
131
  return $config;
132
  }
133
 
135
  * Adds history data to the main menu config.
136
  */
137
  static public function main_menu_config( $config ) {
138
+
139
  $config['main']['items'][36] = array(
140
  'label' => __( 'History', 'fl-builder' ),
141
  'type' => 'view',
157
  * when the builder is active.
158
  */
159
  static public function init_states() {
160
+ if ( FL_BUILDER_HISTORY_STATES && FL_BUILDER_HISTORY_STATES > 0 ) {
161
+ $states = self::get_states();
162
 
163
+ if ( empty( $states ) ) {
164
+ self::save_current_state( 'draft_created' );
165
+ }
166
+ } else {
167
+ $post_id = FLBuilderModel::get_post_id();
168
+ self::delete_states( $post_id );
169
  }
170
  }
171
 
176
  global $wpdb;
177
 
178
  $post_id = FLBuilderModel::get_post_id();
179
+ $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key LIKE %s AND post_id = %d ORDER BY meta_id", '%_fl_builder_history_state%', $post_id ) );
180
  $states = array();
181
 
182
  foreach ( $results as $result ) {
classes/class-fl-builder-icons.php CHANGED
@@ -323,6 +323,46 @@ final class FLBuilderIcons {
323
  }
324
  }
325
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
  }
328
  }
@@ -412,22 +452,28 @@ final class FLBuilderIcons {
412
  // Is this a core icon?
413
  if ( stristr( $icon, 'fa fa-' ) ) {
414
  wp_enqueue_style( 'font-awesome' );
415
- } elseif ( stristr( $icon, 'far fa-' ) || stristr( $icon, 'fas fa-' ) || stristr( $icon, 'fab fa-' ) || stristr( $icon, 'fal fa-' ) || stristr( $icon, 'fad fa-' ) ) {
416
- wp_enqueue_style( 'font-awesome-5' );
417
  } elseif ( stristr( $icon, 'fi-' ) ) {
418
  wp_enqueue_style( 'foundation-icons' );
 
419
  } elseif ( stristr( $icon, 'dashicon' ) ) {
420
  wp_enqueue_style( 'dashicons' );
421
- } else {
422
-
423
- $sets = self::get_sets();
424
 
425
- foreach ( (array) $sets as $key => $data ) {
426
- if ( in_array( $icon, $data['icons'] ) ) {
427
- self::enqueue_custom_styles_by_key( $key );
428
- }
 
429
  }
430
  }
 
 
 
 
 
 
431
  }
432
 
433
  /**
@@ -452,6 +498,9 @@ final class FLBuilderIcons {
452
  if ( 'fontello' == $set['type'] ) {
453
  wp_enqueue_style( $key, $set['stylesheet'], array(), FL_BUILDER_VERSION );
454
  }
 
 
 
455
  }
456
  }
457
  }
323
  }
324
  }
325
  }
326
+ } elseif ( fl_builder_filesystem()->file_exists( $folder . '/metadata/icons.json' ) ) { // font awesome pro subsets
327
+ $data = json_decode( fl_builder_filesystem()->file_get_contents( $folder . '/metadata/icons.json' ) );
328
+ $key = basename( $folder );
329
+ $url = str_ireplace( $upload_info['path'], $upload_info['url'], $folder );
330
+
331
+ if ( is_object( $data ) ) {
332
+
333
+ if ( is_admin() || in_array( $key, $enabled_icons ) ) {
334
+
335
+ self::$sets[ $key ] = array(
336
+ 'name' => 'Font Awesome Custom Subset',
337
+ 'prefix' => '',
338
+ 'type' => 'awesome',
339
+ 'path' => $folder,
340
+ 'url' => $url,
341
+ 'stylesheet' => $url . '/css/all.min.css',
342
+ 'icons' => array(),
343
+ );
344
+
345
+ foreach ( $data as $k => $icon ) {
346
+
347
+ foreach ( $icon->styles as $style ) {
348
+ switch ( $style ) {
349
+ case 'solid':
350
+ self::$sets[ $key ]['icons'][] = 'subset fas fa-' . $k;
351
+ break;
352
+ case 'regular':
353
+ self::$sets[ $key ]['icons'][] = 'subset far fa-' . $k;
354
+ break;
355
+ case 'duotone':
356
+ self::$sets[ $key ]['icons'][] = 'subset fad fa-' . $k;
357
+ break;
358
+ case 'light':
359
+ self::$sets[ $key ]['icons'][] = 'subset fal fa-' . $k;
360
+ break;
361
+ }
362
+ }
363
+ }
364
+ }
365
+ }
366
  }
367
  }
368
  }
452
  // Is this a core icon?
453
  if ( stristr( $icon, 'fa fa-' ) ) {
454
  wp_enqueue_style( 'font-awesome' );
455
+ return;
 
456
  } elseif ( stristr( $icon, 'fi-' ) ) {
457
  wp_enqueue_style( 'foundation-icons' );
458
+ return;
459
  } elseif ( stristr( $icon, 'dashicon' ) ) {
460
  wp_enqueue_style( 'dashicons' );
461
+ return;
462
+ }
 
463
 
464
+ $sets = self::get_sets();
465
+ foreach ( (array) $sets as $key => $data ) {
466
+ if ( in_array( $icon, $data['icons'] ) ) {
467
+ self::enqueue_custom_styles_by_key( $key );
468
+ return;
469
  }
470
  }
471
+
472
+ // finally check for fa5, we do this last because subsets miight be loaded in the block above.
473
+ if ( stristr( $icon, 'far fa-' ) || stristr( $icon, 'fas fa-' ) || stristr( $icon, 'fab fa-' ) || stristr( $icon, 'fal fa-' ) || stristr( $icon, 'fad fa-' ) ) {
474
+ wp_enqueue_style( 'font-awesome-5' );
475
+ }
476
+
477
  }
478
 
479
  /**
498
  if ( 'fontello' == $set['type'] ) {
499
  wp_enqueue_style( $key, $set['stylesheet'], array(), FL_BUILDER_VERSION );
500
  }
501
+ if ( 'awesome' == $set['type'] ) {
502
+ wp_enqueue_style( $key, $set['stylesheet'], array(), FL_BUILDER_VERSION );
503
+ }
504
  }
505
  }
506
  }
classes/class-fl-builder-importer.php CHANGED
@@ -15,289 +15,43 @@ class FLBuilderImporter extends WP_Import {
15
  */
16
  function parse( $file ) {
17
 
18
- if ( extension_loaded( 'simplexml' ) ) {
19
- $parser = new FLBuilderImportParserSimpleXML;
20
  $result = $parser->parse( $file );
21
 
22
  // If SimpleXML succeeds or this is an invalid WXR file then return the results
23
- if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() ) {
24
- return $result;
25
- }
26
- } elseif ( extension_loaded( 'xml' ) ) {
27
-
28
- $parser = new FLBuilderImportParserXML();
29
- $result = $parser->parse( $file );
30
- if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() ) {
31
  return $result;
32
  }
 
 
33
  }
 
34
  // We have a malformed XML file, so display the error and fallthrough to regex
35
- if ( isset( $result ) && defined( 'WP_DEBUG' ) && WP_DEBUG ) {
36
  echo '<pre>';
37
- if ( 'SimpleXML_parse_error' == $result->get_error_code() ) {
38
- foreach ( $result->get_error_data() as $error ) {
39
- echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n";
40
- }
41
- } elseif ( 'XML_parse_error' == $result->get_error_code() ) {
42
  $error = $result->get_error_data();
43
  echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
 
 
44
  }
 
 
 
45
  $data = file_get_contents( $file );
46
  $bad = preg_match( '#[^\x00-\x7F]#', $data );
47
- if ( $bad ) {
48
- echo __( 'Some bad characters were found in the xml file', 'fl-builder' );
49
- }
50
- echo '</pre>';
51
- echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'wordpress-importer' ) . '</strong><br />';
52
- echo '<p>' . __( 'Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer' ) . '</p>';
53
  }
 
 
 
54
  $parser = new FLBuilderImportParserRegex();
55
  return $parser->parse( $file );
56
  }
57
  }
58
 
59
- class FLBuilderImportParserSimpleXML extends WXR_Parser_SimpleXML {
60
- function parse( $file ) {
61
-
62
- $authors = array();
63
- $posts = array();
64
- $categories = array();
65
- $tags = array();
66
- $terms = array();
67
-
68
- $internal_errors = libxml_use_internal_errors( true );
69
-
70
- $dom = new DOMDocument;
71
- $old_value = null;
72
- if ( function_exists( 'libxml_disable_entity_loader' ) ) {
73
- $old_value = libxml_disable_entity_loader( true );
74
- }
75
- $success = $dom->loadXML( file_get_contents( $file ) );
76
- if ( ! is_null( $old_value ) ) {
77
- libxml_disable_entity_loader( $old_value );
78
- }
79
-
80
- if ( ! $success || isset( $dom->doctype ) ) {
81
- return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
82
- }
83
-
84
- $xml = simplexml_import_dom( $dom );
85
- unset( $dom );
86
-
87
- // halt if loading produces an error
88
- if ( ! $xml ) {
89
- return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
90
- }
91
-
92
- $wxr_version = $xml->xpath( '/rss/channel/wp:wxr_version' );
93
- if ( ! $wxr_version ) {
94
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
95
- }
96
-
97
- $wxr_version = (string) trim( $wxr_version[0] );
98
- // confirm that we are dealing with the correct file format
99
- if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) ) {
100
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
101
- }
102
-
103
- $base_url = $xml->xpath( '/rss/channel/wp:base_site_url' );
104
- $base_url = (string) trim( $base_url[0] );
105
-
106
- $base_blog_url = $xml->xpath( '/rss/channel/wp:base_blog_url' );
107
- if ( $base_blog_url ) {
108
- $base_blog_url = (string) trim( $base_blog_url[0] );
109
- } else {
110
- $base_blog_url = $base_url;
111
- }
112
-
113
- $namespaces = $xml->getDocNamespaces();
114
- if ( ! isset( $namespaces['wp'] ) ) {
115
- $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
116
- }
117
- if ( ! isset( $namespaces['excerpt'] ) ) {
118
- $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
119
- }
120
-
121
- // grab authors
122
- foreach ( $xml->xpath( '/rss/channel/wp:author' ) as $author_arr ) {
123
- $a = $author_arr->children( $namespaces['wp'] );
124
- $login = (string) $a->author_login;
125
- $authors[ $login ] = array(
126
- 'author_id' => (int) $a->author_id,
127
- 'author_login' => $login,
128
- 'author_email' => (string) $a->author_email,
129
- 'author_display_name' => (string) $a->author_display_name,
130
- 'author_first_name' => (string) $a->author_first_name,
131
- 'author_last_name' => (string) $a->author_last_name,
132
- );
133
- }
134
-
135
- // grab cats, tags and terms
136
- foreach ( $xml->xpath( '/rss/channel/wp:category' ) as $term_arr ) {
137
- $t = $term_arr->children( $namespaces['wp'] );
138
- $category = array(
139
- 'term_id' => (int) $t->term_id,
140
- 'category_nicename' => (string) $t->category_nicename,
141
- 'category_parent' => (string) $t->category_parent,
142
- 'cat_name' => (string) $t->cat_name,
143
- 'category_description' => (string) $t->category_description,
144
- );
145
-
146
- foreach ( $t->termmeta as $meta ) {
147
- $category['termmeta'][] = array(
148
- 'key' => (string) $meta->meta_key,
149
- 'value' => (string) $meta->meta_value,
150
- );
151
- }
152
-
153
- $categories[] = $category;
154
- }
155
-
156
- foreach ( $xml->xpath( '/rss/channel/wp:tag' ) as $term_arr ) {
157
- $t = $term_arr->children( $namespaces['wp'] );
158
- $tag = array(
159
- 'term_id' => (int) $t->term_id,
160
- 'tag_slug' => (string) $t->tag_slug,
161
- 'tag_name' => (string) $t->tag_name,
162
- 'tag_description' => (string) $t->tag_description,
163
- );
164
-
165
- foreach ( $t->termmeta as $meta ) {
166
- $tag['termmeta'][] = array(
167
- 'key' => (string) $meta->meta_key,
168
- 'value' => (string) $meta->meta_value,
169
- );
170
- }
171
-
172
- $tags[] = $tag;
173
- }
174
-
175
- foreach ( $xml->xpath( '/rss/channel/wp:term' ) as $term_arr ) {
176
- $t = $term_arr->children( $namespaces['wp'] );
177
- $term = array(
178
- 'term_id' => (int) $t->term_id,
179
- 'term_taxonomy' => (string) $t->term_taxonomy,
180
- 'slug' => (string) $t->term_slug,
181
- 'term_parent' => (string) $t->term_parent,
182
- 'term_name' => (string) $t->term_name,
183
- 'term_description' => (string) $t->term_description,
184
- );
185
-
186
- foreach ( $t->termmeta as $meta ) {
187
- $term['termmeta'][] = array(
188
- 'key' => (string) $meta->meta_key,
189
- 'value' => (string) $meta->meta_value,
190
- );
191
- }
192
-
193
- $terms[] = $term;
194
- }
195
-
196
- // grab posts
197
- foreach ( $xml->channel->item as $item ) {
198
- $post = array(
199
- 'post_title' => (string) $item->title,
200
- 'guid' => (string) $item->guid,
201
- );
202
-
203
- $dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
204
- $post['post_author'] = (string) $dc->creator;
205
-
206
- $content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
207
- $excerpt = $item->children( $namespaces['excerpt'] );
208
- $post['post_content'] = (string) $content->encoded;
209
- $post['post_excerpt'] = (string) $excerpt->encoded;
210
-
211
- $wp = $item->children( $namespaces['wp'] );
212
- $post['post_id'] = (int) $wp->post_id;
213
- $post['post_date'] = (string) $wp->post_date;
214
- $post['post_date_gmt'] = (string) $wp->post_date_gmt;
215
- $post['comment_status'] = (string) $wp->comment_status;
216
- $post['ping_status'] = (string) $wp->ping_status;
217
- $post['post_name'] = (string) $wp->post_name;
218
- $post['status'] = (string) $wp->status;
219
- $post['post_parent'] = (int) $wp->post_parent;
220
- $post['menu_order'] = (int) $wp->menu_order;
221
- $post['post_type'] = (string) $wp->post_type;
222
- $post['post_password'] = (string) $wp->post_password;
223
- $post['is_sticky'] = (int) $wp->is_sticky;
224
-
225
- if ( isset( $wp->attachment_url ) ) {
226
- $post['attachment_url'] = (string) $wp->attachment_url;
227
- }
228
-
229
- foreach ( $item->category as $c ) {
230
- $att = $c->attributes();
231
- if ( isset( $att['nicename'] ) ) {
232
- $post['terms'][] = array(
233
- 'name' => (string) $c,
234
- 'slug' => (string) $att['nicename'],
235
- 'domain' => (string) $att['domain'],
236
- );
237
- }
238
- }
239
-
240
- foreach ( $wp->postmeta as $meta ) {
241
- FLBuilderImporterDataFix::set_pcre_limit( apply_filters( 'fl_builder_importer_pcre', '23001337' ) );
242
-
243
- if ( '_fl_builder_data' == $meta->meta_key ) {
244
- $data = FLBuilderImporterDataFix::run( (string) $meta->meta_value );
245
- if ( is_object( $data ) || is_array( $data ) ) {
246
- $data = serialize( $data );
247
- }
248
- } else {
249
- $data = $meta->meta_value;
250
- }
251
-
252
- $post['postmeta'][] = array(
253
- 'key' => (string) $meta->meta_key,
254
- 'value' => (string) $data,
255
- );
256
- }
257
-
258
- foreach ( $wp->comment as $comment ) {
259
- $meta = array();
260
- if ( isset( $comment->commentmeta ) ) {
261
- foreach ( $comment->commentmeta as $m ) {
262
- $meta[] = array(
263
- 'key' => (string) $m->meta_key,
264
- 'value' => (string) $m->meta_value,
265
- );
266
- }
267
- }
268
-
269
- $post['comments'][] = array(
270
- 'comment_id' => (int) $comment->comment_id,
271
- 'comment_author' => (string) $comment->comment_author,
272
- 'comment_author_email' => (string) $comment->comment_author_email,
273
- 'comment_author_IP' => (string) $comment->comment_author_IP,
274
- 'comment_author_url' => (string) $comment->comment_author_url,
275
- 'comment_date' => (string) $comment->comment_date,
276
- 'comment_date_gmt' => (string) $comment->comment_date_gmt,
277
- 'comment_content' => (string) $comment->comment_content,
278
- 'comment_approved' => (string) $comment->comment_approved,
279
- 'comment_type' => (string) $comment->comment_type,
280
- 'comment_parent' => (string) $comment->comment_parent,
281
- 'comment_user_id' => (int) $comment->comment_user_id,
282
- 'commentmeta' => $meta,
283
- );
284
- }
285
-
286
- $posts[] = $post;
287
- }
288
-
289
- return array(
290
- 'authors' => $authors,
291
- 'posts' => $posts,
292
- 'categories' => $categories,
293
- 'tags' => $tags,
294
- 'terms' => $terms,
295
- 'base_url' => $base_url,
296
- 'base_blog_url' => $base_blog_url,
297
- 'version' => $wxr_version,
298
- );
299
- }
300
- }
301
 
302
  class FLBuilderImportParserXML extends WXR_Parser_XML {
303
 
@@ -327,7 +81,15 @@ class FLBuilderImportParserXML extends WXR_Parser_XML {
327
  if ( ! empty( $this->sub_data ) ) {
328
  if ( stristr( $this->sub_data['key'], '_fl_builder_' ) ) {
329
  FLBuilderImporterDataFix::set_pcre_limit( apply_filters( 'fl_builder_importer_pcre', '23001337' ) );
330
- $data = FLBuilderImporterDataFix::run( $this->sub_data['value'] );
 
 
 
 
 
 
 
 
331
  if ( is_object( $data ) || is_array( $data ) ) {
332
  $data = serialize( $data );
333
  }
@@ -369,7 +131,8 @@ class FLBuilderImportParserXML extends WXR_Parser_XML {
369
  $this->in_tag = false;
370
  }
371
  }
372
- $this->cdata = false;
 
373
  }
374
  }
375
 
@@ -463,7 +226,12 @@ class FLBuilderImportParserRegex extends WXR_Parser_Regex {
463
  }
464
  foreach ( $post['postmeta'] as $postmeta_index => $postmeta ) {
465
  if ( stristr( $postmeta['key'], '_fl_builder_' ) ) {
466
- $data = FLBuilderImporterDataFix::run( $postmeta['value'] );
 
 
 
 
 
467
  if ( is_object( $data ) || is_array( $data ) ) {
468
  $data = serialize( $data );
469
  }
@@ -502,7 +270,7 @@ final class FLBuilderImporterDataFix {
502
  * @since 1.8
503
  * @return string
504
  */
505
- static public function run( $data ) {
506
  // return if empty
507
  if ( empty( $data ) ) {
508
  return $data;
@@ -518,7 +286,7 @@ final class FLBuilderImporterDataFix {
518
 
519
  $data = preg_replace_callback('!s:(\d+):"(.*?)";!', function( $m ) {
520
  return 's:' . strlen( $m[2] ) . ':"' . $m[2] . '";';
521
- }, self::sanitize_from_word( $data ) );
522
 
523
  $data = maybe_unserialize( $data );
524
 
@@ -533,19 +301,23 @@ final class FLBuilderImporterDataFix {
533
  /**
534
  * Remove quotes etc pasted from a certain word processor.
535
  */
536
- public static function sanitize_from_word( $content ) {
537
  // Convert microsoft special characters
538
  $replace = array(
539
- '‘' => "\'",
540
- '’' => "\'",
541
- '”' => '\"',
542
- '“' => '\"',
543
  '–' => '-',
544
  '—' => '-',
545
  '…' => '&#8230;',
546
  "\n" => '<br />',
547
  );
548
 
 
 
 
 
549
  foreach ( $replace as $k => $v ) {
550
  $content = str_replace( $k, $v, $content );
551
  }
15
  */
16
  function parse( $file ) {
17
 
18
+ if ( extension_loaded( 'xml' ) ) {
19
+ $parser = new FLBuilderImportParserXML;
20
  $result = $parser->parse( $file );
21
 
22
  // If SimpleXML succeeds or this is an invalid WXR file then return the results
23
+ if ( ! is_wp_error( $result ) ) {
 
 
 
 
 
 
 
24
  return $result;
25
  }
26
+ } else {
27
+ $result = new WP_Error( 'no_xml', __( 'The xml PHP extension is not installed.', 'fl-builder' ) );
28
  }
29
+
30
  // We have a malformed XML file, so display the error and fallthrough to regex
31
+ if ( is_wp_error( $result ) ) {
32
  echo '<pre>';
33
+ if ( 'XML_parse_error' == $result->get_error_code() ) {
 
 
 
 
34
  $error = $result->get_error_data();
35
  echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
36
+ } else {
37
+ echo $result->get_error_message();
38
  }
39
+ echo '</pre>';
40
+ }
41
+
42
  $data = file_get_contents( $file );
43
  $bad = preg_match( '#[^\x00-\x7F]#', $data );
44
+ if ( $bad ) {
45
+ echo __( 'Some bad characters were found in the xml file', 'fl-builder' );
 
 
 
 
46
  }
47
+ echo '</pre>';
48
+ echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'fl-builder' ) . '</strong><br />';
49
+ echo '<p>' . __( 'Details are shown above. The importer will now try again with a different parser...', 'fl-builder' ) . '</p>';
50
  $parser = new FLBuilderImportParserRegex();
51
  return $parser->parse( $file );
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  class FLBuilderImportParserXML extends WXR_Parser_XML {
57
 
81
  if ( ! empty( $this->sub_data ) ) {
82
  if ( stristr( $this->sub_data['key'], '_fl_builder_' ) ) {
83
  FLBuilderImporterDataFix::set_pcre_limit( apply_filters( 'fl_builder_importer_pcre', '23001337' ) );
84
+ if ( '_fl_builder_data_settings' == $this->sub_data['key'] || '_fl_builder_draft_settings' == $this->sub_data['key'] ) {
85
+ $data = FLBuilderImporterDataFix::run( $this->sub_data['value'], false );
86
+ } else {
87
+ $data = FLBuilderImporterDataFix::run( $this->sub_data['value'], true );
88
+ if ( ! $data && ( $data != $this->sub_data['value'] ) ) {
89
+ $data = $this->sub_data['value'];
90
+ }
91
+ }
92
+
93
  if ( is_object( $data ) || is_array( $data ) ) {
94
  $data = serialize( $data );
95
  }
131
  $this->in_tag = false;
132
  }
133
  }
134
+ $this->cdata = false;
135
+ $this->base_blog_url = '';
136
  }
137
  }
138
 
226
  }
227
  foreach ( $post['postmeta'] as $postmeta_index => $postmeta ) {
228
  if ( stristr( $postmeta['key'], '_fl_builder_' ) ) {
229
+
230
+ if ( '_fl_builder_data_settings' == $postmeta['key'] || '_fl_builder_draft_settings' == $postmeta['key'] ) {
231
+ $data = FLBuilderImporterDataFix::run( $postmeta['value'], false );
232
+ } else {
233
+ $data = FLBuilderImporterDataFix::run( $postmeta['value'], true );
234
+ }
235
  if ( is_object( $data ) || is_array( $data ) ) {
236
  $data = serialize( $data );
237
  }
270
  * @since 1.8
271
  * @return string
272
  */
273
+ static public function run( $data, $linebreaks = true ) {
274
  // return if empty
275
  if ( empty( $data ) ) {
276
  return $data;
286
 
287
  $data = preg_replace_callback('!s:(\d+):"(.*?)";!', function( $m ) {
288
  return 's:' . strlen( $m[2] ) . ':"' . $m[2] . '";';
289
+ }, self::sanitize_from_word( $data, $linebreaks ) );
290
 
291
  $data = maybe_unserialize( $data );
292
 
301
  /**
302
  * Remove quotes etc pasted from a certain word processor.
303
  */
304
+ public static function sanitize_from_word( $content, $linebreaks ) {
305
  // Convert microsoft special characters
306
  $replace = array(
307
+ '‘' => "'",
308
+ '’' => "'",
309
+ '”' => '"',
310
+ '“' => '"',
311
  '–' => '-',
312
  '—' => '-',
313
  '…' => '&#8230;',
314
  "\n" => '<br />',
315
  );
316
 
317
+ if ( ! $linebreaks ) {
318
+ unset( $replace["\n"] );
319
+ }
320
+
321
  foreach ( $replace as $k => $v ) {
322
  $content = str_replace( $k, $v, $content );
323
  }
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.3.2.8' );
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 ) );
@@ -54,6 +54,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
54
  define( 'FL_BUILDER_SUPPORT_URL', 'https://www.wpbeaverbuilder.com/support/' ); // Deprecated, do not use.
55
  define( 'FL_BUILDER_UPGRADE_URL', 'https://www.wpbeaverbuilder.com/' ); // Deprecated, do not use.
56
  define( 'FL_BUILDER_STORE_URL', 'https://www.wpbeaverbuilder.com/' );
 
57
  define( 'FL_BUILDER_DEMO_URL', 'http://demos.wpbeaverbuilder.com' );
58
  define( 'FL_BUILDER_OLD_DEMO_URL', 'http://demos.fastlinemedia.com' );
59
  define( 'FL_BUILDER_DEMO_CACHE_URL', 'http://demos.wpbeaverbuilder.com/wp-content/uploads/bb-plugin/cache/' );
46
  * @return void
47
  */
48
  static private function define_constants() {
49
+ define( 'FL_BUILDER_VERSION', '2.4.0.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 ) );
54
  define( 'FL_BUILDER_SUPPORT_URL', 'https://www.wpbeaverbuilder.com/support/' ); // Deprecated, do not use.
55
  define( 'FL_BUILDER_UPGRADE_URL', 'https://www.wpbeaverbuilder.com/' ); // Deprecated, do not use.
56
  define( 'FL_BUILDER_STORE_URL', 'https://www.wpbeaverbuilder.com/' );
57
+ define( 'FL_BUILDER_DEMO_DOMAIN', 'demos.wpbeaverbuilder.com' );
58
  define( 'FL_BUILDER_DEMO_URL', 'http://demos.wpbeaverbuilder.com' );
59
  define( 'FL_BUILDER_OLD_DEMO_URL', 'http://demos.fastlinemedia.com' );
60
  define( 'FL_BUILDER_DEMO_CACHE_URL', 'http://demos.wpbeaverbuilder.com/wp-content/uploads/bb-plugin/cache/' );
classes/class-fl-builder-loop.php CHANGED
@@ -190,11 +190,7 @@ final class FLBuilderLoop {
190
  $paged = self::get_paged();
191
 
192
  // Get the offset.
193
- if ( ! isset( $settings->offset ) || ! is_int( (int) $settings->offset ) ) {
194
- $offset = 0;
195
- } else {
196
- $offset = $settings->offset;
197
- }
198
 
199
  // Get the paged offset.
200
  if ( $paged < 2 ) {
@@ -221,6 +217,16 @@ final class FLBuilderLoop {
221
  'settings' => $settings,
222
  );
223
 
 
 
 
 
 
 
 
 
 
 
224
  // Order by meta value arg.
225
  if ( strstr( $order_by, 'meta_value' ) ) {
226
  $args['meta_key'] = $settings->order_by_meta_key;
@@ -433,6 +439,8 @@ final class FLBuilderLoop {
433
  // Generic Rule for Homepage / Search
434
  $flpaged_rules[ $paged_regex . '/?([0-9]{1,})/?$' ] = 'index.php?&flpaged=$matches[1]';
435
 
 
 
436
  foreach ( $flpaged_rules as $regex => $redirect ) {
437
  add_rewrite_rule( $regex, $redirect, 'top' );
438
  }
@@ -667,17 +675,32 @@ final class FLBuilderLoop {
667
  if ( is_array( $wp_the_query->query ) ) {
668
  foreach ( $wp_the_query->query as $key => $value ) {
669
  if ( strpos( $key, 'flpaged' ) === 0 && is_page() && get_option( 'page_on_front' ) ) {
670
- $redirect_url = false;
671
- break;
672
  }
673
  }
674
 
675
- // Disable canonical on single post pagination for all post types.
676
- if ( true === $wp_the_query->is_singular
677
- && - 1 == $wp_the_query->current_post
678
- && true === $wp_the_query->is_paged
679
  ) {
680
- $redirect_url = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  }
682
  }
683
 
@@ -778,14 +801,20 @@ final class FLBuilderLoop {
778
  $add_args['fl_rand_seed'] = self::$rand_seed;
779
  }
780
 
781
- echo paginate_links(array(
 
 
 
 
782
  'base' => $base . '%_%',
783
  'format' => $format,
784
  'current' => $current_page,
785
  'total' => $total_pages,
786
  'type' => 'list',
787
  'add_args' => $add_args,
788
- ));
 
 
789
  }
790
  }
791
 
190
  $paged = self::get_paged();
191
 
192
  // Get the offset.
193
+ $offset = isset( $settings->offset ) ? intval( $settings->offset ) : 0;
 
 
 
 
194
 
195
  // Get the paged offset.
196
  if ( $paged < 2 ) {
217
  'settings' => $settings,
218
  );
219
 
220
+ // Set query keywords if specified in the settings.
221
+ if ( isset( $settings->keyword ) && ! empty( $settings->keyword ) ) {
222
+ $args['s'] = $settings->keyword;
223
+ }
224
+
225
+ // Set post_status if specified in the settings.
226
+ if ( isset( $settings->post_status ) && ! empty( $settings->post_status ) ) {
227
+ $args['post_status'] = $settings->post_status;
228
+ }
229
+
230
  // Order by meta value arg.
231
  if ( strstr( $order_by, 'meta_value' ) ) {
232
  $args['meta_key'] = $settings->order_by_meta_key;
439
  // Generic Rule for Homepage / Search
440
  $flpaged_rules[ $paged_regex . '/?([0-9]{1,})/?$' ] = 'index.php?&flpaged=$matches[1]';
441
 
442
+ $flpaged_rules = apply_filters( 'fl_builder_loop_rewrite_rules', $flpaged_rules );
443
+
444
  foreach ( $flpaged_rules as $regex => $redirect ) {
445
  add_rewrite_rule( $regex, $redirect, 'top' );
446
  }
675
  if ( is_array( $wp_the_query->query ) ) {
676
  foreach ( $wp_the_query->query as $key => $value ) {
677
  if ( strpos( $key, 'flpaged' ) === 0 && is_page() && get_option( 'page_on_front' ) ) {
678
+ return false;
 
679
  }
680
  }
681
 
682
+ // Checks for paginated singular posts.
683
+ if ( false === $wp_the_query->is_singular
684
+ || - 1 != $wp_the_query->current_post
685
+ || false === $wp_the_query->is_paged
686
  ) {
687
+ return $redirect_url;
688
+ }
689
+
690
+ // Checks for posts module in the current layout.
691
+ $modules = FLBuilderModel::get_all_modules();
692
+
693
+ if ( FLBuilderModel::is_builder_enabled() && ! empty( $modules ) ) {
694
+ foreach ( $modules as $module ) {
695
+ if ( 'post-grid' == $module->slug ) {
696
+ return false;
697
+ }
698
+ }
699
+ }
700
+
701
+ // Checks for posts module in themer layouts.
702
+ if ( fl_theme_builder_has_post_grid() ) {
703
+ return false;
704
  }
705
  }
706
 
801
  $add_args['fl_rand_seed'] = self::$rand_seed;
802
  }
803
 
804
+ /**
805
+ * @since 2.4
806
+ * @see fl_loop_paginate_links_args
807
+ */
808
+ $args = apply_filters( 'fl_loop_paginate_links_args', array(
809
  'base' => $base . '%_%',
810
  'format' => $format,
811
  'current' => $current_page,
812
  'total' => $total_pages,
813
  'type' => 'list',
814
  'add_args' => $add_args,
815
+ ), $query );
816
+
817
+ echo paginate_links( $args );
818
  }
819
  }
820
 
classes/class-fl-builder-model.php CHANGED
@@ -265,7 +265,7 @@ final class FLBuilderModel {
265
  * @return string
266
  */
267
  static public function get_relative_plugin_url() {
268
- $url = str_ireplace( home_url(), '', FL_BUILDER_URL );
269
  $parsed_path = parse_url( FL_BUILDER_URL, PHP_URL_PATH );
270
 
271
  if ( strstr( $url, '://' ) && $parsed_path ) {
@@ -512,6 +512,7 @@ final class FLBuilderModel {
512
 
513
  wp_set_post_lock( $data['fl_builder_post_lock']['post_id'] );
514
  }
 
515
  }
516
 
517
  /**
@@ -950,11 +951,10 @@ final class FLBuilderModel {
950
  * @since 1.6.3
951
  * @return void
952
  */
953
- static public function delete_asset_cache_for_all_posts() {
954
  $cache_dir = self::get_cache_dir();
955
- $css = glob( $cache_dir['path'] . '*.css' );
956
- $js = glob( $cache_dir['path'] . '*.js' );
957
-
958
  if ( is_array( $css ) ) {
959
  array_map( array( fl_builder_filesystem(), 'unlink' ), $css );
960
  }
@@ -2922,10 +2922,7 @@ final class FLBuilderModel {
2922
  static public function get_default_enabled_modules() {
2923
  $default = array_keys( self::$modules );
2924
 
2925
- // These modules are deprecated and disabled by default.
2926
- $deprecated = array(
2927
- 'social-buttons',
2928
- );
2929
 
2930
  // Remove deprecated modules from the defaults.
2931
  foreach ( $default as $key => $slug ) {
@@ -2937,6 +2934,17 @@ final class FLBuilderModel {
2937
  return array_values( $default );
2938
  }
2939
 
 
 
 
 
 
 
 
 
 
 
 
2940
  /**
2941
  * Returns an array of all modules that are enabled.
2942
  *
@@ -6005,8 +6013,11 @@ final class FLBuilderModel {
6005
 
6006
  // glob() will return false on error so cast as an array() just in case.
6007
  foreach ( (array) $templates as $template ) {
 
6008
 
6009
- if ( 'templates.dat' == basename( $template ) ) {
 
 
6010
  continue;
6011
  }
6012
 
@@ -6263,6 +6274,7 @@ final class FLBuilderModel {
6263
  'type' => 'core',
6264
  'kind' => 'template',
6265
  'content' => ! in_array( $type, array( 'row', 'column', 'module' ) ) ? 'layout' : $type,
 
6266
  ), $template );
6267
  }
6268
 
@@ -6380,6 +6392,23 @@ final class FLBuilderModel {
6380
  return apply_filters( 'fl_builder_module_templates_data', self::get_template_selector_data( 'module' ) );
6381
  }
6382
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6383
  /**
6384
  * Get color presets.
6385
  *
265
  * @return string
266
  */
267
  static public function get_relative_plugin_url() {
268
+ $url = str_ireplace( home_url(), '', FL_BUILDER_URL );
269
  $parsed_path = parse_url( FL_BUILDER_URL, PHP_URL_PATH );
270
 
271
  if ( strstr( $url, '://' ) && $parsed_path ) {
512
 
513
  wp_set_post_lock( $data['fl_builder_post_lock']['post_id'] );
514
  }
515
+ return $response;
516
  }
517
 
518
  /**
951
  * @since 1.6.3
952
  * @return void
953
  */
954
+ static public function delete_asset_cache_for_all_posts( $parts = '*' ) {
955
  $cache_dir = self::get_cache_dir();
956
+ $css = glob( $cache_dir['path'] . $parts . '.css' );
957
+ $js = glob( $cache_dir['path'] . $parts . '.js' );
 
958
  if ( is_array( $css ) ) {
959
  array_map( array( fl_builder_filesystem(), 'unlink' ), $css );
960
  }
2922
  static public function get_default_enabled_modules() {
2923
  $default = array_keys( self::$modules );
2924
 
2925
+ $deprecated = self::get_deprecated_modules();
 
 
 
2926
 
2927
  // Remove deprecated modules from the defaults.
2928
  foreach ( $default as $key => $slug ) {
2934
  return array_values( $default );
2935
  }
2936
 
2937
+ /**
2938
+ * @since 2.4.1
2939
+ */
2940
+ static public function get_deprecated_modules() {
2941
+ // These modules are deprecated and disabled by default.
2942
+ $deprecated = array(
2943
+ 'social-buttons',
2944
+ );
2945
+ return $deprecated;
2946
+ }
2947
+
2948
  /**
2949
  * Returns an array of all modules that are enabled.
2950
  *
6013
 
6014
  // glob() will return false on error so cast as an array() just in case.
6015
  foreach ( (array) $templates as $template ) {
6016
+ $basename = basename( $template );
6017
 
6018
+ if ( 'templates.dat' === $basename ) {
6019
+ continue;
6020
+ } elseif ( true !== FL_BUILDER_LITE && 'templates-config.dat' === $basename ) {
6021
  continue;
6022
  }
6023
 
6274
  'type' => 'core',
6275
  'kind' => 'template',
6276
  'content' => ! in_array( $type, array( 'row', 'column', 'module' ) ) ? 'layout' : $type,
6277
+ 'premium' => isset( $template->premium ) ? ! ! $template->premium : false,
6278
  ), $template );
6279
  }
6280
 
6392
  return apply_filters( 'fl_builder_module_templates_data', self::get_template_selector_data( 'module' ) );
6393
  }
6394
 
6395
+ /**
6396
+ * Returns the config for pro modules if it exists.
6397
+ *
6398
+ * @since 2.4
6399
+ * @return object
6400
+ */
6401
+ static public function get_pro_modules_config() {
6402
+ $path = FL_BUILDER_DIR . 'json/modules-config.json';
6403
+ $config = new stdClass;
6404
+
6405
+ if ( file_exists( $path ) ) {
6406
+ $config = json_decode( file_get_contents( $path ) );
6407
+ }
6408
+
6409
+ return $config;
6410
+ }
6411
+
6412
  /**
6413
  * Get color presets.
6414
  *
classes/class-fl-builder-notifications.php CHANGED
@@ -104,7 +104,7 @@ final class FLBuilderNotifications {
104
  $stored_data['read'] = false;
105
  }
106
 
107
- update_option( self::$option, $stored_data );
108
 
109
  } else {
110
  error_log( 'response was not a 200' );
104
  $stored_data['read'] = false;
105
  }
106
 
107
+ update_option( self::$option, $stored_data, false );
108
 
109
  } else {
110
  error_log( 'response was not a 200' );
classes/class-fl-builder-privacy.php CHANGED
@@ -19,7 +19,7 @@ final class FLBuilderPrivacy {
19
 
20
  static public function register_exporter( $exporters ) {
21
  $exporters[] = array(
22
- 'exporter_friendly_name' => __( 'Beaver Builder Plugin' ),
23
  'callback' => array( 'FLBuilderPrivacy', 'exporter' ),
24
  );
25
  return $exporters;
@@ -87,7 +87,7 @@ final class FLBuilderPrivacy {
87
  }
88
 
89
  static public function register_policy() {
90
- wp_add_privacy_policy_content( 'Beaver Builder', __( '<p>In terms of GDPR, Beaver Builder products do not collect any personal information from your users. However some modules such as videos and maps might need you to update your privacy policy accordingly.</p>', 'fl-builder' ) );
91
  }
92
  }
93
  FLBuilderPrivacy::init();
19
 
20
  static public function register_exporter( $exporters ) {
21
  $exporters[] = array(
22
+ 'exporter_friendly_name' => __( 'Beaver Builder Plugin', 'fl-builder' ),
23
  'callback' => array( 'FLBuilderPrivacy', 'exporter' ),
24
  );
25
  return $exporters;
87
  }
88
 
89
  static public function register_policy() {
90
+ wp_add_privacy_policy_content( 'Beaver Builder', sprintf( '<p>%s</p>', __( 'In terms of GDPR, Beaver Builder products do not collect any personal information from your users. However some modules such as videos and maps might need you to update your privacy policy accordingly.', 'fl-builder' ) ) );
91
  }
92
  }
93
  FLBuilderPrivacy::init();
classes/class-fl-builder-service-activecampaign.php CHANGED
@@ -98,7 +98,7 @@ final class FLBuilderServiceActiveCampaign extends FLBuilderService {
98
  'class' => 'fl-builder-service-connect-input',
99
  'type' => 'text',
100
  'label' => __( 'API URL', 'fl-builder' ),
101
- 'help' => __( 'Your API url can be found in your ActiveCampaign account under My Settings > Developer > API.', 'fl-builder' ),
102
  'preview' => array(
103
  'type' => 'none',
104
  ),
98
  'class' => 'fl-builder-service-connect-input',
99
  'type' => 'text',
100
  'label' => __( 'API URL', 'fl-builder' ),
101
+ 'help' => __( 'Your API URL can be found in your ActiveCampaign account under My Settings > Developer > API.', 'fl-builder' ),
102
  'preview' => array(
103
  'type' => 'none',
104
  ),
classes/class-fl-builder-service-groundhogg.php ADDED
@@ -0,0 +1,160 @@