- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/attachments/_public.php
r1179 r1266 40 40 "<?php\n". 41 41 'if ($_ctx->posts !== null && $core->media) {'."\n". 42 '$_ctx->attachments = new ArrayObject($core->media->getPostMedia($_ctx->posts->post_id));'."\n".42 '$_ctx->attachments = $core->media->getPostMedia($_ctx->posts->post_id, null, true);'."\n". 43 43 "?>\n". 44 44 45 '<?php foreach ($_ctx->attachments as $attach_i => $attach_f) : '. 46 '$GLOBALS[\'attach_i\'] = $attach_i; $GLOBALS[\'attach_f\'] = $attach_f;'. 47 '$_ctx->file_url = $attach_f->file_url; ?>'. 45 '<?php $attach_i = 0; ?>'. // LEGACY 46 '<?php while ($_ctx->attachments->fetch()) : ?>'. 47 48 '<?php $GLOBALS[\'attach_i\'] = $attach_i; $attach_f = $_ctx->attachments; $GLOBALS[\'attach_f\'] = $attach_f;'. // LEGACY 49 '$_ctx->file_url = $attach_f->file_url; ?>'. // LEGACY 48 50 $content. 49 '<?php endforeach; $_ctx->attachments = null; unset($attach_i,$attach_f,$_ctx->file_url); ?>'. 51 '<?php $attach_i++; ?>'. // LEGACY 52 '<?php endwhile; '. 53 '$_ctx->attachments = null; ?>'. 50 54 51 55 "<?php } ?>\n"; … … 60 64 { 61 65 return 62 "<?php if (\$ attach_i == 0) : ?>".66 "<?php if (\$_ctx->attachments->isStart()) : ?>". 63 67 $content. 64 68 "<?php endif; ?>"; … … 71 75 { 72 76 return 73 "<?php if (\$ attach_i+1 == count(\$_ctx->attachments)) : ?>".77 "<?php if (\$_ctx->attachments->isEnd()) : ?>". 74 78 $content. 75 79 "<?php endif; ?>"; … … 93 97 if (isset($attr['is_image'])) { 94 98 $sign = (boolean) $attr['is_image'] ? '' : '!'; 95 $if[] = $sign.'$ attach_f->media_image';99 $if[] = $sign.'$_ctx->attachments->media_image'; 96 100 } 97 101 98 102 if (isset($attr['has_thumb'])) { 99 103 $sign = (boolean) $attr['has_thumb'] ? '' : '!'; 100 $if[] = $sign.'isset($ attach_f->media_thumb[\'sq\'])';104 $if[] = $sign.'isset($_ctx->attachments->media_thumb[\'sq\'])'; 101 105 } 102 106 103 107 if (isset($attr['is_mp3'])) { 104 108 $sign = (boolean) $attr['is_mp3'] ? '==' : '!='; 105 $if[] = '$ attach_f->type '.$sign.' "audio/mpeg3"';109 $if[] = '$_ctx->attachments->type '.$sign.' "audio/mpeg3"'; 106 110 } 107 111 … … 109 113 $sign = (boolean) $attr['is_flv'] ? '' : '!'; 110 114 $if[] = $sign. 111 '($ attach_f->type == "video/x-flv" || '.112 '$ attach_f->type == "video/mp4" || '.113 '$ attach_f->type == "video/x-m4v")';115 '($_ctx->attachments->type == "video/x-flv" || '. 116 '$_ctx->attachments->type == "video/mp4" || '. 117 '$_ctx->attachments->type == "video/x-m4v")'; 114 118 } 115 119 … … 127 131 { 128 132 $f = $GLOBALS['core']->tpl->getFilters($attr); 129 return '<?php echo '.sprintf($f,'$ attach_f->type').'; ?>';133 return '<?php echo '.sprintf($f,'$_ctx->attachments->type').'; ?>'; 130 134 } 131 135 … … 136 140 { 137 141 $f = $GLOBALS['core']->tpl->getFilters($attr); 138 return '<?php echo '.sprintf($f,'$ attach_f->media_type').'; ?>';142 return '<?php echo '.sprintf($f,'$_ctx->attachments->media_type').'; ?>'; 139 143 } 140 144 … … 145 149 { 146 150 $f = $GLOBALS['core']->tpl->getFilters($attr); 147 return '<?php echo '.sprintf($f,'$ attach_f->basename').'; ?>';151 return '<?php echo '.sprintf($f,'$_ctx->attachments->basename').'; ?>'; 148 152 } 149 153 … … 158 162 $f = $GLOBALS['core']->tpl->getFilters($attr); 159 163 if (!empty($attr['full'])) { 160 return '<?php echo '.sprintf($f,'$ attach_f->size').'; ?>';161 } 162 return '<?php echo '.sprintf($f,'files::size($ attach_f->size)').'; ?>';164 return '<?php echo '.sprintf($f,'$_ctx->attachments->size').'; ?>'; 165 } 166 return '<?php echo '.sprintf($f,'files::size($_ctx->attachments->size)').'; ?>'; 163 167 } 164 168 … … 169 173 { 170 174 $f = $GLOBALS['core']->tpl->getFilters($attr); 171 return '<?php echo '.sprintf($f,'$ attach_f->media_title').'; ?>';175 return '<?php echo '.sprintf($f,'$_ctx->attachments->media_title').'; ?>'; 172 176 } 173 177 … … 180 184 return 181 185 '<?php '. 182 'if (isset($ attach_f->media_thumb[\'sq\'])) {'.183 'echo '.sprintf($f,'$ attach_f->media_thumb[\'sq\']').';'.186 'if (isset($_ctx->attachments->media_thumb[\'sq\'])) {'. 187 'echo '.sprintf($f,'$_ctx->attachments->media_thumb[\'sq\']').';'. 184 188 '}'. 185 189 '?>'; … … 192 196 { 193 197 $f = $GLOBALS['core']->tpl->getFilters($attr); 194 return '<?php echo '.sprintf($f,'$ attach_f->file_url').'; ?>';198 return '<?php echo '.sprintf($f,'$_ctx->attachments->file_url').'; ?>'; 195 199 } 196 200
Note: See TracChangeset
for help on using the changeset viewer.