Version Description
Download this release
Release Info
Developer | justinbusa |
Plugin | WordPress Page Builder – Beaver Builder |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.4.2
- classes/FLBuilder.php +13 -26
- classes/FLBuilderModel.php +59 -72
- fl-builder.php +2 -3
- includes/js-config.php +3 -3
- includes/ui.php +2 -2
- includes/updater-config.php +1 -1
- js/fl-builder.js +20 -20
- readme.txt +1 -1
classes/FLBuilder.php
CHANGED
@@ -51,10 +51,7 @@ final class FLBuilder {
|
|
51 |
* @method init
|
52 |
*/
|
53 |
static public function init()
|
54 |
-
{
|
55 |
-
// Init the data model.
|
56 |
-
FLBuilderModel::init();
|
57 |
-
|
58 |
// Enable editing if the builder is active.
|
59 |
if(FLBuilderModel::is_builder_active()) {
|
60 |
|
@@ -223,7 +220,7 @@ final class FLBuilder {
|
|
223 |
wp_register_script('jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array('jquery'), $ver, true);
|
224 |
|
225 |
// YUI 3 (Needed for the slideshow)
|
226 |
-
if(is_ssl()) {
|
227 |
wp_register_script('yui3', 'https://yui-s.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false);
|
228 |
}
|
229 |
else {
|
@@ -395,43 +392,33 @@ final class FLBuilder {
|
|
395 |
*/
|
396 |
static public function admin_bar_menu($wp_admin_bar)
|
397 |
{
|
398 |
-
|
399 |
|
400 |
-
|
401 |
|
402 |
-
$wp_admin_bar->add_node(array(
|
403 |
'id' => 'fl-builder-frontend-edit-link',
|
404 |
-
'title' => '<style> #wp-admin-bar-fl-builder-frontend-edit-link .ab-icon:before { content: "\f116" !important; top: 2px; margin-right: 3px; } </style><span class="ab-icon"></span>' . __(FLBuilderModel::get_branding(), 'fl-builder'),
|
405 |
-
'href' => FLBuilderModel::get_edit_url()
|
406 |
));
|
407 |
}
|
408 |
}
|
409 |
|
410 |
-
/**
|
411 |
-
* @method render_js_config
|
412 |
-
*/
|
413 |
-
static public function render_js_config()
|
414 |
-
{
|
415 |
-
if(FLBuilderModel::is_builder_active()) {
|
416 |
-
include FL_BUILDER_DIR . 'includes/js-config.php';
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
/**
|
421 |
* @method render_ui
|
422 |
*/
|
423 |
static public function render_ui()
|
424 |
{
|
425 |
-
global $
|
426 |
-
|
427 |
-
if(FLBuilderModel::is_builder_active()) {
|
428 |
|
429 |
-
|
430 |
|
431 |
-
|
432 |
-
$
|
|
|
433 |
|
434 |
include FL_BUILDER_DIR . 'includes/ui.php';
|
|
|
435 |
}
|
436 |
}
|
437 |
|
51 |
* @method init
|
52 |
*/
|
53 |
static public function init()
|
54 |
+
{
|
|
|
|
|
|
|
55 |
// Enable editing if the builder is active.
|
56 |
if(FLBuilderModel::is_builder_active()) {
|
57 |
|
220 |
wp_register_script('jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array('jquery'), $ver, true);
|
221 |
|
222 |
// YUI 3 (Needed for the slideshow)
|
223 |
+
if(FLBuilderModel::is_ssl()) {
|
224 |
wp_register_script('yui3', 'https://yui-s.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false);
|
225 |
}
|
226 |
else {
|
392 |
*/
|
393 |
static public function admin_bar_menu($wp_admin_bar)
|
394 |
{
|
395 |
+
global $wp_the_query;
|
396 |
|
397 |
+
if ( FLBuilderModel::is_post_editable() ) {
|
398 |
|
399 |
+
$wp_admin_bar->add_node( array(
|
400 |
'id' => 'fl-builder-frontend-edit-link',
|
401 |
+
'title' => '<style> #wp-admin-bar-fl-builder-frontend-edit-link .ab-icon:before { content: "\f116" !important; top: 2px; margin-right: 3px; } </style><span class="ab-icon"></span>' . __( FLBuilderModel::get_branding(), 'fl-builder' ),
|
402 |
+
'href' => FLBuilderModel::get_edit_url( $wp_the_query->post->ID )
|
403 |
));
|
404 |
}
|
405 |
}
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
/**
|
408 |
* @method render_ui
|
409 |
*/
|
410 |
static public function render_ui()
|
411 |
{
|
412 |
+
global $wp_the_query;
|
|
|
|
|
413 |
|
414 |
+
if ( FLBuilderModel::is_builder_active() ) {
|
415 |
|
416 |
+
$post_id = $wp_the_query->post->ID;
|
417 |
+
$categories = FLBuilderModel::get_categorized_modules();
|
418 |
+
$enabled_templates = FLBuilderModel::get_enabled_templates();
|
419 |
|
420 |
include FL_BUILDER_DIR . 'includes/ui.php';
|
421 |
+
include FL_BUILDER_DIR . 'includes/js-config.php';
|
422 |
}
|
423 |
}
|
424 |
|
classes/FLBuilderModel.php
CHANGED
@@ -36,16 +36,6 @@ final class FLBuilderModel {
|
|
36 |
*/
|
37 |
static public $modules = array();
|
38 |
|
39 |
-
/**
|
40 |
-
* The id of the post that is currently being edited
|
41 |
-
* using the builder.
|
42 |
-
*
|
43 |
-
* @property $active_post_id
|
44 |
-
* @type string
|
45 |
-
* @private
|
46 |
-
*/
|
47 |
-
static private $active_post_id = null;
|
48 |
-
|
49 |
/**
|
50 |
* The last node id that was generated by the builder.
|
51 |
* This is saved to ensure the next node id is unique.
|
@@ -84,18 +74,6 @@ final class FLBuilderModel {
|
|
84 |
*/
|
85 |
static private $draft_layout_data = array();
|
86 |
|
87 |
-
/**
|
88 |
-
* @method init
|
89 |
-
*/
|
90 |
-
static public function init()
|
91 |
-
{
|
92 |
-
global $post;
|
93 |
-
|
94 |
-
if($post && isset($_GET['fl_builder'])) {
|
95 |
-
self::$active_post_id = $post->ID;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
/**
|
100 |
* All database updates should be made through
|
101 |
* this method for security.
|
@@ -146,17 +124,21 @@ final class FLBuilderModel {
|
|
146 |
/**
|
147 |
* @method get_edit_url
|
148 |
*/
|
149 |
-
static public function get_edit_url()
|
150 |
{
|
151 |
global $post;
|
152 |
|
153 |
-
|
|
|
|
|
|
|
|
|
154 |
|
155 |
-
if(class_exists('WPMinify')) {
|
156 |
-
$url = add_query_arg('wp-minify-off', '1', $url);
|
157 |
}
|
158 |
|
159 |
-
return set_url_scheme($url);
|
160 |
}
|
161 |
|
162 |
/**
|
@@ -256,21 +238,30 @@ final class FLBuilderModel {
|
|
256 |
}
|
257 |
|
258 |
/**
|
259 |
-
*
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
*
|
262 |
* @method is_post_editable
|
263 |
*/
|
264 |
static public function is_post_editable()
|
265 |
-
{
|
266 |
-
|
267 |
-
|
268 |
-
if(is_singular()) {
|
269 |
|
|
|
270 |
$post_types = self::get_post_types();
|
271 |
-
$user_can = current_user_can('edit_post', $post->ID);
|
272 |
|
273 |
-
if(in_array($post->post_type, $post_types) && $user_can) {
|
274 |
return true;
|
275 |
}
|
276 |
}
|
@@ -322,31 +313,26 @@ final class FLBuilderModel {
|
|
322 |
}
|
323 |
|
324 |
/**
|
325 |
-
* Checks to see if the builder UI is active
|
326 |
-
*
|
327 |
*
|
328 |
* @method is_builder_active
|
329 |
*/
|
330 |
static public function is_builder_active()
|
331 |
{
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
else if(self::is_post_editable() && $post->ID == self::$active_post_id) {
|
346 |
-
return true;
|
347 |
-
}
|
348 |
-
|
349 |
-
return false;
|
350 |
}
|
351 |
|
352 |
/**
|
@@ -382,33 +368,34 @@ final class FLBuilderModel {
|
|
382 |
}
|
383 |
|
384 |
/**
|
385 |
-
* Enable the builder editor.
|
386 |
*
|
387 |
* @method enable_editing
|
388 |
*/
|
389 |
static public function enable_editing()
|
390 |
{
|
391 |
-
|
|
|
|
|
392 |
|
393 |
-
|
394 |
-
$
|
395 |
-
$
|
396 |
-
$draft = self::get_layout_data('draft');
|
397 |
|
398 |
// Migrate existing post content to the builder?
|
399 |
-
if(empty($published) && empty($draft) && !empty($post->post_content)) {
|
400 |
|
401 |
$row = self::add_row();
|
402 |
-
$cols = self::get_nodes('column');
|
403 |
-
$col = array_shift($cols);
|
404 |
-
$settings = self::get_module_defaults('rich-text');
|
405 |
-
$settings->text = wpautop($post->post_content);
|
406 |
|
407 |
-
self::add_module('rich-text', $settings, $col->node);
|
408 |
}
|
409 |
// Create a new draft?
|
410 |
-
else if(empty($draft)) {
|
411 |
-
self::update_layout_data($published, 'draft', $
|
412 |
}
|
413 |
|
414 |
// Delete old draft asset cache.
|
@@ -416,7 +403,7 @@ final class FLBuilderModel {
|
|
416 |
|
417 |
// Lock the post.
|
418 |
require_once ABSPATH . 'wp-admin/includes/post.php';
|
419 |
-
wp_set_post_lock($
|
420 |
}
|
421 |
}
|
422 |
|
@@ -428,7 +415,7 @@ final class FLBuilderModel {
|
|
428 |
$wp_info = wp_upload_dir();
|
429 |
|
430 |
// SSL workaround.
|
431 |
-
if(is_ssl()) {
|
432 |
$wp_info['baseurl'] = str_ireplace('http://', 'https://', $wp_info['baseurl']);
|
433 |
}
|
434 |
|
@@ -1744,7 +1731,7 @@ final class FLBuilderModel {
|
|
1744 |
|
1745 |
if(is_string($val)) {
|
1746 |
|
1747 |
-
$decoded = json_decode($val);
|
1748 |
|
1749 |
if(is_object($decoded) || is_array($decoded)) {
|
1750 |
$new_val = $decoded;
|
36 |
*/
|
37 |
static public $modules = array();
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* The last node id that was generated by the builder.
|
41 |
* This is saved to ensure the next node id is unique.
|
74 |
*/
|
75 |
static private $draft_layout_data = array();
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/**
|
78 |
* All database updates should be made through
|
79 |
* this method for security.
|
124 |
/**
|
125 |
* @method get_edit_url
|
126 |
*/
|
127 |
+
static public function get_edit_url( $post_id = false )
|
128 |
{
|
129 |
global $post;
|
130 |
|
131 |
+
if ( false === $post_id ) {
|
132 |
+
$post_id = $post->ID;
|
133 |
+
}
|
134 |
+
|
135 |
+
$url = add_query_arg( 'fl_builder', '', get_permalink( $post_id ) );
|
136 |
|
137 |
+
if ( class_exists( 'WPMinify' ) ) {
|
138 |
+
$url = add_query_arg( 'wp-minify-off', '1', $url );
|
139 |
}
|
140 |
|
141 |
+
return set_url_scheme( $url );
|
142 |
}
|
143 |
|
144 |
/**
|
238 |
}
|
239 |
|
240 |
/**
|
241 |
+
* @method is_ssl
|
242 |
+
*/
|
243 |
+
static public function is_ssl()
|
244 |
+
{
|
245 |
+
return is_ssl() || 0 === stripos( get_option( 'siteurl' ), 'https://' );
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Checks to see if the builder can be enabled for
|
250 |
+
* the current post in the main query.
|
251 |
*
|
252 |
* @method is_post_editable
|
253 |
*/
|
254 |
static public function is_post_editable()
|
255 |
+
{
|
256 |
+
global $wp_the_query;
|
257 |
+
|
258 |
+
if ( is_singular() && isset( $wp_the_query->post ) ) {
|
259 |
|
260 |
+
$post = $wp_the_query->post;
|
261 |
$post_types = self::get_post_types();
|
262 |
+
$user_can = current_user_can( 'edit_post', $post->ID );
|
263 |
|
264 |
+
if ( in_array( $post->post_type, $post_types ) && $user_can ) {
|
265 |
return true;
|
266 |
}
|
267 |
}
|
313 |
}
|
314 |
|
315 |
/**
|
316 |
+
* Checks to see if the builder UI is active for
|
317 |
+
* the current post in the main query.
|
318 |
*
|
319 |
* @method is_builder_active
|
320 |
*/
|
321 |
static public function is_builder_active()
|
322 |
{
|
323 |
+
if ( self::is_post_editable() && ! is_admin() && ! post_password_required() ) {
|
324 |
+
|
325 |
+
$post_data = self::get_post_data();
|
326 |
+
|
327 |
+
if ( isset( $_GET['fl_builder'] ) ) {
|
328 |
+
return true;
|
329 |
+
}
|
330 |
+
else if ( isset( $post_data['fl_builder'] ) ) {
|
331 |
+
return true;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
/**
|
368 |
}
|
369 |
|
370 |
/**
|
371 |
+
* Enable the builder editor for the main post in the query.
|
372 |
*
|
373 |
* @method enable_editing
|
374 |
*/
|
375 |
static public function enable_editing()
|
376 |
{
|
377 |
+
global $wp_the_query;
|
378 |
+
|
379 |
+
if ( self::is_post_editable() ) {
|
380 |
|
381 |
+
$post = $wp_the_query->post;
|
382 |
+
$published = self::get_layout_data( 'published' );
|
383 |
+
$draft = self::get_layout_data( 'draft' );
|
|
|
384 |
|
385 |
// Migrate existing post content to the builder?
|
386 |
+
if ( empty( $published ) && empty( $draft ) && ! empty( $post->post_content ) ) {
|
387 |
|
388 |
$row = self::add_row();
|
389 |
+
$cols = self::get_nodes( 'column' );
|
390 |
+
$col = array_shift( $cols );
|
391 |
+
$settings = self::get_module_defaults( 'rich-text' );
|
392 |
+
$settings->text = wpautop( $post->post_content );
|
393 |
|
394 |
+
self::add_module( 'rich-text', $settings, $col->node );
|
395 |
}
|
396 |
// Create a new draft?
|
397 |
+
else if ( empty( $draft ) ) {
|
398 |
+
self::update_layout_data( $published, 'draft', $post->ID );
|
399 |
}
|
400 |
|
401 |
// Delete old draft asset cache.
|
403 |
|
404 |
// Lock the post.
|
405 |
require_once ABSPATH . 'wp-admin/includes/post.php';
|
406 |
+
wp_set_post_lock( $post->ID );
|
407 |
}
|
408 |
}
|
409 |
|
415 |
$wp_info = wp_upload_dir();
|
416 |
|
417 |
// SSL workaround.
|
418 |
+
if(self::is_ssl()) {
|
419 |
$wp_info['baseurl'] = str_ireplace('http://', 'https://', $wp_info['baseurl']);
|
420 |
}
|
421 |
|
1731 |
|
1732 |
if(is_string($val)) {
|
1733 |
|
1734 |
+
$decoded = json_decode(stripcslashes($val));
|
1735 |
|
1736 |
if(is_object($decoded) || is_array($decoded)) {
|
1737 |
$new_val = $decoded;
|
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.4.
|
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.4.
|
15 |
define('FL_BUILDER_DIR', plugin_dir_path(__FILE__));
|
16 |
define('FL_BUILDER_URL', plugins_url('/', __FILE__));
|
17 |
define('FL_BUILDER_LITE', true);
|
@@ -99,7 +99,6 @@ add_action('admin_bar_menu', 'FLBuilder::admin
|
|
99 |
add_filter('template_include', 'FLBuilder::render_template', 999);
|
100 |
add_action('wp_footer', 'FLBuilder::include_jquery');
|
101 |
add_action('wp_footer', 'FLBuilder::render_ui');
|
102 |
-
add_action('wp_footer', 'FLBuilder::render_js_config');
|
103 |
|
104 |
/* Filters */
|
105 |
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.4.2
|
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.4.2');
|
15 |
define('FL_BUILDER_DIR', plugin_dir_path(__FILE__));
|
16 |
define('FL_BUILDER_URL', plugins_url('/', __FILE__));
|
17 |
define('FL_BUILDER_LITE', true);
|
99 |
add_filter('template_include', 'FLBuilder::render_template', 999);
|
100 |
add_action('wp_footer', 'FLBuilder::include_jquery');
|
101 |
add_action('wp_footer', 'FLBuilder::render_ui');
|
|
|
102 |
|
103 |
/* Filters */
|
104 |
add_filter('body_class', 'FLBuilder::body_class');
|
includes/js-config.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<script>
|
2 |
|
3 |
var FLBuilderConfig = {
|
4 |
-
ajaxUrl: '<?php
|
5 |
-
enabledTemplates: '<?php echo
|
6 |
homeUrl: '<?php echo home_url(); ?>',
|
7 |
lite: <?php if(FL_BUILDER_LITE === true) echo 'true'; else echo 'false'; ?>,
|
8 |
-
postId: <?php echo
|
9 |
postType: '<?php echo get_post_type(); ?>',
|
10 |
simpleUi: <?php if(!current_user_can(FLBuilderModel::get_editing_capability())) echo 'true'; else echo 'false'; ?>,
|
11 |
upgradeUrl: '<?php echo FL_BUILDER_UPGRADE_URL; ?>'
|
1 |
<script>
|
2 |
|
3 |
var FLBuilderConfig = {
|
4 |
+
ajaxUrl: '<?php echo get_permalink( $post_id ); ?>',
|
5 |
+
enabledTemplates: '<?php echo $enabled_templates; ?>',
|
6 |
homeUrl: '<?php echo home_url(); ?>',
|
7 |
lite: <?php if(FL_BUILDER_LITE === true) echo 'true'; else echo 'false'; ?>,
|
8 |
+
postId: <?php echo $post_id; ?>,
|
9 |
postType: '<?php echo get_post_type(); ?>',
|
10 |
simpleUi: <?php if(!current_user_can(FLBuilderModel::get_editing_capability())) echo 'true'; else echo 'false'; ?>,
|
11 |
upgradeUrl: '<?php echo FL_BUILDER_UPGRADE_URL; ?>'
|
includes/ui.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
<div class="fl-builder-bar-content">
|
6 |
<span class="fl-builder-bar-title fl-builder-bar-title-no-icon">
|
7 |
-
<?php echo sprintf(__('Template: %s', 'fl-builder'), get_the_title($
|
8 |
</span>
|
9 |
<div class="fl-builder-bar-actions">
|
10 |
<span class="fl-builder-save-edit-template-button fl-builder-button fl-builder-button-primary"><?php _e('Save Template', 'fl-builder'); ?></span>
|
@@ -115,5 +115,5 @@
|
|
115 |
<div class="fl-builder-hidden-editor">
|
116 |
<?php wp_editor(' ', 'flhiddeneditor', array('wpautop' => true)); ?>
|
117 |
</div>
|
118 |
-
<input type="hidden" id="fl-post-id" value="<?php echo
|
119 |
<input type="hidden" id="fl-admin-url" value="<?php echo admin_url(); ?>" />
|
4 |
|
5 |
<div class="fl-builder-bar-content">
|
6 |
<span class="fl-builder-bar-title fl-builder-bar-title-no-icon">
|
7 |
+
<?php echo sprintf(__('Template: %s', 'fl-builder'), get_the_title($post_id)); ?>
|
8 |
</span>
|
9 |
<div class="fl-builder-bar-actions">
|
10 |
<span class="fl-builder-save-edit-template-button fl-builder-button fl-builder-button-primary"><?php _e('Save Template', 'fl-builder'); ?></span>
|
115 |
<div class="fl-builder-hidden-editor">
|
116 |
<?php wp_editor(' ', 'flhiddeneditor', array('wpautop' => true)); ?>
|
117 |
</div>
|
118 |
+
<input type="hidden" id="fl-post-id" value="<?php echo $post_id; ?>" />
|
119 |
<input type="hidden" id="fl-admin-url" value="<?php echo admin_url(); ?>" />
|
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.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.4.2',
|
7 |
'slug' => 'bb-plugin',
|
8 |
'type' => 'plugin'
|
9 |
));
|
js/fl-builder.js
CHANGED
@@ -1244,8 +1244,7 @@ var FLBuilder;
|
|
1244 |
oldCss = $('#fl-builder-layout-' + post + '-css'),
|
1245 |
oldJs = $('script[src*="/fl-builder/' + post + '"]'),
|
1246 |
newCss = $('<link rel="stylesheet" id="fl-builder-layout-' + post + '-css" href="'+ data.css +'" />'),
|
1247 |
-
newJs = $('<script src="'+ data.js +'"></script>')
|
1248 |
-
newHtml = $(data.html);
|
1249 |
|
1250 |
// Image onerror hack to check if the stylesheet has been loaded.
|
1251 |
loader.on('error', function()
|
@@ -1272,11 +1271,8 @@ var FLBuilder;
|
|
1272 |
oldCss.remove();
|
1273 |
oldJs.remove();
|
1274 |
|
1275 |
-
// Clean the new content.
|
1276 |
-
newHtml = FLBuilder._renderLayoutCleanContent(newHtml);
|
1277 |
-
|
1278 |
// Add the new content.
|
1279 |
-
content.append(
|
1280 |
|
1281 |
// Add the new layout js.
|
1282 |
setTimeout(function(){
|
@@ -1307,19 +1303,23 @@ var FLBuilder;
|
|
1307 |
* @method _renderLayoutCleanContent
|
1308 |
* @private
|
1309 |
*/
|
1310 |
-
_renderLayoutCleanContent: function(
|
1311 |
{
|
1312 |
-
var
|
|
|
|
|
1313 |
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
|
|
|
|
1319 |
}
|
1320 |
-
}
|
1321 |
|
1322 |
-
return
|
1323 |
},
|
1324 |
|
1325 |
/**
|
@@ -3633,17 +3633,17 @@ var FLBuilder;
|
|
3633 |
FLBuilder._silentUpdate = true;
|
3634 |
}
|
3635 |
|
3636 |
-
// Tell the server to use cached nodes and files.
|
3637 |
-
data.fl_use_cache = 1;
|
3638 |
-
|
3639 |
// Send the post id to the server.
|
3640 |
data.post_id = $('#fl-post-id').val();
|
3641 |
|
|
|
|
|
|
|
3642 |
// Append the builder namespace to the action.
|
3643 |
data.fl_action = data.action;
|
3644 |
|
3645 |
-
//
|
3646 |
-
data = { fl_builder_data:
|
3647 |
|
3648 |
// Do the ajax call.
|
3649 |
return $.post(FLBuilder._ajaxUrl(), data, function(response) {
|
1244 |
oldCss = $('#fl-builder-layout-' + post + '-css'),
|
1245 |
oldJs = $('script[src*="/fl-builder/' + post + '"]'),
|
1246 |
newCss = $('<link rel="stylesheet" id="fl-builder-layout-' + post + '-css" href="'+ data.css +'" />'),
|
1247 |
+
newJs = $('<script src="'+ data.js +'"></script>');
|
|
|
1248 |
|
1249 |
// Image onerror hack to check if the stylesheet has been loaded.
|
1250 |
loader.on('error', function()
|
1271 |
oldCss.remove();
|
1272 |
oldJs.remove();
|
1273 |
|
|
|
|
|
|
|
1274 |
// Add the new content.
|
1275 |
+
content.append( FLBuilder._renderLayoutCleanContent( data.html ) );
|
1276 |
|
1277 |
// Add the new layout js.
|
1278 |
setTimeout(function(){
|
1303 |
* @method _renderLayoutCleanContent
|
1304 |
* @private
|
1305 |
*/
|
1306 |
+
_renderLayoutCleanContent: function( html )
|
1307 |
{
|
1308 |
+
var cleaned = $( '<div id="fl-cleaned-content">' + html + '</div>' ),
|
1309 |
+
src = '',
|
1310 |
+
script = null;
|
1311 |
|
1312 |
+
cleaned.find( 'script' ).each( function() {
|
1313 |
+
|
1314 |
+
src = $( this ).attr( 'src' );
|
1315 |
+
script = $( 'script[src="' + src + '"]' );
|
1316 |
+
|
1317 |
+
if ( script.length > 0 ) {
|
1318 |
+
$( this ).remove();
|
1319 |
}
|
1320 |
+
});
|
1321 |
|
1322 |
+
return cleaned.html();
|
1323 |
},
|
1324 |
|
1325 |
/**
|
3633 |
FLBuilder._silentUpdate = true;
|
3634 |
}
|
3635 |
|
|
|
|
|
|
|
3636 |
// Send the post id to the server.
|
3637 |
data.post_id = $('#fl-post-id').val();
|
3638 |
|
3639 |
+
// Tell the server that the builder is active.
|
3640 |
+
data.fl_builder = 1;
|
3641 |
+
|
3642 |
// Append the builder namespace to the action.
|
3643 |
data.fl_action = data.action;
|
3644 |
|
3645 |
+
// Store the data in a single variable to avoid conflicts.
|
3646 |
+
data = { fl_builder_data: data };
|
3647 |
|
3648 |
// Do the ajax call.
|
3649 |
return $.post(FLBuilder._ajaxUrl(), data, function(response) {
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: justinbusa, RobbyMcCullough, billyyoung
|
3 |
Tags: builder, layout builder, page builder, website builder, site builder, front-end builder, drag and drop builder, editor, front-end editor, visual composer
|
4 |
Requires at least: 3.6
|
5 |
-
Tested up to: 4.
|
6 |
Stable tag: trunk
|
7 |
License: GPL2+
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
2 |
Contributors: justinbusa, RobbyMcCullough, billyyoung
|
3 |
Tags: builder, layout builder, page builder, website builder, site builder, front-end builder, drag and drop builder, editor, front-end editor, visual composer
|
4 |
Requires at least: 3.6
|
5 |
+
Tested up to: 4.1
|
6 |
Stable tag: trunk
|
7 |
License: GPL2+
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|