Changeset 1220:4358ca8a7184
- Timestamp:
- 07/18/13 13:52:55 (12 years ago)
- Branch:
- ticket1084
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.media.php
r1179 r1220 515 515 $f = $this->fileRecord($rs); 516 516 if ($f !== null) { 517 $res[] = $f;517 $res[] = new ArrayObject($f); 518 518 } 519 519 } -
plugins/attachments/_public.php
r1179 r1220 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 = staticRecord::newFromArray($core->media->getPostMedia($_ctx->posts->post_id));'."\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; ?>'. 48 $content. 49 '<?php endforeach; $_ctx->attachments = null; unset($attach_i,$attach_f,$_ctx->file_url); ?>'. 45 '<?php $attach_i = 0; ?>'. // LEGACY 46 '<?php while ($_ctx->attachments->fetch()) : ?>'. 47 48 '<?php $GLOBALS[\'attach_i\'] = $attach_i++; $GLOBALS[\'attach_f\'] = $_ctx->attachments->row();'. // LEGACY 49 '$_ctx->file_url = $_ctx->attachments->file_url; ?>'. // LEGACY 50 51 $content.'<?php endwhile; '. 52 '$_ctx->attachments = null; ?>'. 50 53 51 54 "<?php } ?>\n"; … … 60 63 { 61 64 return 62 "<?php if (\$ attach_i == 0) : ?>".65 "<?php if (\$_ctx->attachments->isStart()) : ?>". 63 66 $content. 64 67 "<?php endif; ?>"; … … 71 74 { 72 75 return 73 "<?php if (\$ attach_i+1 == count(\$_ctx->attachments)) : ?>".76 "<?php if (\$_ctx->attachments->isEnd()) : ?>". 74 77 $content. 75 78 "<?php endif; ?>"; … … 93 96 if (isset($attr['is_image'])) { 94 97 $sign = (boolean) $attr['is_image'] ? '' : '!'; 95 $if[] = $sign.'$ attach_f->media_image';98 $if[] = $sign.'$_ctx->attachments->media_image'; 96 99 } 97 100 98 101 if (isset($attr['has_thumb'])) { 99 102 $sign = (boolean) $attr['has_thumb'] ? '' : '!'; 100 $if[] = $sign.'isset($ attach_f->media_thumb[\'sq\'])';103 $if[] = $sign.'isset($_ctx->attachments->media_thumb[\'sq\'])'; 101 104 } 102 105 103 106 if (isset($attr['is_mp3'])) { 104 107 $sign = (boolean) $attr['is_mp3'] ? '==' : '!='; 105 $if[] = '$ attach_f->type '.$sign.' "audio/mpeg3"';108 $if[] = '$_ctx->attachments->type '.$sign.' "audio/mpeg3"'; 106 109 } 107 110 … … 109 112 $sign = (boolean) $attr['is_flv'] ? '' : '!'; 110 113 $if[] = $sign. 111 '($ attach_f->type == "video/x-flv" || '.112 '$ attach_f->type == "video/mp4" || '.113 '$ attach_f->type == "video/x-m4v")';114 '($_ctx->attachments->type == "video/x-flv" || '. 115 '$_ctx->attachments->type == "video/mp4" || '. 116 '$_ctx->attachments->type == "video/x-m4v")'; 114 117 } 115 118 … … 127 130 { 128 131 $f = $GLOBALS['core']->tpl->getFilters($attr); 129 return '<?php echo '.sprintf($f,'$ attach_f->type').'; ?>';132 return '<?php echo '.sprintf($f,'$_ctx->attachments->type').'; ?>'; 130 133 } 131 134 … … 136 139 { 137 140 $f = $GLOBALS['core']->tpl->getFilters($attr); 138 return '<?php echo '.sprintf($f,'$ attach_f->media_type').'; ?>';141 return '<?php echo '.sprintf($f,'$_ctx->attachments->media_type').'; ?>'; 139 142 } 140 143 … … 145 148 { 146 149 $f = $GLOBALS['core']->tpl->getFilters($attr); 147 return '<?php echo '.sprintf($f,'$ attach_f->basename').'; ?>';150 return '<?php echo '.sprintf($f,'$_ctx->attachments->basename').'; ?>'; 148 151 } 149 152 … … 158 161 $f = $GLOBALS['core']->tpl->getFilters($attr); 159 162 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)').'; ?>';163 return '<?php echo '.sprintf($f,'$_ctx->attachments->size').'; ?>'; 164 } 165 return '<?php echo '.sprintf($f,'files::size($_ctx->attachments->size)').'; ?>'; 163 166 } 164 167 … … 169 172 { 170 173 $f = $GLOBALS['core']->tpl->getFilters($attr); 171 return '<?php echo '.sprintf($f,'$ attach_f->media_title').'; ?>';174 return '<?php echo '.sprintf($f,'$_ctx->attachments->media_title').'; ?>'; 172 175 } 173 176 … … 180 183 return 181 184 '<?php '. 182 'if (isset($ attach_f->media_thumb[\'sq\'])) {'.183 'echo '.sprintf($f,'$ attach_f->media_thumb[\'sq\']').';'.185 'if (isset($_ctx->attachments->media_thumb[\'sq\'])) {'. 186 'echo '.sprintf($f,'$_ctx->attachments->media_thumb[\'sq\']').';'. 184 187 '}'. 185 188 '?>'; … … 192 195 { 193 196 $f = $GLOBALS['core']->tpl->getFilters($attr); 194 return '<?php echo '.sprintf($f,'$ attach_f->file_url').'; ?>';197 return '<?php echo '.sprintf($f,'$_ctx->attachments->file_url').'; ?>'; 195 198 } 196 199
Note: See TracChangeset
for help on using the changeset viewer.