Пример #1
0
function i18n_gallery_next_link($gallery, $pic, $echo = true)
{
    return i18n_gallery_pic_link($gallery, $pic - 1 < -count($gallery['items']) ? -1 : $pic - 1, $echo);
}
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 
    }
}
Пример #3
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 
    }
}
Пример #4
0
function i18n_gallery_cycle_content($gallery, $pic)
{
    global $SITEURL;
    $id = i18n_gallery_id($gallery);
    $w = @$gallery['width'] ? $gallery['width'] : (@$gallery['height'] ? (int) $gallery['height'] * $gallery['items'][0]['width'] / $gallery['items'][0]['height'] : $gallery['items'][0]['width']);
    $h = @$gallery['height'] ? $gallery['height'] : (@$gallery['width'] ? (int) $gallery['width'] * $gallery['items'][0]['height'] / $gallery['items'][0]['width'] : $gallery['items'][0]['height']);
    // set gallery width/height for i18n_gallery_image_link:
    $gallery['width'] = $w;
    $gallery['height'] = $h;
    $tp = @$gallery['textpos'];
    if (!isset($pic) || $pic === null) {
        $pic = 0;
    } else {
        if ($pic < 0) {
            $pic = -$pic - 1;
        }
    }
    $navtype = @$gallery['navtype'] ? $gallery['navtype'] : 'dots';
    ?>
  <div id="gallery-cycle-<?php 
    echo $id;
    ?>
" class="gallery gallery-cycle gallery-<?php 
    echo $id;
    ?>
">
    <div class="gallery-container">
<?php 
    $count = count($gallery['items']);
    for ($i = 0; $i < $count; $i++) {
        $item = $gallery['items'][$i];
        $descr = @$item['_description'];
        if ($descr && !preg_match('/^(<p>|<p |<div>|<div ).*/', $descr)) {
            $descr = '<p>' . $descr . '</p>';
        }
        ?>
      <div class="gallery-slide" <?php 
        if ($i != $pic) {
            echo 'style="display:none"';
        }
        ?>
>
        <?php 
        if ($tp == 'bottom') {
            ?>
<div class="gallery-image"><img src="<?php 
            i18n_gallery_image_link($gallery, $item);
            ?>
" alt=""/></div><?php 
        }
        ?>
        <?php 
        if ($tp) {
            ?>
        <div class="gallery-text">
          <?php 
            if (@$item['_title']) {
                echo '<h2>' . htmlspecialchars($item['_title']) . '</h2>';
            }
            ?>
          <?php 
            echo $descr;
            ?>
        </div>
        <?php 
        }
        ?>
        <?php 
        if ($tp != 'bottom') {
            ?>
<div class="gallery-image"><img src="<?php 
            i18n_gallery_image_link($gallery, $item);
            ?>
" alt=""/></div><?php 
        }
        ?>
      </div>
<?php 
    }
    ?>
      <a class="prev" href="<?php 
    i18n_gallery_pic_link($gallery, $pic > 0 ? $pic - 1 : $count - 1);
    ?>
"><img src="<?php 
    echo $SITEURL;
    ?>
plugins/i18n_gallery/images/cycle/prev.png" alt=""/></a>
      <a class="next" href="<?php 
    i18n_gallery_pic_link($gallery, $pic < $count - 1 ? $pic + 1 : 0);
    ?>
"><img src="<?php 
    echo $SITEURL;
    ?>
plugins/i18n_gallery/images/cycle/next.png" alt=""/></a>
    </div>
<?php 
    if (@$gallery['navtype']) {
        ?>
    <div class="gallery-control gallery-control-<?php 
        echo $navtype;
        ?>
">
      <?php 
        for ($i = 0; $i < count($gallery['items']); $i++) {
            echo '<a href="' . i18n_gallery_pic_link($gallery, $i, false) . '"' . ($pic == $i ? ' class="activeSlide"' : '') . '>' . ($navtype == 'numbers' ? $i + 1 : '&#149;') . '</a>';
        }
        ?>
    </div>
<?php 
    }
    ?>
  </div>
  <script type="text/javascript">
    $(document).ready(function(){
<?php 
    if ($tp == 'overlay') {
        ?>
      // set text positions
      $('.gallery-cycle.gallery-<?php 
        echo $id;
        ?>
 .gallery-slide:hidden').each(function(i,elem) {
        $elem = $(elem);
        $text = $elem.find('.gallery-text');
        $elem.css('left','-10000px').show();
        $text.css('bottom',-$text.outerHeight()+'px');
        $(elem).hide().css('left','0');
      });
<?php 
    }
    ?>
      $('.gallery-cycle.gallery-<?php 
    echo $id;
    ?>
 .gallery-control').empty();
		  $('.gallery-cycle.gallery-<?php 
    echo $id;
    ?>
 .gallery-container').cycle({ 
        slideExpr: '.gallery-slide',
		    fx: <?php 
    echo @$gallery['effect'] ? json_encode($gallery['effect']) : 'scrollLeft';
    ?>
, 
		    speed: 1000,
		    timeout: <?php 
    echo @$gallery['interval'] ? intval(@$gallery['interval']) : 5000;
    ?>
,
		    pause: 1,
        prev: $('.gallery-cycle.gallery-<?php 
    echo $id;
    ?>
 .gallery-container .prev').get(),
        next: $('.gallery-cycle.gallery-<?php 
    echo $id;
    ?>
 .gallery-container .next').get(),
<?php 
    if ($tp == 'overlay') {
        ?>
        before: function(currSlideElem,nextSlideElem,options,forwardFlag) {
          $text = $(currSlideElem).find('.gallery-text');
          $text.animate({	bottom:-$text.outerHeight() },100);
        },
        after: function(currSlideElem,nextSlideElem,options,forwardFlag) {
          $text = $(nextSlideElem).find('.gallery-text');
          $text.animate({	bottom:0 },200);
        },
<?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 
        }
    }
    ?>
		    pager:  '.gallery-cycle.gallery-<?php 
    echo $id;
    ?>
 .gallery-control',
		    pagerAnchorBuilder: function(idx, slide) { return '<a href="#">'+<?php 
    echo $navtype == 'numbers' ? '(idx+1)' : "'&#149;'";
    ?>
+'</a>'; } 
		  });
    });
  </script>
<?php 
}