← All changes
|
includes/bricks-builder-widgets/property-gallery.php
+29
-8
2.2.2
→
2.4.0
View file →
| @@ -67,8 +67,9 @@ | ||
| 67 | 67 | |
| 68 | 68 | // Add 'class' attribute to element root tag |
| 69 | 69 | $this->set_attribute( '_root', 'class', $root_classes ); |
| 70 | 70 | |
| 71 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Bricks serializes registered attributes through its documented render_attributes() API. | |
| 71 | 72 | echo "<div {$this->render_attributes( '_root' )}>"; |
| 72 | 73 | |
| 73 | 74 | $start_at_image = ( isset($settings['start_at_image']) && !empty($settings['start_at_image']) && is_numeric($settings['start_at_image']) ) ? ($settings['start_at_image'] - 1) : 0; |
| 74 | 75 | |
| @@ -252,9 +253,9 @@ | ||
| 252 | 253 | <?php |
| 253 | 254 | |
| 254 | 255 | foreach ( $images_hidden as $image_hidden ) |
| 255 | 256 | { |
| 256 | - echo '<a href="' . esc_url($image_hidden['url']) . '" data-fancybox="elementor-gallery"></a>'; | |
| 257 | + echo '<a href="' . esc_url($image_hidden['url']) . '" data-fancybox="bricks-gallery"></a>'; | |
| 257 | 258 | ++$image_number; |
| 258 | 259 | } |
| 259 | 260 | ?> |
| 260 | 261 | |
| @@ -268,23 +269,43 @@ | ||
| 268 | 269 | echo '<div class="gallery-column">'; |
| 269 | 270 | |
| 270 | 271 | if ( isset($images[$image_number]) ) |
| 271 | 272 | { |
| 272 | - $id_text = $image_number == ($max_images - 1) ? 'id="more-images-link"' : ''; | |
| 273 | - $id_text_mobile = $image_number == 1 ? 'id="more-images-link-mobile"' : ''; | |
| 273 | + $id_text = $image_number == ( $max_images - 1 ) ? 'more-images-link' : ''; | |
| 274 | + $id_text_mobile = $image_number == 1 ? 'more-images-link-mobile' : ''; | |
| 274 | 275 | |
| 275 | - echo '<a ' . $id_text . ' ' . $id_text_mobile . ' href="' . esc_url($images[$image_number]['url']) . '" data-fancybox="elementor-gallery" style="background-image:url(' . esc_url($images[$image_number]['url']) . ')"></a>'; | |
| 276 | + echo '<a'; | |
| 276 | 277 | |
| 278 | + if ( $id_text ) | |
| 279 | + { | |
| 280 | + echo ' id="' . esc_attr( $id_text ) . '"'; | |
| 281 | + } | |
| 282 | + | |
| 283 | + if ( $id_text_mobile ) | |
| 284 | + { | |
| 285 | + echo ' id="' . esc_attr( $id_text_mobile ) . '"'; | |
| 286 | + } | |
| 287 | + | |
| 288 | + echo ' href="' . esc_url( $images[$image_number]['url'] ) . '" data-fancybox="bricks-gallery" style="background-image:url(' . esc_url( $images[$image_number]['url'] ) . ')"></a>'; | |
| 289 | + | |
| 277 | 290 | if ( $image_number == 1 ) |
| 278 | 291 | { |
| 279 | 292 | echo '<div class="more-images-container mobile"><div class="more-images"><a href="javascript:;" onclick="openGallery();">'; |
| 280 | - printf( __( 'See all %d images', 'propertyhive' ), count($images) + count($images_hidden) ); | |
| 293 | + printf( | |
| 294 | + /* translators: %d: number of images (1, 2, 3 etc) */ | |
| 295 | + esc_html__( 'See all %d images', 'propertyhive' ), | |
| 296 | + count($images) + count($images_hidden) | |
| 297 | + ); | |
| 281 | 298 | echo '</a></div></div>'; |
| 282 | 299 | } |
| 283 | 300 | if ( $image_number == ($max_images - 1) ) |
| 284 | 301 | { |
| 285 | 302 | echo '<div class="more-images-container desktop"><div class="more-images"><a href="javascript:;" onclick="openGallery();">'; |
| 286 | - printf( __( 'See all %d images', 'propertyhive' ), count($images) + count($images_hidden) ); | |
| 303 | + printf( | |
| 304 | + /* translators: %d: number of images (1, 2, 3 etc) */ | |
| 305 | + esc_html__( 'See all %d images', 'propertyhive' ), | |
| 306 | + count($images) + count($images_hidden) | |
| 307 | + ); | |
| 287 | 308 | echo '</a></div></div>'; |
| 288 | 309 | } |
| 289 | 310 | } |
| 290 | 311 | |
| @@ -294,9 +315,9 @@ | ||
| 294 | 315 | } |
| 295 | 316 | |
| 296 | 317 | while ( count($images) > ($image_number) ) |
| 297 | 318 | { |
| 298 | - echo '<a href="' . esc_url($images[$image_number]['url']) . '" data-fancybox="elementor-gallery"></a>'; | |
| 319 | + echo '<a href="' . esc_url($images[$image_number]['url']) . '" data-fancybox="bricks-gallery"></a>'; | |
| 299 | 320 | ++$image_number; |
| 300 | 321 | } |
| 301 | 322 | |
| 302 | 323 | // Code second layout, for one main photo |
| @@ -306,5 +327,5 @@ | ||
| 306 | 327 | <?php |
| 307 | 328 | |
| 308 | 329 | echo '</div>'; |
| 309 | 330 | } |
| 310 | -} | |
| 331 | +} | |