WordPress Page Builder – Beaver Builder - Version 2.2.2.5

Version Description

Download this release

Release Info

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

Code changes from version 2.2.1.5 to 2.2.2.5

Files changed (82) hide show
  1. changelog.txt +72 -0
  2. classes/class-fl-builder-admin-settings.php +37 -8
  3. classes/class-fl-builder-admin.php +6 -3
  4. classes/class-fl-builder-art.php +2 -0
  5. classes/class-fl-builder-css.php +15 -5
  6. classes/class-fl-builder-debug.php +25 -0
  7. classes/class-fl-builder-icons.php +0 -4
  8. classes/class-fl-builder-loader.php +2 -1
  9. classes/class-fl-builder-model.php +30 -4
  10. classes/class-fl-builder-revisions.php +7 -5
  11. classes/class-fl-builder-service-aweber.php +3 -0
  12. classes/class-fl-builder-service-campayn.php +3 -0
  13. classes/class-fl-builder-service-constant-contact.php +5 -0
  14. classes/class-fl-builder-service-convertkit.php +2 -0
  15. classes/class-fl-builder-service-drip.php +5 -0
  16. classes/class-fl-builder-service-enormail.php +2 -0
  17. classes/class-fl-builder-service-getresponse.php +1 -0
  18. classes/class-fl-builder-service-godaddy-email-marketing.php +1 -0
  19. classes/class-fl-builder-service-icontact-pro.php +8 -3
  20. classes/class-fl-builder-service-icontact.php +7 -3
  21. classes/class-fl-builder-service-infusionsoft.php +2 -0
  22. classes/class-fl-builder-service-mailchimp.php +1 -0
  23. classes/class-fl-builder-service-mailerlite.php +2 -0
  24. classes/class-fl-builder-service-mailpoet.php +1 -0
  25. classes/class-fl-builder-service-mailrelay.php +3 -0
  26. classes/class-fl-builder-service-mautic.php +2 -1
  27. classes/class-fl-builder-service-ontraport.php +2 -0
  28. classes/class-fl-builder-service-sendinblue.php +3 -0
  29. classes/class-fl-builder-service-sendy.php +2 -0
  30. classes/class-fl-builder-ui-settings-forms.php +17 -11
  31. classes/class-fl-builder-usage.php +1 -0
  32. classes/class-fl-builder-wp-blocks.php +5 -0
  33. classes/class-fl-builder-wpcli-command.php +361 -5
  34. classes/class-fl-builder.php +35 -19
  35. css/fl-builder-admin-settings.css +76 -0
  36. css/fl-builder.css +50 -2
  37. css/fl-builder.min.css +1 -1
  38. css/fl-lightbox.css +1 -3
  39. fl-builder.php +1 -1
  40. fonts/fontawesome/css/all.min.css +1 -1
  41. fonts/fontawesome/css/v4-shims.min.css +5 -0
  42. fonts/fontawesome/webfonts/fa-brands-400.eot +0 -0
  43. fonts/fontawesome/webfonts/fa-brands-400.svg +3 -3
  44. fonts/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  45. fonts/fontawesome/webfonts/fa-brands-400.woff +0 -0
  46. fonts/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  47. fonts/fontawesome/webfonts/fa-regular-400.eot +0 -0
  48. fonts/fontawesome/webfonts/fa-regular-400.svg +2 -2
  49. fonts/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  50. fonts/fontawesome/webfonts/fa-regular-400.woff +0 -0
  51. fonts/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  52. fonts/fontawesome/webfonts/fa-solid-900.eot +0 -0
  53. fonts/fontawesome/webfonts/fa-solid-900.svg +2 -2
  54. fonts/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  55. fonts/fontawesome/webfonts/fa-solid-900.woff +0 -0
  56. fonts/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  57. includes/admin-posts.php +6 -2
  58. includes/admin-settings-welcome.php +20 -2
  59. includes/column-settings.php +1 -0
  60. includes/compatibility.php +5 -43
  61. includes/export.php +3 -3
  62. includes/loop-settings-matching.php +4 -1
  63. includes/module-settings.php +1 -0
  64. includes/row-settings.php +1 -0
  65. includes/shape-layer.php +1 -1
  66. includes/strings.php +1 -1
  67. includes/ui-js-config.php +10 -0
  68. includes/ui-js-templates.php +30 -4
  69. includes/ui-loop-settings.php +2 -0
  70. includes/updater-config.php +1 -1
  71. includes/updater/classes/class-fl-updater.php +3 -1
  72. js/fl-builder-admin-settings.js +45 -0
  73. js/fl-builder-ajax-layout.js +2 -1
  74. js/fl-builder-layout.js +1 -1
  75. js/fl-builder-libs.js +93 -0
  76. js/fl-builder-preview.js +12 -3
  77. js/fl-builder-responsive-preview.js +1 -1
  78. js/fl-builder-revisions.js +11 -3
  79. js/fl-builder-services.js +6 -6
  80. js/fl-builder-ui-settings-forms.js +2 -2
  81. js/fl-builder.js +98 -35
  82. js/fl-builder.min.js +9 -9
changelog.txt CHANGED
@@ -1,3 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>2.2.1.5 - 03/20/2019</h4>
2
  <p><strong>Hot Fix</strong></p>
3
  <ul>
1
+ <h4>2.2.2.5 - 04/16/2019</h4>
2
+ <p><strong>Hot Fix</strong></p>
3
+ <ul>
4
+ <li>Fixed some Google fonts not rendering correctly if they have numbers in the font name.</li>
5
+ <li>Updated the crash error message popup text.</li>
6
+ <li>Update checks now use SSL urls.</li>
7
+ <li>Fixed preview issue. Type unit was using the number value intead of the unit value.</li>
8
+ <li>Fixed WPCLI issue when using PHP5.</li>
9
+ <li>Fixed issue with Maps module and ACF map field connection.</li>
10
+ <li>Fixed undefined index warning on some Woocommerce pages.</li>
11
+ <li>Reverted text editor module styles overriding individual styles set in TinyMCE added in 2.2.2.1</li>
12
+ </ul>
13
+
14
+ <h4>2.2.2.4 - 04/08/2019</h4>
15
+ <p><strong>Hot Fix</strong></p>
16
+ <ul>
17
+ <li>Fixed settings.js not being executed in 3rd party plugins.</li>
18
+ </ul>
19
+
20
+ <h4>2.2.2.3 - 04/06/2019</h4>
21
+ <p><strong>Hot Fix</strong></p>
22
+ <ul>
23
+ <li>Fixed Javascript error in Post Grid.</li>
24
+ <li>Fixed incorrect schema markup in Post Grid.</li>
25
+ </ul>
26
+
27
+ <h4>2.2.2.2 - 04/04/2019</h4>
28
+ <p><strong>Hot Fix</strong></p>
29
+ <ul>
30
+ <li>Added missing debounce dependency for Post Grid Module if scroll is used for pagination.</li>
31
+ <li>Fixed an issue where deleting a Global Saved Module affects the other globals in a layout.</li>
32
+ </ul>
33
+
34
+ <h4>2.2.2.1 - 04/03/2019</h4>
35
+ <p><strong>Enhancements</strong></p>
36
+ <ul>
37
+ <li>Updated Font Awesome to 5.8.1</li>
38
+ <li>Added popup with link to support when a fatal error is detected in AJAX.</li>
39
+ <li>Removed references to Font Awesome 4, if its still needed by a module or the theme a shim will load to map icons to FA5.</li>
40
+ <li>Added option to set placeholder text in Subscribe Module.</li>
41
+ <li>Added order by random option to Content Slider Module.</li>
42
+ <li>Added santization to global settings on save.</li>
43
+ <li>New filter <code>fl_post_grid_disable_schema</code> to disable all schema in Post Grid Module.</li>
44
+ <li>When restoring a layout revision the JS and CSS are now included in the revision.</li>
45
+ <li>Added general post counts to debug info page.</li>
46
+ <li>Title bar now shows what you are editing, row/module/page etc.</li>
47
+ <li>Added setting for responsive menu label in Menu Module.</li>
48
+ <li>Added support for youtu.be links in jQuery.magnificpopup.</li>
49
+ <li>Added shape name as a CSS class to shape layer for easier styling.</li>
50
+ <li>Added <code>nav</code> markup and schema to Menu Module.</li>
51
+ <li>Added more WPCLI support, you can now control Themer layouts.</li>
52
+ <li>Added indicators to main UI menu if there are revisions and css/js for the current layout.</li>
53
+ </ul>
54
+ <p><strong>Bug Fixes</strong></p>
55
+ <ul>
56
+ <li>Fixed rare save error caused by broken zlib server PHP settings.</li>
57
+ <li>Fixed internal templates showing in the link dropdown when using tinymce.</li>
58
+ <li>Fixed several browser jQuery deprecation warnings.</li>
59
+ <li>Fixed UI glitch with colorpicker in Firefox, X to reset was misaligned.</li>
60
+ <li>Fixed incorrect order of media queries rendered with FLBuilderCSS.</li>
61
+ <li>Fixed a bug where unable to add new module when editing a saved column.</li>
62
+ <li>Fixed laggy module settings caused by updated jQuery.validate library.</li>
63
+ <li>Fixed Youtube background no longer auto-playing in Safari when audio is On.</li>
64
+ <li>Fixed text editor module styles overriding individual styles set in TinyMCE.</li>
65
+ <li>Fixed functions being stripped from tiny_mce_before_init because of JSON.Stringify().</li>
66
+ <li>Fixed jQuery migrate warning in _initTimezoneField().</li>
67
+ <li>Make sure submenu icon won’t display on mobile if sets to None in Menu Module.</li>
68
+ <li>Removed all frameborder=0 as it is not needed in modern browsers.</li>
69
+ <li>Removed focus CSS from tinymce textarea.</li>
70
+ <li>Removed Caldera Forms Widget fix added in 2.2.1.5, Caldera Forms 1.8.4 fixed the issue.</li>
71
+ </ul>
72
+
73
  <h4>2.2.1.5 - 03/20/2019</h4>
74
  <p><strong>Hot Fix</strong></p>
75
  <ul>
classes/class-fl-builder-admin-settings.php CHANGED
@@ -23,7 +23,40 @@ final class FLBuilderAdminSettings {
23
  * @return void
24
  */
25
  static public function init() {
26
- add_action( 'after_setup_theme', __CLASS__ . '::init_hooks', 11 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
  /**
@@ -125,7 +158,7 @@ final class FLBuilderAdminSettings {
125
  if ( ! empty( $icon ) ) {
126
  echo '<img role="presentation" src="' . $icon . '" />';
127
  }
128
-
129
  echo '<span>' . sprintf( _x( '%s Settings', '%s stands for custom branded "Page Builder" name.', 'fl-builder' ), FLBuilderModel::get_branding() ) . '</span>';
130
  }
131
 
@@ -432,12 +465,6 @@ final class FLBuilderAdminSettings {
432
  $enabled_icons = array_map( 'sanitize_text_field', $_POST['fl-enabled-icons'] );
433
  }
434
 
435
- // we cant have fa4 and fa5 active at same time.
436
- if ( in_array( 'font-awesome', $enabled_icons ) && (bool) array_intersect( array( 'font-awesome-5-brands', 'font-awesome-5-regular', 'font-awesome-5-solid' ), $enabled_icons ) ) {
437
- self::add_error( __( 'Use either Font Awesome 4 or Font Awesome 5. They are not compatible. Modules already in use will continue to use Font Awesome 4 regardless of your choice here.', 'fl-builder' ) );
438
- return;
439
- }
440
-
441
  // Update the enabled sets.
442
  self::update_enabled_icons( $enabled_icons );
443
 
@@ -482,6 +509,7 @@ final class FLBuilderAdminSettings {
482
 
483
  // unzip returned a WP_Error
484
  if ( is_wp_error( $unzipped ) ) {
 
485
  self::add_error( sprintf( __( 'Unzip Error: %s', 'fl-builder' ), $unzipped->get_error_message() ) );
486
  return;
487
  }
@@ -721,6 +749,7 @@ final class FLBuilderAdminSettings {
721
 
722
  $wporg = '<a target="_blank" href="https://wordpress.org/plugins/beaver-builder-lite-version/">wordpress.org</a>';
723
 
 
724
  return sprintf( __( 'Add your %1$s on %2$s to spread the love.', 'fl-builder' ), $stars, $wporg );
725
  }
726
  }
23
  * @return void
24
  */
25
  static public function init() {
26
+ add_action( 'init', __CLASS__ . '::init_hooks', 11 );
27
+ add_action( 'wp_ajax_fl_welcome_submit', array( 'FLBuilderAdminSettings', 'welcome_submit' ) );
28
+ }
29
+
30
+ /**
31
+ * AJAX callback for welcome email subscription form.
32
+ * @since 2.2.2
33
+ */
34
+ static public function welcome_submit() {
35
+
36
+ if ( ! empty( $_POST ) && wp_verify_nonce( $_POST['_wpnonce'], 'welcome_submit' ) ) {
37
+
38
+ $url = 'http://services.wpbeaverbuilder.com/drip/subscribe.php';
39
+
40
+ $url = add_query_arg( array(
41
+ 'name' => $_POST['name'],
42
+ 'email' => $_POST['email'],
43
+ ), $url );
44
+
45
+ $response = wp_remote_get( $url );
46
+ $body = $response['body'];
47
+ if ( '1' === $body ) {
48
+ $args = array(
49
+ 'message' => __( 'Thank you!', 'fl-builder' ),
50
+ );
51
+ update_user_meta( get_current_user_id(), '_fl_welcome_subscribed', '1' );
52
+ wp_send_json_success( $args );
53
+ }
54
+ } else {
55
+ $args = array(
56
+ 'message' => __( 'Error submitting.', 'fl-builder' ),
57
+ );
58
+ wp_send_json_error( $args );
59
+ }
60
  }
61
 
62
  /**
158
  if ( ! empty( $icon ) ) {
159
  echo '<img role="presentation" src="' . $icon . '" />';
160
  }
161
+ /* translators: %s: builder branded name */
162
  echo '<span>' . sprintf( _x( '%s Settings', '%s stands for custom branded "Page Builder" name.', 'fl-builder' ), FLBuilderModel::get_branding() ) . '</span>';
163
  }
164
 
465
  $enabled_icons = array_map( 'sanitize_text_field', $_POST['fl-enabled-icons'] );
466
  }
467
 
 
 
 
 
 
 
468
  // Update the enabled sets.
469
  self::update_enabled_icons( $enabled_icons );
470
 
509
 
510
  // unzip returned a WP_Error
511
  if ( is_wp_error( $unzipped ) ) {
512
+ /* translators: %s: unzip error message */
513
  self::add_error( sprintf( __( 'Unzip Error: %s', 'fl-builder' ), $unzipped->get_error_message() ) );
514
  return;
515
  }
749
 
750
  $wporg = '<a target="_blank" href="https://wordpress.org/plugins/beaver-builder-lite-version/">wordpress.org</a>';
751
 
752
+ /* translators: 1: stars link: 2: link to wporg page */
753
  return sprintf( __( 'Add your %1$s on %2$s to spread the love.', 'fl-builder' ), $stars, $wporg );
754
  }
