Skip to content

Commit

Permalink
4.6.8.1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Aug 1, 2024
1 parent 72f7712 commit 8f4c04d
Show file tree
Hide file tree
Showing 89 changed files with 15,221 additions and 503 deletions.
2 changes: 1 addition & 1 deletion all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs, business sites, ecommerce sites, and much more. More than 100 million downloads since 2007.
* Author: All in One SEO Team
* Author URI: https://aioseo.com/
* Version: 4.6.7
* Version: 4.6.8.1
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
*
Expand Down
2 changes: 2 additions & 0 deletions app/Common/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ public static function getDefaultSchemaOptions( $existingOptions = '', $post = n
'Movie' => [],
'Person' => [],
'Product' => [],
'ProductReview' => [],
'Car' => [],
'Recipe' => [],
'Service' => [],
'SoftwareApplication' => [],
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Sitemap/Image/ThirdParty.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private function kadenceBlocks() {
return [];
}

$blocks = parse_blocks( $this->post->post_content );
$blocks = aioseo()->helpers->parseBlocks( $this->post );

foreach ( $blocks as $block ) {
if ( 'kadence/advancedgallery' === $block['blockName'] && ! empty( $block['attrs']['ids'] ) ) {
Expand Down
61 changes: 61 additions & 0 deletions app/Common/Traits/Helpers/Wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,4 +837,65 @@ public function canRegisterLegacyWidget( $idBase ) {

return false;
}

/**
* Parses blocks for a given post.
*
* @since 4.6.8
*
* @param \WP_Post|int $post The post or post ID.
* @param bool $flattenBlocks Whether to flatten the blocks.
* @return array The parsed blocks.
*/
public function parseBlocks( $post, $flattenBlocks = true ) {
if ( ! is_a( $post, 'WP_Post' ) ) {
$post = aioseo()->helpers->getPost( $post );
}

static $parsedBlocks = [];
if ( isset( $parsedBlocks[ $post->ID ] ) ) {
return $parsedBlocks[ $post->ID ];
}

$parsedBlocks = parse_blocks( $post->post_content );

if ( $flattenBlocks ) {
$parsedBlocks = $this->flattenBlocks( $parsedBlocks );
}

$parsedBlocks[ $post->ID ] = $parsedBlocks;

return $parsedBlocks[ $post->ID ];
}

/**
* Flattens the given blocks.
*
* @since 4.6.8
*
* @param array $blocks The blocks.
* @return array The flattened blocks.
*/
public function flattenBlocks( $blocks ) {
$flattenedBlocks = [];

foreach ( $blocks as $block ) {
if ( ! empty( $block['innerBlocks'] ) ) {
// Flatten inner blocks first.
$innerBlocks = $this->flattenBlocks( $block['innerBlocks'] );
unset( $block['innerBlocks'] );

// Add the current block to the result.
$flattenedBlocks[] = $block;

// Add the flattened inner blocks to the result.
$flattenedBlocks = array_merge( $flattenedBlocks, $innerBlocks );
} else {
// If no inner blocks, just add the block to the result.
$flattenedBlocks[] = $block;
}
}

return $flattenedBlocks;
}
}
836 changes: 836 additions & 0 deletions app/Lite/Views/taxonomy-upsell.html

Large diffs are not rendered by default.

Loading

0 comments on commit 8f4c04d

Please sign in to comment.