* @date May 24th 2010 * */ Class AttachmentGalleryManager{ var $path; var $options=array(); var $marker='\[attachmentgallery.*\]'; var $downloadText='Download Now'; /** * @desc * @author Leo Brown * */ function AttachmentGalleryManager(){ $this->path = dirname(__FILE__).'/'; } /** * @desc * @author Leo Brown * */ function detect_gallery_options($content){ global $shortcode_tags; $tagnames = array_keys($shortcode_tags); // get shortcode $shortcode=array(); if(preg_match("/{$this->marker}/", $content, $shortcode)){ // extract and use shortcode_parse_atts() to get the array $shortcode=reset($shortcode); $options=array(); preg_match('/\[[^ ]* (.*)\]/', $shortcode, $options); $options=shortcode_parse_atts(end($options)); return $options; } else return false; } /** * @desc Returns gallery HTML on the basis of options * @author Leo Brown * @param $options Array Options array * @return string HTML of Gallery */ function get_attachment_gallery(&$contents,$options){ $attachments = $this->find_attachment_links($contents, $options['filetypes']); // get metadata reader @include_once 'PDFMetaData.class.php'; if(class_exists('PDFMetaData')) $metaReader=new PDFMetaData(); // generate HTML for gallery $html=''; if($attachments){ $html .= '