PHP 22
Token.install Guest on 23rd September 2020 06:01:07 PM
  1. <?php
  2.  
  3. /**
  4.  * @file
  5.  * The install and update code for the token module.
  6.  *
  7.  * @ingroup token
  8.  */
  9.  
  10. /**
  11.  * Implements hook_requirements().
  12.  */
  13. function token_requirements($phase = 'runtime') {
  14.   $requirements = array();
  15.   $t = get_t();
  16.  
  17.   // Check for duplicate tokens.
  18.   if ($phase == 'runtime') {
  19.     if ($duplicate_tokens = token_find_duplicate_tokens()) {
  20.       foreach ($duplicate_tokens as $token => $modules) {
  21.         $duplicate_tokens[$token] = $t('@token (defined by modules: @modules)', array('@token' => $token, '@modules' => implode(', ', $modules)));
  22.       }
  23.       $requirements['token_duplicates'] = array(
  24.         'title' => $t('Duplicate tokens'),
  25.         'value' => $t('The following tokens are defined by multiple modules and may cause problems when performing token replacement.'),
  26.         'severity' => REQUIREMENT_WARNING,
  27.         'description' => theme('item_list', $duplicate_tokens),
  28.       );
  29.     }
  30.   }
  31.  
  32.   return $requirements;
  33. }
  34.  
  35. function token_install() {
  36.   db_query("UPDATE {system} SET weight = 10 WHERE name = 'token'");
  37. }
  38.  
  39. function token_update_1() {
  40.   $ret = array();
  41.   $ret[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'token'");
  42.   return $ret;
  43. }
  44. ?>

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.