コード例 #1
0
ファイル: acl.php プロジェクト: wwxgitcat/habari
 /**
  * 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;
 }
コード例 #2
0
ファイル: acl.php プロジェクト: anupom/my-blog
 /**
  * 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;
 }