Skip to content

Commit

Permalink
Merge branch 'release/2.31.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Feb 2, 2025
2 parents 6e2eb20 + aa84478 commit 62cd181
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 352 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
== Changelog ==

= 2.31.4 – 02 February 2025 =
* Added Compatibility for Events Manager.
* AIOSEO: Loaded plugin widgets.
* Refactored SEO plugin compatibility and restored Yoast Block Editor content parsing.
* Layout Directory: Resolved incorrect empty search after search query.
* WPML: Adjusted editor labels for the WPML 4.7 release.

= 2.31.3 – 20 December 2024 =
* WPML: Improved compatibility by excluding `panels_data` field from automatic translation handling.
* Prebuilt Layouts: Added text/html to accepted mime types for layout exports.
Expand Down
12 changes: 12 additions & 0 deletions compat/aioseo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
// AIOSEO compatibility. We need to add their widgets to a sidebar
// to ensure they're useable in Page Builder.
function siteorigin_panels_load_aioseo_widgets( $sidebars = array() ) {
$sidebars['aio_pb_compat'] = array(
'aioseo-breadcrumb-widget',
'aioseo-html-sitemap-widget',
);

return $sidebars;
}
add_filter( 'sidebars_widgets', 'siteorigin_panels_load_aioseo_widgets', 10, 1 );
55 changes: 55 additions & 0 deletions compat/events-manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
if ( ! function_exists( 'em_content' ) ) {
return;
}

$em_pb_removed = false;

/**
* Disable Page Builder for Events Manager post types.
*
* This function checks if the current post is an Events Manager post type
* and if Page Builder is enabled for it. If both conditions are met, it
* disables Page Builder for the content. This is done to prevent Page Builder
* from interfering with the Events Manager content, and vice versa.
*
* `loop_start` is used due to when the Events Manager plugin sets up its
* content replacement.
*
* @return void
*/
function siteorigin_panels_event_manager_loop_start() {
$em_post_types = array( 'event-recurring', 'event' );

// Is the current post an $em_post_types post?
$post_type = get_post_type();
if ( ! in_array( $post_type, $em_post_types ) ) {
return;
}

// Is Page Builder enabled for Events Manager post types?
$pb_post_types = siteorigin_panels_setting( 'post-types' );
if ( empty( $pb_post_types ) || ! array_intersect( $em_post_types, $pb_post_types ) ) {
return;
}

global $em_pb_removed;
$em_pb_removed = true;

add_filter( 'siteorigin_panels_filter_content_enabled', '__return_false' );
}
add_action( 'loop_start', 'siteorigin_panels_event_manager_loop_start' );

/**
* Re-enable Page Builder for `the_content` filter if it
* was disabled at the start of the loop.
*/
function siteorigin_panels_event_manager_loop_end() {
global $em_pb_removed;

if ( $em_pb_removed ) {
remove_filter( 'siteorigin_panels_filter_content_enabled', '__return_false' );
}

}
add_action( 'loop_end' , 'siteorigin_panels_event_manager_loop_end' );
20 changes: 15 additions & 5 deletions inc/admin-layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,17 @@ public function action_get_prebuilt_layouts() {
return false;
}

