WordPress Page Builder – Beaver Builder - Version 1.3.8.1

Version Description

Download this release

Release Info

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

Code changes from version 1.3.7 to 1.3.8.1

changelog.txt CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>1.3.7</h4>
2
  <p><strong>Enhancements</strong></p>
3
  <ul>
1
+ <h4>1.3.8</h4>
2
+ <p><strong>Enhancements</strong></p>
3
+ <ul>
4
+ <li>Single photos can now be opened in a lightbox by choosing lightbox in the photo module's link settings.</li>
5
+ <li>Added the ability to define custom fields through actions. Developers should review the custom module docs and examples for detailed info on how that works.</li>
6
+ <li>Added the ability to duplicate rows.</li>
7
+ </ul>
8
+ <p><strong>Bug Fixes</strong></p>
9
+ <ul>
10
+ <li>Fixed a bug that made it so you could only have one text or code editor within a builder settings panel. Thanks to Nicholas Joannes for the fix!</li>
11
+ <li>Reworked the load order and definitions for the main builder JavaScript class to prevent issues with some minification plugins.</li>
12
+ <li>Fixed a bug with generating new builder node ids that was affecting templates in some cases.</li>
13
+ </ul>
14
+
15
  <h4>1.3.7</h4>
16
  <p><strong>Enhancements</strong></p>
17
  <ul>
