'pattern1', ...). * @link http://en.wikipedia.org/wiki/Personal_name#Naming_convention */ function &_get_name_conventions() { static $conventions; if (!isset($conventions)) { $file = dirname(__FILE__) . '/internationalization_database/name_order_conventions.php'; if (file_exists($file)) { $conventions = include ($file); } else { $conventions = array('english' => 'first_name last_name'); } $search = array('first_name', 'last_name'); $replacement = array('%f', '%l'); foreach ($conventions as $key => &$value) { $value = str_ireplace($search, $replacement, $value); } } return $conventions; } /** * Checks whether the input namin convention (a pattern) is valid or not. * @param string $convention The input convention to be verified. * @return bool Returns TRUE if the pattern is valid, FALSE othewise. */ function _api_is_valid_name_convention($convention) { static $cache = array(); if (!isset($cache[$convention])) { $cache[$convention] = !empty($convention) && strpos($convention, '%f') !== false && strpos($convention, '%l') !== false; } return $cache[$convention]; }