Esempio n. 1
0
    /**
     * LazyestFrontend::folder_code()
     * Returns html code for a folder shortcode
     * 
     * @example [lg_folder folder="afolder/" count="10" cols="3" paging="true"] 
     * @param mixed $atts
     * @return string
     */
    function folder_code($atts)
    {
        global $lg_show;
        extract(shortcode_atts(array('folder' => '', 'count' => $this->get_option('thumbs_page'), 'cols' => $this->get_option('thumbs_columns'), 'paging' => 'true'), $atts));
        $folder = trailingslashit(ltrim(utf8_decode($folder), '/'));
        $folder = html_entity_decode($folder);
        $this->valid();
        $folder_code = sprintf(__('Lazyest Gallery cannot access %s', 'lazyest-gallery'), lg_html($folder));
        $paging = strtolower($paging);
        if (isset($lg_show)) {
            $this->slideshow = $lg_show;
        } else {
            if (isset($_GET['lg_show'])) {
                $this->slideshow = $_GET['lg_show'];
            }
        }
        $the_folder = new LazyestFrontendFolder($folder);
        $this->valid();
        // set $this->file
        if ($the_folder->valid()) {
            if ('true' == $this->slideshow && $this->file == $folder) {
                ob_start();
                $the_folder->slideshow();
            } else {
                $the_folder->open();
                ob_start();
                ?>

  		<div class="lg_gallery">
      <?php 
                if (isset($this->file) && $this->is_image($this->file) && $this->currentdir == $the_folder->curdir) {
                    $the_folder->show_slide(basename($this->file));
                } else {
                    $the_folder->show_thumbs($count, $cols, $paging);
                }
                ?>

      </div>        
      <?php 
                $virtualroot = isset($this->virtual_root) ? urlencode($this->virtual_root) : '';
                echo "\n<script type='text/javascript'>var lazyest_virtual = { root: '{$virtualroot}' };</script>\n";
            }
            $folder_code = ob_get_contents();
            ob_end_clean();
        }
        unset($the_folder);
        return $folder_code;
    }
Esempio n. 2
0
/**
 * lg_next_thumbs()
 * Shows next page of image thumbnails
 * 
 * @since 1.1.0
 * @return void
 */
function lg_next_thumbs()
{
    global $lg_gallery, $post;
    if ('TRUE' != $lg_gallery->get_option('external_request')) {
        check_ajax_referer('show_thumbs', 'ajax_nonce');
    }
    $lg_plugin_dir = $lg_gallery->plugin_dir;
    define('LG_FRONTEND', true);
    $_SERVER['REQUEST_URI'] = $_POST['request_uri'];
    require_once $lg_plugin_dir . '/inc/frontend.php';
    $lg_gallery = new LazyestFrontend();
    if ('' != $_POST['virtual']) {
        $lg_gallery->set_root(urldecode($_POST['virtual']));
    }
    $start = 1;
    $lg_pagei = isset($_POST['lg_pagei']) ? $_POST['lg_pagei'] : 1;
    if (isset($_POST['folder'])) {
        $path = urldecode($_POST['folder']);
        $folder = new LazyestFrontendFolder($path);
        $folder->load('thumbs');
        $post = get_post(intval($_POST['post_id']));
        $folder->show_thumbs((int) $_POST['perpage'], (int) $_POST['columns'], true);
    } else {
        echo -1;
    }
    die;
}