コード例 #1
0
function i18n_gallery_fancybox_content($gallery, $pic)
{
    $id = i18n_gallery_id($gallery);
    if (i18n_gallery_is_show_image($pic)) {
        $item = i18n_gallery_item($gallery, $pic);
        ?>
    <div class="gallery gallery-fancybox gallery-<?php 
        echo $id;
        ?>
">
      <div class="gallery-image ">
        <a id="fancybox-close" href="<?php 
        i18n_gallery_back_link();
        ?>
" title="<?php 
        i18n_gallery_BACK();
        ?>
"></a>      
        <h2><?php 
        echo htmlspecialchars(@$item['_title']);
        ?>
</h2>
        <img src="<?php 
        i18n_gallery_image_link($gallery, $pic);
        ?>
" alt="<?php 
        echo htmlspecialchars(@$item['_title']);
        ?>
"/>
        <?php 
        if (@$item['_description']) {
            echo '<p>' . htmlspecialchars(@$item['_description']) . '</p>';
        }
        ?>
        <a id="fancybox-left" href="<?php 
        i18n_gallery_prev_link($gallery, $pic);
        ?>
" title="<?php 
        i18n_gallery_PREV();
        ?>
"><span id="fancybox-left-ico" class="fancy-ico"></span></a>
        <a id="fancybox-right" href="<?php 
        i18n_gallery_next_link($gallery, $pic);
        ?>
" title="<?php 
        i18n_gallery_NEXT();
        ?>
"><span id="fancybox-right-ico" class="fancy-ico"></span></a>
      </div>
    </div>
<?php 
    } else {
        $thumb = i18n_gallery_thumb($gallery);
        $showtitles = i18n_gallery_check($gallery, 'thumbtitles', false);
        $pageSize = !isset($thumb) && i18n_gallery_check($gallery, 'pagify', false) ? (int) $gallery['pagesize'] : 0;
        ?>
    <div class="gallery gallery-fancybox gallery-<?php 
        echo $id;
        ?>
">
<?php 
        $i = 0;
        foreach ($gallery['items'] as $item) {
            $text = @$item['_title'];
            if (!$text) {
                $text = @$item['_description'];
            } else {
                if (@$item['_description']) {
                    $text .= ' - ' . $item['_description'];
                }
            }
            ?>
      <div class="gallery-thumb" <?php 
            if (isset($thumb) && $thumb != $i) {
                echo 'style="display:none"';
            }
            ?>
>
        <a href="<?php 
            i18n_gallery_pic_link($gallery, $i);
            ?>
" rel="fancybox-<?php 
            echo $id;
            ?>
" title="<?php 
            echo htmlspecialchars($text);
            ?>
">
          <img src="<?php 
            i18n_gallery_thumb_link($gallery, $item);
            ?>
" alt="<?php 
            echo htmlspecialchars(@$item['_description']);
            ?>
"/>
        </a>
<?php 
            if ($showtitles) {
                ?>
        <p class="gallery-title"><?php 
                echo htmlspecialchars(@$item['_title']);
                ?>
</p>
<?php 
            }
            ?>
      </div>
<?php 
            $i++;
        }
        ?>
      <div style="clear:both"></div>
    </div>
    <script type="text/javascript">
      $(document).ready(function(){
        var $sel = $("[rel=fancybox-<?php 
        echo $id;
        ?>
]")
        <?php 
        i18n_gallery_replace_nojs_links($gallery, '$sel');
        ?>
        $sel.fancybox({
<?php 
        if ($pageSize >= 1) {
            ?>
          onStart: function(arr,index,opts) {
            var page = Math.floor(index/<?php 
            echo $pageSize;
            ?>
) + 1;
            $('.gallery-<?php 
            echo $id;
            ?>
').pagify('setPage', page);
          },
<?php 
        }
        ?>
          
          cyclic: true
<?php 
        foreach ($gallery as $key => $value) {
            if (substr($key, 0, 2) == 'x-') {
                ?>
          ,<?php 
                echo substr($key, 2);
                ?>
: <?php 
                echo preg_match('/^(null|true|false|\\d+)$/', $value) ? $value : json_encode($value);
            }
        }
        ?>
        });
<?php 
        if (i18n_gallery_is_goto_image($pic)) {
            ?>
        $("[rel=fancybox-<?php 
            echo $id;
            ?>
]:eq(<?php 
            echo (int) $pic;
            ?>
)").trigger('click');
<?php 
        }
        if ($pageSize >= 1) {
            ?>
        $('.gallery-<?php 
            echo $id;
            ?>
').pagify({ pageSize:<?php 
            echo $pageSize;
            ?>
, items:'.gallery-thumb' });
<?php 
        }
        ?>
      });
    </script>
<?php 
    }
}
コード例 #2
0
function i18n_gallery_prettyphoto_content($gallery, $pic)
{
    $id = i18n_gallery_id($gallery);
    if (i18n_gallery_is_show_image($pic)) {
        $item = i18n_gallery_item($gallery, $pic);
        ?>
    <div class="gallery gallery-prettyphoto gallery-<?php 
        echo $id;
        ?>
">
      <div class="gallery-image pp_default">
        <a class="pp_arrow_previous" href="<?php 
        i18n_gallery_prev_link($gallery, $pic);
        ?>
" title="<?php 
        i18n_gallery_PREV();
        ?>
"><?php 
        i18n_gallery_PREV();
        ?>
</a>
        <a class="pp_arrow_next" href="<?php 
        i18n_gallery_next_link($gallery, $pic);
        ?>
" title="<?php 
        i18n_gallery_NEXT();
        ?>
"><?php 
        i18n_gallery_NEXT();
        ?>
</a>
        <a class="pp_close" href="<?php 
        i18n_gallery_back_link();
        ?>
" title="<?php 
        i18n_gallery_BACK();
        ?>
"><?php 
        i18n_gallery_BACK();
        ?>
</a>
        <h2><?php 
        echo htmlspecialchars(@$item['_title']);
        ?>
</h2>
        <img src="<?php 
        i18n_gallery_image_link($gallery, $pic);
        ?>
" alt="<?php 
        echo htmlspecialchars(@$item['_title']);
        ?>
"/>
        <?php 
        if (@$item['_description']) {
            echo '<p>' . htmlspecialchars(@$item['_description']) . '</p>';
        }
        ?>
      </div>
    </div>
<?php 
    } else {
        $thumb = i18n_gallery_thumb($gallery);
        $showtitles = i18n_gallery_check($gallery, 'thumbtitles', false);
        $pageSize = !isset($thumb) && i18n_gallery_check($gallery, 'pagify', false) ? (int) $gallery['pagesize'] : 0;
        ?>
    <div class="gallery gallery-prettyphoto gallery-<?php 
        echo $id;
        ?>
">
<?php 
        $i = 0;
        foreach ($gallery['items'] as $item) {
            ?>
      <div class="gallery-thumb" <?php 
            if (isset($thumb) && $thumb != $i) {
                echo 'style="display:none"';
            }
            ?>
>
        <a href="<?php 
            i18n_gallery_pic_link($gallery, $i);
            ?>
" rel="prettyPhoto[<?php 
            echo $id;
            ?>
]" title="<?php 
            echo htmlspecialchars(@$item['_description']);
            ?>
">
          <img src="<?php 
            i18n_gallery_thumb_link($gallery, $item);
            ?>
" alt="<?php 
            echo htmlspecialchars(@$item['_title']);
            ?>
"/>
        </a>
<?php 
            if ($showtitles) {
                ?>
        <p class="gallery-title"><?php 
                echo htmlspecialchars(@$item['_title']);
                ?>
</p>
<?php 
            }
            ?>
      </div>
<?php 
            $i++;
        }
        ?>
      <div style="clear:both"></div>
    </div>
    <script type="text/javascript">
      $(document).ready(function(){
        var $sel = $("a[rel='prettyPhoto[<?php 
        echo $id;
        ?>
]']");
        <?php 
        i18n_gallery_replace_nojs_links($gallery, '$sel');
        ?>
        $sel.prettyPhoto({
<?php 
        if (i18n_gallery_check($gallery, 'autostart', false) && $pic == null) {
            echo "autoplay_slideshow: true, ";
        }
        if (@$gallery['theme']) {
            echo "theme: " . json_encode($gallery['theme']) . ", ";
        }
        if (intval(@$gallery['interval'])) {
            echo "slideshow: " . intval(@$gallery['interval']) . ", ";
        }
        ?>
          social_tools: false
<?php 
        foreach ($gallery as $key => $value) {
            if (substr($key, 0, 2) == 'x-') {
                ?>
          ,<?php 
                echo substr($key, 2);
                ?>
: <?php 
                echo preg_match('/^(null|true|false|\\d+)$/', $value) ? $value : json_encode($value);
            }
        }
        ?>
        });
<?php 
        if (i18n_gallery_is_goto_image($pic)) {
            ?>
        if (window.location.href.indexOf('#') < 0) $("a[rel='prettyPhoto[<?php 
            echo $id;
            ?>
]']:eq(<?php 
            echo (int) $pic;
            ?>
)").trigger('click');
<?php 
        } else {
            if (i18n_gallery_check($gallery, 'autostart', false)) {
                ?>
        if (window.location.href.indexOf('#') < 0) $("a[rel='prettyPhoto[<?php 
                echo $id;
                ?>
]']:eq(0)").trigger('click');
<?php 
            }
        }
        if ($pageSize >= 1) {
            ?>
        $('.gallery-<?php 
            echo $id;
            ?>
').pagify({ pageSize:<?php 
            echo $pageSize;
            ?>
, items:'.gallery-thumb'});
<?php 
        }
        ?>
      });
    </script>
<?php 
    }
}