You are here

function pathauto_punctuation_chars in Pathauto 6.2

Same name and namespace in other branches
  1. 5.2 pathauto.inc \pathauto_punctuation_chars()
  2. 6 pathauto.inc \pathauto_punctuation_chars()
  3. 7 pathauto.inc \pathauto_punctuation_chars()

Return an array of arrays for punctuation values.

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.

Return value

An array of arrays for punctuation values keyed by a name, including the value and a textual description.

3 calls to pathauto_punctuation_chars()
pathauto_cleanstring in ./pathauto.inc
Clean up a string segment to be used in an URL alias.
pathauto_settings_form in ./pathauto.admin.inc
Form builder; Configure the Pathauto settings.
pathauto_settings_form_validate in ./pathauto.admin.inc
Validate pathauto_settings_form form submissions.

File

./pathauto.inc, line 796
Miscellaneous functions for Pathauto.

Code

function pathauto_punctuation_chars() {
  $punctuation =& pathauto_static(__FUNCTION__);
  if (!isset($punctuation)) {
    $cid = 'pathauto:punctuation:' . $GLOBALS['language']->language;
    if ($cache = cache_get($cid)) {
      $punctuation = $cache->data;
    }
    else {
      $punctuation = array();
      $punctuation['double_quotes'] = array(
        'value' => '"',
        'name' => t('Double quotation marks'),
      );
      $punctuation['quotes'] = array(
        'value' => '\'',
        'name' => t("Single quotation marks (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('Vertical bar (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 sign'),
      );
      $punctuation['equal'] = array(
        'value' => '=',
        'name' => t('Equal sign'),
      );
      $punctuation['asterisk'] = array(
        'value' => '*',
        'name' => t('Asterisk'),
      );
      $punctuation['ampersand'] = array(
        'value' => '&',
        'name' => t('Ampersand'),
      );
      $punctuation['percent'] = array(
        'value' => '%',
        'name' => t('Percent sign'),
      );
      $punctuation['caret'] = array(
        'value' => '^',
        'name' => t('Caret'),
      );
      $punctuation['dollar'] = array(
        'value' => '$',
        'name' => t('Dollar sign'),
      );
      $punctuation['hash'] = array(
        'value' => '#',
        'name' => t('Number sign (pound sign, hash)'),
      );
      $punctuation['at'] = array(
        'value' => '@',
        'name' => t('At sign'),
      );
      $punctuation['exclamation'] = array(
        'value' => '!',
        'name' => t('Exclamation mark'),
      );
      $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 sign'),
      );
      $punctuation['greater_than'] = array(
        'value' => '>',
        'name' => t('Greater-than sign'),
      );
      $punctuation['slash'] = array(
        'value' => '/',
        'name' => t('Slash'),
      );
      $punctuation['back_slash'] = array(
        'value' => '\\',
        'name' => t('Backslash'),
      );

      // Allow modules to alter the punctuation list and cache the result.
      drupal_alter('pathauto_punctuation_chars', $punctuation);
      cache_set($cid, $punctuation);
    }
  }
  return $punctuation;
}