Skip to content

Commit

Permalink
Merge branch 'release/2.29.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Jul 21, 2024
2 parents 14ef83f + a93188d commit 4f1b40c
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 18 deletions.
43 changes: 43 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
== Changelog ==

= 2.29.19 – 21 July June 2024 =
* Further improvements for attribute name handling.
* Layout Directory: Resolved an issue with fetching page two.

= 2.29.18 – 29 June 2024 =
* Improved attribute name handling.
* Layout Block: Improved preview updating.
* Widget Groups: Resolved a potential `TypeError`.
* Vantage Compatibility: Resolved a potential `TypeError`.

= 2.29.17 – 15 June 2024 =
* Layout Builder: Default the modal icon to "Cog".
* Layouts Block: Added an additional check for clearing potential block errors.
* Row Overlays: Resolved a potential Column/Widget video content overlap.
* Row Cell Preview: Adjusted the percentage symbol placement.
* Updated escaping functions to use translatable versions where needed.
* Updated SiteOrigin Installer.
* Number Style Field: Added min/max support.

= 2.29.16 – 13 May 2024 =
* Adjusted Add Widget modal sidebar link order and display.
* Restored WP Events Manager compatibility.
* Resolved fallback shortcode decoding issue.
* Added Layout Directory caching for better performance.
* Increased required PHP version to `7.0.0`.
* Developer: Improved `panelsOptions` translation handling.

= 2.29.15 – 27 April 2024 =
* Layout Block: Further improvements to preview functionality and performance.
* Admin Area: Update to ensure Classic Editor notice is translatable.

= 2.29.14 – 26 April 2024 =
* Layout Block: Restored preview functionality.

= 2.29.13 – 21 April 2024 =
* Rank Math SEO Compatibility: Resolved dependency error.

= 2.29.12 – 19 April 2024 =
* Layout Block: Improved preview.
* Layout Block: Fix repeated rendering when switching to editor.
* Layout Block: Restored data integration for SEO content analysis.
* Post Content Widget: Added "Content" option.

= 2.29.11 – 31 March 2024 =
* Post Content Widget: Fixed post featured image output.
* Post Content Widget: Remove unused content and improved title output.
Expand Down
12 changes: 7 additions & 5 deletions compat/js/siteorigin-panels-layout-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,16 @@ function (_wp$element$Component) {

if (!this.isStillMounted) {
return;
} // If we don't have panelsData yet, fetch it from PB directly.

}