classes/FLBuilder.php CHANGED
@@ -656,7 +656,7 @@ final class FLBuilder {
656
  for($i = 0; $i < count($values); $i++) {
657
  $value = $values[$i];
658
  echo '<tr class="fl-builder-field-multiple" data-field="'. $arr_name .'">';
659
- include FL_BUILDER_DIR . 'includes/fields.php';
660
  echo '<td class="fl-builder-field-actions">';
661
  echo '<i class="fl-builder-field-move fa fa-arrows"></i>';
662
  echo '<i class="fl-builder-field-copy fa fa-copy"></i>';
@@ -681,7 +681,7 @@ final class FLBuilder {
681
  }
682
  else {
683
  echo '<tr id="fl-field-'. $name .'" class="fl-field" data-type="' . $field['type'] . '" data-preview=\'' . $preview . '\'>';
684
- include FL_BUILDER_DIR . 'includes/fields.php';
685
  echo '</tr>';
686
  }
687
  }
@@ -1583,7 +1583,7 @@ final class FLBuilder {
1583
 
1584
  // Call the FLBuilder._renderLayoutComplete method if we're currently editing.
1585
  if(stristr($asset_info['js'], '-draft.js') || stristr($asset_info['js'], '-preview.js')) {
1586
- $js .= "; if(typeof FLBuilder !== 'undefined') FLBuilder._renderLayoutComplete();";
1587
  }
1588
 
1589
  // Include FLJSMin
656
  for($i = 0; $i < count($values); $i++) {
657
  $value = $values[$i];
658
  echo '<tr class="fl-builder-field-multiple" data-field="'. $arr_name .'">';
659
+ include FL_BUILDER_DIR . 'includes/field.php';
660
  echo '<td class="fl-builder-field-actions">';
661
  echo '<i class="fl-builder-field-move fa fa-arrows"></i>';
662
  echo '<i class="fl-builder-field-copy fa fa-copy"></i>';
681
  }
682
  else {
683
  echo '<tr id="fl-field-'. $name .'" class="fl-field" data-type="' . $field['type'] . '" data-preview=\'' . $preview . '\'>';
684
+ include FL_BUILDER_DIR . 'includes/field.php';
685
  echo '</tr>';
686
  }
687
  }
1583
 
1584
  // Call the FLBuilder._renderLayoutComplete method if we're currently editing.
1585
  if(stristr($asset_info['js'], '-draft.js') || stristr($asset_info['js'], '-preview.js')) {
1586
+ $js .= "; if(typeof FLBuilder !== 'undefined' && typeof FLBuilder._renderLayoutComplete !== 'undefined') FLBuilder._renderLayoutComplete();";
1587
  }
1588
 
1589
  // Include FLJSMin
classes/FLBuilderModel.php CHANGED
@@ -582,7 +582,7 @@ final class FLBuilderModel {
582
  $nodes[$map[$node_id]] = $node;
583
  $nodes[$map[$node_id]]->node = $map[$node_id];
584
 
585
- if(!empty($node->parent)) {
586
  $nodes[$map[$node_id]]->parent = $map[$node->parent];
587
  }
588
  }
@@ -935,6 +935,62 @@ final class FLBuilderModel {
935
  // Return the updated row.
936
  return self::get_node($row_node_id);
937
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
938
 
939
  /**
940
  * @method get_row_defaults
582
  $nodes[$map[$node_id]] = $node;
583
  $nodes[$map[$node_id]]->node = $map[$node_id];
584
 
585
+ if(!empty($node->parent) && isset($map[$node->parent])) {
586
  $nodes[$map[$node_id]]->parent = $map[$node->parent];
587
  }
588
  }
935
  // Return the updated row.
936
  return self::get_node($row_node_id);
937
  }
938
+
939
+ /**
940
+ * @method copy_row
941
+ */
942
+ static public function copy_row($node_id = null)
943
+ {
944
+ $post_data = self::get_post_data();
945
+ $node_id = isset($post_data['node_id']) ? $post_data['node_id'] : $node_id;
946
+ $layout_data = self::get_layout_data();
947
+ $row = self::get_node($node_id);
948
+ $new_row_id = self::generate_node_id();
949
+ $col_groups = self::get_child_nodes($node_id);
950
+ $new_nodes = array();
951
+
952
+ // Set the new row id.
953
+ $row->node = $new_row_id;
954
+
955
+ // Add the new row.
956
+ $layout_data[$new_row_id] = $row;
957
+
958
+ // Get the new child nodes.
959
+ foreach($col_groups as $col_group_id => $col_group) {
960
+
961
+ $new_nodes[$col_group_id] = $col_group;
962
+ $cols = self::get_child_nodes($col_group_id);
963
+
964
+ foreach($cols as $col_id => $col) {
965
+
966
+ $new_nodes[$col_id] = $col;
967
+ $modules = self::get_child_nodes($col_id);
968
+
969
+ foreach($modules as $module_id => $module) {
970
+ $new_nodes[$module_id] = $module;
971
+ }
972
+ }
973
+ }
974
+
975
+ // Generate new child ids.
976
+ $new_nodes = self::generate_new_node_ids($new_nodes);
977
+
978
+ // Set col group parent ids to the new row id.
979
+ foreach($new_nodes as $child_node_id => $child) {
980
+ if($child->type == 'column-group') {
981
+ $new_nodes[$child_node_id]->parent = $new_row_id;
982
+ }
983
+ }
984
+
985
+ // Merge the child data.
986
+ $layout_data = array_merge($layout_data, $new_nodes);
987
+
988
+ // Update the layout data.
989
+ self::update_layout_data($layout_data);
990
+
991
+ // Position the new row.
992
+ self::reorder_node($new_row_id, $row->position + 1);
993
+ }
994
 
995
  /**
996
  * @method get_row_defaults
fl-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: http://www.wpbeaverbuilder.com
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
- * Version: 1.3.7
7
  * Author: The Beaver Builder Team
8
  * Author URI: http://www.wpbeaverbuilder.com
9
  * Copyright: (c) 2014 Beaver Builder
@@ -11,7 +11,7 @@
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  * Text Domain: fl-builder
13
  */
14
- define('FL_BUILDER_VERSION', '1.3.7');
15
  define('FL_BUILDER_DIR', plugin_dir_path(__FILE__));
16
  define('FL_BUILDER_URL', plugins_url('/', __FILE__));
17
  define('FL_BUILDER_LITE', true);
@@ -97,7 +97,7 @@ add_action('admin_bar_menu', 'FLBuilder::admin
97
  add_filter('template_include', 'FLBuilder::render_template', 999);
98
  add_action('wp_footer', 'FLBuilder::include_jquery');
99
  add_action('wp_footer', 'FLBuilder::render_ui');
100
- add_action('wp_print_footer_scripts', 'FLBuilder::render_js_config');
101
 
102
  /* Filters */
103
  add_filter('body_class', 'FLBuilder::body_class');
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: http://www.wpbeaverbuilder.com
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
+ * Version: 1.3.8.1
7
  * Author: The Beaver Builder Team
8
  * Author URI: http://www.wpbeaverbuilder.com
9
  * Copyright: (c) 2014 Beaver Builder
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  * Text Domain: fl-builder
13
  */
14
+ define('FL_BUILDER_VERSION', '1.3.8.1');
15
  define('FL_BUILDER_DIR', plugin_dir_path(__FILE__));
16
  define('FL_BUILDER_URL', plugins_url('/', __FILE__));
17
  define('FL_BUILDER_LITE', true);
97
  add_filter('template_include', 'FLBuilder::render_template', 999);
98
  add_action('wp_footer', 'FLBuilder::include_jquery');
99
  add_action('wp_footer', 'FLBuilder::render_ui');
100
+ add_action('wp_footer', 'FLBuilder::render_js_config');
101
 
102
  /* Filters */
103
  add_filter('body_class', 'FLBuilder::body_class');
includes/field-code.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-code-field">
2
+ <?php $editor_id = 'flcode' . time() . '_' . $name; ?>
3
+ <textarea id="<?php echo $editor_id; ?>" name="<?php echo $name; ?>" data-editor="<?php echo $field['editor']; ?>" <?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['rows'])) echo ' rows="'. $field['rows'] .'"'; ?>><?php echo htmlspecialchars($value); ?></textarea>
4
+ <script>
5
+
6
+ jQuery(function(){
7
+
8
+ var textarea = jQuery('#<?php echo $editor_id; ?>'),
9
+ mode = textarea.data('editor'),
10
+ editDiv = jQuery('<div>', {
11
+ position: 'absolute',
12
+ height: parseInt(textarea.attr('rows'), 10) * 20
13
+ }),
14
+ editor = null;
15
+
16
+ editDiv.insertBefore(textarea);
17
+ textarea.css('display', 'none');
18
+
19
+ editor = ace.edit(editDiv[0]);
20
+ editor.getSession().setValue(textarea.val());
21
+ editor.getSession().setMode('ace/mode/' + mode);
22
+
23
+ editor.getSession().on('change', function(e) {
24
+ textarea.val(editor.getSession().getValue()).trigger('change');
25
+ });
26
+ });
27
+
28
+ </script>
29
+ </div>
includes/field-color.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div class="fl-color-picker<?php if(empty($value)) echo ' fl-color-picker-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
2
+ <div class="fl-color-picker-color fl-picker-<?php echo $name; ?>"></div>
3
+ <?php if(isset($field['show_reset']) && $field['show_reset']) : ?>
4
+ <div class="fl-color-picker-clear"></div>
5
+ <?php endif; ?>
6
+ <input name="<?php echo $name; ?>" type="hidden" value="<?php echo $value; ?>" class="fl-color-picker-value" />
7
+ </div>
includes/field-editor.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-editor-field" id="<?php echo $name; ?>">
2
+ <?php
3
+
4
+ // Remove 3rd party editor buttons.
5
+ remove_all_actions('media_buttons', 999999);
6
+ remove_all_actions('media_buttons_context', 999999);
7
+ remove_all_filters('mce_external_plugins', 999999);
8
+
9
+ global $wp_version;
10
+
11
+ $editor_id = 'flrich' . time() . '_' . $name;;
12
+
13
+ wp_editor($value, $editor_id, array(
14
+ 'media_buttons' => isset($field['media_buttons']) ? $field['media_buttons'] : true,
15
+ 'textarea_rows' => isset($field['rows']) ? $field['rows'] : 16,
16
+ 'wpautop' => true
17
+ ));
18
+
19
+ ?>
20
+ <script type="text/javascript">
21
+
22
+ <?php if(version_compare($wp_version, '3.8.9', '<=')) : // Pre 3.9 editor init. ?>
23
+ jQuery(function()
24
+ {
25
+ var editorId = '<?php echo $editor_id; ?>';
26
+
27
+ quicktags({id : editorId});
28
+ QTags._buttonsInit();
29
+
30
+ if(typeof tinymce != 'undefined') {
31
+ tinymce.execCommand('mceAddControl', true, editorId);
32
+ }
33
+
34
+ FLBuilder.initEditorField(editorId);
35
+ });
36
+ <?php else : // 3.9 and above editor init. ?>
37
+ jQuery(function()
38
+ {
39
+ var editorId = '<?php echo $editor_id; ?>',
40
+ hiddenEditor = tinyMCEPreInit.mceInit['flhiddeneditor'],
41
+ editorProps = null;
42
+
43
+ if(typeof tinymce != 'undefined') {
44
+ editorProps = tinymce.extend({}, hiddenEditor);
45
+ editorProps.selector = '#' + editorId;
46
+ editorProps.body_class = editorProps.body_class.replace('flhiddeneditor', editorId);
47
+ tinyMCEPreInit.mceInit[editorId] = editorProps;
48
+ tinymce.init(editorProps);
49
+ }
50
+ if(typeof quicktags != 'undefined') {
51
+ quicktags({id : editorId});
52
+ QTags._buttonsInit();
53
+ }
54
+
55
+ window.wpActiveEditor = editorId;
56
+ });
57
+ <?php endif; ?>
58
+
59
+ </script>
60
+ </div>
includes/field-form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-form-field fl-builder-custom-field"<?php if(isset($field['preview_text'])) echo ' data-preview-text="'. $field['preview_text'] .'"'; ?>>
2
+ <div class="fl-form-field-preview-text">
3
+ <?php
4
+
5
+ if(isset($field['preview_text']) && is_object($value)) {
6
+
7
+ if(stristr($value->$field['preview_text'], 'fa fa-')) {
8
+ echo '<i class="' . $value->$field['preview_text'] . '"></i>';
9
+ }
10
+ else if(isset($value->$field['preview_text']) && !empty($value->$field['preview_text'])) {
11
+ echo FLBuilderUtils::snippetwop(strip_tags(str_replace('&#39;', "'", $value->$field['preview_text'])), 35);
12
+ }
13
+ }
14
+
15
+ ?>
16
+ </div>
17
+ <a class="fl-form-field-edit" href="javascript:void(0);" onclick="return false;" data-type="<?php echo $field['form']; ?>"><?php _e('Edit', 'fl-builder'); echo ' ' . $field['label']; ?></a>
18
+ <input name="<?php echo $name; ?>" type="hidden" value='<?php echo str_replace("'", '&#39;', json_encode($value)); ?>' />
19
+ </div>
includes/field-icon.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-icon-field fl-builder-custom-field<?php if(empty($value)) echo ' fl-icon-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
2
+ <a class="fl-icon-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Icon', 'fl-builder'); ?></a>
3
+ <div class="fl-icon-preview">
4
+ <i class="<?php echo $value; ?>" data-icon="<?php echo $value; ?>"></i>
5
+ <a class="fl-icon-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace', 'fl-builder'); ?></a>
6
+ <?php if(isset($field['show_remove']) && $field['show_remove']) : ?>
7
+ <a class="fl-icon-remove" href="javascript:void(0);" onclick="return false;"><?php _e('Remove', 'fl-builder'); ?></a>
8
+ <?php endif; ?>
9
+ </div>
10
+ <input name="<?php echo $name; ?>" type="hidden" value="<?php echo $value; ?>" />
11
+ </div>
includes/field-layout.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-layout-field">
2
+ <?php foreach($field['options'] as $key => $img) : ?>
3
+ <div class="fl-layout-field-option <?php if($key == $value) echo 'fl-layout-field-option-selected'; ?>" data-value="<?php echo $key; ?>">
4
+ <img src="<?php echo $img; ?>" />
5
+ </div>
6
+ <?php endforeach; ?>
7
+ <div class="fl-clear"></div>
8
+ <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
9
+ </div>
includes/field-multiple-photos.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="fl-multiple-photos-field fl-builder-custom-field<?php if(empty($value)) echo ' fl-multiple-photos-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
2
+ <div class="fl-multiple-photos-count">
3
+ <?php
4
+
5
+ $count = is_array($value) ? count($value) : false;
6
+
7
+ if($count) {
8
+ if($count == 1) {
9
+ echo $count . __(' Photo Selected', 'fl-builder');
10
+ }
11
+ else {
12
+ echo $count . __(' Photos Selected', 'fl-builder');
13
+ }
14
+ }
15
+
16
+ ?>
17
+ </div>
18
+ <a class="fl-multiple-photos-select" href="javascript:void(0);" onclick="return false;"><?php _e('Create Gallery', 'fl-builder'); ?></a>
19
+ <a class="fl-multiple-photos-edit" href="javascript:void(0);" onclick="return false;"><?php _e('Edit Gallery', 'fl-builder'); ?></a>
20
+ <a class="fl-multiple-photos-add" href="javascript:void(0);" onclick="return false;"><?php _e('Add Photos', 'fl-builder'); ?></a>
21
+ <input name="<?php echo $name; ?>" type="hidden" value='<?php if(!empty($value)) echo json_encode($value); ?>' />
22
+ </div>
includes/field-photo-sizes.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <select name="<?php echo $name; ?>">
2
+ <?php
3
+
4
+ foreach(FLBuilderPhoto::sizes() as $size => $atts) :
5
+
6
+ $label = ucwords(str_replace(array('_', '-'), ' ', $size)) . ' (' . implode('x', $atts) . ')';
7
+
8
+ ?>
9
+ <option value="<?php echo $size; ?>" <?php selected($value, $size); ?>><?php echo $label; ?></option>
10
+ <?php endforeach; ?>
11
+ </select>
includes/field-photo.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $photo = FLBuilderPhoto::get_attachment_data($value); ?>
2
+ <div class="fl-photo-field fl-builder-custom-field<?php if(empty($value) || !$photo) echo ' fl-photo-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
3
+ <a class="fl-photo-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Photo', 'fl-builder'); ?></a>
4
+ <div class="fl-photo-preview">
5
+ <div class="fl-photo-preview-img">
6
+ <img src="<?php if($photo) echo FLBuilderPhoto::get_thumb($photo); ?>" />
7
+ </div>
8
+ <select name="<?php echo $name; ?>_src">
9
+ <?php if($photo && isset($settings->{$name . '_src'})) echo FLBuilderPhoto::get_src_options($settings->{$name . '_src'}, $photo); ?>
10
+ </select>
11
+ <br />
12
+ <a class="fl-photo-edit" href="javascript:void(0);" onclick="return false;"><?php _e('Edit', 'fl-builder'); ?></a>
13
+ <a class="fl-photo-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace', 'fl-builder'); ?></a>
14
+ <div class="fl-clear"></div>
15
+ </div>
16
+ <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
17
+ </div>
includes/field-post-type.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <select name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; ?>>
2
+ <?php foreach(FLBuilderLoop::post_types() as $slug => $type) : ?>
3
+ <option value="<?php echo $slug; ?>" <?php selected($value, $slug); ?>><?php echo $type->labels->name; ?></option>
4
+ <?php endforeach; ?>
5
+ </select>
includes/field-select.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <select name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['toggle'])) echo "data-toggle='". json_encode($field['toggle']) ."'"; if(isset($field['hide'])) echo "data-hide='". json_encode($field['hide']) ."'"; if(isset($field['trigger'])) echo "data-trigger='". json_encode($field['trigger']) ."'"; ?>>
2
+ <?php
3
+
4
+ foreach($field['options'] as $key => $val) :
5
+
6
+ $label = is_array($val) ? $val['label'] : $val;
7
+
8
+ if(is_array($val) && isset($val['premium']) && $val['premium'] && FL_BUILDER_LITE === true) {
9
+ continue;
10
+ }
11
+
12
+ ?>
13
+ <option value="<?php echo $key; ?>" <?php selected($value, $key); ?>><?php echo $label; ?></option>
14
+ <?php endforeach; ?>
15
+ </select>
includes/field-suggest.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $action = isset($field['action']) ? $field['action'] : '';
4
+ $data = isset($field['data']) ? $field['data'] : '';
5
+
6
+ ?>
7
+ <input type="text" name="<?php echo $name; ?>" data-value='<?php echo FLBuilderAutoSuggest::get_value($action, $value, $data); ?>' data-action="<?php echo $action; ?>" data-action-data="<?php echo $data; ?>" class="text text-full fl-suggest-field<?php if(isset($field['class'])) echo ' '. $field['class']; ?>" placeholder="<?php if(isset($field['placeholder'])) echo $field['placeholder']; else echo _e('Start typing...', 'fl-builder'); ?>" />
includes/field-text.php ADDED
@@ -0,0 +1 @@
 
