Plugin Directory

Changeset 3676771


Ignore:
Timestamp:
09/01/2026 07:57:00 PM (3 months ago)
Author:
m9729640633
Message:

Release 0.2.6: add Why You'll Love This inner-block container

Location:
mubly-blocks
Files:
8 added
2 edited
34 copied

Legend:

Unmodified
Added
Removed
  • mubly-blocks/tags/0.2.6/mubly-blocks.php

    r3657735 r3676771  
    33 * Plugin Name: Mubly Blocks
    44 * Description: Practical editor blocks for publishers, creators, and site owners.
    5  * Version: 0.2.5
     5 * Version: 0.2.6
    66 * Author: Mohit Chawla
     7 * Author URI: https://mycloudworld.com
    78 * Requires at least: 6.4
    89 * Requires PHP: 7.4
    … …  
    1617}
    1718
    18 define( 'MUBLY_VERSION', '0.2.5' );
     19define( 'MUBLY_VERSION', '0.2.6' );
    1920define( 'MUBLY_FILE', __FILE__ );
    2021define( 'MUBLY_DIR', plugin_dir_path( __FILE__ ) );
    … …  
    2223
    2324add_filter( 'block_categories_all', 'mubly_register_block_category' );
     25add_filter( 'plugin_row_meta', 'mubly_set_author_link_target', 20, 2 );
    2426add_action( 'init', 'mubly_register_blocks' );
     27
     28/**
     29 * Open the Mubly Blocks author link in a new tab.
     30 *
     31 * @param string[] $plugin_meta Plugin metadata links.
     32 * @param string   $plugin_file Plugin file relative to the plugins directory.
     33 * @return string[]
     34 */
     35function mubly_set_author_link_target( $plugin_meta, $plugin_file ) {
     36        if ( plugin_basename( MUBLY_FILE ) !== $plugin_file ) {
     37                return $plugin_meta;
     38        }
     39
     40        $author_url  = 'https://mycloudworld.com';
     41        $current     = '<a href="' . esc_url( $author_url ) . '">';
     42        $replacement = '<a href="' . esc_url( $author_url ) . '" target="_blank" rel="noopener noreferrer">';
     43
     44        foreach ( $plugin_meta as $index => $meta ) {
     45                $plugin_meta[ $index ] = str_replace( $current, $replacement, $meta );
     46        }
     47
     48        return $plugin_meta;
     49}
    2550
    2651function mubly_register_block_category( array $categories ): array {
    … …  
    108133                        'editor_style'  => 'mubly-blocks-key-takeaways-block',
    109134                        'style'         => 'mubly-blocks-key-takeaways-block',
     135                )
     136        );
     137
     138        wp_register_script(
     139                'mubly-blocks-why-love-block',
     140                MUBLY_URL . 'assets/why-love-block.js',
     141                array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-i18n' ),
     142                MUBLY_VERSION,
     143                true
     144        );
     145
     146        wp_register_style(
     147                'mubly-blocks-why-love-block',
     148                MUBLY_URL . 'assets/why-love-block.css',
     149                array(),
     150                MUBLY_VERSION
     151        );
     152
     153        register_block_type(
     154                MUBLY_DIR . 'blocks/why-love',
     155                array(
     156                        'editor_script' => 'mubly-blocks-why-love-block',
     157                        'editor_style'  => 'mubly-blocks-why-love-block',
     158                        'style'         => 'mubly-blocks-why-love-block',
    110159                )
    111160        );
    … …  
    280329        $role_names = wp_roles()->role_names;
    281330        $user_roles = array_values( (array) $user->roles );
    282         $role = isset( $user_roles[0], $role_names[ $user_roles[0] ] ) ? translate_user_role( $role_names[ $user_roles[0] ] ) : '';
     331        $role       = isset( $user_roles[0], $role_names[ $user_roles[0] ] ) ? translate_user_role( $role_names[ $user_roles[0] ] ) : '';
    283332
    284333        return array(
    … …  
    321370
    322371        if ( 'profile' === $author_source && ! empty( $author_data ) ) {
    323                 $name       = $author_data['name'];
    324                 $role       = $author_data['role'];
    325                 $bio        = $author_data['bio'];
    326                 $avatar_url = $author_data['avatarUrl'];
     372                $name        = $author_data['name'];
     373                $role        = $author_data['role'];
     374                $bio         = $author_data['bio'];
     375                $avatar_url  = $author_data['avatarUrl'];
    327376                $website_url = $author_data['websiteUrl'];
    328377        } else {
    … …  
    334383        }
    335384
    336         $link_url = 'archive' === $link_destination && ! empty( $author_data['archiveUrl'] ) ? $author_data['archiveUrl'] : $website_url;
    337         $link_text = isset( $attributes['websiteText'] ) ? $attributes['websiteText'] : __( 'Visit website', 'mubly-blocks' );
     385        $link_url   = 'archive' === $link_destination && ! empty( $author_data['archiveUrl'] ) ? $author_data['archiveUrl'] : $website_url;
     386        $link_text  = isset( $attributes['websiteText'] ) ? $attributes['websiteText'] : __( 'Visit website', 'mubly-blocks' );
     387        $plain_name = trim( wp_strip_all_tags( $name ) );
     388        $initial    = strtoupper( substr( '' !== $plain_name ? $plain_name : 'A', 0, 1 ) );
    338389
    339390        ob_start();
    … …  
    344395                                <img class="mub-author-block__avatar-image" src="<?php echo esc_url( $avatar_url ); ?>" alt="<?php echo esc_attr( wp_strip_all_tags( $name ) ); ?>">
    345396                        <?php else : ?>
    346                                 <div class="mub-author-block__avatar-fallback" aria-hidden="true"><?php echo esc_html( strtoupper( substr( trim( wp_strip_all_tags( $name ) ) ?: 'A', 0, 1 ) ) ); ?></div>
     397                                <div class="mub-author-block__avatar-fallback" aria-hidden="true"><?php echo esc_html( $initial ); ?></div>
    347398                        <?php endif; ?>
    348399                </div>
    … …  
    461512function mubly_get_posts_block_query_args( array $attributes, int $posts_to_show ): array {
    462513        $query_type     = isset( $attributes['queryType'] ) ? sanitize_key( $attributes['queryType'] ) : 'recent';
    463         $allowed_types   = array( 'recent', 'category', 'tag', 'manual' );
    464         $query_type      = in_array( $query_type, $allowed_types, true ) ? $query_type : 'recent';
    465         $category_id     = isset( $attributes['categoryId'] ) ? absint( $attributes['categoryId'] ) : 0;
    466         $tag_id          = isset( $attributes['tagId'] ) ? absint( $attributes['tagId'] ) : 0;
    467         $selected_posts  = isset( $attributes['selectedPosts'] ) && is_array( $attributes['selectedPosts'] ) ? array_map( 'absint', $attributes['selectedPosts'] ) : array();
    468         $selected_posts  = array_values( array_unique( array_filter( $selected_posts ) ) );
    469         $query_args      = array(
     514        $allowed_types  = array( 'recent', 'category', 'tag', 'manual' );
     515        $query_type     = in_array( $query_type, $allowed_types, true ) ? $query_type : 'recent';
     516        $category_id    = isset( $attributes['categoryId'] ) ? absint( $attributes['categoryId'] ) : 0;
     517        $tag_id         = isset( $attributes['tagId'] ) ? absint( $attributes['tagId'] ) : 0;
     518        $selected_posts = isset( $attributes['selectedPosts'] ) && is_array( $attributes['selectedPosts'] ) ? array_map( 'absint', $attributes['selectedPosts'] ) : array();
     519        $selected_posts = array_values( array_unique( array_filter( $selected_posts ) ) );
     520        $query_args     = array(
    470521                'post_type'           => 'post',
    471522                'post_status'         => 'publish',
    … …  
    518569        $tablet_columns  = min( 3, max( 1, $tablet_columns ) );
    519570        $mobile_columns  = min( 2, max( 1, $mobile_columns ) );
    520         $colors = array(
     571        $colors          = array(
    521572                '--mub-posts-background'      => isset( $attributes['backgroundColor'] ) ? sanitize_hex_color( $attributes['backgroundColor'] ) : '#ffffff',
    522573                '--mub-posts-text'            => isset( $attributes['textColor'] ) ? sanitize_hex_color( $attributes['textColor'] ) : '#17202a',
    … …  
    531582        }
    532583
    533         $style  = '';
     584        $style = '';
    534585
    535586        foreach ( $colors as $property => $value ) {
  • mubly-blocks/tags/0.2.6/readme.txt

    r3657735 r3676771  
    33Tags: blocks, editor, publishing, review, comparison
    44Requires at least: 6.4
    5 Tested up to: 7.0
     5Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.2.5
     7Stable tag: 0.2.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    1919* Trusted Source CTA: Invite readers to add the site as a trusted source on Google using Google's preferred source URL format.
    2020* Key Takeaways: Highlight the most important article points in a clean summary block.
     21* Why You'll Love This: Add any WordPress blocks inside a styled recommendation container.
    2122* Fancy List: Create styled ordered and unordered list items with custom markers and counter styles.
    2223* Pro & Con List: Present review or comparison points with custom checkmarks and crosses.
    … …  
    2829
    2930The Key Takeaways block includes Clean List, Accent Box, and Numbered Notes design styles. Editors can customize the heading, intro, and takeaway items directly in the block.
     31
     32The Why You'll Love This block includes Soft Card, Accent Border, and Minimal design styles. Its heading is editable, and its content area accepts any registered WordPress block.
    3033
    3134The Fancy List block supports Card, Minimal, and Accent Box design styles. It starts with one empty list item and includes ordered and unordered list modes. Unordered lists include selectable icons, while ordered lists include Circle Counter, Square Counter, and Plain Counter styles with counter color controls. Ordered lists can reset numbering or continue from a previous Fancy List counter.
    … …  
    78811. Trusted Source CTA block in the editor.
    79822. Key Takeaways block with summary styles.
    80 3. Fancy List block with ordered and unordered marker styles.
    81 4. Pro & Con List block with side-by-side comparison columns.
    82 5. Step-by-Step Process block with nested step content.
    83 6. Posts Block with List, Grid, and Card layouts.
    84 7. Author Block with manual and profile author settings.
     833. Why You'll Love This block with flexible nested content.
     844. Fancy List block with ordered and unordered marker styles.
     855. Pro & Con List block with side-by-side comparison columns.
     866. Step-by-Step Process block with nested step content.
     877. Posts Block with List, Grid, and Card layouts.
     888. Author Block with manual and profile author settings.
    8589
    8690== Changelog ==
     91
     92= 0.2.6 =
     93* Added the Why You'll Love This container block with unrestricted inner WordPress blocks, editable heading, design styles, and color controls.
    8794
    8895= 0.2.5 =
  • mubly-blocks/trunk/mubly-blocks.php

    r3657735 r3676771  
    33 * Plugin Name: Mubly Blocks
    44 * Description: Practical editor blocks for publishers, creators, and site owners.
    5  * Version: 0.2.5
     5 * Version: 0.2.6
    66 * Author: Mohit Chawla
     7 * Author URI: https://mycloudworld.com
    78 * Requires at least: 6.4
    89 * Requires PHP: 7.4
    … …  
    1617}
    1718
    18 define( 'MUBLY_VERSION', '0.2.5' );
     19define( 'MUBLY_VERSION', '0.2.6' );
    1920define( 'MUBLY_FILE', __FILE__ );
    2021define( 'MUBLY_DIR', plugin_dir_path( __FILE__ ) );
    … …  
    2223
    2324add_filter( 'block_categories_all', 'mubly_register_block_category' );
     25add_filter( 'plugin_row_meta', 'mubly_set_author_link_target', 20, 2 );
    2426add_action( 'init', 'mubly_register_blocks' );
     27
     28/**
     29 * Open the Mubly Blocks author link in a new tab.
     30 *
     31 * @param string[] $plugin_meta Plugin metadata links.
     32 * @param string   $plugin_file Plugin file relative to the plugins directory.
     33 * @return string[]
     34 */
     35function mubly_set_author_link_target( $plugin_meta, $plugin_file ) {
     36        if ( plugin_basename( MUBLY_FILE ) !== $plugin_file ) {
     37                return $plugin_meta;
     38        }
     39
     40        $author_url  = 'https://mycloudworld.com';
     41        $current     = '<a href="' . esc_url( $author_url ) . '">';
     42        $replacement = '<a href="' . esc_url( $author_url ) . '" target="_blank" rel="noopener noreferrer">';
     43
     44        foreach ( $plugin_meta as $index => $meta ) {
     45                $plugin_meta[ $index ] = str_replace( $current, $replacement, $meta );
     46        }
     47
     48        return $plugin_meta;
     49}
    2550
    2651function mubly_register_block_category( array $categories ): array {
    … …  
    108133                        'editor_style'  => 'mubly-blocks-key-takeaways-block',
    109134                        'style'         => 'mubly-blocks-key-takeaways-block',
     135                )
     136        );
     137
     138        wp_register_script(
     139                'mubly-blocks-why-love-block',
     140                MUBLY_URL . 'assets/why-love-block.js',
     141                array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-i18n' ),
     142                MUBLY_VERSION,
     143                true
     144        );
     145
     146        wp_register_style(
     147                'mubly-blocks-why-love-block',
     148                MUBLY_URL . 'assets/why-love-block.css',
     149                array(),
     150                MUBLY_VERSION
     151        );
     152
     153        register_block_type(
     154                MUBLY_DIR . 'blocks/why-love',
     155                array(
     156                        'editor_script' => 'mubly-blocks-why-love-block',
     157                        'editor_style'  => 'mubly-blocks-why-love-block',
     158                        'style'         => 'mubly-blocks-why-love-block',
    110159                )
    111160        );
    … …  
    280329        $role_names = wp_roles()->role_names;
    281330        $user_roles = array_values( (array) $user->roles );
    282         $role = isset( $user_roles[0], $role_names[ $user_roles[0] ] ) ? translate_user_role( $role_names[ $user_roles[0] ] ) : '';
     331        $role       = isset( $user_roles[0], $role_names[ $user_roles[0] ] ) ? translate_user_role( $role_names[ $user_roles[0] ] ) : '';
    283332
    284333        return array(
    … …  
    321370
    322371        if ( 'profile' === $author_source && ! empty( $author_data ) ) {
    323                 $name       = $author_data['name'];
    324                 $role       = $author_data['role'];
    325                 $bio        = $author_data['bio'];
    326                 $avatar_url = $author_data['avatarUrl'];
     372                $name        = $author_data['name'];
     373                $role        = $author_data['role'];
     374                $bio         = $author_data['bio'];
     375                $avatar_url  = $author_data['avatarUrl'];
    327376                $website_url = $author_data['websiteUrl'];
    328377        } else {
    … …  
    334383        }
    335384
    336         $link_url = 'archive' === $link_destination && ! empty( $author_data['archiveUrl'] ) ? $author_data['archiveUrl'] : $website_url;
    337         $link_text = isset( $attributes['websiteText'] ) ? $attributes['websiteText'] : __( 'Visit website', 'mubly-blocks' );
     385        $link_url   = 'archive' === $link_destination && ! empty( $author_data['archiveUrl'] ) ? $author_data['archiveUrl'] : $website_url;
     386        $link_text  = isset( $attributes['websiteText'] ) ? $attributes['websiteText'] : __( 'Visit website', 'mubly-blocks' );
     387        $plain_name = trim( wp_strip_all_tags( $name ) );
     388        $initial    = strtoupper( substr( '' !== $plain_name ? $plain_name : 'A', 0, 1 ) );
    338389
    339390        ob_start();
    … …  
    344395                                <img class="mub-author-block__avatar-image" src="<?php echo esc_url( $avatar_url ); ?>" alt="<?php echo esc_attr( wp_strip_all_tags( $name ) ); ?>">
    345396                        <?php else : ?>
    346                                 <div class="mub-author-block__avatar-fallback" aria-hidden="true"><?php echo esc_html( strtoupper( substr( trim( wp_strip_all_tags( $name ) ) ?: 'A', 0, 1 ) ) ); ?></div>
     397                                <div class="mub-author-block__avatar-fallback" aria-hidden="true"><?php echo esc_html( $initial ); ?></div>
    347398                        <?php endif; ?>
    348399                </div>
    … …  
    461512function mubly_get_posts_block_query_args( array $attributes, int $posts_to_show ): array {
    462513        $query_type     = isset( $attributes['queryType'] ) ? sanitize_key( $attributes['queryType'] ) : 'recent';
    463         $allowed_types   = array( 'recent', 'category', 'tag', 'manual' );
    464         $query_type      = in_array( $query_type, $allowed_types, true ) ? $query_type : 'recent';
    465         $category_id     = isset( $attributes['categoryId'] ) ? absint( $attributes['categoryId'] ) : 0;
    466         $tag_id          = isset( $attributes['tagId'] ) ? absint( $attributes['tagId'] ) : 0;
    467         $selected_posts  = isset( $attributes['selectedPosts'] ) && is_array( $attributes['selectedPosts'] ) ? array_map( 'absint', $attributes['selectedPosts'] ) : array();
    468         $selected_posts  = array_values( array_unique( array_filter( $selected_posts ) ) );
    469         $query_args      = array(
     514        $allowed_types  = array( 'recent', 'category', 'tag', 'manual' );
     515        $query_type     = in_array( $query_type, $allowed_types, true ) ? $query_type : 'recent';
     516        $category_id    = isset( $attributes['categoryId'] ) ? absint( $attributes['categoryId'] ) : 0;
     517        $tag_id         = isset( $attributes['tagId'] ) ? absint( $attributes['tagId'] ) : 0;
     518        $selected_posts = isset( $attributes['selectedPosts'] ) && is_array( $attributes['selectedPosts'] ) ? array_map( 'absint', $attributes['selectedPosts'] ) : array();
     519        $selected_posts = array_values( array_unique( array_filter( $selected_posts ) ) );
     520        $query_args     = array(
    470521                'post_type'           => 'post',
    471522                'post_status'         => 'publish',
    … …  
    518569        $tablet_columns  = min( 3, max( 1, $tablet_columns ) );
    519570        $mobile_columns  = min( 2, max( 1, $mobile_columns ) );
    520         $colors = array(
     571        $colors          = array(
    521572                '--mub-posts-background'      => isset( $attributes['backgroundColor'] ) ? sanitize_hex_color( $attributes['backgroundColor'] ) : '#ffffff',
    522573                '--mub-posts-text'            => isset( $attributes['textColor'] ) ? sanitize_hex_color( $attributes['textColor'] ) : '#17202a',
    … …  
    531582        }
    532583
    533         $style  = '';
     584        $style = '';
    534585
    535586        foreach ( $colors as $property => $value ) {
  • mubly-blocks/trunk/readme.txt

    r3657735 r3676771  
    33Tags: blocks, editor, publishing, review, comparison
    44Requires at least: 6.4
    5 Tested up to: 7.0
     5Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.2.5
     7Stable tag: 0.2.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    1919* Trusted Source CTA: Invite readers to add the site as a trusted source on Google using Google's preferred source URL format.
    2020* Key Takeaways: Highlight the most important article points in a clean summary block.
     21* Why You'll Love This: Add any WordPress blocks inside a styled recommendation container.
    2122* Fancy List: Create styled ordered and unordered list items with custom markers and counter styles.
    2223* Pro & Con List: Present review or comparison points with custom checkmarks and crosses.
    … …  
    2829
    2930The Key Takeaways block includes Clean List, Accent Box, and Numbered Notes design styles. Editors can customize the heading, intro, and takeaway items directly in the block.
     31
     32The Why You'll Love This block includes Soft Card, Accent Border, and Minimal design styles. Its heading is editable, and its content area accepts any registered WordPress block.
    3033
    3134The Fancy List block supports Card, Minimal, and Accent Box design styles. It starts with one empty list item and includes ordered and unordered list modes. Unordered lists include selectable icons, while ordered lists include Circle Counter, Square Counter, and Plain Counter styles with counter color controls. Ordered lists can reset numbering or continue from a previous Fancy List counter.
    … …  
    78811. Trusted Source CTA block in the editor.
    79822. Key Takeaways block with summary styles.
    80 3. Fancy List block with ordered and unordered marker styles.
    81 4. Pro & Con List block with side-by-side comparison columns.
    82 5. Step-by-Step Process block with nested step content.
    83 6. Posts Block with List, Grid, and Card layouts.
    84 7. Author Block with manual and profile author settings.
     833. Why You'll Love This block with flexible nested content.
     844. Fancy List block with ordered and unordered marker styles.
     855. Pro & Con List block with side-by-side comparison columns.
     866. Step-by-Step Process block with nested step content.
     877. Posts Block with List, Grid, and Card layouts.
     888. Author Block with manual and profile author settings.
    8589
    8690== Changelog ==
     91
     92= 0.2.6 =
     93* Added the Why You'll Love This container block with unrestricted inner WordPress blocks, editable heading, design styles, and color controls.
    8794
    8895= 0.2.5 =
Note: See TracChangeset for help on using the changeset viewer.