/** * download_data function. * * @access public * * @param array $atts * * @return mixed */ public function download_data($atts) { extract(shortcode_atts(array('id' => '', 'data' => '', 'version_id' => '', 'version' => ''), $atts)); $id = apply_filters('dlm_shortcode_download_id', $id); if (empty($id) || empty($data)) { return; } $download = new DLM_Download($id); if (!empty($version)) { $version_id = $download->get_version_id($version); } if ($version_id) { $download->set_version($version_id); } switch ($data) { // File / Version Info case 'filename': return $download->get_the_filename(); case 'filetype': return $download->get_the_filetype(); case 'filesize': return $download->get_the_filesize(); case 'md5': return $download->get_the_hash('md5'); case 'sha1': return $download->get_the_hash('sha1'); case 'crc32': return $download->get_the_hash('crc32'); case 'version': return $download->get_the_version_number(); // Download Info // Download Info case 'title': return $download->get_the_title(); case 'short_description': return $download->get_the_short_description(); case 'download_link': return $download->get_the_download_link(); case 'download_count': return $download->get_the_download_count(); case 'post_content': return wpautop(wptexturize(do_shortcode($download->post->post_content))); case 'post_date': return date_i18n(get_option('date_format'), strtotime($download->post->post_date)); case 'file_date': return date_i18n(get_option('date_format'), strtotime($download->get_the_file_date())); case 'author': return $download->get_the_author(); // Images // Images case 'image': return $download->get_the_image('full'); case 'thumbnail': return $download->get_the_image('thumbnail'); // Taxonomies // Taxonomies case 'tags': return get_the_term_list($id, 'dlm_download_tags', '', ', ', ''); case 'categories': return get_the_term_list($id, 'dlm_download_category', '', ', ', ''); } }