WordPress Page Builder – Beaver Builder - Version 1.9.5.1

Version Description

Download this release

Release Info

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

Code changes from version 1.9.4 to 1.9.5.1

Files changed (73) hide show
  1. .gitattributes +0 -1
  2. changelog.txt +53 -0
  3. classes/class-fl-builder-ajax-layout.php +8 -1
  4. classes/class-fl-builder-ajax.php +3 -1
  5. classes/class-fl-builder-fonts.php +126 -10
  6. classes/class-fl-builder-import.php +1 -1
  7. classes/class-fl-builder-importer.php +1 -1
  8. classes/class-fl-builder-loader.php +1 -1
  9. classes/class-fl-builder-loop.php +129 -14
  10. classes/class-fl-builder-model.php +16 -3
  11. classes/class-fl-builder-module.php +11 -4
  12. classes/class-fl-builder-photo.php +7 -1
  13. classes/class-fl-builder-service-convertkit.php +6 -1
  14. classes/class-fl-builder-service-email-address.php +33 -28
  15. classes/class-fl-builder.php +54 -13
  16. css/fl-builder-layout.css +19 -2
  17. fl-builder.php +1 -1
  18. includes/compatibility.php +30 -0
  19. includes/field-code.php +4 -0
  20. includes/field-unit.php +5 -5
  21. includes/layout-js-config.php +3 -0
  22. includes/strings.php +4 -4
  23. includes/template-selector.php +8 -8
  24. includes/ui-panel.php +2 -2
  25. includes/updater-config.php +1 -1
  26. includes/updater/classes/class-fl-updater.php +24 -23
  27. index.php +2 -0
  28. js/fl-builder-layout.js +15 -10
  29. js/fl-builder.js +21 -3
  30. js/fl-builder.min.js +6 -6
  31. js/fl-lightbox.js +0 -5
  32. languages/af_ZA.mo +0 -0
  33. languages/ar.mo +0 -0
  34. languages/cs_CZ.mo +0 -0
  35. languages/da_DK.mo +0 -0
  36. languages/de.mo +0 -0
  37. languages/el_GR.mo +0 -0
  38. languages/es.mo +0 -0
  39. languages/es_MX.mo +0 -0
  40. languages/fa.mo +0 -0
  41. languages/fi.mo +0 -0
  42. languages/fr.mo +0 -0
  43. languages/fr_CA.mo +0 -0
  44. languages/he_IL.mo +0 -0
  45. languages/hi_IN.mo +0 -0
  46. languages/hr.mo +0 -0
  47. languages/hu.mo +0 -0
  48. languages/id.mo +0 -0
  49. languages/it.mo +0 -0
  50. languages/ja_JP.mo +0 -0
  51. languages/ko_KR.mo +0 -0
  52. languages/mr.mo +0 -0
  53. languages/ms.mo +0 -0
  54. languages/nb_NO.mo +0 -0
  55. languages/nl.mo +0 -0
  56. languages/pl.mo +0 -0
  57. languages/pt.mo +0 -0
  58. languages/pt_BR.mo +0 -0
  59. languages/ru.mo +0 -0
  60. languages/sk.mo +0 -0
  61. languages/sl_SI.mo +0 -0
  62. languages/sv_SE.mo +0 -0
  63. languages/th.mo +0 -0
  64. languages/tl_PH.mo +0 -0
  65. languages/tr.mo +0 -0
  66. languages/uk_UA.mo +0 -0
  67. languages/vi_VN.mo +0 -0
  68. languages/zh_CN.mo +0 -0
  69. languages/zh_TW.mo +0 -0
  70. modules/photo/css/frontend.responsive.css +4 -0
  71. modules/photo/photo.php +8 -6
  72. modules/video/video.php +5 -3
  73. readme.txt +4 -4
.gitattributes DELETED
@@ -1 +0,0 @@
1
- data/templates.dat binary
 
changelog.txt CHANGED
@@ -1,3 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>1.9.4 - 01/18/2017</h4>
2
  <p><strong>Bug Fixes</strong></p>
3
  <ul>
1
+ <h4>1.9.5.1 - 3/21/2017</h4>
2
+ <p><strong>Bug Fixes</strong></p>
3
+ <ul>
4
+ <li>Rolled back change in 1.9.5 that fixed some photos not going full width on mobile. That was causing all photos to go full width on mobile even when not intended. We’ll revisit that fix in 1.10.</li>
5
+ </ul>
6
+
7
+ <h4>1.9.5 - 3/20/2017</h4>
8
+ <p><strong>Enhancements</strong></p>
9
+ <ul>
10
+ <li>Posts module pagination now works separately when multiple Posts modules are on a page.</li>
11
+ <li>Added support for WooCommerce Memberships.</li>
12
+ <li>Added support for setting a custom subject in the Contact Form and Subscribe Form modules.</li>
13
+ <li>Added JS config for overriding the offset of waypoint animations.</li>
14
+ <li>Added support for font-weights that have 'i' at the end of their value string.</li>
15
+ <li>Added fl_builder_editing_enabled filter.</li>
16
+ <li>Added fl_builder_module_details filter.</li>
17
+ <li>Added logic to prevent bad JS entered into the layout settings from breaking the builder.</li>
18
+ <li>Added post_class() call to the Posts module.</li>
19
+ <li>Update Google Fonts.</li>
20
+ </ul>
21
+ <p><strong>Changes</strong></p>
22
+ <ul>
23
+ <li>Changed Video module embed field to a code editor.</li>
24
+ <li>Removed outline from the Accordion module when an item has focus.</li>
25
+ </ul>
26
+ <p><strong>Bug Fixes</strong></p>
27
+ <ul>
28
+ <li>Fixed content disappearing or being ordered incorrectly when dragging and dropping nested columns.</li>
29
+ <li>Fixed Posts module pagination not working when rendered via a shortcode.</li>
30
+ <li>Fixed module settings JS errors in Safari.</li>
31
+ <li>Fixed warning caused when DOING_AJAX is already defined.</li>
32
+ <li>Fixed Gravity Forms not showing in the Button module lightbox.</li>
33
+ <li>Fixed IE flexbox issues with full-height rows.</li>
34
+ <li>Fixed nested menu items not opening in the Menu module's accordion layout.</li>
35
+ <li>Fixed module export/import not working.</li>
36
+ <li>Fixed non-breaking space in the Number module.</li>
37
+ <li>Fixed content in nested columns not being exported to the default WordPress editor.</li>
38
+ <li>Fixed Posts Carousel and Posts Gallery icons always showing even when set not to display.</li>
39
+ <li>Fixed YouTube and Vimeo video backgrounds not filling the full width and height of a row.</li>
40
+ <li>Fixed photos not going full width on mobile devices.</li>
41
+ <li>Fixed pagination double slashes when using permalinks with no ending slash.</li>
42
+ <li>Fixed multiple translation issues.</li>
43
+ <li>Fixed photo fields showing incorrect selection when switching site to HTTPS.</li>
44
+ <li>Fixed layout settings css not applying when overriding/appending a user template.</li>
45
+ <li>Fixed validation errors with Map module.</li>
46
+ <li>Fixed conflict with WPEngine's PHP Compatibility plugin reporting a PHP7 warning.</li>
47
+ <li>Fixed ReCaptcha conflicts with other plugins.</li>
48
+ <li>Fixed linking to a specific tab in the Tabs module.</li>
49
+ <li>Fixed name being set to 0 in the Subscribe Form module when using ConvertKit.</li>
50
+ <li>Fixed PHP warning in the Gallery module when an image doesn't have an ID.</li>
51
+ <li>Fixed JavaScript error in FireFox.</li>
52
+ </ul>
53
+
54
  <h4>1.9.4 - 01/18/2017</h4>
55
  <p><strong>Bug Fixes</strong></p>
56
  <ul>
classes/class-fl-builder-ajax-layout.php CHANGED
@@ -460,7 +460,14 @@ final class FLBuilderAJAXLayout {
460
  }
461
 
462
  $assets['js'] .= 'FLBuilder._renderLayoutComplete();';
463
- $assets['js'] = FLJSMin::minify( $assets['js'] );
 
 
 
 
 
 
 
464
  }
465
  else {
466
  $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
460
  }
461
 
462
  $assets['js'] .= 'FLBuilder._renderLayoutComplete();';
463
+
464
+ try {
465
+ $min = FLJSMin::minify( $assets['js'] );
466
+ } catch (Exception $e) {}
467
+
468
+ if ( $min ) {
469
+ $assets['js'] = $min;
470
+ }
471
  }
472
  else {
473
  $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
classes/class-fl-builder-ajax.php CHANGED
@@ -202,7 +202,9 @@ final class FLBuilderAJAX {
202
  }
203
 
204
  // Tell WordPress this is an AJAX request.
205
- define( 'DOING_AJAX', true );
 
 
206
 
207
  // Allow developers to hook before the action runs.
208
  do_action( 'fl_ajax_before_' . $action['action'], $keys_args );
202
  }
203
 
204
  // Tell WordPress this is an AJAX request.
205
+ if ( ! defined( 'DOING_AJAX' ) ) {
206
+ define( 'DOING_AJAX', true );
207
+ }
208
 
209
  // Allow developers to hook before the action runs.
210
  do_action( 'fl_ajax_before_' . $action['action'], $keys_args );
