当前位置: 首页>>代码示例>>PHP>>正文


PHP arr::c方法代码示例

本文整理汇总了PHP中arr::c方法的典型用法代码示例。如果您正苦于以下问题:PHP arr::c方法的具体用法?PHP arr::c怎么用?PHP arr::c使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arr的用法示例。


在下文中一共展示了arr::c方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trigger

 /**
  * Throws a new 404 exception.
  *
  * @throws  Eight_Exception_404
  * @return  void
  */
 public static function trigger($page = NULL)
 {
     // Silence 404 errors (as matched within the ignore array) and die quietly
     if (in_array(Router::$complete_uri, arr::c(Eight::config('core.ignore_page_not_found')))) {
         Eight::shutdown();
         exit;
     }
     throw new Eight_Exception_404($page);
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:15,代码来源:404.php

示例2: exists

 /**
  * Finds an array of files matching the given id or tag.
  *
  * @param  string  cache key or tag
  * @param  bool    search for tags
  * @return array   of filenames matching the id or tag
  */
 public function exists($keys, $tag = NO)
 {
     if ($keys === YES) {
         // Find all the files
         return glob($this->config['directory'] . '*~*~*');
     } elseif ($tag === YES) {
         // Find all the files that have the tag name
         $paths = array();
         foreach ((array) $keys as $tag) {
             $paths = array_merge($paths, glob($this->config['directory'] . '*~*' . $tag . '*~*'));
         }
         // Find all tags matching the given tag
         $files = array();
         foreach ($paths as $path) {
             // Split the files
             $tags = explode('~', basename($path));
             // Find valid tags
             if (count($tags) !== 3 or empty($tags[1])) {
                 continue;
             }
             // Split the tags by plus signs, used to separate tags
             $item_tags = explode('+', $tags[1]);
             // Check each supplied tag, and match aginst the tags on each item.
             foreach ($keys as $tag) {
                 if (in_array($tag, $item_tags)) {
                     // Add the file to the array, it has the requested tag
                     $files[] = $path;
                 }
             }
         }
         return $files;
     } else {
         $paths = array();
         foreach ((array) $keys as $key) {
             // Find the file matching the given key
             $paths = array_merge($paths, arr::c(glob($this->config['directory'] . str_replace(array('/', '\\', ' '), '_', $key) . '~*')));
         }
         return $paths;
     }
 }
开发者ID:shnhrrsn-abandoned,项目名称:EightPHP,代码行数:47,代码来源:file.php

示例3: has_role

 /**
  * Checks for the specified role
  *
  * @param   string		role to check for
  * @return  boolean		does the user have this role?
  */
 public function has_role($role)
 {
     if (!$this->loaded) {
         return false;
     }
     if (!is_array($this->roles) or $this->roles === NULL) {
         self::db()->use_master(YES);
         $rs = self::db()->join('user_roles AS ur', 'ur.user_role_role_id = r.role_id', 'LEFT')->where('ur.user_role_user_id', $this->id)->get('roles AS r')->result_array();
         foreach (arr::c($rs) as $r) {
             $this->roles[$r['role_id']] = $r['role_name'];
         }
         unset($r, $rs);
     }
     // After we loaded them...if we still have no roles
     if (!is_array($this->roles) or count($this->roles) == 0) {
         return false;
     }
     if (is_string($role) and !ctype_digit($role)) {
         return in_array($role, $this->roles);
     } else {
         return isset($this->roles[$role]);
     }
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:29,代码来源:authuser.php

示例4: __to_assoc

 public function __to_assoc()
 {
     $assoc = array();
     foreach (arr::c($this->data) as $key => $val) {
         $key = str_replace($this->column_prefix, "", $key);
         $assoc[$key] = $val;
     }
     return $assoc;
 }
开发者ID:shnhrrsn-abandoned,项目名称:EightPHP,代码行数:9,代码来源:modeler.php

示例5: show_404

 /**
  * Displays a 404 page, unless config says to ignore page not found.
  *
  * @param   string  URI of page
  * @param   string  custom template
  * @throws  Eight_Exception_404
  */
 public static function show_404($page = NO, $template = NO)
 {
     if (in_array($page, arr::c(Eight::config('core.ignore_page_not_found')))) {
         return FALSE;
     }
     throw new Eight_Exception_404($page, $template);
 }
开发者ID:shnhrrsn-abandoned,项目名称:EightPHP,代码行数:14,代码来源:eight.php

示例6: errors

 /**
  * Return the errors array.
  *
  * @param   boolean  load errors from a lang file
  * @return  array
  */
 public function errors($file = nil, $seperator = false)
 {
     if ($file === nil) {
         return $this->errors;
     } else {
         $errors = array();
         foreach ($this->errors as $input => $error) {
             // Key for this input error
             $key = "{$file}.{$input}.{$error}";
             if (($errors[$input] = Eight::lang($key)) === $key) {
                 // Get the default error message
                 $errors[$input] = Eight::lang("{$file}.{$input}.default");
             }
         }
         if (!$seperator) {
             return $errors;
         } else {
             $string = '';
             $seperator = is_bool($seperator) ? "<br />\n" : $seperator . "\n";
             foreach (arr::c($errors) as $error) {
                 $string .= $error . $seperator;
             }
             return $string;
         }
     }
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:32,代码来源:validation.php


注:本文中的arr::c方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。