Skip to content

Commit

Permalink
Merge branch 'master' into update-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
oakesjosh committed Nov 22, 2024
2 parents 7aafa14 + 6b7ecd4 commit 2178957
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
# For posting a rich message using Block Kit
payload: |
{
"text": "<!subteam^kadencewp-team> 🚀 ${{ github.event.repository.name }} version ${{ github.event.release.tag_name }} has been released!\n\nView on GitHub: ${{ github.event.release.html_url }}"
"text": "<!subteam^S07ESK6U6EN|kadencewp-team> 🚀 ${{ github.event.repository.name }} version ${{ github.event.release.tag_name }} has been released!\n\nView on GitHub: ${{ github.event.release.html_url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand Down
20 changes: 11 additions & 9 deletions includes/blocks/class-kadence-blocks-advancedgallery-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,17 @@ public function render_gallery_images( $image, $attributes ) {
$output .= '<div class="kadence-blocks-gallery-item-inner">';
$output .= '<figure class="' . esc_attr( implode( ' ', $fig_classes ) ). '" ' . ( ! empty( $padding_bottom ) && 'below' === $caption_style ? 'style="max-width:' . $image['width'] . 'px;"' : '' ) . '">';
if ( ! empty( $href ) ) {
$caption = wp_kses(html_entity_decode($caption, ENT_QUOTES, 'UTF-8'), array(
'a' => array(
'href' => true,
'target' => array('_blank', '_self'),
'rel' => true,
)
));

$output .= '<a href="' . esc_url( $href ) . '"' . ( $link_to === 'media' && $lightbox === 'magnific' && $lightbox_cap && ! empty( $caption ) && is_string( $caption ) ? ' data-description="' . esc_attr( $caption ) . '"' : '' ) . '' . ( $link_to === 'media' && $lightbox === 'magnific' && ! empty( $image_alt ) && is_string( $image_alt ) ? ' data-alt="' . esc_attr( $image_alt ) . '"' : '' ) . ' class="kb-gallery-item-link" ' . ( ( $link_to === 'custom' && '_blank' === $link_target ) || ( $link_to === 'media' && $lightbox === 'new_tab' ) ? 'target="_blank"' : '' ) . ' ' . ( ( $link_to === 'custom' && ! empty( $rel_attr ) ) || ( $link_to === 'media' && ! empty( $rel_attr ) ) ? 'rel="' . esc_attr( $rel_attr ) . '"' : '' ) . '>';
$safe_caption = '';
if( $link_to === 'media' && $lightbox === 'magnific' && $lightbox_cap && ! empty( $caption ) && is_string( $caption ) ) {
$safe_caption = wp_kses(html_entity_decode($caption, ENT_QUOTES, 'UTF-8'), array(
'a' => array(
'href' => true,
'target' => array('_blank', '_self'),
'rel' => true,
)
));
}
$output .= '<a href="' . esc_url( $href ) . '"' . ( !empty( $safe_caption ) ? ' data-description="' . esc_attr( $safe_caption ) . '"' : '' ) . '' . ( $link_to === 'media' && $lightbox === 'magnific' && ! empty( $image_alt ) && is_string( $image_alt ) ? ' data-alt="' . esc_attr( $image_alt ) . '"' : '' ) . ' class="kb-gallery-item-link" ' . ( ( $link_to === 'custom' && '_blank' === $link_target ) || ( $link_to === 'media' && $lightbox === 'new_tab' ) ? 'target="_blank"' : '' ) . ' ' . ( ( $link_to === 'custom' && ! empty( $rel_attr ) ) || ( $link_to === 'media' && ! empty( $rel_attr ) ) ? 'rel="' . esc_attr( $rel_attr ) . '"' : '' ) . '>';
}
$output .= '<div class="kb-gal-image-radius"' . ( ! empty( $padding_bottom ) ? ' style="max-width:' . esc_attr( $image['width'] ) . 'px;"' : '' ) . '>';
$output .= $img;
Expand Down
5 changes: 4 additions & 1 deletion includes/class-kadence-blocks-table-of-contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,11 @@ public function render_table_of_content( $attributes, $content ) {
if ( kadence_blocks_is_not_amp() ) {
if ( isset( $attributes['enableScrollSpy'] ) && $attributes['enableScrollSpy'] ) {
wp_enqueue_script( 'kadence-blocks-gumshoe' );
//need to laod this script with the gumshoe dependency if scrollspy is enabled
wp_enqueue_script( 'kadence-blocks-table-of-contents', KADENCE_BLOCKS_URL . 'includes/assets/js/kb-table-of-contents.min.js', array('kadence-blocks-gumshoe') , KADENCE_BLOCKS_VERSION, true );
} else {
wp_enqueue_script( 'kadence-blocks-table-of-contents' );
}
wp_enqueue_script( 'kadence-blocks-table-of-contents' );
}
if ( ! doing_filter( 'the_content' ) ) {
if ( ! wp_style_is( 'kadence-blocks-table-of-contents', 'done' ) ) {
Expand Down
4 changes: 2 additions & 2 deletions kadence-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Advanced Page Building Blocks for Gutenberg. Create custom column layouts, backgrounds, dual buttons, icons etc.
* Author: Kadence WP
* Author URI: https://www.kadencewp.com
* Version: 3.3.5
* Version: 3.3.7
* Requires PHP: 7.4
* Text Domain: kadence-blocks
* License: GPL2+
Expand All @@ -20,7 +20,7 @@
}
define( 'KADENCE_BLOCKS_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR );
define( 'KADENCE_BLOCKS_URL', plugin_dir_url( __FILE__ ) );
define( 'KADENCE_BLOCKS_VERSION', '3.3.5' );
define( 'KADENCE_BLOCKS_VERSION', '3.3.7' );

require_once plugin_dir_path( __FILE__ ) . 'vendor/vendor-prefixed/autoload.php';
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
Expand Down
15 changes: 13 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: gutenberg, blocks, page builder, editor, gutenberg blocks
Donate link: https://www.kadencewp.com/about-us/
Requires at least: 6.3
Tested up to: 6.7
Stable tag: 3.3.5
Stable tag: 3.3.7
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -174,9 +174,20 @@ Please report security bugs found in the Kadence Blocks plugin's source code thr

== Changelog ==

= 3.3.6 =
= 3.3.8 =
Release Date: tba
* Fix: Issue with table of contents script dependency timing.

= 3.3.7 =
Release Date: November 21st 2024
* Fix: Issue with advanced gallery captions.

= 3.3.6 =
Release Date: November 20th 2024
* Add: Allow links in advanced gallery lightbox captions.
* Add: WPML support for advanced form input fields.
* Adjust: Naming and support text for navigation stretch option.
* Fix: Editor error when modifying accordion panes.

= 3.3.5 =
Release Date: November 19th 2024
Expand Down
20 changes: 19 additions & 1 deletion tests/wpunit/Blocks/AdvancedGalleryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,23 @@ protected function setUp(): void {
$this->block = new Kadence_Blocks_Advancedgallery_Block();
}


// Make sure captions that are arrays do not throw an error.
public function test_render_gallery_images_with_array_caption()
{
$image = [
'url' => 'http://example.com/image.jpg',
'lightUrl' => 'http://example.com/image.jpg',
'caption' => [ 'should', 'not', 'fail']
];
$attributes = [
'linkTo' => 'media',
'lightbox' => 'magnific',
'lightboxCaption' => true,
];

$response = $this->block->render_gallery_images( $image, $attributes );

$this->assertIsString( $response );
$this->assertNotEmpty( $response );
}
}

0 comments on commit 2178957

Please sign in to comment.