|
Revision 2450, 0.8 kB
(checked in by takayama, 18 months ago)
|
|
Fixed BugId:79904
* Changed to use MTCommentLink
* Added support for filtering of no class to fetch_entries
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
|---|
| 3 | # This program is distributed under the terms of the |
|---|
| 4 | # GNU General Public License, version 2. |
|---|
| 5 | # |
|---|
| 6 | # $Id$ |
|---|
| 7 | |
|---|
| 8 | function smarty_function_mtcommentlink($args, &$ctx) { |
|---|
| 9 | $args['no_anchor'] = 1; |
|---|
| 10 | $c = $ctx->stash('comment'); |
|---|
| 11 | $e = $ctx->stash('entry'); |
|---|
| 12 | $need_clear = false; |
|---|
| 13 | if (empty($e)) { |
|---|
| 14 | $entries = $ctx->mt->db->fetch_entries( |
|---|
| 15 | array('entry_id' => $c['comment_entry_id'], 'class' => '*')); |
|---|
| 16 | $e = $entries[0]; |
|---|
| 17 | $ctx->stash('entry', $e); |
|---|
| 18 | $need_clear = true; |
|---|
| 19 | } |
|---|
| 20 | if (empty($e)) return ''; |
|---|
| 21 | $entry_link = $ctx->tag($e['entry_class'].'Permalink', $args); |
|---|
| 22 | $entry_link .= '#comment-' . $c['comment_id']; |
|---|
| 23 | |
|---|
| 24 | if ($need_clear) |
|---|
| 25 | $ctx->stash('entry', null); |
|---|
| 26 | |
|---|
| 27 | return $entry_link; |
|---|
| 28 | } |
|---|