From dc5843bd30a614cb074f70750ba2f631e61f8cb8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 15 Feb 2007 11:40:19 +0000 Subject: - Patch #111347 by Steven: refactor url() and l(). --- modules/comment/comment.module | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index f922d300e..91b7601fc 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -284,7 +284,7 @@ function comment_get_recent($number = 10) { function theme_comment_block() { $items = array(); foreach (comment_get_recent() as $comment) { - $items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'
'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))); + $items[] = l($comment->subject, 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)) .'
'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))); } if ($items) { return theme('item_list', $items); @@ -443,7 +443,7 @@ function comment_nodeapi(&$node, $op, $arg = 0) { case 'rss item': if ($node->comment != COMMENT_NODE_DISABLED) { - return array(array('key' => 'comments', 'value' => url('node/'. $node->nid, NULL, 'comments', TRUE))); + return array(array('key' => 'comments', 'value' => url('node/'. $node->nid, array('fragment' => 'comments', 'absolute' => TRUE)))); } else { return array(); @@ -538,7 +538,7 @@ function comment_admin_settings() { COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'), COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information')), - '#description' => t('This option is enabled when anonymous users have permission to post comments on the permissions page.', array('@url' => url('admin/user/access', NULL, 'module-comment'))), + '#description' => t('This option is enabled when anonymous users have permission to post comments on the permissions page.', array('@url' => url('admin/user/access', array('fragment' => 'module-comment')))), ); if (!user_access('post comments', user_load(array('uid' => 0)))) { $form['posting_settings']['comment_anonymous']['#disabled'] = TRUE; @@ -718,7 +718,7 @@ function comment_save($edit) { comment_invoke_comment($edit, 'update'); // Add an entry to the watchdog log. - watchdog('content', t('Comment: updated %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); + watchdog('content', t('Comment: updated %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], array('fragment' => 'comment-'. $edit['cid']))); } else { // Check for duplicate comments. Note that we have to use the @@ -799,7 +799,7 @@ function comment_save($edit) { comment_invoke_comment($edit, 'insert'); // Add an entry to the watchdog log. - watchdog('content', t('Comment: added %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid'])); + watchdog('content', t('Comment: added %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], array('fragment' => 'comment-'. $edit['cid']))); } // Clear the cache so an anonymous user can see his comment being added. @@ -1187,10 +1187,10 @@ function comment_admin_overview($type = 'new', $arg) { while ($comment = db_fetch_object($result)) { $comments[$comment->cid] = ''; $comment->name = $comment->uid ? $comment->registered_name : $comment->name; - $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8($comment->comment, 128)), NULL, 'comment-'. $comment->cid)); + $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8($comment->comment, 128), 'fragment' => 'comment-'. $comment->cid))); $form['username'][$comment->cid] = array('#value' => theme('username', $comment)); $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small')); - $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array(), $destination)); + $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array('query' => $destination))); } $form['comments'] = array('#type' => 'checkboxes', '#options' => isset($comments) ? $comments: array()); $form['pager'] = array('#value' => theme('pager', NULL, 50, 0)); @@ -1226,7 +1226,7 @@ function comment_admin_overview_submit($form_id, $form_values) { // Allow modules to respond to the updating of a comment. comment_invoke_comment($comment, $form_values['operation']); // Add an entry to the watchdog log. - watchdog('content', t('Comment: updated %subject.', array('%subject' => $comment->subject)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid)); + watchdog('content', t('Comment: updated %subject.', array('%subject' => $comment->subject)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid))); } } cache_clear_all(); @@ -1772,7 +1772,7 @@ function comment_controls_submit($form_id, $form_values) { function theme_comment($comment, $links = array()) { $output = '
'; - $output .= '
'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") .' '. theme('mark', $comment->new) ."
\n"; + $output .= '
'. l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . ' ' . theme('mark', $comment->new) ."
\n"; $output .= '
'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."
\n"; $output .= '
'. $comment->comment .'
'; $output .= ''; @@ -1782,7 +1782,7 @@ function theme_comment($comment, $links = array()) { function theme_comment_folded($comment) { $output = "
\n"; - $output .= ' '. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") .' '. theme('mark', $comment->new) .' '; + $output .= ' '. l($comment->subject, comment_node_url() .'/'. $comment->cid, array('fragment' => "comment-$comment->cid")) . ' '. theme('mark', $comment->new) .' '; $output .= ''. t('by') .' '. theme('username', $comment) ."\n"; $output .= "
\n"; return $output; @@ -1822,10 +1822,10 @@ function theme_comment_post_forbidden($nid) { } if (variable_get('user_register', 1)) { - return t('Login or register to post comments', array('@login' => url('user/login', $destination), '@register' => url('user/register', $destination))); + return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); } else { - return t('Login to post comments', array('@login' => url('user/login', $destination))); + return t('Login to post comments', array('@login' => url('user/login', array('query' => $destination)))); } } } -- cgit v1.2.3