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

« back to all changes in this revision

Viewing changes to sites/all/modules/token/token.pages.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.pages.inc,v 1.7.2.5 2010/08/10 03:33:32 davereid Exp $
 
2
// $Id: token.pages.inc,v 1.7.2.7 2010/09/30 18:30:08 davereid Exp $
3
3
 
4
4
/**
5
5
 * @file
18
18
 * @param suffix
19
19
 *    The suffix your module will use when parsing tokens. Defaults to ']'
20
20
 * @return An HTML table containing the formatting docs.
 
21
 *
 
22
 * @ingroup themeable
21
23
 */
22
24
function theme_token_help($types = 'all', $prefix = TOKEN_PREFIX, $suffix = TOKEN_SUFFIX) {
23
25
  token_include();
41
43
 
42
44
/**
43
45
 * Provide a 'tree' display of nested tokens.
 
46
 *
 
47
 * @ingroup themeable
44
48
 */
45
49
function theme_token_tree($token_types = array(), $global_types = TRUE, $click_insert = TRUE) {
46
 
  //$info = token_get_list('all');
47
 
  $info = token_get_list($token_types);
48
 
 
49
 
  if ($token_types == 'all') {
50
 
  //  $token_types = array('all');
 
50
  if ($token_types == 'all' || !is_array($token_types) || in_array('all', $token_types)) {
 
51
    $token_types = array('all');
51
52
  }
52
53
  elseif ($global_types) {
53
 
  //  $token_types[] = 'global';
54
 
  //  $token_types = array_unique($token_types);
 
54
    $token_types[] = 'global';
55
55
  }
56
56
  else {
57
 
    unset($info['global']);
 
57
    $global_key = array_search('global', $token_types);
 
58
    if ($global_key !== FALSE) {
 
59
      unset($token_types[$global_key]);
 
60
    }
58
61
  }
59
62
 
60
63
  // Check for token type validity and sort.
 
64
  $token_types = array_unique($token_types);
 
65
  $info = token_get_list($token_types);
61
66
  //$token_types = array_intersect($token_types, array_keys($info));
62
67
  $token_types = array_keys($info);
63
68
  sort($token_types);
143
148
function _token_clean_css_identifier($id) {
144
149
  return 'token-' . str_replace(array('][', '_', ' ', ':'), '-', trim($id, '[]'));
145
150
}
 
151
 
 
152
/**
 
153
 * Menu callback; prints the available tokens and values for an object.
 
154
 */
 
155
function token_devel_token_object($entity, $object) {
 
156
  $tokens = token_get_values($entity, $object);
 
157
  $tokens = array_combine($tokens->tokens, $tokens->values);
 
158
  return kdevel_print_object($tokens);
 
159
}