var panelsData = props.panelsData === null ? this.builderView.getData() : props.panelsData;
this.setState({
previewInitialized: false
});
var fetchRequest = this.currentFetchRequest = jQuery.post({
url: window.soPanelsBlockEditorAdmin.previewUrl,
data: {
action: 'so_panels_layout_block_preview',
panelsData: JSON.stringify(panelsData)
panelsData: JSON.stringify(this.builderView.getData())
}
}).then(function (preview) {
if (!_this4.isStillMounted) {
Expand Down Expand Up @@ -392,7 +390,11 @@ wp.blocks.registerBlockType('siteorigin-panels/layout-block', {
panelsAttributes.contentPreview = content.preview;
}

setAttributes(panelsAttributes);
setAttributes({
contentPreview: panelsAttributes.contentPreview,
panelsData: panelsAttributes.panelsData,
previewInitialized: false
});

if (!isNewWPBlockEditor) {
wp.data.dispatch('core/editor').unlockPostSaving();
Expand Down
11 changes: 6 additions & 5 deletions compat/js/siteorigin-panels-layout-block.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ class SiteOriginPanelsLayoutBlock extends wp.element.Component {
return;
}

// If we don't have panelsData yet, fetch it from PB directly.
var panelsData = props.panelsData === null ? this.builderView.getData() : props.panelsData;

this.setState( {
previewInitialized: false,
} );
Expand All @@ -200,7 +197,7 @@ class SiteOriginPanelsLayoutBlock extends wp.element.Component {
url: window.soPanelsBlockEditorAdmin.previewUrl,
data: {
action: 'so_panels_layout_block_preview',
panelsData: JSON.stringify( panelsData ),
panelsData: JSON.stringify( this.builderView.getData() ),
}
} )
.then( ( preview ) => {
Expand Down Expand Up @@ -354,7 +351,11 @@ wp.blocks.registerBlockType( 'siteorigin-panels/layout-block', {
panelsAttributes.contentPreview = content.preview;
}

setAttributes( panelsAttributes );
setAttributes( {
contentPreview: panelsAttributes.contentPreview,
panelsData: panelsAttributes.panelsData,
previewInitialized: false,
} );

if ( ! isNewWPBlockEditor ) {
wp.data.dispatch( 'core/editor' ).unlockPostSaving();
Expand Down
9 changes: 8 additions & 1 deletion compat/vantage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php
function siteorigin_panels_vantage_row_style_attributes( $attributes, $style ) {
if ( empty( $style['class'] ) ) {
return $attributes;
}

if ( isset( $style['class'] ) && $style['class'] == 'wide-grey' && ! empty( $attributes['style'] ) ) {
$attributes['style'] = preg_replace( '/padding-left: 1000px; padding-right: 1000px;/', '', $attributes['style'] );
}
Expand All @@ -11,7 +15,10 @@ function siteorigin_panels_vantage_row_style_attributes( $attributes, $style ) {
// Ensure all full width stretched rows have padding.
// This will prevent a situation where the content is squished.
function siteorigin_panels_vantage_full_width_stretch( $data, $post_id ) {
if ( empty( $data['grids'] ) ) {
if (
! is_array( $data ) ||
empty( $data['grids'] )
) {
return $data;
}

Expand Down
3 changes: 2 additions & 1 deletion inc/admin-layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ public function action_get_prebuilt_layouts() {
}

$cache = get_transient( 'siteorigin_panels_layouts_directory_' . $directory_id .'_page_' . $page_num );

if ( empty( $search ) && ! empty( $cache ) ) {
$return = $cache;
} else {
Expand All @@ -265,7 +266,7 @@ public function action_get_prebuilt_layouts() {
}

$url = apply_filters( 'siteorigin_panels_layouts_directory_url', $url );
$response = wp_remote_get( esc_url( $url ) );
$response = wp_remote_get( esc_url_raw( $url ) );

if (
! is_wp_error( $response ) &&
Expand Down
1 change: 1 addition & 0 deletions inc/admin-widget-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public function add_widgets_dialog_tabs( $tabs ) {
foreach ( $widgets as $widgetName => $widgetData ) {
if (
isset( $widgetData['groups'] ) &&
is_array( $widgetData['groups'] ) &&
in_array( 'recommended', $widgetData['groups'] )
) {
$recommendedWidgets[ $widgetName ] = $widgetData;
Expand Down
25 changes: 21 additions & 4 deletions inc/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@ private function start_style_wrapper( $name, $style = array(), $for = false ) {
}

if ( is_array( $value ) ) {
$style_wrapper .= $name . '="' . esc_attr( implode( ' ', array_unique( $value ) ) ) . '" ';
$style_wrapper .= $this->sanitize_attribute_key( $name ) . '="' . esc_attr( implode( ' ', array_unique( $value ) ) ) . '" ';
} else {
$style_wrapper .= $name . '="' . esc_attr( $value ) . '" ';
$style_wrapper .= $this->sanitize_attribute_key( $name ) . '="' . esc_attr( $value ) . '" ';
}
}
$style_wrapper .= '>';
Expand Down Expand Up @@ -810,7 +810,7 @@ public function the_widget( $widget_info, $instance, $grid_index, $cell_index, $
$before_widget = '<div ';

foreach ( $attributes as $k => $v ) {
$before_widget .= esc_attr( $k ) . '="' . esc_attr( $v ) . '" ';
$before_widget .= $this->sanitize_attribute_key( $k ) . '="' . esc_attr( $v ) . '" ';
}
$before_widget .= '>';

Expand Down Expand Up @@ -1014,7 +1014,7 @@ private function render_element( $tag, $attributes ) {

foreach ( $attributes as $name => $value ) {
if ( $value ) {
echo ' ' . esc_html( $name ) . '="' . esc_attr( $value ) . '" ';
echo ' ' . $this->sanitize_attribute_key( $name ) . '="' . esc_attr( $value ) . '" ';
}
}
echo '>';
Expand Down Expand Up @@ -1231,4 +1231,21 @@ public function front_css_url() {
return siteorigin_panels_url( 'css/front-flex' . SITEORIGIN_PANELS_CSS_SUFFIX . '.css' );
}

function sanitize_attribute_key( $attr = null ) {
if ( empty( $attr ) ) {
return 'invalid-attribute';
}

$attr = sanitize_key( strtolower( $attr ) );

// "On" prefixed attributes are too risky to allow.
if (
empty( $attr ) ||
strpos( $attr, 'on' ) === 0
) {
return 'invalid-attribute';
};

return $attr;
}
}
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Page Builder by SiteOrigin ===
Tags: page builder, website builder, responsive design, drag and drop, visual editor
Requires at least: 4.7
Tested up to: 6.5
Tested up to: 6.6
Requires PHP: 7.0.0
Stable tag: trunk
Build time: unbuilt
Expand Down Expand Up @@ -121,6 +121,16 @@ SiteOrigin offers a single premium plugin that enhances and extends Page Builder

== Changelog ==

= 2.29.19 – 21 July June 2024 =
* Further improvements for attribute name handling.
* Layout Directory: Resolved an issue with fetching page two.

= 2.29.18 – 29 June 2024 =
* Improved attribute name handling.
* Layout Block: Improved preview updating.
* Widget Groups: Resolved a potential `TypeError`.
* Vantage Compatibility: Resolved a potential `TypeError`.

= 2.29.17 – 15 June 2024 =
* Layout Builder: Default the modal icon to "Cog".
* Layouts Block: Added an additional check for clearing potential block errors.
Expand Down
3 changes: 3 additions & 0 deletions siteorigin-panels.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ public function version_check() {
if ( empty( $active_version ) || $active_version !== SITEORIGIN_PANELS_VERSION ) {
do_action( 'siteorigin_panels_version_changed' );
update_option( 'siteorigin_panels_active_version', SITEORIGIN_PANELS_VERSION );

// Clear layout directory cache after update to account for bug in versions 2.29.18 and below.
delete_transient( 'siteorigin_panels_layouts_directory_siteorigin_page_2' );
}
}

Expand Down
2 changes: 1 addition & 1 deletion widgets/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public function widget( $args, $instance ) {
if ( empty( $v ) ) {
continue;
}
$shortcode_attr[] = esc_html( $k ) . '="' . esc_attr( $v ) . '"';
$shortcode_attr[] = sanitize_key( $k ) . '="' . esc_attr( $v ) . '"';
}

echo do_shortcode( '[gallery ' . implode( ' ', $shortcode_attr ) . ']' );
Expand Down

0 comments on commit 4f1b40c

Please sign in to comment.