WordPress Page Builder – Beaver Builder - Version 1.8.1

Version Description

Download this release

Release Info

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

Code changes from version 1.7.8 to 1.8.1

Files changed (87) hide show
  1. changelog.txt +76 -27
  2. classes/class-fl-builder-admin-posts.php +24 -5
  3. classes/class-fl-builder-admin-settings.php +100 -178
  4. classes/class-fl-builder-admin.php +110 -179
  5. classes/class-fl-builder-ajax-layout.php +27 -8
  6. classes/class-fl-builder-ajax.php +35 -11
  7. classes/class-fl-builder-export.php +113 -0
  8. classes/class-fl-builder-extensions.php +39 -0
  9. classes/class-fl-builder-fonts.php +5 -1
  10. classes/class-fl-builder-icons.php +5 -0
  11. classes/class-fl-builder-import.php +46 -0
  12. classes/class-fl-builder-importer.php +179 -0
  13. classes/class-fl-builder-loader.php +136 -0
  14. classes/class-fl-builder-loop.php +13 -0
  15. classes/class-fl-builder-model.php +419 -198
  16. classes/class-fl-builder-module.php +4 -2
  17. classes/class-fl-builder-shortcodes.php +1 -0
  18. classes/class-fl-builder-update.php +15 -2
  19. classes/class-fl-builder.php +368 -451
  20. css/fl-builder-admin-settings.css +1 -10
  21. css/fl-builder-export.css +14 -0
  22. css/fl-builder-layout-responsive.css +39 -9
  23. css/fl-builder-layout.css +66 -22
  24. css/fl-builder.css +76 -12
  25. css/fl-builder.min.css +1 -1
  26. css/fl-lightbox.css +30 -0
  27. {classes → extensions/fl-builder-multisite/classes}/class-fl-builder-multisite.php +32 -5
  28. extensions/fl-builder-multisite/fl-builder-multisite.php +13 -0
  29. fl-builder.php +4 -98
  30. img/templates-preview.jpg +0 -0
  31. includes/admin-settings-editing.php +1 -5
  32. includes/admin-settings-upgrade.php +16 -6
  33. includes/admin-settings-welcome.php +24 -11
  34. includes/column-css.php +4 -4
  35. includes/column-settings.php +61 -0
  36. includes/export-filters.php +8 -0
  37. includes/export.php +438 -0
  38. includes/field-time.php +4 -0
  39. includes/field.php +6 -2
  40. includes/layout-settings.php +2 -2
  41. includes/module-settings.php +31 -0
  42. includes/row-css.php +6 -6
  43. includes/row-settings.php +84 -0
  44. includes/row-video.php +16 -1
  45. includes/settings.php +3 -0
  46. includes/strings.php +14 -0
  47. includes/template-selector.php +57 -0
  48. includes/ui-js-config.php +135 -132
  49. includes/ui-js-templates.php +2 -22
  50. includes/ui-panel-module-templates.php +20 -0
  51. includes/ui-panel-row-templates.php +20 -0
  52. includes/ui-panel.php +8 -42
  53. includes/updater-config.php +1 -1
  54. includes/updater/includes/form.php +4 -4
  55. js/fl-builder-admin-settings.js +0 -30
  56. js/fl-builder-export.js +100 -0
  57. js/fl-builder-preview.js +40 -7
  58. js/fl-builder.js +194 -65
  59. js/fl-builder.min.js +5 -5
  60. js/fl-lightbox.js +102 -2
  61. json/font-awesome.json +1 -1
  62. languages/ar.mo +0 -0
  63. languages/cs_CZ.mo +0 -0
  64. languages/da_DK.mo +0 -0
  65. languages/de_DE.mo +0 -0
  66. languages/es_ES.mo +0 -0
  67. languages/fa_IR.mo +0 -0
  68. languages/fi.mo +0 -0
  69. languages/fr_CA.mo +0 -0
  70. languages/fr_FR.mo +0 -0
  71. languages/he_IL.mo +0 -0
  72. languages/hr.mo +0 -0
  73. languages/hu_HU.mo +0 -0
  74. languages/it_IT.mo +0 -0
  75. languages/ja.mo +0 -0
  76. languages/nl_NL.mo +0 -0
  77. languages/no_NO.mo +0 -0
  78. languages/pl_PL.mo +0 -0
  79. languages/pt_BR.mo +0 -0
  80. languages/pt_PT.mo +0 -0
  81. languages/ru_RU.mo +0 -0
  82. languages/sk_SK.mo +0 -0
  83. languages/sl_SL.mo +0 -0
  84. languages/sv_SE.mo +0 -0
  85. languages/th.mo +0 -0
  86. modules/photo/includes/frontend.php +2 -1
  87. modules/rich-text/includes/frontend.php +7 -1
changelog.txt CHANGED
@@ -1,4 +1,79 @@
1
- <h4>1.7.8 - 04/20/2016</h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <p><strong>Bug Fixes</strong></p>
3
  <ul>
4
  <li>Fixed a bug in the Post Carousel and Post Slider modules caused in 1.7.7 that broke the offset setting.</li>
@@ -176,32 +251,6 @@
176
  <li>Fixed a CSS bug with custom column widths on small devices.</li>
177
  </ul>
178
 
179
- <h4>1.7-beta.2 - 1/10/2016</h4>
180
- <p><strong>Enhancements</strong></p>
181
- <ul>
182
- <li>Builder caching is now disabled when WP_DEBUG is set to true.</li>
183
- </ul>
184
- <p><strong>Bug Fixes</strong></p>
185
- <ul>
186
- <li>Fixed a bug with the Subscribe Form module.</li>
187
- <li>Fixed CSS specificity issues with the new builder shortcode.</li>
188
- </ul>
189
-
190
- <h4>1.7-beta.1 - 12/16/2015</h4>
191
- <p><strong>Enhancements</strong></p>
192
- <ul>
193
- <li>Added partial refresh for all rows, columns, and modules. Developers will need to read the custom module docs for info on making their modules compatible with partial refresh.</li>
194
- <li>Added the Layout Settings panel with per-page CSS and JavaScript settings.</li>
195
- <li>Added CSS and JavaScript settings to the Global Settings panel.</li>
196
- <li>Added the Audio module.</li>
197
- <li>Added the Countdown module.</li>
198
- <li>Added new style settings to the Pricing Table module for achieving a variety of different looks.</li>
199
- <li>Added the fl_builder_insert_layout shortcode for inserting builder saved templates, rows, modules anywhere in your posts.</li>
200
- <li>Added the FLBuilder::render_query method for rendering layouts anywhere within a theme's PHP files.</li>
201
- <li>Refactored frontend AJAX actions and rendering to support partial refresh. Developers tapping into those actions may need to update their code.</li>
202
- <li>Optimized loading of the builder UI by concatenating and minifying all core CSS and JavaScript files.</li>
203
- </ul>
204
-
205
  <h4>1.6.4.7 - 1/10/2016</h4>
206
  <p><strong>Enhancements</strong></p>
207
  <ul>
