Exemple #1
0
 public function download_shortcode($atts)
 {
     //in last line of shortcodes : add_filter('the_content', 'do_shortcode', 11);
     // so the shortcode is trigger before wp_footer
     self::$_add_js = TRUE;
     extract(shortcode_atts(array('id' => '0', 'display' => 'both'), $atts));
     if (!is_feed()) {
         $conditions = array();
         if ($id != '0') {
             if (strpos($id, ',') !== false) {
                 $conditions[] = "file_id IN ({$id})";
             } else {
                 $conditions[] = "file_id = {$id}";
             }
         }
         if ($conditions) {
             return $this->download_embedded(implode(' AND ', $conditions), $display);
         } else {
             return '';
         }
     } else {
         return sprintf(__('Note: There is a file embedded within this post, please visit <a href="%s">this post</a> to download the file.', 'hacklog-downloadmanager'), get_permalink());
     }
 }