Skip to content

Commit

Permalink
Merge branch 'release/2.16.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Mar 30, 2022
2 parents c68014a + 67d6200 commit 8194b1b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
17 changes: 16 additions & 1 deletion inc/admin-layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,27 @@ private function get_layout_id( $layout_data, $fallback ) {
return $fallback;
}
}

static private function get_files( $folder_path, $file_name ) {
$paths = array();
$types = array (
'jpg',
'jpeg',
'gif',
'png',
);
foreach ( $types as $ext ) {
$paths = array_merge( glob( $folder_path . "/$file_name.$ext" ), $paths );
}

return $paths;
}

private function get_layout_file_screenshot( $panels_data, $folder_path, $file_name ) {
if ( ! empty( $panels_data['screenshot'] ) ) {
return $panels_data['screenshot'];
} else {
$paths = glob( $folder_path . "/$file_name.{jpg,jpeg,gif,png}", GLOB_BRACE );
$paths = self::get_files( $folder_path, $file_name );
// Highlander Condition. There can be only one.
$screenshot_path = empty( $paths ) ? '' : wp_normalize_path( $paths[0] );
$wp_content_dir = wp_normalize_path( WP_CONTENT_DIR );
Expand Down
8 changes: 6 additions & 2 deletions inc/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ function render( $post_id = false, $enqueue_css = true, $panels_data = false, &
echo apply_filters( 'siteorigin_panels_before_content', '', $panels_data, $post_id );

foreach ( $layout_data as $ri => & $row ) {
$this->render_row( $post_id, $ri, $row, $panels_data );
if ( apply_filters( 'siteorigin_panels_output_row', true, $row, $ri, $panels_data, $post_id ) ) {
$this->render_row( $post_id, $ri, $row, $panels_data );
}
}

echo apply_filters( 'siteorigin_panels_after_content', '', $panels_data, $post_id );
Expand Down Expand Up @@ -1018,7 +1020,9 @@ private function render_cell( $post_id, $ri, $ci, & $cell, $cells, & $panels_dat

foreach ( $cell['widgets'] as $wi => & $widget ) {
$is_last = ( $wi == count( $cell['widgets'] ) - 1 );
$this->render_widget( $post_id, $ri, $ci, $wi, $widget, $is_last );
if ( apply_filters( 'siteorigin_panels_output_widget', true, $widget, $ri, $ci, $wi, $panels_data, $post_id ) ) {
$this->render_widget( $post_id, $ri, $ci, $wi, $widget, $is_last );
}
}

// This allows other themes and plugins to add HTML inside of the cell after its contents.
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ SiteOrigin Premium includes access to our professional email support service, pe

== Changelog ==

= 2.16.8 - 30 March 2022 =
* Improved PHP 8 Compatibility: Replaced `GLOB_BRACE` flag in favor of multiple `glob` functions.
* Developer: Added `siteorigin_panels_output_row` and `siteorigin_panels_output_widget` filters.

= 2.16.7 - 23 March 2022 =
* Improved empty CSS rule check to avoid potential edge cases.

Expand Down

0 comments on commit 8194b1b

Please sign in to comment.