예제 #1
0
    /**
     * LazyestUploadTab::insert_image_shortcode()
     * Form to insert an image shortcode
     * 
     * @param LazyestThumb $image
     * @return void
     */
    function insert_image_shortcode($image)
    {
        if (!$image->valid()) {
            esc_html_e('Error retrieving image', 'lazyest-gallery');
            return;
        }
        $onclick = $image->on_click('widget');
        $onclickhref = $onclick['href'];
        $thumburl = $image->src();
        $filename = $image->image;
        list($width, $height, $type, $attr) = getimagesize($image->original());
        $date = $image->datetime;
        $media_dims = "{$width} x {$height}";
        $caption = htmlspecialchars(stripslashes($image->caption), ENT_QUOTES);
        ?>
    
    <input type="hidden" name="lg_folder" value="<?php 
        echo urlencode($image->folder->curdir);
        ?>
" />
    <input type="hidden" name="lg_image" value="<?php 
        echo urlencode($image->image);
        ?>
" />
    <table class="describe">
  		<thead class="media-item-info" id="media-head-<?php 
        echo $image->id;
        ?>
">
    		<tr valign="top">
    			<td class="A1B1" id="thumbnail-head-<?php 
        echo $image->id;
        ?>
">
    		  	<p><a href="<?php 
        echo $onclickhref;
        ?>
" target="_blank"><img class="thumbnail" src="<?php 
        echo $thumburl;
        ?>
" alt="" style="margin-top: 3px" /></a></p>		
    			</td>
    			<td>
      			<p><strong><?php 
        esc_html_e('File name:', 'lazyest-gallery');
        ?>
</strong> <?php 
        esc_html_e($filename);
        ?>
</p>
      			<p><strong><?php 
        esc_html_e('File type:', 'lazyest-gallery');
        ?>
</strong> <?php 
        echo image_type_to_mime_type($type);
        ?>
</p>
      		  <p><strong><?php 
        esc_html_e('Date:', 'lazyest-gallery');
        ?>
</strong> <?php 
        echo date(get_option("date_format"), $date);
        ?>
</p>
      		  <p><strong><?php 
        esc_html_e('Dimensions:', 'lazyest-gallery');
        ?>
</strong> <?php 
        echo $media_dims;
        ?>
</p>
    		  </td>
        </tr>
        <tr class="post_title form-required">
          <th valign="top" class="label" scope="row">
            <label for="short_code_caption">
              <span class="alignleft"><?php 
        esc_html_e('Caption', 'lazyest-gallery');
        ?>
</span><br class="clear" />
            </label>
          </th>
          <td class="field">
            <input type="text" value="<?php 
        echo $caption;
        ?>
" name="short_code_caption" id="short_code_caption[<?php 
        echo $image->id;
        ?>
]" class="text" />
          </td>        
        </tr> 
        <tr class="align">
          <th valign="top" class="label" scope="row">
            <label for="image_align[<?php 
        echo $image->id;
        ?>
]"><span class="alignleft"><?php 
        esc_html_e('Alignment', 'lazyest-gallery');
        ?>
</span><br class="clear" /></label>
          </th>
          <td class="field">
            <input type="radio" value="" id="image-align-none-<?php 
        echo $image->id;
        ?>
" name="image_align" /><label class="align image-align-none-label" for="image-align-none"><?php 
        esc_html_e('None', 'lazyest-gallery');
        ?>
</label>
            <input type="radio" checked="checked" value="left" id="image-align-left" name="image_align" /><label class="align image-align-left-label" for="image-align-left"><?php 
        esc_html_e('Left', 'lazyest-gallery');
        ?>
</label>
            <input type="radio" value="center" id="image-align-center" name="image_align" /><label class="align image-align-center-label" for="image-align-center"><?php 
        esc_html_e('Center', 'lazyest-gallery');
        ?>
</label>
            <input type="radio" value="right" id="image-align-right" name="image_align" /><label class="align image-align-right-label" for="image-align-right-<?php 
        echo $image->id;
        ?>
"><?php 
        esc_html_e('Right', 'lazyest-gallery');
        ?>
</label>
          </td>
		    </tr> 
        <tr class="image-size">    
          <th valign="top" class="label" scope="row">
            <label for="image-size">
              <span class="alignleft"><?php 
        esc_html_e('Size', 'lazyest-gallery');
        ?>
</span><br class="clear" />
            </label>
          </th>
          <td class="field">
            <div class="image-size-item">
              <input type="radio" checked="checked" value="thumb" id="image-size-thumbnail" name="image-size" />
                <label for="image-size-thumbnail"><?php 
        esc_html_e('Thumbnail', 'lazyest-gallery');
        ?>
