当前位置: 首页>>代码示例>>PHP>>正文


PHP gallery_shortcode函数代码示例

本文整理汇总了PHP中gallery_shortcode函数的典型用法代码示例。如果您正苦于以下问题:PHP gallery_shortcode函数的具体用法?PHP gallery_shortcode怎么用?PHP gallery_shortcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了gallery_shortcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: new_gallery_shortcode

/**
 * Add an option to gallery images with no links
 */
function new_gallery_shortcode($attr)
{
    global $post, $wp_locale;
    $output = gallery_shortcode($attr);
    if ($attr['link'] == "none") {
        $output = preg_replace(array('/<a[^>]*>/', '/<\\/a>/'), '', $output);
    }
    return $output;
}
开发者ID:centroculturalsp,项目名称:cultural,代码行数:12,代码来源:extras.php

示例2: fotorama_gallery_shortcode

function fotorama_gallery_shortcode($atts)
{
    if (!$atts) {
        $atts = array();
    }
    if (array_key_exists('fotorama', $atts) && $atts['fotorama'] == 'false') {
        return gallery_shortcode($atts);
    }
    $atts['link'] = 'file';
    $atts['itemtag'] = 'dl';
    $atts['icontag'] = 'dt';
    $atts['captiontag'] = 'dd';
    $atts['columns'] = 0;
    if (array_key_exists('orderby', $atts) && $atts['orderby'] == 'rand') {
        $atts['orderby'] = '';
        $atts['shuffle'] = 'true';
    }
    $atts['size'] = 'thumbnail';
    $gallery = gallery_shortcode($atts);
    $width = array_key_exists('width', $atts) ? $atts['width'] : '';
    $height = array_key_exists('height', $atts) ? $atts['height'] : '';
    $atts['size'] = 'large';
    preg_match_all('/(<img[^<>]*>).*\\n*.*<\\/dt/', gallery_shortcode($atts), $images);
    preg_match_all('/href=(\'|")([^"\']+)(\'|").*\\n*.*<\\/dt/', $gallery, $hrefs);
    for ($i = 0, $l = count($images[0]); $i < $l; $i++) {
        $image = $images[1][$i];
        preg_match('/src=(\'|")([^"\']+)(\'|")/', $image, $src);
        if (!$i) {
            preg_match('/width=(\'|")([^"\']+)(\'|")/', $image, $__width);
            $_width = $__width[2];
            preg_match('/height=(\'|")([^"\']+)(\'|")/', $image, $__height);
            $_height = $__height[2];
            if (!$width) {
                $atts['width'] = $_width;
            }
            if (!$height) {
                $height = $_height;
            }
        }
        $quote = $hrefs[1][$i];
        $full = $hrefs[2][$i];
        $gallery = str_replace($quote . $full . $quote, $quote . $src[2] . $quote . ' data-full=' . $quote . $full . $quote, $gallery);
    }
    $atts['auto'] = 'false';
    $atts['max-width'] = '100%';
    $atts['ratio'] = array_key_exists('ratio', $atts) ? $atts['ratio'] : ($_width && $_height ? $_width / $_height : '');
    $data = '';
    foreach ($atts as $key => $value) {
        if ($key != 'fotorama') {
            $data .= "data-{$key}='{$value}'";
        }
    }
    return "<div class='fotorama--wp' {$data}>{$gallery}</div>";
}
开发者ID:teshenaliev,项目名称:decisiontree,代码行数:54,代码来源:fotorama.php

示例3: carelib_get_attachment_image_gallery

/**
 * Output a formatted WordPress image gallery of related attachments on
 * attachment image pages.
 *
 * @since  1.0.0
 * @access public
 * @return string
 */
