Changeset 2566:9bf417837888 for plugins/attachments
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- Location:
- plugins/attachments
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/attachments/_admin.php
r2360 r2566 38 38 public static function postHeaders() 39 39 { 40 return 40 return 41 41 '<script type="text/javascript" src="index.php?pf=attachments/js/post.js"></script>'; 42 42 } 43 public static function adminPostFormItems($main,$sidebar,$post) 43 public static function adminPostFormItems($main,$sidebar,$post) 44 44 { 45 45 if ($post !== null) … … 66 66 '<li>'.files::size($f->size).' - '. 67 67 '<a href="'.$f->file_url.'">'.__('open').'</a>'.'</li>'. 68 68 69 69 '<li class="media-action"><a class="attachment-remove" id="attachment-'.$f->media_id.'" '. 70 70 'href="post_media.php?post_id='.$post->post_id.'&media_id='.$f->media_id.'&remove=1">'. 71 71 '<img src="images/trash.png" alt="'.__('remove').'" /></a>'. 72 72 '</li>'. 73 73 74 74 '</ul>'. 75 75 '</div>'; 76 76 } 77 77 unset($f); 78 78 79 79 if (empty($post_media)) { 80 80 $item .= '<p class="form-note s-attachments">'.__('No attachment.').'</p>'; 81 } 81 } 82 82 $item .= '<p class="s-attachments"><a class="button" href="media.php?post_id='.$post->post_id.'">'.__('Add files to this entry').'</a></p>'; 83 83 $sidebar['metas-box']['items']['attachments']= $item; 84 84 } 85 85 } 86 86 87 87 public static function adminPostAfterForm($post) { 88 88 if ($post !== null) … … 98 98 } 99 99 } 100 ?> -
plugins/attachments/_define.php
r2257 r2566 23 23 ) 24 24 ); 25 ?> -
plugins/attachments/_public.php
r1280 r2566 31 31 32 32 class attachmentTpl { 33 33 34 34 /*dtd 35 35 <!ELEMENT tpl:Attachments - - -- Post Attachments loop --> … … 42 42 '$_ctx->attachments = new ArrayObject($core->media->getPostMedia($_ctx->posts->post_id));'."\n". 43 43 "?>\n". 44 44 45 45 '<?php foreach ($_ctx->attachments as $attach_i => $attach_f) : '. 46 46 '$GLOBALS[\'attach_i\'] = $attach_i; $GLOBALS[\'attach_f\'] = $attach_f;'. … … 48 48 $content. 49 49 '<?php endforeach; $_ctx->attachments = null; unset($attach_i,$attach_f,$_ctx->file_url); ?>'. 50 50 51 51 "<?php } ?>\n"; 52 52 53 53 return $res; 54 54 } 55 55 56 56 /*dtd 57 57 <!ELEMENT tpl:AttachmentsHeader - - -- First attachments result container --> … … 64 64 "<?php endif; ?>"; 65 65 } 66 66 67 67 /*dtd 68 68 <!ELEMENT tpl:AttachmentsFooter - - -- Last attachments result container --> … … 75 75 "<?php endif; ?>"; 76 76 } 77 77 78 78 /*dtd 79 79 <!ELEMENT tpl:AttachmentsIf - - -- Test on attachment fields --> … … 88 88 { 89 89 $if = array(); 90 90 91 91 $operator = isset($attr['operator']) ? dcTemplate::getOperator($attr['operator']) : '&&'; 92 92 93 93 if (isset($attr['is_image'])) { 94 94 $sign = (boolean) $attr['is_image'] ? '' : '!'; 95 95 $if[] = $sign.'$attach_f->media_image'; 96 96 } 97 97 98 98 if (isset($attr['has_thumb'])) { 99 99 $sign = (boolean) $attr['has_thumb'] ? '' : '!'; 100 100 $if[] = $sign.'isset($attach_f->media_thumb[\'sq\'])'; 101 101 } 102 102 103 103 if (isset($attr['is_mp3'])) { 104 104 $sign = (boolean) $attr['is_mp3'] ? '==' : '!='; 105 105 $if[] = '$attach_f->type '.$sign.' "audio/mpeg3"'; 106 106 } 107 107 108 108 if (isset($attr['is_flv'])) { 109 109 $sign = (boolean) $attr['is_flv'] ? '' : '!'; … … 113 113 '$attach_f->type == "video/x-m4v")'; 114 114 } 115 115 116 116 if (count($if) != 0) { 117 117 return '<?php if('.implode(' '.$operator.' ', (array) $if).') : ?>'.$content.'<?php endif; ?>'; … … 120 120 } 121 121 } 122 122 123 123 /*dtd 124 124 <!ELEMENT tpl:AttachmentMimeType - O -- Attachment MIME Type --> … … 129 129 return '<?php echo '.sprintf($f,'$attach_f->type').'; ?>'; 130 130 } 131 131 132 132 /*dtd 133 133 <!ELEMENT tpl:AttachmentType - O -- Attachment type --> … … 138 138 return '<?php echo '.sprintf($f,'$attach_f->media_type').'; ?>'; 139 139 } 140 140 141 141 /*dtd 142 142 <!ELEMENT tpl:AttachmentFileName - O -- Attachment file name --> … … 147 147 return '<?php echo '.sprintf($f,'$attach_f->basename').'; ?>'; 148 148 } 149 149 150 150 /*dtd 151 151 <!ELEMENT tpl:AttachmentSize - O -- Attachment size --> … … 162 162 return '<?php echo '.sprintf($f,'files::size($attach_f->size)').'; ?>'; 163 163 } 164 164 165 165 /*dtd 166 166 <!ELEMENT tpl:AttachmentTitle - O -- Attachment title --> … … 171 171 return '<?php echo '.sprintf($f,'$attach_f->media_title').'; ?>'; 172 172 } 173 173 174 174 /*dtd 175 175 <!ELEMENT tpl:AttachmentThumbnailURL - O -- Attachment square thumbnail URL --> … … 185 185 '?>'; 186 186 } 187 187 188 188 /*dtd 189 189 <!ELEMENT tpl:AttachmentURL - O -- Attachment URL --> … … 194 194 return '<?php echo '.sprintf($f,'$attach_f->file_url').'; ?>'; 195 195 } 196 196 197 197 public static function MediaURL($attr) 198 198 { … … 200 200 return '<?php echo '.sprintf($f,'$_ctx->file_url').'; ?>'; 201 201 } 202 202 203 203 /*dtd 204 204 <!ELEMENT tpl:EntryAttachmentCount - O -- Number of attachments for entry --> … … 214 214 $one = 'one attachment'; 215 215 $more = '%d attachments'; 216 216 217 217 if (isset($attr['none'])) { 218 218 $none = addslashes($attr['none']); … … 224 224 $more = addslashes($attr['more']); 225 225 } 226 226 227 227 return 228 228 "<?php if (\$_ctx->posts->countMedia() == 0) {\n". … … 246 246 } 247 247 } 248 ?>
Note: See TracChangeset
for help on using the changeset viewer.