- Patch #831914 by Dave Reid: removed redundant/duplicate [node:uid], [comment:uid], and [file:uid] tokens.

merge-requests/26/head
Dries Buytaert 2010-06-29 00:57:19 +00:00
parent cbfdd2e9c7
commit b6c0d1ab20
6 changed files with 5 additions and 46 deletions

View File

@ -1187,9 +1187,6 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
// Generate and test sanitized tokens.
$tests = array();
$tests['[comment:cid]'] = $comment->cid;
$tests['[comment:pid]'] = $comment->pid;
$tests['[comment:nid]'] = $comment->nid;
$tests['[comment:uid]'] = $comment->uid;
$tests['[comment:hostname]'] = check_plain($comment->hostname);
$tests['[comment:name]'] = filter_xss($comment->name);
$tests['[comment:mail]'] = check_plain($this->admin_user->mail);
@ -1200,8 +1197,11 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[comment:edit-url]'] = url('comment/' . $comment->cid . '/edit', $url_options);
$tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->created, 2, $language->language);
$tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->changed, 2, $language->language);
$tests['[comment:parent:cid]'] = $comment->pid;
$tests['[comment:parent:title]'] = check_plain($parent_comment->subject);
$tests['[comment:node:nid]'] = $comment->nid;
$tests['[comment:node:title]'] = check_plain($node->title);
$tests['[comment:author:uid]'] = $comment->uid;
$tests['[comment:author:name]'] = check_plain($this->admin_user->name);
// Test to make sure that we generated something for each token.

View File

@ -31,18 +31,6 @@ function comment_token_info() {
'name' => t("Comment ID"),
'description' => t("The unique ID of the comment."),
);
$comment['pid'] = array(
'name' => t("Parent ID"),
'description' => t("The unique ID of the comment's parent, if comment threading is active."),
);
$comment['nid'] = array(
'name' => t("Node ID"),
'description' => t("The unique ID of the node the comment was posted to."),
);
$comment['uid'] = array(
'name' => t("User ID"),
'description' => t("The unique ID of the user who posted the comment."),
);
$comment['hostname'] = array(
'name' => t("IP Address"),
'description' => t("The IP address of the computer the comment was posted from."),
@ -138,18 +126,6 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements[$original] = $comment->cid;
break;
case 'pid':
$replacements[$original] = $comment->pid;
break;
case 'nid':
$replacements[$original] = $comment->nid;
break;
case 'uid':
$replacements[$original] = $comment->uid;
break;
// Poster identity information for comments
case 'hostname':
$replacements[$original] = $sanitize ? check_plain($comment->hostname) : $comment->hostname;

View File

@ -647,7 +647,6 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
// Generate and test sanitized tokens.
$tests = array();
$tests['[file:fid]'] = $file->fid;
$tests['[file:uid]'] = $file->uid;
$tests['[file:name]'] = check_plain($file->filename);
$tests['[file:description]'] = filter_xss($file->description);
$tests['[file:path]'] = filter_xss($file->uri);
@ -657,7 +656,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
$tests['[file:timestamp]'] = format_date($file->timestamp, 'medium', '', NULL, $language->language);
$tests['[file:timestamp:short]'] = format_date($file->timestamp, 'short', '', NULL, $language->language);
$tests['[file:owner]'] = $this->admin_user->name;
$tests['[file:owner:uid]'] = $this->admin_user->uid;
$tests['[file:owner:uid]'] = $file->uid;
// Test to make sure that we generated something for each token.
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));

View File

@ -1730,7 +1730,6 @@ class NodeTokenReplaceTestCase extends DrupalWebTestCase {
$tests['[node:nid]'] = $node->nid;
$tests['[node:vid]'] = $node->vid;
$tests['[node:tnid]'] = $node->tnid;
$tests['[node:uid]'] = $node->uid;
$tests['[node:type]'] = 'article';
$tests['[node:type-name]'] = 'Article';
$tests['[node:title]'] = check_plain($node->title);
@ -1739,6 +1738,7 @@ class NodeTokenReplaceTestCase extends DrupalWebTestCase {
$tests['[node:language]'] = check_plain($node->language);
$tests['[node:url]'] = url('node/' . $node->nid, $url_options);
$tests['[node:edit-url]'] = url('node/' . $node->nid . '/edit', $url_options);
$tests['[node:author:uid]'] = $node->uid;
$tests['[node:author:name]'] = check_plain($account->name);
$tests['[node:created:since]'] = format_interval(REQUEST_TIME - $node->created, 2, $language->language);
$tests['[node:changed:since]'] = format_interval(REQUEST_TIME - $node->changed, 2, $language->language);

View File

@ -31,10 +31,6 @@ function node_token_info() {
'name' => t("Translation set ID"),
'description' => t("The unique ID of the original-language version of this node, if one exists."),
);
$node['uid'] = array(
'name' => t("User ID"),
'description' => t("The unique ID of the user who posted the node."),
);
$node['type'] = array(
'name' => t("Content type"),
'description' => t("The type of the node."),
@ -125,10 +121,6 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
$replacements[$original] = $node->tnid;
break;
case 'uid':
$replacements[$original] = $node->uid;
break;
case 'type':
$replacements[$original] = $sanitize ? check_plain($node->type) : $node->type;
break;

View File

@ -89,10 +89,6 @@ function system_token_info() {
'name' => t("File ID"),
'description' => t("The unique ID of the uploaded file."),
);
$file['uid'] = array(
'name' => t("User ID"),
'description' => t("The unique ID of the user who owns the file."),
);
$file['name'] = array(
'name' => t("File name"),
'description' => t("The name of the file on disk."),
@ -237,10 +233,6 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
$replacements[$original] = $file->fid;
break;
case 'uid':
$replacements[$original] = $file->uid;
break;
// Essential file data
case 'name':
$replacements[$original] = $sanitize ? check_plain($file->filename) : $file->filename;