/** * LazyestUploadTab::_folder_row() * Display a row of folder information * * @param LazyestFolder $folder * @param bool $single * @internal * @return void */ function _folder_row($folder, $single = false) { global $lg_gallery; $icon = $folder->icon(); $count = $folder->count(); $lg_ajax = strpos($icon['icon'], '?') ? ' lg_ajax' : ''; ?> <div id="media-item-<?php echo $folder->id; ?> " class="media-item child-of-0 preloaded"> <img class="pinkynail toggle<?php echo $lg_ajax; ?> " alt="" src="<?php echo $icon['icon']; ?> " style="margin-top:3px; display:block;" /> <?php if (!$single) { ?> <div id="lg_actions_<?php echo $folder->id; ?> " class="folder-actions"> <img alt="" id="ajax-loading_<?php echo $folder->id; ?> " class="ajax-loading" src="<?php echo admin_url('images/wpspin_light.gif'); ?> " /> <a rel="<?php echo urlencode($folder->curdir); ?> " class="lg_upload-insertfolder" title="<?php esc_attr_e('Insert folder shortcode', 'lazyest-gallery'); ?> " id="lg_if_<?php echo $folder->id; ?> " href="#"><?php echo esc_html__('Insert', 'lazyest-gallery'); ?> </a> <a rel="<?php echo urlencode($folder->curdir); ?> " class="lg_upload-showfolder" title="<?php esc_attr_e('Select an image', 'lazyest-gallery'); ?> " id="lg_sf_<?php echo $folder->id; ?> " href="#"><?php echo esc_html_e('Show', 'lazyest-gallery'); ?> </a> </div> <?php } $back_url = remove_query_arg(array('lg_paged', 'lg_pagei', 'folder'), $_SERVER['REQUEST_URI']); ?> <div id="lg_back_<?php echo $folder->id; ?> " class="folder-actions" <?php if (!$single) { echo 'style="display:none;"'; } ?> "> <a title="<?php esc_html_e('Show all folders', 'lazyest-gallery'); ?> " href="<?php echo $back_url; ?> "><?php esc_html_e('Back', 'lazyest-gallery'); ?> </a> </div> <div class="filename"><span class="title"><code><?php echo htmlentities($folder->curdir); ?> </code> <?php echo $folder->title(); ?> (<?php echo $count; ?> <?php echo $lg_gallery->get_option('listed_as'); ?> )</span></div> </div> <?php }
/** * lg_get_the_title() * Returns the title for the currently displaying folder or slide page * * @since 1.1.0 * @return string */ function lg_get_the_title() { global $lg_gallery; $page = get_page($lg_gallery->get_option('gallery_id')); $title = esc_html($page->post_title); unset($page); if (!isset($lg_gallery)) { return $title; } $lg_gallery->valid(); if ($lg_gallery->is_image($lg_gallery->file)) { $folder = new LazyestFolder(dirname($lg_gallery->file)); $image = $folder->single_image(basename($lg_gallery->file)); $title = $image->title(); unset($image, $folder); } if ($lg_gallery->is_folder($lg_gallery->file)) { $folder = new LazyestFolder($lg_gallery->file); $folder->open(); $title = $folder->title(); unset($folder); } return $title; }
/** * LazyestCommentor::edit_comments_form() * * @return */ function edit_comments_form($all = 'gallery') { global $lg_gallery; $this->comments_from = $all; wp_enqueue_script('admin-forms'); wp_enqueue_script('admin-comments'); if (isset($_REQUEST['move_comments'])) { $lg_gallery->move_comments(); $result = get_transient('lg_not_inserted'); if (false === $result) { $lg_gallery->success = true; $lg_gallery->message = __('Successfully updated your comments', 'lazyest-gallery'); } } $file = ''; if ($all == 'gallery') { $file = stripslashes(rawurldecode($_GET['file'])); $title = __('Gallery', 'lazyest-gallery'); if ($lg_gallery->is_folder($file)) { $this->comments_from = 'folder'; $folder = new LazyestFolder($file); $folder->open(); $title = __('Folder ', 'lazyest-gallery') . '“' . $folder->title() . '”'; unset($folder); } elseif ($lg_gallery->is_image($file)) { $this->comments_from = 'image'; $folder = new LazyestFolder(dirname($file)); $image = $folder->single_image(basename($file)); $title = __('Image ', 'lazyest-gallery') . '“' . $image->title() . '”'; unset($folder, $image); } } else { $title = __('Gallery, Folders and Images', 'lazyest-gallery'); } ?> <div class="wrap"> <?php screen_icon('komments'); ?> <h2><?php esc_html_e('Comments on', 'lazyest-gallery'); ?> <?php echo esc_html($title); ?> </h2> <?php $lg_gallery->options_message(); ?> <div id="ajax-div"></div> <div id="poststuff" class="metabox-holder has-right-sidebar"> <form id="lazyest-comments" action="admin.php?page=lazyest-comments" method="post"> <?php $this->edit_comments($file); ?> </form> </div> </div> <?php }
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&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&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&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; }