function carelib_get_attachment_image_gallery()
{
    if (!wp_attachment_is_image()) {
        return false;
    }
    $parent = get_queried_object()->post_parent;
    if (empty($parent)) {
        return false;
    }
    $gallery = gallery_shortcode(array('columns' => 4, 'numberposts' => 8, 'orderby' => 'rand', 'id' => $parent, 'exclude' => get_the_ID()));
    if (empty($gallery)) {
        return false;
    }
    $markup = '<div class="image-gallery"><h3 class="attachment-meta-title">%s</h3>%s</div>';
    $title = esc_attr__('Related Images', 'carelib');
    $output = sprintf($markup, $title, $gallery);
    return apply_filters("{$GLOBALS['carelib_prefix']}_attachment_image_gallery", $output, $markup, $title, $gallery);
}
开发者ID:wpsitecare,项目名称:carelib,代码行数:26,代码来源:template-attachment.php

示例4: bootstrat_carousel_gallery_shortcode

function bootstrat_carousel_gallery_shortcode($attr)
{
    /* Validate for necessary data */
    if (isset($attr['ids']) and isset($attr['type']) and $attr['type'] == 'carousel') {
        /* Define data by given attributes. */
        $attr['ids'] = $attr['ids'];
        $attr['name'] = isset($attr['name']) ? sanitize_title($attr['name']) : 'bootstrap-carousel';
        /* Any name. String will be sanitize to be used as HTML ID. Recomended when you want to have more than one carousel in the same page. Default: bootstrap-carousel. */
        $attr['width'] = isset($attr['width']) ? $attr['width'] : '';
        /* Carousel container width, in px or % */
        $attr['height'] = isset($attr['height']) ? $attr['height'] : '';
        /* Carousel item height, in px or % */
        $attr['indicators'] = isset($attr['indicators']) ? $attr['indicators'] : 'before-inner';
        /* Accepted values: before-inner, after-inner, after-control, false. Default: before-inner. */
        $attr['control'] = isset($attr['control']) ? $attr['control'] : 'true';
        /* Accepted values: true, false. Default: true. */
        $attr['interval'] = isset($attr['interval']) ? $attr['interval'] : 5000;
        /* The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. */
        $attr['pause'] = isset($attr['pause']) ? $attr['pause'] : 'hover';
        /* Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. */
        $attr['titletag'] = isset($attr['titletag']) ? $attr['titletag'] : 'h4';
        /* Define tag for image title. Default: h4. */
        $attr['title'] = isset($attr['title']) ? $attr['title'] : 'true';
        /* Show or hide image title. Set false to hide. Default: true. */
        $attr['text'] = isset($attr['text']) ? $attr['text'] : 'true';
        /* Show or hide image text. Set false to hide. Default: true. */
        $attr['wpautop'] = isset($attr['wpautop']) ? $attr['wpautop'] : 'true';
        /* Auto-format text. Default: true. */
        $attr['containerclass'] = isset($attr['containerclass']) ? $attr['containerclass'] : '';
        /* Extra class for container. */
        $attr['itemclass'] = isset($attr['itemclass']) ? $attr['itemclass'] : '';
        /* Extra class for item. */
        $attr['captionclass'] = isset($attr['captionclass']) ? $attr['captionclass'] : '';
        /* Extra class for caption. */
        /* Obtain HTML. */
        $output = bootstrat_carousel_get_html_from($attr);
        /* If attributes could not be validated, execute default gallery shortcode function */
    } else {
        $output = gallery_shortcode($attr);
    }
    return $output;
}
开发者ID:CamionCiterne,项目名称:wordpress_fbpc,代码行数:42,代码来源:bootstrap-carousel.php

示例5: twentytwentyproton

/**
 * Gallery Shortcode Function
 * @param array $attrs Shortcode Attributes
 * @return none
 */
