예제 #1
0
 /**
  * LazyestFrontend::create_navigation()
  * Show the navigation breadcrumb trail
  * 
  * @uses apply_filters()
  * @uses get_bloginfo()
  * @uses get_the_title()
  * @uses trailingslashit()
  * @return void
  */
 function create_navigation()
 {
     global $post;
     $nav = explode('/', untrailingslashit($this->currentdir));
     $path = pathinfo($this->file);
     $current = '';
     $now_viewing = apply_filters('lazyest_now_viewing', __(' Now viewing: ', 'lazyest-gallery'));
     $sep = $this->_sep();
     $navigator = sprintf('<div class="top_navigator">%s <a href="%s">%s</a> <span class="raquo">%s</span> <a href="%s">%s</a>', $now_viewing, home_url(), get_bloginfo('name'), $sep, $this->uri(), get_the_title($post->ID));
     if ($nav[0] != '') {
         foreach ($nav as $n) {
             $current .= trailingslashit($n);
             $folder = new LazyestFrontendFolder($current);
             $folder->open();
             $navigator .= sprintf(' <span class="raquo">%s</span> <a href="%s">%s</a> ', $sep, $folder->uri(), $folder->title());
             unset($folder);
         }
     }
     if (!is_dir(untrailingslashit($this->root . $this->file))) {
         $folder = new LazyestFolder($this->currentdir);
         if ($folder->valid()) {
             $image = $folder->single_image($path['basename']);
             $navigator .= sprintf(' <span class="raquo">%s</span> <a href="%s">%s</a>', $sep, $image->uri(), $image->title());
         }
         unset($folder);
     }
     $navigator .= "</div>\n";
     echo apply_filters('lazyest_navigator', $navigator);
 }
예제 #2
0
 /**
  * LazyestGallery::random_image()
  * Gets a random image from a folder
  * 
  * @param string $folder
  * @param string $sub if 'subfolders', subfolders are included in the selection
  * @param integer $count
  * @return array
  */
 function random_image($folder = '', $sub = 'subfolders', $count = 1, $what = 'thumbs')
 {
     if ('' == $folder) {
         $sub = 'subfolders';
     }
     $images_list = array();
     $counted = 0;
     if ('' == $folder) {
         $folderlist = $this->folders('subfolders', 'visible');
         while ($counted < $count && 0 < count($folderlist)) {
             $folder_key = array_rand($folderlist);
             $folder = $folderlist[$folder_key];
             $random_images = $folder->random_image('subfolders', $count - $counted, $what);
             if (false != $random_images) {
                 // no images have been read
                 $counted += count($random_images);
                 if (0 < count($random_images)) {
                     foreach ($random_images as $image) {
                         $images_list[] = $image;
                         if ($count == count($images_list)) {
                             break;
                         }
                     }
                 }
             }
             unset($folderlist[$folder_key]);
         }
     } else {
         $ifolder = new LazyestFrontendFolder($folder);
         if ($ifolder->valid()) {
             $images_list = $ifolder->random_image($sub, $count, $what);
         }
     }
     return $images_list;
 }
예제 #3
0
 /**
  * LazyestCommentor::redirect_comment()
  * 
  * @return
  */
 function redirect_comment()
 {
     if (is_admin()) {
         return;
     }
     global $lg_gallery, $lg_comment;
     if (isset($lg_comment)) {
         $lg_gallery->comment = $lg_comment;
     } else {
         if (isset($_GET['lg_comment'])) {
             $lg_gallery->comment = $_GET['lg_comment'];
         }
     }
     if ('' != $lg_gallery->comment) {
         $comment_ID = $lg_gallery->comment;
         $filevar = urldecode($this->get_file_by_comment_id($comment_ID));
         $redirect = $lg_gallery->address;
         if ($lg_gallery->is_folder($filevar)) {
             $folder = new LazyestFrontendFolder($filevar);
             if ($folder->valid()) {
                 $redirect = $folder->uri();
             }
             unset($folder);
         }
         if ($lg_gallery->is_image($filevar)) {
             $folder = new LazyestFrontendFolder(dirname($filevar));
             if ($folder->valid()) {
                 $slide = $folder->single_image(basename($filevar), 'slides');
                 $redirect = $slide->uri();
                 unset($slide);
             }
         }
         wp_redirect($redirect);
         exit;
     }
 }
예제 #4
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;
}