/** * Returns HTML representing this Document. * @filter dg_icon_template Filters the DG icon HTML. Passes a single * bool value indicating whether the gallery is using descriptions or not. * @return string */ public function __toString() { include_once DG_PATH . 'inc/class-thumber.php'; $thumb = $this->gallery->useFancyThumbs() ? DG_Thumber::getThumbnail($this->ID) : DG_Thumber::getDefaultThumbnail($this->ID); $target = $this->gallery->openLinkInNewWindow() ? '_blank' : '_self'; $repl = array($this->link, $thumb, $this->title_attribute, $this->title, $target, $this->extension, $this->size, $this->path); $find = array('%link%', '%img%', '%title_attribute%', '%title%', '%target%', '%extension%', '%size%', '%path%'); $description = ''; // if descriptions then add filterable tag and value to replaced tag if ($this->gallery->useDescriptions()) { $repl[] = $this->description; $find[] = '%description%'; $description = ' <p>%description%</p>'; } $doc_icon = ' <div class="document-icon">' . PHP_EOL . ' <a href="%link%" target="%target%"><img src="%img%" title="%title_attribute%" alt="%title_attribute%" /><br>%title%</a>' . PHP_EOL . ' </div>' . PHP_EOL . $description; // allow developers to filter icon output $doc_icon = apply_filters('dg_icon_template', $doc_icon, $this->gallery->useDescriptions(), $this->ID); return str_replace($find, $repl, $doc_icon); }
/** * Render a Meta Box. */ public static function renderMetaBox($post) { global $dg_options; wp_nonce_field(DG_OPTION_NAME . '_meta_box', DG_OPTION_NAME . '_meta_box_nonce'); $ID = $post->ID; $icon = isset($dg_options['thumber']['thumbs'][$ID]['thumb_url']) ? $dg_options['thumber']['thumbs'][$ID]['thumb_url'] : DG_Thumber::getDefaultThumbnail($ID); echo '<table id="ThumbsTable" class="wp-list-table widefat fixed media" cellpadding="0" cellspacing="0">' . '<tbody><tr data-entry="' . $ID . '"><td class="column-icon media-icon"><img src="' . $icon . '" />' . '</td><td class="column-thumbupload">' . '<span class="manual-download">' . '<span class="dashicons dashicons-upload"></span>' . '<span class="html5dndmarker">Drop file here<span> or </span></span>' . '<span class="buttons-area">' . '<input id="upload-button' . $ID . '" type="file" />' . '<input id="trigger-button' . $ID . '" type="button" value="Select File" class="button" />' . '</span>' . '</span>' . '</td></tr></tbody></table>' . (empty($dg_options['thumber']['thumbs'][$ID]) ? '<span class="dashicons dashicons-info"></span><span class="">Please note this attachment hasn't been used in any Document Gallery instance and so there is no autogenerated thumbnail, in the meantime default one is used instead.</span>' : '') . PHP_EOL; }