$cache = get_transient( 'siteorigin_panels_layouts_directory_' . $directory_id .'_page_' . $page_num );
// If the user isn't searching, check if we have a cached
// version of the results.
if ( empty( $search ) ) {
$cache = get_transient( 'siteorigin_panels_layouts_directory_cache_' . $directory_id .'_page_' . $page_num );

if ( empty( $search ) && ! empty( $cache ) ) {
$return = $cache;
} else {
if ( ! empty( $cache ) ) {
$return = $cache;
}
}

if ( empty( $return['items'] ) ) {
$url = add_query_arg( $query, $directory[ 'url' ] . 'wp-admin/admin-ajax.php?action=query_layouts' );

if ( ! empty( $directory['args'] ) && is_array( $directory['args'] ) ) {
Expand Down Expand Up @@ -319,7 +325,11 @@ public function action_get_prebuilt_layouts() {
}

$return['max_num_pages'] = $results['max_num_pages'];
set_transient( 'siteorigin_panels_layouts_directory_' . $directory_id .'_page_' . $page_num, $return, 86400 );

// If the user isn't searching, cache the results.
if ( empty( $search ) ) {
set_transient( 'siteorigin_panels_layouts_directory_cache_' . $directory_id .'_page_' . $page_num, $return, 86400 );
}
}
}
} elseif ( strpos( $type, 'clone_' ) !== false ) {
Expand Down
6 changes: 3 additions & 3 deletions inc/admin-widget-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function add_widgets_dialog_tabs( $tabs ) {
if ( defined( 'WOOCOMMERCE_VERSION' ) ) {
$tabs[] = array(
// TRANSLATORS: The name of WordPress plugin
'title' => __( 'WooCommerce', 'woocommerce' ),
'title' => __( 'WooCommerce', 'siteorigin-panels' ),
'filter' => array(
'groups' => array( 'woocommerce' ),
),
Expand All @@ -176,7 +176,7 @@ public function add_widgets_dialog_tabs( $tabs ) {
if ( defined( 'JETPACK__VERSION' ) ) {
$tabs[] = array(
// TRANSLATORS: The name of WordPress plugin
'title' => __( 'Jetpack', 'jetpack' ),
'title' => __( 'Jetpack', 'siteorigin-panels' ),
'filter' => array(
'groups' => array( 'jetpack' ),
),
Expand All @@ -187,7 +187,7 @@ public function add_widgets_dialog_tabs( $tabs ) {
if ( function_exists( 'bbpress' ) ) {
$tabs[] = array(
// TRANSLATORS: The name of WordPress plugin
'title' => __( 'BBPress', 'bbpress' ),
'title' => __( 'BBPress', 'siteorigin-panels' ),
'filter' => array(
'groups' => array( 'bbpress' ),
),
Expand Down
17 changes: 15 additions & 2 deletions inc/compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ class SiteOrigin_Panels_Compatibility {

public function __construct() {
$this->compat_path = plugin_dir_path( SITEORIGIN_PANELS_BASE_FILE ) . 'compat/';
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'init', array( $this, 'init' ), 100 );
add_action( 'admin_init', array( $this, 'admin_init' ), 10, 0 );
add_action( 'init', array( $this, 'init' ), 100, 0 );
add_action( 'widgets_init', array( $this, 'widgets_init' ), 1, 0 );
}

public static function single() {
Expand Down Expand Up @@ -115,5 +116,17 @@ function_exists( 'yoast_wpseo_video_seo_init' )
if ( class_exists( 'PUM_Site' )) {
require_once $this->compat_path . 'popup-maker.php';
}

// Compatibility with Events Manager.
if ( defined( 'EM_VERSION' ) ) {
require_once $this->compat_path . 'events-manager.php';
}
}

public function widgets_init() {
// Compatibility for All in One SEO.
if ( function_exists( 'aioseo' ) ) {
require_once $this->compat_path . 'aioseo.php';
}
}
}
63 changes: 45 additions & 18 deletions inc/styles-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public function render_styles_fields( $section, $before = '', $after = '', $curr
?>
<div class="style-section-wrapper">
<div class="style-section-head" tabindex="0">
<h4><?php esc_html_e( $group['name'] ); ?></h4>
<h4>
<?php echo esc_html( $group['name'] ); ?>
</h4>
</div>
<div class="style-section-fields" style="display: none">
<?php
Expand All @@ -173,7 +175,7 @@ public function render_styles_fields( $section, $before = '', $after = '', $curr
<div class="style-field-wrapper so-field-<?php echo esc_attr( $field_id ); ?>">
<?php if ( ! empty( $field['name'] ) ) { ?>
<label>
<?php esc_html_e( $field['name'] ); ?>
<?php echo esc_html( $field['name'] ); ?>
</label>
<?php } ?>
<div
Expand Down Expand Up @@ -235,8 +237,9 @@ public function render_style_field( $field, $current, $field_id, $current_styles
<select
class="measurement-unit measurement-unit-<?php echo ! empty( $field['multiple'] ) ? 'multiple' : 'single'; ?>">
<?php foreach ( $this->measurements_list() as $measurement ) { ?>
<option
value="<?php echo esc_attr( $measurement ); ?>"><?php esc_html_e( $measurement ); ?></option>
<option value="<?php echo esc_attr( $measurement ); ?>">
<?php echo esc_html( $measurement ); ?>
</option>
<?php } ?>
</select>
<input type="hidden" name="<?php echo esc_attr( $field_name ); ?>"
Expand Down Expand Up @@ -317,12 +320,19 @@ class="image-fallback widefat" />
?>
<select name="<?php echo esc_attr( $field_name ); ?>">
<?php foreach ( $sizes as $size_name => $size_config ) { ?>
<?php $sizing_label = ! empty( $size_config['width'] ) && is_numeric( $size_config['width'] ) ? ' (' . $size_config['width'] . 'x' . $size_config['height'] . ')' : ''; ?>
<?php
$sizing_label = ! empty( $size_config['width'] ) && is_numeric( $size_config['width'] ) ? ' (' . $size_config['width'] . 'x' . $size_config['height'] . ')' : '';
?>
<option
value="<?php echo esc_attr( $size_name ); ?>"
<?php selected( $current, $size_name ); ?>
>
<?php esc_html_e( ucwords( preg_replace( '/[-_]/', ' ', $size_name ) ) . $sizing_label ); ?>
<?php
echo esc_html(
ucwords( preg_replace( '/[-_]/', ' ', $size_name ) ) .
$sizing_label
);
?>
</option>
<?php } ?>
</select>
Expand Down Expand Up @@ -363,7 +373,9 @@ class="image-fallback widefat" />
?>
<label class="so-checkbox-label">
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" <?php checked( $current ); ?> />
<?php esc_html_e( isset( $field['label'] ) ? $field['label'] : __( 'Enabled', 'siteorigin-panels' ) ); ?>
<?php
echo esc_html( isset( $field['label'] ) ? $field['label'] : __( 'Enabled', 'siteorigin-panels' ) );
?>
</label>
<?php
break;
Expand All @@ -373,7 +385,11 @@ class="image-fallback widefat" />
<select name="<?php echo esc_attr( $field_name ); ?>">
<?php foreach ( $field['options'] as $k => $v ) { ?>
<option
value="<?php echo esc_attr( $k ); ?>" <?php selected( $current, $k ); ?>><?php esc_html_e( $v ); ?></option>
value="<?php echo esc_attr( $k ); ?>"
<?php selected( $current, $k ); ?>
>
<?php echo esc_html( $v ); ?>
</option>
<?php } ?>
</select>
<?php
Expand Down Expand Up @@ -403,27 +419,38 @@ class="image-fallback widefat" />
foreach ( $field['options'] as $k => $v ) {
?>
<label for="<?php echo esc_attr( $radio_id . '-' . $k ); ?>">
<input type="radio" name="<?php echo esc_attr( $radio_id ); ?>"
id="<?php echo esc_attr( $radio_id . '-' . $k ); ?>"
value="<?php echo esc_attr( $k ); ?>" <?php checked( $k, $current ); ?>> <?php esc_html_e( $v ); ?>
<input
type="radio"
name="<?php echo esc_attr( $radio_id ); ?>"
id="<?php echo esc_attr( $radio_id . '-' . $k ); ?>"
value="<?php echo esc_attr( $k ); ?>" <?php checked( $k, $current ); ?>
>
<?php echo esc_html( $v ); ?>
</label>
<?php
}
break;

case 'textarea' :
case 'code' :
?><textarea type="text" name="<?php echo esc_attr( $field_name ); ?>"
class="widefat <?php if ( $field['type'] == 'code' ) {
echo 'so-field-code';
} ?>" rows="4"><?php echo esc_textarea( stripslashes( $current ) ); ?></textarea><?php
?><textarea
type="text"
name="<?php echo esc_attr( $field_name ); ?>"
class="widefat <?php if ( $field['type'] == 'code' ) {
echo 'so-field-code';
} ?>"
rows="4"
><?php
echo esc_textarea( stripslashes( $current ) );
?></textarea>
<?php
break;

case 'toggle' :
$current = (bool) $current;
?>

<?php esc_html_e( isset( $field['label'] ) ? $field['label'] : '' ); ?>
echo esc_html( isset( $field['label'] ) ? $field['label'] : '' );
?>
<label class="so-toggle-switch">
<input class="so-toggle-switch-input" type="checkbox" <?php checked( $current ); ?> name="<?php echo esc_attr( $field_name ); ?>">
<span class="so-toggle-switch-label" data-on="<?php esc_attr_e( 'On', 'siteorigin-panels' ); ?>" data-off="<?php esc_attr_e( 'Off', 'siteorigin-panels' ); ?>"></span>
Expand All @@ -437,7 +464,7 @@ class="widefat <?php if ( $field['type'] == 'code' ) {
<div class="style-field-wrapper so-field-<?php echo esc_attr( $sub_field_id ); ?>">
<?php if ( ! empty( $sub_field['name'] ) ) { ?>
<label>
<?php esc_html_e( $sub_field['name'] ); ?>
<?php echo esc_html( $sub_field['name'] ); ?>
</label>
<?php } ?>
<div
Expand Down
10 changes: 5 additions & 5 deletions inc/styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,14 @@ public function add_overlay( $html, $context ) {
?>
<div
class="panel-background-overlay"
<?php if ( ! empty( $styles ) ) { ?>
style="
<?php
<?php
if ( ! empty( $styles ) ) {
$style_attr = '';
foreach ( $styles as $p => $v ) {
esc_attr_e( $p . ':' . $v . ';' );
$style_attr .= $p . ':' . $v . ';';
}
?>
"
style="<?php echo esc_attr( $style_attr ); ?>"
<?php } ?>
>
<?php echo apply_filters( 'siteorigin_panels_overlay_content', '', $context, ! empty( $custom_overlay ) ); ?>
Expand Down
4 changes: 2 additions & 2 deletions inc/widgets/post-loop-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function __construct( $templates ) {
),
'more' => array(
'type' => 'checkbox',
'label' => __( 'More link', 'so-widgets-bundle' ),
'label' => __( 'More link', 'siteorigin-panels' ),
'description' => __( 'If the template supports it, cut posts and display the more link.', 'siteorigin-panels' ),
'default' => false,
),
'posts' => array(
'type' => 'posts',
'label' => __( 'Posts query', 'so-widgets-bundle' ),
'label' => __( 'Posts query', 'siteorigin-panels' ),
'hide' => true,
),
)
Expand Down
Loading

0 comments on commit 62cd181

Please sign in to comment.