1 path.inc path_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

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

File

core/modules/path/path.inc, line 632
Miscellaneous functions for Path module.

Code

function path_punctuation_chars() {
  global $language_content;
  $punctuation = &backdrop_static(__FUNCTION__);
  $cache_bin = cache();

  if (!isset($punctuation)) {
    $cid = 'path:punctuation:' . $language_content->langcode;
    if ($cache = $cache_bin->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.
      backdrop_alter('path_punctuation_chars', $punctuation);
      $cache_bin->set($cid, $punctuation);
    }
  }

  return $punctuation;
}