classes/class-fl-builder-fonts.php CHANGED
@@ -97,7 +97,7 @@ final class FLBuilderFonts {
97
  */
98
  static public function get_weight_string( $weight ){
99
 
100
- $weight_string = array(
101
  'default' => __( 'Default', 'fl-builder' ),
102
  'regular' => __( 'Regular', 'fl-builder' ),
103
  '100' => 'Thin 100',
@@ -109,7 +109,7 @@ final class FLBuilderFonts {
109
  '700' => 'Bold 700',
110
  '800' => 'Extra-Bold 800',
111
  '900' => 'Ultra-Bold 900'
112
- );
113
 
114
  return $weight_string[ $weight ];
115
  }
@@ -138,7 +138,12 @@ final class FLBuilderFonts {
138
  if ( 'regular' == $font['weight'] ) {
139
  $css .= 'font-weight: normal;';
140
  } else {
141
- $css .= 'font-weight: '. $font['weight'] .';';
 
 
 
 
 
142
  }
143
 
144
  echo $css;
@@ -328,9 +333,9 @@ final class FLBuilderFontFamilies {
328
  * @var array
329
  */
330
  static public $google = array(
331
- "ABeeZee" => array(
332
- "regular",
333
- ),
334
  "Abel" => array(
335
  "regular",
336
  ),
@@ -552,6 +557,10 @@ final class FLBuilderFontFamilies {
552
  "Armata" => array(
553
  "regular",
554
  ),
 
 
 
 
555
  "Artifika" => array(
556
  "regular",
557
  ),
@@ -565,6 +574,7 @@ final class FLBuilderFontFamilies {
565
  ),
566
  "Asap" => array(
567
  "regular",
 
568
  "700",
569
  ),
570
  "Asar" => array(
@@ -643,6 +653,9 @@ final class FLBuilderFontFamilies {
643
  "Bad Script" => array(
644
  "regular",
645
  ),
 
 
 
646
  "Baloo" => array(
647
  "regular",
648
  ),
@@ -673,6 +686,9 @@ final class FLBuilderFontFamilies {
673
  "Bangers" => array(
674
  "regular",
675
  ),
 
 
 
676
  "Basic" => array(
677
  "regular",
678
  ),
@@ -951,7 +967,9 @@ final class FLBuilderFontFamilies {
951
  "regular",
952
  ),
953
  "Chivo" => array(
 
954
  "regular",
 
955
  "900",
956
  ),
957
  "Chonburi" => array(
@@ -1344,13 +1362,41 @@ final class FLBuilderFontFamilies {
1344
  ),
1345
  "Fira Mono" => array(
1346
  "regular",
 
1347
  "700",
1348
  ),
1349
  "Fira Sans" => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  "300",
1351
  "regular",
1352
  "500",
 
1353
  "700",
 
 
1354
  ),
1355
  "Fjalla One" => array(
1356
  "regular",
@@ -2193,12 +2239,26 @@ final class FLBuilderFontFamilies {
2193
  "regular",
2194
  ),
2195
  "Montserrat" => array(
 
 
 
2196
  "regular",
 
 
2197
  "700",
 
 
2198
  ),
2199
  "Montserrat Alternates" => array(
 
 
 
2200
  "regular",
 
 
2201
  "700",
 
 
2202
  ),
2203
  "Montserrat Subrayada" => array(
2204
  "regular",
@@ -2242,8 +2302,13 @@ final class FLBuilderFontFamilies {
2242
  "800",
2243
  ),
2244
  "Muli" => array(
 
2245
  "300",
2246
  "regular",
 
 
 
 
2247
  ),
2248
  "Mystery Quest" => array(
2249
  "regular",
@@ -2331,9 +2396,22 @@ final class FLBuilderFontFamilies {
2331
  "regular",
2332
  ),
2333
  "Nunito" => array(
 
 
 
 
 
 
 
 
 
 
2334
  "300",
2335
  "regular",
 
2336
  "700",
 
 
2337
  ),
2338
  "Odor Mean Chey" => array(
2339
  "regular",
@@ -2386,8 +2464,11 @@ final class FLBuilderFontFamilies {
2386
  "regular",
2387
  ),
2388
  "Oswald" => array(
 
2389
  "300",
2390
  "regular",
 
 
2391
  "700",
2392
  ),
2393
  "Over the Rainbow" => array(
@@ -2401,6 +2482,22 @@ final class FLBuilderFontFamilies {
2401
  "Overlock SC" => array(
2402
  "regular",
2403
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2404
  "Ovo" => array(
2405
  "regular",
2406
  ),
@@ -2437,6 +2534,10 @@ final class FLBuilderFontFamilies {
2437
  "Pacifico" => array(
2438
  "regular",
2439
  ),
 
 
 
 
2440
  "Palanquin" => array(
2441
  "100",
2442
  "200",
@@ -2452,6 +2553,9 @@ final class FLBuilderFontFamilies {
2452
  "600",
2453
  "700",
2454
  ),
 
 
 
2455
  "Paprika" => array(
2456
  "regular",
2457
  ),
@@ -2537,7 +2641,10 @@ final class FLBuilderFontFamilies {
2537
  ),
2538
  "Podkova" => array(
2539
  "regular",
 
 
2540
  "700",
 
2541
  ),
2542
  "Poiret One" => array(
2543
  "regular",
@@ -2643,6 +2750,7 @@ final class FLBuilderFontFamilies {
2643
  "Quicksand" => array(
2644
  "300",
2645
  "regular",
 
2646
  "700",
2647
  ),
2648
  "Quintessential" => array(
@@ -2777,8 +2885,15 @@ final class FLBuilderFontFamilies {
2777
  "regular",
2778
  ),
2779
  "Rokkitt" => array(
 
 
 
2780
  "regular",
 
 
2781
  "700",
 
 
2782
  ),
2783
  "Romanesco" => array(
2784
  "regular",
@@ -2809,9 +2924,6 @@ final class FLBuilderFontFamilies {
2809
  "Rubik Mono One" => array(
2810
  "regular",
2811
  ),
2812
- "Rubik One" => array(
2813
- "regular",
2814
- ),
2815
  "Ruda" => array(
2816
  "regular",
2817
  "700",
@@ -2861,8 +2973,11 @@ final class FLBuilderFontFamilies {
2861
  "Sancreek" => array(
2862
  "regular",
2863
  ),
2864
- "Sansita One" => array(
2865
  "regular",
 
 
 
2866
  ),
2867
  "Sarala" => array(
2868
  "regular",
@@ -3255,6 +3370,7 @@ final class FLBuilderFontFamilies {
3255
  ),
3256
  "Unna" => array(
3257
  "regular",
 
3258
  ),
3259
  "VT323" => array(
3260
  "regular",
97
  */
98
  static public function get_weight_string( $weight ){
99
 
100
+ $weight_string = apply_filters( 'fl_builder_font_weight_strings', array(
101
  'default' => __( 'Default', 'fl-builder' ),
102
  'regular' => __( 'Regular', 'fl-builder' ),
103
  '100' => 'Thin 100',
109
  '700' => 'Bold 700',
110
  '800' => 'Extra-Bold 800',
111
  '900' => 'Ultra-Bold 900'
112
+ ) );
113
 
114
  return $weight_string[ $weight ];
115
  }
138
  if ( 'regular' == $font['weight'] ) {
139
  $css .= 'font-weight: normal;';
140
  } else {
141
+ if ( 'i' == substr( $font['weight'], -1 ) ) {
142
+ $css .= 'font-weight: '. substr( $font['weight'], 0, -1 ) .';';
143
+ $css .= 'font-style: italic;';
144
+ } else {
145
+ $css .= 'font-weight: '. $font['weight'] .';';
146
+ }
147
  }
148
 
149
  echo $css;
333
  * @var array
334
  */
335
  static public $google = array(
336
+ "ABeeZee" => array(
337
+ "regular",
338
+ ),
339
  "Abel" => array(
340
  "regular",
341
  ),
557
  "Armata" => array(
558
  "regular",
559
  ),
560
+ "Arsenal" => array(
561
+ "regular",
562
+ "700",
563
+ ),
564
  "Artifika" => array(
565
  "regular",
566
  ),
574
  ),
575
  "Asap" => array(
576
  "regular",
577
+ "500",
578
  "700",
579
  ),
580
  "Asar" => array(
653
  "Bad Script" => array(
654
  "regular",
655
  ),
656
+ "Bahiana" => array(
657
+ "regular",
658
+ ),
659
  "Baloo" => array(
660
  "regular",
661
  ),
686
  "Bangers" => array(
687
  "regular",
688
  ),
689
+ "Barrio" => array(
690
+ "regular",
691
+ ),
692
  "Basic" => array(
693
  "regular",
694
  ),
967
  "regular",
968
  ),
969
  "Chivo" => array(
970
+ "300",
971
  "regular",
972
+ "700",
973
  "900",
974
  ),
975
  "Chonburi" => array(
1362
  ),
1363
  "Fira Mono" => array(
1364
  "regular",
1365
+ "500",
1366
  "700",
1367
  ),
1368
  "Fira Sans" => array(
1369
+ "100",
1370
+ "200",
1371
+ "300",
1372
+ "regular",
1373
+ "500",
1374
+ "600",
1375
+ "700",
1376
+ "800",
1377
+ "900",
1378
+ ),
1379
+ "Fira Sans Condensed" => array(
1380
+ "100",
1381
+ "200",
1382
+ "300",
1383
+ "regular",
1384
+ "500",
1385
+ "600",
1386
+ "700",
1387
+ "800",
1388
+ "900",
1389
+ ),
1390
+ "Fira Sans Extra Condensed" => array(
1391
+ "100",
1392
+ "200",
1393
  "300",
1394
  "regular",
1395
  "500",
1396
+ "600",
1397
  "700",
1398
+ "800",
1399
+ "900",
1400
  ),
1401
  "Fjalla One" => array(
1402
  "regular",
2239
  "regular",
2240
  ),
2241
  "Montserrat" => array(
2242
+ "100",
2243
+ "200",
2244
+ "300",
2245
  "regular",
2246
+ "500",
2247
+ "600",
2248
  "700",
2249
+ "800",
2250
+ "900",
2251
  ),
2252
  "Montserrat Alternates" => array(
2253
+ "100",
2254
+ "200",
2255
+ "300",
2256
  "regular",
2257
+ "500",
2258
+ "600",
2259
  "700",
2260
+ "800",
2261
+ "900",
2262
  ),
2263
  "Montserrat Subrayada" => array(
2264
  "regular",
2302
  "800",
2303
  ),
2304
  "Muli" => array(
2305
+ "200",
2306
  "300",
2307
  "regular",
2308
+ "600",
2309
+ "700",
2310
+ "800",
2311
+ "900",
2312
  ),
2313
  "Mystery Quest" => array(
2314
  "regular",
2396
  "regular",
2397
  ),
2398
  "Nunito" => array(
2399
+ "200",
2400
+ "300",
2401
+ "regular",
2402
+ "600",
2403
+ "700",
2404
+ "800",
2405
+ "900",
2406
+ ),
2407
+ "Nunito Sans" => array(
2408
+ "200",
2409
  "300",
2410
  "regular",
2411
+ "600",
2412
  "700",
2413
+ "800",
2414
+ "900",
2415
  ),
2416
  "Odor Mean Chey" => array(
2417
  "regular",
2464
  "regular",
2465
  ),
2466
  "Oswald" => array(
2467
+ "200",
2468
  "300",
2469
  "regular",
2470
+ "500",
2471
+ "600",
2472
  "700",
2473
  ),
2474
  "Over the Rainbow" => array(
2482
  "Overlock SC" => array(
2483
  "regular",
2484
  ),
2485
+ "Overpass" => array(
2486
+ "100",
2487
+ "200",
2488
+ "300",
2489
+ "regular",
2490
+ "600",
2491
+ "700",
2492
+ "800",
2493
+ "900",
2494
+ ),
2495
+ "Overpass Mono" => array(
2496
+ "300",
2497
+ "regular",
2498
+ "600",
2499
+ "700",
2500
+ ),
2501
  "Ovo" => array(
2502
  "regular",
2503
  ),
2534
  "Pacifico" => array(
2535
  "regular",
2536
  ),
2537
+ "Padauk" => array(
2538
+ "regular",
2539
+ "700",
2540
+ ),
2541
  "Palanquin" => array(
2542
  "100",
2543
  "200",
2553
  "600",
2554
  "700",
2555
  ),
2556
+ "Pangolin" => array(
2557
+ "regular",
2558
+ ),
2559
  "Paprika" => array(
2560
  "regular",
2561
  ),
2641
  ),
2642
  "Podkova" => array(
2643
  "regular",
2644
+ "500",
2645
+ "600",
2646
  "700",
2647
+ "800",
2648
  ),
2649
  "Poiret One" => array(
2650
  "regular",
2750
  "Quicksand" => array(
2751
  "300",
2752
  "regular",
2753
+ "500",
2754
  "700",
2755
  ),
2756
  "Quintessential" => array(
2885
  "regular",
2886
  ),
2887
  "Rokkitt" => array(
2888
+ "100",
2889
+ "200",
2890
+ "300",
2891
  "regular",
2892
+ "500",
2893
+ "600",
2894
  "700",
2895
+ "800",
2896
+ "900",
2897
  ),
2898
  "Romanesco" => array(
2899
  "regular",
2924
  "Rubik Mono One" => array(
2925
  "regular",
2926
  ),
 
 
 
2927
  "Ruda" => array(
2928
  "regular",
2929
  "700",
2973
  "Sancreek" => array(
2974
  "regular",
2975
  ),
2976
+ "Sansita" => array(
2977
  "regular",
2978
+ "700",
2979
+ "800",
2980
+ "900",
2981
  ),
2982
  "Sarala" => array(
2983
  "regular",
3370
  ),
3371
  "Unna" => array(
3372
  "regular",
3373
+ "700",
3374
  ),
3375
  "VT323" => array(
3376
  "regular",
classes/class-fl-builder-import.php CHANGED
@@ -43,7 +43,7 @@ final class FLBuilderImport {
43
 
44
  $GLOBALS['wp_import'] = new FLBuilderImporter();
45
 
46
- register_importer( 'wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'wordpress-importer'), array( $GLOBALS['wp_import'], 'dispatch' ) );
47
  }
48
  }
49
 
43
 
44
  $GLOBALS['wp_import'] = new FLBuilderImporter();
45
 
46
+ register_importer( 'wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.', 'fl-builder'), array( $GLOBALS['wp_import'], 'dispatch' ) );
47
  }
48
  }
49
 
classes/class-fl-builder-importer.php CHANGED
@@ -110,7 +110,7 @@ class FLBuilderImportParserRegex extends WXR_Parser_Regex {
110
  }
111
 
112
  if ( ! $wxr_version )
113
- return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
114
 
115
  return array(
116
  'authors' => $this->authors,
110
  }
111
 
112
  if ( ! $wxr_version )
113
+ return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'fl-builder' ) );
114
 
115
  return array(
116
  'authors' => $this->authors,
classes/class-fl-builder-loader.php CHANGED
@@ -45,7 +45,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
45
  */
46
  static private function define_constants()
47
  {
48
- define('FL_BUILDER_VERSION', '1.9.4');
49
  define('FL_BUILDER_FILE', trailingslashit(dirname(dirname(__FILE__))) . 'fl-builder.php');
50
  define('FL_BUILDER_DIR', plugin_dir_path(FL_BUILDER_FILE));
51
  define('FL_BUILDER_URL', plugins_url('/', FL_BUILDER_FILE));
45
  */
46
  static private function define_constants()
47
  {
48
+ define('FL_BUILDER_VERSION', '1.9.5.1');
49
  define('FL_BUILDER_FILE', trailingslashit(dirname(dirname(__FILE__))) . 'fl-builder.php');
50
  define('FL_BUILDER_DIR', plugin_dir_path(FL_BUILDER_FILE));
51
  define('FL_BUILDER_URL', plugins_url('/', FL_BUILDER_FILE));
classes/class-fl-builder-loop.php CHANGED
@@ -7,6 +7,14 @@
7
  */
8
  final class FLBuilderLoop {
9
 
 
 
 
 
 
 
 
 
10
  /**
11
  * Initializes hooks.
12
  *
@@ -15,7 +23,9 @@ final class FLBuilderLoop {
15
  */
16
  static public function init()
17
  {
18
- add_filter( 'found_posts', __CLASS__ . '::found_posts', 1, 2 );
 
 
19
  }
20
 
21
  /**
@@ -33,9 +43,12 @@ final class FLBuilderLoop {
33
  $order_by = empty($settings->order_by) ? 'date' : $settings->order_by;
34
  $order = empty($settings->order) ? 'DESC' : $settings->order;
35
  $users = empty($settings->users) ? '' : $settings->users;
36
- $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
37
- $fields = empty($settings->fields) ? '' : $settings->fields;
38
-
 
 
 
39
  // Get the offset.
40
  if ( ! isset( $settings->offset ) || ! is_int( ( int )$settings->offset ) ) {
41
  $offset = 0;
@@ -43,7 +56,7 @@ final class FLBuilderLoop {
43
  else {
44
  $offset = $settings->offset;
45
  }
46
-
47
  // Get the paged offset.
48
  if ( $paged < 2 ) {
49
  $paged_offset = $offset;
@@ -128,7 +141,52 @@ final class FLBuilderLoop {
128
 
129
  return $found_posts;
130
  }
131
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  /**
133
  * Builds and renders the pagination for a query.
134
  *
@@ -140,26 +198,40 @@ final class FLBuilderLoop {
140
  {
141
  $total_pages = $query->max_num_pages;
142
  $permalink_structure = get_option('permalink_structure');
143
- $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
144
-
 
145
  if($total_pages > 1) {
146
 
147
- if(!$current_page = $paged) {
148
  $current_page = 1;
149
  }
150
 
 
 
 
 
 
 
 
151
  if(empty($permalink_structure)) {
152
- $format = '&paged=%#%';
153
  }
154
- else if ("/" == substr($permalink_structure, -1)) {
155
- $format = 'page/%#%/';
 
156
  }
157
  else {
158
- $format = '/page/%#%/';
 
 
 
 
 
159
  }
160
 
161
  echo paginate_links(array(
162
- 'base' => get_pagenum_link(1) . '%_%',
163
  'format' => $format,
164
  'current' => $current_page,
165
  'total' => $total_pages,
@@ -168,6 +240,49 @@ final class FLBuilderLoop {
168
  }
169
  }
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  /**
172
  * Returns an array of data for post types supported
173
  * by module loop settings.
7
  */
8
  final class FLBuilderLoop {
9
 
10
+ /**
11
+ * Loop query counter
12
+ *
13
+ * @since 1.9.5
14
+ * @var int $loop_counter
15
+ */
16
+ static public $loop_counter = 0;
17
+
18
  /**
19
  * Initializes hooks.
20
  *
23
  */
24
  static public function init()
25
  {
26
+ add_filter( 'found_posts', __CLASS__ . '::found_posts', 1, 2 );
27
+ add_action( 'init', __CLASS__ . '::init_rewrite_rules' );
28
+ add_filter( 'redirect_canonical', __CLASS__ . '::override_canonical', 1, 2 );
29
  }
30
 
31
  /**
43
  $order_by = empty($settings->order_by) ? 'date' : $settings->order_by;
44
  $order = empty($settings->order) ? 'DESC' : $settings->order;
45
  $users = empty($settings->users) ? '' : $settings->users;
46
+ $fields = empty($settings->fields) ? '' : $settings->fields;
47
+
48
+ // Count how many times this method has been called
49
+ self::$loop_counter++;
50
+ $paged = self::get_paged();
51
+
52
  // Get the offset.
53
  if ( ! isset( $settings->offset ) || ! is_int( ( int )$settings->offset ) ) {
54
  $offset = 0;
56
  else {
57
  $offset = $settings->offset;
58
  }
59
+
60
  // Get the paged offset.
61
  if ( $paged < 2 ) {
62
  $paged_offset = $offset;
141
 
142
  return $found_posts;
143
  }
144
+
145
+
146
+ /**
147
+ * Add rewrite rules for custom pagination url to avoid conflict with the default paged param in WP
148
+ *
149
+ * @since 1.9.5
150
+ * @return void
151
+ */
152
+ static public function init_rewrite_rules()
153
+ {
154
+ for ( $x = 2; $x <= 10; $x++ ) {
155
+ add_rewrite_rule( 'paged-'. $x .'/([0-9]*)/?', 'index.php?page_id=' . get_option( 'page_on_front' ) . '&flpaged'. $x .'=$matches[1]', 'top' );
156
+ add_rewrite_rule( 'paged-'. $x .'/?([0-9]{1,})/?$', 'index.php?&flpaged'. $x .'=$matches[1]', 'top');
157
+ add_rewrite_rule( '(.?.+?)/paged-'. $x .'/?([0-9]{1,})/?$', 'index.php?pagename=$matches[1]&flpaged'. $x .'=$matches[2]', 'top');
158
+ add_rewrite_rule( '([^/]+)/paged-'. $x .'/?([0-9]{1,})/?$', 'index.php?name=$matches[1]&flpaged'. $x .'=$matches[2]', 'top');
159
+
160
+ add_rewrite_tag( "%flpaged{$x}%", '([^&]+)');
161
+ }
162
+
163
+ // Flush the rewrite rules so it would take effect
164
+ flush_rewrite_rules();
165
+ }
166
+
167
+ /**
168
+ * Disable canonical redirection on the frontpage when query var 'flpaged' is found.
169
+ *
170
+ * @param string $redirect_url The redirect URL.
171
+ * @param string $requested_url The requested URL.
172
+ * @since 1.9.5
173
+ * @return bool|string
174
+ */
175
+ static public function override_canonical( $redirect_url, $requested_url ) {
176
+ global $wp_the_query;
177
+
178
+ if ( is_array($wp_the_query->query) ) {
179
+ foreach ($wp_the_query->query as $key => $value) {
180
+ if (strpos($key, 'flpaged') === 0 && is_page() && get_option( 'page_on_front' )) {
181
+ $redirect_url = false;
182
+ break;
183
+ }
184
+ }
185
+ }
186
+
187
+ return $redirect_url;
188
+ }
189
+
190
  /**
191
  * Builds and renders the pagination for a query.
192
  *
198
  {
199
  $total_pages = $query->max_num_pages;
200
  $permalink_structure = get_option('permalink_structure');
201
+ $paged = self::get_paged();
202
+ $base = get_pagenum_link();
203
+
204
  if($total_pages > 1) {
205
 
206
+ if(!$current_page = $paged) {
207
  $current_page = 1;
208
  }
209
 
210
+ if ( self::$loop_counter > 1 ) {
211
+ $page_prefix = 'paged-'. self::$loop_counter;
212
+ }
213
+ else {
214
+ $page_prefix = empty($permalink_structure) ? 'paged' : 'page';
215
+ }
216
+
217
  if(empty($permalink_structure)) {
218
+ $format = '&'. $page_prefix .'=%#%';
219
  }
220
+
221
+ else if ("/" == substr($base, -1)) {
222
+ $format = $page_prefix . '/%#%/';
223
  }
224
  else {
225
+ $format = '/'. $page_prefix .'/%#%';
226
+ }
227
+
228
+ $pos = strrpos($base, "paged-");
229
+ if ( $pos ) {
230
+ $base = substr_replace( $base, '', $pos, strlen( $base ) );
231
  }
232
 
233
  echo paginate_links(array(
234
+ 'base' => $base . '%_%',
235
  'format' => $format,
236
  'current' => $current_page,
237
  'total' => $total_pages,
240
  }
241
  }
242
 
243
+ /**
244
+ * Returns the paged number for the query.
245
+ *
246
+ * @since 1.9.5
247
+ * @return int
248
+ */
249
+ static public function get_paged()
250
+ {
251
+ global $wp_the_query, $paged;
252
+
253
+ // Check first for custom pagination from post module
254
+ $flpaged = $wp_the_query->get( 'flpaged'. self::$loop_counter );
255
+
256
+ if ( is_numeric( $flpaged ) ) {
257
+ return $flpaged;
258
+ }
259
+ else if ( self::$loop_counter > 1 ) {
260
+ // If we have multiple paginations, make sure it won't affect the other loops.
261
+ return 0;
262
+ }
263
+
264
+ // Check the 'page' query var.
265
+ $page_qv = $wp_the_query->get( 'page' );
266
+
267
+ if ( is_numeric( $page_qv ) ) {
268
+ return $page_qv;
269
+ }
270
+
271
+ // Check the 'paged' query var.
272
+ $paged_qv = $wp_the_query->get( 'paged' );
273
+
274
+ if ( is_numeric( $paged_qv ) ) {
275
+ return $paged_qv;
276
+ }
277
+
278
+ // Check the $paged global?
279
+ if ( is_numeric( $paged ) ) {
280
+ return $paged;
281
+ }
282
+
283
+ return 0;
284
+ }
285
+
286
  /**
287
  * Returns an array of data for post types supported
288
  * by module loop settings.
classes/class-fl-builder-model.php CHANGED
@@ -544,6 +544,9 @@ final class FLBuilderModel {
544
  // Lock the post.
545
  require_once ABSPATH . 'wp-admin/includes/post.php';
546
  wp_set_post_lock( $post->ID );
 
 
 
547
  }
548
  }
549
 
@@ -4116,10 +4119,14 @@ final class FLBuilderModel {
4116
  // Update the layout data and settings.
4117
  self::update_layout_data($data);
4118
  self::update_layout_settings( $settings );
4119
- }
4120
 
4121
- // Delete old asset cache.
4122
- self::delete_asset_cache();
 
 
 
 
 
4123
  }
4124
  }
4125
 
@@ -4531,6 +4538,12 @@ final class FLBuilderModel {
4531
  */
4532
  static public function set_node_template_default_type( $post_id, $post, $update )
4533
  {
 
 
 
 
 
 
4534
  $post_data = self::get_post_data();
4535
 
4536
  if ( $update || 'fl-builder-template' != $post->post_type ) {
544
  // Lock the post.
545
  require_once ABSPATH . 'wp-admin/includes/post.php';
546
  wp_set_post_lock( $post->ID );
547
+
548
+ // Allow devs to hook into when editing is enabled.
549
+ do_action( 'fl_builder_editing_enabled' );
550
  }
551
  }
552
 
4119
  // Update the layout data and settings.
4120
  self::update_layout_data($data);
4121
  self::update_layout_settings( $settings );
 
4122
 
4123
+ // Delete old asset cache.
4124
+ self::delete_asset_cache();
4125
+
4126
+ return array(
4127
+ 'layout_css' => $settings->css
4128
+ );
4129
+ }
4130
  }
4131
  }
4132
 
4538
  */
4539
  static public function set_node_template_default_type( $post_id, $post, $update )
4540
  {
4541
+ global $pagenow;
4542
+
4543
+ if ( 'admin.php' == $pagenow && isset( $_GET['import'] ) ) {
4544
+ return;
4545
+ }
4546
+
4547
  $post_data = self::get_post_data();
4548
 
4549
  if ( $update || 'fl-builder-template' != $post->post_type ) {
classes/class-fl-builder-module.php CHANGED
@@ -143,19 +143,26 @@ class FLBuilderModule {
143
  *
144
  * @since 1.0
145
  */
146
- public function __construct($params)
147
  {
148
  $class_info = new ReflectionClass($this);
149
  $class_path = $class_info->getFileName();
150
  $dir_path = dirname($class_path);
151
- $this->name = $params['name'];
152
- $this->description = $params['description'];
153
- $this->category = $params['category'];
154
  $this->slug = basename($class_path, '.php');
155
  $this->enabled = isset($params['enabled']) ? $params['enabled'] : true;
156
  $this->editor_export = isset($params['editor_export']) ? $params['editor_export'] : true;
157
  $this->partial_refresh = isset($params['partial_refresh']) ? $params['partial_refresh'] : false;
158
 
 
 
 
 
 
 
 
 
 
 
159
  // We need to normalize the paths here since path comparisons
160
  // break on Windows because they use backslashes.
161
  $abspath = str_replace( '\\', '/', ABSPATH );
143
  *
144
  * @since 1.0
145
  */
146
+ public function __construct( $params )
147
  {
148
  $class_info = new ReflectionClass($this);
149
  $class_path = $class_info->getFileName();
150
  $dir_path = dirname($class_path);
 
 
 
151
  $this->slug = basename($class_path, '.php');
152
  $this->enabled = isset($params['enabled']) ? $params['enabled'] : true;
153
  $this->editor_export = isset($params['editor_export']) ? $params['editor_export'] : true;
154
  $this->partial_refresh = isset($params['partial_refresh']) ? $params['partial_refresh'] : false;
155
 
156
+ $details = apply_filters( 'fl_builder_module_details', array(
157
+ 'name' => $params['name'],
158
+ 'description' => $params['description'],
159
+ 'category' => $params['category']
160
+ ), $this->slug );
161
+
162
+ $this->name = $details['name'];
163
+ $this->description = $details['description'];
164
+ $this->category = $details['category'];
165
+
166
  // We need to normalize the paths here since path comparisons
167
  // break on Windows because they use backslashes.
168
  $abspath = str_replace( '\\', '/', ABSPATH );
classes/class-fl-builder-photo.php CHANGED
@@ -108,13 +108,19 @@ final class FLBuilderPhoto {
108
  'thumbnail' => _x( 'Thumbnail', 'Image size.', 'fl-builder' )
109
  );
110
 
 
 
 
 
111
  foreach($photo->sizes as $key => $val) {
112
 
113
  if(!isset($titles[$key])) {
114
  $titles[$key] = ucwords(str_replace(array('_', '-'), ' ', $key));
115
  }
 
 
116
 
117
- echo '<option value="' . $val->url . '" ' . selected($selected, $val->url) . '>' . $titles[$key] . ' - ' . $val->width . ' x ' . $val->height . '</option>';
118
  }
119
  }
120
  }
108
  'thumbnail' => _x( 'Thumbnail', 'Image size.', 'fl-builder' )
109
  );
110
 
111
+ // Check the selected value without the protocol so we get a match if
112
+ // a site has switched to HTTPS since selecting this photo (#641).
113
+ $selected = str_replace( array( 'http://', 'https://' ), '', $selected );
114
+
115
  foreach($photo->sizes as $key => $val) {
116
 
117
  if(!isset($titles[$key])) {
118
  $titles[$key] = ucwords(str_replace(array('_', '-'), ' ', $key));
119
  }
120
+
121
+ $check = str_replace( array( 'http://', 'https://' ), '', $val->url );
122
 
123
+ echo '<option value="' . $val->url . '" ' . selected($selected, $check) . '>' . $titles[$key] . ' - ' . $val->width . ' x ' . $val->height . '</option>';
124
  }
125
  }
126
  }
classes/class-fl-builder-service-convertkit.php CHANGED
@@ -192,8 +192,13 @@ final class FLBuilderServiceConvertKit extends FLBuilderService {
192
  else {
193
 
194
  $api = $this->get_api( $account_data['api_key'] );
 
195
 
196
- $result = $api->form_subscribe( $settings->list_id, array('email' => $email, 'fname' => $name) );
 
 
 
 
197
  if ($result->status != "created") {
198
  $response['error'] = __( 'There was an error subscribing to ConvertKit.', 'fl-builder' );
199
  }
192
  else {
193
 
194
  $api = $this->get_api( $account_data['api_key'] );
195
+ $data = array('email' => $email);
196
 
197
+ if ( !empty( $name ) ) {
198
+ $data['fname'] = $name;
199
+ }
200
+
201
+ $result = $api->form_subscribe( $settings->list_id, $data );
202
  if ($result->status != "created") {
203
  $response['error'] = __( 'There was an error subscribing to ConvertKit.', 'fl-builder' );
204
  }
classes/class-fl-builder-service-email-address.php CHANGED
@@ -12,9 +12,9 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
12
  *
13
  * @since 1.6.0
14
  * @var string $id
15
- */
16
  public $id = 'email-address';
17
-
18
  /**
19
  * Test the API connection.
20
  *
@@ -26,14 +26,14 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
26
  * @type bool|string $error The error message or false if no error.
27
  * @type array $data An array of data used to make the connection.
28
  * }
29
- */
30
- public function connect( $fields = array() )
31
  {
32
- $response = array(
33
  'error' => false,
34
  'data' => array()
35
  );
36
-
37
  // Make sure we have an email address.
38
  if ( ! isset( $fields['email'] ) || empty( $fields['email'] ) ) {
39
  $response['error'] = __( 'Error: You must provide an email address.', 'fl-builder' );
@@ -42,7 +42,7 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
42
  else {
43
  $response['data'] = array( 'email' => $fields['email'] );
44
  }
45
-
46
  return $response;
47
  }
48
 
@@ -51,11 +51,11 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
51
  *
52
  * @since 1.6.0
53
  * @return string The connection settings markup.
54
- */
55
- public function render_connect_settings()
56
  {
57
  ob_start();
58
-
59
  FLBuilder::render_settings_field( 'email', array(
60
  'row_class' => 'fl-builder-service-connect-row',
61
  'class' => 'fl-builder-service-connect-input',
@@ -64,13 +64,13 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
64
  'preview' => array(
65
  'type' => 'none'
66
  )
67
- ));
68
-
69
  return ob_get_clean();
70
  }
71
 
72
  /**
73
- * Render the markup for service specific fields.
74
  *
75
  * @since 1.6.0
76
  * @param string $account The name of the saved account.
@@ -79,18 +79,18 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
79
  * @type bool|string $error The error message or false if no error.
80
  * @type string $html The field markup.
81
  * }
82
- */
83
- public function render_fields( $account, $settings )
84
  {
85
- $response = array(
86
- 'error' => false,
87
- 'html' => ''
88
  );
89
-
90
  return $response;
91
  }
92
 
93
- /**
94
  * Send the subscription info to the saved email address.
95
  *
96
  * @since 1.6.0
@@ -100,31 +100,36 @@ final class FLBuilderServiceEmailAddress extends FLBuilderService {
100
  * @return array {
101
  * @type bool|string $error The error message or false if no error.
102
  * }
103
- */
104
  public function subscribe( $settings, $email, $name = false )
105
  {
106
  $account_data = $this->get_account_data( $settings->service_account );
107
  $response = array( 'error' => false );
108
-
109
  if ( ! $account_data ) {
110
  $response['error'] = __( 'There was an error subscribing. The account is no longer connected.', 'fl-builder' );
111
  }
112
  else {
113
-
114
  $subject = __( 'Subscribe Form Signup', 'fl-builder' );
 
 
 
 
 
115
  $message = __( 'Email', 'fl-builder' ) . ': ' . $email;
116
-
117
  if ( $name ) {
118
  $message .= "\n" . __( 'Name', 'fl-builder' ) . ': ' . $name;
119
  }
120
-
121
  $result = wp_mail( $account_data['email'], $subject, $message );
122
-
123
  if ( ! $result ) {
124
  $response['error'] = __( 'There was an error subscribing. Please try again.', 'fl-builder' );
125
  }
126
  }
127
-
128
  return $response;
129
  }
130
- }
12
  *
13
  * @since 1.6.0
14
  * @var string $id
15
+ */
16
  public $id = 'email-address';
17
+
18
  /**
19
  * Test the API connection.
20
  *
26
  * @type bool|string $error The error message or false if no error.
27
  * @type array $data An array of data used to make the connection.
28
  * }
29
+ */
30
+ public function connect( $fields = array() )
31
  {
32
+ $response = array(
33
  'error' => false,
34
  'data' => array()
35
  );
36
+
37
  // Make sure we have an email address.
38
  if ( ! isset( $fields['email'] ) || empty( $fields['email'] ) ) {
39
  $response['error'] = __( 'Error: You must provide an email address.', 'fl-builder' );
42
  else {
43
  $response['data'] = array( 'email' => $fields['email'] );
44
  }
45
+
46
  return $response;
47
  }
48
 
51
  *
52
  * @since 1.6.0
53
  * @return string The connection settings markup.
54
+ */
55
+ public function render_connect_settings()
56
  {
57
  ob_start();
58
+
59
  FLBuilder::render_settings_field( 'email', array(
60
  'row_class' => 'fl-builder-service-connect-row',
61
  'class' => 'fl-builder-service-connect-input',
64
  'preview' => array(
65
  'type' => 'none'
66
  )
67
+ ));
68
+
69
  return ob_get_clean();
70
  }
71
 
72
  /**
73
+ * Render the markup for service specific fields.
74
  *
75
  * @since 1.6.0
76
  * @param string $account The name of the saved account.
79
  * @type bool|string $error The error message or false if no error.
80
  * @type string $html The field markup.
81
  * }
82
+ */
83
+ public function render_fields( $account, $settings )
84
  {
85
+ $response = array(
86
+ 'error' => false,
87
+ 'html' => ''
88
  );
89
+
90
  return $response;
91
  }
92
 
93
+ /**
94
  * Send the subscription info to the saved email address.
95
  *
96
  * @since 1.6.0
100
  * @return array {
101
  * @type bool|string $error The error message or false if no error.
102
  * }
103
+ */
104
  public function subscribe( $settings, $email, $name = false )
105
  {
106
  $account_data = $this->get_account_data( $settings->service_account );
107
  $response = array( 'error' => false );
108
+
109
  if ( ! $account_data ) {
110
  $response['error'] = __( 'There was an error subscribing. The account is no longer connected.', 'fl-builder' );
111
  }
112
  else {
113
+
114
  $subject = __( 'Subscribe Form Signup', 'fl-builder' );
115
+
116
+ if( $settings->custom_subject ) {
117
+ $subject = $settings->custom_subject;
118
+ }
119
+
120
  $message = __( 'Email', 'fl-builder' ) . ': ' . $email;
121
+
122
  if ( $name ) {
123
  $message .= "\n" . __( 'Name', 'fl-builder' ) . ': ' . $name;
124
  }
125
+
126
  $result = wp_mail( $account_data['email'], $subject, $message );
127
+
128
  if ( ! $result ) {
129
  $response['error'] = __( 'There was an error subscribing. Please try again.', 'fl-builder' );
130
  }
131
  }
132
+
133
  return $response;
134
  }
135
+ }
classes/class-fl-builder.php CHANGED
@@ -82,8 +82,13 @@ final class FLBuilder {
82
  */
83
  static public function load_plugin_textdomain()
84
  {
85
- //Traditional WordPress plugin locale filter
86
- $locale = apply_filters( 'plugin_locale', get_locale(), 'fl-builder' );
 
 
 
 
 
87
 
88
  //Setup paths to current locale file
89
  $mofile_global = trailingslashit( WP_LANG_DIR ) . 'plugins/bb-plugin/' . $locale . '.mo';
@@ -629,7 +634,9 @@ final class FLBuilder {
629
  */
630
  static public function body_class($classes)
631
  {
632
- if(FLBuilderModel::is_builder_enabled() && !is_archive()) {
 
 
633
  $classes[] = 'fl-builder';
634
  }
635
  if(FLBuilderModel::is_builder_active() && !FLBuilderModel::current_user_has_editing_capability()) {
@@ -965,10 +972,11 @@ final class FLBuilder {
965
  $post_id = FLBuilderModel::get_post_id();
966
  $enabled = FLBuilderModel::is_builder_enabled();
967
  $rendering = $post_id === self::$post_rendering;
 
968
  $in_loop = in_the_loop();
969
  $is_global = in_array( $post_id, FLBuilderModel::get_global_posts() );
970
 
971
- if( $enabled && ! $rendering && ( $in_loop || $is_global ) ) {
972
 
973
  // Set the post rendering ID.
974
  self::$post_rendering = $post_id;
@@ -1137,18 +1145,45 @@ final class FLBuilder {
1137
 
1138
  foreach($cols as $col) {
1139
 
1140
- $modules = FLBuilderModel::get_modules($col);
1141
 
1142
- foreach($modules as $module) {
1143
 
1144
- if($module->editor_export) {
 
 
 
 
1145
 
1146
- // Don't crop photos to ensure media library photos are rendered.
1147
- if($module->settings->type == 'photo') {
1148
- $module->settings->crop = false;
1149
- }
1150
 
1151
- FLBuilder::render_module_html($module->settings->type, $module->settings, $module);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1152
  }
1153
  }
1154
  }
@@ -2504,7 +2539,13 @@ final class FLBuilder {
2504
  $js = apply_filters( 'fl_builder_render_js', $js, $nodes, $global_settings );
2505
 
2506
  if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
2507
- $js = FLJSMin::minify( $js );
 
 
 
 
 
 
2508
  }
2509
 
2510
  file_put_contents( $path, $js );
82
  */
83
  static public function load_plugin_textdomain()
84
  {
85
+ // Traditional WordPress plugin locale filter
86
+ // Uses get_user_locale() which was added in 4.7 so we need to check its available.
87
+ if( function_exists( 'get_user_locale' ) ) {
88
+ $locale = apply_filters( 'plugin_locale', get_user_locale(), 'fl-builder' );
89
+ } else {
90
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'fl-builder' );
91
+ }
92
 
93
  //Setup paths to current locale file
94
  $mofile_global = trailingslashit( WP_LANG_DIR ) . 'plugins/bb-plugin/' . $locale . '.mo';
634
  */
635
  static public function body_class($classes)
636
  {
637
+ $do_render = apply_filters( 'fl_builder_do_render_content', true, FLBuilderModel::get_post_id() );
638
+
639
+ if($do_render && FLBuilderModel::is_builder_enabled() && !is_archive()) {
640
  $classes[] = 'fl-builder';
641
  }
642
  if(FLBuilderModel::is_builder_active() && !FLBuilderModel::current_user_has_editing_capability()) {
972
  $post_id = FLBuilderModel::get_post_id();
973
  $enabled = FLBuilderModel::is_builder_enabled();
974
  $rendering = $post_id === self::$post_rendering;
975
+ $do_render = apply_filters( 'fl_builder_do_render_content', true, $post_id );
976
  $in_loop = in_the_loop();
977
  $is_global = in_array( $post_id, FLBuilderModel::get_global_posts() );
978
 
979
+ if( $enabled && ! $rendering && $do_render && ( $in_loop || $is_global ) ) {
980
 
981
  // Set the post rendering ID.
982
  self::$post_rendering = $post_id;
1145
 
1146
  foreach($cols as $col) {
1147
 
1148
+ $col_children = FLBuilderModel::get_nodes( null, $col );
1149
 
1150
+ foreach ( $col_children as $col_child ) {
1151
 
1152
+ if ( 'module' == $col_child->type ) {
1153
+
1154
+ $module = FLBuilderModel::get_module( $col_child );
1155
+
1156
+ if ( $module && $module->editor_export ) {
1157
 
1158
+ // Don't crop photos to ensure media library photos are rendered.
1159
+ if($module->settings->type == 'photo') {
1160
+ $module->settings->crop = false;
1161
+ }
1162
 
1163
+ FLBuilder::render_module_html($module->settings->type, $module->settings, $module);
1164
+ }
1165
+ }
1166
+ else if ( 'column-group' == $col_child->type ) {
1167
+
1168
+ $group_cols = FLBuilderModel::get_nodes( 'column', $col_child );
1169
+
1170
+ foreach ( $group_cols as $group_col ) {
1171
+
1172
+ $modules = FLBuilderModel::get_modules( $group_col );
1173
+
1174
+ foreach ( $modules as $module ) {
1175
+
1176
+ if($module->editor_export) {
1177
+
1178
+ // Don't crop photos to ensure media library photos are rendered.
1179
+ if($module->settings->type == 'photo') {
1180
+ $module->settings->crop = false;
1181
+ }
1182
+
1183
+ FLBuilder::render_module_html($module->settings->type, $module->settings, $module);
1184
+ }
1185
+ }
1186
+ }
1187
  }
1188
  }
1189
  }
2539
  $js = apply_filters( 'fl_builder_render_js', $js, $nodes, $global_settings );
2540
 
2541
  if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
2542
+ try {
2543
+ $min = FLJSMin::minify( $js );
2544
+ } catch (Exception $e) {}
2545
+
2546
+ if ( $min ) {
2547
+ $js = $min;
2548
+ }
2549
  }
2550
 
2551
  file_put_contents( $path, $js );
css/fl-builder-layout.css CHANGED
@@ -111,6 +111,7 @@
111
  pointer-events: none;
112
  width: 100vw;
113
  height: 56.25vw; /* Given a 16:9 aspect ratio, 9/16*100 = 56.25 */
 
114
  min-height: 100vh;
115
  min-width: 177.77vh; /* Given a 16:9 aspect ratio, 16/9*100 = 177.77 */
116
  position: absolute;
@@ -191,13 +192,29 @@
191
 
192
  /* Stupid IE Full Height Row Fixes */
193
  .fl-builder-ie-11 .fl-row-full-height .fl-row-content-wrap {
194
- height: 1px;
195
  }
196
 
197
  .fl-builder-ie-11 .fl-row-full-height .fl-row-content {
198
  flex: 0 0 auto;
199
  flex-basis: 100%;
200
- margin: 0 auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  }
202
 
203
  /* Full height align center */
111
  pointer-events: none;
112
  width: 100vw;
113
  height: 56.25vw; /* Given a 16:9 aspect ratio, 9/16*100 = 56.25 */
114
+ max-width: none;
115
  min-height: 100vh;
116
  min-width: 177.77vh; /* Given a 16:9 aspect ratio, 16/9*100 = 177.77 */
117
  position: absolute;
192
 
193
  /* Stupid IE Full Height Row Fixes */
194
  .fl-builder-ie-11 .fl-row-full-height .fl-row-content-wrap {
195
+ height: auto;
196
  }
197
 
198
  .fl-builder-ie-11 .fl-row-full-height .fl-row-content {
199
  flex: 0 0 auto;
200
  flex-basis: 100%;
201
+ margin: 0;
202
+ }
203
+
204
+ .fl-builder-ie-11 .fl-row-full-height.fl-row-align-top .fl-row-content {
205
+ margin: 0 auto;
206
+ }
207
+
208
+ .fl-row-full-height.fl-row-align-center .fl-col-group:not(.fl-col-group-equal-height) {
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ -webkit-align-items: center;
213
+ -webkit-box-align: center;
214
+ -webkit-box-pack: center;
215
+ -webkit-justify-content: center;
216
+ -ms-flex-align: center;
217
+ -ms-flex-pack: center;
218
  }
219
 
220
  /* Full height align center */
fl-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
- * Version: 1.9.4
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
+ * Version: 1.9.5.1
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
includes/compatibility.php CHANGED
@@ -4,6 +4,36 @@
4
  * Misc functions for compatibility with other plugins.
5
  */
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  /**
8
  * Support for Option Tree.
9
  *
4
  * Misc functions for compatibility with other plugins.
5
  */
6
 
7
+ /**
8
+ * Support for WooCommerce Memberships.
9
+ *
10
+ * Makes sure builder content isn't rendered for protected posts.
11
+ */
12
+ function fl_builder_wc_memberships_support() {
13
+
14
+ if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
15
+
16
+ function fl_builder_wc_memberships_maybe_render_content( $do_render, $post_id ) {
17
+
18
+ if ( wc_memberships_is_post_content_restricted() ) {
19
+
20
+ // check if user has access to restricted content
21
+ if ( ! current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
22
+ $do_render = false;
23
+ }
24
+ // check if user has access to delayed content
25
+ else if ( ! current_user_can( 'wc_memberships_view_delayed_post_content', $post_id ) ) {
26
+ $do_render = false;
27
+ }
28
+ }
29
+
30
+ return $do_render;
31
+ }
32
+ add_filter( 'fl_builder_do_render_content', 'fl_builder_wc_memberships_maybe_render_content', 10, 2 );
33
+ }
34
+ }
35
+ add_action( 'plugins_loaded', 'fl_builder_wc_memberships_support', 11 );
36
+
37
  /**
38
  * Support for Option Tree.
39
  *
includes/field-code.php CHANGED
@@ -21,6 +21,10 @@
21
  editor.getSession().setValue(textarea.val());
22
  editor.getSession().setMode('ace/mode/' + mode);
23
 
 
 
 
 
24
  editor.setOptions({
25
  enableBasicAutocompletion: true,
26
  enableLiveAutocompletion: true,
21
  editor.getSession().setValue(textarea.val());
22
  editor.getSession().setMode('ace/mode/' + mode);
23
 
24
+ <?php if ( isset( $field['wrap'] ) && $field['wrap'] === true ) : ?>
25
+ editor.getSession().setUseWrapMode(true);
26
+ <?php endif; ?>
27
+
28
  editor.setOptions({
29
  enableBasicAutocompletion: true,
30
  enableLiveAutocompletion: true,
includes/field-unit.php CHANGED
@@ -1,6 +1,6 @@
1
- <input
2
  type="number"
3
- name="<?php esc_attr_e( $name ); ?>"
4
- value="<?php esc_attr_e( $value ); ?>"
5
- placeholder="<?php if ( isset( $field['placeholder'] ) ) esc_attr_e( $field['placeholder'] ); ?>"
6
- />
1
+ <input
2
  type="number"
3
+ name="<?php echo esc_attr( $name ); ?>"
4
+ value="<?php echo esc_attr( $value ); ?>"
5
+ placeholder="<?php if ( isset( $field['placeholder'] ) ) echo esc_attr( $field['placeholder'] ); ?>"
6
+ />
includes/layout-js-config.php CHANGED
@@ -7,5 +7,8 @@ var FLBuilderLayoutConfig = {
7
  paths : {
8
  pluginUrl : '<?php echo FL_BUILDER_URL; ?>',
9
  wpAjaxUrl : '<?php echo admin_url( 'admin-ajax.php' ); ?>'
 
 
 
10
  }
11
  };
7
  paths : {
8
  pluginUrl : '<?php echo FL_BUILDER_URL; ?>',
9
  wpAjaxUrl : '<?php echo admin_url( 'admin-ajax.php' ); ?>'
10
+ },
11
+ waypoint: {
12
+ offset: 80
13
  }
14
  };
includes/strings.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
-
3
  /**
4
  * Misc strings that aren't in the core plugin but
5
  * need to be translated.
6
  */
7
-
8
  __( 'The Beaver Builder Booster plugin is not compatible with your host.', 'fl-builder' );
9
 
10
- __( 'Click here to edit content on this %s using an easy drag-and-drop builder.', '%s is the singular post type name (e.g. page)', 'fl-builder' );
11
 
12
  __( 'Use an easy drag-and-drop builder to edit content on this page.', 'fl-builder' );
13
 
14
- __( 'Launch Page Builder', 'fl-builder' );
1
  <?php
2
+
3
  /**
4
  * Misc strings that aren't in the core plugin but
5
  * need to be translated.
6
  */
7
+
8
  __( 'The Beaver Builder Booster plugin is not compatible with your host.', 'fl-builder' );
9
 
10
+ _x( 'Click here to edit content on this %s using an easy drag-and-drop builder.', '%s is the singular post type name (e.g. page)', 'fl-builder' );
11
 
12
  __( 'Use an easy drag-and-drop builder to edit content on this page.', 'fl-builder' );
13
 
14
+ __( 'Launch Page Builder', 'fl-builder' );
includes/template-selector.php CHANGED
@@ -1,8 +1,8 @@
1
  <form class="fl-builder-settings fl-template-selector">
2
  <div class="fl-lightbox-header">
3
-
4
  <h1><?php _e('Layout Templates', 'fl-builder'); ?></h1>
5
-
6
  <?php if ( count( $filter_data ) > 1 ) : ?>
7
  <div class="fl-template-category-filter fl-builder-settings-fields">
8
  <select class="fl-template-category-select" name="fl-template-category-select">
@@ -12,21 +12,21 @@
12
  </select>
13
  </div>
14
  <?php endif; ?>
15
-
16
  </div>
17
  <div class="fl-builder-settings-fields fl-nanoscroller">
18
  <div class="fl-nanoscroller-content">
19
-
20
  <?php if ( true === FL_BUILDER_LITE ) : ?>
21
  <?php if ( FLBuilderModel::has_templates() ) : ?>
22
  <div class="fl-builder-settings-message fl-builder-templates-cta">
23
- <p>Save and reuse your layouts or kick-start your creativity with even more professionally designed templates.</p>
24
- <a class="fl-builder-upgrade-button fl-builder-button" href="<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'templates-cta' ) ); ?>" target="_blank">Learn More <i class="fa fa-external-link-square"></i></a>
25
  </div>
26
  <?php else : ?>
27
  <div class="fl-builder-settings-message fl-builder-templates-cta">
28
- <p>Save and reuse your layouts or kick-start your creativity with dozens of professionally designed templates.</p>
29
- <a class="fl-builder-upgrade-button fl-builder-button" href="<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'templates-cta' ) ); ?>" target="_blank">Learn More <i class="fa fa-external-link-square"></i></a>
30
  </div>
31
  <img class="fl-builder-templates-cta-img" src="<?php echo FL_BUILDER_URL; ?>img/templates-preview.jpg" />
32
  <?php endif; ?>
1
  <form class="fl-builder-settings fl-template-selector">
2
  <div class="fl-lightbox-header">
3
+
4
  <h1><?php _e('Layout Templates', 'fl-builder'); ?></h1>
5
+
6
  <?php if ( count( $filter_data ) > 1 ) : ?>
7
  <div class="fl-template-category-filter fl-builder-settings-fields">
8
  <select class="fl-template-category-select" name="fl-template-category-select">
12
  </select>
13
  </div>
14
  <?php endif; ?>
15
+
16
  </div>
17
  <div class="fl-builder-settings-fields fl-nanoscroller">
18
  <div class="fl-nanoscroller-content">
19
+
20
  <?php if ( true === FL_BUILDER_LITE ) : ?>
21
  <?php if ( FLBuilderModel::has_templates() ) : ?>
22
  <div class="fl-builder-settings-message fl-builder-templates-cta">
23
+ <p><?php _e( 'Save and reuse your layouts or kick-start your creativity with even more professionally designed templates.', 'fl-builder' ); ?></p>
24
+ <a class="fl-builder-upgrade-button fl-builder-button" href="<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'templates-cta' ) ); ?>" target="_blank"><?php _e( 'Learn More', 'fl-builder' ); ?> <i class="fa fa-external-link-square"></i></a>
25
  </div>
26
  <?php else : ?>
27
  <div class="fl-builder-settings-message fl-builder-templates-cta">
28
+ <p><?php _e( 'Save and reuse your layouts or kick-start your creativity with dozens of professionally designed templates.', 'fl-builder' ); ?></p>
29
+ <a class="fl-builder-upgrade-button fl-builder-button" href="<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'templates-cta' ) ); ?>" target="_blank"><?php _e( 'Learn More', 'fl-builder' ); ?> <i class="fa fa-external-link-square"></i></a>
30
  </div>
31
  <img class="fl-builder-templates-cta-img" src="<?php echo FL_BUILDER_URL; ?>img/templates-preview.jpg" />
32
  <?php endif; ?>
includes/ui-panel.php CHANGED
@@ -31,7 +31,7 @@
31
  <div class="fl-builder-blocks-separator"></div>
32
 
33
  <?php do_action( 'fl_builder_ui_panel_before_modules' ); ?>
34
-
35
  <?php foreach($categories as $title => $modules) : ?>
36
  <div id="fl-builder-blocks-<?php echo FLBuilderModel::get_module_category_slug( $title ); ?>" class="fl-builder-blocks-section">
37
  <span class="fl-builder-blocks-section-title">
@@ -58,7 +58,7 @@
58
 
59
  <?php if ( true === FL_BUILDER_LITE ) : ?>
60
  <div class="fl-builder-modules-cta">
61
- <a href="#" onclick="window.open('<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'modules-panel-cta' ) ); ?>');" target="_blank"><i class="fa fa-external-link-square"></i> Get more time-saving features, modules, and expert support.</a>
62
  </div>
63
  <?php endif; ?>
64
 
31
  <div class="fl-builder-blocks-separator"></div>
32
 
33
  <?php do_action( 'fl_builder_ui_panel_before_modules' ); ?>
34
+
35
  <?php foreach($categories as $title => $modules) : ?>
36
  <div id="fl-builder-blocks-<?php echo FLBuilderModel::get_module_category_slug( $title ); ?>" class="fl-builder-blocks-section">
37
  <span class="fl-builder-blocks-section-title">
58
 
59
  <?php if ( true === FL_BUILDER_LITE ) : ?>
60
  <div class="fl-builder-modules-cta">
61
+ <a href="#" onclick="window.open('<?php echo FLBuilderModel::get_store_url( '', array( 'utm_medium' => 'bb-lite', 'utm_source' => 'builder-ui', 'utm_campaign' => 'modules-panel-cta' ) ); ?>');" target="_blank"><i class="fa fa-external-link-square"></i> <?php _e( 'Get more time-saving features, modules, and expert support.', 'fl-builder' ); ?></a>
62
  </div>
63
  <?php endif; ?>
64
 
includes/updater-config.php CHANGED
@@ -3,7 +3,7 @@
3
  if(class_exists('FLUpdater')) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
- 'version' => '1.9.4',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin'
9
  ));
3
  if(class_exists('FLUpdater')) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
+ 'version' => '1.9.5.1',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin'
9
  ));
includes/updater/classes/class-fl-updater.php CHANGED
@@ -8,7 +8,7 @@
8
  final class FLUpdater {
9
 
10
  /**
11
- * The API URL for the Beaver Builder update server.
12
  *
13
  * @since 1.0
14
  * @access private
@@ -26,7 +26,7 @@ final class FLUpdater {
26
  static private $_products = array();
27
 
28
  /**
29
- * An internal array of remote responses with
30
  * update data for each product.
31
  *
32
  * @since 1.8.4
@@ -74,20 +74,21 @@ final class FLUpdater {
74
  public function get_response()
75
  {
76
  $slug = $this->settings['slug'];
77
-
78
  if ( isset( FLUpdater::$_responses[ $slug ] ) ) {
79
  return FLUpdater::$_responses[ $slug ];
80
  }
81
-
82
  FLUpdater::$_responses[ $slug ] = FLUpdater::api_request( FLUpdater::$_updates_api_url, array(
83
  'fl-api-method' => 'update_info',
84
  'license' => FLUpdater::get_subscription_license(),
85
  'domain' => network_home_url(),
86
  'product' => $this->settings['name'],
87
  'slug' => $this->settings['slug'],
88
- 'version' => $this->settings['version']
 
89
  ) );
90
-
91
  return FLUpdater::$_responses[ $slug ];
92
  }
93
 
@@ -101,7 +102,7 @@ final class FLUpdater {
101
  public function update_check( $transient )
102
  {
103
  global $pagenow;
104
-
105
  if( 'plugins.php' == $pagenow && is_multisite() ) {
106
  return $transient;
107
  }
@@ -111,26 +112,26 @@ final class FLUpdater {
111
  if ( ! isset( $transient->checked ) ) {
112
  $transient->checked = array();
113
  }
114
-
115
  $response = $this->get_response();
116
 
117
  if( ! isset( $response->error ) ) {
118
-
119
  $transient->last_checked = time();
120
  $transient->checked[ $this->settings['slug'] ] = $this->settings['version'];
121
 
122
  if($this->settings['type'] == 'plugin') {
123
 
124
  $plugin = self::get_plugin_file($this->settings['slug']);
125
-
126
  if ( version_compare( $response->new_version, $this->settings['version'], '>' ) ) {
127
-
128
  $transient->response[ $plugin ] = new stdClass();
129
  $transient->response[ $plugin ]->slug = $response->slug;
130
  $transient->response[ $plugin ]->new_version = $response->new_version;
131
  $transient->response[ $plugin ]->url = $response->homepage;
132
  $transient->response[ $plugin ]->package = $response->package;
133
-
134
  if ( empty( $response->package ) ) {
135
  $transient->response[ $plugin ]->upgrade_notice = FLUpdater::get_update_error_message();
136
  }
@@ -139,7 +140,7 @@ final class FLUpdater {
139
  else if($this->settings['type'] == 'theme') {
140
 
141
  if(version_compare($response->new_version, $this->settings['version'], '>')) {
142
-
143
  $transient->response[$this->settings['slug']] = array(
144
  'new_version' => $response->new_version,
145
  'url' => $response->homepage,
@@ -173,7 +174,7 @@ final class FLUpdater {
173
  $response = $this->get_response();
174
 
175
  if( ! isset( $response->error ) ) {
176
-
177
  $info = new stdClass();
178
  $info->name = $this->settings['name'];
179
  $info->version = $response->new_version;
@@ -186,7 +187,7 @@ final class FLUpdater {
186
  $info->last_updated = $response->last_updated;
187
  $info->download_link = $response->package;
188
  $info->sections = (array)$response->sections;
189
-
190
  return $info;
191
  }
192
 
@@ -304,7 +305,7 @@ final class FLUpdater {
304
  'domain' => network_home_url(),
305
  'products' => json_encode( self::$_products )
306
  ));
307
-
308
  update_site_option('fl_themes_subscription_email', $license);
309
  }
310
 
@@ -338,15 +339,15 @@ final class FLUpdater {
338
  $message .= __( '<strong>UPDATE UNAVAILABLE!</strong>', 'fl-builder' );
339
  $message .= '&nbsp;&nbsp;&nbsp;';
340
  $message .= __('Please subscribe to enable automatic updates for this plugin.', 'fl-builder');
341
-
342
  if ( $plugin_data && isset( $plugin_data['PluginURI'] ) ) {
343
  $message .= ' <a href="' . $plugin_data['PluginURI'] . '" target="_blank" style="color: #fff; text-decoration: underline;">';
344
  $message .= __('Subscribe Now', 'fl-builder');
345
  $message .= ' &raquo;</a>';
346
  }
347
-
348
  $message .= '</p>';
349
-
350
  return $message;
351
  }
352
 
@@ -417,19 +418,19 @@ final class FLUpdater {
417
  if(wp_remote_retrieve_response_code($request) != 200) {
418
  return $error;
419
  }
420
-
421
  $body = wp_remote_retrieve_body($request);
422
-
423
  if(is_wp_error($body)) {
424
  return $error;
425
  }
426
 
427
  $body_decoded = json_decode($body);
428
-
429
  if(!is_object($body_decoded)) {
430
  return $error;
431
  }
432
 
433
  return $body_decoded;
434
  }
435
- }
8
  final class FLUpdater {
9
 
10
  /**
11
+ * The API URL for the Beaver Builder update server.
12
  *
13
  * @since 1.0
14
  * @access private
26
  static private $_products = array();
27
 
28
  /**
29
+ * An internal array of remote responses with
30
  * update data for each product.
31
  *
32
  * @since 1.8.4
74
  public function get_response()
75
  {
76
  $slug = $this->settings['slug'];
77
+
78
  if ( isset( FLUpdater::$_responses[ $slug ] ) ) {
79
  return FLUpdater::$_responses[ $slug ];
80
  }
81
+
82
  FLUpdater::$_responses[ $slug ] = FLUpdater::api_request( FLUpdater::$_updates_api_url, array(
83
  'fl-api-method' => 'update_info',
84
  'license' => FLUpdater::get_subscription_license(),
85
  'domain' => network_home_url(),
86
  'product' => $this->settings['name'],
87
  'slug' => $this->settings['slug'],
88
+ 'version' => $this->settings['version'],
89
+ 'php' => phpversion()
90
  ) );
91
+
92
  return FLUpdater::$_responses[ $slug ];
93
  }
94
 
102
  public function update_check( $transient )
103
  {
104
  global $pagenow;
105
+
106
  if( 'plugins.php' == $pagenow && is_multisite() ) {
107
  return $transient;
108
  }
112
  if ( ! isset( $transient->checked ) ) {
113
  $transient->checked = array();
114
  }
115
+
116
  $response = $this->get_response();
117
 
118
  if( ! isset( $response->error ) ) {
119
+
120
  $transient->last_checked = time();
121
  $transient->checked[ $this->settings['slug'] ] = $this->settings['version'];
122
 
123
  if($this->settings['type'] == 'plugin') {
124
 
125
  $plugin = self::get_plugin_file($this->settings['slug']);
126
+
127
  if ( version_compare( $response->new_version, $this->settings['version'], '>' ) ) {
128
+
129
  $transient->response[ $plugin ] = new stdClass();
130
  $transient->response[ $plugin ]->slug = $response->slug;
131
  $transient->response[ $plugin ]->new_version = $response->new_version;
132
  $transient->response[ $plugin ]->url = $response->homepage;
133
  $transient->response[ $plugin ]->package = $response->package;
134
+
135
  if ( empty( $response->package ) ) {
136
  $transient->response[ $plugin ]->upgrade_notice = FLUpdater::get_update_error_message();
137
  }
140
  else if($this->settings['type'] == 'theme') {
141
 
142
  if(version_compare($response->new_version, $this->settings['version'], '>')) {
143
+
144
  $transient->response[$this->settings['slug']] = array(
145
  'new_version' => $response->new_version,
146
  'url' => $response->homepage,
174
  $response = $this->get_response();
175
 
176
  if( ! isset( $response->error ) ) {
177
+
178
  $info = new stdClass();
179
  $info->name = $this->settings['name'];
180
  $info->version = $response->new_version;
187
  $info->last_updated = $response->last_updated;
188
  $info->download_link = $response->package;
189
  $info->sections = (array)$response->sections;
190
+
191
  return $info;
192
  }
193
 
305
  'domain' => network_home_url(),
306
  'products' => json_encode( self::$_products )
307
  ));
308
+
309
  update_site_option('fl_themes_subscription_email', $license);
310
  }
311
 
339
  $message .= __( '<strong>UPDATE UNAVAILABLE!</strong>', 'fl-builder' );
340
  $message .= '&nbsp;&nbsp;&nbsp;';
341
  $message .= __('Please subscribe to enable automatic updates for this plugin.', 'fl-builder');
342
+
343
  if ( $plugin_data && isset( $plugin_data['PluginURI'] ) ) {
344
  $message .= ' <a href="' . $plugin_data['PluginURI'] . '" target="_blank" style="color: #fff; text-decoration: underline;">';
345
  $message .= __('Subscribe Now', 'fl-builder');
346
  $message .= ' &raquo;</a>';
347
  }
348
+
349
  $message .= '</p>';
350
+
351
  return $message;
352
  }
353
 
418
  if(wp_remote_retrieve_response_code($request) != 200) {
419
  return $error;
420
  }
421
+
422
  $body = wp_remote_retrieve_body($request);
423
+
424
  if(is_wp_error($body)) {
425
  return $error;
426
  }
427
 
428
  $body_decoded = json_decode($body);
429
+
430
  if(!is_object($body_decoded)) {
431
  return $error;
432
  }
433
 
434
  return $body_decoded;
435
  }
436
+ }
index.php CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
js/fl-builder-layout.js CHANGED
@@ -838,9 +838,9 @@
838
  if ( responsiveLabel.is( ':visible' ) ) {
839
  responsiveLabel.trigger( 'click' );
840
  }
841
- else {
842
- FLBuilderLayout._scrollToElement( label );
843
- label.trigger( 'click' );
844
  }
845
 
846
  }, 100 );
@@ -877,16 +877,21 @@
877
  loc = window.location,
878
  id = null,
879
  element = null;
880
-
881
  if ( 'undefined' != typeof href && href.indexOf( '#' ) > -1 ) {
882
-
883
  if ( loc.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && loc.hostname == this.hostname ) {
884
-
885
  try {
886
-
887
  id = href.split( '#' ).pop();
 
 
 
 
 
888
  element = $( '#' + id );
889
-
890
  if ( element.length > 0 ) {
891
  if ( link.hasClass( 'fl-scroll-link' ) || element.hasClass( 'fl-row' ) || element.hasClass( 'fl-col' ) || element.hasClass( 'fl-module' ) ) {
892
  $( link ).on( 'click', FLBuilderLayout._scrollToElementOnLinkClick );
@@ -1025,8 +1030,8 @@
1025
  FLBuilderLayout._scrollToElementOnLinkClick.call( this, e, callback );
1026
  }
1027
  else {
1028
- FLBuilderLayout._scrollToElement( label );
1029
- label.trigger( 'click' );
1030
  }
1031
 
1032
  e.preventDefault();
838
  if ( responsiveLabel.is( ':visible' ) ) {
839
  responsiveLabel.trigger( 'click' );
840
  }
841
+ else {
842
+ label[0].click();
843
+ FLBuilderLayout._scrollToElement( element );
844
  }
845
 
846
  }, 100 );
877
  loc = window.location,
878
  id = null,
879
  element = null;
880
+
881
  if ( 'undefined' != typeof href && href.indexOf( '#' ) > -1 ) {
882
+
883
  if ( loc.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && loc.hostname == this.hostname ) {
884
+
885
  try {
886
+
887
  id = href.split( '#' ).pop();
888
+ // If there is no ID then we have nowhere to look
889
+ // Fixes a quirk in jQuery and FireFox
890
+ if( ! id ) {
891
+ return;
892
+ }
893
  element = $( '#' + id );
894
+
895
  if ( element.length > 0 ) {
896
  if ( link.hasClass( 'fl-scroll-link' ) || element.hasClass( 'fl-row' ) || element.hasClass( 'fl-col' ) || element.hasClass( 'fl-module' ) ) {
897
  $( link ).on( 'click', FLBuilderLayout._scrollToElementOnLinkClick );
1030
  FLBuilderLayout._scrollToElementOnLinkClick.call( this, e, callback );
1031
  }
1032
  else {
1033
+ label[0].click();
1034
+ FLBuilderLayout._scrollToElement( element );
1035
  }
1036
 
1037
  e.preventDefault();
js/fl-builder.js CHANGED
@@ -1932,8 +1932,26 @@
1932
  action: 'apply_user_template',
1933
  template_id: id,
1934
  append: append
1935
- }, FLBuilder._updateLayout);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1936
  }
 
 
1937
  },
1938
 
1939
  /* User Template Settings
@@ -3788,7 +3806,7 @@
3788
  }
3789
 
3790
  // Find the new group position.
3791
- position = newParent.find( '.fl-module, .fl-col-group, .fl-col-sortable-proxy-item' ).index( ui.item );
3792
 
3793
  // Add the new group.
3794
  FLBuilder._addColGroup( newParent.closest( '.fl-col' ).attr('data-node'), colId, position );
@@ -6018,7 +6036,7 @@
6018
  $(prefix + inputArray[i] + suffix)[func]();
6019
 
6020
  // Resize code editor fields.
6021
- $( prefix + inputArray[i] ).parent().find( '.fl-field[data-type="code"]' ).each( function() {
6022
  $( this ).data( 'editor' ).resize();
6023
  } );
6024
  }
1932
  action: 'apply_user_template',
1933
  template_id: id,
1934
  append: append
1935
+ }, FLBuilder._updateTemplateLayout);
1936
+ }
1937
+ },
1938
+
1939
+ /**
1940
+ * Callback method when applying user template to the current layout
1941
+
1942
+ * @since 1.9.5
1943
+ * @access private
1944
+ * @method _updateTemplateLayout
1945
+ * @param {string} response The JSON with the new layout settings
1946
+ */
1947
+ _updateTemplateLayout: function(response)
1948
+ {
1949
+ var data = JSON.parse(response);
1950
+ if( data !== null ) {
1951
+ $( '#fl-builder-layout-css' ).html( data.layout_css );
1952
  }
1953
+
1954
+ FLBuilder._updateLayout();
1955
  },
1956
 
1957
  /* User Template Settings
3806
  }
3807
 
3808
  // Find the new group position.
3809
+ position = newParent.find( '> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item' ).index( ui.item );
3810
 
3811
  // Add the new group.
3812
  FLBuilder._addColGroup( newParent.closest( '.fl-col' ).attr('data-node'), colId, position );
6036
  $(prefix + inputArray[i] + suffix)[func]();
6037
 
6038
  // Resize code editor fields.
6039
+ $( prefix + inputArray[i] + suffix ).parent().find( '.fl-field[data-type="code"]' ).each( function() {
6040
  $( this ).data( 'editor' ).resize();
6041
  } );
6042
  }
js/fl-builder.min.js CHANGED
@@ -1,6 +1,6 @@
1
- !function(e){FLBuilderAJAXLayout=function(t,l){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=l,this._post=e("#fl-post-id").val(),this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback()},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),l="fl-row",i=this._data.scriptsStyles,o="";this._data.partial&&(l="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(l)||(o=e(this).remove(),i+=o[0].outerHTML)}),""!==i&&(i=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+i+"<div>":'<div class="fl-builder-node-scripts-styles">'+i+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=i}},_addNewHTML:function(){var e;this._data.partial?this._data.nodeParent?(e=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),0===e.length||e.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):e.eq(this._data.nodePosition).before(this._data.html)):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html)},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var l=e("<div>"+t+"</div>"),i="",o=null,s="",r=null,n=window.location,a=n.protocol+"//"+n.hostname+(n.port?":"+n.port:"");return l.find("script").each(function(){i=e(this).attr("src"),"undefined"!=typeof i&&(i=i.replace(a,""),o=e('script[src*="'+i+'"]'),o.length>0&&e(this).remove())}),l.find("link").each(function(){s=e(this).attr("href"),"undefined"!=typeof s&&(s=s.replace(a,""),r=e('link[href*="'+s+'"]'),r.length>0&&e(this).remove())}),l.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),!function(e){"use strict";if(e.matchMedia&&e.matchMedia("all").addListener)return!1;var t=e.matchMedia,l=t("only all").matches,i=!1,o=0,s=[],r=function(l){e.clearTimeout(o),o=e.setTimeout(function(){for(var l=0,i=s.length;l<i;l++){var o=s[l].mql,r=s[l].listeners||[],n=t(o.media).matches;if(n!==o.matches){o.matches=n;for(var a=0,d=r.length;a<d;a++)r[a].call(e,o)}}},30)};e.matchMedia=function(o){var n=t(o),a=[],d=0;return n.addListener=function(t){l&&(i||(i=!0,e.addEventListener("resize",r,!0)),0===d&&(d=s.push({mql:n,listeners:a})),a.push(t))},n.removeListener=function(e){for(var t=0,l=a.length;t<l;t++)a[t]===e&&a.splice(t,1)},n}}(this),!function(e){"use strict";e.matchMedia=e.matchMedia||function(e,t){var l,i=e.documentElement,o=i.firstElementChild||i.firstChild,s=e.createElement("body"),r=e.createElement("div");return r.id="mq-test-1",r.style.cssText="position:absolute;top:-100em",s.style.background="none",s.appendChild(r),function(e){return r.innerHTML='&shy;<style media="'+e+'"> #mq-test-1 { width: 42px; }</style>',i.insertBefore(s,o),l=42===r.offsetWidth,i.removeChild(s),{matches:l,media:e}}}(e.document)}(this),function(e){FLBuilderForcedMediaQueries={_requestQueue:[],_xmlHttp:function(){var e=!1;try{e=new window.XMLHttpRequest}catch(t){e=new window.ActiveXObject("Microsoft.XMLHTTP")}return function(){return e}}(),_regex:{media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},_mediaStyles:[],_rules:[],_appendedEls:[],_parsedSheets:{},_emInPx:null,_width:null,_callback:null,update:function(e,t){var l=FLBuilderForcedMediaQueries,i=window.document,o=i.documentElement,s=i.getElementsByTagName("head")[0]||o,r=i.getElementsByTagName("base")[0],n=s.getElementsByTagName("link");l._mediaStyles=[],l._rules=[],"undefined"!=typeof e&&(l._width=e),"undefined"!=typeof t&&(l._callback=t);for(var a in l._parsedSheets)a.indexOf("-layout-draft.css?")>-1?l._parsedSheets[a].parsed=!1:a.indexOf("-layout-preview.css?")>-1&&(l._parsedSheets[a].parsed=!1);for(var d=0;d<n.length;d++){var a=n[d],u=a.href,c=a.media,f=a.rel&&"stylesheet"===a.rel.toLowerCase();if(u&&f){if(u.indexOf(FLBuilderConfig.pluginUrl)>-1)continue;"undefined"!=typeof l._parsedSheets[u]&&l._parsedSheets[u].parsed?l._translate(l._parsedSheets[u].styles,u,l._parsedSheets[u].media):a.styleSheet&&a.styleSheet.rawCssText?(l._translate(a.styleSheet.rawCssText,u,c),l._parsedSheets[u]=!0):(/^([a-zA-Z:]*\/\/)/.test(u)||r)&&u.replace(RegExp.$1,"").split("/")[0]!==window.location.host||("//"===u.substring(0,2)&&(u=window.location.protocol+u),l._requestQueue.push({href:u,media:c}))}}l._makeRequests()},applyMedia:function(e){var t=FLBuilderForcedMediaQueries,l="clientWidth",i=window.document,o=i.documentElement,s=(o[l],i.getElementsByTagName("head")[0]||o),r=s.getElementsByTagName("link"),n=r[r.length-1],a=((new Date).getTime(),{}),d=t._mediaStyles,u=t._appendedEls,c=t._emInPx;t._width=e;for(var f in d)if(d.hasOwnProperty(f)){var h=d[f],p=h.minw,g=h.maxw,_=null===p,m=null===g,b="em";p&&(p=parseFloat(p)*(p.indexOf(b)>-1?c||t.getEmPixelValue():1)),g&&(g=parseFloat(g)*(g.indexOf(b)>-1?c||t.getEmPixelValue():1)),h.hasQuery&&(_&&m||!(_||e>=p)||!(m||e<=g))||(a[h.media]||(a[h.media]=[]),a[h.media].push(t._rules[h.rules]))}for(var v in u)u.hasOwnProperty(v)&&u[v]&&u[v].parentNode===s&&s.removeChild(u[v]);t._appendedEls.length=0;for(var L in a)if(a.hasOwnProperty(L)){var F=i.createElement("style"),y=a[L].join("\n");F.type="text/css",F.media=L,s.insertBefore(F,n.nextSibling),F.styleSheet?F.styleSheet.cssText=y:F.appendChild(i.createTextNode(y)),t._appendedEls.push(F)}},isUnsupportedMediaQuery:function(e){var t=FLBuilderForcedMediaQueries._regex;return e.replace(t.minmaxwh,"").match(t.other)},getEmPixelValue:function(){var e=null,t=window.document,l=t.documentElement,i=t.body,o=t.createElement("div"),s=l.style.fontSize,r=i&&i.style.fontSize,n=!1;return o.style.cssText="position:absolute;font-size:1em;width:1em",i||(i=n=t.createElement("body"),i.style.background="none"),l.style.fontSize="100%",i.style.fontSize="100%",i.appendChild(o),n&&l.insertBefore(i,l.firstChild),e=o.offsetWidth,n?l.removeChild(i):i.removeChild(o),l.style.fontSize=s,r&&(i.style.fontSize=r),e=FLBuilderForcedMediaQueries._emInPx=parseFloat(e)},_translate:function(e,t,l){var i=FLBuilderForcedMediaQueries,o=i._regex,s=e.replace(o.comments,"").replace(o.keyframes,"").match(o.media),r=s&&s.length||0;t=t.substring(0,t.lastIndexOf("/"));var n=function(e){return e.replace(o.urls,"$1"+t+"$2$3")},a=!r&&l;t.length&&(t+="/"),a&&(r=1);for(var d=0;d<r;d++){var u,c,f,h;a?(u=l,i._rules.push(n(e))):(u=s[d].match(o.findStyles)&&RegExp.$1,i._rules.push(RegExp.$2&&n(RegExp.$2))),f=u.split(","),h=f.length;for(var p=0;p<h;p++)c=f[p],i.isUnsupportedMediaQuery(c)||i._mediaStyles.push({media:c.split("(")[0].match(o.only)&&RegExp.$2||"all",rules:i._rules.length-1,hasQuery:c.indexOf("(")>-1,minw:c.match(o.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:c.match(o.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}},_makeRequests:function(){var e=FLBuilderForcedMediaQueries;if(e._requestQueue.length){var t=e._requestQueue.shift();e._ajax(t.href,function(l){e._translate(l,t.href,t.media),e._parsedSheets[t.href]={parsed:!0,styles:l,media:t.media},window.setTimeout(function(){e._makeRequests()},0)})}else e._width&&(e.applyMedia(e._width),e._callback&&(e._callback(),e._callback=null))},_ajax:function(e,t){var l=FLBuilderForcedMediaQueries._xmlHttp();l&&(l.open("GET",e,!0),l.onreadystatechange=function(){4!==l.readyState||200!==l.status&&304!==l.status||t(l.responseText)},4!==l.readyState&&l.send(null))}}}(jQuery),function(e){FLBuilderPreview=function(t){this.type=t.type,"undefined"!=t.state&&t.state?this.state=t.state:this._saveState(),"undefined"!=t.layout&&t.layout?FLBuilder._renderLayout(t.layout,e.proxy(this._init,this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(l)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,l){this._styleSheet.updateRule(e,t,l)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),l=t>>16&255,i=t>>8&255,o=255&t;return[l,i,o]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,l){var i=FLBuilderResponsiveEditing._mode,o="default"==i?"":i.charAt(0).toUpperCase()+i.slice(1);this["_styleSheet"+o].updateRule(e,t,l)},_saveState:function(){var t=e("#fl-post-id").val(),l=e('link[href*="/cache/'+t+'"]').attr("href"),i=e('script[src*="/cache/'+t+'"]').attr("src"),o=e(FLBuilder._contentClass).html();this.state={css:l,js:i,html:o}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=t.attr("data-node"),i=FLBuilder._getSettings(t);this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:l,node_preview:i},e.proxy(this._renderPreview,this))},delayPreview:function(t){var l="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),i=e(".fl-builder-widget-settings .fl-builder-settings-title"),o=e(".fl-builder-settings .fl-lightbox-header"),s=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.gif",r=e('<img class="fl-builder-preview-loader" src="'+s+'" />');e(".fl-builder-preview-loader").remove(),l.length>0?l.append(r):i.length>0?i.append(r):o.length>0&&o.append(r),this.delay(1e3,e.proxy(this.preview,this))},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._initElementsAndClasses(),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){this.clear(),this._settingsHaveChanged()&&FLBuilder._renderLayout(this.state)},clear:function(){this._cancelDelay(),this._cancelPreview(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var l=this.elements.textColor.val(),i=this.elements.linkColor.val(),o=this.elements.hoverColor.val(),s=this.elements.headingColor.val();i=""===i?l:i,o=""===o?l:o,s=""===s?l:s,this.delay(100,e.proxy(function(){""===l?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+l),""===i?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+i),""===o?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+o),""===s?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+s),this.updateCSSRule(this.classes.node+" h2","color","#"+s),this.updateCSSRule(this.classes.node+" h3","color","#"+s),this.updateCSSRule(this.classes.node+" h4","color","#"+s),this.updateCSSRule(this.classes.node+" h5","color","#"+s),this.updateCSSRule(this.classes.node+" h6","color","#"+s),this.updateCSSRule(this.classes.node+" h1 a","color","#"+s),this.updateCSSRule(this.classes.node+" h2 a","color","#"+s),this.updateCSSRule(this.classes.node+" h3 a","color","#"+s),this.updateCSSRule(this.classes.node+" h4 a","color","#"+s),this.updateCSSRule(this.classes.node+" h5 a","color","#"+s),this.updateCSSRule(this.classes.node+" h6 a","color","#"+s))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var l,i,o;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(l=this.hexToRgb(this.elements.bgColor.val()),i=this.parseFloat(this.elements.bgOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",o)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var l=this.elements,i=l.bgVideoSource.val(),o=l.bgVideo.val(),s=l.bgVideoServiceUrl.val(),r="https://www.youtube.com/iframe_api",n="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==i&&""!=s?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(s)&&e('script[src*="youtube.com"').length<1?a.attr("src",r):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(s)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",n),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=o&&this.preview()},_bgSlideshowChange:function(t){var l=this.elements,i=l.bgSlideshowSource.val(),o=l.bgSlideshowPhotos.val(),s=l.bgSlideshowFeedUrl.val(),r=l.bgSlideshowSpeed.val(),n=l.bgSlideshowTransSpeed.val();"wordpress"==i&&""===o||"smugmug"==i&&""===s||isNaN(parseInt(r))||isNaN(parseInt(n))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var l,i,o;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(l=this.hexToRgb(this.elements.bgOverlayColor.val()),i=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",o)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var l,i,o;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(l=this.hexToRgb(this.elements.borderColor.val()),i=parseInt(this.elements.borderOpacity.val())/100,o="rgba("+l.join()+", "+i+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",o)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var l={},i=["Top","Bottom","Left","Right"],o=["","Medium","Responsive"],s=this.classes.settings,r="",n="",a=null,d=null;for(a=0;a<i.length;a++)for(d=0;d<o.length;d++)r=t+i[a]+o[d],n=t+"_"+i[a].toLowerCase(),""!=o[d]&&(n+="_"+o[d].toLowerCase()),l[r]=e(s+" input[name="+n+"]"),l[r].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,l)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,l=["Top","Bottom","Left","Right"],i="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),o={},s=0;s<l.length;s++)o[l[s].toLowerCase()]=this.elements[e+l[s]+i].val();return this._normalizeDimensionValues(o,e)},_responsiveDimensionChange:function(t){var l=this._getDimensions(t),i={},o="border"==t;e.each(l,function(e,l){i[t+"-"+e+(o?"-width":"")]=l}),this.updateResponsiveCSSRule(this.classes.content,i),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,l){var i=this,o=FLBuilderResponsiveEditing._mode,s="default"==o?"":o.charAt(0).toUpperCase()+o.slice(1),l=l.split("-");return"undefined"==typeof l[1]?l[1]="":l[1]=l[1].charAt(0).toUpperCase()+l[1].slice(1),e.map(t,function(e,o){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var r=l[0]+o.charAt(0).toUpperCase()+o.slice(1)+l[1]+s,n=i.elements[r].attr("placeholder");n&&(e=n)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[o]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),l=this.elements.node.find(".fl-bg-video"),i=null,o=null,s={top:0,bottom:0,left:0,right:0};(t.length>0||l.length>0)&&(i=this._getDimensions("margin"),o=this._getDimensions("border"),e.map(s,function(e,t){i[t]&&o[t]?s[t]="calc("+i[t]+"+"+o[t]+")":i[t]?s[t]=i[t]:o[t]&&(s[t]=o[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",s),FLBuilder._resizeLayout()),l.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",s))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node;"full"==this.elements.width.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content");"full"==this.elements.contentWidth.val()?(t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"))},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,l=100-t,i=parseFloat(this.elements.size.val()),o=this.elements.node.prev(".fl-col"),s=this.elements.node.next(".fl-col"),r=0===s.length?o:s,n=this.elements.node.siblings(".fl-col"),a=0;0===n.length||isNaN(i)||(n.each(function(){e(this).data("node")!=r.data("node")&&(l-=parseFloat(e(this)[0].style.width),
2
- a+=parseFloat(e(this)[0].style.width))}),i<t&&(i=t),i>l&&(i=l),r.css("width",100-a-i+"%"),this.elements.node.css("width",i+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(){for(var e=this.elements.settings.find(".fl-field"),t=null,l=null,i=0;i<e.length;i++)t=e.eq(i),l=t.data("preview"),"refresh"==l.type&&this._initFieldRefreshPreview(t),"text"==l.type&&this._initFieldTextPreview(t),"css"==l.type&&this._initFieldCSSPreview(t),"widget"==l.type&&this._initFieldWidgetPreview(t),"font"==l.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this.delayPreview,this);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"select":t.find("select").on("change",o);break;case"color":t.find(".fl-color-picker-value").on("change",o);break;case"photo":t.find("select").on("change",o);break;case"multiple-photos":t.find("input").on("change",o);break;case"photo-sizes":t.find("select").on("change",o);break;case"video":t.find("input").on("change",o);break;case"multiple-audios":t.find("input").on("change",o);break;case"icon":t.find("input").on("change",o);break;case"form":t.delegate("input","change",o);break;case"editor":this._addTextEditorCallback(t,i);break;case"code":t.find("textarea").on("change",o);break;case"post-type":t.find("select").on("change",o);break;case"suggest":t.find(".as-values").on("change",o);break;case"unit":t.find("input[type=number]").on("keyup",o)}},_initFieldTextPreview:function(t){var l=t.data("type"),i=t.data("preview"),o=e.proxy(this._previewText,this,i);switch(l){case"text":t.find("input[type=text]").on("keyup",o);break;case"unit":t.find("input[type=number]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"code":t.find("textarea").on("change",o);break;case"editor":this._addTextEditorCallback(t,i)}},_previewText:function(t,l){var i=this.elements.node.find(t.selector),o=e("<div>"+e(l.target).val()+"</div>");i.length>0&&(o.find("script").remove(),i.html(o.html()))},_previewTextEditor:function(t,l,i){var o=this.elements.node.find(t.selector),s="undefined"!=typeof tinyMCE?tinyMCE.get(l):null,r=e("#"+l),n="";o.length>0&&(n=e(s&&"none"==r.css("display")?"<div>"+s.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+r.val()+"</div>":"<div>"+switchEditors.wpautop(r.val())+"</div>"),n.find("script").remove(),o.html(n.html()))},_addTextEditorCallback:function(t,l){var i=t.find("textarea.wp-editor-area").attr("id"),o=null;if("refresh"==l.type)o=e.proxy(this.delayPreview,this);else{if("text"!=l.type)return;o=e.proxy(this._previewTextEditor,this,l,i)}e("#"+i).on("keyup",o),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(i),editor.on("change",o),editor.on("keyup",o))},_initFieldFontPreview:function(t){var l=t.data("type"),i=t.data("preview");i.id=t.attr("id");var o=e.proxy(this._previewFont,this,i);"font"==l&&t.find(".fl-font-field").on("change","select",o)},_previewFont:function(t,l){var i=e(l.delegateTarget),o=i.find(".fl-font-field-font"),s=e(o).find(":selected"),r=s.parent().attr("label"),n=i.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==r&&this._buildFontStylesheet(a,o.val(),n.val()),"Default"==o.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",o.val()),this.updateCSSRule(d,"font-weight",n.val()))},_buildFontStylesheet:function(t,l,i){var o=FLBuilderConfig.googleFontsUrl,s="",r={},n={};r[l]=[i],FLBuilderPreview._fontsList[t]=r,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var l=t[e];n[e]=n[e]||[],l=l.filter(function(t){return n[e].indexOf(t)<0}),n[e]=n[e].concat(l)})}),e.each(n,function(e,t){s+=e+":"+t.join()+"|"}),s=o+s.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",s).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",s)},_initFieldCSSPreview:function(e){var t=e.data("preview"),l=null;if("undefined"!=typeof t.rules)for(l in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[l]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,l){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,l));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,l));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,l))}},_previewCSS:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=t.property,s="undefined"==typeof t.unit?"":t.unit,r=e(l.target),n=r.val();"%"==s?n=parseInt(n)/100:n+=s,r.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,o,n):this.updateCSSRule(i,o,n)},_previewColor:function(t,l){var i=this._getPreviewSelector(this.classes.node,t.selector),o=e(l.target),s=o.val(),r=""===s?"inherit":"#"+s;o.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(i,t