1
+ <input type="text" name="<?php echo $name; ?>" value="<?php echo htmlspecialchars($value); ?>" class="text<?php if(isset($field['class'])) echo ' '. $field['class']; if(!isset($field['size'])) echo ' text-full'; ?>" <?php if(isset($field['placeholder'])) echo ' placeholder="'. $field['placeholder'] .'"'; if(isset($field['maxlength'])) echo ' maxlength="'. $field['maxlength'] .'"'; if(isset($field['size'])) echo ' size="'. $field['size'] .'"'; ?> />
includes/field-textarea.php ADDED
@@ -0,0 +1 @@
 
1
+ <textarea name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['placeholder'])) echo ' placeholder="'. $field['placeholder'] .'"'; if(isset($field['rows'])) echo ' rows="'. $field['rows'] .'"'; ?>><?php echo $value; ?></textarea>
includes/field-video.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $video = FLBuilderPhoto::get_attachment_data($value); ?>
2
+ <div class="fl-video-field fl-builder-custom-field<?php if(empty($value) || !$video) echo ' fl-video-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
3
+ <a class="fl-video-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Video', 'fl-builder'); ?></a>
4
+ <div class="fl-video-preview">
5
+ <?php if(!empty($value) && $video) : ?>
6
+ <div class="fl-video-preview-img">
7
+ <img src="<?php echo $video->icon; ?>" />
8
+ </div>
9
+ <span class="fl-video-preview-filename"><?php echo $video->filename; ?></span>
10
+ <?php else : ?>
11
+ <div class="fl-video-preview-img">
12
+ <img src="<?php echo FL_BUILDER_URL; ?>img/spacer.png" />
13
+ </div>
14
+ <span class="fl-video-preview-filename"></span>
15
+ <?php endif; ?>
16
+ <br />
17
+ <a class="fl-video-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace Video', 'fl-builder'); ?></a>
18
+ <div class="fl-clear"></div>
19
+ </div>
20
+ <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
21
+ </div>
includes/field.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if(empty($field['label'])) : ?>
2
+ <td colspan="2">
3
+ <?php else : ?>
4
+ <th>
5
+ <label for="<?php echo $name; ?>">
6
+ <?php
7
+
8
+ echo $field['label'];
9
+
10
+ if(isset($i)) {
11
+ echo ' <span>' . ($i + 1) . '</span>';
12
+ }
13
+
14
+ ?>
15
+ </label>
16
+ <?php if(isset($field['help'])) : ?>
17
+ <span class="fl-help-tooltip">
18
+ <i class="fl-help-tooltip-icon fa fa-question-circle"></i>
19
+ <span class="fl-help-tooltip-text"><?php echo $field['help']; ?></span>
20
+ </span>
21
+ <?php endif; ?>
22
+ </th>
23
+ <td>
24
+ <?php endif; ?>
25
+ <?php
26
+
27
+ $field_file = FL_BUILDER_DIR . 'includes/field-' . $field['type'] . '.php';
28
+
29
+ if(file_exists($field_file)) {
30
+ include $field_file;
31
+ }
32
+ else {
33
+ do_action('fl_builder_control_' . $field['type'], $name, $value, $field);
34
+ }
35
+
36
+ ?>
37
+ <?php if(isset($field['description'])) : ?>
38
+ <span class="fl-field-description"><?php echo $field['description']; ?></span>
39
+ <?php endif; ?>
40
+ </td>
includes/fields.php DELETED
@@ -1,310 +0,0 @@
1
- <?php if(empty($field['label'])) : ?>
2
- <td colspan="2">
3
- <?php else : ?>
4
- <th>
5
- <label for="<?php echo $name; ?>">
6
- <?php
7
-
8
- echo $field['label'];
9
-
10
- if(isset($i)) {
11
- echo ' <span>' . ($i + 1) . '</span>';
12
- }
13
-
14
- ?>
15
- </label>
16
- <?php if(isset($field['help'])) : ?>
17
- <span class="fl-help-tooltip">
18
- <i class="fl-help-tooltip-icon fa fa-question-circle"></i>
19
- <span class="fl-help-tooltip-text"><?php echo $field['help']; ?></span>
20
- </span>
21
- <?php endif; ?>
22
- </th>
23
- <td>
24
- <?php endif; ?>
25
-
26
- <?php if($field['type'] == 'text') : // TEXT ?>
27
- <input type="text" name="<?php echo $name; ?>" value="<?php echo htmlspecialchars($value); ?>" class="text<?php if(isset($field['class'])) echo ' '. $field['class']; if(!isset($field['size'])) echo ' text-full'; ?>" <?php if(isset($field['placeholder'])) echo ' placeholder="'. $field['placeholder'] .'"'; if(isset($field['maxlength'])) echo ' maxlength="'. $field['maxlength'] .'"'; if(isset($field['size'])) echo ' size="'. $field['size'] .'"'; ?> />
28
- <?php endif; ?>
29
-
30
- <?php if($field['type'] == 'textarea') : // TEXTAREA ?>
31
- <textarea name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['placeholder'])) echo ' placeholder="'. $field['placeholder'] .'"'; if(isset($field['rows'])) echo ' rows="'. $field['rows'] .'"'; ?>><?php echo $value; ?></textarea>
32
- <?php endif; ?>
33
-
34
- <?php if($field['type'] == 'select') : // SELECT ?>
35
- <select name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['toggle'])) echo "data-toggle='". json_encode($field['toggle']) ."'"; if(isset($field['hide'])) echo "data-hide='". json_encode($field['hide']) ."'"; if(isset($field['trigger'])) echo "data-trigger='". json_encode($field['trigger']) ."'"; ?>>
36
- <?php
37
-
38
- foreach($field['options'] as $key => $val) :
39
-
40
- $label = is_array($val) ? $val['label'] : $val;
41
-
42
- if(is_array($val) && isset($val['premium']) && $val['premium'] && FL_BUILDER_LITE === true) {
43
- continue;
44
- }
45
-
46
- ?>
47
- <option value="<?php echo $key; ?>" <?php selected($value, $key); ?>><?php echo $label; ?></option>
48
- <?php endforeach; ?>
49
- </select>
50
- <?php endif; ?>
51
-
52
- <?php if($field['type'] == 'color') : // COLOR ?>
53
- <div class="fl-color-picker<?php if(empty($value)) echo ' fl-color-picker-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
54
- <div class="fl-color-picker-color fl-picker-<?php echo $name; ?>"></div>
55
- <?php if(isset($field['show_reset']) && $field['show_reset']) : ?>
56
- <div class="fl-color-picker-clear"></div>
57
- <?php endif; ?>
58
- <input name="<?php echo $name; ?>" type="hidden" value="<?php echo $value; ?>" class="fl-color-picker-value" />
59
- </div>
60
- <?php endif; ?>
61
-
62
- <?php if($field['type'] == 'photo') : // PHOTO ?>
63
- <?php $photo = FLBuilderPhoto::get_attachment_data($value); ?>
64
- <div class="fl-photo-field fl-builder-custom-field<?php if(empty($value) || !$photo) echo ' fl-photo-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
65
- <a class="fl-photo-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Photo', 'fl-builder'); ?></a>
66
- <div class="fl-photo-preview">
67
- <div class="fl-photo-preview-img">
68
- <img src="<?php if($photo) echo FLBuilderPhoto::get_thumb($photo); ?>" />
69
- </div>
70
- <select name="<?php echo $name; ?>_src">
71
- <?php if($photo && isset($settings->{$name . '_src'})) echo FLBuilderPhoto::get_src_options($settings->{$name . '_src'}, $photo); ?>
72
- </select>
73
- <br />
74
- <a class="fl-photo-edit" href="javascript:void(0);" onclick="return false;"><?php _e('Edit', 'fl-builder'); ?></a>
75
- <a class="fl-photo-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace', 'fl-builder'); ?></a>
76
- <div class="fl-clear"></div>
77
- </div>
78
- <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
79
- </div>
80
- <?php endif; ?>
81
-
82
- <?php if($field['type'] == 'multiple-photos') : // MULTIPLE PHOTOS ?>
83
- <div class="fl-multiple-photos-field fl-builder-custom-field<?php if(empty($value)) echo ' fl-multiple-photos-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
84
- <div class="fl-multiple-photos-count">
85
- <?php
86
-
87
- $count = is_array($value) ? count($value) : false;
88
-
89
- if($count) {
90
- if($count == 1) {
91
- echo $count . __(' Photo Selected', 'fl-builder');
92
- }
93
- else {
94
- echo $count . __(' Photos Selected', 'fl-builder');
95
- }
96
- }
97
-
98
- ?>
99
- </div>
100
- <a class="fl-multiple-photos-select" href="javascript:void(0);" onclick="return false;"><?php _e('Create Gallery', 'fl-builder'); ?></a>
101
- <a class="fl-multiple-photos-edit" href="javascript:void(0);" onclick="return false;"><?php _e('Edit Gallery', 'fl-builder'); ?></a>
102
- <a class="fl-multiple-photos-add" href="javascript:void(0);" onclick="return false;"><?php _e('Add Photos', 'fl-builder'); ?></a>
103
- <input name="<?php echo $name; ?>" type="hidden" value='<?php if(!empty($value)) echo json_encode($value); ?>' />
104
- </div>
105
- <?php endif; ?>
106
-
107
- <?php if($field['type'] == 'photo-sizes') : // PHOTO SIZES ?>
108
- <select name="<?php echo $name; ?>">
109
- <?php
110
-
111
- foreach(FLBuilderPhoto::sizes() as $size => $atts) :
112
-
113
- $label = ucwords(str_replace(array('_', '-'), ' ', $size)) . ' (' . implode('x', $atts) . ')';
114
-
115
- ?>
116
- <option value="<?php echo $size; ?>" <?php selected($value, $size); ?>><?php echo $label; ?></option>
117
- <?php endforeach; ?>
118
- </select>
119
- <?php endif; ?>
120
-
121
- <?php if($field['type'] == 'video') : // VIDEO ?>
122
- <?php $video = FLBuilderPhoto::get_attachment_data($value); ?>
123
- <div class="fl-video-field fl-builder-custom-field<?php if(empty($value) || !$video) echo ' fl-video-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
124
- <a class="fl-video-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Video', 'fl-builder'); ?></a>
125
- <div class="fl-video-preview">
126
- <?php if(!empty($value) && $video) : ?>
127
- <div class="fl-video-preview-img">
128
- <img src="<?php echo $video->icon; ?>" />
129
- </div>
130
- <span class="fl-video-preview-filename"><?php echo $video->filename; ?></span>
131
- <?php else : ?>
132
- <div class="fl-video-preview-img">
133
- <img src="<?php echo FL_BUILDER_URL; ?>img/spacer.png" />
134
- </div>
135
- <span class="fl-video-preview-filename"></span>
136
- <?php endif; ?>
137
- <br />
138
- <a class="fl-video-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace Video', 'fl-builder'); ?></a>
139
- <div class="fl-clear"></div>
140
- </div>
141
- <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
142
- </div>
143
- <?php endif; ?>
144
-
145
- <?php if($field['type'] == 'icon') : // ICON ?>
146
- <div class="fl-icon-field fl-builder-custom-field<?php if(empty($value)) echo ' fl-icon-empty'; if(isset($field['class'])) echo ' ' . $field['class']; ?>">
147
- <a class="fl-icon-select" href="javascript:void(0);" onclick="return false;"><?php _e('Select Icon', 'fl-builder'); ?></a>
148
- <div class="fl-icon-preview">
149
- <i class="<?php echo $value; ?>" data-icon="<?php echo $value; ?>"></i>
150
- <a class="fl-icon-replace" href="javascript:void(0);" onclick="return false;"><?php _e('Replace', 'fl-builder'); ?></a>
151
- <?php if(isset($field['show_remove']) && $field['show_remove']) : ?>
152
- <a class="fl-icon-remove" href="javascript:void(0);" onclick="return false;"><?php _e('Remove', 'fl-builder'); ?></a>
153
- <?php endif; ?>
154
- </div>
155
- <input name="<?php echo $name; ?>" type="hidden" value="<?php echo $value; ?>" />
156
- </div>
157
- <?php endif; ?>
158
-
159
- <?php if($field['type'] == 'form') : // SETTINGS FORM ?>
160
- <div class="fl-form-field fl-builder-custom-field"<?php if(isset($field['preview_text'])) echo ' data-preview-text="'. $field['preview_text'] .'"'; ?>>
161
- <div class="fl-form-field-preview-text">
162
- <?php
163
-
164
- if(isset($field['preview_text']) && is_object($value)) {
165
-
166
- if(stristr($value->$field['preview_text'], 'fa fa-')) {
167
- echo '<i class="' . $value->$field['preview_text'] . '"></i>';
168
- }
169
- else if(isset($value->$field['preview_text']) && !empty($value->$field['preview_text'])) {
170
- echo FLBuilderUtils::snippetwop(strip_tags(str_replace('&#39;', "'", $value->$field['preview_text'])), 35);
171
- }
172
- }
173
-
174
- ?>
175
- </div>
176
- <a class="fl-form-field-edit" href="javascript:void(0);" onclick="return false;" data-type="<?php echo $field['form']; ?>"><?php _e('Edit', 'fl-builder'); echo ' ' . $field['label']; ?></a>
177
- <input name="<?php echo $name; ?>" type="hidden" value='<?php echo str_replace("'", '&#39;', json_encode($value)); ?>' />
178
- </div>
179
- <?php endif; ?>
180
-
181
- <?php if($field['type'] == 'editor') : // EDITOR ?>
182
- <div class="fl-editor-field" id="<?php echo $name; ?>">
183
- <?php
184
-
185
- // Remove 3rd party editor buttons.
186
- remove_all_actions('media_buttons', 999999);
187
- remove_all_actions('media_buttons_context', 999999);
188
- remove_all_filters('mce_external_plugins', 999999);
189
-
190
- global $wp_version;
191
-
192
- $editor_id = 'flrich' . time();
193
-
194
- wp_editor($value, $editor_id, array(
195
- 'media_buttons' => isset($field['media_buttons']) ? $field['media_buttons'] : true,
196
- 'textarea_rows' => isset($field['rows']) ? $field['rows'] : 16,
197
- 'wpautop' => true
198
- ));
199
-
200
- ?>
201
- <script type="text/javascript">
202
-
203
- <?php if(version_compare($wp_version, '3.8.9', '<=')) : // Pre 3.9 editor init. ?>
204
- jQuery(function()
205
- {
206
- var editorId = '<?php echo $editor_id; ?>';
207
-
208
- quicktags({id : editorId});
209
- QTags._buttonsInit();
210
-
211
- if(typeof tinymce != 'undefined') {
212
- tinymce.execCommand('mceAddControl', true, editorId);
213
- }
214
-
215
- FLBuilder.initEditorField(editorId);
216
- });
217
- <?php else : // 3.9 and above editor init. ?>
218
- jQuery(function()
219
- {
220
- var editorId = '<?php echo $editor_id; ?>',
221
- hiddenEditor = tinyMCEPreInit.mceInit['flhiddeneditor'],
222
- editorProps = null;
223
-
224
- if(typeof tinymce != 'undefined') {
225
- editorProps = tinymce.extend({}, hiddenEditor);
226
- editorProps.selector = '#' + editorId;
227
- editorProps.body_class = editorProps.body_class.replace('flhiddeneditor', editorId);
228
- tinyMCEPreInit.mceInit[editorId] = editorProps;
229
- tinymce.init(editorProps);
230
- }
231
- if(typeof quicktags != 'undefined') {
232
- quicktags({id : editorId});
233
- QTags._buttonsInit();
234
- }
235
-
236
- window.wpActiveEditor = editorId;
237
- });
238
- <?php endif; ?>
239
-
240
- </script>
241
- </div>
242
- <?php endif; ?>
243
-
244
- <?php if($field['type'] == 'code') : // CODE ?>
245
- <div class="fl-code-field">
246
- <?php $editor_id = 'flcode' . time(); ?>
247
- <textarea id="<?php echo $editor_id; ?>" name="<?php echo $name; ?>" data-editor="<?php echo $field['editor']; ?>" <?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; if(isset($field['rows'])) echo ' rows="'. $field['rows'] .'"'; ?>><?php echo htmlspecialchars($value); ?></textarea>
248
- <script>
249
-
250
- jQuery(function(){
251
-
252
- var textarea = jQuery('#<?php echo $editor_id; ?>'),
253
- mode = textarea.data('editor'),
254
- editDiv = jQuery('<div>', {
255
- position: 'absolute',
256
- height: parseInt(textarea.attr('rows'), 10) * 20
257
- }),
258
- editor = null;
259
-
260
- editDiv.insertBefore(textarea);
261
- textarea.css('display', 'none');
262
-
263
- editor = ace.edit(editDiv[0]);
264
- editor.getSession().setValue(textarea.val());
265
- editor.getSession().setMode('ace/mode/' + mode);
266
-
267
- editor.getSession().on('change', function(e) {
268
- textarea.val(editor.getSession().getValue()).trigger('change');
269
- });
270
- });
271
-
272
- </script>
273
- </div>
274
- <?php endif; ?>
275
-
276
- <?php if($field['type'] == 'post-type') : // POST TYPE ?>
277
- <select name="<?php echo $name; ?>"<?php if(isset($field['class'])) echo ' class="'. $field['class'] .'"'; ?>>
278
- <?php foreach(FLBuilderLoop::post_types() as $slug => $type) : ?>
279
- <option value="<?php echo $slug; ?>" <?php selected($value, $slug); ?>><?php echo $type->labels->name; ?></option>
280
- <?php endforeach; ?>
281
- </select>
282
- <?php endif; ?>
283
-
284
- <?php
285
-
286
- if($field['type'] == 'suggest') : // SUGGEST
287
-
288
- $action = isset($field['action']) ? $field['action'] : '';
289
- $data = isset($field['data']) ? $field['data'] : '';
290
- ?>
291
- <input type="text" name="<?php echo $name; ?>" data-value='<?php echo FLBuilderAutoSuggest::get_value($action, $value, $data); ?>' data-action="<?php echo $action; ?>" data-action-data="<?php echo $data; ?>" class="text text-full fl-suggest-field<?php if(isset($field['class'])) echo ' '. $field['class']; ?>" placeholder="<?php if(isset($field['placeholder'])) echo $field['placeholder']; else echo _e('Start typing...', 'fl-builder'); ?>" />
292
- <?php endif; ?>
293
-
294
- <?php if($field['type'] == 'layout') : // LAYOUT - Experimental, do not use! ?>
295
- <div class="fl-layout-field">
296
- <?php foreach($field['options'] as $key => $img) : ?>
297
- <div class="fl-layout-field-option <?php if($key == $value) echo 'fl-layout-field-option-selected'; ?>" data-value="<?php echo $key; ?>">
298
- <img src="<?php echo $img; ?>" />
299
- </div>
300
- <?php endforeach; ?>
301
- <div class="fl-clear"></div>
302
- <input name="<?php echo $name; ?>" type="hidden" value='<?php echo $value; ?>' />
303
- </div>
304
- <?php endif; ?>
305
-
306
- <?php if(isset($field['description'])) : ?>
307
- <span class="fl-field-description"><?php echo $field['description']; ?></span>
308
- <?php endif; ?>
309
-
310
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js-config.php CHANGED
@@ -1,6 +1,6 @@
1
  <script>