function twentytwentyproton($attrs)
{
    //fallback to previous gallery shortcode
    if ($attrs["link"] != "twentytwentyproton") {
        return gallery_shortcode($attrs);
    }
    //check if image ids are set
    if (!empty($attrs["ids"])) {
        //explode ids and make sure there are exactly two
        $ids = explode(",", $attrs["ids"]);
        if (count($ids) == 2) {
            //get images info
            $images = array(wp_get_attachment_image_src($ids[0], $attrs["size"]), wp_get_attachment_image_src($ids[1], $attrs["size"]));
            //generate unique id for dom elements
            $uniqid = uniqid();
            //initialize markup and javascript
            $content = "\r\n\t\t\t\t<script type='text/javascript'>\r\n\t\t\t\t\twindow.addEventListener('load',function(){\r\n\t\t\t\t\t\tjQuery('#" . $uniqid . "').show().twentytwentyproton({\r\n\t\t\t\t\t\t\tparticle:'" . plugin_dir_url(__FILE__) . "twentytwenty-proton/img/particle.png',\r\n\t\t\t\t\t\t\tfullscreen:false\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t</script>\r\n\t\t\t\t<div id='" . $uniqid . "' style='display:none; width:" . max($images[0][1], $images[1][1]) . "px;'>\r\n\t\t\t\t\t<img src='" . $images[0][0] . "' width='" . $images[0][1] . "' height='" . $images[0][2] . "' />\r\n\t\t\t\t\t<img src='" . $images[1][0] . "' width='" . $images[1][1] . "' height='" . $images[1][2] . "' />\r\n\t\t\t\t</div>\r\n\t\t\t";
        }
    }
    return $content;
}
开发者ID:zcnet,项目名称:twentytwenty-proton,代码行数:26,代码来源:twentytwenty-proton.php

示例6: gallery_shortcode

 public function gallery_shortcode($attr)
 {
     $attr = wp_parse_args($attr, array('itemtag' => 'li', 'icontag' => 'div', 'captiontag' => 'div', 'lightbox' => true));
     $open_in_lightbox = $attr['lightbox'] !== 'false';
     if ($open_in_lightbox) {
         $attr['link'] = 'file';
     }
     $html = gallery_shortcode($attr);
     $html = preg_replace('/<br[^>]*>/i', '', $html);
     $open_tag_found = preg_match('/^\\s*(<div[^>]*>)/i', $html, $open_matches);
     $close_tag_found = preg_match('/(<\\/div>)\\s*$/i', $html);
     // replace first opening and last closing tag
     if ($open_tag_found && $close_tag_found) {
         $open_div = $open_matches[1];
         $new_open_div = str_replace('div', 'figure', $open_div) . '<ol>';
         $html = str_replace($open_div, $new_open_div, $html);
         $html = preg_replace('/<\\/div>\\s*$/', '</ol></figure>', $html);
         $lightbox_group_id = rand();
         if ($open_in_lightbox) {
             $html = str_replace('<a', '<a data-g1-lightbox="gallery-' . $lightbox_group_id . '"', $html);
         }
     }
     return $html;
 }
开发者ID:aragonc,项目名称:3clicks,代码行数:24,代码来源:theme-functions.php

示例7: alpha_attachment_image_gallery

