token_scan

function token_scan

token_scan($text)

Builds a list of all token-like patterns that appear in the text.

Parameters

$text: The text to be scanned for possible tokens.

Return value

An associative array of discovered tokens, grouped by type.

File

includes/token.inc, line 114
Drupal placeholder/token replacement system.

Code

function token_scan($text) {
  // Matches tokens with the following pattern: [$type:$name]
  // $type and $name may not contain  [ ] characters.
  // $type may not contain : or whitespace characters, but $name may.
  preg_match_all('/
    \[             # [ - pattern start
    ([^\s\[\]:]*)  # match $type not containing whitespace : [ or ]
    :              # : - separator
    ([^\[\]]*)     # match $name not