You are here

function auto_username_punctuation_chars in Automatic User Names 5

Same name and namespace in other branches
  1. 6 auto_username.module \auto_username_punctuation_chars()
  2. 7 auto_username.inc \auto_username_punctuation_chars()

Returns an array of arrays for punctuation values keyed by a name.

Including the value and a textual description Can and should be expanded to include "all" non text punctuation values

This method is ripped verbatim from pathauto, until this functionality can be pushed down into token.module.

2 calls to auto_username_punctuation_chars()
auto_username_cleanstring in ./auto_username.module
Clean up a string value to have only alphanumeric and separator values.
auto_username_configuration in ./auto_username.module

File

./auto_username.module, line 357

Code

function auto_username_punctuation_chars() {
  $punctuation = array();

  // Handle " ' , . - _ : ; | { { } ] + = * & % $ � # @ ! ~ ( ) ? < > \
  $punctuation['double_quotes'] = array(
    'value' => '"',
    'name' => t('Double quotes "'),
  );
  $punctuation['quotes'] = array(
    'value' => "'",
    'name' => t("Single quotes (apostrophe) '"),
  );
  $punctuation['backtick'] = array(
    'value' => "`",
    'name' => t("Back tick `"),
  );
  $punctuation['comma'] = array(
    'value' => ",",
    'name' => t('Comma ,'),
  );
  $punctuation['period'] = array(
    'value' => ".",
    'name' => t('Period .'),
  );
  $punctuation['hyphen'] = array(
    'value' => "-",
    'name' => t('Hyphen -'),
  );
  $punctuation['underscore'] = array(
    'value' => "_",
    'name' => t('Underscore _'),
  );
  $punctuation['colon'] = array(
    'value' => ":",
    'name' => t('Colon :'),
  );
  $punctuation['semicolon'] = array(
    'value' => ";",
    'name' => t('Semicolon ;'),
  );
  $punctuation['pipe'] = array(
    'value' => "|",
    'name' => t('Pipe |'),
  );
  $punctuation['left_curly'] = array(
    'value' => "{",
    'name' => t('Left curly bracket {'),
  );
  $punctuation['left_square'] = array(
    'value' => "[",
    'name' => t('Left square bracket ['),
  );
  $punctuation['right_curly'] = array(
    'value' => "}",
    'name' => t('Right curly bracket }'),
  );
  $punctuation['right_square'] = array(
    'value' => "]",
    'name' => t('Right square bracket ]'),
  );
  $punctuation['plus'] = array(
    'value' => "+",
    'name' => t('Plus +'),
  );
  $punctuation['equal'] = array(
    'value' => "=",
    'name' => t('Equal ='),
  );
  $punctuation['asterisk'] = array(
    'value' => "*",
    'name' => t('Asterisk *'),
  );
  $punctuation['ampersand'] = array(
    'value' => "&",
    'name' => t('Ampersand &'),
  );
  $punctuation['percent'] = array(
    'value' => "%",
    'name' => t('Percent %'),
  );
  $punctuation['caret'] = array(
    'value' => "^",
    'name' => t('Caret ^'),
  );
  $punctuation['dollar'] = array(
    'value' => "\$",
    'name' => t('Dollar $'),
  );
  $punctuation['hash'] = array(
    'value' => "#",
    'name' => t('Hash #'),
  );
  $punctuation['at'] = array(
    'value' => "@",
    'name' => t('At @'),
  );
  $punctuation['exclamation'] = array(
    'value' => "!",
    'name' => t('Exclamation !'),
  );
  $punctuation['tilde'] = array(
    'value' => "~",
    'name' => t('Tilde ~'),
  );
  $punctuation['left_parenthesis'] = array(
    'value' => "(",
    'name' => t('Left parenthesis ('),
  );
  $punctuation['right_parenthesis'] = array(
    'value' => ")",
    'name' => t('right parenthesis )'),
  );
  $punctuation['question_mark'] = array(
    'value' => "?",
    'name' => t('Question mark ?'),
  );
  $punctuation['less_than'] = array(
    'value' => "<",
    'name' => t('Less than <'),
  );
  $punctuation['greater_than'] = array(
    'value' => ">",
    'name' => t('Greater than >'),
  );
  $punctuation['back_slash'] = array(
    'value' => '\\',
    'name' => t('Back slash \\'),
  );
  return $punctuation;
}