/** * Get a permission token's ID by its name * @param string $name the name of the permission * @return int the permission's ID */ public static function token_id($name) { if (is_numeric($name)) { return intval($name); } $name = self::normalize_token($name); if ($token = array_search($name, ACL::cache_tokens())) { return $token; } return false; }
/** * Get a permission token's ID by its name * @param string $name the name of the permission * @return int the permission's ID **/ public static function token_id($name) { if (is_numeric($name)) { return intval($name); } $name = self::normalize_token($name); $tokens = array_flip(ACL::cache_tokens()); return isset($tokens[$name]) ? $tokens[$name] : false; }