/**
 * Output a formatted WordPress image gallery of related attachments on
 * attachment image pages.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function alpha_attachment_image_gallery()
{
    if (!wp_attachment_is_image()) {
        return;
    }
    $parent = get_queried_object()->post_parent;
    if (empty($parent)) {
        return;
    }
    $gallery = gallery_shortcode(array('columns' => 4, 'numberposts' => 8, 'orderby' => 'rand', 'id' => $parent, 'exclude' => get_the_ID()));
    if (empty($gallery)) {
        return;
    }
    $markup = '<div class="image-gallery"><h3 class="attachment-meta-title">%s</h3>%s</div>';
    $title = esc_attr__('Related Images', 'alpha');
    echo apply_filters('alpha_attachment_image_gallery', sprintf($markup, $title, $gallery), $markup, $title, $gallery);
}
开发者ID:rolka,项目名称:alpha,代码行数:25,代码来源:template-attachment.php

示例8: widget

 function widget($args, $instance)
 {
     if (!is_singular()) {
         return;
     }
     //only run on single post/page/custom post_type pages
     $post = get_post();
     if (is_null($post)) {
         return;
     }
     //we have a post to work with
     $gargs = array('columns' => 1, 'link' => 'file', 'orderby' => 'rand', 'size' => $instance['size']);
     if ($instance['hide_featured'] && ($featured_image = get_post_thumbnail_id($post->ID))) {
         $gargs['exclude'] = $featured_image;
     }
     $gallery = gallery_shortcode($gargs);
     if (empty($gallery)) {
         return;
     }
     //no gallery so do not display an empty widget
     $args = $this->override_args($args, $instance);
     extract($args);
     echo $before_widget;
     echo $gallery;
     echo $after_widget;
     self::limit_images($post->ID, $instance['posts_per_page'], $instance['lightbox']);
 }
开发者ID:jonpetersen,项目名称:PHTC,代码行数:27,代码来源:class-post-widgets.php

示例9: _e

		<div class="media-info image-info">

			<h3 class="attachment-meta-title"><?php 
    _e('Image Info', 'saga');
    ?>
</h3>

			<?php 
    hybrid_media_meta();
    ?>

		</div><!-- .media-info -->

		<?php 
    $gallery = gallery_shortcode(array('columns' => 4, 'numberposts' => 8, 'orderby' => 'rand', 'id' => get_queried_object()->post_parent, 'exclude' => get_the_ID()));
    ?>

		<?php 
    if (!empty($gallery)) {
        // Check if the gallery is not empty.
        ?>

			<div class="image-gallery">
				<h3 class="attachment-meta-title"><?php 
        _e('Gallery', 'saga');
        ?>
</h3>
				<?php 
        echo $gallery;
        ?>
开发者ID:8manos,项目名称:bogohack,代码行数:30,代码来源:attachment-image.php

示例10: gdlr_gallery_shortcode

function gdlr_gallery_shortcode($atts)
{
    if (!empty($atts['masterslider']) && $atts['masterslider'] == "true") {
        return gallery_shortcode($atts);
    }
    extract(shortcode_atts(array('columns' => '3', 'ids' => '', 'link' => 'post', 'type' => 'grid', 'caption' => 'yes', 'caption_position' => 'left', 'thumbnail_size' => 'thumbnail', 'size' => ''), $atts));
    $settings = array();
    $settings['show-caption'] = $caption;
    if (!empty($size)) {
        $settings['thumbnail-size'] = $size;
    } else {
        $settings['thumbnail-size'] = $thumbnail_size;
    }
    $settings['gallery-columns'] = $columns;
    $slides = array();
    $ids = explode(',', $ids);
    foreach ($ids as $slide_id) {
        $data = array();
        if ($link == 'file') {
            $data['slide-link'] = 'current';
        } else {
            if ($link == 'post') {
                $data['new-tab'] = 'disable';
                $data['slide-link'] = 'url';
                $data['url'] = get_permalink($slide_id);
            }
        }
        if ($type == 'slider' && $caption == 'yes') {
            $attachment = gdlr_get_attachment_info($slide_id);
            $data['title'] = $attachment['title'];
            $data['caption'] = $attachment['caption'];
            $data['caption-position'] = $caption_position;
        }
        $slides[$slide_id] = $data;
    }
    if (function_exists('gdlr_get_slider_item') && $type == 'slider') {
        $settings['slider-type'] = 'flexslider';
        return gdlr_get_flex_slider($slides, array('size' => $thumbnail_size));
    } else {
        if (function_exists('gdlr_get_gallery_thumbnail') && $type == 'thumbnail') {
            $settings['slider'] = $slides;
            return '<div class="gdlr-shortcode-wrapper">' . gdlr_get_gallery_thumbnail($settings) . '</div>';
        } else {
            if (function_exists('gdlr_get_gallery')) {
                $settings['slider'] = $slides;
                return '<div class="gdlr-shortcode-wrapper">' . gdlr_get_gallery($settings) . '</div>';
            }
        }
    }
    return '';
}
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:51,代码来源:gdlr-shortcode-elements.php

示例11: photo_galleria_scripts_head

/**
 * Add scripts to head
 */
