about-widget.php
10 years ago
accordion.php
10 years ago
attachment-url.php
10 years ago
audio.php
10 years ago
button.php
10 years ago
code.php
10 years ago
contact-box.php
10 years ago
contact-form.php
10 years ago
divider.php
10 years ago
dropcap.php
10 years ago
gallery.php
10 years ago
gmap.php
10 years ago
highlight.php
10 years ago
image.php
10 years ago
instagram-feed.php
10 years ago
latest-items.php
10 years ago
latest-posts-slider.php
10 years ago
quote.php
10 years ago
recent-posts-widget.php
10 years ago
recent-posts.php
10 years ago
sample-element.php
10 years ago
search.php
10 years ago
socials-list.php
10 years ago
tabs.php
10 years ago
text.php
10 years ago
video.php
10 years ago
gallery.php
570 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Filterable gallery with lightbox |
| 4 | * |
| 5 | * |
| 6 | * @package auxin-elements |
| 7 | * @license LICENSE.txt |
| 8 | * @author |
| 9 | * @link https://bitbucket.org/averta/ |
| 10 | * @copyright (c) 2010-2016 |
| 11 | */ |
| 12 | function auxin_get_gallery_master_array( $master_array ) { |
| 13 | |
| 14 | $master_array['aux_gallery'] = array( |
| 15 | 'name' => __('[Phlox] Gallery', 'auxin-elements'), |
| 16 | 'auxin_output_callback' => 'auxin_widget_gallery_callback', |
| 17 | 'base' => 'aux_gallery', |
| 18 | 'description' => __('Filterable and grid gallery with lightbox', 'auxin-elements'), |
| 19 | 'class' => 'aux-widget-gallery', |
| 20 | 'show_settings_on_create' => true, |
| 21 | 'weight' => 1, |
| 22 | 'is_widget' => false, |
| 23 | 'is_shortcode' => true, |
| 24 | 'is_so' => true, |
| 25 | 'is_vc' => true, |
| 26 | 'category' => THEME_NAME, |
| 27 | 'group' => '', |
| 28 | 'admin_enqueue_js' => '', |
| 29 | 'admin_enqueue_css' => '', |
| 30 | 'front_enqueue_js' => '', |
| 31 | 'front_enqueue_css' => '', |
| 32 | 'icon' => 'auxin-element auxin-gallery', |
| 33 | 'custom_markup' => '', |
| 34 | 'js_view' => '', |
| 35 | 'html_template' => '', |
| 36 | 'deprecated' => '', |
| 37 | 'content_element' => '', |
| 38 | 'as_parent' => '', |
| 39 | 'as_child' => '', |
| 40 | 'params' => array( |
| 41 | // array( |
| 42 | // 'param_name' => 'title', |
| 43 | // 'type' => 'textfield', |
| 44 | // 'value' => '', |
| 45 | // 'def_value' => '', |
| 46 | // 'holder' => 'textfield', |
| 47 | // 'class' => 'id', |
| 48 | // 'heading' => __('Gallery title','auxin-elements'), |
| 49 | // 'description' => '', |
| 50 | // 'admin_label' => true, |
| 51 | // 'dependency' => '', |
| 52 | // 'weight' => '', |
| 53 | // 'group' => '' , |
| 54 | // 'edit_field_class' => '' |
| 55 | // ), |
| 56 | array( |
| 57 | 'param_name' => 'include', |
| 58 | 'type' => 'attach_images', |
| 59 | 'value' => '', |
| 60 | 'def_value' => '', |
| 61 | 'holder' => 'attach_images', |
| 62 | 'class' => 'include', |
| 63 | 'heading' => __('Images','auxin-elements'), |
| 64 | 'description' => '', |
| 65 | 'admin_label' => true, |
| 66 | 'dependency' => '', |
| 67 | 'weight' => '', |
| 68 | 'group' => '' , |
| 69 | 'edit_field_class' => '' |
| 70 | ), |
| 71 | array( |
| 72 | 'param_name' => 'columns', |
| 73 | 'type' => 'dropdown', |
| 74 | 'value' => array( |
| 75 | '1' => __('1 Column' , 'auxin-elements'), |
| 76 | '2' => __('2 Columns', 'auxin-elements'), |
| 77 | '3' => __('3 Columns', 'auxin-elements'), |
| 78 | '4' => __('4 Columns', 'auxin-elements'), |
| 79 | '5' => __('5 Columns', 'auxin-elements'), |
| 80 | '6' => __('6 Columns', 'auxin-elements') |
| 81 | ), |
| 82 | 'def_value' => '2', |
| 83 | 'holder' => 'dropdown', |
| 84 | 'class' => 'columns', |
| 85 | 'heading' => __('Column number','auxin-elements'), |
| 86 | 'description' => '', |
| 87 | 'admin_label' => true, |
| 88 | 'dependency' => '', |
| 89 | 'weight' => '', |
| 90 | 'group' => '' , |
| 91 | 'edit_field_class' => '' |
| 92 | ), |
| 93 | array( |
| 94 | 'param_name' => 'wp_order', |
| 95 | 'type' => 'aux_switch', |
| 96 | 'value' => '0', |
| 97 | 'class' => '', |
| 98 | 'heading' => __('Order images by query','auxin-elements'), |
| 99 | 'description' => '', |
| 100 | 'admin_label' => true, |
| 101 | 'dependency' => '', |
| 102 | 'weight' => '', |
| 103 | 'group' => '' , |
| 104 | 'edit_field_class' => '' |
| 105 | ), |
| 106 | array( |
| 107 | 'param_name' => 'order', |
| 108 | 'type' => 'dropdown', |
| 109 | 'def_value' => 'ASC', |
| 110 | 'value' => array( |
| 111 | 'ASC' => __('ASC' , 'auxin-elements'), |
| 112 | 'DESC' => __('DESC', 'auxin-elements') |
| 113 | ), |
| 114 | 'holder' => 'dropdown', |
| 115 | 'class' => 'order', |
| 116 | 'heading' => __('Order','auxin-elements'), |
| 117 | 'description' => __('Order images ascending or descending','auxin-elements'), |
| 118 | 'admin_label' => true, |
| 119 | 'dependency' => array( |
| 120 | 'element' => 'wp_order', |
| 121 | 'value' => '1' |
| 122 | ), |
| 123 | 'weight' => '', |
| 124 | 'group' => '' , |
| 125 | 'edit_field_class' => '' |
| 126 | ), |
| 127 | array( |
| 128 | 'param_name' => 'orderby', |
| 129 | 'type' => 'dropdown', |
| 130 | 'def_value' => 'menu_order ID', |
| 131 | 'value' => array( |
| 132 | 'menu_order ID' => __('Menu Order' , 'auxin-elements'), |
| 133 | 'date' => __('Date' , 'auxin-elements'), |
| 134 | 'ID' => __('ID' , 'auxin-elements'), |
| 135 | 'none' => __('None' , 'auxin-elements') |
| 136 | ), |
| 137 | 'dependency' => array( |
| 138 | 'element' => 'wp_order', |
| 139 | 'value' => '1' |
| 140 | ), |
| 141 | 'holder' => 'dropdown', |
| 142 | 'class' => 'orderby', |
| 143 | 'heading' => __('Order images by','auxin-elements'), |
| 144 | 'description' => '', |
| 145 | 'admin_label' => true, |
| 146 | 'weight' => '', |
| 147 | 'group' => '' , |
| 148 | 'edit_field_class' => '' |
| 149 | ), |
| 150 | array( |
| 151 | 'param_name' => 'layout', |
| 152 | 'type' => 'dropdown', |
| 153 | 'def_value' => 'grid', |
| 154 | 'value' => array( |
| 155 | 'grid' => __('Grid', 'auxin-elements'), |
| 156 | 'masonry' => __('Masonry', 'auxin-elements')//, |
| 157 | //'justify-rows' => __('Justify rows', 'auxin-elements') |
| 158 | ), |
| 159 | 'holder' => 'dropdown', |
| 160 | 'class' => 'layout', |
| 161 | 'heading' => __('Gallery layout','auxin-elements'), |
| 162 | 'description' => '', |
| 163 | 'admin_label' => true, |
| 164 | 'dependency' => '', |
| 165 | 'weight' => '', |
| 166 | 'group' => '' , |
| 167 | 'edit_field_class' => '' |
| 168 | ), |
| 169 | array( |
| 170 | 'param_name' => 'link', |
| 171 | 'type' => 'dropdown', |
| 172 | 'def_value' => 'lightbox', |
| 173 | 'value' => array( |
| 174 | 'lightbox' => __('Lightbox', 'auxin-elements'), |
| 175 | 'none' => __('None' , 'auxin-elements'), |
| 176 | '' => __('Attachment Page' , 'auxin-elements'), |
| 177 | 'file' => __('File' , 'auxin-elements') |
| 178 | ), |
| 179 | 'holder' => 'dropdown', |
| 180 | 'class' => 'link', |
| 181 | 'heading' => __('Link images to','auxin-elements'), |
| 182 | 'description' => '', |
| 183 | 'admin_label' => true, |
| 184 | 'dependency' => '', |
| 185 | 'weight' => '', |
| 186 | 'group' => '' , |
| 187 | 'edit_field_class' => '' |
| 188 | ), |
| 189 | array( |
| 190 | 'param_name' => 'size', |
| 191 | 'type' => 'dropdown', |
| 192 | 'def_value' => 'medium', |
| 193 | 'value' => array( |
| 194 | 'full' => __('Original' , 'auxin-elements'), |
| 195 | 'large' => __('Large' , 'auxin-elements'), |
| 196 | 'medium' => __('Medium' , 'auxin-elements'), |
| 197 | 'thumbnail' => __('Thumbnail' , 'auxin-elements') |
| 198 | ), |
| 199 | 'holder' => 'dropdown', |
| 200 | 'class' => 'size', |
| 201 | 'heading' => __('Image size','auxin-elements'), |
| 202 | 'description' => '', |
| 203 | 'admin_label' => true, |
| 204 | 'dependency' => '', |
| 205 | 'weight' => '', |
| 206 | 'group' => '' , |
| 207 | 'edit_field_class' => '' |
| 208 | ), |
| 209 | array( |
| 210 | 'param_name' => 'pagination', |
| 211 | 'type' => 'aux_switch', |
| 212 | 'value' => '0', |
| 213 | 'class' => '', |
| 214 | 'heading' => __('Enable pagination','auxin-elements'), |
| 215 | 'description' => '', |
| 216 | 'admin_label' => true, |
| 217 | 'dependency' => '', |
| 218 | 'weight' => '', |
| 219 | 'group' => '' , |
| 220 | 'edit_field_class' => '' |
| 221 | ), |
| 222 | array( |
| 223 | 'param_name' => 'perpage', |
| 224 | 'type' => 'textfield', |
| 225 | 'value' => '24', |
| 226 | 'def_value' => '', |
| 227 | 'holder' => 'textfield', |
| 228 | 'class' => 'id', |
| 229 | 'heading' => __('Images per page','auxin-elements'), |
| 230 | 'description' => '', |
| 231 | 'admin_label' => true, |
| 232 | 'dependency' => array( |
| 233 | 'element' => 'pagination', |
| 234 | 'value' => '1' |
| 235 | ), |
| 236 | 'weight' => '', |
| 237 | 'group' => '' , |
| 238 | 'edit_field_class' => '' |
| 239 | ), |
| 240 | array( |
| 241 | 'param_name' => 'extra_classes', |
| 242 | 'type' => 'textfield', |
| 243 | 'value' => '', |
| 244 | 'def_value' => '', |
| 245 | 'holder' => 'textfield', |
| 246 | 'class' => 'extra_classes', |
| 247 | 'heading' => __('Extra CSS class','auxin-elements'), |
| 248 | 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'), |
| 249 | 'admin_label' => true, |
| 250 | 'dependency' => '', |
| 251 | 'weight' => '', |
| 252 | 'group' => '' , |
| 253 | 'edit_field_class' => '' |
| 254 | ) |
| 255 | |
| 256 | ) |
| 257 | ); |
| 258 | |
| 259 | return $master_array; |
| 260 | } |
| 261 | |
| 262 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_gallery_master_array', 10, 1 ); |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | // This is the widget call back in fact the front end out put of this widget comes from this function |
| 270 | function auxin_widget_gallery_callback( $attr, $shortcode_content = null ){ |
| 271 | |
| 272 | global $axi_img_size; |
| 273 | $post = get_post(); |
| 274 | |
| 275 | static $instance = 0; |
| 276 | $instance++; |
| 277 | |
| 278 | if ( ! empty( $attr['ids'] ) ) { |
| 279 | // 'ids' is explicitly ordered, unless you specify otherwise. |
| 280 | if ( empty( $attr['orderby'] ) ) { |
| 281 | $attr['orderby'] = 'post__in'; |
| 282 | } |
| 283 | $attr['include'] = $attr['ids']; |
| 284 | } |
| 285 | |
| 286 | // Allow plugins/themes to override the default gallery template. |
| 287 | $output = apply_filters( 'post_gallery', '', $attr, $instance ); |
| 288 | if ( $output != '' ) { |
| 289 | return $output; |
| 290 | } |
| 291 | |
| 292 | // We're trusting author input, so let's at least make sure it looks like a valid orderby statement |
| 293 | if ( isset( $attr['orderby'] ) ) { |
| 294 | $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); |
| 295 | if ( ! $attr['orderby'] ) |
| 296 | unset( $attr['orderby'] ); |
| 297 | } |
| 298 | |
| 299 | $html5 = true; |
| 300 | // Defining default attributes |
| 301 | $default_atts = array( |
| 302 | 'wp_order' => '0', |
| 303 | 'order' => 'ASC', |
| 304 | 'orderby' => 'menu_order ID', |
| 305 | 'id' => $post ? $post->ID : 0, |
| 306 | 'itemtag' => $html5 ? 'figure' : 'dl', |
| 307 | 'icontag' => $html5 ? 'div' : 'dt', |
| 308 | 'captiontag' => $html5 ? 'figcaption' : 'dd', |
| 309 | 'columns' => 4, |
| 310 | 'size' => 'medium', |
| 311 | 'hardcrop' => "yes", |
| 312 | 'layout' => 'grid', // grid, masonry, justify-rows, packery |
| 313 | 'include' => '', |
| 314 | 'exclude' => '', |
| 315 | 'link' => 'lightbox', // none, file, empty(attachment), lightbox |
| 316 | 'perpage' => 24, |
| 317 | 'pagination' => '0', |
| 318 | 'lazyload' => '0', |
| 319 | 'gutter' => '1', |
| 320 | |
| 321 | 'title' => '', // header title |
| 322 | 'extra_classes' => '', // custom css class names for this element |
| 323 | 'custom_el_id' => '', // custom id attribute for this element |
| 324 | 'base_class' => 'aux-widget-gallery' // base class name for container |
| 325 | ); |
| 326 | |
| 327 | $result = auxin_get_widget_scafold( $attr, $default_atts ); |
| 328 | $atts = $result['parsed_atts']; |
| 329 | |
| 330 | // ------------------------------------------ |
| 331 | |
| 332 | $id = intval( $atts['id'] ); |
| 333 | |
| 334 | |
| 335 | if ( !$atts['wp_order'] && empty( $atts['ids'] ) ) { |
| 336 | $atts['order'] = 'ASC'; |
| 337 | $atts['orderby'] = 'post__in'; |
| 338 | } |
| 339 | |
| 340 | if ( ! empty( $atts['include'] ) ) { |
| 341 | $_attachments = get_posts( |
| 342 | array( |
| 343 | 'include' => $atts['include'], |
| 344 | 'post_status' => 'inherit', |
| 345 | 'post_type' => 'attachment', |
| 346 | 'post_mime_type' => 'image', |
| 347 | 'order' => $atts['order'], |
| 348 | 'orderby' => $atts['orderby'] |
| 349 | ) |
| 350 | ); |
| 351 | |
| 352 | $attachments = array(); |
| 353 | foreach ( $_attachments as $key => $val ) { |
| 354 | $attachments[$val->ID] = $_attachments[$key]; |
| 355 | } |
| 356 | |
| 357 | } elseif ( ! empty( $atts['exclude'] ) ) { |
| 358 | |
| 359 | $attachments = get_children( array( |
| 360 | 'post_parent' => $id, |
| 361 | 'exclude' => $atts['exclude'], |
| 362 | 'post_status' => 'inherit', |
| 363 | 'post_type' => 'attachment', |
| 364 | 'post_mime_type' => 'image', |
| 365 | 'order' => $atts['order'], |
| 366 | 'orderby' => $atts['orderby'] |
| 367 | )); |
| 368 | |
| 369 | } else { |
| 370 | |
| 371 | $attachments = get_children( array( |
| 372 | 'post_parent' => $ids, |
| 373 | 'post_status' => 'inherit', |
| 374 | 'post_type' => 'attachment', |
| 375 | 'post_mime_type' => 'image', |
| 376 | 'order' => $atts['order'], |
| 377 | 'orderby' => $atts['orderby'] |
| 378 | )); |
| 379 | } |
| 380 | |
| 381 | if ( empty( $attachments ) ) { |
| 382 | return ''; |
| 383 | } |
| 384 | |
| 385 | if ( is_feed() ) { |
| 386 | $output = "\n"; |
| 387 | foreach ( $attachments as $att_id => $attachment ) { |
| 388 | $output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n"; |
| 389 | } |
| 390 | return $output; |
| 391 | } |
| 392 | |
| 393 | $itemtag = tag_escape( $atts['itemtag'] ); |
| 394 | $captiontag = tag_escape( $atts['captiontag'] ); |
| 395 | $icontag = tag_escape( $atts['icontag'] ); |
| 396 | $valid_tags = wp_kses_allowed_html( 'post' ); |
| 397 | if ( ! isset( $valid_tags[ $itemtag ] ) ) { |
| 398 | $itemtag = 'dl'; |
| 399 | } |
| 400 | if ( ! isset( $valid_tags[ $captiontag ] ) ) { |
| 401 | $captiontag = 'dd'; |
| 402 | } |
| 403 | if ( ! isset( $valid_tags[ $icontag ] ) ) { |
| 404 | $icontag = 'dt'; |
| 405 | } |
| 406 | |
| 407 | $columns = intval( $atts['columns'] ); |
| 408 | $itemwidth = $columns > 0 ? floor(100/$columns) : 100; |
| 409 | $float = is_rtl() ? 'right' : 'left'; |
| 410 | |
| 411 | $selector = "gallery-{$instance}"; |
| 412 | |
| 413 | $gallery_style = ''; |
| 414 | |
| 415 | /** |
| 416 | * Filter whether to print default gallery styles. |
| 417 | * |
| 418 | * @since 3.1.0 |
| 419 | * |
| 420 | * @param bool $print Whether to print default gallery styles. |
| 421 | * Defaults to false if the theme supports HTML5 galleries. |
| 422 | * Otherwise, defaults to true. |
| 423 | */ |
| 424 | if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) { |
| 425 | $gallery_style = " |
| 426 | <style type='text/css'> |
| 427 | #{$selector} { |
| 428 | margin: auto; |
| 429 | } |
| 430 | #{$selector} .gallery-item { |
| 431 | float: {$float}; |
| 432 | margin-top: 10px; |
| 433 | text-align: center; |
| 434 | width: {$itemwidth}%; |
| 435 | } |
| 436 | #{$selector} img { |
| 437 | border: 2px solid #cfcfcf; |
| 438 | } |
| 439 | #{$selector} .gallery-caption { |
| 440 | margin-left: 0; |
| 441 | } |
| 442 | /* see gallery_shortcode() in wp-includes/media.php */ |
| 443 | </style>\n\t\t"; |
| 444 | } |
| 445 | |
| 446 | |
| 447 | $img_sizes = array ( |
| 448 | 'large' => 1024, |
| 449 | 'medium' => 768, |
| 450 | 'thumbnail' => 300 |
| 451 | ); |
| 452 | |
| 453 | $grid_wrapper_class = ''; |
| 454 | $grid_col_class = ''; |
| 455 | |
| 456 | $layoutAttr = $atts['layout']; |
| 457 | |
| 458 | $grid_wrapper_class = 'aux-col'. $columns;// . ' aux-no-gutter'; |
| 459 | $grid_col_class = 'aux-col'; |
| 460 | |
| 461 | if ( empty( $atts['layout'] ) || 'grid' == $atts['layout'] ){ |
| 462 | $layoutAttr = 'masonry'; |
| 463 | } else if ( 'justify-rows' == $atts['layout'] ) { |
| 464 | $layoutAttr = 'justifyRows'; |
| 465 | } |
| 466 | |
| 467 | $size_class = sanitize_html_class( $atts['size'] ); |
| 468 | $gallery_div = "<div id='$selector' class='gallery aux-gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class} aux-lightbox-frame'>"; |
| 469 | |
| 470 | $gallery_div .= "<div class='aux-gallery-container $grid_wrapper_class aux-layout-{$atts['layout']}' data-pagination='{$atts['pagination']}' data-lazyload='{$atts['lazyload']}' data-perpage='{$atts['perpage']}' data-layout='$layoutAttr' >"; |
| 471 | |
| 472 | /** |
| 473 | * Filter the default gallery shortcode CSS styles. |
| 474 | * |
| 475 | * @param string $gallery_style Default CSS styles and opening HTML div container |
| 476 | * for the gallery shortcode output. |
| 477 | */ |
| 478 | $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div ); |
| 479 | |
| 480 | $i = 0; |
| 481 | $index = 0; |
| 482 | |
| 483 | foreach ( $attachments as $id => $attachment ) { |
| 484 | $item = ""; |
| 485 | $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : ''; |
| 486 | |
| 487 | $url = get_attachment_link( $id ); |
| 488 | $original_src = auxin_get_attachment_url( $id, 'full' ); |
| 489 | |
| 490 | if ( empty( $atts['link'] ) ) { |
| 491 | $atts['link'] = 'attachment'; |
| 492 | } |
| 493 | |
| 494 | if ( 'file' === $atts['link'] || 'lightbox' === $atts['link'] ) { |
| 495 | $url = $original_src; |
| 496 | } |
| 497 | |
| 498 | if ( empty( $atts['size'] ) || $atts['size'] === 'full' ) { |
| 499 | $image_src = $original_src; |
| 500 | } else { |
| 501 | $image_src = auxin_get_the_resized_attachment_src( $id, $img_sizes[ $atts['size'] ] , $img_sizes[ $atts['size'] ] , $atts['layout'] === 'grid' , 100, $attr, true ); |
| 502 | } |
| 503 | |
| 504 | $image_meta = wp_get_attachment_metadata( $id ); |
| 505 | |
| 506 | $orientation = ''; |
| 507 | if ( isset( $image_meta['height'], $image_meta['width'] ) ) { |
| 508 | $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape'; |
| 509 | } |
| 510 | // get image size |
| 511 | $image_width = ( 'full' !== $atts['size'] && isset( $image_meta['sizes'][ $atts['size'] ]['width'] ) ) ? $image_meta['sizes'][ $atts['size'] ]['width' ] : $image_meta['width' ]; |
| 512 | $image_height = ( 'full' !== $atts['size'] && isset( $image_meta['sizes'][ $atts['size'] ]['height'] ) ) ? $image_meta['sizes'][ $atts['size'] ]['height'] : $image_meta['height']; |
| 513 | $image_alt = trim(strip_tags( get_post_meta( $id, '_wp_attachment_image_alt', true ) )); |
| 514 | |
| 515 | if ( empty( $image_alt ) ) |
| 516 | $image_alt = trim( strip_tags( $attachment->post_excerpt ) ); // If not, Use the Caption |
| 517 | if ( empty( $image_alt ) ) |
| 518 | $image_alt = trim( strip_tags( $attachment->post_title ) ); // Finally, use the title |
| 519 | |
| 520 | $loading_class = $atts['lazyload'] ? '' : 'aux-loading'; |
| 521 | |
| 522 | $item_inner = " |
| 523 | <{$icontag} class='aux-image-holder {$orientation}'> |
| 524 | <img src='$image_src' |
| 525 | data-original-src-width='{$image_meta['width']}' |
| 526 | data-original-src-height='{$image_meta['height']}' |
| 527 | data-original-src='$original_src' |
| 528 | alt='$image_alt' |
| 529 | width='$image_width' |
| 530 | height='$image_height' |
| 531 | > |
| 532 | </{$icontag}>"; |
| 533 | |
| 534 | if ( $captiontag && trim($attachment->post_excerpt) ) { |
| 535 | $item_inner .= " |
| 536 | <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'> |
| 537 | " . wptexturize($attachment->post_excerpt) . " |
| 538 | </{$captiontag}>"; |
| 539 | } |
| 540 | |
| 541 | if ( 'lightbox' === $atts['link'] ) { |
| 542 | $item_inner = "<a href='$url' class='aux-lightbox-btn'><span class='aux-plus'></span> <span class='aux-plus-bg'></span>$item_inner</a>"; |
| 543 | } elseif ( 'none' != $atts['link'] ) { |
| 544 | $item_inner = "<a href='$url'>$item_inner</a>"; |
| 545 | } |
| 546 | |
| 547 | if ( $atts['pagination'] && ++$index > $atts['perpage'] ) { |
| 548 | $item .= "<{$itemtag} class='gallery-item aux-iso-hidden $loading_class {$grid_col_class}' data-width='{$image_width}' data-height='{$image_height}'>$item_inner</{$itemtag}>"; |
| 549 | } else { |
| 550 | $item .= "<{$itemtag} class='gallery-item {$grid_col_class} $loading_class' data-width='{$image_width}' data-height='{$image_height}'>$item_inner</{$itemtag}>"; |
| 551 | } |
| 552 | |
| 553 | |
| 554 | if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) { |
| 555 | $item .= '<br style="clear: both" />'; |
| 556 | } |
| 557 | |
| 558 | $output .= $item; |
| 559 | } |
| 560 | |
| 561 | if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) { |
| 562 | $output .= " |
| 563 | <br style='clear: both' />"; |
| 564 | } |
| 565 | |
| 566 | $output .= "</div>\n</div>\n"; |
| 567 | |
| 568 | return $output; |
| 569 | } |
| 570 |