1
+ <h4>1.8.1 - 06/15/2016</h4>
2
+ <p><strong>Bug Fixes</strong></p>
3
+ <ul>
4
+ <li>Fixed a bug with the text editor field stripping line breaks in 1.8.</li>
5
+ <li>Fixed a bug that caused the visual text editor to break in 1.8.</li>
6
+ <li>Fixed a bug with the index.html file in the icons cache folder causing an error.</li>
7
+ <li>Fixed a bug with vertically centered columns also centering content horizontally.</li>
8
+ <li>Fixed a bug with hooking rows via the shortcode breaking the builder UI.</li>
9
+ <li>Fixed a bug with layout templates showing in row/module positions in the content sidebar when using the Agency override feature.</li>
10
+ <li>Fixed a bug with backgrounds, padding, and margins where they were applied to all elements when using the shortcode.</li>
11
+ <li>Fixed a bug with resizing the Testimonials module on large/medium devices.</li>
12
+ <li>Fixed a number of minor CSS bugs.</li>
13
+ <li>Fixed a number of minor issues with the Menu module.</li>
14
+ <li>Fixed editing performance issues with AJAX layout rendering on large pages.</li>
15
+ </ul>
16
+
17
+ <h4>1.8 - 06/07/2016</h4>
18
+ <p>This update adds a number of new features. Be sure to check out <a href="https://www.wpbeaverbuilder.com/beaver-builder-1-8-gordon/">the blog post</a> for detailed info on what was added.</p>
19
+ <p><strong>Enhancements</strong></p>
20
+ <ul>
21
+ <li>Added 16 new home page templates.</li>
22
+ <li>Added the ability for theme authors to load third party templates into all version of the builder (including the lite) using the new Template Data Exporter. Please <a href="https://www.wpbeaverbuilder.com/knowledge-base/theme-author-templates/">read the docs</a> for more info on that.</li>
23
+ <li>Added the ability to export single templates or groups of templates using the WordPress Exporter.</li>
24
+ <li>Added a patch for the WordPress Importer to prevent it from breaking imports in certain situations.</li>
25
+ <li>Added a setting in the advanced tab to show rows/modules/columns based on if a user is logged in, logged out, or never show them (they only appear while editing). You can also choose the capability logged in users must have to see a row/column/module.</li>
26
+ <li>Added a setting in the advanced tab to reverse the column stacking order on smaller devices.</li>
27
+ <li>Added settings to vertically center or top align content in full height rows and equal height columns.</li>
28
+ <li>Added settings to add a video background to a row using external links instead of the media library.</li>
29
+ <li>Added settings in the Icon Group module to choose individual icon colors and link targets.</li>
30
+ <li>Added settings in the Heading module to set the line-height and letter spacing.</li>
31
+ <li>Added settings in the Separator module to set the width and alignment.</li>
32
+ <li>Added a setting to the Accordion module that makes the first item open by default.</li>
33
+ <li>Added a setting in the Posts module to customize the "No Posts Found" message.</li>
34
+ <li>Added settings to all modules with buttons for fading in icons on hover and choosing a hover opacity for transparent backgrounds.</li>
35
+ <li>Added settings to the Contact Form module for customizing the button.</li>
36
+ <li>Made changes to the Contact Form module so the recipient's email address is no longer visible in the markup.</li>
37
+ <li>Captions are now displayed in the Gallery module's lightbox.</li>
38
+ <li>PHP files can now be used to register templates and load template data from the database.</li>
39
+ <li>Added caching to FLBuilderModel::get_user_template_type to cut down on the number of queries it runs.</li>
40
+ <li>The form validation required message is now translatable.</li>
41
+ <li>Empty index files are now added the cache directories to prevent browsing.</li>
42
+ <li>Added a button for resizing settings lightboxes so they fill the screen.</li>
43
+ <li>Added support for oEmbeds in the Text Editor module.</li>
44
+ <li>Changed row and module templates to saved rows and modules.</li>
45
+ <li>Tweaked templates admin settings terminology.</li>
46
+ <li>Tweaked draft and discard button terminology.</li>
47
+ <li>Added CSS/JavaScript to layout settings button and panel.</li>
48
+ <li>Increased size of the publish button.</li>
49
+ <li>Added a setting to collapse inactive items in accordion mode for the Menu module.</li>
50
+ <li>Updated Font Awesome.</li>
51
+ <li>Sticky posts are no longer included when using the fl_builder_insert_layout shortcode.</li>
52
+ <li>Added an above title option for image position in the Posts module.</li>
53
+ </ul>
54
+ <p><strong>Bug Fixes</strong></p>
55
+ <ul>
56
+ <li>Fixed issues with exporting and importing new templates.</li>
57
+ <li>Fixed issues with layout CSS/JS not exporting and importing.</li>
58
+ <li>Fixed incorrect module paths on Windows servers.</li>
59
+ <li>Fixed the alignment setting preview for the Heading module. </li>
60
+ <li>Fixed the incorrect load order of FLBuilder::render_query CSS in IE.</li>
61
+ <li>Fixed RTL issues with the Content Slider and Post Slider modules.</li>
62
+ <li>Fixed an IE11 bug with images that have height:auto in equal height columns.</li>
63
+ <li>Fixed a PHP notice when adding Post Slider and Post Carousel modules to the page.</li>
64
+ <li>Fixed a PHP error when the time field is used inside a nested form.</li>
65
+ <li>Fixed a bug with duplicate rows adding backslashes to text.</li>
66
+ <li>Fixed a bug with nested Tab modules via the fl_builder_insert_layout shortcode.</li>
67
+ <li>Fixed an issue with sticky posts being included when using the fl_builder_insert_layout shortcode.</li>
68
+ <li>Fixed a PHP notice when using the fl_builder_insert_layout shortcode on a 404 page.</li>
69
+ <li>Fixed TinyMCE link editor not closing since WordPress 4.5.</li>
70
+ <li>Fixed a fatal error with the new Template Data Exporter caused by unsupported syntax in certain PHP versions.</li>
71
+ <li>Fixed a PHP warning caused by plugin activation.</li>
72
+ <li>Fixed the display of SVG files in the Photo module.</li>
73
+ <li>Fixed CSS specificity issues in IE when using the fl_builder_render_layout shortcode.</li>
74
+ </ul>
75
+
76
+ <h4>1.7.8 - 04/20/2016</h4>
77
  <p><strong>Bug Fixes</strong></p>
78
  <ul>
79
  <li>Fixed a bug in the Post Carousel and Post Slider modules caused in 1.7.7 that broke the offset setting.</li>
251
  <li>Fixed a CSS bug with custom column widths on small devices.</li>
252
  </ul>
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  <h4>1.6.4.7 - 1/10/2016</h4>
255
  <p><strong>Enhancements</strong></p>
256
  <ul>
classes/class-fl-builder-admin-posts.php CHANGED
@@ -7,6 +7,23 @@
7
  */
8
  final class FLBuilderAdminPosts {
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  /**
11
  * Sets the body class, loads assets and renders the UI
12
  * if we are on a post type that supports the builder.
@@ -14,7 +31,7 @@ final class FLBuilderAdminPosts {
14
  * @since 1.0
15
  * @return void
16
  */
17
- static public function init()
18
  {
19
  global $pagenow;
20
 
@@ -24,9 +41,9 @@ final class FLBuilderAdminPosts {
24
  $screen = get_current_screen();
25
 
26
  if ( in_array( $screen->post_type, $post_types ) ) {
27
- add_filter( 'admin_body_class', 'FLBuilderAdminPosts::body_class', 99 );
28
- add_action( 'admin_enqueue_scripts', 'FLBuilderAdminPosts::styles_scripts' );
29
- add_action( 'edit_form_after_title', 'FLBuilderAdminPosts::render' );
30
  }
31
  }
32
  }
@@ -133,4 +150,6 @@ final class FLBuilderAdminPosts {
133
 
134
  return $location;
135
  }
136
- }
 
 
7
  */
8
  final class FLBuilderAdminPosts {
9
 
10
+ /**
11
+ * Initialize hooks.
12
+ *
13
+ * @since 1.8
14
+ * @return void
15
+ */
16
+ static public function init()
17
+ {
18
+ /* Actions */
19
+ add_action('current_screen', __CLASS__ . '::init_rendering');
20
+
21
+ /* Filters */
22
+ add_filter('redirect_post_location', __CLASS__ . '::redirect_post_location');
23
+ add_filter('page_row_actions', __CLASS__ . '::render_row_actions_link');
24
+ add_filter('post_row_actions', __CLASS__ . '::render_row_actions_link');
25
+ }
26
+
27
  /**
28
  * Sets the body class, loads assets and renders the UI
29
  * if we are on a post type that supports the builder.
31
  * @since 1.0
32
  * @return void
33
  */
34
+ static public function init_rendering()
35
  {
36
  global $pagenow;
37
 
41
  $screen = get_current_screen();
42
 
43
  if ( in_array( $screen->post_type, $post_types ) ) {
44
+ add_filter( 'admin_body_class', __CLASS__ . '::body_class', 99 );
45
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
46
+ add_action( 'edit_form_after_title', __CLASS__ . '::render' );
47
  }
48
  }
49
  }
150
 
151
  return $location;
152
  }
