예제 #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 
    }