PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.0.41
Post Grid Gutenberg Blocks – PostX v5.0.41
5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 All 238 releases
← All changes | classes/Blocks.php +40 -6 5.0.195.0.41 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +// phpcs:ignore
3 +// @codingStandardsIgnoreFile
4 +// @ignoreWarnings
2 5 /**
3 6 * Require All Blocks and handle block ajax action
4 7 *
5 8 * @package ULTP\Blocks
@@ -6,9 +9,8 @@
6 9 * @since 4.1.11
7 10 */
8 11
9 12 namespace ULTP;
10 -
11 13 defined( 'ABSPATH' ) || exit;
12 14
13 15 /**
14 16 * Blocks class.
@@ -592,8 +594,19 @@
592 594 * @return ARRAY
593 595 */
594 596 public function filter_content_return( $blocks, $blockId, $blockRaw, $blockName, $taxtype, $taxonomy, $postId, &$toReturn, $widgetBlockId = '', $adv_filter_data = array(), $ultp_uniqueIds = array(), $ultp_current_unique_posts = array() ) {
595 597 foreach ( $blocks as $key => $value ) {
598 + if ( ( $value['blockName'] ?? '' ) === 'core/shortcode' ) {
599 + if ( preg_match( '/id="([^"]+)"/', $value['innerHTML'] ?? '', $matches ) ) {
600 + $template_post = get_post( $matches[1] );
601 + if ( $template_post && ! empty( $template_post->post_content ) ) {
602 + $template_blocks = parse_blocks( $template_post->post_content );
603 + // recurse into the expanded blocks instead
604 + $this->filter_content_return( $template_blocks, $blockId, $blockRaw, $blockName, $taxtype, $taxonomy, $postId, $toReturn, $widgetBlockId, $adv_filter_data, $ultp_uniqueIds, $ultp_current_unique_posts );
605 + continue; // skip the shortcode block itself
606 + }
607 + }
608 + }
596 609 if ( $blockName == $value['blockName'] ) {
597 610 if ( $value['attrs']['blockId'] == $blockId ) {
598 611 $objName = str_replace( ' ', '_', ucwords( str_replace( array( 'ultimate-post/', '-' ), array( '', ' ' ), $blockName ) ) );
599 612 $new_obj = '\ULTP\blocks\\' . $objName;
@@ -642,18 +655,21 @@
642 655 $filter_attributes['queryTax'] = $taxtype;
643 656
644 657 if ( $filter_attributes['isAdv'] ) {
645 658 $filter_attributes['queryAuthor'] = $adv_filter_data['author'];
646 - $filter_attributes['queryOrderBy'] = ! empty( $adv_filter_data['orderby'] ) ? $adv_filter_data['orderby'] : $value['attrs']['queryOrderBy'];
647 659 $filter_attributes['queryOrder'] = $adv_filter_data['order'];
648 660 $filter_attributes['querySearch'] = $adv_filter_data['search'];
649 661 $filter_attributes['queryQuick'] = $adv_filter_data['adv_sort'];
662 + $filter_attributes['queryOrderBy'] =
663 + ! empty( $adv_filter_data['orderby'] ) ? $adv_filter_data['orderby'] : ( $value['attrs']['queryOrderBy'] ?? '' );
650 664 }
651 -
665 + $pagination = $this->pagination_for_filter( $attr, $postId, $blockRaw, $filter_attributes );
652 666 $toReturn = array(
653 667 'blocks' => $objectBlock->content( $attr, true ),
654 668 'notFound' => isset( $attr['notFoundMessage'] ) ? $attr['notFoundMessage'] : '',
655 - 'pagination' => $this->pagination_for_filter( $attr, $postId, $blockRaw, $filter_attributes ),
669 + 'pagination' => $pagination['pagination_content'],
670 + 'data_attrs' => $pagination['data_attrs'],
671 + 'data_all_attrs' => $pagination['data_attrs'],
656 672 'paginationType' => $attr['paginationType'],
657 673 'paginationShow' => $attr['paginationShow'],
658 674 );
659 675 }
@@ -709,10 +725,28 @@
709 725
710 726 $wraper_after .= '</div>';
711 727 }
712 728 wp_reset_query();
713 -
714 - return $wraper_after;
729 +
730 + // queryQuick
731 + return array(
732 + 'pagination_content' => $wraper_after,
733 + 'data_attrs' => wp_json_encode( array(
734 + 'paged' => 1,
735 + 'blockid' => $attr['blockId'],
736 + 'postid' => $postId,
737 + 'pages' => $pageNum,
738 + 'blockname' => $blockRaw,
739 + 'filter_value' => isset( $filter_attributes['queryTaxValue'] ) ? $filter_attributes['queryTaxValue'] : '',
740 + 'filter_type' => isset( $filter_attributes['queryTax'] ) ? $filter_attributes['queryTax'] : '',
741 + 'filter_author' => isset( $filter_attributes['queryAuthor'] ) ? $filter_attributes['queryAuthor'] : '',
742 + 'filter_order' => isset( $filter_attributes['queryOrder'] ) ? $filter_attributes['queryOrder'] : 'DESC',
743 + 'filter_orderby' => isset( $filter_attributes['queryOrderBy'] ) ? $filter_attributes['queryOrderBy'] : '',
744 + 'filter_search' => isset( $filter_attributes['querySearch'] ) ? $filter_attributes['querySearch'] : '',
745 + 'filter_queryQuick' => isset( $filter_attributes['queryQuick'] ) ? $filter_attributes['queryQuick'] : '',
746 + 'filter_for' => 'ultp-block-' . $attr['blockId'],
747 + )),
748 + );
715 749 }
716 750
717 751 /**
718 752 * Nonce Generation Callback