~ubuntu-fr/ubuntu-fr-website/www.dev

« back to all changes in this revision

Viewing changes to sites/all/modules/token/token_user.inc

  • Committer: Vincent Liefooghe
  • Date: 2010-11-16 20:51:54 UTC
  • Revision ID: vl@ubuntovo-20101116205154-fuyfka524rm2zgni
Mise à jour des modules Backup & Migrate, Image API, Token et Pathauto

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
// $Id: token_user.inc,v 1.3.4.10 2010/08/10 04:01:05 davereid Exp $
 
2
// $Id: token_user.inc,v 1.3.4.11 2010/09/19 21:39:14 davereid Exp $
3
3
 
4
4
/**
5
5
 * @file
15
15
 */
16
16
 
17
17
/**
 
18
 * Implementation of hook_token_list().
 
19
 */
 
20
function user_token_list($type = 'all') {
 
21
  if ($type == 'user' || $type == 'all') {
 
22
    $tokens['user']['user']     = t("The login name of the user account.");
 
23
    $tokens['user']['user-raw'] = t("The login name of the user account.");
 
24
    $tokens['user']['uid']      = t("The unique ID of the user account.");
 
25
    $tokens['user']['mail']     = t("The email address of the user account.");
 
26
 
 
27
    $tokens['user'] += token_get_date_token_info(t("User's registration"), 'user-created-');
 
28
    $tokens['user'] += token_get_date_token_info(t("User's last login"), 'user-last-login-');
 
29
    $tokens['user']['date-in-tz'] = t("The current date in the user's timezone.");
 
30
 
 
31
    $tokens['user']['account-url']      = t("The URL of the account profile page.");
 
32
    $tokens['user']['account-edit-url'] = t("The URL of the account edit page.");
 
33
 
 
34
    return $tokens;
 
35
  }
 
36
}
 
37
 
 
38
/**
18
39
 * Implementation of hook_token_values().
19
40
 */
20
41
function user_token_values($type, $object = NULL, $options = array()) {
34
55
        $account->name = variable_get('anonymous', 'Anonymous');
35
56
      }
36
57
 
37
 
      $values['user']           = check_plain($account->name);
38
 
      $values['user-raw']       = $account->name;
39
 
      $values['uid']            = $account->uid;
40
 
      $values['mail']           = $account->uid ? $account->mail : '';
41
 
      $values['date-in-tz']     = $account->uid ? format_date(time(), 'small', '', $account->timezone) : '';
42
 
      $values['account-url']    = $account->uid ? url("user/$account->uid", array('absolute' => TRUE)) : '';
43
 
      $values['account-edit']   = $account->uid ? url("user/$account->uid/edit", array('absolute' => TRUE)) : '';
 
58
      $values['user']     = check_plain($account->name);
 
59
      $values['user-raw'] = $account->name;
 
60
      $values['uid']      = $account->uid;
 
61
      $values['mail']     = $account->uid ? $account->mail : '';
44
62
 
45
63
      if ($account->uid) {
46
64
        $values += token_get_date_token_values($account->created, 'user-created-');
49
67
        $values['reg-since'] = $values['user-created-since'];
50
68
        $values['log-date'] = $values['user-last-login-small'];
51
69
        $values['log-since'] = $values['user-last-login-since'];
 
70
        $values['date-in-tz'] = $account->uid ? format_date(time(), 'small', '', $account->timezone) : '';
52
71
      }
53
72
 
 
73
      $values['account-url']      = $account->uid ? url("user/$account->uid", array('absolute' => TRUE)) : '';
 
74
      $values['account-edit-url'] = $account->uid ? url("user/$account->uid/edit", array('absolute' => TRUE)) : '';
 
75
      $values['account-edit']     = $values['account-edit-url'];
 
76
 
54
77
      break;
55
78
  }
56
79
  return $values;
57
80
}
58
 
 
59
 
/**
60
 
 * Implementation of hook_token_list().
61
 
 */
62
 
function user_token_list($type = 'all') {
63
 
  if ($type == 'user' || $type == 'all') {
64
 
    $tokens['user']['user']           = t("The login name of the user account.");
65
 
    $tokens['user']['user-raw']       = t("The login name of the user account.");
66
 
 
67
 
    $tokens['user']['uid']            = t("The unique ID of the user account.");
68
 
    $tokens['user']['mail']           = t("The email address of the user account.");
69
 
 
70
 
    $tokens['user'] += token_get_date_token_info(t("User's registration"), 'user-created-');
71
 
    $tokens['user'] += token_get_date_token_info(t("User's last login"), 'user-last-login-');
72
 
    $tokens['user']['date-in-tz']     = t("The current date in the user's timezone.");
73
 
    $tokens['user']['account-url']    = t("The URL of the account profile page.");
74
 
    $tokens['user']['account-edit']   = t("The URL of the account edit page.");
75
 
 
76
 
    return $tokens;
77
 
  }
78
 
}