Changeset 519
- Timestamp:
- 10/13/08 02:20:01 (15 years ago)
- google:author:
- appears
- Location:
- plugins/publicMedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/publicMedia/_define.php
r516 r519 25 25 /* Name */ "Public Media", 26 26 /* Description*/ "Display media on a public page or in a widget", 27 /* Author */ "Moe (http://gniark.net/) andOsku and Tomtom (http://blog.zenstyle.fr)",28 /* Version */ '1.1 ',27 /* Author */ "Moe (http://gniark.net/), Osku and Tomtom (http://blog.zenstyle.fr)", 28 /* Version */ '1.1.1', 29 29 /* Permissions */ 'admin' 30 30 ); -
plugins/publicMedia/_public.php
r516 r519 156 156 157 157 /** 158 serve downl aod headers158 serve download headers 159 159 @param args <b>string</b> Argument 160 160 */ 161 public function wrapper($args)161 public static function wrapper($args) 162 162 { 163 163 global $core; … … 167 167 } 168 168 169 $core->media = new dcMedia($core); 169 if (!is_object($core->media)) 170 { 171 $core->media = new dcMedia($core); 172 } 170 173 171 174 $core->media->chdir($core->blog->settings->publicmedia_page_root); 175 // we need to test if the file is in a subdirectory of -^ 172 176 $core->media->getDir(); 173 177 174 178 $items = $core->media->dir['files']; 175 179 180 # initialize $file 181 $file = ''; 182 176 183 foreach ($items as $media_item) { 177 184 if ($media_item->media_id == $args) { … … 189 196 $count = unserialize($core->blog->settings->publicmedia_count_dl); 190 197 $count[$file_id] = array_key_exists($file_id,$count) ? $count[$file_id]+1 : 1; 198 // if (!is_object($core->settings)) ? 191 199 $settings = new dcSettings($core,$core->blog->id); 192 200 $settings->setNamespace('system'); … … 250 258 $core->tpl->addValue('MediaItemSize',array('publicMediaPageTpl','itemSize')); 251 259 $core->tpl->addValue('MediaItemFileURL',array('publicMediaPageTpl','itemFileURL')); 260 $core->tpl->addValue('MediaItemDlURL',array('publicMediaPageTpl','itemDlURL')); 252 261 253 262 $core->tpl->addValue('MediaItemBasename',array('publicMediaPageTpl', … … 567 576 $f = $GLOBALS['core']->tpl->getFilters($attr); 568 577 569 $link = $GLOBALS['core']->blog->url.'download/'; 570 571 return($link.'<?php echo '.sprintf($f,'$_ctx->media_item->media_id').'; ?>'); 578 return('<?php echo '.sprintf($f,'$_ctx->media_item->file_url').'; ?>'); 579 } 580 /** 581 Item download URL 582 @param attr <b>array</b> Attribute 583 @return <b>string</b> PHP block 584 */ 585 public static function itemDlURL($attr) 586 { 587 $f = $GLOBALS['core']->tpl->getFilters($attr); 588 589 return('<?php echo($core->blog->url.\'download/\'.'.sprintf($f,'$_ctx->media_item->media_id').'); ?>'); 572 590 } 573 591 /** … … 640 658 return 641 659 '<?php $count = unserialize($core->blog->settings->publicmedia_count_dl); '. 660 'if (empty($count)) {$count = array();}'. 642 661 'echo '.sprintf($f,'array_key_exists($_ctx->media_item->media_id,$count) ? $count[$_ctx->media_item->media_id] : "0"'). 643 662 '; ?>'; -
plugins/publicMedia/default-templates/media.html
r518 r519 122 122 {{tpl:MediaSwitchCase case="image/tiff"}} 123 123 {{tpl:MediaSwitchCase case="image/x-xbitmap"}} 124 <a href="{{tpl:MediaItem FileURL}}"124 <a href="{{tpl:MediaItemDlURL}}" 125 125 title="{{tpl:MediaItemBasename}}"> 126 126 <img src="{{tpl:MediaItemImageThumbPath size="s"}}" alt="{{tpl:MediaItemTitle}}" /> … … 149 149 <!-- # other files --> 150 150 {{tpl:MediaSwitchDefault}} 151 <a href="{{tpl:MediaItem FileURL}}"151 <a href="{{tpl:MediaItemDlURL}}" 152 152 title="{{tpl:MediaItemBasename}}"> 153 153 {{tpl:MediaItemTitle}}
Note: See TracChangeset
for help on using the changeset viewer.