2
 
3
- FLBuilder.config = {
4
  ajaxUrl: '<?php wp_reset_query(); global $post; echo get_permalink($post->ID); ?>',
5
  lite: <?php if(FL_BUILDER_LITE === true) echo 'true'; else echo 'false'; ?>,
6
  homeUrl: '<?php echo home_url(); ?>',
@@ -9,7 +9,7 @@ FLBuilder.config = {
9
  enabledTemplates: '<?php echo FLBuilderModel::get_enabled_templates(); ?>'
10
  };
11
 
12
- FLBuilder.strings = {
13
  actionsLightboxTitle: '<?php _e('What would you like to do?', 'fl-builder'); ?>',
14
  cancel: '<?php _e('Cancel', 'fl-builder'); ?>',
15
  changeTemplate: '<?php _e('Change Template', 'fl-builder'); ?>',
1
  <script>
2
 
3
+ var FLBuilderConfig = {
4
  ajaxUrl: '<?php wp_reset_query(); global $post; echo get_permalink($post->ID); ?>',
5
  lite: <?php if(FL_BUILDER_LITE === true) echo 'true'; else echo 'false'; ?>,
6
  homeUrl: '<?php echo home_url(); ?>',
9
  enabledTemplates: '<?php echo FLBuilderModel::get_enabled_templates(); ?>'
10
  };
11
 
12
+ var FLBuilderStrings = {
13
  actionsLightboxTitle: '<?php _e('What would you like to do?', 'fl-builder'); ?>',
14
  cancel: '<?php _e('Cancel', 'fl-builder'); ?>',
15
  changeTemplate: '<?php _e('Change Template', 'fl-builder'); ?>',
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.3.7',
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.3.8',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin'
9
  ));
js/fl-builder-admin-posts.js CHANGED
@@ -2,10 +2,6 @@ var FLBuilderAdminPosts;
2
 
3
  (function($){
4
 
5
- $(function(){
6
- FLBuilderAdminPosts._init();
7
- });
8
-
9
  /**
10
  * @class FLBuilderAdminPosts
11
  * @static
@@ -164,4 +160,8 @@ var FLBuilderAdminPosts;
164
  }
165
  };
166
 
 
 
 
 
167
  })(jQuery);
2
 
3
  (function($){
4
 
 
 
 
 
5
  /**
6
  * @class FLBuilderAdminPosts
7
  * @static
160
  }
161
  };
162
 
163
+ $(function(){
164
+ FLBuilderAdminPosts._init();
165
+ });
166
+
167
  })(jQuery);
js/fl-builder-admin-settings.js CHANGED
@@ -1,9 +1,5 @@
1
  (function($){
2
 
3
- $(function(){
4
- FLBuilderAdminSettings.init();
5
- });
6
-
7
  /**
8
  * @class FLBuilderAdminSettings
9
  */
@@ -160,4 +156,8 @@
160
  }
161
  };
162
 
 
 
 
 
163
  })(jQuery);
