Commit 7bb6753e authored by webchick's avatar webchick

#701818 by mcarbone: Test coverage of every core token, and bug fixes to make...

#701818 by mcarbone: Test coverage of every core token, and bug fixes to make them work. AWESOME! :D
parent 8e94b5d6
......@@ -1263,3 +1263,103 @@ class CommentContentRebuild extends CommentHelperCase {
$this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.'));
}
}
/**
* Test comment token replacement in strings.
*/
class CommentTokenReplaceTestCase extends CommentHelperCase {
public static function getInfo() {
return array(
'name' => 'Comment token replacement',
'description' => 'Generates text using placeholders for dummy content to check comment token replacement.',
'group' => 'Comment',
);
}
/**
* Creates a comment, then tests the tokens generated from it.
*/
function testCommentTokenReplacement() {
global $language;
$url_options = array(
'absolute' => TRUE,
'language' => $language,
);
$this->drupalLogin($this->admin_user);
// Set comment variables.
$this->setCommentSubject(TRUE);
// Create a node and a comment.
$node = $this->drupalCreateNode(array('type' => 'article'));
$parent_comment = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
// Post a reply to the comment.
$this->drupalGet('comment/reply/' . $node->nid . '/' . $parent_comment->id);
$child_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
$comment = comment_load($child_comment->id);
$comment->homepage = 'http://example.org/';
// Add HTML to ensure that sanitation of some fields tested directly.
$comment->subject = '<blink>Blinking Comment</blink>';
$instance = field_info_instance('comment', 'body', 'comment_body');
// 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);
$tests['[comment:homepage]'] = filter_xss_bad_protocol($comment->homepage);
$tests['[comment:title]'] = filter_xss($comment->subject);
$tests['[comment:body]'] = _text_sanitize($instance, LANGUAGE_NONE, $comment->comment_body[LANGUAGE_NONE][0], 'value');
$tests['[comment:url]'] = url('comment/' . $comment->cid, $url_options + array('fragment' => 'comment-' . $comment->cid));
$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:title]'] = check_plain($parent_comment->subject);
$tests['[comment:node:title]'] = check_plain($node->title);
$tests['[comment:author:name]'] = check_plain($this->admin_user->name);
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Sanitized comment token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
$tests['[comment:hostname]'] = $comment->hostname;
$tests['[comment:name]'] = $comment->name;
$tests['[comment:mail]'] = $this->admin_user->mail;
$tests['[comment:homepage]'] = $comment->homepage;
$tests['[comment:title]'] = $comment->subject;
$tests['[comment:body]'] = $comment->comment_body[LANGUAGE_NONE][0]['value'];
$tests['[comment:parent:title]'] = $parent_comment->subject;
$tests['[comment:node:title]'] = $node->title;
$tests['[comment:author:name]'] = $this->admin_user->name;
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE));
$this->assertFalse(strcmp($output, $expected), t('Unsanitized comment token %token replaced.', array('%token' => $input)));
}
// Load node so comment_count gets computed.
$node = node_load($node->nid);
// Generate comment tokens for the node (it has 2 comments, both new).
$tests = array();
$tests['[node:comment-count]'] = 2;
$tests['[node:comment-count-new]'] = 2;
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Node comment token %token replaced.', array('%token' => $input)));
}
}
}
......@@ -82,6 +82,11 @@ function comment_token_info() {
'description' => t("The date the comment was posted."),
'type' => 'date',
);
$comment['changed'] = array(
'name' => t("Date changed"),
'description' => t("The date the comment was most recently updated."),
'type' => 'date',
);
$comment['parent'] = array(
'name' => t("Parent"),
'description' => t("The comment's parent, if comment threading is active."),
......@@ -133,6 +138,10 @@ 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;
......@@ -141,10 +150,6 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements[$original] = $comment->uid;
break;
case 'pid':
$replacements[$original] = $comment->pid;
break;
// Poster identity information for comments
case 'hostname':
$replacements[$original] = $sanitize ? check_plain($comment->hostname) : $comment->hostname;
......@@ -175,7 +180,9 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
break;
case 'body':
$replacements[$original] = $sanitize ? check_markup($comment->comment, $comment->format, '', TRUE) : $comment->comment;
$item = $comment->comment_body[LANGUAGE_NONE][0];
$instance = field_info_instance('comment', 'body', 'comment_body');
$replacements[$original] = $sanitize ? _text_sanitize($instance, LANGUAGE_NONE, $item, 'value') : $item['value'];
break;
// Comment related URLs.
......@@ -185,6 +192,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
break;
case 'edit-url':
$url_options['fragment'] = NULL;
$replacements[$original] = url('comment/' . $comment->cid . '/edit', $url_options);
break;
......@@ -226,6 +234,10 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements += token_generate('date', $date_tokens, array('date' => $comment->created), $options);
}
if ($date_tokens = token_find_with_prefix($tokens, 'changed')) {
$replacements += token_generate('date', $date_tokens, array('date' => $comment->changed), $options);
}
if (($parent_tokens = token_find_with_prefix($tokens, 'parent')) && $parent = comment_load($comment->pid)) {
$replacements += token_generate('comment', $parent_tokens, array('comment' => $parent), $options);
}
......
......@@ -568,3 +568,79 @@ class FileFieldPathTestCase extends FileFieldTestCase {
$this->assertTrue($result, $message);
}
}
/**
* Test file token replacement in strings.
*/
class FileTokenReplaceTestCase extends FileFieldTestCase {
public static function getInfo() {
return array(
'name' => 'File token replacement',
'description' => 'Generates text using placeholders for dummy content to check file token replacement.',
'group' => 'File',
);
}
/**
* Creates a file, then tests the tokens generated from it.
*/
function testFileTokenReplacement() {
global $language;
$url_options = array(
'absolute' => TRUE,
'language' => $language,
);
// Create file field.
$type_name = 'article';
$field_name = 'field_' . strtolower($this->randomName());
$this->createFileField($field_name, $type_name);
$field = field_info_field($field_name);
$instance = field_info_instance('node', $field_name, $type_name);
$test_file = $this->getTestFile('text');
// Create a new node with the uploaded file.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
// Load the node and the file.
$node = node_load($nid);
$file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$file->description = 'File description.';
// 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);
$tests['[file:mime]'] = filter_xss($file->filemime);
$tests['[file:size]'] = format_size($file->filesize);
$tests['[file:url]'] = url(file_create_url($file->uri), $url_options);
$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;
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Sanitized file token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
$tests['[file:name]'] = $file->filename;
$tests['[file:description]'] = $file->description;
$tests['[file:path]'] = $file->uri;
$tests['[file:mime]'] = $file->filemime;
$tests['[file:size]'] = format_size($file->filesize);
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language, 'sanitize' => FALSE));
$this->assertFalse(strcmp($output, $expected), t('Unsanitized file token %token replaced.', array('%token' => $input)));
}
}
}
......@@ -1666,3 +1666,79 @@ class NodeQueryAlter extends DrupalWebTestCase {
}
}
}
/**
* Test node token replacement in strings.
*/
class NodeTokenReplaceTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Node token replacement',
'description' => 'Generates text using placeholders for dummy content to check node token replacement.',
'group' => 'Node',
);
}
/**
* Creates a node, then tests the tokens generated from it.
*/
function testNodeTokenReplacement() {
global $language;
$url_options = array(
'absolute' => TRUE,
'language' => $language,
);
// Create a user and a node.
$account = $this->drupalCreateUser();
$settings = array(
'type' => 'article',
'uid' => $account->uid,
'title' => '<blink>Blinking Text</blink>',
'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(32), 'summary' => $this->randomName(16)))),
);
$node = $this->drupalCreateNode($settings);
// Load node so that the body and summary fields are structured properly.
$node = node_load($node->nid);
$instance = field_info_instance('node', 'body', $node->type);
// Generate and test sanitized tokens.
$tests = array();
$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);
$tests['[node:body]'] = _text_sanitize($instance, $node->language, $node->body[$node->language][0], 'value');
$tests['[node:summary]'] = _text_sanitize($instance, $node->language, $node->body[$node->language][0], 'summary');
$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: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);
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Sanitized node token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
$tests['[node:title]'] = $node->title;
$tests['[node:body]'] = $node->body[$node->language][0]['value'];
$tests['[node:summary]'] = $node->body[$node->language][0]['summary'];
$tests['[node:language]'] = $node->language;
$tests['[node:author:name]'] = $account->name;
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language, 'sanitize' => FALSE));
$this->assertFalse(strcmp($output, $expected), t('Unsanitized node token %token replaced.', array('%token' => $input)));
}
}
}
......@@ -129,8 +129,13 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
$replacements[$original] = $node->uid;
break;
case 'name':
$replacements[$original] = $sanitize ? check_plain($node->name) : $node->name;
case 'type':
$replacements[$original] = $sanitize ? check_plain($node->type) : $node->type;
break;
case 'type-name':
$type_name = node_type_get_name($node);
$replacements[$original] = $sanitize ? check_plain($type_name) : $type_name;
break;
case 'title':
......@@ -147,15 +152,6 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
}
break;
case 'type':
$replacements[$original] = $sanitize ? check_plain($node->type) : $node->type;
break;
case 'type-name':
$type_name = node_type_get_name($node);
$replacements[$original] = $sanitize ? check_plain($type_name) : $type_name;
break;
case 'language':
$replacements[$original] = $sanitize ? check_plain($node->language) : $node->language;
break;
......
......@@ -457,3 +457,92 @@ class PollVoteCheckHostname extends PollTestCase {
$this->assertTrue(empty($elements), t("%user is not able to vote again.", array('%user' => $this->web_user1->name)));
}
}
/**
* Test poll token replacement in strings.
*/
class PollTokenReplaceTestCase extends PollTestCase {
public static function getInfo() {
return array(
'name' => 'Poll token replacement',
'description' => 'Generates text using placeholders for dummy content to check poll token replacement.',
'group' => 'Poll',
);
}
function setUp() {
parent::setUp('poll');
}
/**
* Creates a poll, then tests the tokens generated from it.
*/
function testPollTokenReplacement() {
global $language;
// Craete a poll with three choices.
$title = $this->randomName();
$choices = $this->_generateChoices(3);
$poll_nid = $this->pollCreate($title, $choices, FALSE);
$this->drupalLogout();
// Create four users and have each of them vote.
$vote_user1 = $this->drupalCreateUser(array('vote on polls', 'access content'));
$this->drupalLogin($vote_user1);
$edit = array(
'choice' => '1',
);
$this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
$this->drupalLogout();
$vote_user2 = $this->drupalCreateUser(array('vote on polls', 'access content'));
$this->drupalLogin($vote_user2);
$edit = array(
'choice' => '1',
);
$this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
$this->drupalLogout();
$vote_user3 = $this->drupalCreateUser(array('vote on polls', 'access content'));
$this->drupalLogin($vote_user3);
$edit = array(
'choice' => '2',
);
$this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
$this->drupalLogout();
$vote_user4 = $this->drupalCreateUser(array('vote on polls', 'access content'));
$this->drupalLogin($vote_user4);
$edit = array(
'choice' => '3',
);
$this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
$this->drupalLogout();
$poll = node_load($poll_nid, NULL, TRUE);
// Generate and test sanitized tokens.
$tests = array();
$tests['[node:poll-votes]'] = 4;
$tests['[node:poll-winner]'] = filter_xss($poll->choice[1]['chtext']);
$tests['[node:poll-winner-votes]'] = 2;
$tests['[node:poll-winner-percent]'] = 50;
$tests['[node:poll-duration]'] = format_interval($poll->runtime, 1, $language->language);
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $poll), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Sanitized poll token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
$tests['[node:poll-winner]'] = $poll->choice[1]['chtext'];
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $poll), array('language' => $language, 'sanitize' => FALSE));
$this->assertFalse(strcmp($output, $expected), t('Unsanitized poll token %token replaced.', array('%token' => $input)));
}
}
}
......@@ -41,6 +41,14 @@ function poll_token_info() {
*/
function poll_tokens($type, $tokens, array $data = array(), array $options = array()) {
$sanitize = !empty($options['sanitize']);
if (isset($options['language'])) {
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
}
else {
$language_code = NULL;
}
$replacements = array();
if ($type == 'node' && !empty($data['node']) && $data['node']->type == 'poll') {
......@@ -65,12 +73,18 @@ function poll_tokens($type, $tokens, array $data = array(), array $options = arr
if (isset($winner)) {
$replacements[$original] = $sanitize ? filter_xss($winner['chtext']) : $winner['chtext'];
}
else {
$replacements[$original] = '';
}
break;
case 'poll-winner-votes':
if (isset($winner)) {
$replacements[$original] = $winner['chvotes'];
}
else {
$replacements[$original] = '';
}
break;
case 'poll-winner-percent':
......@@ -78,6 +92,9 @@ function poll_tokens($type, $tokens, array $data = array(), array $options = arr
$percent = ($winner['chvotes'] / $total_votes) * 100;
$replacements[$original] = number_format($percent, 0);
}
else {
$replacements[$original] = '';
}
break;
case 'poll-duration':
......
......@@ -312,3 +312,47 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
$this->assertFalse($result, t('Daycounter is zero.'));
}
}
/**
* Test statistics token replacement in strings.
*/
class StatisticsTokenReplaceTestCase extends StatisticsTestCase {
public static function getInfo() {
return array(
'name' => 'Statistics token replacement',
'description' => 'Generates text using placeholders for dummy content to check statistics token replacement.',
'group' => 'Statistics',
);
}
/**
* Creates a node, then tests the statistics tokens generated from it.
*/
function testStatisticsTokenReplacement() {
global $language;
// Create user and node.
$user = $this->drupalCreateUser(array('create page content'));
$this->drupalLogin($user);
$node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->uid));
// Hit the node.
$this->drupalGet('node/' . $node->nid);
$statistics = statistics_get($node->nid);
// Generate and test tokens.
$tests = array();
$tests['[node:total-count]'] = 1;
$tests['[node:day-count]'] = 1;
$tests['[node:last-view]'] = format_date($statistics['timestamp']);
$tests['[node:last-view:short]'] = format_date($statistics['timestamp'], 'short');
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Statistics token %token replaced.', array('%token' => $input)));
}
}
}
......@@ -10,11 +10,11 @@
* Implements hook_token_info().
*/
function statistics_token_info() {
$node['views'] = array(
$node['total-count'] = array(
'name' => t("Number of views"),
'description' => t("The number of visitors who have read the node."),
);
$node['day-views'] = array(
$node['day-count'] = array(
'name' => t("Views today"),
'description' => t("The number of visitors who have read the node today."),
);
......@@ -40,13 +40,13 @@ function statistics_tokens($type, $tokens, array $data = array(), array $options
$node = $data['node'];
foreach ($tokens as $name => $original) {
if ($name == 'views') {
if ($name == 'total-count') {
$statistics = statistics_get($node->nid);
$replacements[$original] = $statistics['totalviews'];
$replacements[$original] = $statistics['totalcount'];
}
elseif ($name == 'views-today') {
elseif ($name == 'day-count') {
$statistics = statistics_get($node->nid);
$replacements[$original] = $statistics['dayviews'];
$replacements[$original] = $statistics['daycount'];
}
elseif ($name == 'last-view') {
$statistics = statistics_get($node->nid);
......
......@@ -1490,6 +1490,77 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
$this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('Unsanitized token generated properly.'));
}
/**
* Tests the generation of all system site information tokens.
*/
function testSystemSiteTokenReplacement() {
global $language;
$url_options = array(
'absolute' => TRUE,
'language' => $language,
);
// Set a few site variables.
variable_set('site_name', '<strong>Drupal<strong>');
variable_set('site_slogan', '<blink>Slogan</blink>');
variable_set('site_mission', '<em>Mission</em>');
// Generate and test sanitized tokens.
$tests = array();
$tests['[site:name]'] = check_plain(variable_get('site_name', 'Drupal'));
$tests['[site:slogan]'] = check_plain(variable_get('site_slogan', ''));
$tests['[site:mission]'] = filter_xss(variable_get('site_mission', ''));
$tests['[site:mail]'] = 'simpletest@example.com';
$tests['[site:url]'] = url('<front>', $url_options);
$tests['[site:url-brief]'] = preg_replace('!^https?://!', '', url('<front>', $url_options));
$tests['[site:login-url]'] = url('user', $url_options);
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array(), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Sanitized system site information token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
$tests['[site:name]'] = variable_get('site_name', 'Drupal');
$tests['[site:slogan]'] = variable_get('site_slogan', '');
$tests['[site:mission]'] = variable_get('site_mission', '');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array(), array('language' => $language, 'sanitize' => FALSE));
$this->assertFalse(strcmp($output, $expected), t('Unsanitized system site information token %token replaced.', array('%token' => $input)));
}
}
/**
* Tests the generation of all system date tokens.
*/
function testSystemDateTokenReplacement() {
global $language;
// Set time to one hour before request.
$date = REQUEST_TIME - 3600;
// Generate and test tokens.
$tests = array();
$tests['[date:short]'] = format_date($date, 'short', '', NULL, $language->language);
$tests['[date:medium]'] = format_date($date, 'medium', '', NULL, $language->language);
$tests['[date:long]'] = format_date($date, 'long', '', NULL, $language->language);
$tests['[date:custom:m/j/Y]'] = format_date($date, 'custom', 'm/j/Y', NULL, $language->language);
$tests['[date:since]'] = format_interval((REQUEST_TIME - $date), 2, $language->language);
$tests['[date:raw]'] = filter_xss($date);
// 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.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('date' => $date), array('language' => $language));
$this->assertFalse(strcmp($output, $expected), t('Date token %token replaced.', array('%token' => $input)));
}
}
}
class InfoFileParserTestCase extends DrupalUnitTestCase {
......
......@@ -76,7 +76,7 @@ function system_token_info() {
);
$date['since'] = array(
'name' => t("Time-since"),
'description' => t("A data in 'time-since' format. (%date)", array('%date' => format_interval(REQUEST_TIME - 360, 2))),
'description' => t("A date in 'time-since' format. (%date)", array('%date' => format_interval(REQUEST_TIME - 360, 2))),
);
$date['raw'] = array(
'name' => t("Raw timestamp"),
......@@ -93,10 +93,6 @@ function system_token_info() {
'name' => t("User ID"),
'description' => t("The unique ID of the user who owns the file."),
);
$file['nid'] = array(
'name' => t("Node ID"),
'description' => t("The unique ID of the node the file is attached to."),
);
$file['name'] = array(
'name' => t("File name"),
'description' => t("The name of the file on disk."),
......@@ -107,7 +103,7 @@ function system_token_info() {
);
$file['path'] = array(
'name' => t("Path"),
'description' => t("The location of the file on disk."),
'description' => t("The location of the file relative to Drupal root."),
);
$file['mime'] = array(
'name' => t("MIME type"),
......@@ -117,7 +113,7 @@ function system_token_info() {
'name' => t("File size"),
'description' => t("The size of the file, in kilobytes."),
);