function photo_galleria_scripts_head()
{
    global $post, $wp_query;
    // Retreive our plugin options
    $photo_galleria = get_option('photo_galleria');
    $design = $photo_galleria['design'];
    if ($design == 'classic' || $design == '') {
        $design = PHOTO_GALLERIA_PLUGIN_URL . '/themes/classic/galleria.classic.js';
    } elseif ($design == 'dots') {
        $design = PHOTO_GALLERIA_PLUGIN_URL . '/themes/dots/galleria.dots.js';
    }
    //elseif ($design == 'fullscreen') {
    //$design = '/themes/fullscreen/galleria.fullscreen.js';}
    $autoplay = $photo_galleria['autoplay'];
    if ($autoplay == 1) {
        $autoplay = '5000';
    }
    if ($autoplay == 0) {
        $autoplay = 'false';
    }
    $height = $photo_galleria['height'];
    if ($height == "") {
        $height = 500;
    }
    $width = $photo_galleria['width'];
    if ($width == "") {
        $width = 500;
    }
    $transition = $photo_galleria['transition'];
    // show only on homepage and archive pages
    if (!is_admin() && is_home() || !is_admin() && is_archive()) {
        echo "\n<script type=\"text/javascript\">\n\t\t\t    \n  // Load theme\n  Galleria.loadTheme('" . $design . "');\n\t";
        // run galleria and add some options
        echo "jQuery('";
        $posts = get_posts('numberposts=-1');
        $stack = array();
        foreach ($posts as $post) {
            $pid = $post->ID;
            if (stripos($post->post_content, '[gallery') !== false) {
                $element = "#galleria-" . $pid;
                array_push($stack, $element);
            }
        }
        //print_r($stack);
        $lastitem = end($stack);
        foreach ($stack as $ele) {
            if ($ele != $lastitem) {
                echo $ele . ", ";
            } else {
                echo $ele;
            }
        }
        echo "').galleria({\n  \t\tautoplay: " . $autoplay . ",\n      height: " . $height . ",\n\t\t\twidth: " . $width . ",\n      transition: '" . $transition . "',\n      data_config: function(img) {\n          // will extract and return image captions from the source:\n          return  {\n              title: jQuery(img).parent().next('strong').html(),\n              description: jQuery(img).parent().next('strong').next().html()\n          };\n      }\n  });\n  </script>\n";
    }
    // Show only on single posts and pages
    if (!is_admin() && is_single() || !is_admin() && is_page() && !is_page_template('page-blog.php')) {
        echo "\n<script type=\"text/javascript\">\n\t\t\t    \n  // Load theme\n  Galleria.loadTheme('" . $design . "');\n\t";
        // run galleria and add some options
        echo "jQuery('";
        if (gallery_shortcode($post->ID)) {
            $pid = $post->ID;
        }
        echo "#galleria-" . $pid . "').galleria({\n  \t\tautoplay: " . $autoplay . ",\n      height: " . $height . ",\n\t  clicknext: 'false',\n      width: " . $width . ",\n      transition: '" . $transition . "',\n      data_config: function(img) {\n          // will extract and return image captions from the source:\n          return  {\n              title: jQuery(img).parent().next('strong').html(),\n              description: jQuery(img).parent().next('strong').next().html()\n          };\n      }\n  });\n  </script>\n";
    }
}
开发者ID:ejoan,项目名称:erikajoan.com,代码行数:68,代码来源:photo-galleria.php

示例12: exclude_thumbnail_from_gallery