755
  }
classes/class-fl-builder-admin.php CHANGED
@@ -59,6 +59,7 @@ final class FLBuilderAdmin {
59
  'utm_source' => 'plugins-admin-page',
60
  'utm_campaign' => 'no-multisite-support',
61
  ) );
 
62
  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"' ) );
63
  }
64
 
@@ -123,7 +124,7 @@ final class FLBuilderAdmin {
123
  $folder = rtrim( FLBuilderModel::plugin_basename(), '/fl-builder.php' );
124
 
125
  if ( 'bb-plugin' != $folder ) {
126
-
127
  $error = sprintf( __( 'Install Error! We detected that Beaver Builder appears to be installed in a folder called <kbd>%s</kbd>.<br />For automatic updates to work the plugin must be installed in the folder <kbd>bb-plugin</kbd>.', 'fl-builder' ), $folder );
128
  FLBuilderAdminSettings::add_error( $error );
129
  }
@@ -180,10 +181,12 @@ final class FLBuilderAdmin {
180
  */
181
  static public function activate_notice() {
182
  if ( FL_BUILDER_LITE !== true ) {
183
- $hash = '#license';
 
184
  $message = __( 'Page Builder activated! <a%s>Click here</a> to enable remote updates.', 'fl-builder' );
185
  } else {
186
- $hash = '#welcome';
 
187
  $message = __( 'Page Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
188
  }
189
 
59
  'utm_source' => 'plugins-admin-page',
60
  'utm_campaign' => 'no-multisite-support',
61
  ) );
62
+ /* translators: %s: upgrade url */
63
  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"' ) );
64
  }
65
 
124
  $folder = rtrim( FLBuilderModel::plugin_basename(), '/fl-builder.php' );
125
 
126
  if ( 'bb-plugin' != $folder ) {
127
+ /* translators: %s: folder path */
128
  $error = sprintf( __( 'Install Error! We detected that Beaver Builder appears to be installed in a folder called <kbd>%s</kbd>.<br />For automatic updates to work the plugin must be installed in the folder <kbd>bb-plugin</kbd>.', 'fl-builder' ), $folder );
129
  FLBuilderAdminSettings::add_error( $error );
130
  }
181
  */
182
  static public function activate_notice() {
183
  if ( FL_BUILDER_LITE !== true ) {
184
+ $hash = '#license';
185
+ /* translators: %s: link to licence page */
186
  $message = __( 'Page Builder activated! <a%s>Click here</a> to enable remote updates.', 'fl-builder' );
187
  } else {
188
+ $hash = '#welcome';
189
+ /* translators: %s: link to welcome page */
190
  $message = __( 'Page Builder activated! <a%s>Click here</a> to get started.', 'fl-builder' );
191
  }
192
 
classes/class-fl-builder-art.php CHANGED
@@ -337,6 +337,7 @@ class FLBuilderArt {
337
 
338
  // Preset & Shape Section
339
  $sections[ $prefix . 'shape' ] = array(
 
340
  'title' => sprintf( __( '%s Shape', 'fl-builder' ), $position_label ),
341
  'fields' => array(
342
  $prefix . 'shape' => array(
@@ -463,6 +464,7 @@ class FLBuilderArt {
463
 
464
  // Shape Styles
465
  $sections[ $prefix . 'style' ] = array(
 
466
  'title' => sprintf( __( '%s Shape Style', 'fl-builder' ), $position_label ),
467
  'fields' => array(
468
  $prefix . 'fill_style' => array(
337
 
338
  // Preset & Shape Section
339
  $sections[ $prefix . 'shape' ] = array(
340
+ /* translators: %s: position label */
341
  'title' => sprintf( __( '%s Shape', 'fl-builder' ), $position_label ),
342
  'fields' => array(
343
  $prefix . 'shape' => array(
464
 
465
  // Shape Styles
466
  $sections[ $prefix . 'style' ] = array(
467
+ /* translators: %s: position label */
468
  'title' => sprintf( __( '%s Shape Style', 'fl-builder' ), $position_label ),
469
  'fields' => array(
470
  $prefix . 'fill_style' => array(
classes/class-fl-builder-css.php CHANGED
@@ -285,10 +285,13 @@ final class FLBuilderCSS {
285
  static public function typography_field_props( $setting = array() ) {
286
  $props = array();
287
  $settings = FLBuilderModel::get_global_settings();
288
-
289
  if ( isset( $setting['font_family'] ) && 'Default' !== $setting['font_family'] ) {
290
- $fallback = FLBuilderFonts::get_font_fallback( $setting['font_family'] );
291
- $props['font-family'] = sprintf( '%s, %s', $setting['font_family'], $fallback );
 
 
 
292
  }
293
  if ( isset( $setting['font_weight'] ) && 'i' == substr( $setting['font_weight'], -1 ) ) {
294
  $props['font-weight'] = substr( $setting['font_weight'], 0, -1 );
@@ -340,8 +343,15 @@ final class FLBuilderCSS {
340
  * @return void
341
  */
342
  static public function render() {
343
- $rendered = array();
344
- $css = '';
 
 
 
 
 
 
 
345
 
346
  foreach ( self::$rules as $args ) {
347
  $defaults = array(
285
  static public function typography_field_props( $setting = array() ) {
286
  $props = array();
287
  $settings = FLBuilderModel::get_global_settings();
288
+ $pattern = '%s, %s';
289
  if ( isset( $setting['font_family'] ) && 'Default' !== $setting['font_family'] ) {
290
+ $fallback = FLBuilderFonts::get_font_fallback( $setting['font_family'] );
291
+ if ( preg_match( '#[0-9]#', $setting['font_family'] ) ) {
292
+ $pattern = '"%s", %s';
293
+ }
294
+ $props['font-family'] = sprintf( $pattern, $setting['font_family'], $fallback );
295
  }
296
  if ( isset( $setting['font_weight'] ) && 'i' == substr( $setting['font_weight'], -1 ) ) {
297
  $props['font-weight'] = substr( $setting['font_weight'], 0, -1 );
343
  * @return void
344
  */
345
  static public function render() {
346
+ $rendered = array();
347
+ $breakpoints = array( 'default', 'medium', 'responsive' );
348
+ $css = '';
349
+
350
+ // Setup system breakpoints here to ensure proper order.
351
+ foreach ( $breakpoints as $breakpoint ) {
352
+ $media = self::media_value( $breakpoint );
353
+ $rendered[ $media ] = array();
354
+ }
355
 
356
  foreach ( self::$rules as $args ) {
357
  $defaults = array(
classes/class-fl-builder-debug.php CHANGED
@@ -158,6 +158,31 @@ final class FL_Debug {
158
  );
159
  self::register( 'wp_max_mem', $args );
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  $args = array(
162
  'name' => 'Themes',
163
  'data' => self::divider(),
158
  );
159
  self::register( 'wp_max_mem', $args );
160
 
161
+ $args = array(
162
+ 'name' => 'Post Counts',
163
+ 'data' => self::divider(),
164
+ );
165
+ self::register( 'post_counts', $args );
166
+
167
+ $templates = wp_count_posts( 'fl-builder-template' );
168
+
169
+ $post_types = get_post_types( null, 'object' );
170
+
171
+ foreach ( $post_types as $type => $type_object ) {
172
+
173
+ if ( in_array( $type, array( 'wp_block', 'user_request', 'oembed_cache', 'customize_changeset', 'custom_css', 'nav_menu_item' ) ) ) {
174
+ continue;
175
+ }
176
+
177
+ $count = wp_count_posts( $type );
178
+
179
+ $args = array(
180
+ 'name' => ( 'fl-builder-template' == $type ) ? 'Builder Templates' : 'WordPress ' . $type_object->label,
181
+ 'data' => ( $count->inherit > 0 ) ? $count->inherit : $count->publish,
182
+ );
183
+ self::register( 'wp_type_count_' . $type, $args );
184
+ }
185
+
186
  $args = array(
187
  'name' => 'Themes',
188
  'data' => self::divider(),
classes/class-fl-builder-icons.php CHANGED
@@ -130,10 +130,6 @@ final class FLBuilderIcons {
130
  static private function register_core_sets() {
131
  $enabled_icons = FLBuilderModel::get_enabled_icons();
132
  $core_sets = apply_filters( 'fl_builder_core_icon_sets', array(
133
- 'font-awesome' => array(
134
- 'name' => 'Font Awesome 4',
135
- 'prefix' => 'fa',
136
- ),
137
  'font-awesome-5-solid' => array(
138
  'name' => 'Font Awesome 5 Solid',
139
  'prefix' => 'fas',
130
  static private function register_core_sets() {
131
  $enabled_icons = FLBuilderModel::get_enabled_icons();
132
  $core_sets = apply_filters( 'fl_builder_core_icon_sets', array(
 
 
 
 
133
  'font-awesome-5-solid' => array(
134
  'name' => 'Font Awesome 5 Solid',
135
  'prefix' => 'fas',
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.2.1.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 ) );
@@ -166,6 +166,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
166
  * @return void
167
  */
168
  static public function double_install_admin_notice() {
 
169
  $message = __( 'You currently have two versions of Beaver Builder active on this site. Please <a href="%s">deactivate one</a> before continuing.', 'fl-builder' );
170
 
171
  self::render_admin_notice( sprintf( $message, admin_url( 'plugins.php' ) ), 'error' );
46
  * @return void
47
  */
48
  static private function define_constants() {
49
+ define( 'FL_BUILDER_VERSION', '2.2.2.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 ) );
166
  * @return void
167
  */
168
  static public function double_install_admin_notice() {
169
+ /* translators: %s: plugins page link */
170
  $message = __( 'You currently have two versions of Beaver Builder active on this site. Please <a href="%s">deactivate one</a> before continuing.', 'fl-builder' );
171
 
172
  self::render_admin_notice( sprintf( $message, admin_url( 'plugins.php' ) ), 'error' );
classes/class-fl-builder-model.php CHANGED
@@ -2752,6 +2752,7 @@ final class FLBuilderModel {
2752
 
2753
  // Log an error if a module with this slug already exists.
2754
  if ( isset( self::$modules[ $instance->slug ] ) ) {
 
2755
  error_log( sprintf( _x( 'A module with the filename %s.php already exists! Please namespace your module filenames to ensure compatibility with Beaver Builder.', '%s stands for the module filename', 'fl-builder' ), $instance->slug ) );
2756
  return;
2757
  }
@@ -2787,6 +2788,7 @@ final class FLBuilderModel {
2787
  */
2788
  static public function register_module_alias( $alias, $config ) {
2789
  if ( isset( self::$module_aliases[ $alias ] ) ) {
 
2790
  _doing_it_wrong( __CLASS__ . '::register_module_alias', sprintf( _x( 'The module alias %s already exists! Please namespace your module aliases to ensure compatibility with Beaver Builder.', '%s stands for the module alias key', 'fl-builder' ), $alias ), '1.10' );
2791
  return;
2792
  }
@@ -4045,6 +4047,9 @@ final class FLBuilderModel {
4045
  */
4046
  static public function save_global_settings( $settings = array() ) {
4047
  $old_settings = self::get_global_settings();
 
 
 
4048
  $new_settings = (object) array_merge( (array) $old_settings, (array) $settings );
4049
 
4050
  self::delete_asset_cache_for_all_posts();
@@ -4055,6 +4060,24 @@ final class FLBuilderModel {
4055
  return self::get_global_settings();
4056
  }
4057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4058
  /**
4059
  * Duplicate the current post.
4060
  *
@@ -4080,6 +4103,7 @@ final class FLBuilderModel {
4080
  'post_parent' => $post->post_parent,
4081
  'post_password' => $post->post_password,
4082
  'post_status' => 'draft',
 
4083
  'post_title' => sprintf( _x( 'Copy of %s', '%s stands for post/page title.', 'fl-builder' ), $post->post_title ),
4084
  'post_type' => $post->post_type,
4085
  'to_ping' => $post->to_ping,
@@ -5563,9 +5587,11 @@ final class FLBuilderModel {
5563
 
5564
  // Remove template info from the layout data.
5565
  foreach ( $layout_data as $node_id => $node ) {
5566
- unset( $layout_data[ $node_id ]->template_id );
5567
- unset( $layout_data[ $node_id ]->template_node_id );
5568
- unset( $layout_data[ $node_id ]->template_root_node );
 
 
5569
  }
5570
 
5571
  // Update the layout data.
@@ -6344,7 +6370,7 @@ final class FLBuilderModel {
6344
  'enabled' => true,
6345
  'tour' => true,
6346
  'video' => true,
6347
- 'video_embed' => '<iframe src="https://player.vimeo.com/video/240550556?autoplay=1" width="420" height="315" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
6348
  'knowledge_base' => true,
6349
  'knowledge_base_url' => self::get_store_url( 'knowledge-base', array(
6350
  'utm_medium' => ( true === FL_BUILDER_LITE ? 'bb-lite' : 'bb-pro' ),
2752
 
2753
  // Log an error if a module with this slug already exists.
2754
  if ( isset( self::$modules[ $instance->slug ] ) ) {
2755
+ /* translators: %s: module filename */
2756
  error_log( sprintf( _x( 'A module with the filename %s.php already exists! Please namespace your module filenames to ensure compatibility with Beaver Builder.', '%s stands for the module filename', 'fl-builder' ), $instance->slug ) );
2757
  return;
2758
  }
2788
  */
2789
  static public function register_module_alias( $alias, $config ) {
2790
  if ( isset( self::$module_aliases[ $alias ] ) ) {
2791
+ /* translators: %s: module alias key */
2792
  _doing_it_wrong( __CLASS__ . '::register_module_alias', sprintf( _x( 'The module alias %s already exists! Please namespace your module aliases to ensure compatibility with Beaver Builder.', '%s stands for the module alias key', 'fl-builder' ), $alias ), '1.10' );
2793
  return;
2794
  }
4047
  */
4048
  static public function save_global_settings( $settings = array() ) {
4049
  $old_settings = self::get_global_settings();
4050
+
4051
+ $settings = self::sanitize_global( $settings );
4052
+
4053
  $new_settings = (object) array_merge( (array) $old_settings, (array) $settings );
4054
 
4055
  self::delete_asset_cache_for_all_posts();
4060
  return self::get_global_settings();
4061
  }
4062
 
4063
+ /**
4064
+ * Sanitize global options on save.
4065
+ * @since 2.2.2
4066
+ */
4067
+ static public function sanitize_global( $settings ) {
4068
+
4069
+ $fields = self::get_settings_form_fields( 'global', 'general' );
4070
+
4071
+ foreach ( $settings as $name => $value ) {
4072
+ if ( ! isset( $fields[ $name ] ) ) {
4073
+ continue;
4074
+ } elseif ( isset( $fields[ $name ]['sanitize'] ) ) {
4075
+ $settings[ $name ] = call_user_func_array( $fields[ $name ]['sanitize'], array( $value ) );
4076
+ }
4077
+ }
4078
+ return $settings;
4079
+ }
4080
+
4081
  /**
4082
  * Duplicate the current post.
4083
  *
4103
  'post_parent' => $post->post_parent,
4104
  'post_password' => $post->post_password,
4105
  'post_status' => 'draft',
4106
+ /* translators: %s: post/page title */
4107
  'post_title' => sprintf( _x( 'Copy of %s', '%s stands for post/page title.', 'fl-builder' ), $post->post_title ),
4108
  'post_type' => $post->post_type,
4109
  'to_ping' => $post->to_ping,
5587
 
5588
  // Remove template info from the layout data.
5589
  foreach ( $layout_data as $node_id => $node ) {
5590
+ if ( isset( $node->template_id ) && $node->template_id == $template_id ) {
5591
+ unset( $layout_data[ $node_id ]->template_id );
5592
+ unset( $layout_data[ $node_id ]->template_node_id );
5593
+ unset( $layout_data[ $node_id ]->template_root_node );
5594
+ }
5595
  }
5596
 
5597
  // Update the layout data.
6370
  'enabled' => true,
6371
  'tour' => true,
6372
  'video' => true,
6373
+ 'video_embed' => '<iframe src="https://player.vimeo.com/video/240550556?autoplay=1" width="420" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
6374
  'knowledge_base' => true,
6375
  'knowledge_base_url' => self::get_store_url( 'knowledge-base', array(
6376
  'utm_medium' => ( true === FL_BUILDER_LITE ? 'bb-lite' : 'bb-pro' ),
classes/class-fl-builder-revisions.php CHANGED
@@ -26,8 +26,8 @@ final class FLBuilderRevisions {
26
  * @return array
27
  */
28
  static public function ui_js_config( $config ) {
29
- $config['revisions'] = self::get_config( $config['postId'] );
30
-
31
  return $config;
32
  }
33
 
@@ -138,10 +138,12 @@ final class FLBuilderRevisions {
138
  $data = FLBuilderModel::get_layout_data( 'published', $revision_id );
139
 
140
  FLBuilderModel::update_layout_data( $data );
141
-
 
142
  return array(
143
- 'layout' => FLBuilderAJAXLayout::render(),
144
- 'config' => FLBuilderUISettingsForms::get_node_js_config(),
 
145
  );
146
  }
147
  }
26
  * @return array
27
  */
28
  static public function ui_js_config( $config ) {
29
+ $config['revisions'] = self::get_config( $config['postId'] );
30
+ $config['revisions_count'] = isset( $config['revisions']['posts'] ) && is_array( $config['revisions']['posts'] ) ? count( $config['revisions']['posts'] ) : 0;
31
  return $config;
32
  }
33
 
138
  $data = FLBuilderModel::get_layout_data( 'published', $revision_id );
139
 
140
  FLBuilderModel::update_layout_data( $data );
141
+ $settings = get_post_meta( $revision_id, '_fl_builder_data_settings', true );
142
+ update_post_meta( FLBuilderModel::get_post_id(), '_fl_builder_draft_settings', $settings );
143
  return array(
144
+ 'layout' => FLBuilderAJAXLayout::render(),
145
+ 'config' => FLBuilderUISettingsForms::get_node_js_config(),
146
+ 'settings' => $settings,
147
  );
148
  }
149
  }
classes/class-fl-builder-service-aweber.php CHANGED
@@ -116,6 +116,7 @@ final class FLBuilderServiceAWeber extends FLBuilderService {
116
  'class' => 'fl-builder-service-connect-input',
117
  'type' => 'text',
118
  'label' => __( 'Authorization Code', 'fl-builder' ),
 
119
  'description' => sprintf( __( 'Please register this website with AWeber to get your Authorization Code. <a%s>Register Now</a>', 'fl-builder' ), ' href="https://auth.aweber.com/1.0/oauth/authorize_app/baa1f131" target="_blank"' ),
120
  'preview' => array(
121
  'type' => 'none',
@@ -283,6 +284,7 @@ final class FLBuilderServiceAWeber extends FLBuilderService {
283
  }
284
  } catch ( AWeberAPIException $e ) {
285
  $response['error'] = sprintf(
 
286
  __( 'There was an error subscribing to AWeber. %s', 'fl-builder' ),
287
  $e->getMessage()
288
  );
@@ -301,6 +303,7 @@ final class FLBuilderServiceAWeber extends FLBuilderService {
301
  }
302
  } catch ( AWeberAPIException $e ) {
303
  $response['error'] = sprintf(
 
304
  __( 'There was an error subscribing to AWeber. %s', 'fl-builder' ),
305
  $e->getMessage()
306
  );
116
  'class' => 'fl-builder-service-connect-input',
117
  'type' => 'text',
118
  'label' => __( 'Authorization Code', 'fl-builder' ),
119
+ /* translators: %s: register url */
120
  'description' => sprintf( __( 'Please register this website with AWeber to get your Authorization Code. <a%s>Register Now</a>', 'fl-builder' ), ' href="https://auth.aweber.com/1.0/oauth/authorize_app/baa1f131" target="_blank"' ),
121
  'preview' => array(
122
  'type' => 'none',
284
  }
285
  } catch ( AWeberAPIException $e ) {
286
  $response['error'] = sprintf(
287
+ /* translators: %s: error */
288
  __( 'There was an error subscribing to AWeber. %s', 'fl-builder' ),
289
  $e->getMessage()
290
  );
303
  }
304
  } catch ( AWeberAPIException $e ) {
305
  $response['error'] = sprintf(
306
+ /* translators: %s: error */
307
  __( 'There was an error subscribing to AWeber. %s', 'fl-builder' ),
308
  $e->getMessage()
309
  );
classes/class-fl-builder-service-campayn.php CHANGED
@@ -108,6 +108,7 @@ final class FLBuilderServiceCampayn extends FLBuilderService {
108
  'api_key' => $fields['api_key'],
109
  );
110
  } else {
 
111
  $response['error'] = sprintf( __( 'Error: Could not connect to Campayn. %s', 'fl-builder' ), $result['error'] );
112
  }
113
  }
@@ -170,6 +171,7 @@ final class FLBuilderServiceCampayn extends FLBuilderService {
170
  );
171
 
172
  if ( isset( $results['error'] ) ) {
 
173
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $results['error'] );
174
  } else {
175
  $response['html'] = $this->render_list_field( $results, $settings );
@@ -278,6 +280,7 @@ final class FLBuilderServiceCampayn extends FLBuilderService {
278
  ) );
279
 
280
  if ( isset( $result['error'] ) ) {
 
281
  $response['error'] = sprintf( __( 'There was an error subscribing to Campayn. %s', 'fl-builder' ), $result['error'] );
282
  }
283
  }
108
  'api_key' => $fields['api_key'],
109
  );
110
  } else {
111
+ /* translators: %s: error */
112
  $response['error'] = sprintf( __( 'Error: Could not connect to Campayn. %s', 'fl-builder' ), $result['error'] );
113
  }
114
  }
171
  );
172
 
173
  if ( isset( $results['error'] ) ) {
174
+ /* translators: %s: error */
175
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $results['error'] );
176
  } else {
177
  $response['html'] = $this->render_list_field( $results, $settings );
280
  ) );
281
 
282
  if ( isset( $result['error'] ) ) {
283
+ /* translators: %s: error */
284
  $response['error'] = sprintf( __( 'There was an error subscribing to Campayn. %s', 'fl-builder' ), $result['error'] );
285
  }
286
  }
classes/class-fl-builder-service-constant-contact.php CHANGED
@@ -53,6 +53,7 @@ final class FLBuilderServiceConstantContact extends FLBuilderService {
53
  $request = json_decode( wp_remote_retrieve_body( wp_remote_get( $url ) ) );
54
 
55
  if ( ! is_array( $request ) || ( isset( $request[0] ) && isset( $request[0]->error_message ) ) ) {
 
56
  $response['error'] = sprintf( __( 'Error: Could not connect to Constant Contact. %s', 'fl-builder' ), $request[0]->error_message );
57
  } else {
58
  $response['data'] = array(
@@ -91,6 +92,7 @@ final class FLBuilderServiceConstantContact extends FLBuilderService {
91
  'type' => 'text',
92
  'label' => __( 'Access Token', 'fl-builder' ),
93
  'help' => __( 'Your Constant Contact access token.', 'fl-builder' ),
 
94
  'description' => sprintf( __( 'You must register a <a%1$s>Developer Account</a> with Constant Contact to obtain an API key and access token. Please see <a%2$s>Getting an API key</a> for complete instructions.', 'fl-builder' ), ' href="https://constantcontact.mashery.com/member/register" target="_blank"', ' href="https://developer.constantcontact.com/home/api-keys.html" target="_blank"' ),
95
  'preview' => array(
96
  'type' => 'none',
@@ -123,6 +125,7 @@ final class FLBuilderServiceConstantContact extends FLBuilderService {
123
  );
124
 
125
  if ( ! is_array( $request ) || ( isset( $request[0] ) && isset( $request[0]->error_message ) ) ) {
 
126
  $response['error'] = sprintf( __( 'Error: Could not connect to Constant Contact. %s', 'fl-builder' ), $request[0]->error_message );
127
  } else {
128
  $response['html'] = $this->render_list_field( $request, $settings );
@@ -233,6 +236,7 @@ final class FLBuilderServiceConstantContact extends FLBuilderService {
233
  $res = json_decode( wp_remote_retrieve_body( $update ) );
234
 
235
  if ( isset( $res->error_key ) ) {
 
236
  $response['error'] = sprintf( __( 'There was an error subscribing to Constant Contact. %s', 'fl-builder' ), $res->error_key );
237
  }
238
  } else {
@@ -265,6 +269,7 @@ final class FLBuilderServiceConstantContact extends FLBuilderService {
265
  $create = wp_remote_post( $url, $args );
266
 
267
  if ( isset( $create->error_key ) ) {
 
268
  $response['error'] = sprintf( __( 'There was an error subscribing to Constant Contact. %s', 'fl-builder' ), $create->error_key );
269
  }
270
  }
53
  $request = json_decode( wp_remote_retrieve_body( wp_remote_get( $url ) ) );
54
 
55
  if ( ! is_array( $request ) || ( isset( $request[0] ) && isset( $request[0]->error_message ) ) ) {
56
+ /* translators: %s: error */
57
  $response['error'] = sprintf( __( 'Error: Could not connect to Constant Contact. %s', 'fl-builder' ), $request[0]->error_message );
58
  } else {
59
  $response['data'] = array(
92
  'type' => 'text',
93
  'label' => __( 'Access Token', 'fl-builder' ),
94
  'help' => __( 'Your Constant Contact access token.', 'fl-builder' ),
95
+ /* translators: 1: account link: 2: api key link */
96
  'description' => sprintf( __( 'You must register a <a%1$s>Developer Account</a> with Constant Contact to obtain an API key and access token. Please see <a%2$s>Getting an API key</a> for complete instructions.', 'fl-builder' ), ' href="https://constantcontact.mashery.com/member/register" target="_blank"', ' href="https://developer.constantcontact.com/home/api-keys.html" target="_blank"' ),
97
  'preview' => array(
98
  'type' => 'none',
125
  );
126
 
127
  if ( ! is_array( $request ) || ( isset( $request[0] ) && isset( $request[0]->error_message ) ) ) {
128
+ /* translators: %s: error */
129
  $response['error'] = sprintf( __( 'Error: Could not connect to Constant Contact. %s', 'fl-builder' ), $request[0]->error_message );
130
  } else {
131
  $response['html'] = $this->render_list_field( $request, $settings );
236
  $res = json_decode( wp_remote_retrieve_body( $update ) );
237
 
238
  if ( isset( $res->error_key ) ) {
239
+ /* translators: %s: error */
240
  $response['error'] = sprintf( __( 'There was an error subscribing to Constant Contact. %s', 'fl-builder' ), $res->error_key );
241
  }
242
  } else {
269
  $create = wp_remote_post( $url, $args );
270
 
271
  if ( isset( $create->error_key ) ) {
272
+ /* translators: %s: error */
273
  $response['error'] = sprintf( __( 'There was an error subscribing to Constant Contact. %s', 'fl-builder' ), $create->error_key );
274
  }
275
  }
classes/class-fl-builder-service-convertkit.php CHANGED
@@ -72,6 +72,7 @@ final class FLBuilderServiceConvertKit extends FLBuilderService {
72
  'api_key' => $fields['api_key'],
73
  );
74
  } else {
 
75
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $api::$response['error_message'] );
76
  }
77
  }
@@ -202,6 +203,7 @@ final class FLBuilderServiceConvertKit extends FLBuilderService {
202
  if ( isset( $result->error ) ) {
203
  $message = isset( $result->message ) ? $result->message : '';
204
  $response['error'] = sprintf(
 
205
  __( 'There was an error subscribing to ConvertKit. Error: %s', 'fl-builder' ),
206
  $message
207
  );
72
  'api_key' => $fields['api_key'],
73
  );
74
  } else {
75
+ /* translators: %s: error */
76
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $api::$response['error_message'] );
77
  }
78
  }
203
  if ( isset( $result->error ) ) {
204
  $message = isset( $result->message ) ? $result->message : '';
205
  $response['error'] = sprintf(
206
+ /* translators: %s: error */
207
  __( 'There was an error subscribing to ConvertKit. Error: %s', 'fl-builder' ),
208
  $message
209
  );
classes/class-fl-builder-service-drip.php CHANGED
@@ -84,12 +84,14 @@ final class FLBuilderServiceDrip extends FLBuilderService {
84
  }
85
  } catch ( Exception $e ) {
86
  $response['error'] = sprintf(
 
87
  __( 'Error: Please check your Account ID. %s', 'fl-builder' ),
88
  $e->getMessage()
89
  );
90
  }
91
  } catch ( Exception $e ) {
92
  $response['error'] = sprintf(
 
93
  __( 'Error: Please check your API token. %s', 'fl-builder' ),
94
  $e->getMessage()
95
  );
@@ -113,6 +115,7 @@ final class FLBuilderServiceDrip extends FLBuilderService {
113
  'class' => 'fl-builder-service-connect-input',
114
  'type' => 'text',
115
  'label' => __( 'API Token', 'fl-builder' ),
 
116
  'description' => sprintf( __( 'Your API Token can be found in your Drip account under Settings > My User Settings. Or, you can click this <a%s>direct link</a>.', 'fl-builder' ), ' href="https://www.getdrip.com/user/edit" target="_blank"' ),
117
  'preview' => array(
118
  'type' => 'none',
@@ -255,6 +258,7 @@ final class FLBuilderServiceDrip extends FLBuilderService {
255
  }
256
  } catch ( Exception $e ) {
257
  $response['error'] = sprintf(
 
258
  __( 'There was an error searching contact from Drip. %s', 'fl-builder' ),
259
  $e->getMessage()
260
  );
@@ -287,6 +291,7 @@ final class FLBuilderServiceDrip extends FLBuilderService {
287
  }
288
  } catch ( Exception $e ) {
289
  $response['error'] = sprintf(
 
290
  __( 'There was an error subscribing to Drip. %s', 'fl-builder' ),
291
  $e->getMessage()
292
  );
84
  }
85
  } catch ( Exception $e ) {
86
  $response['error'] = sprintf(
87
+ /* translators: %s: error */
88
  __( 'Error: Please check your Account ID. %s', 'fl-builder' ),
89
  $e->getMessage()
90
  );
91
  }
92
  } catch ( Exception $e ) {
93
  $response['error'] = sprintf(
94
+ /* translators: %s: error */
95
  __( 'Error: Please check your API token. %s', 'fl-builder' ),
96
  $e->getMessage()
97
  );
115
  'class' => 'fl-builder-service-connect-input',
116
  'type' => 'text',
117
  'label' => __( 'API Token', 'fl-builder' ),
118
+ /* translators: %s: api url */
119
  'description' => sprintf( __( 'Your API Token can be found in your Drip account under Settings > My User Settings. Or, you can click this <a%s>direct link</a>.', 'fl-builder' ), ' href="https://www.getdrip.com/user/edit" target="_blank"' ),
120
  'preview' => array(
121
  'type' => 'none',
258
  }
259
  } catch ( Exception $e ) {
260
  $response['error'] = sprintf(
261
+ /* translators: %s: error */
262
  __( 'There was an error searching contact from Drip. %s', 'fl-builder' ),
263
  $e->getMessage()
264
  );
291
  }
292
  } catch ( Exception $e ) {
293
  $response['error'] = sprintf(
294
+ /* translators: %s: error */
295
  __( 'There was an error subscribing to Drip. %s', 'fl-builder' ),
296
  $e->getMessage()
297
  );
classes/class-fl-builder-service-enormail.php CHANGED
@@ -77,6 +77,7 @@ final class FLBuilderServiceEnormail extends FLBuilderService {
77
  'api_key' => $fields['api_key'],
78
  );
79
  } else {
 
80
  $response['error'] = sprintf(__( 'Error: Could not connect to Enormail. %s', 'fl-builder' ),
81
  '(' . $api_response->error->http_code . ': ' . $api_response->error->message . ')'
82
  );
@@ -215,6 +216,7 @@ final class FLBuilderServiceEnormail extends FLBuilderService {
215
  $get_results = json_decode( $result );
216
 
217
  if ( isset( $get_results->status ) && 'error' === $get_results->status ) {
 
218
  $response['error'] = sprintf(__( 'There was an error subscribing to Enormail. %s', 'fl-builder' ),
219
  '(' . $get_results->code . ': ' . $get_results->message . ')'
220
  );
77
  'api_key' => $fields['api_key'],
78
  );
79
  } else {
80
+ /* translators: %s: error */
81
  $response['error'] = sprintf(__( 'Error: Could not connect to Enormail. %s', 'fl-builder' ),
82
  '(' . $api_response->error->http_code . ': ' . $api_response->error->message . ')'
83
  );
216
  $get_results = json_decode( $result );
217
 
218
  if ( isset( $get_results->status ) && 'error' === $get_results->status ) {
219
+ /* translators: %s: error */
220
  $response['error'] = sprintf(__( 'There was an error subscribing to Enormail. %s', 'fl-builder' ),
221
  '(' . $get_results->code . ': ' . $get_results->message . ')'
222
  );
classes/class-fl-builder-service-getresponse.php CHANGED
@@ -243,6 +243,7 @@ final class FLBuilderServiceGetResponse extends FLBuilderService {
243
  }
244
  } catch ( Exception $e ) {
245
  $response['error'] = sprintf(
 
246
  __( 'There was an error subscribing to GetResponse. %s', 'fl-builder' ),
247
  $e->getMessage()
248
  );
243
  }
244
  } catch ( Exception $e ) {
245
  $response['error'] = sprintf(
246
+ /* translators: %s: error */
247
  __( 'There was an error subscribing to GetResponse. %s', 'fl-builder' ),
248
  $e->getMessage()
249
  );
classes/class-fl-builder-service-godaddy-email-marketing.php CHANGED
@@ -110,6 +110,7 @@ final class FLBuilderServiceGoDaddyEmailMarketing extends FLBuilderService {
110
  'type' => 'text',
111
  'label' => __( 'API Key', 'fl-builder' ),
112
  'help' => __( 'Your API key from your GoDaddy Email Marketing account.', 'fl-builder' ),
 
113
  'description' => sprintf( __( '<a%1$s>Sign in</a> to get your username and API key. <a%2$s>Signup</a> if you don\'t have a GoDaddy Email Marketing account.', 'fl-builder' ), ' href="https://gem.godaddy.com/mwp/accounts" target="_blank"', ' href="https://sso.godaddy.com/account/create?path=/wordpress_plugin&app=gem&realm=idp&ssoreturnpath=/%3Fpath%3D%2Fwordpress_plugin%26app%3Dgem%26realm%3Didp" target="_blank"' ),
114
  'preview' => array(
115
  'type' => 'none',
110
  'type' => 'text',
111
  'label' => __( 'API Key', 'fl-builder' ),
112
  'help' => __( 'Your API key from your GoDaddy Email Marketing account.', 'fl-builder' ),
113
+ /* translators: 1: Godaddy account page: 2: Godaddy signup page */
114
  'description' => sprintf( __( '<a%1$s>Sign in</a> to get your username and API key. <a%2$s>Signup</a> if you don\'t have a GoDaddy Email Marketing account.', 'fl-builder' ), ' href="https://gem.godaddy.com/mwp/accounts" target="_blank"', ' href="https://sso.godaddy.com/account/create?path=/wordpress_plugin&app=gem&realm=idp&ssoreturnpath=/%3Fpath%3D%2Fwordpress_plugin%26app%3Dgem%26realm%3Didp" target="_blank"' ),
115
  'preview' => array(
116
  'type' => 'none',
classes/class-fl-builder-service-icontact-pro.php CHANGED
@@ -103,7 +103,8 @@ final class FLBuilderServiceIContactPro extends FLBuilderService {
103
  'profile_id' => $fields['profile_id'],
104
  );
105
  } catch ( Exception $e ) {
106
- $errors = $api->getErrors();
 
107
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact Pro. %s', 'fl-builder' ), $errors[0] );
108
  }
109
  }
@@ -148,6 +149,7 @@ final class FLBuilderServiceIContactPro extends FLBuilderService {
148
  'type' => 'text',
149
  'label' => __( 'App Password', 'fl-builder' ),
150
  'help' => __( 'Your iContact Pro app password.', 'fl-builder' ),
 
151
  'description' => sprintf( __( 'You must <a%1$s>create an app</a> in iContact Pro to obtain an app ID and password. Please see <a%2$s>the iContact docs</a> for complete instructions.', 'fl-builder' ), ' href="https://app.icontactpro.com/MKT/Settings/Api?returnUrl=/MKT/Settings" target="_blank"', ' href="http://www.icontact.com/developerportal/api-documentation/vocus-register-your-app/" target="_blank"' ),
152
  'preview' => array(
153
  'type' => 'none',
@@ -171,6 +173,7 @@ final class FLBuilderServiceIContactPro extends FLBuilderService {
171
  'type' => 'text',
172
  'label' => __( 'Profile ID', 'fl-builder' ),
173
  'help' => __( 'Your iContact Pro Profile ID.', 'fl-builder' ),
 
174
  'description' => sprintf( __( 'Your Company and Profile ID can also be found in the <a%1$s>iContact Pro API settings</a> under Account Information.', 'fl-builder' ), ' href="https://app.icontactpro.com/MKT/Settings/Api?returnUrl=/MKT/Settings" target="_blank"' ),
175
  'preview' => array(
176
  'type' => 'none',
@@ -209,7 +212,8 @@ final class FLBuilderServiceIContactPro extends FLBuilderService {
209
  $lists = $api->getLists();
210
  $response['html'] = $this->render_list_field( $lists, $settings );
211
  } catch ( Exception $e ) {
212
- $errors = $api->getErrors();
 
213
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact Pro. %s', 'fl-builder' ), $errors[0] );
214
  }
215
 
@@ -304,7 +308,8 @@ final class FLBuilderServiceIContactPro extends FLBuilderService {
304
 
305
  $api->subscribeContactToList( $result->contactId, $settings->list_id ); // @codingStandardsIgnoreLine
306
  } catch ( Exception $e ) {
307
- $errors = $api->getErrors();
 
308
  $response['error'] = sprintf( __( 'There was an error subscribing to iContact Pro. %s', 'fl-builder' ), $errors[0] );
309
  }
310
  }
103
  'profile_id' => $fields['profile_id'],
104
  );
105
  } catch ( Exception $e ) {
106
+ $errors = $api->getErrors();
107
+ /* translators: %s: error */
108
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact Pro. %s', 'fl-builder' ), $errors[0] );
109
  }
110
  }
149
  'type' => 'text',
150
  'label' => __( 'App Password', 'fl-builder' ),
151
  'help' => __( 'Your iContact Pro app password.', 'fl-builder' ),
152
+ /* translators: 1: create app url: 2: register url */
153
  'description' => sprintf( __( 'You must <a%1$s>create an app</a> in iContact Pro to obtain an app ID and password. Please see <a%2$s>the iContact docs</a> for complete instructions.', 'fl-builder' ), ' href="https://app.icontactpro.com/MKT/Settings/Api?returnUrl=/MKT/Settings" target="_blank"', ' href="http://www.icontact.com/developerportal/api-documentation/vocus-register-your-app/" target="_blank"' ),
154
  'preview' => array(
155
  'type' => 'none',
173
  'type' => 'text',
174
  'label' => __( 'Profile ID', 'fl-builder' ),
175
  'help' => __( 'Your iContact Pro Profile ID.', 'fl-builder' ),
176
+ /* translators: 1: api link */
177
  'description' => sprintf( __( 'Your Company and Profile ID can also be found in the <a%1$s>iContact Pro API settings</a> under Account Information.', 'fl-builder' ), ' href="https://app.icontactpro.com/MKT/Settings/Api?returnUrl=/MKT/Settings" target="_blank"' ),
178
  'preview' => array(
179
  'type' => 'none',
212
  $lists = $api->getLists();
213
  $response['html'] = $this->render_list_field( $lists, $settings );
214
  } catch ( Exception $e ) {
215
+ $errors = $api->getErrors();
216
+ /* translators: %s: error */
217
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact Pro. %s', 'fl-builder' ), $errors[0] );
218
  }
219
 
308
 
309
  $api->subscribeContactToList( $result->contactId, $settings->list_id ); // @codingStandardsIgnoreLine
310
  } catch ( Exception $e ) {
311
+ $errors = $api->getErrors();
312
+ /* translators: %s: error */
313
  $response['error'] = sprintf( __( 'There was an error subscribing to iContact Pro. %s', 'fl-builder' ), $errors[0] );
314
  }
315
  }
classes/class-fl-builder-service-icontact.php CHANGED
@@ -91,7 +91,8 @@ final class FLBuilderServiceIContact extends FLBuilderService {
91
  'app_password' => $fields['app_password'],
92
  );
93
  } catch ( Exception $e ) {
94
- $errors = $api->getErrors();
 
95
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact. %s', 'fl-builder' ), $errors[0] );
96
  }
97
  }
@@ -136,6 +137,7 @@ final class FLBuilderServiceIContact extends FLBuilderService {
136
  'type' => 'text',
137
  'label' => __( 'App Password', 'fl-builder' ),
138
  'help' => __( 'Your iContact app password.', 'fl-builder' ),
 
139
  'description' => sprintf( __( 'You must <a%1$s>create an app</a> in iContact to obtain an app ID and password. Please see <a%2$s>the iContact docs</a> for complete instructions.', 'fl-builder' ), ' href="https://app.icontact.com/icp/core/registerapp/" target="_blank"', ' href="http://www.icontact.com/developerportal/api-documentation/vocus-register-your-app/" target="_blank"' ),
140
  'preview' => array(
141
  'type' => 'none',
@@ -172,7 +174,8 @@ final class FLBuilderServiceIContact extends FLBuilderService {
172
  $lists = $api->getLists();
173
  $response['html'] = $this->render_list_field( $lists, $settings );
174
  } catch ( Exception $e ) {
175
- $errors = $api->getErrors();
 
176
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact. %s', 'fl-builder' ), $errors[0] );
177
  }
178
 
@@ -267,7 +270,8 @@ final class FLBuilderServiceIContact extends FLBuilderService {
267
  // @codingStandardsIgnoreLine
268
  $api->subscribeContactToList( $result->contactId, $settings->list_id );
269
  } catch ( Exception $e ) {
270
- $errors = $api->getErrors();
 
271
  $response['error'] = sprintf( __( 'There was an error subscribing to iContact. %s', 'fl-builder' ), $errors[0] );
272
  }
273
  }
91
  'app_password' => $fields['app_password'],
92
  );
93
  } catch ( Exception $e ) {
94
+ $errors = $api->getErrors();
95
+ /* translators: %s: error */
96
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact. %s', 'fl-builder' ), $errors[0] );
97
  }
98
  }
137
  'type' => 'text',
138
  'label' => __( 'App Password', 'fl-builder' ),
139
  'help' => __( 'Your iContact app password.', 'fl-builder' ),
140
+ /* translators: 1: create app url: 2: docs url */
141
  'description' => sprintf( __( 'You must <a%1$s>create an app</a> in iContact to obtain an app ID and password. Please see <a%2$s>the iContact docs</a> for complete instructions.', 'fl-builder' ), ' href="https://app.icontact.com/icp/core/registerapp/" target="_blank"', ' href="http://www.icontact.com/developerportal/api-documentation/vocus-register-your-app/" target="_blank"' ),
142
  'preview' => array(
143
  'type' => 'none',
174
  $lists = $api->getLists();
175
  $response['html'] = $this->render_list_field( $lists, $settings );
176
  } catch ( Exception $e ) {
177
+ $errors = $api->getErrors();
178
+ /* translators: %s: error */
179
  $response['error'] = sprintf( __( 'Error: Could not connect to iContact. %s', 'fl-builder' ), $errors[0] );
180
  }
181
 
270
  // @codingStandardsIgnoreLine
271
  $api->subscribeContactToList( $result->contactId, $settings->list_id );
272
  } catch ( Exception $e ) {
273
+ $errors = $api->getErrors();
274
+ /* translators: %s: error */
275
  $response['error'] = sprintf( __( 'There was an error subscribing to iContact. %s', 'fl-builder' ), $errors[0] );
276
  }
277
  }
classes/class-fl-builder-service-infusionsoft.php CHANGED
@@ -44,6 +44,7 @@ final class FLBuilderServiceInfusionsoft extends FLBuilderService {
44
  } catch ( iSDKException $e ) {
45
  $this->api_instance = new stdClass();
46
  $this->api_instance->error = sprintf(
 
47
  __( 'There was an error connecting to Infusionsoft. %s', 'fl-builder' ),
48
  $e->getMessage()
49
  );
@@ -281,6 +282,7 @@ final class FLBuilderServiceInfusionsoft extends FLBuilderService {
281
  }
282
  } catch ( iSDKException $e ) {
283
  $response['error'] = sprintf(
 
284
  __( 'There was an error subscribing to Infusionsoft. %s', 'fl-builder' ),
285
  $e->getMessage()
286
  );
44
  } catch ( iSDKException $e ) {
45
  $this->api_instance = new stdClass();
46
  $this->api_instance->error = sprintf(
47
+ /* translators: %s: error */
48
  __( 'There was an error connecting to Infusionsoft. %s', 'fl-builder' ),
49
  $e->getMessage()
50
  );
282
  }
283
  } catch ( iSDKException $e ) {
284
  $response['error'] = sprintf(
285
+ /* translators: %s: error */
286
  __( 'There was an error subscribing to Infusionsoft. %s', 'fl-builder' ),
287
  $e->getMessage()
288
  );
classes/class-fl-builder-service-mailchimp.php CHANGED
@@ -338,6 +338,7 @@ final class FLBuilderServiceMailChimp extends FLBuilderService {
338
 
339
  if ( $api->getLastError() ) {
340
  $response['error'] = sprintf(
 
341
  __( 'There was an error subscribing to MailChimp. %s', 'fl-builder' ),
342
  $api->getLastError()
343
  );
338
 
339
  if ( $api->getLastError() ) {
340
  $response['error'] = sprintf(
341
+ /* translators: %s: error */
342
  __( 'There was an error subscribing to MailChimp. %s', 'fl-builder' ),
343
  $api->getLastError()
344
  );
classes/class-fl-builder-service-mailerlite.php CHANGED
@@ -84,6 +84,7 @@ final class FLBuilderServiceMailerLite extends FLBuilderService {
84
  'api_key' => $fields['api_key'],
85
  );
86
  } else {
 
87
  $response['error'] = sprintf( __( 'Error: Could not connect to MailerLite. %s', 'fl-builder' ), $get_api_response['http_code'] );
88
  }
89
  }
@@ -235,6 +236,7 @@ final class FLBuilderServiceMailerLite extends FLBuilderService {
235
  $result = $api->getResponseInfo();
236
 
237
  if ( 200 !== $result['http_code'] ) {
 
238
  $response['error'] = sprintf( __( 'There was an error subscribing to MailerLite. Code: %s', 'fl-builder' ), $result['http_code'] );
239
  }
240
  }
84
  'api_key' => $fields['api_key'],
85
  );
86
  } else {
87
+ /* translators: %s: error */
88
  $response['error'] = sprintf( __( 'Error: Could not connect to MailerLite. %s', 'fl-builder' ), $get_api_response['http_code'] );
89
  }
90
  }
236
  $result = $api->getResponseInfo();
237
 
238
  if ( 200 !== $result['http_code'] ) {
239
+ /* translators: %s: error */
240
  $response['error'] = sprintf( __( 'There was an error subscribing to MailerLite. Code: %s', 'fl-builder' ), $result['http_code'] );
241
  }
242
  }
classes/class-fl-builder-service-mailpoet.php CHANGED
@@ -191,6 +191,7 @@ final class FLBuilderServiceMailPoet extends FLBuilderService {
191
  $errors = $subscribed->getErrors();
192
 
193
  if ( false !== $errors ) {
 
194
  $response['error'] = sprintf( __( 'There was an error subscribing to MailPoet. %s', 'fl-builder' ), $errors[0] );
195
  }
196
  }
191
  $errors = $subscribed->getErrors();
192
 
193
  if ( false !== $errors ) {
194
+ /* translators: %s: error */
195
  $response['error'] = sprintf( __( 'There was an error subscribing to MailPoet. %s', 'fl-builder' ), $errors[0] );
196
  }
197
  }
classes/class-fl-builder-service-mailrelay.php CHANGED
@@ -92,6 +92,7 @@ final class FLBuilderServiceMailrelay extends FLBuilderService {
92
  'api_key' => $fields['api_key'],
93
  );
94
  } else {
 
95
  $response['error'] = sprintf( __( 'Error: Could not connect to Mailrelay. %s', 'fl-builder' ), $result['error'] );
96
  }
97
  }
@@ -157,6 +158,7 @@ final class FLBuilderServiceMailrelay extends FLBuilderService {
157
  );
158
 
159
  if ( isset( $result['error'] ) ) {
 
160
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $result['error'] );
161
  } else {
162
  $response['html'] = $this->render_list_field( $result['data'], $settings );
@@ -230,6 +232,7 @@ final class FLBuilderServiceMailrelay extends FLBuilderService {
230
  ) );
231
 
232
  if ( isset( $result['error'] ) ) {
 
233
  $response['error'] = sprintf( __( 'There was an error subscribing to Mailrelay. %s', 'fl-builder' ), $result['error'] );
234
  }
235
  }
92
  'api_key' => $fields['api_key'],
93
  );
94
  } else {
95
+ /* translators: %s: error */
96
  $response['error'] = sprintf( __( 'Error: Could not connect to Mailrelay. %s', 'fl-builder' ), $result['error'] );
97
  }
98
  }
158
  );
159
 
160
  if ( isset( $result['error'] ) ) {
161
+ /* translators: %s: error */
162
  $response['error'] = sprintf( __( 'Error: Please check your API key. %s', 'fl-builder' ), $result['error'] );
163
  } else {
164
  $response['html'] = $this->render_list_field( $result['data'], $settings );
232
  ) );
233
 
234
  if ( isset( $result['error'] ) ) {
235
+ /* translators: %s: error */
236
  $response['error'] = sprintf( __( 'There was an error subscribing to Mailrelay. %s', 'fl-builder' ), $result['error'] );
237
  }
238
  }
classes/class-fl-builder-service-mautic.php CHANGED
@@ -104,7 +104,7 @@ final class FLBuilderServiceMautic extends FLBuilderService {
104
  if ( isset( $get_response['errors'] ) && count( $get_response['errors'] ) > 0 ) {
105
  $error_message = '[' . $get_response['errors'][0]['code'] . '] ' . $get_response['errors'][0]['message'];
106
  }
107
-
108
  $response['error'] = sprintf( __( 'Error: Could not connect to Mautic. %s', 'fl-builder' ), $error_message );
109
  }
110
  }
@@ -277,6 +277,7 @@ final class FLBuilderServiceMautic extends FLBuilderService {
277
 
278
  if ( isset( $get_api_response['errors'] ) && count( $get_api_response['errors'] ) > 0 ) {
279
  $response['error'] = sprintf(
 
280
  __( 'There was an error subscribing to Mautic. %s', 'fl-builder' ),
281
  '[' . $get_api_response['errors'][0]['code'] . '] ' . $get_api_response['errors'][0]['message']
282
  );
104
  if ( isset( $get_response['errors'] ) && count( $get_response['errors'] ) > 0 ) {
105
  $error_message = '[' . $get_response['errors'][0]['code'] . '] ' . $get_response['errors'][0]['message'];
106
  }
107
+ /* translators: %s: error */
108
  $response['error'] = sprintf( __( 'Error: Could not connect to Mautic. %s', 'fl-builder' ), $error_message );
109
  }
110
  }
277
 
278
  if ( isset( $get_api_response['errors'] ) && count( $get_api_response['errors'] ) > 0 ) {
279
  $response['error'] = sprintf(
280
+ /* translators: %s: error */
281
  __( 'There was an error subscribing to Mautic. %s', 'fl-builder' ),
282
  '[' . $get_api_response['errors'][0]['code'] . '] ' . $get_api_response['errors'][0]['message']
283
  );
classes/class-fl-builder-service-ontraport.php CHANGED
@@ -86,6 +86,7 @@ final class FLBuilderServiceOntraport extends FLBuilderService {
86
  );
87
  } else {
88
  $response['error'] = sprintf(
 
89
  __( 'Error: Please check your API token. Code: %s', 'fl-builder' ),
90
  $status_code
91
  );
@@ -247,6 +248,7 @@ final class FLBuilderServiceOntraport extends FLBuilderService {
247
 
248
  if ( 200 !== $api->getLastStatusCode() ) {
249
  $response['error'] = sprintf(
 
250
  __( 'There was an error subscribing to Ontraport. Code: %s', 'fl-builder' ),
251
  $api->getLastStatusCode()
252
  );
86
  );
87
  } else {
88
  $response['error'] = sprintf(
89
+ /* translators: %s: error code */
90
  __( 'Error: Please check your API token. Code: %s', 'fl-builder' ),
91
  $status_code
92
  );
248
 
249
  if ( 200 !== $api->getLastStatusCode() ) {
250
  $response['error'] = sprintf(
251
+ /* translators: %s: error code */
252
  __( 'There was an error subscribing to Ontraport. Code: %s', 'fl-builder' ),
253
  $api->getLastStatusCode()
254
  );
classes/class-fl-builder-service-sendinblue.php CHANGED
@@ -71,6 +71,7 @@ final class FLBuilderServiceSendinBlue extends FLBuilderService {
71
  if ( ! is_array( $result ) ) {
72
  $response['error'] = __( 'There was an error connecting to SendinBlue. Please try again.', 'fl-builder' );
73
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
 
74
  $response['error'] = sprintf( __( 'Error: Could not connect to SendinBlue. %s', 'fl-builder' ), $result['message'] );
75
  } else {
76
  $response['data'] = array(
@@ -129,6 +130,7 @@ final class FLBuilderServiceSendinBlue extends FLBuilderService {
129
  if ( ! is_array( $result ) ) {
130
  $response['error'] = __( 'There was an error connecting to SendinBlue. Please try again.', 'fl-builder' );
131
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
 
132
  $response['error'] = sprintf( __( 'Error: Could not connect to SendinBlue. %s', 'fl-builder' ), $result['message'] );
133
  } else {
134
  $response['html'] = $this->render_list_field( $result['data']['lists'], $settings );
@@ -222,6 +224,7 @@ final class FLBuilderServiceSendinBlue extends FLBuilderService {
222
  if ( ! is_array( $result ) ) {
223
  $response['error'] = __( 'There was an error subscribing to SendinBlue. Please try again.', 'fl-builder' );
224
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
 
225
  $response['error'] = sprintf( __( 'Error: Could not subscribe to SendinBlue. %s', 'fl-builder' ), $result['message'] );
226
  }
227
  }
71
  if ( ! is_array( $result ) ) {
72
  $response['error'] = __( 'There was an error connecting to SendinBlue. Please try again.', 'fl-builder' );
73
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
74
+ /* translators: %s: error */
75
  $response['error'] = sprintf( __( 'Error: Could not connect to SendinBlue. %s', 'fl-builder' ), $result['message'] );
76
  } else {
77
  $response['data'] = array(
130
  if ( ! is_array( $result ) ) {
131
  $response['error'] = __( 'There was an error connecting to SendinBlue. Please try again.', 'fl-builder' );
132
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
133
+ /* translators: %s: error */
134
  $response['error'] = sprintf( __( 'Error: Could not connect to SendinBlue. %s', 'fl-builder' ), $result['message'] );
135
  } else {
136
  $response['html'] = $this->render_list_field( $result['data']['lists'], $settings );
224
  if ( ! is_array( $result ) ) {
225
  $response['error'] = __( 'There was an error subscribing to SendinBlue. Please try again.', 'fl-builder' );
226
  } elseif ( isset( $result['code'] ) && 'failure' == $result['code'] ) {
227
+ /* translators: %s: error */
228
  $response['error'] = sprintf( __( 'Error: Could not subscribe to SendinBlue. %s', 'fl-builder' ), $result['message'] );
229
  }
230
  }
classes/class-fl-builder-service-sendy.php CHANGED
@@ -90,6 +90,7 @@ final class FLBuilderServiceSendy extends FLBuilderService {
90
  'list_id' => $fields['list_id'],
91
  );
92
  } else {
 
93
  $response['error'] = sprintf( __( 'Error: Could not connect to Sendy. %s', 'fl-builder' ), $get_api_response['message'] );
94
  }
95
  }
@@ -197,6 +198,7 @@ final class FLBuilderServiceSendy extends FLBuilderService {
197
  ) );
198
 
199
  if ( false === $get_api_response['status'] ) {
 
200
  $response['error'] = sprintf( __( 'There was an error subscribing to Sendy. %s', 'fl-builder' ), $get_api_response['message'] );
201
  }
202
  }
90
  'list_id' => $fields['list_id'],
91
  );
92
  } else {
93
+ /* translators: %s: error */
94
  $response['error'] = sprintf( __( 'Error: Could not connect to Sendy. %s', 'fl-builder' ), $get_api_response['message'] );
95
  }
96
  }
198
  ) );
199
 
200
  if ( false === $get_api_response['status'] ) {
201
+ /* translators: %s: error */
202
  $response['error'] = sprintf( __( 'There was an error subscribing to Sendy. %s', 'fl-builder' ), $get_api_response['message'] );
203
  }
204
  }
classes/class-fl-builder-ui-settings-forms.php CHANGED
@@ -25,6 +25,7 @@ class FLBuilderUISettingsForms {
25
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::enqueue_settings_config', 11 );
26
  add_action( 'wp_footer', __CLASS__ . '::init_js_config', 1 );
27
  add_action( 'wp_footer', __CLASS__ . '::render_js_templates', 11 );
 
28
  }
29
 
30
  /**
@@ -66,8 +67,7 @@ class FLBuilderUISettingsForms {
66
  wp_raise_memory_limit( 'bb-plugin' );
67
  }
68
 
69
- $type = sanitize_key( $_GET['fl_builder_load_settings_config'] );
70
- $handler = 'FLBuilderUISettingsForms::compress_settings_config';
71
 
72
  if ( 'modules' === $type ) {
73
  $settings = FLBuilderUISettingsForms::get_modules_js_config();
@@ -75,13 +75,9 @@ class FLBuilderUISettingsForms {
75
  $settings = FLBuilderUISettingsForms::get_js_config();
76
  }
77
 
78
- if ( @ini_get( 'zlib.output_compression' ) ) { // @codingStandardsIgnoreLine
79
- @ini_set( 'zlib.output_compression', 'Off' ); // @codingStandardsIgnoreLine
80
- $handler = null;
81
- }
82
  header( 'Content-Type: application/javascript' );
83
 
84
- ob_start( $handler );
85
  include FL_BUILDER_DIR . 'includes/ui-settings-config.php';
86
  ob_end_flush();
87
 
@@ -93,7 +89,7 @@ class FLBuilderUISettingsForms {
93
  * Attempts to use the output buffer gzip handler to compress
94
  * the settings config. We have to do it this way to prevent
95
  * errors we were running into on some hosts.
96
- *
97
  * @since 2.1.0.2
98
  * @param string $buffer $mode
99
  * @return string
@@ -314,8 +310,9 @@ class FLBuilderUISettingsForms {
314
  'title' => $module->name,
315
  'tabs' => $module->form,
316
  'assets' => array(
317
- 'css' => $css,
318
- 'js' => $js,
 
319
  ),
320
  );
321
  }
@@ -918,7 +915,7 @@ class FLBuilderUISettingsForms {
918
  } else {
919
  echo '<td>&nbsp;</td><td>';
920
  }
921
-
922
  echo '<a href="javascript:void(0);" onclick="return false;" class="fl-builder-field-add fl-builder-button" data-field="' . $arr_name . '">' . sprintf( _x( 'Add %s', 'Field name to add.', 'fl-builder' ), $field['label'] ) . '</a>';
923
  echo '</td>';
924
  echo '</tr>';
@@ -948,6 +945,15 @@ class FLBuilderUISettingsForms {
948
  'html' => $html,
949
  );
950
  }
 
 
 
 
 
 
 
 
 
951
  }
952
 
953
  FLBuilderUISettingsForms::init();
25
  add_action( 'wp_enqueue_scripts', __CLASS__ . '::enqueue_settings_config', 11 );
26
  add_action( 'wp_footer', __CLASS__ . '::init_js_config', 1 );
27
  add_action( 'wp_footer', __CLASS__ . '::render_js_templates', 11 );
28
+ add_filter( 'fl_builder_ui_js_config', __CLASS__ . '::layout_css_js' );
29
  }
30
 
31
  /**
67
  wp_raise_memory_limit( 'bb-plugin' );
68
  }
69
 
70
+ $type = sanitize_key( $_GET['fl_builder_load_settings_config'] );
 
71
 
72
  if ( 'modules' === $type ) {
73
  $settings = FLBuilderUISettingsForms::get_modules_js_config();
75
  $settings = FLBuilderUISettingsForms::get_js_config();
76
  }
77
 
 
 
 
 
78
  header( 'Content-Type: application/javascript' );
79
 
80
+ ob_start();
81
  include FL_BUILDER_DIR . 'includes/ui-settings-config.php';
82
  ob_end_flush();
83
 
89
  * Attempts to use the output buffer gzip handler to compress
90
  * the settings config. We have to do it this way to prevent
91
  * errors we were running into on some hosts.
92
+ * @deprecated 2.2.2
93
  * @since 2.1.0.2
94
  * @param string $buffer $mode
95
  * @return string
310
  'title' => $module->name,
311
  'tabs' => $module->form,
312
  'assets' => array(
313
+ 'css' => $css,
314
+ 'js' => $js,
315
+ 'jsurl' => $js_file_uri,
316
  ),
317
  );
318
  }
915
  } else {
916
  echo '<td>&nbsp;</td><td>';
917
  }
918
+ /* translators: %s: field name to add */
919
  echo '<a href="javascript:void(0);" onclick="return false;" class="fl-builder-field-add fl-builder-button" data-field="' . $arr_name . '">' . sprintf( _x( 'Add %s', 'Field name to add.', 'fl-builder' ), $field['label'] ) . '</a>';
920
  echo '</td>';
921
  echo '</tr>';
945
  'html' => $html,
946
  );
947
  }
948
+
949
+ static public function layout_css_js( $config ) {
950
+
951
+ $post_id = $config['postId'];
952
+ $settings = get_post_meta( $post_id, '_fl_builder_data_settings', true );
953
+
954
+ $config['layout_css_js'] = ( ( isset( $settings->css ) && '' !== $settings->css ) || ( isset( $settings->js ) && '' !== $settings->js ) ) ? true : false;
955
+ return $config;
956
+ }
957
  }
958
 
959
  FLBuilderUISettingsForms::init();
classes/class-fl-builder-usage.php CHANGED
@@ -99,6 +99,7 @@ final class FLBuilderUsage {
99
  );
100
 
101
  $message = sprintf(
 
102
  __( 'Would you like to help us improve %s by sending anonymous usage data?', 'fl-builder' ),
103
  FLBuilderModel::get_branding()
104
  );
99
  );
100
 
101
  $message = sprintf(
102
+ /* translators: %s: branded builder name */
103
  __( 'Would you like to help us improve %s by sending anonymous usage data?', 'fl-builder' ),
104
  FLBuilderModel::get_branding()
105
  );
classes/class-fl-builder-wp-blocks.php CHANGED
@@ -79,12 +79,17 @@ final class FLBuilderWPBlocks {
79
  'id' => $post->ID,
80
  ),
81
  'strings' => array(
 
82
  'active' => sprintf( _x( '%1$s is currently active for this %2$s.', '%1$s branded builder name. %2$s post type name.', 'fl-builder' ), $branding, strtolower( $post_type_name ) ),
 
83
  'convert' => sprintf( _x( 'Convert to %s', '%s branded builder name.', 'fl-builder' ), $branding ),
 
84
  'description' => sprintf( _x( '%s lets you drag and drop your layout on the frontend.', '%s branded builder name.', 'fl-builder' ), $branding ),
85
  'editor' => __( 'Use Standard Editor', 'fl-builder' ),
 
86
  'launch' => sprintf( _x( 'Launch %s', '%s branded builder name.', 'fl-builder' ), $branding ),
87
  'title' => $branding,
 
88
  'view' => sprintf( _x( 'View %s', '%s post type name.', 'fl-builder' ), $post_type_name ),
89
  'warning' => __( 'Switching to the native WordPress editor will disable your Beaver Builder layout until it is enabled again. Any edits made in the WordPress editor will not be converted to your Page Builded layout. Do you want to continue?', 'fl-builder' ),
90
  ),
79
  'id' => $post->ID,
80
  ),
81
  'strings' => array(
82
+ /* translators: 1: branded builder name: 2: post type name */
83
  'active' => sprintf( _x( '%1$s is currently active for this %2$s.', '%1$s branded builder name. %2$s post type name.', 'fl-builder' ), $branding, strtolower( $post_type_name ) ),
84
+ /* translators: %s: post type name */
85
  'convert' => sprintf( _x( 'Convert to %s', '%s branded builder name.', 'fl-builder' ), $branding ),
86
+ /* translators: %s: branded builder name */
87
  'description' => sprintf( _x( '%s lets you drag and drop your layout on the frontend.', '%s branded builder name.', 'fl-builder' ), $branding ),
88
  'editor' => __( 'Use Standard Editor', 'fl-builder' ),
89
+ /* translators: %s: branded builder name */
90
  'launch' => sprintf( _x( 'Launch %s', '%s branded builder name.', 'fl-builder' ), $branding ),
91
  'title' => $branding,
92
+ /* translators: %s: post type name */
93
  'view' => sprintf( _x( 'View %s', '%s post type name.', 'fl-builder' ), $post_type_name ),
94
  'warning' => __( 'Switching to the native WordPress editor will disable your Beaver Builder layout until it is enabled again. Any edits made in the WordPress editor will not be converted to your Page Builded layout. Do you want to continue?', 'fl-builder' ),
95
  ),
classes/class-fl-builder-wpcli-command.php CHANGED
@@ -62,9 +62,11 @@ class FLbuilder_WPCLI_Command extends WP_CLI_Command {
62
  $blog_id = $blog['blog_id'];
63
  switch_to_blog( $blog_id );
64
  FLBuilderModel::delete_asset_cache_for_all_posts();
 
65
  WP_CLI::success( sprintf( _x( 'Cleared the page builder cache for blog %s', 'current blog name', 'fl-builder' ), get_option( 'home' ) ) );
66
  if ( $all ) {
67
  FLCustomizer::refresh_css();
 
68
  WP_CLI::success( sprintf( _x( 'Rebuilt the theme cache for blog %s', 'current blog name', 'fl-builder' ), get_option( 'home' ) ) );
69
  }
70
  restore_current_blog();
@@ -112,23 +114,23 @@ class FLbuilder_WPCLI_Command extends WP_CLI_Command {
112
 
113
  if ( isset( $assoc_args['deactivate'] ) ) {
114
  FLUpdater::save_subscription_license( '' );
115
- WP_CLI::success( 'deactivated' );
116
  return false;
117
  }
118
 
119
  if ( defined( 'FL_LICENSE_KEY' ) ) {
120
  $license = FL_LICENSE_KEY;
121
- WP_CLI::log( 'Found license using FL_LICENSE_KEY global.' );
122
  }
123
  if ( isset( $assoc_args['license'] ) && '' != $assoc_args['license'] ) {
124
  $license = $assoc_args['license'];
125
  }
126
 
127
  if ( ! $license ) {
128
- WP_CLI::error( 'No license info found.' );
129
  }
130
-
131
- WP_CLI::log( sprintf( 'Using license [ %s ] to register %s', $license, network_home_url() ) );
132
 
133
  $response = FLUpdater::save_subscription_license( $license );
134
 
@@ -140,4 +142,358 @@ class FLbuilder_WPCLI_Command extends WP_CLI_Command {
140
  }
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  WP_CLI::add_command( 'beaver', 'FLbuilder_WPCLI_Command' );
 
62
  $blog_id = $blog['blog_id'];
63
  switch_to_blog( $blog_id );
64
  FLBuilderModel::delete_asset_cache_for_all_posts();
65
+ /* translators: %s: current blog name */
66
  WP_CLI::success( sprintf( _x( 'Cleared the page builder cache for blog %s', 'current blog name', 'fl-builder' ), get_option( 'home' ) ) );
67
  if ( $all ) {
68
  FLCustomizer::refresh_css();
69
+ /* translators: %s: current blog name */
70
  WP_CLI::success( sprintf( _x( 'Rebuilt the theme cache for blog %s', 'current blog name', 'fl-builder' ), get_option( 'home' ) ) );
71
  }
72
  restore_current_blog();
114
 
115
  if ( isset( $assoc_args['deactivate'] ) ) {
116
  FLUpdater::save_subscription_license( '' );
117
+ WP_CLI::success( __( 'Deactivated', 'fl-builder' ) );
118
  return false;
119
  }
120
 
121
  if ( defined( 'FL_LICENSE_KEY' ) ) {
122
  $license = FL_LICENSE_KEY;
123
+ WP_CLI::log( __( 'Found license using FL_LICENSE_KEY global.', 'fl-builder' ) );
124
  }
125
  if ( isset( $assoc_args['license'] ) && '' != $assoc_args['license'] ) {
126
  $license = $assoc_args['license'];
127
  }
128
 
129
  if ( ! $license ) {
130
+ WP_CLI::error( __( 'No license info found.', 'fl-builder' ) );
131
  }
132
+ /* translators: %1$s: license : %2$s: domain */
133
+ WP_CLI::log( sprintf( __( 'Using license [ %1$s ] to register %2$s', 'fl-builder' ), $license, network_home_url() ) );
134
 
135
  $response = FLUpdater::save_subscription_license( $license );
136
 
142
  }
143
  }
144
 
145
+ /**
146
+ * WP Cli commands for Beaver Themer.
147
+ */
148
+ class FLThemer_List_WPCLI_Command extends WP_CLI_Command {
149
+
150
+ var $fields = array(
151
+ 'id',
152
+ 'name',
153
+ 'status',
154
+ 'type',
155
+ 'hook',
156
+ 'locations',
157
+ );
158
+
159
+ /**
160
+ * Set status for Themer layout.
161
+ *
162
+ * ## OPTIONS
163
+ *
164
+ * [--id]
165
+ * Post ID of Themer layout
166
+ *
167
+ * [--status]
168
+ * Status to use, publish or draft
169
+ *
170
+ * ## EXAMPLES
171
+ *
172
+ * 1. wp beaver themer set-status --id=123 --status=publish
173
+ * - Set status for id 123 to publish
174
+ * 2. wp beaver themer set-status --id=456 --status=draft
175
+ * - Set status for id 456 to draft
176
+ * @subcommand set-status
177
+ */
178
+ public function set_status( $args, $assoc_args ) {
179
+
180
+ $this->is_themer();
181
+
182
+ if ( ! isset( $assoc_args['status'] ) ) {
183
+ WP_CLI::error( 'No status use --status=' );
184
+ exit;
185
+ }
186
+
187
+ if ( ! isset( $assoc_args['id'] ) ) {
188
+ WP_CLI::error( 'No id use --id=' );
189
+ exit;
190
+ }
191
+ $status = $assoc_args['status'];
192
+ $id = $assoc_args['id'];
193
+
194
+ if ( ! in_array( $status, array( 'publish', 'draft' ) ) ) {
195
+ WP_CLI::error( __( 'Status must be either draft or publish', 'fl-builder' ) );
196
+ exit;
197
+ }
198
+ $args = array(
199
+ 'ID' => $id,
200
+ 'post_status' => $status,
201
+ );
202
+
203
+ if ( 'fl-theme-layout' == get_post_type( $id ) ) {
204
+ wp_update_post( $args );
205
+ WP_CLI::success( __( 'Layout status updated', 'fl-builder' ) );
206
+ } else {
207
+ WPCLI::error( __( 'Post was not valid Themer layout.', 'fl-builder' ) );
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Set type for Themer layout.
213
+ *
214
+ * ## OPTIONS
215
+ *
216
+ * [--id]
217
+ * Post ID of Themer layout
218
+ *
219
+ * [--type]
220
+ * Type to use, header, footer, archive, 404 or part
221
+ *
222
+ * [--hook] ( If using part )
223
+ * Part hook to use
224
+ *
225
+ * ## EXAMPLES
226
+ *
227
+ * 1. wp beaver themer set-type --id=123 --type=archive
228
+ * - Set typw for id 123 to archive
229
+ * 2. wp beaver themer set-type --id=456 --type=part --hook=fl_before_content
230
+ * - Set type for id 456 to part and set hook to fl_before_content
231
+ * @subcommand set-type
232
+ */
233
+ public function set_type( $args, $assoc_args ) {
234
+
235
+ $this->is_themer();
236
+
237
+ if ( ! isset( $assoc_args['type'] ) ) {
238
+ WP_CLI::error( 'No type use --type=' );
239
+ exit;
240
+ }
241
+
242
+ if ( ! isset( $assoc_args['id'] ) ) {
243
+ WP_CLI::error( 'No id use --id=' );
244
+ exit;
245
+ }
246
+ $type = $assoc_args['type'];
247
+ $id = $assoc_args['id'];
248
+ $hook = false;
249
+
250
+ if ( 'part' == $type ) {
251
+ if ( ! isset( $assoc_args['hook'] ) ) {
252
+ WP_CLI::error( 'No hook use --hook=' );
253
+ exit;
254
+ }
255
+ $hook = $assoc_args['hook'];
256
+ }
257
+
258
+ if ( ! in_array( $type, array( 'archive', 'single', 'part', 'header', 'footer', '404' ) ) ) {
259
+ WP_CLI::error( __( 'Incorrect type.', 'fl-builder' ) );
260
+ exit;
261
+ }
262
+
263
+ if ( 'fl-theme-layout' == get_post_type( $id ) ) {
264
+ update_post_meta( $id, '_fl_theme_layout_type', $type );
265
+ update_post_meta( $id, '_fl_theme_layout_hook', '' );
266
+ WP_CLI::success( __( 'Layout type updated', 'fl-builder' ) );
267
+ if ( false !== $hook && 'part' == $type ) {
268
+ update_post_meta( $id, '_fl_theme_layout_hook', $hook );
269
+ WP_CLI::success( __( 'Hook updated', 'fl-builder' ) );
270
+ }
271
+ } else {
272
+ WPCLI::error( __( 'Not valid Themer layout.', 'fl-builder' ) );
273
+ }
274
+ }
275
+
276
+ /**
277
+ * List all Themer layouts.
278
+ *
279
+ * ## EXAMPLE
280
+ *
281
+ * 1. wp beaver themer list
282
+ * - Returns list of all themer layouts.
283
+ *
284
+ * @subcommand list
285
+ */
286
+ public function themer_list( $args, $assoc_args ) {
287
+
288
+ $this->is_themer();
289
+
290
+ $results = array();
291
+ $args = array(
292
+ 'post_type' => 'fl-theme-layout',
293
+ 'post_status' => array( 'publish', 'draft' ),
294
+ 'meta_key' => '_fl_builder_enabled',
295
+ 'meta_value' => '1',
296
+ 'posts_per_page' => -1,
297
+ );
298
+ $query = new WP_Query( $args );
299
+ $posts = $query->posts;
300
+ foreach ( $posts as $post ) {
301
+ $type = get_post_meta( $post->ID, '_fl_theme_layout_type', true );
302
+ $locations = get_post_meta( $post->ID, '_fl_theme_builder_locations', true );
303
+ $hook = get_post_meta( $post->ID, '_fl_theme_layout_hook', true );
304
+ $results[] = array(
305
+ 'id' => $post->ID,
306
+ 'status' => $post->post_status,
307
+ 'name' => $post->post_title,
308
+ 'type' => $type,
309
+ 'hook' => $hook,
310
+ 'locations' => $this->format_locations( $locations ),
311
+ );
312
+ }
313
+
314
+ $formatter = new WP_CLI\Formatter( $assoc_args, $this->fields );
315
+ $formatter->display_items( $results );
316
+ }
317
+
318
+ /**
319
+ * List all possible Themer Part Hooks.
320
+ *
321
+ * ## EXAMPLE
322
+ *
323
+ * 1. wp beaver themer list-hooks
324
+ * - Returns list of all possible themer part hooks.
325
+ * @subcommand list-hooks
326
+ */
327
+ public function list_hooks( $args, $assoc_args ) {
328
+
329
+ $this->is_themer();
330
+
331
+ $hooks = FLThemeBuilderLayoutData::get_part_hooks();
332
+ $results = array();
333
+
334
+ $fields = array(
335
+ 'name',
336
+ 'hook',
337
+ );
338
+
339
+ foreach ( $hooks as $hook ) {
340
+
341
+ if ( is_array( $hook ) ) {
342
+ foreach ( $hook['hooks'] as $k => $location ) {
343
+ $results[] = array(
344
+ 'name' => $location,
345
+ 'hook' => $k,
346
+ );
347
+ }
348
+ }
349
+ }
350
+
351
+ $formatter = new WP_CLI\Formatter( $assoc_args, $fields );
352
+ $formatter->display_items( $results );
353
+ }
354
+
355
+ /**
356
+ * Add location to themer layout.
357
+ *
358
+ * ## OPTIONS
359
+ *
360
+ * [--id]
361
+ * Post ID of Themer layout
362
+ *
363
+ * [--location]
364
+ * Status to use, publish or draft
365
+ *
366
+ * [--postion] (Optional)
367
+ * Position in location array to insert new location
368
+ *
369
+ * ## EXAMPLES
370
+ *
371
+ * 1. wp beaver themer add-location --id=123 --location=general:single
372
+ * - Add location general:site to Themer layout 123
373
+ * 2. wp beaver themer add-location --id=123 --location=general:single --position=0
374
+ * - Add location general:site to Themer layout 123 in first element of array
375
+ * @subcommand add-location
376
+ */
377
+ public function add_location( $args, $assoc_args ) {
378
+
379
+ $this->is_themer();
380
+
381
+ if ( ! isset( $assoc_args['location'] ) ) {
382
+ WP_CLI::error( 'No location use --location=' );
383
+ exit;
384
+ }
385
+ if ( ! isset( $assoc_args['id'] ) ) {
386
+ WP_CLI::error( 'No id use --id=' );
387
+ exit;
388
+ }
389
+ $location = $assoc_args['location'];
390
+ $id = $assoc_args['id'];
391
+ $position = isset( $assoc_args['position'] ) ? $assoc_args['position'] : false;
392
+
393
+ $locations = (array) get_post_meta( $id, '_fl_theme_builder_locations', true );
394
+
395
+ if ( false !== $position ) {
396
+ array_splice( $locations, $position, 0, $location );
397
+ } else {
398
+ $locations[] = $location;
399
+ }
400
+
401
+ update_post_meta( $id, '_fl_theme_builder_locations', array_unique( $locations ) );
402
+
403
+ $post = get_post( $id );
404
+ $results = array();
405
+ $type = get_post_meta( $post->ID, '_fl_theme_layout_type', true );
406
+ $locations = get_post_meta( $post->ID, '_fl_theme_builder_locations', true );
407
+ $hook = get_post_meta( $post->ID, '_fl_theme_layout_hook', true );
408
+ $results[] = array(
409
+ 'id' => $post->ID,
410
+ 'status' => $post->post_status,
411
+ 'name' => $post->post_title,
412
+ 'type' => $type,
413
+ 'hook' => $hook,
414
+ 'locations' => $this->format_locations( $locations ),
415
+ );
416
+
417
+ $formatter = new WP_CLI\Formatter( $assoc_args, $this->fields );
418
+ $formatter->display_items( $results );
419
+ }
420
+
421
+ /**
422
+ * Delete location from themer layout.
423
+ *
424
+ * ## OPTIONS
425
+ *
426
+ * [--id]
427
+ * Post ID of Themer layout
428
+ *
429
+ * [--location]
430
+ * Status to use, publish or draft
431
+ *
432
+ *
433
+ * ## EXAMPLES
434
+ *
435
+ * 1. wp beaver themer del-location --id=123 --location=general:single
436
+ * - Remove location general:site from Themer layout 123
437
+ * @subcommand del-location
438
+ */
439
+ public function del_location( $args, $assoc_args ) {
440
+
441
+ $this->is_themer();
442
+
443
+ if ( ! isset( $assoc_args['location'] ) ) {
444
+ WP_CLI::error( 'No location use --location=' );
445
+ exit;
446
+ }
447
+ if ( ! isset( $assoc_args['id'] ) ) {
448
+ WP_CLI::error( 'No id use --id=' );
449
+ exit;
450
+ }
451
+ $location = $assoc_args['location'];
452
+ $id = $assoc_args['id'];
453
+
454
+ $locations = (array) get_post_meta( $id, '_fl_theme_builder_locations', true );
455
+
456
+ $find = array_search( $location, $locations );
457
+
458
+ if ( false !== $find ) {
459
+ unset( $locations[ $find ] );
460
+ } else {
461
+ WP_CLI::error( 'Location not found' );
462
+ }
463
+
464
+ update_post_meta( $id, '_fl_theme_builder_locations', array_unique( $locations ) );
465
+
466
+ $post = get_post( $id );
467
+ $results = array();
468
+ $type = get_post_meta( $post->ID, '_fl_theme_layout_type', true );
469
+ $locations = get_post_meta( $post->ID, '_fl_theme_builder_locations', true );
470
+ $hook = get_post_meta( $post->ID, '_fl_theme_layout_hook', true );
471
+ $results[] = array(
472
+ 'id' => $post->ID,
473
+ 'status' => $post->post_status,
474
+ 'name' => $post->post_title,
475
+ 'type' => $type,
476
+ 'hook' => $hook,
477
+ 'locations' => $this->format_locations( $locations ),
478
+ );
479
+
480
+ $formatter = new WP_CLI\Formatter( $assoc_args, $this->fields );
481
+ $formatter->display_items( $results );
482
+ }
483
+
484
+ protected function is_themer() {
485
+ if ( ! class_exists( 'FLThemeBuilder' ) ) {
486
+ WP_CLI::error( __( 'Unable to find Themer, is it installed and activated?', 'fl-builder' ) );
487
+ exit;
488
+ }
489
+ }
490
+
491
+ protected function format_locations( $data ) {
492
+ return implode( ', ', $data );
493
+ }
494
+ }
495
+ /**
496
+ * Add WPCLI commands
497
+ */
498
  WP_CLI::add_command( 'beaver', 'FLbuilder_WPCLI_Command' );
499
+ WP_CLI::add_command( 'beaver themer', 'FLThemer_List_WPCLI_Command' );
classes/class-fl-builder.php CHANGED
@@ -67,8 +67,8 @@ final class FLBuilder {
67
  * Font awesome urls.
68
  * @since 2.1
69
  */
70
- static public $fa4_url = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
71
- static public $fa5_pro_url = 'https://pro.fontawesome.com/releases/v5.8.0/css/all.css';
72
 
73
  /**
74
  * Initializes hooks.
@@ -100,6 +100,7 @@ final class FLBuilder {
100
  add_filter( 'tiny_mce_before_init', __CLASS__ . '::editor_font_sizes' );
101
  add_filter( 'the_content', __CLASS__ . '::render_content' );
102
  add_filter( 'wp_handle_upload_prefilter', __CLASS__ . '::wp_handle_upload_prefilter_filter' );
 
103
  }
104
 
105
  /**
@@ -389,21 +390,23 @@ final class FLBuilder {
389
  wp_register_style( 'yui3', $css_url . 'yui3.css', array(), $ver );
390
 
391
  // Register icon CDN CSS
392
- wp_register_style( 'font-awesome', self::$fa4_url, array(), $ver );
393
  wp_register_style( 'font-awesome-5', self::get_fa5_url(), array(), $ver );
 
 
394
  wp_register_style( 'foundation-icons', 'https://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.css', array(), $ver );
395
 
396
  // Register additional JS
397
  wp_register_script( 'fl-slideshow', $js_url . 'fl-slideshow' . $min . '.js', array( 'yui3' ), $ver, true );
398
  wp_register_script( 'fl-gallery-grid', $js_url . 'fl-gallery-grid.js', array( 'jquery' ), $ver, true );
399
- wp_register_script( 'jquery-bxslider', $js_url . 'jquery.bxslider.js', array( 'jquery-easing', 'jquery-fitvids' ), $ver, true );
400
  wp_register_script( 'jquery-easing', $js_url . 'jquery.easing.min.js', array( 'jquery' ), '1.4', true );
401
  wp_register_script( 'jquery-fitvids', $js_url . 'jquery.fitvids.min.js', array( 'jquery' ), '1.2', true );
402
  wp_register_script( 'jquery-infinitescroll', $js_url . 'jquery.infinitescroll.min.js', array( 'jquery' ), $ver, true );
403
- wp_register_script( 'jquery-magnificpopup', $js_url . 'jquery.magnificpopup.min.js', array( 'jquery' ), $ver, true );
404
- wp_register_script( 'jquery-mosaicflow', $js_url . 'jquery.mosaicflow.min.js', array( 'jquery' ), $ver, true );
405
  wp_register_script( 'jquery-waypoints', $js_url . 'jquery.waypoints.min.js', array( 'jquery' ), $ver, true );
406
  wp_register_script( 'jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array( 'jquery' ), $ver, true );
 
407
  wp_register_script( 'yui3', $js_url . 'yui3.min.js', array(), $ver, true );
408
  wp_register_script( 'youtube-player', 'https://www.youtube.com/iframe_api', array(), $ver, true );
409
  wp_register_script( 'vimeo-player', 'https://player.vimeo.com/api/player.js', array(), $ver, true );
@@ -658,13 +661,6 @@ final class FLBuilder {
658
 
659
  /* Frontend builder styles */
660
  wp_enqueue_style( 'dashicons' );
661
-
662
- /**
663
- * FA4 css and FA5 css do not mix well and actually break some of the icvons in the selector.
664
- */
665
- if ( in_array( 'font-awesome', FLBuilderModel::get_enabled_icons() ) ) {
666
- wp_enqueue_style( 'font-awesome' );
667
- }
668
  wp_enqueue_style( 'font-awesome-5' );
669
  wp_enqueue_style( 'foundation-icons' );
670
  wp_enqueue_style( 'jquery-nanoscroller', $css_url . 'jquery.nanoscroller.css', array(), $ver );
@@ -738,7 +734,8 @@ final class FLBuilder {
738
  wp_enqueue_script( 'fl-lightbox', $js_url . 'fl-lightbox.js', array(), $ver );
739
  wp_enqueue_script( 'fl-icon-selector', $js_url . 'fl-icon-selector.js', array(), $ver );
740
  wp_enqueue_script( 'fl-stylesheet', $js_url . 'fl-stylesheet.js', array(), $ver );
741
- wp_enqueue_script( 'fl-builder', $js_url . 'fl-builder.js', array(), $ver );
 
742
  wp_enqueue_script( 'fl-builder-ajax-layout', $js_url . 'fl-builder-ajax-layout.js', array(), $ver );
743
  wp_enqueue_script( 'fl-builder-preview', $js_url . 'fl-builder-preview.js', array(), $ver );
744
  wp_enqueue_script( 'fl-builder-simulate-media-query', $js_url . 'fl-builder-simulate-media-query.js', array(), $ver );
@@ -1323,10 +1320,16 @@ final class FLBuilder {
1323
  if ( '' == $icon_url ) {
1324
  $wrapper_classes[] = 'fl-builder-bar-title-no-icon';
1325
  }
 
 
 
 
 
 
1326
 
1327
- $edited_object_label = get_post_type_object( $post->post_type )->labels->singular_name;
1328
- $pretitle = sprintf( _x( 'Currently Editing %s', 'Currently editing message', 'fl-builder' ), $edited_object_label );
1329
- $pretitle = apply_filters( 'fl_builder_ui_bar_pretitle', $pretitle );
1330
 
1331
  // Render the bar title.
1332
  include FL_BUILDER_DIR . 'includes/ui-bar-title-area.php';
@@ -1476,7 +1479,7 @@ final class FLBuilder {
1476
  self::enqueue_layout_styles_scripts_by_id( $query_post->ID );
1477
 
1478
  // Print the styles if we are outside of the head tag.
1479
- if ( did_action( 'wp_enqueue_scripts' ) && 'wp_enqueue_scripts' !== current_filter() ) {
1480
  wp_print_styles();
1481
  }
1482
 
@@ -2109,7 +2112,7 @@ final class FLBuilder {
2109
  'data-node' => $group->node,
2110
  );
2111
 
2112
- if ( 'column' == $parent->type ) {
2113
  $attrs['class'][] = 'fl-col-group-nested';
2114
  }
2115
 
@@ -3390,6 +3393,7 @@ final class FLBuilder {