gallery = $gallery; $this->description = $attachment->post_content; $this->ID = $attachment->ID; $this->link = $gallery->linkToAttachmentPg() ? get_attachment_link($attachment->ID) : wp_get_attachment_url($attachment->ID); $this->title = get_the_title($attachment->ID); $this->title_attribute = esc_attr(strip_tags($this->title)); } /*========================================================================== * OUTPUT HTML STRING *=========================================================================*/ /** * 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. * @filter dg_doc_icon Deprecated. To be removed in a future relesase. * @return string */ public function __toString() { $thumb = $this->gallery->useFancyThumbs() ? DG_Thumber::getThumbnail($this->ID) : DG_Thumber::getDefaultThumbnail($this->ID); $repl = array($this->link, $thumb, $this->title_attribute, $this->title); $find = array('%link%', '%img%', '%title_attribute%', '%title%'); $description = ''; // if descriptions then add filterable tag and value to replaced tag if ($this->gallery->useDescriptions()) { $repl[] = $this->description; $find[] = '%description%'; $description = '
%description%
'; } // allow developers to filter icon output $doc_icon = apply_filters( 'dg_icon_template', ' ' . PHP_EOL, $this->gallery->useDescriptions(), $this->ID); $core = str_replace($find, $repl, $doc_icon); // deprecated: users may filter icon here return apply_filters('dg_doc_icon', $core, $this->ID, $this->gallery->useDescriptions()); } } ?>