function exclude_thumbnail_from_gallery($null, $attr)
{
    if (!($thumbnail_ID = get_post_thumbnail_id())) {
        return $null;
    }
    // no point carrying on if no thumbnail ID
    // temporarily remove the filter, otherwise endless loop!
    remove_filter('post_gallery', 'exclude_thumbnail_from_gallery');
    // pop in our excluded thumbnail
    if (!isset($attr['exclude']) || empty($attr['exclude'])) {
        $attr['exclude'] = array($thumbnail_ID);
    } elseif (is_array($attr['exclude'])) {
        $attr['exclude'][] = $thumbnail_ID;
    }
    // now manually invoke the shortcode handler
    $gallery = gallery_shortcode($attr);
    // add the filter back
    add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
    // return output to the calling instance of gallery_shortcode()
    return $gallery;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:21,代码来源:functions.php

示例13: lsx_portfolio_gallery

 function lsx_portfolio_gallery()
 {
     $media = get_attached_media('image');
     $media_array = array();
     $post_thumbnail_id = get_post_thumbnail_id(get_the_ID());
     if (!empty($media)) {
         foreach ($media as $media_item) {
             if ($post_thumbnail_id != $media_item->ID) {
                 $media_array[] = $media_item->ID;
             }
         }
         if (!empty($media_array)) {
             echo gallery_shortcode(array('size' => 'full', 'ids' => implode(',', $media_array)));
         }
     }
 }
开发者ID:LinaPeterssonOberg,项目名称:exam,代码行数:16,代码来源:template-tags.php

示例14: the_ID

        ?>

						</article><!-- #post-<?php 
        the_ID();
        ?>
 -->

					<?php 
        // Action hook for placing content after post content
        do_action('satu_entry_after');
        ?>

					<div class="attachment-gallery">

						<?php 
        $gallery = gallery_shortcode(array('columns' => 4, 'numberposts' => 8, 'id' => $post->post_parent, 'exclude' => get_the_ID()));
        ?>

						<?php 
        if (!empty($gallery)) {
            ?>
							<div class="image-gallery">
								<?php 
            echo $gallery;
            ?>
							</div>
						<?php 
        }
        ?>

					</div><!-- .attachment-gallery -->
开发者ID:centaurustech,项目名称:gapura,代码行数:31,代码来源:attachment-image.php

示例15: bb_gallery_shortcode

    public static function bb_gallery_shortcode($attr, $content = '')
    {
        if (is_feed() || is_array($attr) && !empty($attr['mode']) && $attr['mode'] === 'wordpress') {
            # invoke the standard WordPress gallery shortcode function
            unset($attr['mode']);
            return gallery_shortcode($attr);
        }
        if (is_array($attr) && !empty($attr['mode']) && $attr['mode'] === 'get_first') {
            # in this mode only the first image is returned for use as a representative image for a gallery
            unset($attr['mode']);
            $get_first = TRUE;
            ob_start();
            #TODO: set underlying SQL LIMIT to 1
        }
        foreach (['thumbnail', 'medium', 'medium_large', 'large', 'full'] as $size) {
            $label = "{$size}_width";
            $width = intval(get_option("{$size}_size_w"));
            if (!$width && $size === 'medium_large') {
                $width = 768;
            }
            $width = intval(1.125 * $width);
            if ($size === 'thumbnail') {
                ${$label} = $width;
            } else {
                ${$label} = $prev_width + 1;
            }
            $prev_width = $width;
        }
        ob_start();
        require_once dirname(__FILE__) . '/bbg_xiv-gallery_templates_wp_rest.php';
        $templates = ob_get_clean();
        $post = get_post();
        static $instance = 10000;
        # not 0 to create a different space from the WordPress "gallery" shortcode
        $instance++;
        static $bbg_xiv_data = ['version' => '1.0'];
        $bbg_xiv_data['ajaxurl'] = admin_url('admin-ajax.php');
        $bbg_xiv_data['bbg_xiv_flex_min_width'] = get_option('bbg_xiv_flex_min_width', 128);
        $bbg_xiv_data['bbg_xiv_flex_min_width_for_caption'] = get_option('bbg_xiv_flex_min_width_for_caption', 96);
        $bbg_xiv_data['bbg_xiv_max_search_results'] = get_option('bbg_xiv_max_search_results', 250);
        $bbg_xiv_data['bbg_xiv_flex_min_width_for_dense_view'] = get_option('bbg_xiv_flex_min_width_for_dense_view', 1280);
        $bbg_xiv_data['bbg_xiv_flex_number_of_dense_view_columns'] = get_option('bbg_xiv_flex_number_of_dense_view_columns', 10);
        $bbg_xiv_data['bbg_xiv_carousel_interval'] = get_option('bbg_xiv_carousel_interval', 2500);
        $bbg_xiv_data['bbg_xiv_disable_flexbox'] = get_option('bbg_xiv_disable_flexbox', FALSE);
        $bbg_xiv_data['bbg_xiv_default_view'] = get_option('bbg_xiv_default_view', 'Gallery');
        $bbg_xiv_data['bbg_xiv_wp_rest_api'] = self::$wp_rest_api_available && self::$use_wp_rest_api_if_available;
        # translations for JavaScript side
        $bbg_xiv_lang['Nothing Found'] = __('Nothing Found', 'bb_gallery');
        $bbg_xiv_lang['Search Results for'] = __('Search Results for', 'bb_gallery');
        $bbg_xiv_lang['Page'] = __('Page', 'bb_gallery');
        $bbg_xiv_lang['of'] = __('of', 'bb_gallery');
        $bbg_xiv_lang['Images'] = __('Images', 'bb_gallery');
        $bbg_xiv_lang['to'] = __('to', 'bb_gallery');
        $bbg_xiv_lang['galleryOfGalleriesTitle'] = __('Each image below represents a gallery. Please click on an image to load its gallery.', 'bb_gallery');
        $default_flags = [];
        switch (get_option('bbg_xiv_use_tiles', 'Cover')) {
            case 'Cover':
                $default_flags[] = 'tiles';
                break;
            case 'Contain':
                $default_flags[] = 'tiles';
                $default_flags[] = 'contain';
                break;
            case 'Fill':
                $default_flags[] = 'tiles';
                $default_flags[] = 'fill';
                break;
        }
        if (get_option('bbg_xiv_use_embedded_carousel', TRUE)) {
            $default_flags[] = 'embedded-carousel';
        }
        if (is_array($attr)) {
            if (!empty($attr['mode']) && $attr['mode'] === "galleries") {
                # this is a proprietary mode to display altgallery entries as a gallery of representative images
                $gallery_icons_mode = TRUE;
            }
            if (!empty($attr['view'])) {
                # this sets the initial view of a gallery - gallery, carousel or tabs
                $default_view = $attr['view'];
            }
            if (!empty($attr['flags'])) {
                # flag to set embedded carousel mode
                $flags = $attr['flags'];
            }
        }
        # merge the default flags and the flags from the shortcode
        if (empty($flags)) {
            $flags = $default_flags;
        } else {
            $flags = explode(',', $flags);
            $flags = array_merge($default_flags, $flags);
            $flags = array_unique($flags);
        }
        # handle cancel flags
        foreach (['embedded-carousel', 'tiles', 'contain', 'fill'] as $flag) {
            if (($i = array_search('no-' . $flag, $flags)) !== FALSE) {
                unset($flags[$i]);
                if (($j = array_search($flag, $flags)) !== FALSE) {
                    unset($flags[$j]);
                }
//.........这里部分代码省略.........
开发者ID:magenta-cuda,项目名称:bb-gallery,代码行数:101,代码来源:bbg_xiv-gallery.php


注:本文中的gallery_shortcode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。