예제 #1
0
 /**
  * LazyestImage::uri()
  * The address for the image in Lazyest Gallery
  * This can be a slide view page
  * @param string $widget
  * @return string
  */
 function uri($widget = 'none')
 {
     global $lg_gallery;
     if ('' == $this->image || !isset($lg_gallery)) {
         return false;
     }
     return $this->folder->uri($widget) . lg_nice_link($this->image);
 }
예제 #2
0
function lg_comment_id_fields()
{
    global $lg_gallery;
    if (!isset($lg_gallery)) {
        return false;
    }
    if (!isset($lg_gallery->file)) {
        $lg_gallery->valid();
    }
    if ($lg_gallery->is_image($lg_gallery->file)) {
        $the_folder = new LazyestFolder(dirname($lg_gallery->file));
        $the_image = $the_folder->single_image(basename($lg_gallery->file));
        $the_id = $the_image->id;
        $the_uri = $the_image->uri();
        $the_file = lg_nice_link($the_folder->curdir . $the_image->image);
        unset($the_image, $the_folder);
    } elseif ($lg_gallery->is_folder($lg_gallery->file)) {
        $the_folder = new LazyestFolder($lg_gallery->file);
        $the_folder->open();
        $the_id = $the_folder->id;
        $the_uri = $the_folder->uri();
        $the_file = lg_nice_link($the_folder->curdir);
        unset($the_folder);
    } else {
        return;
    }
    ?>

  <input type="hidden" name="lg_comment_image_ID" value="<?php 
    echo $the_id;
    ?>
"/>
  <input type="hidden" name="redirect_to" value="<?php 
    echo $the_uri;
    ?>
"/>
  <input type="hidden" name="lg_filevar" value="<?php 
    echo $the_file;
    ?>
"/>  
  <?php 
}
예제 #3
0
 function body_cell($key, $value, $i)
 {
     global $comment, $lg_gallery;
     // set global $comment so we can use WordPress functions
     $comment = $this->items[$i];
     $comment_ID = $comment->comment_ID;
     // in this table we only shows approved comments
     $comment_status = 'approve';
     $pending_comments = 0;
     switch ($key) {
         case 'author':
             $author_url = get_comment_author_url();
             $cell = '<td class="author column-author">';
             $cell .= sprintf('<strong> %s %s </strong><br />', get_avatar($comment, 32), get_comment_author($comment));
             if (current_user_can('moderate_comments')) {
                 if (!empty($comment->comment_author_email)) {
                     $cell .= get_comment_author_email_link() . '<br />';
                 }
                 $cell .= sprintf('<a href="edit-comments.php?s=%s&amp;mode=detail">%s</a>', get_comment_author_IP($comment), get_comment_author_IP($comment));
             }
             $cell .= '</td>';
             break;
         case 'comment':
             $approve_nonce = esc_html('_wpnonce=' . wp_create_nonce("approve-comment_{$comment_ID}"));
             $del_nonce = esc_html('_wpnonce=' . wp_create_nonce("delete-comment_{$comment_ID}"));
             $postID = $lg_gallery->get_option('gallery_id');
             $cell = '<td class="comment column-comment">';
             $filevar = isset($comment->filevar) ? $comment->filevar : '';
             $uri = trailingslashit($lg_gallery->get_option('gallery_prev'));
             if ('TRUE' != $lg_gallery->get_option('use_permalinks')) {
                 $comment_url = add_query_arg('file', $filevar, $uri);
             } else {
                 $comment_url = trailingslashit($uri . $filevar);
             }
             $comment_url .= '#comment-' . $comment_ID;
             $cell .= '<div class="submitted-on">';
             $cell .= sprintf(__('Submitted on <a href="%1$s">%2$s - %3$s</a>'), esc_url($comment_url), get_comment_date(get_option('date_format')), get_comment_date(get_option('time_format')));
             $cell .= sprintf('<p>%s</p>', apply_filters('comment_text', get_comment_text($comment), $comment));
             if (current_user_can('moderate_comments')) {
                 $cell .= '<div class="row-actions">';
                 $cell .= sprintf('<span class="unapprove"><a href="%s" class="delete:the-comment-list:comment-%s:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive" title="%s">%s</a> | </span>', esc_url("comment.php?action=unapprovecomment&p={$postID}&c={$comment_ID}&{$approve_nonce}"), $comment_ID, esc_attr__('Unapprove this comment'), __('Unapprove'));
                 $cell .= sprintf('<span class="edit"><a href="comment.php?action=editcomment&amp;c=%s" title="%s">%s</a> | </span>', $comment_ID, esc_attr__('Edit comment'), __('Edit'));
                 $cell .= sprintf('<span class="spam"><a href="%s" class="delete:the-comment-list:comment-%s::spam=1 vim-s vim-destructive" title="%s">%s</a> | </span>', esc_url("comment.php?action=spamcomment&p={$postID}&c={$comment_ID}&{$del_nonce}"), $comment_ID, esc_attr__('Mark this comment as spam'), _x('Spam', 'verb'));
                 $cell .= sprintf('<span class="trash"><a href="%s" class="delete:the-comment-list:%s::trash=1 delete vim-d vim-destructive" title="%s">%s</a></span>', esc_url("comment.php?action=trashcomment&p={$postID}&c={$comment_ID}&{$del_nonce}"), $comment_ID, esc_attr__('Move this comment to the trash'), _x('Trash', 'verb'));
             }
             $cell .= '</td>';
             break;
         case 'response':
             $cell = '<td class="response column-response">';
             $edit_title = esc_html__('Gallery', 'lazyest-gallery');
             $edit_url = admin_url('admin.php?page=lazyest-filemanager&folder=');
             $filevar = isset($comment->filevar) ? stripslashes(rawurldecode($comment->filevar)) : $lg_gallery->commentor->get_file_by_comment_id($comment_ID);
             $preview = $lg_gallery->get_option('gallery_prev');
             $class = 'alignright';
             $img_src = trailingslashit($lg_gallery->plugin_url) . 'images/folders.png';
             $img_alt = __('Icon', 'lazyest-gallery');
             $img_title = __('Click to View', 'lazyest-gallery');
             $img_id = 0;
             $img_class = 'lg';
             if ('' !== $filevar) {
                 $edit_url .= $lg_gallery->is_folder($filevar) ? lg_nice_link($filevar) : lg_nice_link(dirname($filevar));
                 if ($lg_gallery->is_folder($filevar)) {
                     $folder = new LazyestFolder($filevar);
                     $folder->open();
                     $edit_title = $folder->title();
                     $preview = $folder->uri();
                     $img_src = trailingslashit($lg_gallery->plugin_url) . 'images/folder-icon.png';
                     $img_id = $folder->id;
                 }
                 if ($lg_gallery->is_image($filevar)) {
                     $folder = new LazyestFolder(dirname($filevar));
                     $image = $folder->single_image(basename($filevar), 'thumbs');
                     $edit_url .= '#' . $image->form_name();
                     $edit_title = $image->title();
                     $onclick = $image->on_click();
                     $preview = $onclick['href'];
                     $class .= ' ' . $onclick['class'];
                     $img_src = $image->src();
                     if ('TRUE' == $lg_gallery->get_option('async_cache') && !file_exists($image->loc())) {
                         $img_class = 'lg_ajax';
                     }
                     $img_alt = $image->alt();
                     $img_id = $image->id;
                 }
             }
             $cell .= '<div class="response-links"><span class="post-com-count-wrapper">';
             $cell .= sprintf('<a href="%s">%s</a><br />', $edit_url, $edit_title);
             $cell .= sprintf('<a href="admin.php?page=lazyest-filemanager&edit=comments&file=%s" title="%s" class="post-com-count"><span class="comment-count">%s</span></a>', $filevar, esc_attr(__('0 pending')), $lg_gallery->commentor->count_comments($img_id));
             $cell .= '</div>';
             $cell .= sprintf('<a target="_blank" href="%s" class="alignright"><img width="32" height="32" src="%s" alt="%s"  title="%s" class="%s" /></a>', $preview, $img_src, $img_alt, $img_title, $img_class);
             $cell .= "</td>\n";
             break;
     }
     return $cell;
 }