Skip to content

Commit

Permalink
Merge pull request #1116 from live-composer/release_1_5_32
Browse files Browse the repository at this point in the history
revert back changes 1.5.31 to 1.5.32
  • Loading branch information
nitin-blueastral committed Jan 25, 2024
2 parents 3db5df4 + 77d2c19 commit cf412fa
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 77 deletions.
4 changes: 2 additions & 2 deletions ds-live-composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://www.livecomposerplugin.com
* Description: Page builder for WordPress with drag and drop header/footer editing.
* Author: Live Composer Team
* Version: 1.5.31
* Version: 1.5.32
* Author URI: https://livecomposerplugin.com
* License: GPL3
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -41,7 +41,7 @@
* Constants
*/

define( 'DS_LIVE_COMPOSER_VER', '1.5.31' );
define( 'DS_LIVE_COMPOSER_VER', '1.5.32' );

define( 'DS_LIVE_COMPOSER_SHORTNAME', __( 'Live Composer', 'live-composer-page-builder' ) );
define( 'DS_LIVE_COMPOSER_BASENAME', plugin_basename( __FILE__ ) );
Expand Down
22 changes: 7 additions & 15 deletions includes/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
header( 'HTTP/1.0 403 Forbidden' );
exit;
}


/**
* Add/display a new module section
*
Expand Down Expand Up @@ -471,11 +473,7 @@ function dslc_ajax_import_template( $atts ) {

// The code of the template.
$template_code = stripslashes( $_POST['dslc_template_code'] );

if (!dslc_is_json( $template_code ) ) {
return 0;
exit;
}
$template_code = maybe_serialize($template_code);

$response['output'] = dslc_render_content( $template_code, true );

Expand Down Expand Up @@ -514,11 +512,6 @@ function dslc_ajax_save_template( $atts ) {
$template_id = strtolower( str_replace( ' ', '-', $template_title ) );
$template_code = stripslashes( $_POST['dslc_template_code'] );

if (!dslc_is_json($template_code) ) {
return 0;
exit;
}

// Get current templates.
$templates = get_option( 'dslc_templates' );

Expand All @@ -533,7 +526,7 @@ function dslc_ajax_save_template( $atts ) {
$templates[ $template_id ] = array(
'title' => $template_title,
'id' => $template_id,
'code' => $template_code,
'code' => maybe_serialize($template_code),
'section' => 'user',
);

Expand Down Expand Up @@ -612,10 +605,9 @@ function dslc_ajax_import_modules_section( $atts ) {

// The code of the modules section.
$code_to_import = stripslashes( $_POST['dslc_modules_section_code'] );
if (!dslc_is_json($code_to_import) ) {
return 0;
exit;
}

$code_to_import = maybe_serialize($code_to_import);

$response['output'] = dslc_render_content( $code_to_import, true );
$response['output'] = do_shortcode( $response['output'] );

Expand Down
103 changes: 45 additions & 58 deletions includes/display-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -942,13 +942,7 @@ function dslc_editor_code() {
* @return Bool True if JSON, false otherwise.
*/
function dslc_is_json( $string ) {

try {
json_decode( $string );
} catch (\Throwable $th) {
return false;
}

json_decode( $string );
return ( function_exists( 'json_last_error' ) && json_last_error() == JSON_ERROR_NONE );
}

Expand All @@ -962,61 +956,54 @@ function dslc_is_json( $string ) {
function dslc_json_decode( $raw_code, $ignore_migration = false ) {
$decoded = false;

if (dslc_is_json( $raw_code ) ) {
$decoded = json_decode( $raw_code, true );
}
else{
// $raw_code = maybe_unserialize( stripslashes($raw_code) );
$raw_code = maybe_unserialize( $raw_code );

// Array already provided. Do nothing.
if ( is_array( $raw_code ) ) {
return $raw_code;
}

// Is it JSON?
if ( ! dslc_is_json( $raw_code ) ) {
// If it's not JSON then:
// $raw_code = maybe_unserialize( stripslashes($raw_code) );
$raw_code = maybe_unserialize( $raw_code );

// Array already provided. Do nothing.
if ( is_array( $raw_code ) ) {
return $raw_code;
}

// Is it JSON?
if ( ! dslc_is_json( $raw_code ) ) {
// If it's not JSON then:
// 1. it's old code of the module settings serialized + base64.
// 2. it's old code containing both shortocodes + base64.
/**
* Is it's valid base64?
*
* Function base64_decode returns FALSE if input contains
* character from outside the base64 alphabet.
*/

$decoded_base64 = base64_decode( $raw_code );

// Base64 successfull?
if ( ! $decoded_base64 ) {
// 2. it's old code containing both shortocodes + base64
// We can do nothing with it, so return FALSE.
return false;
} else {
// 1. it's old code of the module settings serialized + base64.
// 2. it's old code containing both shortocodes + base64.
/**
* Is it's valid base64?
*
* Function base64_decode returns FALSE if input contains
* character from outside the base64 alphabet.
*/

$decoded_base64 = base64_decode( $raw_code );

// Base64 successfull?
if ( ! $decoded_base64 ) {
// 2. it's old code containing both shortocodes + base64
// We can do nothing with it, so return FALSE.
return false;
} else {
// 1. it's old code of the module settings serialized + base64.
// Get array out of it.
$decoded = maybe_unserialize( $decoded_base64 );

// Add a marker indicating that this module
// was imported from shortcode format.
if ( is_array( $decoded ) ) {
$decoded['code_version'] = 1;
}
// Get array out of it.
$decoded = maybe_unserialize( $decoded_base64 );

// Preset is always being stored in base64 format,
// so we need to ignore code version parameter as it's not relevant.
if ( $ignore_migration ) {
unset( $decoded['code_version'] );
}
// Add a marker indicating that this module
// was imported from shortcode format.
if ( is_array( $decoded ) ) {
$decoded['code_version'] = 1;
}
} else {
// Decode JSON.
$decoded = json_decode( $raw_code, true );
} // End if().

}

// Preset is always being stored in base64 format,
// so we need to ignore code version parameter as it's not relevant.
if ( $ignore_migration ) {
unset( $decoded['code_version'] );
}
}
} else {
// Decode JSON.
$decoded = json_decode( $raw_code, true );
} // End if().

return $decoded;
}
Expand Down
2 changes: 1 addition & 1 deletion js/dist/editor_backend.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: LiveComposer
Tags: page builder, landing page builder, frontend page builder, drag and drop page builder, website builder
Requires at least: 4.7
Tested up to: 6.4.2
Stable tag: 1.5.31
Stable tag: 1.5.32
License: GPLv3

Page builder for WordPress with drag and drop header/footer editing, responsive settings, and animations. Compatible with Gutenberg block editor.
Expand Down Expand Up @@ -58,6 +58,9 @@ In most of the cases, this is because the homepage is not a real WordPress page,
* 🦊 [Check out our WooCommerce Page Builder Extension](https://livecomposerplugin.com/downloads/woocommerce-page-builder/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=woo-integration)
* 👀 [We keep updating and improving our extensions pack](https://livecomposerplugin.com/downloads/extensions/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=add-ons) ACF + CPT + MegaMenu + 9 more add-ons.

= 1.5.32 - Jan 25 2024 =
* Reverted changes from Release 1.5.30 and 1.5.31

= 1.5.31 - Jan 24 2024 =
* Security improvements

Expand Down

0 comments on commit cf412fa

Please sign in to comment.