summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-02-15 11:40:19 +0000
committerDries Buytaert <dries@buytaert.net>2007-02-15 11:40:19 +0000
commitdc5843bd30a614cb074f70750ba2f631e61f8cb8 (patch)
treecd977b194f73b16e3dc1dfb40c9c9c5c1988f47f
parente57b926e8d4385e399731159bd90f862962a86ab (diff)
downloadbrdo-dc5843bd30a614cb074f70750ba2f631e61f8cb8.tar.gz
brdo-dc5843bd30a614cb074f70750ba2f631e61f8cb8.tar.bz2
- Patch #111347 by Steven: refactor url() and l().
-rw-r--r--includes/common.inc144
-rw-r--r--includes/file.inc2
-rw-r--r--includes/form.inc4
-rw-r--r--includes/pager.inc2
-rw-r--r--includes/tablesort.inc2
-rw-r--r--includes/theme.inc14
-rw-r--r--modules/aggregator/aggregator.module6
-rw-r--r--modules/blog/blog.module4
-rw-r--r--modules/blogapi/blogapi.module12
-rw-r--r--modules/comment/comment.module24
-rw-r--r--modules/contact/contact.module8
-rw-r--r--modules/forum/forum.module6
-rw-r--r--modules/node/node.module12
-rw-r--r--modules/path/path.module6
-rw-r--r--modules/statistics/statistics.module4
-rw-r--r--modules/system/system.module12
-rw-r--r--modules/taxonomy/taxonomy.module15
-rw-r--r--modules/tracker/tracker.module2
-rw-r--r--modules/upload/upload.module2
-rw-r--r--modules/user/user.module14
-rw-r--r--modules/watchdog/watchdog.module2
-rw-r--r--scripts/code-style.pl2
-rw-r--r--themes/engines/phptemplate/phptemplate.engine2
23 files changed, 163 insertions, 138 deletions
diff --git a/includes/common.inc b/includes/common.inc
index a5deeae12..175f9c9c1 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -303,7 +303,7 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response
extract(parse_url(urldecode($_REQUEST['edit']['destination'])));
}
- $url = url($path, $query, $fragment, TRUE);
+ $url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));
// Before the redirect, allow modules to react to the end of the page request.
module_invoke_all('exit', $url);
@@ -663,7 +663,7 @@ function locale_initialize() {
* - !variable, which indicates that the text should be inserted as-is. This is
* useful for inserting variables into things like e-mail.
* @code
- * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", NULL, NULL, TRUE)));
+ * $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE))));
* @endcode
*
* - @variable, which indicates that the text should be run through check_plain,
@@ -1120,25 +1120,39 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
* @param $path
* The Drupal path being linked to, such as "admin/content/node", or an existing URL
* like "http://drupal.org/".
- * @param $query
- * A query string to append to the link or URL.
- * @param $fragment
- * A fragment identifier (named anchor) to append to the link. If an existing
- * URL with a fragment identifier is used, it will be replaced. Note, do not
- * include the '#'.
- * @param $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an
- * RSS feed.
+ * @param $options
+ * An associative array of additional options, with the following keys:
+ * 'query'
+ * A query string to append to the link, or an array of query key/value
+ * properties.
+ * 'fragment'
+ * A fragment identifier (or named anchor) to append to the link.
+ * Do not include the '#' character.
+ * 'absolute' (default FALSE)
+ * Whether to force the output to be an absolute link (beginning with
+ * http:). Useful for links that will be displayed outside the site, such
+ * as in an RSS feed.
+ * 'alias' (default FALSE)
+ * Whether the given path is an alias already.
* @return
* a string containing a URL to the given path.
*
* When creating links in modules, consider whether l() could be a better
* alternative than url().
*/
-function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
- if (isset($fragment)) {
- $fragment = '#'. $fragment;
+function url($path = NULL, $options = array()) {
+ // Merge in defaults
+ $options += array(
+ 'fragment' => '',
+ 'query' => '',
+ 'absolute' => FALSE,
+ 'alias' => FALSE,
+ );
+ if ($options['fragment']) {
+ $options['fragment'] = '#'. $options['fragment'];
+ }
+ if (is_array($options['query'])) {
+ $options['query'] = drupal_query_string_encode($options['query']);
}
// Return an external link if $path contains an allowed absolute URL.
@@ -1148,16 +1162,16 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
// Split off the fragment
if (strpos($path, '#') !== FALSE) {
list($path, $old_fragment) = explode('#', $path, 2);
- if (isset($old_fragment) && !isset($fragment)) {
- $fragment = '#'. $old_fragment;
+ if (isset($old_fragment) && !$options['fragment']) {
+ $options['fragment'] = '#'. $old_fragment;
}
}
// Append the query
- if (isset($query)) {
- $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . $query;
+ if ($options['query']) {
+ $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . $options['query'];
}
// Reassemble
- return $path . $fragment;
+ return $path . $options['fragment'];
}
global $base_url;
@@ -1176,35 +1190,37 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
$clean_url = (bool)variable_get('clean_url', '0');
}
- $base = ($absolute ? $base_url . '/' : base_path());
+ $base = $options['absolute'] ? $base_url . '/' : base_path();
// The special path '<front>' links to the default front page.
if (!empty($path) && $path != '<front>') {
- $path = drupal_get_path_alias($path);
+ if (!$options['alias']) {
+ $path = drupal_get_path_alias($path);
+ }
$path = drupal_urlencode($path);
if (!$clean_url) {
- if (isset($query)) {
- return $base . $script .'?q='. $path .'&'. $query . $fragment;
+ if ($options['query']) {
+ return $base . $script .'?q='. $path .'&'. $options['query'] . $options['fragment'];
}
else {
- return $base . $script .'?q='. $path . $fragment;
+ return $base . $script .'?q='. $path . $options['fragment'];
}
}
else {
- if (isset($query)) {
- return $base . $path .'?'. $query . $fragment;
+ if ($options['query']) {
+ return $base . $path .'?'. $options['query'] . $options['fragment'];
}
else {
- return $base . $path . $fragment;
+ return $base . $path . $options['fragment'];
}
}
}
else {
- if (isset($query)) {
- return $base . $script .'?'. $query . $fragment;
+ if ($options['query']) {
+ return $base . $script .'?'. $options['query'] . $options['fragment'];
}
else {
- return $base . $fragment;
+ return $base . $options['fragment'];
}
}
}
@@ -1237,40 +1253,54 @@ function drupal_attributes($attributes = array()) {
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
- * The Drupal path being linked to, such as "admin/content/node". Can be an external
- * or internal URL.
- * - If you provide the full URL, it will be considered an
- * external URL.
- * - If you provide only the path (e.g. "admin/content/node"), it is considered an
- * internal link. In this case, it must be a system URL as the url() function
- * will generate the alias.
- * @param $attributes
- * An associative array of HTML attributes to apply to the anchor tag.
- * @param $query
- * A query string to append to the link.
- * @param $fragment
- * A fragment identifier (named anchor) to append to the link.
- * @param $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an RSS
- * feed.
- * @param $html
- * Whether the title is HTML, or just plain-text. For example for making an
- * image a link, this must be set to TRUE, or else you will see the encoded
- * HTML.
+ * The Drupal path being linked to, such as "admin/content/node". Can be an
+ * external or internal URL.
+ * - If you provide the full URL, it will be considered an external URL.
+ * - If you provide only the path (e.g. "admin/content/node"), it is
+ * considered an internal link. In this case, it must be a system URL
+ * as the url() function will generate the alias.
+ * - If you provide a path, and 'alias' is set to TRUE (see below), it is
+ * used as is.
+ * @param $options
+ * An associative array of additional options, with the following keys:
+ * 'attributes'
+ * An associative array of HTML attributes to apply to the anchor tag.
+ * 'query'
+ * A query string to append to the link, or an array of query key/value
+ * properties.
+ * 'fragment'
+ * A fragment identifier (named anchor) to append to the link.
+ * Do not include the '#' character.
+ * 'absolute' (default FALSE)
+ * Whether to force the output to be an absolute link (beginning with
+ * http:). Useful for links that will be displayed outside the site, such
+ * as in an RSS feed.
+ * 'html' (default FALSE)
+ * Whether the title is HTML, or just plain-text. For example for making
+ * an image a link, this must be set to TRUE, or else you will see the
+ * escaped HTML.
+ * 'alias' (default FALSE)
+ * Whether the given path is an alias already.
* @return
* an HTML string containing a link to the given path.
*/
-function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
+function l($text, $path, $options = array()) {
+ // Merge in defaults
+ $options += array(
+ 'attributes' => array(),
+ 'html' => FALSE,
+ );
+
+ // Append active class
if ($path == $_GET['q']) {
- if (isset($attributes['class'])) {
- $attributes['class'] .= ' active';
+ if (isset($options['attributes']['class'])) {
+ $options['attributes']['class'] .= ' active';
}
else {
- $attributes['class'] = 'active';
+ $options['attributes']['class'] = 'active';
}
}
- return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
+ return '<a href="'. check_url(url($path, $options)) .'"'. drupal_attributes($options['attributes']) .'>'. ($options['html'] ? $text : check_plain($text)) .'</a>';
}
/**
diff --git a/includes/file.inc b/includes/file.inc
index 4b8e3c6e3..5afc66b0d 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -35,7 +35,7 @@ function file_create_url($path) {
case FILE_DOWNLOADS_PUBLIC:
return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
case FILE_DOWNLOADS_PRIVATE:
- return url('system/files/'. $path, NULL, NULL, TRUE);
+ return url('system/files/'. $path, array('absolute' => TRUE));
}
}
diff --git a/includes/form.inc b/includes/form.inc
index 49d8de0cf..8df277379 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1038,7 +1038,7 @@ function theme_fieldset($element) {
}
}
- return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . $element['#value'] . "</fieldset>\n";
+ return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . (isset($element['#description']) && $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . $element['#value'] . "</fieldset>\n";
}
/**
@@ -1401,7 +1401,7 @@ function theme_textfield($element) {
if ($element['#autocomplete_path']) {
drupal_add_js('misc/autocomplete.js');
$class[] = 'form-autocomplete';
- $extra = '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
+ $extra = '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], array('absolute' => TRUE))) .'" disabled="disabled" />';
}
_form_set_class($element, $class);
diff --git a/includes/pager.inc b/includes/pager.inc
index edf2ba009..cabbe9e8b 100644
--- a/includes/pager.inc
+++ b/includes/pager.inc
@@ -392,7 +392,7 @@ function theme_pager_link($text, $page_new, $element, $parameters = array(), $at
}
}
- return l($text, $_GET['q'], $attributes, count($query) ? implode('&', $query) : NULL);
+ return l($text, $_GET['q'], array('attributes' => $attributes, 'query' => count($query) ? implode('&', $query) : NULL));
}
/**
diff --git a/includes/tablesort.inc b/includes/tablesort.inc
index 48a445828..b7f5d2003 100644
--- a/includes/tablesort.inc
+++ b/includes/tablesort.inc
@@ -83,7 +83,7 @@ function tablesort_header($cell, $header, $ts) {
if (!empty($ts['query_string'])) {
$ts['query_string'] = '&'. $ts['query_string'];
}
- $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . $ts['query_string'], NULL, FALSE, TRUE);
+ $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('attributes' => array('title' => $title), 'query' => 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . $ts['query_string'], 'html' => TRUE));
unset($cell['field'], $cell['sort']);
}
diff --git a/includes/theme.inc b/includes/theme.inc
index de1be95dd..7d1972ac8 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -563,19 +563,13 @@ function theme_links($links, $attributes = array('class' => 'links')) {
}
$output .= '<li class="'. $extra_class . $class .'">';
- // Is the title HTML?
- $html = isset($link['html']) && $link['html'];
-
- // Initialize fragment and query variables.
- $link['query'] = isset($link['query']) ? $link['query'] : NULL;
- $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
-
if (isset($link['href'])) {
- $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
+ // Pass in $link as $options, they share the same keys.
+ $output .= l($link['title'], $link['href'], $link);
}
else if ($link['title']) {
- //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
- if (!$html) {
+ // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
+ if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 51fa8ddb8..397e3650d 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -1212,7 +1212,7 @@ function aggregator_page_rss() {
$output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$output .= "<rss version=\"2.0\">\n";
- $output .= format_rss_channel(variable_get('site_name', 'Drupal') . ' ' . t('aggregator'), url('aggregator' . $url, NULL, NULL, TRUE), variable_get('site_name', 'Drupal') . ' - ' . t('aggregated feeds') . $title, $items, 'en');
+ $output .= format_rss_channel(variable_get('site_name', 'Drupal') . ' ' . t('aggregator'), url('aggregator' . $url, array('absolute' => TRUE)), variable_get('site_name', 'Drupal') . ' - ' . t('aggregated feeds') . $title, $items, 'en');
$output .= "</rss>\n";
drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
@@ -1290,7 +1290,7 @@ function theme_aggregator_feed($feed) {
$output .= theme('feed_icon', $feed->url) ."\n";
$output .= $feed->image;
$output .= '<div class="feed-description">'. aggregator_filter_xss($feed->description) ."</div>\n";
- $output .= '<div class="feed-url"><em>'. t('URL:') .'</em> '. l($feed->link, $feed->link, array(), NULL, NULL, TRUE) ."</div>\n";
+ $output .= '<div class="feed-url"><em>'. t('URL:') .'</em> '. l($feed->link, $feed->link, array('absolute' => TRUE)) ."</div>\n";
if ($feed->checked) {
$updated = t('@time ago', array('@time' => format_interval(time() - $feed->checked)));
@@ -1355,7 +1355,7 @@ function theme_aggregator_page_item($item) {
$source = '';
if ($item->ftitle && $item->fid) {
- $source = l($item->ftitle, "aggregator/sources/$item->fid", array('class' => 'feed-item-source')) . ' -';
+ $source = l($item->ftitle, "aggregator/sources/$item->fid", array('attributes' => array('class' => 'feed-item-source'))) . ' -';
}
if (date('Ymd', $item->timestamp) == date('Ymd')) {
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index ffdeeedec..6969dbd16 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -85,7 +85,7 @@ function blog_feed_user($uid = 0) {
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, variable_get('feed_default_items', 10));
$channel['title'] = $account->name ."'s blog";
- $channel['link'] = url("blog/$uid", NULL, NULL, TRUE);
+ $channel['link'] = url("blog/$uid", array('absolute' => TRUE));
$channel['description'] = $term->description;
node_feed($result, $channel);
}
@@ -96,7 +96,7 @@ function blog_feed_user($uid = 0) {
function blog_feed_last() {
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
$channel['title'] = variable_get('site_name', 'Drupal') .' blogs';
- $channel['link'] = url('blog', NULL, NULL, TRUE);
+ $channel['link'] = url('blog', array('absolute' => TRUE));
$channel['description'] = $term->description;
node_feed($result, $channel);
}
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index f55b54ce3..e78c30b2f 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -138,7 +138,7 @@ function blogapi_blogger_get_users_blogs($appid, $username, $password) {
$types = _blogapi_get_node_types();
$structs = array();
foreach ($types as $type) {
- $structs[] = array('url' => url('blog/' . $user->uid, NULL, NULL, TRUE), 'blogid' => $type, 'blogName' => $user->name . ": " . $type);
+ $structs[] = array('url' => url('blog/' . $user->uid, array('absolute' => TRUE)), 'blogid' => $type, 'blogName' => $user->name . ": " . $type);
}
return $structs;
}
@@ -161,7 +161,7 @@ function blogapi_blogger_get_user_info($appkey, $username, $password) {
'firstname' => $name[0],
'nickname' => $user->name,
'email' => $user->mail,
- 'url' => url('blog/' . $user->uid, NULL, NULL, TRUE));
+ 'url' => url('blog/' . $user->uid, array('absolute' => TRUE)));
}
else {
return blogapi_error($user);
@@ -575,7 +575,7 @@ function blogapi_init() {
drupal_add_link(array('rel' => 'EditURI',
'type' => 'application/rsd+xml',
'title' => t('RSD'),
- 'href' => url('blogapi/rsd', NULL, NULL, TRUE)));
+ 'href' => url('blogapi/rsd', array('absolute' => TRUE))));
}
}
@@ -583,7 +583,7 @@ function blogapi_rsd() {
global $base_url;
$xmlrpc = $base_url .'/'. 'xmlrpc.php';
- $base = url('', NULL, NULL, TRUE);
+ $base = url('', array('absolute' => TRUE));
$blogid = 1; # until we figure out how to handle multiple bloggers
drupal_set_header('Content-Type: application/rsd+xml; charset=utf-8');
@@ -658,8 +658,8 @@ function _blogapi_get_post($node, $bodies = TRUE) {
'dateCreated' => xmlrpc_date($node->created),
'title' => $node->title,
'postid' => $node->nid,
- 'link' => url('node/'.$node->nid, NULL, NULL, TRUE),
- 'permaLink' => url('node/'.$node->nid, NULL, NULL, TRUE),
+ 'link' => url('node/'.$node->nid, array('absolute' => TRUE)),
+ 'permaLink' => url('node/'.$node->nid, array('absolute' => TRUE)),
);
if ($bodies) {
if ($node->comment == 1) {
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) .'<br />'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp)));
+ $items[] = l($comment->subject, 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)) .'<br />'. 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 <a href="@url">permissions page</a>.', 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 <a href="@url">permissions page</a>.', 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 = '<div class="comment'. ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') .'">';
- $output .= '<div class="subject">'. l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") .' '. theme('mark', $comment->new) ."</div>\n";
+ $output .= '<div class="subject">'. l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . ' ' . theme('mark', $comment->new) ."</div>\n";
$output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
$output .= '<div class="body">'. $comment->comment .'</div>';
$output .= '<div class="links">'. theme('links', $links) .'</div>';
@@ -1782,7 +1782,7 @@ function theme_comment($comment, $links = array()) {
function theme_comment_folded($comment) {
$output = "<div class=\"comment-folded\">\n";
- $output .= ' <span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, NULL, NULL, "comment-$comment->cid") .' '. theme('mark', $comment->new) .'</span> ';
+ $output .= ' <span class="subject">'. l($comment->subject, comment_node_url() .'/'. $comment->cid, array('fragment' => "comment-$comment->cid")) . ' '. theme('mark', $comment->new) .'</span> ';
$output .= '<span class="credit">'. t('by') .' '. theme('username', $comment) ."</span>\n";
$output .= "</div>\n";
return $output;
@@ -1822,10 +1822,10 @@ function theme_comment_post_forbidden($nid) {
}
if (variable_get('user_register', 1)) {
- return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments', array('@login' => url('user/login', $destination), '@register' => url('user/register', $destination)));
+ return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
}
else {
- return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', $destination)));
+ return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
}
}
}
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index 9fa22df51..e00423d8e 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -16,7 +16,7 @@ function contact_help($section) {
$output .= '<p>'. t("Users can activate/deactivate their personal contact forms in their account settings. Upon activation, a contact tab will appear in their user profiles. Privileged users such as site administrators are able to contact users even if they have chosen not to enable this feature.") .'</p>';
$output .= '<p>'. t("Note that the contact tab will not appear when a user views his or her own profile; only when viewing another user's profile, if that user's contact form is enabled.") .'</p>';
$output .= '<p>'. t('If the menu module is enabled, a menu item linking to the site-wide contact page is added to the navigation block. It is disabled by default, but can be enabled via the <a href="@menu-module">menu management</a> page. Links to the contact page may also be added to the primary and secondary links using the same page.', array('@menu-module' => url('admin/build/menu'))) .'</p>';
- $output .= '<p>'. t('For more information, please read the configuration and customization handbook page for the <a href="@contact">contact module</a>.', array('@contact' => url('http://drupal.org/handbook/modules/contact/', NULL, NULL, TRUE))) .'</p>';
+ $output .= '<p>'. t('For more information, please read the configuration and customization handbook page for the <a href="@contact">contact module</a>.', array('@contact' => url('http://drupal.org/handbook/modules/contact/', array('absolute' => TRUE)))) .'</p>';
return $output;
case 'admin/build/contact':
$output = '<p>'. t('This page lets you setup <a href="@form">your site-wide contact form</a>. To do so, add one or more categories. You can associate different recipients with each category to route e-mails to different people. For example, you can route website feedback to the webmaster and direct product information requests to the sales department. On the <a href="@settings">settings page</a>, you can customize the information shown above the contact form. This can be useful to provide additional contact information such as your postal address and telephone number.', array('@settings' => url('admin/build/contact/settings'), '@form' => url('contact'))) .'</p>';
@@ -345,8 +345,8 @@ function contact_mail_user_submit($form_id, $form_values) {
$account = user_load(array('uid' => arg(1), 'status' => 1));
// Compose the body:
$message[] = "$account->name,";
- $message[] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", NULL, NULL, TRUE), '!form-url' => url($_GET['q'], NULL, NULL, TRUE), '!site' => variable_get('site_name', 'Drupal')));
- $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", NULL, NULL, TRUE)));
+ $message[] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE)), '!form-url' => url($_GET['q'], array('absolute' => TRUE)), '!site' => variable_get('site_name', 'Drupal')));
+ $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE))));
$message[] = t('Message:');
$message[] = $form_values['message'];
@@ -494,7 +494,7 @@ function contact_mail_page_submit($form_id, $form_values) {
$from = $form_values['mail'];
// Compose the body:
- $message[] = t("!name sent a message using the contact form at !form.", array('!name' => $form_values['name'], '!form' => url($_GET['q'], NULL, NULL, TRUE)));
+ $message[] = t("!name sent a message using the contact form at !form.", array('!name' => $form_values['name'], '!form' => url($_GET['q'], array('absolute' => TRUE))));
$message[] = $form_values['message'];
// Tidy up the body:
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index c3cf18cf3..15da94ece 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -915,7 +915,7 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$output .= '<li>'. t('You are not allowed to post a new forum topic.') .'</li>';
}
else {
- $output .= '<li>'. t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) .'</li>';
+ $output .= '<li>'. t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', array('query' => drupal_get_destination())))) .'</li>';
}
$output .= '</ul>';
@@ -977,7 +977,7 @@ function theme_forum_list($forums, $parents, $tid) {
$row = array(
'data' => array(
array('data' => $description, 'class' => 'forum'),
- array('data' => $forum->num_topics . ($new_topics ? '<br />'. l(format_plural($new_topics, '1 new', '@count new'), "forum/$forum->tid", NULL, NULL, 'new') : ''), 'class' => 'topics'),
+ array('data' => $forum->num_topics . ($new_topics ? '<br />'. l(format_plural($new_topics, '1 new', '@count new'), "forum/$forum->tid", array('fragment' => 'new')) : ''), 'class' => 'topics'),
array('data' => $forum->num_posts, 'class' => 'posts'),
array('data' => _forum_format($forum->last_post), 'class' => 'last-reply'),
),
@@ -1018,7 +1018,7 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
$rows[] = array(
array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
- array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),
+ array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", array('fragment' => 'new')) : ''), 'class' => 'replies'),
array('data' => _forum_format($topic), 'class' => 'created'),
array('data' => _forum_format(isset($topic->last_reply) ? $topic->last_reply : NULL), 'class' => 'last-reply')
);
diff --git a/modules/node/node.module b/modules/node/node.module
index cc9a3cf6f..98eae0e42 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -922,7 +922,7 @@ function node_search($op = 'search', $keys = NULL) {
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
$extra = node_invoke_nodeapi($node, 'search result');
- $results[] = array('link' => url('node/'. $item->sid, NULL, NULL, TRUE),
+ $results[] = array('link' => url('node/'. $item->sid, array('absolute' => TRUE)),
'type' => node_get_types('name', $node),
'title' => $node->title,
'user' => theme('username', $node),
@@ -1530,7 +1530,7 @@ function node_admin_nodes() {
$form['name'][$node->nid] = array('#value' => node_get_types('name', $node));
$form['username'][$node->nid] = array('#value' => theme('username', $node));
$form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published')));
- $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
+ $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array('query' => $destination)));
}
$form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
$form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
@@ -1764,7 +1764,7 @@ function node_feed($nodes = 0, $channel = array()) {
while ($node = db_fetch_object($nodes)) {
// Load the specified node:
$item = node_load($node->nid);
- $link = url("node/$node->nid", NULL, NULL, 1);
+ $link = url("node/$node->nid", array('absolute' => TRUE));
if ($item_length != 'title') {
$teaser = ($item_length == 'teaser') ? TRUE : FALSE;
@@ -1798,7 +1798,7 @@ function node_feed($nodes = 0, $channel = array()) {
case 'teaser':
$item_text = $item->teaser;
if ($item->readmore) {
- $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) .'</p>';
+ $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, array('absolute' => TRUE)) .'</p>';
}
break;
case 'title':
@@ -2128,7 +2128,7 @@ function node_add($type = NULL) {
if (function_exists($type->module .'_form') && node_access('create', $type->type)) {
$type_url_str = str_replace('_', '-', $type->type);
$title = t('Add a new @s.', array('@s' => $type->name));
- $out = '<dt>'. l(drupal_ucfirst($type->name), "node/add/$type_url_str", array('title' => $title)) .'</dt>';
+ $out = '<dt>'. l(drupal_ucfirst($type->name), "node/add/$type_url_str", array('attributes' => array('title' => $title))) .'</dt>';
$out .= '<dd>'. filter_xss_admin($type->description) .'</dd>';
$item[$type->type] = $out;
}
@@ -2348,7 +2348,7 @@ function node_page_default() {
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
if (db_num_rows($result)) {
- $feed_url = url('rss.xml', NULL, NULL, TRUE);
+ $feed_url = url('rss.xml', array('absolute' => TRUE));
drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') .' '. t('RSS'));
$output = '';
diff --git a/modules/path/path.module b/modules/path/path.module
index 7c6b5480b..372ff5e05 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -187,7 +187,7 @@ function path_form($edit = '') {
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
- '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
);
$form['dst'] = array(
'#type' => 'textfield',
@@ -195,7 +195,7 @@ function path_form($edit = '') {
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
- '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
);
if ($edit['pid']) {
@@ -312,7 +312,7 @@ function path_overview() {
$rows = array();
$destination = drupal_get_destination();
while ($data = db_fetch_object($result)) {
- $rows[] = array(check_plain($data->dst), check_plain($data->src), l(t('edit'), "admin/build/path/edit/$data->pid", array(), $destination), l(t('delete'), "admin/build/path/delete/$data->pid", array(), $destination));
+ $rows[] = array(check_plain($data->dst), check_plain($data->src), l(t('edit'), "admin/build/path/edit/$data->pid", array('query' => $destination)), l(t('delete'), "admin/build/path/delete/$data->pid", array('query' => $destination)));
}
if (empty($rows)) {
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 82de6c73a..4ccbb2006 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -176,7 +176,7 @@ function statistics_access_log($aid) {
$result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
if ($access = db_fetch_object($result)) {
$output = '<table border="1" cellpadding="2" cellspacing="2">';
- $output .= ' <tr><th>'. t('URL') ."</th><td>". l(url($access->path, NULL, NULL, TRUE), $access->path) ."</td></tr>";
+ $output .= ' <tr><th>'. t('URL') ."</th><td>". l(url($access->path, array('absolute' => TRUE)), $access->path) ."</td></tr>";
$output .= ' <tr><th>'. t('Title') .'</th><td>'. $access->title .'</td></tr>'; // safe because it comes from drupal_get_title()
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". ($access->url ? l($access->url, $access->url) : '') ."</td></tr>";
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($access->timestamp, 'large') .'</td></tr>';
@@ -318,7 +318,7 @@ function statistics_top_visitors() {
$rows = array();
while ($account = db_fetch_object($result)) {
$qs = drupal_get_destination();
- $ban_link = $account->aid ? l(t('unban'), "admin/user/rules/delete/$account->aid", array(), $qs) : l(t('ban'), "admin/user/rules/add/$account->hostname/host", array(), $qs);
+ $ban_link = $account->aid ? l(t('unban'), "admin/user/rules/delete/$account->aid", array('query' => $qs)) : l(t('ban'), "admin/user/rules/add/$account->hostname/host", array('query' => $qs));
$rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), $ban_link);
}
diff --git a/modules/system/system.module b/modules/system/system.module
index 7282e156c..e77483f51 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -565,7 +565,7 @@ function system_site_information_settings() {
'#default_value' => variable_get('site_frontpage', 'node'),
'#size' => 40,
'#description' => t('The home page displays content from this relative URL. If unsure, specify "node".'),
- '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
);
return system_settings_form($form);
@@ -614,7 +614,7 @@ function system_error_reporting_settings() {
'#default_value' => variable_get('site_403', ''),
'#size' => 40,
'#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
);
$form['site_404'] = array(
@@ -623,7 +623,7 @@ function system_error_reporting_settings() {
'#default_value' => variable_get('site_404', ''),
'#size' => 40,
'#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
);
$form['error_level'] = array(
@@ -2150,7 +2150,7 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL,
$fragment = isset($path['fragment']) ? $path['fragment'] : NULL;
$path = isset($path['path']) ? $path['path'] : NULL;
}
- $cancel = l($no ? $no : t('Cancel'), $path, array(), $query, $fragment);
+ $cancel = l($no ? $no : t('Cancel'), $path, array('query' => $query, 'fragment' => $fragment));
drupal_set_title($question);
$form['#attributes'] = array('class' => 'confirmation');
@@ -2261,7 +2261,7 @@ function theme_admin_block_content($content) {
if (system_admin_compact_mode()) {
$output = '<ul class="menu">';
foreach ($content as $item) {
- $output .= '<li class="leaf">'. l($item['title'], $item['path'], array('title' => $item['description'])) .'</li>';
+ $output .= '<li class="leaf">'. l($item['title'], $item['path'], array('attributes' => array('title' => $item['description']))) .'</li>';
}
$output .= '</ul>';
}
@@ -2316,7 +2316,7 @@ function system_get_module_admin_tasks($module) {
// Check for permissions.
if (module_hook($module, 'perm') && $admin_access) {
- $admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/access', NULL, NULL, 'module-'. $module);
+ $admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/access', array('fragment' => 'module-'. $module));
}
// Check for menu items that are admin links.
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index b6f370a51..9bbe24ee4 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -190,7 +190,7 @@ function taxonomy_overview_terms($vocabulary) {
if (($start_from && ($start_from * $page_increment) >= $total_entries) || ($displayed_count == $page_increment)) {
continue;
}
- $rows[] = array(str_repeat('--', $term->depth) .' '. l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array(), $destination));
+ $rows[] = array(str_repeat('--', $term->depth) . ' ' . l($term->name, "taxonomy/term/$term->tid"), l(t('edit'), "admin/content/taxonomy/edit/term/$term->tid", array('query' => $destination)));
$displayed_count++; // we're counting tids displayed
}
@@ -240,12 +240,12 @@ function taxonomy_form_vocabulary($edit = array()) {
'#title' => t('Hierarchy'),
'#default_value' => $edit['hierarchy'],
'#options' => array(t('Disabled'), t('Single'), t('Multiple')),
- '#description' => t('Allows <a href="@help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('@help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))),
+ '#description' => t('Allows <a href="@help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('@help-url' => url('admin/help/taxonomy', array('absolute' => TRUE)))),
);
$form['relations'] = array('#type' => 'checkbox',
'#title' => t('Related terms'),
'#default_value' => $edit['relations'],
- '#description' => t('Allows <a href="@help-url">related terms</a> in this vocabulary.', array('@help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'))),
+ '#description' => t('Allows <a href="@help-url">related terms</a> in this vocabulary.', array('@help-url' => url('admin/help/taxonomy', array('absolute' => TRUE)))),
);
$form['tags'] = array('#type' => 'checkbox',
'#title' => t('Free tagging'),
@@ -396,10 +396,11 @@ function taxonomy_form_term($vocabulary, $edit = array()) {
$exclude[] = $edit['tid'];
if ($vocabulary->hierarchy == 1) {
+ $form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary_id, l(t('Parent term'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 0, '<'. t('root') .'>', $exclude);
$form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary->vid, l(t('Parent term'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 0, '<'. t('root') .'>', $exclude);
}
elseif ($vocabulary->hierarchy == 2) {
- $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, l(t('Parent terms'), 'admin/help/taxonomy', NULL, NULL, 'parent') .'.', 1, '<'. t('root') .'>', $exclude);
+ $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary_id, l(t('Parent terms'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 1, '<'. t('root') .'>', $exclude);
}
}
@@ -411,7 +412,7 @@ function taxonomy_form_term($vocabulary, $edit = array()) {
'#type' => 'textarea',
'#title' => t('Synonyms'),
'#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])),
- '#description' => t('<a href="@help-url">Synonyms</a> of this term, one synonym per line.', array('@help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
+ '#description' => t('<a href="@help-url">Synonyms</a> of this term, one synonym per line.', array('@help-url' => url('admin/help/taxonomy', array('absolute' => TRUE)))));
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
@@ -1385,7 +1386,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
case 'feed':
$term = taxonomy_get_term($tids[0]);
- $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
+ $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, array('absolute' => TRUE));
$channel['title'] = variable_get('site_name', 'Drupal') .' - '. $title;
$channel['description'] = $term->description;
@@ -1433,7 +1434,7 @@ function taxonomy_rss_item($node) {
foreach ($node->taxonomy as $term) {
$output[] = array('key' => 'category',
'value' => check_plain($term->name),
- 'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, NULL, NULL, TRUE)));
+ 'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, array('absolute' => TRUE))));
}
return $output;
}
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 51d6f6d3a..9f924d649 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -107,7 +107,7 @@ function tracker_page($uid = 0) {
if ($new = comment_num_new($node->nid)) {
$comments .= '<br />';
- $comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", NULL, NULL, 'new');
+ $comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", array('fragment' => 'new'));
}
}
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index c85df433c..82c7eb6d9 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -795,7 +795,7 @@ function _upload_form($node) {
$form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
$form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name' => 'attach', '#id' => 'attach-button');
// The class triggers the js upload behaviour.
- $form['attach-url'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
+ $form['attach-url'] = array('#type' => 'hidden', '#value' => url('upload/js', array('absolute' => TRUE)), '#attributes' => array('class' => 'upload'));
}
// Needed for JS
diff --git a/modules/user/user.module b/modules/user/user.module
index ff92c54fd..5c3fff7ce 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -440,7 +440,7 @@ function user_search($op = 'search', $keys = NULL, $skip_access_check = FALSE) {
$keys = preg_replace('!\*+!', '%', $keys);
$result = pager_query("SELECT * FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
while ($account = db_fetch_object($result)) {
- $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, NULL, NULL, TRUE));
+ $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
}
return $find;
}
@@ -478,7 +478,7 @@ function user_user($type, &$edit, &$user, $category = NULL) {
function user_login_block() {
$form = array(
- '#action' => url($_GET['q'], drupal_get_destination()),
+ '#action' => url($_GET['q'], array('query' => drupal_get_destination())),
'#id' => 'user-login-form',
'#base' => 'user_login',
);
@@ -965,7 +965,7 @@ function user_auth_help_links() {
$links = array();
foreach (module_list() as $module) {
if (module_hook($module, 'auth')) {
- $links[] = l(module_invoke($module, 'info', 'name'), 'user/help', array(), NULL, $module);
+ $links[] = l(module_invoke($module, 'info', 'name'), 'user/help', array('fragment' => $module));
}
}
return $links;
@@ -1158,7 +1158,7 @@ function user_pass_submit($form_id, $form_values) {
$from = variable_get('site_mail', ini_get('sendmail_from'));
// Mail one time login URL and instructions.
- $variables = array('!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => user_pass_reset_url($account), '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), '!mailto' => $account->mail, '!date' => format_date(time()), '!login_uri' => url('user', NULL, NULL, TRUE), '!edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE));
+ $variables = array('!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => user_pass_reset_url($account), '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), '!mailto' => $account->mail, '!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)), '!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE)));
$subject = _user_mail_text('pass_subject', $variables);
$body = _user_mail_text('pass_body', $variables);
$mail_success = drupal_mail('user-pass', $account->mail, $subject, $body, $from);
@@ -1234,7 +1234,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass, $action = NULL) {
function user_pass_reset_url($account) {
$timestamp = time();
- return url("user/reset/$account->uid/$timestamp/".user_pass_rehash($account->pass, $timestamp, $account->login), NULL, NULL, TRUE);
+ return url("user/reset/$account->uid/$timestamp/".user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
}
function user_pass_rehash($password, $timestamp, $login) {
@@ -1332,7 +1332,7 @@ function user_register_submit($form_id, $form_values) {
$account = user_save('', array_merge($form_values, $merge_data));
watchdog('user', t('New user: %name %email.', array('%name' => $name, '%email' => '<'. $mail .'>')), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
- $variables = array('!username' => $name, '!site' => variable_get('site_name', 'Drupal'), '!password' => $pass, '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), '!mailto' => $mail, '!date' => format_date(time()), '!login_uri' => url('user', NULL, NULL, TRUE), '!edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '!login_url' => user_pass_reset_url($account));
+ $variables = array('!username' => $name, '!site' => variable_get('site_name', 'Drupal'), '!password' => $pass, '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), '!mailto' => $mail, '!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)), '!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE)), '!login_url' => user_pass_reset_url($account));
// The first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
@@ -2136,7 +2136,7 @@ function user_admin_account() {
$form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles));
$form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created));
$form['last_access'][$account->uid] = array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never'));
- $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array(), $destination));
+ $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
}
$form['accounts'] = array(
'#type' => 'checkboxes',
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index e26f48a64..9c584cd86 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -142,7 +142,7 @@ function watchdog_overview() {
$icons[$watchdog->severity],
t($watchdog->type),
format_date($watchdog->timestamp, 'small'),
- l(truncate_utf8($watchdog->message, 56, TRUE, TRUE), 'admin/logs/event/'. $watchdog->wid, array(), NULL, NULL, FALSE, TRUE),
+ l(truncate_utf8($watchdog->message, 56, TRUE, TRUE), 'admin/logs/event/'. $watchdog->wid, array('html' => TRUE)),
theme('username', $watchdog),
$watchdog->link,
),
diff --git a/scripts/code-style.pl b/scripts/code-style.pl
index 5f88748f3..5970fc10c 100644
--- a/scripts/code-style.pl
+++ b/scripts/code-style.pl
@@ -181,7 +181,7 @@ code-style.pl - Review drupal code for style
=head1 DESCRIPTION
Originally written for Drupal (http://drupal.org/) to ensure stylish
-code. This program reviews PHP code, and tries to show as many code
+code. This program reviews PHP code, and tries to show as many code
improvements as possible with no false positives.
=head1 OPTIONS
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index c8892b097..8b3e5448c 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -312,7 +312,7 @@ function phptemplate_comment($comment, $links = 0) {
'submitted' => t('Submitted by !a on @b.',
array('!a' => theme('username', $comment),
'@b' => format_date($comment->timestamp))),
- 'title' => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid")
+ 'title' => l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid"))
));
}