153
+ }
154
+
155
+ FLBuilderAdminPosts::init();
classes/class-fl-builder-admin-settings.php CHANGED
@@ -16,6 +16,17 @@ final class FLBuilderAdminSettings {
16
  */
17
  static public $errors = array();
18
 
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * Adds the admin menu and enqueues CSS/JS if we are on
21
  * the builder admin settings page.
@@ -23,12 +34,16 @@ final class FLBuilderAdminSettings {
23
  * @since 1.0
24
  * @return void
25
  */
26
- static public function init()
27
  {
28
- add_action( 'admin_menu', 'FLBuilderAdminSettings::menu' );
 
 
 
 
29
 
30
  if ( isset( $_REQUEST['page'] ) && 'fl-builder-settings' == $_REQUEST['page'] ) {
31
- add_action( 'admin_enqueue_scripts', 'FLBuilderAdminSettings::styles_scripts' );
32
  self::save();
33
  }
34
  }
@@ -64,7 +79,7 @@ final class FLBuilderAdminSettings {
64
  $title = FLBuilderModel::get_branding();
65
  $cap = 'delete_users';
66
  $slug = 'fl-builder-settings';
67
- $func = 'FLBuilderAdminSettings::render';
68
 
69
  add_submenu_page( 'options-general.php', $title, $title, $cap, $slug, $func );
70
  }
@@ -142,60 +157,66 @@ final class FLBuilderAdminSettings {
142
  */
143
  static public function render_nav_items()
144
  {
145
- $item_data = array(
146
  'welcome' => array(
147
- 'title' => __( 'Welcome', 'fl-builder' ),
148
- 'show' => FLBuilderModel::get_branding() == __( 'Page Builder', 'fl-builder' ) && ( is_network_admin() || ! self::multisite_support() )
 
149
  ),
150
  'license' => array(
151
- 'title' => __( 'License', 'fl-builder' ),
152
- 'show' => FL_BUILDER_LITE !== true && ( is_network_admin() || ! self::multisite_support() )
 
153
  ),
154
  'upgrade' => array(
155
- 'title' => __( 'Upgrade', 'fl-builder' ),
156
- 'show' => FL_BUILDER_LITE === true
 
157
  ),
158
  'modules' => array(
159
- 'title' => __( 'Modules', 'fl-builder' ),
160
- 'show' => true
161
- ),
162
- 'templates' => array(
163
- 'title' => __( 'Templates', 'fl-builder' ),
164
- 'show' => FL_BUILDER_LITE !== true
165
  ),
166
  'post-types' => array(
167
- 'title' => __( 'Post Types', 'fl-builder' ),
168
- 'show' => true
 
169
  ),
170
  'icons' => array(
171
- 'title' => __( 'Icons', 'fl-builder' ),
172
- 'show' => FL_BUILDER_LITE !== true
 
173
  ),
174
  'editing' => array(
175
- 'title' => __( 'Editing', 'fl-builder' ),
176
- 'show' => true
177
- ),
178
- 'branding' => array(
179
- 'title' => __( 'Branding', 'fl-builder' ),
180
- 'show' => self::has_support( 'branding' ) && ( is_network_admin() || ! self::multisite_support() )
181
- ),
182
- 'help-button' => array(
183
- 'title' => __( 'Help Button', 'fl-builder' ),
184
- 'show' => self::has_support( 'help-button' ) && ( is_network_admin() || ! self::multisite_support() )
185
  ),
186
  'cache' => array(
187
- 'title' => __( 'Cache', 'fl-builder' ),
188
- 'show' => true
 
189
  ),
190
  'uninstall' => array(
191
- 'title' => __( 'Uninstall', 'fl-builder' ),
192
- 'show' => is_network_admin() || ! self::multisite_support()
 
193
  ),
194
- );
 
 
195
 
196
  foreach ( $item_data as $key => $data ) {
 
 
 
 
 
 
 
197
  if ( $data['show'] ) {
198
- echo '<li><a href="#' . $key . '">' . $data['title'] . '</a></li>';
199
  }
200
  }
201
  }
@@ -226,9 +247,6 @@ final class FLBuilderAdminSettings {
226
  // Modules
227
  self::render_form( 'modules' );
228
 
229
- // Templates
230
- self::render_form( 'templates' );
231
-
232
  // Post Types
233
  self::render_form( 'post-types' );
234
 
@@ -238,17 +256,14 @@ final class FLBuilderAdminSettings {
238
  // Editing
239
  self::render_form( 'editing' );
240
 
241
- // Branding
242
- self::render_form( 'branding' );
243
-
244
- // Help Button
245
- self::render_form( 'help-button' );
246
-
247
  // Cache
248
  self::render_form( 'cache' );
249
 
250
  // Uninstall
251
  self::render_form( 'uninstall' );
 
 
 
252
  }
253
 
254
  /**
@@ -348,14 +363,14 @@ final class FLBuilderAdminSettings {
348
  }
349
 
350
  self::save_enabled_modules();
351
- self::save_enabled_templates();
352
  self::save_enabled_post_types();
353
  self::save_enabled_icons();
354
  self::save_editing_capability();
355
- self::save_branding();
356
- self::save_help_button();
357
  self::clear_cache();
358
  self::uninstall();
 
 
 
359
  }
360
 
361
  /**
@@ -379,30 +394,6 @@ final class FLBuilderAdminSettings {
379
  }
380
  }
381
 
382
- /**
383
- * Saves the enabled templates.
384
- *
385
- * @since 1.0
386
- * @since 1.5.7 Added the ability to enable the templates admin UI.
387
- * @access private
388
- * @return void
389
- */
390
- static private function save_enabled_templates()
391
- {
392
- if ( isset( $_POST['fl-templates-nonce'] ) && wp_verify_nonce( $_POST['fl-templates-nonce'], 'templates' ) ) {
393
-
394
- $enabled_templates = sanitize_text_field( $_POST['fl-template-settings'] );
395
- $admin_ui_enabled = isset( $_POST['fl-template-admin-ui'] ) ? 1 : 0;
396
-
397
- FLBuilderModel::update_admin_settings_option( '_fl_builder_enabled_templates', $enabled_templates, true );
398
- FLBuilderModel::update_admin_settings_option( '_fl_builder_user_templates_admin', $admin_ui_enabled, true );
399
-
400
- if ( class_exists( 'FLBuilderTemplatesOverride' ) ) {
401
- FLBuilderTemplatesOverride::save_admin_settings();
402
- }
403
- }
404
- }
405
-
406
  /**
407
  * Saves the enabled post types.
408
  *
@@ -560,110 +551,12 @@ final class FLBuilderAdminSettings {
560
  {
561
  if ( isset( $_POST['fl-editing-nonce'] ) && wp_verify_nonce( $_POST['fl-editing-nonce'], 'editing' ) ) {
562
 
563
- $capability = sanitize_text_field( $_POST['fl-editing-capability'] );
564
- $templates_capability = sanitize_text_field( $_POST['fl-global-templates-editing-capability'] );
565
 
566
  FLBuilderModel::update_admin_settings_option( '_fl_builder_editing_capability', $capability, true );
567
- FLBuilderModel::update_admin_settings_option( '_fl_builder_global_templates_editing_capability', $templates_capability, true );
568
- }
569
- }
570
-
571
- /**
572
- * Saves the branding settings.
573
- *
574
- * @since 1.0
575
- * @access private
576
- * @return void
577
- */
578
- static private function save_branding()
579
- {
580
- if ( isset( $_POST['fl-branding-nonce'] ) && wp_verify_nonce( $_POST['fl-branding-nonce'], 'branding' ) ) {
581
-
582
- // Get the plugin branding data.
583
- $branding = wp_kses_post( $_POST['fl-branding'] );
584
- $branding_icon = sanitize_text_field( $_POST['fl-branding-icon'] );
585
-
586
- // Get the theme branding data.
587
- $theme_data = array(
588
- 'name' => wp_kses_post( $_POST['fl-theme-branding-name'] ),
589
- 'description' => wp_kses_post( $_POST['fl-theme-branding-description'] ),
590
- 'company_name' => wp_kses_post( $_POST['fl-theme-branding-company-name'] ),
591
- 'company_url' => sanitize_text_field( $_POST['fl-theme-branding-company-url'] ),
592
- 'screenshot_url' => sanitize_text_field( $_POST['fl-theme-branding-screenshot-url'] ),
593
- );
594
-
595
- // Save the data.
596
- FLBuilderModel::update_admin_settings_option( '_fl_builder_branding', $branding, false );
597
- FLBuilderModel::update_admin_settings_option( '_fl_builder_branding_icon', $branding_icon, false );
598
- FLBuilderModel::update_admin_settings_option( '_fl_builder_theme_branding', $theme_data, false );
599
  }
600
  }
601
 
602
- /**
603
- * Saves the help button settings.
604
- *
605
- * @since 1.0
606
- * @access private
607
- * @return void
608
- */
609
- static private function save_help_button()
610
- {
611
- if ( isset( $_POST['fl-help-button-nonce'] ) && wp_verify_nonce( $_POST['fl-help-button-nonce'], 'help-button' ) ) {
612
-
613
- $settings = FLBuilderModel::get_help_button_defaults();
614
- $settings['enabled'] = isset( $_POST['fl-help-button-enabled'] ) ? true : false;
615
- $settings['tour'] = isset( $_POST['fl-help-tour-enabled'] ) ? true : false;
616
- $settings['video'] = isset( $_POST['fl-help-video-enabled'] ) ? true : false;
617
- $settings['knowledge_base'] = isset( $_POST['fl-knowledge-base-enabled'] ) ? true : false;
618
- $settings['forums'] = isset( $_POST['fl-forums-enabled'] ) ? true : false;
619
-
620
- // Disable everything if the main button is disabled.
621
- if ( ! $settings['enabled'] ) {
622
- $settings['tour'] = false;
623
- $settings['video'] = false;
624
- $settings['knowledge_base'] = false;
625
- $settings['forums'] = false;
626
- }
627
-
628
- // Clean the video embed.
629
- $video_embed = wp_kses( $_POST['fl-help-video-embed'], array(
630
- 'iframe' => array(
631
- 'src' => array(),
632
- 'frameborder' => array(),
633
- 'webkitallowfullscreen' => array(),
634
- 'mozallowfullscreen' => array(),
635
- 'allowfullscreen' => array()
636
- )
637
- ));
638
-
639
- // Save the video embed.
640
- if ( ! empty( $video_embed ) && ! stristr( $video_embed, 'iframe' ) ) {
641
- self::add_error( __( "Error! Please enter an iframe for the video embed code.", 'fl-builder' ) );
642
- }
643
- else if ( ! empty( $video_embed ) ) {
644
- $settings['video_embed'] = $video_embed;
645
- }
646
-
647
- // Save the knowledge base URL.
648
- if ( ! empty( $_POST['fl-knowledge-base-url'] ) ) {
649
- $settings['knowledge_base_url'] = sanitize_text_field( $_POST['fl-knowledge-base-url'] );
650
- }
651
-
652
- // Save the forums URL.
653
- if ( ! empty( $_POST['fl-forums-url'] ) ) {
654
- $settings['forums_url'] = sanitize_text_field( $_POST['fl-forums-url'] );
655
- }
656
-
657
- // Make sure we have at least one help feature enabled.
658
- if ( $settings['enabled'] && ! $settings['tour'] && ! $settings['video'] && ! $settings['knowledge_base'] && ! $settings['forums'] ) {
659
- self::add_error( __( "Error! You must have at least one feature of the help button enabled.", 'fl-builder' ) );
660
- return;
661
- }
662
-
663
- FLBuilderModel::update_admin_settings_option( '_fl_builder_help_button', $settings, false );
664
- }
665
- }
666
-
667
  /**
668
  * Clears the builder cache.
669
  *
@@ -727,12 +620,41 @@ final class FLBuilderAdminSettings {
727
  return;
728
  }
729
  else if ( isset( $_POST['fl-uninstall'] ) && wp_verify_nonce( $_POST['fl-uninstall'], 'uninstall' ) ) {
730
- if ( is_multisite() && class_exists( 'FLBuilderMultisite' ) ) {
731
- FLBuilderMultisite::uninstall();
732
- }
733
- else {
734
- FLBuilderAdmin::uninstall();
735
  }
736
  }
737
  }
738
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  */
17
  static public $errors = array();
18
 
19
+ /**
20
+ * Initializes the admin settings.
21
+ *
22
+ * @since 1.0
23
+ * @return void
24
+ */
25
+ static public function init()
26
+ {
27
+ add_action( 'plugins_loaded', __CLASS__ . '::init_hooks' );
28
+ }
29
+
30
  /**
31
  * Adds the admin menu and enqueues CSS/JS if we are on
32
  * the builder admin settings page.
34
  * @since 1.0
35
  * @return void
36
  */
37
+ static public function init_hooks()
38
  {
39
+ if ( ! is_admin() ) {
40
+ return;
41
+ }
42
+
43
+ add_action( 'admin_menu', __CLASS__ . '::menu' );
44
 
45
  if ( isset( $_REQUEST['page'] ) && 'fl-builder-settings' == $_REQUEST['page'] ) {
46
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
47
  self::save();
48
  }
49
  }
79
  $title = FLBuilderModel::get_branding();
80
  $cap = 'delete_users';
81
  $slug = 'fl-builder-settings';
82
+ $func = __CLASS__ . '::render';
83
 
84
  add_submenu_page( 'options-general.php', $title, $title, $cap, $slug, $func );
85
  }
157
  */
158
  static public function render_nav_items()
159
  {
160
+ $item_data = apply_filters( 'fl_builder_admin_settings_nav_items', array(
161
  'welcome' => array(
162
+ 'title' => __( 'Welcome', 'fl-builder' ),
163
+ 'show' => FLBuilderModel::get_branding() == __( 'Page Builder', 'fl-builder' ) && ( is_network_admin() || ! self::multisite_support() ),
164
+ 'priority' => 50
165
  ),
166
  'license' => array(
167
+ 'title' => __( 'License', 'fl-builder' ),
168
+ 'show' => FL_BUILDER_LITE !== true && ( is_network_admin() || ! self::multisite_support() ),
169
+ 'priority' => 100
170
  ),
171
  'upgrade' => array(
172
+ 'title' => __( 'Upgrade', 'fl-builder' ),
173
+ 'show' => FL_BUILDER_LITE === true,
174
+ 'priority' => 200
175
  ),
176
  'modules' => array(
177
+ 'title' => __( 'Modules', 'fl-builder' ),
178
+ 'show' => true,
179
+ 'priority' => 300
 
 
 
180
  ),
181
  'post-types' => array(
182
+ 'title' => __( 'Post Types', 'fl-builder' ),
183
+ 'show' => true,
184
+ 'priority' => 400
185
  ),
186
  'icons' => array(
187
+ 'title' => __( 'Icons', 'fl-builder' ),
188
+ 'show' => FL_BUILDER_LITE !== true,
189
+ 'priority' => 500
190
  ),
191
  'editing' => array(
192
+ 'title' => __( 'Editing', 'fl-builder' ),
193
+ 'show' => true,
194
+ 'priority' => 600
 
 
 
 
 
 
 
195
  ),
196
  'cache' => array(
197
+ 'title' => __( 'Cache', 'fl-builder' ),
198
+ 'show' => true,
199
+ 'priority' => 700
200
  ),
201
  'uninstall' => array(
202
+ 'title' => __( 'Uninstall', 'fl-builder' ),
203
+ 'show' => is_network_admin() || ! self::multisite_support(),
204
+ 'priority' => 800
205
  ),
206
+ ) );
207
+
208
+ $sorted_data = array();
209
 
210
  foreach ( $item_data as $key => $data ) {
211
+ $data['key'] = $key;
212
+ $sorted_data[ $data['priority'] ] = $data;
213
+ }
214
+
215
+ ksort( $sorted_data );
216
+
217
+ foreach ( $sorted_data as $data ) {
218
  if ( $data['show'] ) {
219
+ echo '<li><a href="#' . $data['key'] . '">' . $data['title'] . '</a></li>';
220
  }
221
  }
222
  }
247
  // Modules
248
  self::render_form( 'modules' );
249
 
 
 
 
250
  // Post Types
251
  self::render_form( 'post-types' );
252
 
256
  // Editing
257
  self::render_form( 'editing' );
258
 
 
 
 
 
 
 
259
  // Cache
260
  self::render_form( 'cache' );
261
 
262
  // Uninstall
263
  self::render_form( 'uninstall' );
264
+
265
+ // Let extensions hook into form rendering.
266
+ do_action( 'fl_builder_admin_settings_render_forms' );
267
  }
268
 
269
  /**
363
  }
364
 
365
  self::save_enabled_modules();
 
366
  self::save_enabled_post_types();
367
  self::save_enabled_icons();
368
  self::save_editing_capability();
 
 
369
  self::clear_cache();
370
  self::uninstall();
371
+
372
+ // Let extensions hook into saving.
373
+ do_action( 'fl_builder_admin_settings_save' );
374
  }
375
 
376
  /**
394
  }
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  /**
398
  * Saves the enabled post types.
399
  *
551
  {
552
  if ( isset( $_POST['fl-editing-nonce'] ) && wp_verify_nonce( $_POST['fl-editing-nonce'], 'editing' ) ) {
553
 
554
+ $capability = sanitize_text_field( $_POST['fl-editing-capability'] );
 
555
 
556
  FLBuilderModel::update_admin_settings_option( '_fl_builder_editing_capability', $capability, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  }
558
  }
559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  /**
561
  * Clears the builder cache.
562
  *
620
  return;
621
  }
622
  else if ( isset( $_POST['fl-uninstall'] ) && wp_verify_nonce( $_POST['fl-uninstall'], 'uninstall' ) ) {
623
+
624
+ $uninstall = apply_filters( 'fl_builder_uninstall', true );
625
+
626
+ if ( $uninstall ) {
627
+ FLBuilderAdmin::uninstall();
628
  }
629
  }
630
  }
631
+
632
+ /**
633
+ * @since 1.0
634
+ * @deprecated 1.8
635
+ */
636
+ static private function save_help_button()
637
+ {
638
+ _deprecated_function( __METHOD__, '1.8', 'FLBuilderWhiteLabel::save_help_button_settings()' );
639
+ }
640
+
641
+ /**
642
+ * @since 1.0
643
+ * @deprecated 1.8
644
+ */
645
+ static private function save_branding()
646
+ {
647
+ _deprecated_function( __METHOD__, '1.8', 'FLBuilderWhiteLabel::save_branding_settings()' );
648
+ }
649
+
650
+ /**
651
+ * @since 1.0
652
+ * @deprecated 1.8
653
+ */
654
+ static private function save_enabled_templates()
655
+ {
656
+ _deprecated_function( __METHOD__, '1.8', 'FLBuilderUserTemplatesAdmin::save_settings()' );
657
+ }
658
+ }
659
+
660
+ FLBuilderAdminSettings::init();
classes/class-fl-builder-admin.php CHANGED
@@ -7,6 +7,26 @@
7
  */
8
  final class FLBuilderAdmin {
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  /**
11
  * Called on plugin activation and checks to see if the correct
12
  * WordPress version is installed and multisite is supported. If
@@ -20,43 +40,28 @@ final class FLBuilderAdmin {
20
  global $wp_version;
21
 
22
  // Check for WordPress 3.5 and above.
23
- if(version_compare($wp_version, '3.5', '>=')) {
 
 
 
 
 
 
 
 
24
 
25
  // Check for multisite.
26
  if(is_multisite()) {
27
-
28
- // Init multisite support.
29
- self::init_classes();
30
- self::init_multisite();
31
-
32
- // This version has multisite support.
33
- if(class_exists('FLBuilderMultisite')) {
34
-
35
- if(is_network_admin()) {
36
- FLBuilderMultisite::install();
37
- }
38
- else {
39
- self::install();
40
- }
41
- }
42
- // This version doesn't have multisite support.
43
- else {
44
- $url = FLBuilderModel::get_upgrade_url( array( 'utm_source' => 'external', 'utm_medium' => 'builder', 'utm_campaign' => 'no-multisite-support' ) );
45
- self::show_activate_error( sprintf( __( 'This version of the <strong>Page Builder</strong> plugin is not compatible with WordPress Multisite. <a%s>Please upgrade</a> to the Multisite version of this plugin.', 'fl-builder' ), ' href="' . $url . '" target="_blank"' ) );
46
- }
47
  }
48
- // No multisite, standard install.
49
- else {
50
- self::install();
51
- }
52
- }
53
- // Wrong WordPress version.
54
- else {
55
- self::show_activate_error(__('The <strong>Page Builder</strong> plugin requires WordPress version 3.5 or greater. Please update WordPress before activating the plugin.', 'fl-builder'));
56
  }
57
-
58
- // Success! Trigger the activation notice.
59
- update_site_option('_fl_builder_activation_admin_notice', true);
60
  }
61
 
62
  /**
@@ -75,19 +80,44 @@ final class FLBuilderAdmin {
75
  }
76
 
77
  /**
78
- * Sets the action to show the activation success message.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  *
80
  * @since 1.0
81
  * @return void
82
  */
83
  static public function show_activate_notice()
84
  {
85
- $notice = get_site_option('_fl_builder_activation_admin_notice');
 
 
 
 
 
 
86
 
87
- if($notice) {
88
- add_action('admin_notices', 'FLBuilderAdmin::activate_notice');
89
- add_action('network_admin_notices', 'FLBuilderAdmin::activate_notice');
90
- delete_site_option('_fl_builder_activation_admin_notice');
 
 
 
 
91
  }
92
  }
93
 
@@ -99,24 +129,19 @@ final class FLBuilderAdmin {
99
  */
100
  static public function activate_notice()
101
  {
102
- if ( class_exists('FLBuilderMultisiteSettings') && is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
103
- $href = esc_url( network_admin_url( '/settings.php?page=fl-builder-multisite-settings' ) );
104
- }
105
- else {
106
- $href = esc_url( admin_url( '/options-general.php?page=fl-builder-settings' ) );
107
- }
108
-
109
  if ( FL_BUILDER_LITE !== true ) {
110
- $href .= '#license';
111
  $message = __( 'Page Builder activated! <a%s>Click here</a> to enable remote updates.', 'fl-builder' );
112
  }
113
  else {
114
- $href .= '#welcome';
115
  $message = __( 'Page Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
116
  }
117
 
 
 
118
  echo '<div class="updated" style="background: #d3ebc1;">';
119
- echo '<p><strong>' . sprintf( $message, ' href="' . esc_url( $href ) . '"' ) . '</strong></p>';
120
  echo '</div>';
121
  }
122
 
@@ -141,194 +166,100 @@ final class FLBuilderAdmin {
141
  }
142
 
143
  /**
144
- * Initializes builder logic for wp-admin.
145
  *
146
  * @since 1.0
147
- * @return void
 
148
  */
149
- static public function init()
150
  {
151
- self::init_classes();
152
- self::init_settings();
153
- self::init_multisite();
154
- self::init_templates();
155
- self::show_activate_notice();
 
156
  }
157
 
158
  /**
159
- * Loads builder classes if they exist.
160
- *
161
  * @since 1.0
162
- * @return void
163
  */
164
  static public function init_classes()
165
  {
166
- $templates_class = FL_BUILDER_DIR . 'classes/class-fl-builder-template-settings.php';
167
- $overrides_class = FL_BUILDER_DIR . 'classes/class-fl-builder-templates-override.php';
168
- $ms_class = FL_BUILDER_DIR . 'classes/class-fl-builder-multisite.php';
169
- $ms_settings_class = FL_BUILDER_DIR . 'classes/class-fl-builder-multisite-settings.php';
170
-
171
- if(file_exists($templates_class)) {
172
- require_once $templates_class;
173
- }
174
- if(file_exists($overrides_class)) {
175
- require_once $overrides_class;
176
- }
177
- if(is_multisite()) {
178
-
179
- if(file_exists($ms_class)) {
180
- require_once $ms_class;
181
- }
182
- if(file_exists($ms_settings_class)) {
183
- require_once $ms_settings_class;
184
- }
185
- }
186
-
187
- require_once FL_BUILDER_DIR . 'classes/class-fl-builder-admin-settings.php';
188
  }
189
 
190
  /**
191
- * Initializes the builder admin settings page.
192
- *
193
  * @since 1.0
194
- * @return void
195
  */
196
  static public function init_settings()
197
  {
198
- FLBuilderAdminSettings::init();
199
  }
200
 
201
  /**
202
- * Initializes the builder network admin settings page
203
- * and additional multisite logic.
204
- *
205
  * @since 1.0
206
- * @return void
207
  */
208
  static public function init_multisite()
209
  {
210
- if(is_multisite()) {
211
-
212
- if(class_exists('FLBuilderMultisite')) {
213
- FLBuilderMultisite::init();
214
- }
215
- if(class_exists('FLBuilderMultisiteSettings')) {
216
- FLBuilderMultisiteSettings::init();
217
- }
218
- }
219
  }
220
 
221
  /**
222
- * Initializes the interface for core builder templates.
223
- *
224
  * @since 1.0
225
- * @return void
226
  */
227
  static public function init_templates()
228
  {
229
- if(class_exists('FLBuilderTemplates')) {
230
- FLBuilderTemplates::init();
231
- }
232
  }
233
 
234
  /**
235
- * Renders the link for the row actions on the plugins page.
236
- *
237
  * @since 1.0
238
- * @param array $actions An array of row action links.
239
- * @return array
240
- */
241
- static public function render_plugin_action_links($actions)
242
- {
243
- if(FL_BUILDER_LITE === true) {
244
- $url = FLBuilderModel::get_upgrade_url( array( 'utm_source' => 'external', 'utm_medium' => 'builder', 'utm_campaign' => 'plugins-page' ) );
245
- $actions[] = '<a href="' . $url . '" style="color:#3db634;" target="_blank">' . _x( 'Upgrade', 'Plugin action link label.', 'fl-builder' ) . '</a>';
246
- }
247
-
248
- return $actions;
249
- }
250
-
251
- /**
252
- * White labels the builder on the plugins page.
253
- *
254
- * @since 1.0
255
- * @param array $plugins An array data for each plugin.
256
- * @return array
257
  */
258
  static public function white_label_plugins_page($plugins)
259
  {
260
- $default = __( 'Page Builder', 'fl-builder' );
261
- $branding = FLBuilderModel::get_branding();
262
- $key = FLBuilderModel::plugin_basename();
263
-
264
- if ( isset( $plugins[ $key ] ) && $branding != $default ) {
265
- $plugins[ $key ]['Name'] = $branding;
266
- $plugins[ $key ]['Title'] = $branding;
267
- $plugins[ $key ]['Author'] = '';
268
- $plugins[ $key ]['AuthorName'] = '';
269
- $plugins[ $key ]['PluginURI'] = '';
270
  }
271
 
272
  return $plugins;
273
  }
274
 
275
  /**
276
- * White labels the builder theme on the themes page.
277
- *
278
  * @since 1.6.4.3
279
- * @param array $themes An array data for each theme.
280
- * @return array
281
  */
282
  static public function white_label_themes_page( $themes )
283
  {
284
- if ( isset( $themes['bb-theme'] ) ) {
285
-
286
- $theme_data = FLBuilderModel::get_theme_branding();
287
-
288
- if ( ! empty( $theme_data['name'] ) ) {
289
-
290
- $themes['bb-theme']['name'] = $theme_data['name'];
291
-
292
- foreach ( $themes as $theme_key => $theme ) {
293
- if ( isset( $theme['parent'] ) && $theme['parent'] == 'Beaver Builder Theme' ) {
294
- $themes[ $theme_key ]['parent'] = $theme_data['name'];
295
- }
296
- }
297
- }
298
- if ( ! empty( $theme_data['description'] ) ) {
299
- $themes['bb-theme']['description'] = $theme_data['description'];
300
- }
301
- if ( ! empty( $theme_data['company_name'] ) ) {
302
- $company_url = empty( $theme_data['company_url'] ) ? '#' : $theme_data['company_url'];
303
- $themes['bb-theme']['author'] = $theme_data['company_name'];
304
- $themes['bb-theme']['authorAndUri'] = '<a href="' . $company_url . '">' . $theme_data['company_name'] . '</a>';
305
- }
306
- if ( ! empty( $theme_data['screenshot_url'] ) ) {
307
- $themes['bb-theme']['screenshot'] = array( $theme_data['screenshot_url'] );
308
- }
309
  }
310
 
311
  return $themes;
312
  }
313
 
314
  /**
315
- * White labels the builder theme using the gettext filter
316
- * to cover areas that we can't access like the Customizer.
317
- *
318
  * @since 1.6.4.4
319
- * @return string
320
  */
321
  static public function white_label_theme_gettext( $text )
322
  {
323
- if ( is_admin() && 'Beaver Builder Theme' == $text ) {
324
-
325
- $theme_data = FLBuilderModel::get_theme_branding();
326
-
327
- if ( ! empty( $theme_data['name'] ) ) {
328
- $text = $theme_data['name'];
329
- }
330
- }
331
-
332
- return $text;
333
  }
334
- }
 
 
7
  */
8
  final class FLBuilderAdmin {
9
 
10
+ /**
11
+ * Initialize hooks.
12
+ *
13
+ * @since 1.8
14
+ * @return void
15
+ */
16
+ static public function init()
17
+ {
18
+ $basename = plugin_basename( FL_BUILDER_FILE );
19
+
20
+ // Activation
21
+ register_activation_hook( FL_BUILDER_FILE, __CLASS__ . '::activate' );
22
+
23
+ // Actions
24
+ add_action( 'admin_init', __CLASS__ . '::show_activate_notice' );
25
+
26
+ // Filters
27
+ add_filter( 'plugin_action_links_' . $basename, __CLASS__ . '::render_plugin_action_links' );
28
+ }
29
+
30
  /**
31
  * Called on plugin activation and checks to see if the correct
32
  * WordPress version is installed and multisite is supported. If
40
  global $wp_version;
41
 
42
  // Check for WordPress 3.5 and above.
43
+ if(!version_compare($wp_version, '3.5', '>=')) {
44
+ self::show_activate_error(__('The <strong>Page Builder</strong> plugin requires WordPress version 3.5 or greater. Please update WordPress before activating the plugin.', 'fl-builder'));
45
+ }
46
+
47
+ // Allow extensions to hook activation.
48
+ $activate = apply_filters( 'fl_builder_activate', true );
49
+
50
+ // Should we continue with activation?
51
+ if ( $activate ) {
52
 
53
  // Check for multisite.
54
  if(is_multisite()) {
55
+ $url = FLBuilderModel::get_upgrade_url( array( 'utm_medium' => 'bb-pro', 'utm_source' => 'plugins-admin-page', 'utm_campaign' => 'no-multisite-support' ) );
56
+ self::show_activate_error( sprintf( __( 'This version of the <strong>Page Builder</strong> plugin is not compatible with WordPress Multisite. <a%s>Please upgrade</a> to the Multisite version of this plugin.', 'fl-builder' ), ' href="' . $url . '" target="_blank"' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
+
59
+ // Success! Run the install.
60
+ self::install();
61
+
62
+ // Trigger the activation notice.
63
+ self::trigger_activate_notice();
 
 
64
  }
 
 
 
65
  }
66
 
67
  /**
80
  }
81
 
82
  /**
83
+ * Sets the transient that triggers the activation notice
84
+ * or welcome page redirect.
85
+ *
86
+ * @since 1.8
87
+ * @return void
88
+ */
89
+ static public function trigger_activate_notice()
90
+ {
91
+ if ( current_user_can( 'delete_users' ) ) {
92
+ set_transient( '_fl_builder_activation_admin_notice', true, 30 );
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Shows the activation success message or redirects to the
98
+ * welcome page.
99
  *
100
  * @since 1.0
101
  * @return void
102
  */
103
  static public function show_activate_notice()
104
  {
105
+ // Bail if no activation transient is set.
106
+ if ( ! get_transient( '_fl_builder_activation_admin_notice' ) ) {
107
+ return;
108
+ }
109
+
110
+ // Delete the activation transient.
111
+ delete_transient( '_fl_builder_activation_admin_notice' );
112
 
113
+ if ( isset( $_GET['activate-multi'] ) || is_multisite() ) {
114
+ // Show the notice if we are activating multiple plugins or on multisite.
115
+ add_action('admin_notices', __CLASS__ . '::activate_notice');
116
+ add_action('network_admin_notices', __CLASS__ . '::activate_notice');
117
+ }
118
+ else {
119
+ // Redirect to the welcome page.
120
+ wp_safe_redirect( add_query_arg( array( 'page' => 'fl-builder-settings' ), admin_url( 'options-general.php' ) ) );
121
  }
122
  }
123
 
129
  */
130
  static public function activate_notice()
131
  {
 
 
 
 
 
 
 
132
  if ( FL_BUILDER_LITE !== true ) {
133
+ $hash = '#license';
134
  $message = __( 'Page Builder activated! <a%s>Click here</a> to enable remote updates.', 'fl-builder' );
135
  }
136
  else {
137
+ $hash = '#welcome';
138
  $message = __( 'Page Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
139
  }
140
 
141
+ $url = apply_filters( 'fl_builder_activate_redirect_url', admin_url( '/options-general.php?page=fl-builder-settings' . $hash ) );
142
+
143
  echo '<div class="updated" style="background: #d3ebc1;">';
144
+ echo '<p><strong>' . sprintf( $message, ' href="' . esc_url( $url ) . '"' ) . '</strong></p>';
145
  echo '</div>';
146
  }
147
 
166
  }
167
 
168
  /**
169
+ * Renders the link for the row actions on the plugins page.
170
  *
171
  * @since 1.0
172
+ * @param array $actions An array of row action links.
173
+ * @return array
174
  */
175
+ static public function render_plugin_action_links($actions)
176
  {
177
+ if(FL_BUILDER_LITE === true) {
178
+ $url = FLBuilderModel::get_upgrade_url( array( 'utm_medium' => 'bb-lite', 'utm_source' => 'plugins-admin-page', 'utm_campaign' => 'plugins-admin-upgrade' ) );
179
+ $actions[] = '<a href="' . $url . '" style="color:#3db634;" target="_blank">' . _x( 'Upgrade', 'Plugin action link label.', 'fl-builder' ) . '</a>';
180
+ }
181
+
182
+ return $actions;
183
  }
184
 
185
  /**
 
 
186
  * @since 1.0
187
+ * @deprecated 1.8
188
  */
189
  static public function init_classes()
190
  {
191
+ _deprecated_function( __METHOD__, '1.8' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
 
194
  /**
 
 
195
  * @since 1.0
196
+ * @deprecated 1.8
197
  */
198
  static public function init_settings()
199
  {
200
+ _deprecated_function( __METHOD__, '1.8' );
201
  }
202
 
203
  /**
 
 
 
204
  * @since 1.0
205
+ * @deprecated 1.8
206
  */
207
  static public function init_multisite()
208
  {
209
+ _deprecated_function( __METHOD__, '1.8' );
 
 
 
 
 
 
 
 
210
  }
211
 
212
  /**
 
 
213
  * @since 1.0
214
+ * @deprecated 1.8
215
  */
216
  static public function init_templates()
217
  {
218
+ _deprecated_function( __METHOD__, '1.8' );
 
 
219
  }
220
 
221
  /**
 
 
222
  * @since 1.0
223
+ * @deprecated 1.8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  */
225
  static public function white_label_plugins_page($plugins)
226
  {
227
+ _deprecated_function( __METHOD__, '1.8', 'FLBuilderWhiteLabel::plugins_page()' );
228
+
229
+ if ( class_exists( 'FLBuilderWhiteLabel' ) ) {
230
+ return FLBuilderWhiteLabel::plugins_page( $plugins );
 
 
 
 
 
 
231
  }
232
 
233
  return $plugins;
234
  }
235
 
236
  /**
 
 
237
  * @since 1.6.4.3
238
+ * @deprecated 1.8
 
239
  */
240
  static public function white_label_themes_page( $themes )
241
  {
242
+ _deprecated_function( __METHOD__, '1.8', 'FLBuilderWhiteLabel::themes_page()' );
243
+
244
+ if ( class_exists( 'FLBuilderWhiteLabel' ) ) {
245
+ return FLBuilderWhiteLabel::themes_page( $themes );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
247
 
248
  return $themes;
249
  }
250
 
251
  /**
 
 
 
252
  * @since 1.6.4.4
253
+ * @deprecated 1.8
254
  */
255
  static public function white_label_theme_gettext( $text )
256
  {
257
+ if ( class_exists( 'FLBuilderWhiteLabel' ) ) {
258
+ return FLBuilderWhiteLabel::theme_gettext( $text );
259
+ }
260
+
261
+ return $text;
 
 
 
 
 
262
  }
263
+ }
264
+
265
+ FLBuilderAdmin::init();
classes/class-fl-builder-ajax-layout.php CHANGED
@@ -31,7 +31,7 @@ final class FLBuilderAJAXLayout {
31
  FLBuilderModel::update_post_data( 'node_id', $node_id );
32
  }
33
 
34
- // Render CSS and JS assets.
35
  FLBuilder::render_assets();
36
 
37
  // Register scripts needed for shortcodes and widgets.
@@ -72,15 +72,21 @@ final class FLBuilderAJAXLayout {
72
  * @param string $cols The type of column layout to use.
73
  * @param int $position The position of the new row in the layout.
74
  * @param string $template_id The ID of a row template to render.
 
75
  * @return array
76
  */
77
- static public function render_new_row( $cols = '1-col', $position = false, $template_id = null )
78
  {
79
  // Add a row template?
80
- if ( $template_id ) {
81
 
82
- // Add the row template.
83
- $row = FLBuilderModel::apply_node_template( $template_id, null, $position );
 
 
 
 
 
84
 
85
  // Return the response.
86
  return self::render( $row->node );
@@ -173,13 +179,21 @@ final class FLBuilderAJAXLayout {
173
  * @param int $position The new module position.
174
  * @param string $type The type of module.
175
  * @param string $template_id The ID of a module template to render.
 
176
  * @return array
177
  */
178
- static public function render_new_module( $parent_id, $position = false, $type = null, $template_id = null )
179
  {
180
  // Add a module template?
181
- if ( $template_id ) {
182
- $module = FLBuilderModel::apply_node_template( $template_id, $parent_id, $position );
 
 
 
 
 
 
 
183
  }
184
  // Add a standard module.
185
  else {
@@ -463,6 +477,11 @@ final class FLBuilderAJAXLayout {
463
  */
464
  static private function register_scripts()
465
  {
 
 
 
 
 
466
  ob_start();
467
  do_action( 'wp_enqueue_scripts' );
468
  ob_end_clean();
31
  FLBuilderModel::update_post_data( 'node_id', $node_id );
32
  }
33
 
34
+ // Render the draft layout CSS that will be passed back.
35
  FLBuilder::render_assets();
36
 
37
  // Register scripts needed for shortcodes and widgets.
72
  * @param string $cols The type of column layout to use.
73
  * @param int $position The position of the new row in the layout.
74
  * @param string $template_id The ID of a row template to render.
75
+ * @param string $template_type The type of template. Either "user" or "core".
76
  * @return array
77
  */
78
+ static public function render_new_row( $cols = '1-col', $position = false, $template_id = null, $template_type = 'user' )
79
  {
80
  // Add a row template?
81
+ if ( null !== $template_id ) {
82
 
83
+ if ( 'core' == $template_type ) {
84
+ $template = FLBuilderModel::get_template( $template_id, 'row' );
85
+ $row = FLBuilderModel::apply_node_template( $template_id, null, $position, $template );
86
+ }
87
+ else {
88
+ $row = FLBuilderModel::apply_node_template( $template_id, null, $position );
89
+ }
90
 
91
  // Return the response.
92
  return self::render( $row->node );
179
  * @param int $position The new module position.
180
  * @param string $type The type of module.
181
  * @param string $template_id The ID of a module template to render.
182
+ * @param string $template_type The type of template. Either "user" or "core".
183
  * @return array
184
  */
185
+ static public function render_new_module( $parent_id, $position = false, $type = null, $template_id = null, $template_type = 'user' )
186
  {
187
  // Add a module template?
188
+ if ( null !== $template_id ) {
189
+
190
+ if ( 'core' == $template_type ) {
191
+ $template = FLBuilderModel::get_template( $template_id, 'module' );
192
+ $module = FLBuilderModel::apply_node_template( $template_id, $parent_id, $position, $template );
193
+ }
194
+ else {
195
+ $module = FLBuilderModel::apply_node_template( $template_id, $parent_id, $position );
196
+ }
197
  }
198
  // Add a standard module.
199
  else {
477
  */
478
  static private function register_scripts()
479
  {
480
+ // Running these isn't necessary and can cause performance issues.
481
+ remove_action( 'wp_enqueue_scripts', 'FLBuilder::register_layout_styles_scripts' );
482
+ remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_ui_styles_scripts' );
483
+ remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_all_layouts_styles_scripts' );
484
+
485
  ob_start();
486
  do_action( 'wp_enqueue_scripts' );
487
  ob_end_clean();
classes/class-fl-builder-ajax.php CHANGED
@@ -22,12 +22,23 @@ final class FLBuilderAJAX {
22
  static private $actions = array();
23
 
24
  /**
25
- * Initializes builder AJAX.
26
  *
27
- * @since 1.7
28
  * @return void
29
  */
30
  static public function init()
 
 
 
 
 
 
 
 
 
 
 
31
  {
32
  self::add_actions();
33
  self::call_action();
@@ -51,6 +62,20 @@ final class FLBuilderAJAX {
51
  );
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /**
55
  * Adds all callable AJAX actions.
56
  *
@@ -62,14 +87,12 @@ final class FLBuilderAJAX {
62
  {
63
  // FLBuilder
64
  self::add_action( 'render_settings_form', 'FLBuilder::render_settings_form', array( 'type', 'settings' ) );
65
- self::add_action( 'render_node_template_settings', 'FLBuilder::render_node_template_settings', array( 'node_id' ) );
66
  self::add_action( 'render_row_settings', 'FLBuilder::render_row_settings', array( 'node_id' ) );
67
  self::add_action( 'render_column_settings', 'FLBuilder::render_column_settings', array( 'node_id' ) );
68
  self::add_action( 'render_module_settings', 'FLBuilder::render_module_settings', array( 'node_id', 'type', 'parent_id' ) );
69
  self::add_action( 'render_layout_settings', 'FLBuilder::render_layout_settings' );
70
  self::add_action( 'render_global_settings', 'FLBuilder::render_global_settings' );
71
  self::add_action( 'render_template_selector', 'FLBuilder::render_template_selector' );
72
- self::add_action( 'render_user_template_settings', 'FLBuilder::render_user_template_settings' );
73
  self::add_action( 'render_icon_selector', 'FLBuilder::render_icon_selector' );
74
 
75
  // FLBuilderModel
@@ -85,11 +108,7 @@ final class FLBuilderAJAX {
85
  self::add_action( 'save_color_presets', 'FLBuilderModel::save_color_presets', array( 'presets' ) );
86
  self::add_action( 'duplicate_post', 'FLBuilderModel::duplicate_post' );
87
  self::add_action( 'duplicate_wpml_layout', 'FLBuilderModel::duplicate_wpml_layout', array( 'original_post_id', 'post_id' ) );
88
- self::add_action( 'save_user_template', 'FLBuilderModel::save_user_template', array( 'settings' ) );
89
- self::add_action( 'delete_user_template', 'FLBuilderModel::delete_user_template', array( 'template_id' ) );
90
  self::add_action( 'apply_user_template', 'FLBuilderModel::apply_user_template', array( 'template_id', 'append' ) );
91
- self::add_action( 'save_node_template', 'FLBuilderModel::save_node_template', array( 'node_id', 'settings' ) );
92
- self::add_action( 'delete_node_template', 'FLBuilderModel::delete_node_template', array( 'template_id' ) );
93
  self::add_action( 'apply_template', 'FLBuilderModel::apply_template', array( 'template_id', 'append' ) );
94
  self::add_action( 'save_layout', 'FLBuilderModel::save_layout' );
95
  self::add_action( 'save_draft', 'FLBuilderModel::save_draft' );
@@ -98,11 +117,11 @@ final class FLBuilderAJAX {
98
 
99
  // FLBuilderAJAXLayout
100
  self::add_action( 'render_layout', 'FLBuilderAJAXLayout::render' );
101
- self::add_action( 'render_new_row', 'FLBuilderAJAXLayout::render_new_row', array( 'cols', 'position', 'template_id' ) );
102
  self::add_action( 'copy_row', 'FLBuilderAJAXLayout::copy_row', array( 'node_id' ) );
103
  self::add_action( 'render_new_column_group', 'FLBuilderAJAXLayout::render_new_column_group', array( 'node_id', 'cols', 'position' ) );
104
  self::add_action( 'render_new_column', 'FLBuilderAJAXLayout::render_new_column', array( 'node_id', 'insert' ) );
105
- self::add_action( 'render_new_module', 'FLBuilderAJAXLayout::render_new_module', array( 'parent_id', 'position', 'type', 'template_id' ) );
106
  self::add_action( 'copy_module', 'FLBuilderAJAXLayout::copy_module', array( 'node_id' ) );
107
 
108
  // FLBuilderServices
@@ -162,6 +181,9 @@ final class FLBuilderAJAX {
162
  return;
163
  }
164
 
 
 
 
165
  // Make sure the action exists.
166
  if ( ! isset( self::$actions[ $action ] ) ) {
167
  return;
@@ -221,4 +243,6 @@ final class FLBuilderAJAX {
221
 
222
  return true;
223
  }
224
- }
 
 
22
  static private $actions = array();
23
 
24
  /**
25
+ * Initializes hooks.
26
  *
27
+ * @since 1.8
28
  * @return void
29
  */
30
  static public function init()
31
+ {
32
+ add_action( 'wp', __CLASS__ . '::run' );
33
+ }
34
+
35
+ /**
36
+ * Runs builder's frontend AJAX.
37
+ *
38
+ * @since 1.7
39
+ * @return void
40
+ */
41
+ static public function run()
42
  {
43
  self::add_actions();
44
  self::call_action();
62
  );
63
  }
64
 
65
+ /**
66
+ * Removes an AJAX action.
67
+ *
68
+ * @since 1.8
69
+ * @param string $action The action to remove.
70
+ * @return void
71
+ */
72
+ static public function remove_action( $action )
73
+ {
74
+ if ( isset( self::$actions[ $action ] ) ) {
75
+ unset( self::$actions[ $action ] );
76
+ }
77
+ }
78
+
79
  /**
80
  * Adds all callable AJAX actions.
81
  *
87
  {
88
  // FLBuilder
89
  self::add_action( 'render_settings_form', 'FLBuilder::render_settings_form', array( 'type', 'settings' ) );
 
90
  self::add_action( 'render_row_settings', 'FLBuilder::render_row_settings', array( 'node_id' ) );
91
  self::add_action( 'render_column_settings', 'FLBuilder::render_column_settings', array( 'node_id' ) );
92
  self::add_action( 'render_module_settings', 'FLBuilder::render_module_settings', array( 'node_id', 'type', 'parent_id' ) );
93
  self::add_action( 'render_layout_settings', 'FLBuilder::render_layout_settings' );
94
  self::add_action( 'render_global_settings', 'FLBuilder::render_global_settings' );
95
  self::add_action( 'render_template_selector', 'FLBuilder::render_template_selector' );
 
96
  self::add_action( 'render_icon_selector', 'FLBuilder::render_icon_selector' );
97
 
98
  // FLBuilderModel
108
  self::add_action( 'save_color_presets', 'FLBuilderModel::save_color_presets', array( 'presets' ) );
109
  self::add_action( 'duplicate_post', 'FLBuilderModel::duplicate_post' );
110
  self::add_action( 'duplicate_wpml_layout', 'FLBuilderModel::duplicate_wpml_layout', array( 'original_post_id', 'post_id' ) );
 
 
111
  self::add_action( 'apply_user_template', 'FLBuilderModel::apply_user_template', array( 'template_id', 'append' ) );
 
 
112
  self::add_action( 'apply_template', 'FLBuilderModel::apply_template', array( 'template_id', 'append' ) );
113
  self::add_action( 'save_layout', 'FLBuilderModel::save_layout' );
114
  self::add_action( 'save_draft', 'FLBuilderModel::save_draft' );
117
 
118
  // FLBuilderAJAXLayout
119
  self::add_action( 'render_layout', 'FLBuilderAJAXLayout::render' );
120
+ self::add_action( 'render_new_row', 'FLBuilderAJAXLayout::render_new_row', array( 'cols', 'position', 'template_id', 'template_type' ) );
121
  self::add_action( 'copy_row', 'FLBuilderAJAXLayout::copy_row', array( 'node_id' ) );
122
  self::add_action( 'render_new_column_group', 'FLBuilderAJAXLayout::render_new_column_group', array( 'node_id', 'cols', 'position' ) );
123
  self::add_action( 'render_new_column', 'FLBuilderAJAXLayout::render_new_column', array( 'node_id', 'insert' ) );
124
+ self::add_action( 'render_new_module', 'FLBuilderAJAXLayout::render_new_module', array( 'parent_id', 'position', 'type', 'template_id', 'template_type' ) );
125
  self::add_action( 'copy_module', 'FLBuilderAJAXLayout::copy_module', array( 'node_id' ) );
126
 
127
  // FLBuilderServices
181
  return;
182
  }
183
 
184
+ // Allow developers to modify actions before they are called.
185
+ do_action( 'fl_ajax_before_call_action', $action );
186
+
187
  // Make sure the action exists.
188
  if ( ! isset( self::$actions[ $action ] ) ) {
189
  return;
243
 
244
  return true;
245
  }
246
+ }
247
+
248
+ FLBuilderAJAX::init();
classes/class-fl-builder-export.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Custom export handling.
5
+ *
6
+ * @since 1.8
7
+ */
8
+ final class FLBuilderExport {
9
+
10
+ /**
11
+ * @since 1.8
12
+ * @return void
13
+ */
14
+ static public function init()
15
+ {
16
+ add_action( 'admin_enqueue_scripts', 'FLBuilderExport::enqueue_scripts' );
17
+ add_action( 'export_filters', 'FLBuilderExport::filters' );
18
+ add_action( 'wp_ajax_fl_builder_export_templates_data', 'FLBuilderExport::templates_data' );
19
+ add_action( 'export_wp', 'FLBuilderExport::export' );
20
+ }
21
+
22
+ /**
23
+ * Enqueues the export scripts and styles.
24
+ *
25
+ * @since 1.8
26
+ * @return void
27
+ */
28
+ static public function enqueue_scripts()
29
+ {
30
+ global $pagenow;
31
+
32
+ if ( 'export.php' != $pagenow ) {
33
+ return;
34
+ }
35
+
36
+ wp_enqueue_style( 'fl-builder-export', FL_BUILDER_URL . 'css/fl-builder-export.css', array(), FL_BUILDER_VERSION );
37
+ wp_enqueue_script( 'fl-builder-export', FL_BUILDER_URL . 'js/fl-builder-export.js', array(), FL_BUILDER_VERSION, true );
38
+ }
39
+
40
+ /**
41
+ * Renders the export filters markup.
42
+ *
43
+ * @since 1.8
44
+ * @return void
45
+ */
46
+ static public function filters()
47
+ {
48
+ include FL_BUILDER_DIR . 'includes/export-filters.php';
49
+ }
50
+
51
+ /**
52
+ * Called via AJAX and returns the data used for selecting
53
+ * templates for export.
54
+ *
55
+ * @since 1.8
56
+ * @return void
57
+ */
58
+ static public function templates_data()
59
+ {
60
+ $data = array();
61
+ $query = new WP_Query( array(
62
+ 'post_type' => 'fl-builder-template',
63
+ 'orderby' => 'title',
64
+ 'order' => 'ASC',
65
+ 'posts_per_page' => '-1'
66
+ ) );
67
+
68
+ foreach( $query->posts as $post ) {
69
+ $data[] = array(
70
+ 'id' => $post->ID,
71
+ 'title' => $post->post_title
72
+ );
73
+ }
74
+
75
+ echo json_encode( $data );
76
+
77
+ die();
78
+ }
79
+
80
+ /**
81
+ * Download the export file.
82
+ *
83
+ * @since 1.8
84
+ * @param array $args
85
+ * @return void
86
+ */
87
+ static public function export( $args )
88
+ {
89
+ if ( ! current_user_can( 'export' ) ) {
90
+ return;
91
+ }
92
+ if ( 'fl-builder-template' != $args['content'] ) {
93
+ return;
94
+ }
95
+ if ( ! isset( $_REQUEST['fl-builder-template-export-select'] ) ) {
96
+ return;
97
+ }
98
+ if ( 'all' == $_REQUEST['fl-builder-template-export-select'] ) {
99
+ return;
100
+ }
101
+ if ( ! is_array( $_REQUEST['fl-builder-export-template'] ) ) {
102
+ return;
103
+ }
104
+
105
+ require_once FL_BUILDER_DIR . 'includes/export.php';
106
+
107
+ fl_export_wp( $_REQUEST['fl-builder-export-template'] );
108
+
109
+ die();
110
+ }
111
+ }
112
+
113
+ FLBuilderExport::init();
classes/class-fl-builder-extensions.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Helper class for builder extensions.
5
+ *
6
+ * @since 1.0
7
+ */
8
+ final class FLBuilderExtensions {
9
+
10
+ /**
11
+ * Initalizes any extensions found in the extensions directory.
12
+ *
13
+ * @since 1.8
14
+ * @return void
15
+ */
16
+ static public function init()
17
+ {
18
+ $extensions = glob( FL_BUILDER_DIR . 'extensions/*' );
19
+
20
+ if ( ! is_array( $extensions ) ) {
21
+ return;
22
+ }
23
+
24
+ foreach ( $extensions as $extension ) {
25
+
26
+ if ( ! is_dir( $extension ) ) {
27
+ continue;
28
+ }
29
+
30
+ $path = trailingslashit( $extension ) . basename( $extension ) . '.php';
31
+
32
+ if ( file_exists( $path ) ) {
33
+ require_once $path;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ FLBuilderExtensions::init();
classes/class-fl-builder-fonts.php CHANGED
@@ -129,7 +129,11 @@ final class FLBuilderFonts {
129
  $css .= 'font-family: '. $font['family'] .';';
130
  }
131
 
132
- $css .= 'font-weight: '. $font['weight'] .';';
 
 
 
 
133
 
134
  echo $css;
135
  }
129
  $css .= 'font-family: '. $font['family'] .';';
130
  }
131
 
132
+ if ( 'regular' == $font['weight'] ) {
133
+ $css .= 'font-weight: normal;';
134
+ } else {
135
+ $css .= 'font-weight: '. $font['weight'] .';';
136
+ }
137
 
138
  echo $css;
139
  }
classes/class-fl-builder-icons.php CHANGED
@@ -183,6 +183,11 @@ final class FLBuilderIcons {
183
  // Loop through uploaded sets.
184
  foreach ( $folders as $folder ) {
185
 
 
 
 
 
 
186
  $folder = trailingslashit( $folder );
187
 
188
  // This is an Icomoon font.
183
  // Loop through uploaded sets.
184
  foreach ( $folders as $folder ) {
185
 
186
+ // Make sure we have a directory.
187
+ if ( ! is_dir( $folder ) ) {
188
+ continue;
189
+ }
190
+
191
  $folder = trailingslashit( $folder );
192
 
193
  // This is an Icomoon font.
classes/class-fl-builder-import.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The WordPress importer plugin has a few issues that break
5
+ * serialized data in certain cases. This class overrides the
6
+ * WordPress importer with our own patched version that fixes
7
+ * these issues.
8
+ *
9
+ * @since 1.8
10
+ */
11
+ final class FLBuilderImport {
12
+
13
+ /**
14
+ * @since 1.8
15
+ * @return void
16
+ */
17
+ static public function init()
18
+ {
19
+ if ( ! defined( 'WP_LOAD_IMPORTERS' ) || ! class_exists( 'WP_Import' ) || ! class_exists( 'WXR_Parser_Regex' ) ) {
20
+ return;
21
+ }
22
+
23
+ require_once FL_BUILDER_DIR . '/classes/class-fl-builder-importer.php';
24
+
25
+ // Remove the WordPress importer.
26
+ remove_action( 'admin_init', 'wordpress_importer_init' );
27
+
28
+ // Add our importer.
29
+ add_action( 'admin_init', 'FLBuilderImport::load' );
30
+ }
31
+
32
+ /**
33
+ * @since 1.8
34
+ * @return void
35
+ */
36
+ static public function load()
37
+ {
38
+ load_plugin_textdomain( 'wordpress-importer', false, 'wordpress-importer/languages' );
39
+
40
+ $GLOBALS['wp_import'] = new FLBuilderImporter();
41
+
42
+ register_importer( 'wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'wordpress-importer'), array( $GLOBALS['wp_import'], 'dispatch' ) );
43
+ }
44
+ }
45
+
46
+ add_action( 'plugins_loaded', 'FLBuilderImport::init' );
classes/class-fl-builder-importer.php ADDED
@@ -0,0 +1,179 @@