1
  (function($){
2
 
 
 
 
 
3
  /**
4
  * @class FLBuilderAdminSettings
5
  */
156
  }
157
  };
158
 
159
+ $(function(){
160
+ FLBuilderAdminSettings.init();
161
+ });
162
+
163
  })(jQuery);
js/fl-builder.js CHANGED
@@ -2,11 +2,9 @@ var FLBuilder;
2
 
3
  (function($){
4
 
5
- $(function(){
6
- FLBuilder._init();
7
- });
8
-
9
  /**
 
 
10
  * @class FLBuilder
11
  * @static
12
  */
@@ -41,6 +39,12 @@ var FLBuilder;
41
  */
42
  _dragging : false,
43
 
 
 
 
 
 
 
44
  /**
45
  * @param _lightbox
46
  * @private
@@ -291,6 +295,7 @@ var FLBuilder;
291
  {
292
  /* Links */
293
  $('a').on('click', FLBuilder._linkClicked);
 
294
 
295
  /* Heartbeat */
296
  $(document).on('heartbeat-tick', FLBuilder._lockPost);
@@ -341,6 +346,7 @@ var FLBuilder;
341
 
342
  /* Rows */
343
  $('body').delegate('.fl-row-overlay .fl-block-remove', 'click', FLBuilder._deleteRowClicked);
 
344
  $('body').delegate('.fl-row-overlay .fl-block-settings', 'click', FLBuilder._rowSettingsClicked);
345
  $('body').delegate('.fl-row-overlay .fl-block-move', 'mousedown', FLBuilder._blockDragInit);
346
  $('body').delegate('.fl-builder-row-settings .fl-builder-settings-save', 'click', FLBuilder._saveSettings);
@@ -445,6 +451,21 @@ var FLBuilder;
445
  e.preventDefault();
446
  },
447
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  /**
449
  * @method _warnBeforeUnload
450
  * @private
@@ -456,7 +477,7 @@ var FLBuilder;
456
  moduleSettings = $('.fl-builder-module-settings').length > 0;
457
 
458
  if(rowSettings || colSettings || moduleSettings) {
459
- return FLBuilder.strings.unloadWarning;
460
  }
461
  },
462
 
@@ -511,34 +532,34 @@ var FLBuilder;
511
  _toolsClicked: function()
512
  {
513
  var buttons = {},
514
- lite = FLBuilder.config.lite,
515
- postType = FLBuilder.config.postType,
516
- enabledTemplates = FLBuilder.config.enabledTemplates;
517
 
518
  // Duplicate button
519
  if(postType == 'fl-builder-template') {
520
- buttons['duplicate-page'] = FLBuilder.strings.duplicateTemplate;
521
  }
522
  else {
523
- buttons['duplicate-page'] = FLBuilder.strings.duplicatePage;
524
  }
525
 
526
  // Template buttons
527
  if(!lite && postType != 'fl-builder-template' && (enabledTemplates == 'user' || enabledTemplates == 'enabled')) {
528
 
529
- buttons['save-user-template'] = FLBuilder.strings.saveTemplate;
530
 
531
  if(FLBuilder._templateSettingsEnabled) {
532
- buttons['save-template'] = FLBuilder.strings.saveCoreTemplate;
533
  }
534
  }
535
 
536
  // Global settings button
537
- buttons['global-settings'] = FLBuilder.strings.editGlobalSettings;
538
 
539
  FLBuilder._showActionsLightbox({
540
  'className' : 'fl-builder-tools-actions',
541
- 'title' : FLBuilder.strings.actionsLightboxTitle,
542
  'buttons' : buttons
543
  });
544
  },
@@ -551,11 +572,11 @@ var FLBuilder;
551
  {
552
  FLBuilder._showActionsLightbox({
553
  'className': 'fl-builder-save-actions',
554
- 'title': FLBuilder.strings.actionsLightboxTitle,
555
  'buttons': {
556
- 'publish': FLBuilder.strings.publish,
557
- 'draft': FLBuilder.strings.draft,
558
- 'discard': FLBuilder.strings.discard
559
  }
560
  });
561
  },
@@ -586,7 +607,7 @@ var FLBuilder;
586
  */
587
  _blockUpgradeClicked: function()
588
  {
589
- window.open(FLBuilder.config.upgradeUrl);
590
  },
591
 
592
  /* Save Actions
@@ -626,7 +647,7 @@ var FLBuilder;
626
  */
627
  _discardButtonClicked: function()
628
  {
629
- var result = confirm(FLBuilder.strings.discardMessage);
630
 
631
  if(result) {
632
 
@@ -648,6 +669,7 @@ var FLBuilder;
648
  */
649
  _cancelButtonClicked: function()
650
  {
 
651
  FLBuilder._actionsLightbox.close();
652
  },
653
 
@@ -657,7 +679,9 @@ var FLBuilder;
657
  */
658
  _exit: function()
659
  {
660
- window.location.href = window.location.href.replace('fl_builder', '');
 
 
661
  },
662
 
663
  /* Tools Actions
@@ -811,7 +835,7 @@ var FLBuilder;
811
  */
812
  _showTemplateSelector: function()
813
  {
814
- if(!FLBuilder.config.lite) {
815
 
816
  FLBuilder._showLightbox(false);
817
 
@@ -846,7 +870,7 @@ var FLBuilder;
846
  if($('.fl-builder-content').children('.fl-row').length > 0) {
847
 
848
  if(index == 0) {
849
- if(confirm(FLBuilder.strings.changeTemplateMessage)) {
850
  FLBuilder._lightbox._node.hide();
851
  FLBuilder._applyTemplate(0, false, 'core');
852
  }
@@ -874,7 +898,7 @@ var FLBuilder;
874
  if($('.fl-builder-content').children('.fl-row').length > 0) {
875
 
876
  if(id == 'blank') {
877
- if(confirm(FLBuilder.strings.changeTemplateMessage)) {
878
  FLBuilder._lightbox._node.hide();
879
  FLBuilder._applyTemplate('blank', false, 'user');
880
  }
@@ -911,7 +935,7 @@ var FLBuilder;
911
  {
912
  var template = $(this).closest('.fl-user-template');
913
 
914
- if(confirm(FLBuilder.strings.deleteTemplate)) {
915
 
916
  FLBuilder.ajax({
917
  action: 'fl_builder_update',
@@ -940,10 +964,10 @@ var FLBuilder;
940
  {
941
  FLBuilder._showActionsLightbox({
942
  'className': 'fl-builder-template-actions',
943
- 'title': FLBuilder.strings.actionsLightboxTitle,
944
  'buttons': {
945
- 'template-replace': FLBuilder.strings.templateReplace,
946
- 'template-append': FLBuilder.strings.templateAppend
947
  }
948
  });
949
  },
@@ -954,7 +978,7 @@ var FLBuilder;
954
  */
955
  _templateReplaceClicked: function()
956
  {
957
- if(confirm(FLBuilder.strings.changeTemplateMessage)) {
958
  FLBuilder._actionsLightbox.close();
959
  FLBuilder._applyTemplate(FLBuilder._selectedTemplateId, false, FLBuilder._selectedTemplateType);
960
  }
@@ -1059,7 +1083,7 @@ var FLBuilder;
1059
  */
1060
  _saveUserTemplateSettingsComplete: function()
1061
  {
1062
- FLBuilder._alert(FLBuilder.strings.templateSaved);
1063
  },
1064
 
1065
  /* Template Settings
@@ -1092,7 +1116,7 @@ var FLBuilder;
1092
 
1093
  if(content.children('.fl-row').length === 0) {
1094
  content.addClass('fl-builder-empty');
1095
- content.append('<span class="fl-builder-empty-message">'+ FLBuilder.strings.emptyMessage +'</span>');
1096
  FLBuilder._initSortables();
1097
  }
1098
  },
@@ -1347,7 +1371,7 @@ var FLBuilder;
1347
  }
1348
 
1349
  var parent = ui.placeholder.parent(),
1350
- title = FLBuilder.strings.insert;
1351
 
1352
  if(parent.hasClass('fl-col-content')) {
1353
  if(ui.item.hasClass('fl-builder-block-module')) {
@@ -1362,7 +1386,7 @@ var FLBuilder;
1362
  title = ui.item.text();
1363
  }
1364
  else {
1365
- title = FLBuilder.strings.newColumn;
1366
  }
1367
  }
1368
  else if(parent.hasClass('fl-builder-content')) {
@@ -1370,10 +1394,10 @@ var FLBuilder;
1370
  title = ui.item.text();
1371
  }
1372
  else if(ui.item.hasClass('fl-row')) {
1373
- title = FLBuilder.strings.row;
1374
  }
1375
  else {
1376
- title = FLBuilder.strings.newRow;
1377
  }
1378
  }
1379
 
@@ -1476,7 +1500,7 @@ var FLBuilder;
1476
 
1477
  if(!row.hasClass('fl-block-overlay-active')) {
1478
  row.addClass('fl-block-overlay-active');
1479
- row.append('<div class="fl-row-overlay fl-block-overlay" data-node="'+ row.attr('data-node') +'"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ FLBuilder.strings.row +'</div><i class="fl-block-move fa fa-arrows fl-tip" title="' + FLBuilder.strings.move + '"></i><i class="fl-block-settings fa fa-wrench fl-tip" title="' + FLBuilder.strings.rowSettings + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilder.strings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1480
  FLBuilder._initTipTips();
1481
  }
1482
  },
@@ -1635,7 +1659,7 @@ var FLBuilder;
1635
  FLBuilder._deleteRow(row);
1636
  }
1637
  else {
1638
- result = confirm(FLBuilder.strings.deleteRowMessage);
1639
 
1640
  if(result) {
1641
  FLBuilder._deleteRow(row);
@@ -1664,6 +1688,27 @@ var FLBuilder;
1664
  FLBuilder._removeRowOverlays();
1665
  },
1666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1667
  /**
1668
  * @method _rowSettingsClicked
1669
  * @private
@@ -1708,7 +1753,7 @@ var FLBuilder;
1708
  }
1709
  if(!col.hasClass('fl-block-overlay-active')) {
1710
  col.addClass('fl-block-overlay-active');
1711
- col.append('<div class="fl-col-overlay fl-block-overlay"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ FLBuilder.strings.column +'</div><i class="fl-block-settings fa fa-wrench fl-tip" title="' + FLBuilder.strings.columnSettings + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilder.strings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1712
  FLBuilder._initTipTips();
1713
  }
1714
 
@@ -1898,7 +1943,7 @@ var FLBuilder;
1898
  }
1899
 
1900
  module.addClass('fl-block-overlay-active');
1901
- module.append('<div class="fl-module-overlay fl-block-overlay"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ moduleName +'</div><i class="fl-block-move fa fa-arrows fl-tip" title="' + FLBuilder.strings.move + '"></i><i class="fl-block-settings fa fa-wrench fl-tip" title="' + moduleName + ' ' + FLBuilder.strings.settings + '"></i><i class="fl-block-copy fa fa-copy fl-tip" title="' + FLBuilder.strings.duplicate + '"></i><i class="fl-block-columns fa fa-columns fl-tip" title="' + FLBuilder.strings.columnSettings + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilder.strings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1902
  FLBuilder._initTipTips();
1903
  }
1904
 
@@ -2038,7 +2083,7 @@ var FLBuilder;
2038
  _deleteModuleClicked: function(e)
2039
  {
2040
  var module = $(this).closest('.fl-module'),
2041
- result = confirm(FLBuilder.strings.deleteModuleMessage);
2042
 
2043
  if(result) {
2044
  FLBuilder._deleteModule(module);
@@ -2534,7 +2579,7 @@ var FLBuilder;
2534
  keyDelay : 1000,
2535
  fadeOut : false,
2536
  usePlaceholder : true,
2537
- emptyText : FLBuilder.strings.noResultsFound,
2538
  showResultListWhenNoMatch : true,
2539
  preFill : field.data('value'),
2540
  queryParam : 'fl_as_query',
@@ -2634,7 +2679,7 @@ var FLBuilder;
2634
  {
2635
  var row = $(this).closest('tr'),
2636
  parent = row.parent(),
2637
- result = confirm(FLBuilder.strings.deleteFieldMessage);
2638
 
2639
  if(result) {
2640
  row.remove();
@@ -2824,8 +2869,8 @@ var FLBuilder;
2824
  {
2825
  if(FLBuilder._singlePhotoSelector === null) {
2826
  FLBuilder._singlePhotoSelector = wp.media({
2827
- title: FLBuilder.strings.selectPhoto,
2828
- button: { text: FLBuilder.strings.selectPhoto },
2829
  library : { type : 'image' },
2830
  multiple: false
2831
  });
@@ -2917,10 +2962,10 @@ var FLBuilder;
2917
  size = null,
2918
  selected = null,
2919
  titles = {
2920
- full : FLBuilder.strings.fullSize,
2921
- large : FLBuilder.strings.large,
2922
- medium : FLBuilder.strings.medium,
2923
- thumbnail : FLBuilder.strings.thumbnail
2924
  };
2925
 
2926
  for(size in photo.sizes) {
@@ -3007,10 +3052,10 @@ var FLBuilder;
3007
  }
3008
 
3009
  if(photos.length == 1) {
3010
- count.html('1 ' + FLBuilder.strings.photoSelected);
3011
  }
3012
  else {
3013
- count.html(photos.length + ' ' + FLBuilder.strings.photosSelected);
3014
  }
3015
 
3016
  wrap.removeClass('fl-multiple-photos-empty');
@@ -3030,8 +3075,8 @@ var FLBuilder;
3030
  if(FLBuilder._singleVideoSelector === null) {
3031
 
3032
  FLBuilder._singleVideoSelector = wp.media({
3033
- title: FLBuilder.strings.selectVideo,
3034
- button: { text: FLBuilder.strings.selectVideo },
3035
  library : { type : 'video' },
3036
  multiple: false
3037
  });
@@ -3306,7 +3351,7 @@ var FLBuilder;
3306
  ----------------------------------------------------------*/
3307
 
3308
  /**
3309
- * Used to init pre WP 3.9 editors from fields.php.
3310
  *
3311
  * @method initEditorField
3312
  */
@@ -3435,7 +3480,7 @@ var FLBuilder;
3435
  */
3436
  _ajaxUrl: function(params)
3437
  {
3438
- var url = FLBuilder.config.ajaxUrl,
3439
  param = null;
3440
 
3441
  if(typeof params !== 'undefined') {
@@ -3518,7 +3563,7 @@ var FLBuilder;
3518
  buttons += '<span class="fl-builder-'+ i +'-button fl-builder-button fl-builder-button-large">'+ settings.buttons[i] +'</span>';
3519
  }
3520
 
3521
- FLBuilder._actionsLightbox.open('<div class="fl-builder-actions '+ settings.className +'"><span class="fl-builder-actions-title">'+ settings.title +'</span>'+ buttons +'<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">'+ FLBuilder.strings.cancel +'</span></div>');
3522
  },
3523
 
3524
  /* Alert Lightboxes
@@ -3534,10 +3579,14 @@ var FLBuilder;
3534
  className: 'fl-builder-lightbox fl-builder-alert-lightbox',
3535
  destroyOnClose: true
3536
  }),
3537
- html = '<div class="fl-lightbox-message">' + message + '</div><div class="fl-lightbox-footer"><span class="fl-builder-settings-cancel fl-builder-button fl-builder-button-large fl-builder-button-primary" href="javascript:void(0);">' + FLBuilder.strings.ok + '</span></div>';
3538
 
3539
  alert.open(html);
3540
  }
3541
  };
3542
 
 
 
 
 
3543
  })(jQuery);
2
 
3
  (function($){
4
 
 
 
 
 
5
  /**
6
+ * The main builder interface class.
7
+ *
8
  * @class FLBuilder
9
  * @static
10
  */
39
  */
40
  _dragging : false,
41
 
42
+ /**
43
+ * @param _exitUrl
44
+ * @private
45
+ */
46
+ _exitUrl : null,
47
+
48
  /**
49
  * @param _lightbox
50
  * @private
295
  {
296
  /* Links */
297
  $('a').on('click', FLBuilder._linkClicked);
298
+ $('.fl-page-nav .nav a').on('click', FLBuilder._headerLinkClicked);
299
 
300
  /* Heartbeat */
301
  $(document).on('heartbeat-tick', FLBuilder._lockPost);
346
 
347
  /* Rows */
348
  $('body').delegate('.fl-row-overlay .fl-block-remove', 'click', FLBuilder._deleteRowClicked);
349
+ $('body').delegate('.fl-row-overlay .fl-block-copy', 'click', FLBuilder._rowCopyClicked);
350
  $('body').delegate('.fl-row-overlay .fl-block-settings', 'click', FLBuilder._rowSettingsClicked);
351
  $('body').delegate('.fl-row-overlay .fl-block-move', 'mousedown', FLBuilder._blockDragInit);
352
  $('body').delegate('.fl-builder-row-settings .fl-builder-settings-save', 'click', FLBuilder._saveSettings);
451
  e.preventDefault();
452
  },
453
 
454
+ /**
455
+ * @method _headerLinkClicked
456
+ * @private
457
+ */
458
+ _headerLinkClicked: function(e)
459
+ {
460
+ var link = $(this),
461
+ href = link.attr('href');
462
+
463
+ e.preventDefault();
464
+
465
+ FLBuilder._exitUrl = href.indexOf('?') > -1 ? href : href + '?fl_builder';
466
+ FLBuilder._doneClicked();
467
+ },
468
+
469
  /**
470
  * @method _warnBeforeUnload
471
  * @private
477
  moduleSettings = $('.fl-builder-module-settings').length > 0;
478
 
479
  if(rowSettings || colSettings || moduleSettings) {
480
+ return FLBuilderStrings.unloadWarning;
481
  }
482
  },
483
 
532
  _toolsClicked: function()
533
  {
534
  var buttons = {},
535
+ lite = FLBuilderConfig.lite,
536
+ postType = FLBuilderConfig.postType,
537
+ enabledTemplates = FLBuilderConfig.enabledTemplates;
538
 
539
  // Duplicate button
540
  if(postType == 'fl-builder-template') {
541
+ buttons['duplicate-page'] = FLBuilderStrings.duplicateTemplate;
542
  }
543
  else {
544
+ buttons['duplicate-page'] = FLBuilderStrings.duplicatePage;
545
  }
546
 
547
  // Template buttons
548
  if(!lite && postType != 'fl-builder-template' && (enabledTemplates == 'user' || enabledTemplates == 'enabled')) {
549
 
550
+ buttons['save-user-template'] = FLBuilderStrings.saveTemplate;
551
 
552
  if(FLBuilder._templateSettingsEnabled) {
553
+ buttons['save-template'] = FLBuilderStrings.saveCoreTemplate;
554
  }
555
  }
556
 
557
  // Global settings button
558
+ buttons['global-settings'] = FLBuilderStrings.editGlobalSettings;
559
 
560
  FLBuilder._showActionsLightbox({
561
  'className' : 'fl-builder-tools-actions',
562
+ 'title' : FLBuilderStrings.actionsLightboxTitle,
563
  'buttons' : buttons
564
  });
565
  },
572
  {
573
  FLBuilder._showActionsLightbox({
574
  'className': 'fl-builder-save-actions',
575
+ 'title': FLBuilderStrings.actionsLightboxTitle,
576
  'buttons': {
577
+ 'publish': FLBuilderStrings.publish,
578
+ 'draft': FLBuilderStrings.draft,
579
+ 'discard': FLBuilderStrings.discard
580
  }
581
  });
582
  },
607
  */
608
  _blockUpgradeClicked: function()
609
  {
610
+ window.open(FLBuilderConfig.upgradeUrl);
611
  },
612
 
613
  /* Save Actions
647
  */
648
  _discardButtonClicked: function()
649
  {
650
+ var result = confirm(FLBuilderStrings.discardMessage);
651
 
652
  if(result) {
653
 
669
  */
670
  _cancelButtonClicked: function()
671
  {
672
+ FLBuilder._exitUrl = null;
673
  FLBuilder._actionsLightbox.close();
674
  },
675
 
679
  */
680
  _exit: function()
681
  {
682
+ var href = FLBuilder._exitUrl ? FLBuilder._exitUrl : window.location.href.replace('fl_builder', '');
683
+
684
+ window.location.href = href;
685
  },
686
 
687
  /* Tools Actions
835
  */
836
  _showTemplateSelector: function()
837
  {
838
+ if(!FLBuilderConfig.lite) {
839
 
840
  FLBuilder._showLightbox(false);
841
 
870
  if($('.fl-builder-content').children('.fl-row').length > 0) {
871
 
872
  if(index == 0) {
873
+ if(confirm(FLBuilderStrings.changeTemplateMessage)) {
874
  FLBuilder._lightbox._node.hide();
875
  FLBuilder._applyTemplate(0, false, 'core');
876
  }
898
  if($('.fl-builder-content').children('.fl-row').length > 0) {
899
 
900
  if(id == 'blank') {
901
+ if(confirm(FLBuilderStrings.changeTemplateMessage)) {
902
  FLBuilder._lightbox._node.hide();
903
  FLBuilder._applyTemplate('blank', false, 'user');
904
  }
935
  {
936
  var template = $(this).closest('.fl-user-template');
937
 
938
+ if(confirm(FLBuilderStrings.deleteTemplate)) {
939
 
940
  FLBuilder.ajax({
941
  action: 'fl_builder_update',
964
  {
965
  FLBuilder._showActionsLightbox({
966
  'className': 'fl-builder-template-actions',
967
+ 'title': FLBuilderStrings.actionsLightboxTitle,
968
  'buttons': {
969
+ 'template-replace': FLBuilderStrings.templateReplace,
970
+ 'template-append': FLBuilderStrings.templateAppend
971
  }
972
  });
973
  },
978
  */
979
  _templateReplaceClicked: function()
980
  {
981
+ if(confirm(FLBuilderStrings.changeTemplateMessage)) {
982
  FLBuilder._actionsLightbox.close();
983
  FLBuilder._applyTemplate(FLBuilder._selectedTemplateId, false, FLBuilder._selectedTemplateType);
984
  }
1083
  */
1084
  _saveUserTemplateSettingsComplete: function()
1085
  {
1086
+ FLBuilder._alert(FLBuilderStrings.templateSaved);
1087
  },
1088
 
1089
  /* Template Settings
1116
 
1117
  if(content.children('.fl-row').length === 0) {
1118
  content.addClass('fl-builder-empty');
1119
+ content.append('<span class="fl-builder-empty-message">'+ FLBuilderStrings.emptyMessage +'</span>');
1120
  FLBuilder._initSortables();
1121
  }
1122
  },
1371
  }
1372
 
1373
  var parent = ui.placeholder.parent(),
1374
+ title = FLBuilderStrings.insert;
1375
 
1376
  if(parent.hasClass('fl-col-content')) {
1377
  if(ui.item.hasClass('fl-builder-block-module')) {
1386
  title = ui.item.text();
1387
  }
1388
  else {
1389
+ title = FLBuilderStrings.newColumn;
1390
  }
1391
  }
1392
  else if(parent.hasClass('fl-builder-content')) {
1394
  title = ui.item.text();
1395
  }
1396
  else if(ui.item.hasClass('fl-row')) {
1397
+ title = FLBuilderStrings.row;
1398
  }
1399
  else {
1400
+ title = FLBuilderStrings.newRow;
1401
  }
1402
  }
1403
 
1500
 
1501
  if(!row.hasClass('fl-block-overlay-active')) {
1502
  row.addClass('fl-block-overlay-active');
1503
+ row.append('<div class="fl-row-overlay fl-block-overlay" data-node="'+ row.attr('data-node') +'"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ FLBuilderStrings.row +'</div><i class="fl-block-move fa fa-arrows fl-tip" title="' + FLBuilderStrings.move + '"></i><i class="fl-block-settings fa fa-wrench fl-tip" title="' + FLBuilderStrings.rowSettings + '"></i><i class="fl-block-copy fa fa-copy fl-tip" title="' + FLBuilderStrings.duplicate + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilderStrings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1504
  FLBuilder._initTipTips();
1505
  }
1506
  },
1659
  FLBuilder._deleteRow(row);
1660
  }
1661
  else {
1662
+ result = confirm(FLBuilderStrings.deleteRowMessage);
1663
 
1664
  if(result) {
1665
  FLBuilder._deleteRow(row);
1688
  FLBuilder._removeRowOverlays();
1689
  },
1690
 
1691
+ /**
1692
+ * @method _rowCopyClicked
1693
+ * @private
1694
+ */
1695
+ _rowCopyClicked: function(e)
1696
+ {
1697
+ var nodeId = $(this).closest('.fl-row-overlay').attr('data-node');
1698
+
1699
+ $('.fl-builder-loading').show();
1700
+
1701
+ FLBuilder._removeAllOverlays();
1702
+
1703
+ FLBuilder.ajax({
1704
+ action: 'fl_builder_update',
1705
+ method: 'copy_row',
1706
+ node_id: nodeId
1707
+ }, FLBuilder._updateLayout);
1708
+
1709
+ e.stopPropagation();
1710
+ },
1711
+
1712
  /**
1713
  * @method _rowSettingsClicked
1714
  * @private
1753
  }
1754
  if(!col.hasClass('fl-block-overlay-active')) {
1755
  col.addClass('fl-block-overlay-active');
1756
+ col.append('<div class="fl-col-overlay fl-block-overlay"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ FLBuilderStrings.column +'</div><i class="fl-block-settings fa fa-wrench fl-tip" title="' + FLBuilderStrings.columnSettings + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilderStrings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1757
  FLBuilder._initTipTips();
1758
  }
1759
 
1943
  }
1944
 
1945
  module.addClass('fl-block-overlay-active');
1946
+ module.append('<div class="fl-module-overlay fl-block-overlay"><div class="fl-block-overlay-header"><div class="fl-block-overlay-actions"><div class="fl-block-overlay-title">'+ moduleName +'</div><i class="fl-block-move fa fa-arrows fl-tip" title="' + FLBuilderStrings.move + '"></i><i class="fl-block-settings fa fa-wrench fl-tip" title="' + moduleName + ' ' + FLBuilderStrings.settings + '"></i><i class="fl-block-copy fa fa-copy fl-tip" title="' + FLBuilderStrings.duplicate + '"></i><i class="fl-block-columns fa fa-columns fl-tip" title="' + FLBuilderStrings.columnSettings + '"></i><i class="fl-block-remove fa fa-times fl-tip" title="' + FLBuilderStrings.remove + '"></i></div><div class="fl-clear"></div></div></div>');
1947
  FLBuilder._initTipTips();
1948
  }
1949
 
2083
  _deleteModuleClicked: function(e)
2084
  {
2085
  var module = $(this).closest('.fl-module'),
2086
+ result = confirm(FLBuilderStrings.deleteModuleMessage);
2087
 
2088
  if(result) {
2089
  FLBuilder._deleteModule(module);
2579
  keyDelay : 1000,
2580
  fadeOut : false,
2581
  usePlaceholder : true,
2582
+ emptyText : FLBuilderStrings.noResultsFound,
2583
  showResultListWhenNoMatch : true,
2584
  preFill : field.data('value'),
2585
  queryParam : 'fl_as_query',
2679
  {
2680
  var row = $(this).closest('tr'),
2681
  parent = row.parent(),
2682
+ result = confirm(FLBuilderStrings.deleteFieldMessage);
2683
 
2684
  if(result) {
2685
  row.remove();
2869
  {
2870
  if(FLBuilder._singlePhotoSelector === null) {
2871
  FLBuilder._singlePhotoSelector = wp.media({
2872
+ title: FLBuilderStrings.selectPhoto,
2873
+ button: { text: FLBuilderStrings.selectPhoto },
2874
  library : { type : 'image' },
2875
  multiple: false
2876
  });
2962
  size = null,
2963
  selected = null,
2964
  titles = {
2965
+ full : FLBuilderStrings.fullSize,
2966
+ large : FLBuilderStrings.large,
2967
+ medium : FLBuilderStrings.medium,
2968
+ thumbnail : FLBuilderStrings.thumbnail
2969
  };
2970
 
2971
  for(size in photo.sizes) {
3052
  }
3053
 
3054
  if(photos.length == 1) {
3055
+ count.html('1 ' + FLBuilderStrings.photoSelected);
3056
  }
3057
  else {
3058
+ count.html(photos.length + ' ' + FLBuilderStrings.photosSelected);
3059
  }
3060
 
3061
  wrap.removeClass('fl-multiple-photos-empty');
3075
  if(FLBuilder._singleVideoSelector === null) {
3076
 
3077
  FLBuilder._singleVideoSelector = wp.media({
3078
+ title: FLBuilderStrings.selectVideo,
3079
+ button: { text: FLBuilderStrings.selectVideo },
3080
  library : { type : 'video' },
3081
  multiple: false
3082
  });
3351
  ----------------------------------------------------------*/
3352
 
3353
  /**
3354
+ * Used to init pre WP 3.9 editors from field.php.
3355
  *
3356
  * @method initEditorField
3357
  */
3480
  */
3481
  _ajaxUrl: function(params)
3482
  {
3483
+ var url = FLBuilderConfig.ajaxUrl,
3484
  param = null;
3485
 
3486
  if(typeof params !== 'undefined') {
3563
  buttons += '<span class="fl-builder-'+ i +'-button fl-builder-button fl-builder-button-large">'+ settings.buttons[i] +'</span>';
3564
  }
3565
 
3566
+ FLBuilder._actionsLightbox.open('<div class="fl-builder-actions '+ settings.className +'"><span class="fl-builder-actions-title">'+ settings.title +'</span>'+ buttons +'<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">'+ FLBuilderStrings.cancel +'</span></div>');
3567
  },
3568
 
3569
  /* Alert Lightboxes
3579
  className: 'fl-builder-lightbox fl-builder-alert-lightbox',
3580
  destroyOnClose: true
3581
  }),
3582
+ html = '<div class="fl-lightbox-message">' + message + '</div><div class="fl-lightbox-footer"><span class="fl-builder-settings-cancel fl-builder-button fl-builder-button-large fl-builder-button-primary" href="javascript:void(0);">' + FLBuilderStrings.ok + '</span></div>';
3583
 
3584
  alert.open(html);
3585
  }
3586
  };
3587
 
3588
+ $(function(){
3589
+ FLBuilder._init();
3590
+ });
3591
+
3592
  })(jQuery);
modules/photo/includes/frontend.js.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php if($settings->link_type == 'lightbox') : ?>
2
+ jQuery(function() {
3
+ jQuery('.fl-node-<?php echo $id; ?> a').magnificPopup({
4
+ type: 'image',
5
+ closeOnContentClick: true,
6
+ closeBtnInside: false
7
+ });
8
+ });
9
+ <?php endif; ?>
modules/photo/photo.php CHANGED
@@ -28,6 +28,17 @@ class FLPhotoModule extends FLBuilderModule {
28
  ));
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
 
31
  /**
32
  * @method update
33
  * @param $settings {object}
@@ -214,6 +225,9 @@ class FLPhotoModule extends FLBuilderModule {
214
  if($this->settings->link_type == 'url') {
215
  $link = $this->settings->link_url;
216
  }
 
 
 
217
  else if($this->settings->link_type == 'file') {
218
  $link = $photo->url;
219
  }
@@ -435,6 +449,7 @@ FLBuilder::register_module('FLPhotoModule', array(
435
  'options' => array(
436
  '' => __('None', 'fl-builder'),
437
  'url' => __('URL', 'fl-builder'),
 
438
  'file' => __('Photo File', 'fl-builder'),
439
  'page' => __('Photo Page', 'fl-builder')
440
  ),
28
  ));
29
  }
30
 
31
+ /**
32
+ * @method enqueue_scripts
33
+ */
34
+ public function enqueue_scripts()
35
+ {
36
+ if($this->settings && $this->settings->link_type == 'lightbox') {
37
+ $this->add_js('jquery-magnificpopup');
38
+ $this->add_css('jquery-magnificpopup');
39
+ }
40
+ }
41
+
42
  /**
43
  * @method update
44
  * @param $settings {object}
225
  if($this->settings->link_type == 'url') {
226
  $link = $this->settings->link_url;
227
  }
228
+ else if($this->settings->link_type == 'lightbox') {
229
+ $link = $photo->url;
230
+ }
231
  else if($this->settings->link_type == 'file') {
232
  $link = $photo->url;
233
  }
449
  'options' => array(
450
  '' => __('None', 'fl-builder'),
451
  'url' => __('URL', 'fl-builder'),
452
+ 'lightbox' => __('Lightbox', 'fl-builder'),
453
  'file' => __('Photo File', 'fl-builder'),
454
  'page' => __('Photo Page', 'fl-builder')
455
  ),
modules/widget/includes/frontend.php CHANGED
@@ -1,34 +1,38 @@
1
  <div class="fl-widget">
2
  <?php
 
 
3
 
4
  // Get builder post data.
5
  $post_data = FLBuilderModel::get_post_data();
6
 
7
  // Widget class
8
  if(isset($settings->widget)) {
9
- $widget_class = $settings->widget;
10
  }
11
  else if(isset($post_data['widget']) && FLBuilderModel::is_builder_active()) {
12
- $widget_class = $post_data['widget'];
13
  }
14
 
15
- if(isset($widget_class) && class_exists($widget_class)) {
16
 
17
  // Widget instance
18
- $widget_instance = new $widget_class();
 
 
19
 
20
  // Widget settings
21
  $settings_key = 'widget-' . $widget_instance->id_base;
22
  $widget_settings = isset($settings->$settings_key) ? (array)$settings->$settings_key : array();
23
 
24
  // Render the widget
25
- wp_cache_flush($widget_class, 'widget');
26
- the_widget($widget_class, $widget_settings);
27
  }
28
- else if(isset($widget_class) && FLBuilderModel::is_builder_active()) {
29
 
30
  // Widget doesn't exist!
31
- echo $widget_class . __(' no longer exists.');
32
  }
33
 
34
  ?>
1
  <div class="fl-widget">
2
  <?php
3
+
4
+ global $wp_widget_factory;
5
 
6
  // Get builder post data.
7
  $post_data = FLBuilderModel::get_post_data();
8
 
9
  // Widget class
10
  if(isset($settings->widget)) {
11
+ $widget_slug = $settings->widget;
12
  }
13
  else if(isset($post_data['widget']) && FLBuilderModel::is_builder_active()) {
14
+ $widget_slug = $post_data['widget'];
15
  }
16
 
17
+ if(isset($widget_slug) && isset($wp_widget_factory->widgets[$widget_slug])) {
18
 
19
  // Widget instance
20
+ $factory_instance = $wp_widget_factory->widgets[$widget_slug];
21
+ $widget_class = get_class($factory_instance);
22
+ $widget_instance = new $widget_class($factory_instance->id_base, $factory_instance->name, $factory_instance->widget_options);
23
 
24
  // Widget settings
25
  $settings_key = 'widget-' . $widget_instance->id_base;
26
  $widget_settings = isset($settings->$settings_key) ? (array)$settings->$settings_key : array();
27
 
28
  // Render the widget
29
+ wp_cache_flush($widget_slug, 'widget');
30
+ the_widget($widget_slug, $widget_settings);
31
  }
32
+ else if(isset($widget_slug) && FLBuilderModel::is_builder_active()) {
33
 
34
  // Widget doesn't exist!
35
+ echo $widget_slug . __(' no longer exists.');
36
  }
37
 
38
  ?>
modules/widget/includes/settings-general.php CHANGED
@@ -1,20 +1,24 @@
1
  <?php
 
 
2
 
3
  // Get builder post data.
4
  $post_data = FLBuilderModel::get_post_data();
5
 
6
- // Widget class
7
  if(isset($settings->widget)) {
8
- $widget_class = $settings->widget;
9
  }
10
  else if(isset($post_data['widget'])) {
11
- $widget_class = $post_data['widget'];
12
  }
13
 
14
- if(isset($widget_class) && class_exists($widget_class)) {
15
 
16
  // Widget instance
17
- $widget_instance = new $widget_class();
 
 
18
 
19
  // Widget settings
20
  $settings_key = 'widget-' . $widget_instance->id_base;
@@ -30,13 +34,13 @@ if(isset($widget_class) && class_exists($widget_class)) {
30
  // Widget form
31
  echo '<div class="fl-field" data-preview=\'{"type":"widget"}\'>';
32
  $widget_instance->form($widget_settings);
33
- echo '<input type="hidden" name="widget" value="' . $widget_class . '" />';
34
  echo '</div>';
35
  }
36
- else if(isset($widget_class)) {
37
 
38
  // Widget doesn't exist!
39
  echo '<div class="fl-builder-widget-missing">';
40
- echo $widget_class . __(' no longer exists.');
41
  echo '</div>';
42
  }
1
  <?php
2
+
3
+ global $wp_widget_factory;
4
 
5
  // Get builder post data.
6
  $post_data = FLBuilderModel::get_post_data();
7
 
8
+ // Widget slug
9
  if(isset($settings->widget)) {
10
+ $widget_slug = $settings->widget;
11
  }
12
  else if(isset($post_data['widget'])) {
13
+ $widget_slug = $post_data['widget'];
14
  }
15
 
16
+ if(isset($widget_slug) && isset($wp_widget_factory->widgets[$widget_slug])) {
17
 
18
  // Widget instance
19
+ $factory_instance = $wp_widget_factory->widgets[$widget_slug];
20
+ $widget_class = get_class($factory_instance);
21
+ $widget_instance = new $widget_class($factory_instance->id_base, $factory_instance->name, $factory_instance->widget_options);
22
 
23
  // Widget settings
24
  $settings_key = 'widget-' . $widget_instance->id_base;
34
  // Widget form
35
  echo '<div class="fl-field" data-preview=\'{"type":"widget"}\'>';
36
  $widget_instance->form($widget_settings);
37
+ echo '<input type="hidden" name="widget" value="' . $widget_slug . '" />';
38
  echo '</div>';
39
  }
40
+ else if(isset($widget_slug)) {
41
 
42
  // Widget doesn't exist!
43
  echo '<div class="fl-builder-widget-missing">';
44
+ echo $widget_slug . __(' no longer exists.');
45
  echo '</div>';
46
  }