</label>
            </div>            
            <div class="image-size-item">
              <input type="radio" value="slide" id="image-size-slide" name="image-size" />
                <label for="image-size-slide"><?php 
        esc_html_e('Slide', 'lazyest-gallery');
        ?>
</label>
            </div>
            <div class="image-size-item">
              <input type="radio" value="image" id="image-size-full" name="image-size" />
                <label for="image-size-full"><?php 
        esc_html_e('Full Size', 'lazyest-gallery');
        ?>
</label>
            </div>
          </td>
		    </tr>
        <tr class="submit">
          <td></td>
          <td>
            <input class="button" type="submit" name="image_short" title="<?php 
        esc_html_e('Insert a Lazyest Gallery shortcode', 'lazyest-gallery');
        ?>
" value="<?php 
        echo __('Insert as shortcode', 'lazyest-gallery');
        ?>
" />
          </td>
        </tr>
  		</thead>
  		<tbody>
      </tbody>
    </table>
    <?php 
    }
예제 #2
0
 /**
  * LazyestFrontendFolder::thumb_image()
  * 
  * @since 1.1.0
  * @param LazyestThumb $image
  * @return string code for thumbnail image
  */
 function thumb_image($image)
 {
     global $post, $lg_gallery;
     $onclick = $image->on_click();
     $rel = '' != $onclick['rel'] ? 'rel="' . $onclick['rel'] . '"' : '';
     $class = 'thumb';
     if ('TRUE' != $lg_gallery->get_option('enable_cache') || 'TRUE' == $lg_gallery->get_option('async_cache') && !file_exists($image->loc())) {
         $class .= ' lg_ajax';
     }
     $postid = is_object($post) ? $post->ID : $lg_gallery->get_option('gallery_id');
     $anchor_1 = $anchor_2 = '';
     if ('nothing' != $lg_gallery->get_option('on_thumb_click')) {
         $anchor_1 = sprintf('<a id="%s_%s" href="%s" class="%s" %s title="%s" >', $onclick['id'], $postid, $onclick['href'], $onclick['class'], $rel, $onclick['title']);
         $anchor_2 = '</a>';
     }
     return sprintf('<div class="lg_thumb_image">%s<img class="%s" src="%s" alt="%s" />%s</div>', $anchor_1, $class, $image->src(), $image->alt(), $anchor_2);
 }
예제 #3
0
 /**
  * LazyestFolder::icon()
  * returns the folder icon as array icon=>img src class=>img class
  * @since 1.0.0
  * @uses untrailingslashit()
  * @return array
  */
 function icon()
 {
     global $lg_gallery;
     $folder_icon = array();
     if (!$this->user_can('viewer')) {
         $folder_icon['icon'] = $lg_gallery->plugin_url . '/images/folder-na.png';
         $folder_icon['class'] = 'category_icon';
         return $folder_icon;
     }
     $dir_parts = explode('/', untrailingslashit($this->curdir));
     $fil = $dir_parts[count($dir_parts) - 1];
     $default_icon = $lg_gallery->plugin_url . '/images/folder-icon.png';
     $the_icon = $default_icon;
     $folder_icon['class'] = 'icon';
     $exts = array('.gif', '.jpg', '.jpeg', '.png');
     $the_ext = '';
     switch ($lg_gallery->get_option('folder_image')) {
         case 'icon':
             $folder_icon['icon'] = $the_icon;
             $stub = $lg_gallery->root . $this->curdir . $fil;
             $stuba = $lg_gallery->address . $this->curdir . $fil;
             foreach ($exts as $ext) {
                 if (file_exists($stub . $ext)) {
                     $the_ext = $ext;
                 }
                 if (file_exists($stub . strtoupper($ext))) {
                     $the_ext = strtoupper($ext);
                 }
             }
             if ('' != $the_ext) {
                 $thumb = new LazyestThumb($this);
                 $thumb->image = $fil . $the_ext;
                 $folder_icon['icon'] = $thumb->src();
                 $folder_icon['class'] = 'category_icon';
             }
             break;
         case 'random_image':
             $folder_icon['icon'] = $default_icon;
             $folder_icon['class'] = 'random_image';
             $sub = 'TRUE' == $lg_gallery->get_option('random_subfolder') ? 'subfolders' : 'root';
             $images = $this->random_image($sub);
             if (0 < count($images)) {
                 $thumb = $images[0];
                 $folder_icon['icon'] = $thumb->src();
             }
             break;
     }
     $folder_icon['class'] .= ' thumb';
     if (isset($thumb) && ('TRUE' != $lg_gallery->get_option('enable_cache') || 'TRUE' == $lg_gallery->get_option('async_cache')) && !file_exists($thumb->loc())) {
         $folder_icon['class'] .= ' lg_ajax';
     }
     unset($thumb);
     return apply_filters('lazyest_folder_icon', $folder_icon, $this->curdir);
 }