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


PHP Kohana::_files_changed方法代码示例

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


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

示例1: find_file

 /**
  * Searches for a file in the [Cascading Filesystem](kohana/files), and
  * returns the path to the file that has the highest precedence, so that it
  * can be included.
  *
  * When searching the "config", "messages", or "i18n" directories, or when
  * the `$array` flag is set to true, an array of all the files that match
  * that path in the [Cascading Filesystem](kohana/files) will be returned.
  * These files will return arrays which must be merged together.
  *
  * If no extension is given, the default extension (`EXT` set in
  * `index.php`) will be used.
  *
  *     // Returns an absolute path to views/template.php
  *     Kohana::find_file('views', 'template');
  *
  *     // Returns an absolute path to media/css/style.css
  *     Kohana::find_file('media', 'css/style', 'css');
  *
  *     // Returns an array of all the "mimes" configuration files
  *     Kohana::find_file('config', 'mimes');
  *
  * @param   string  $dir    directory name (views, i18n, classes, extensions, etc.)
  * @param   string  $file   filename with subdirectory
  * @param   string  $ext    extension to search for
  * @param   boolean $array  return an array of files?
  * @param   string  $theme  theme name or defaults to active
  * @return  array   a list of files when $array is TRUE
  * @return  string  single file path
  */
 public static function find_file($dir, $file, $ext = NULL, $array = FALSE, $theme = NULL)
 {
     if ($ext === NULL) {
         // Use the default extension
         $ext = EXT;
     } elseif ($ext) {
         // Prefix the extension with a period
         $ext = ".{$ext}";
     } else {
         // Use no extension
         $ext = '';
     }
     //theme class may not be available during initial init phase
     if ($theme === NULL and class_exists('Theme')) {
         // Use the active theme
         $theme = Theme::$active;
     }
     // Create a partial path of the filename
     $path = $dir . DS . $file . $ext;
     if (Kohana::$caching === TRUE and isset(Kohana::$_files[$path . ($array ? '_array' : '_path')][$theme])) {
         // This path has been cached
         return Kohana::$_files[$path . ($array ? '_array' : '_path')][$theme];
     }
     if (Kohana::$profiling === TRUE and class_exists('Profiler', FALSE)) {
         // Start a new benchmark
         $benchmark = Profiler::start('Kohana', __FUNCTION__);
     }
     if ($array or $dir === 'config' or $dir === 'i18n' or $dir === 'messages') {
         // Include paths must be searched in reverse
         $paths = array_reverse(Kohana::$_paths);
         // Array of files that have been found
         $found = array();
         foreach ($paths as $dir) {
             if (is_file($dir . $path)) {
                 // This path has a file, add it to the list
                 $found[] = $dir . $path;
             }
         }
     } else {
         // The file has not been found yet
         $found = FALSE;
         foreach (Kohana::$_paths as $dir) {
             if (is_file($dir . $path)) {
                 // A path has been found
                 $found = $dir . $path;
                 // Stop searching
                 break;
             }
         }
     }
     if (Kohana::$caching === TRUE) {
         // Add the path to the cache
         Kohana::$_files[$path . ($array ? '_array' : '_path')][$theme] = $found;
         // Files have been changed
         Kohana::$_files_changed = TRUE;
     }
     if (isset($benchmark)) {
         // Stop the benchmark
         Profiler::stop($benchmark);
     }
     return $found;
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:92,代码来源:kohana.php

示例2: find_file

 /**
  * Finds the path of a file by directory, filename, and extension.
  * If no extension is given, the default EXT extension will be used.
  *
  * When searching the "config" or "i18n" directories, or when the
  * $aggregate_files flag is set to true, an array of files
  * will be returned. These files will return arrays which must be
  * merged together.
  *
  *     // Returns an absolute path to views/template.php
  *     Kohana::find_file('views', 'template');
  *
  *     // Returns an absolute path to media/css/style.css
  *     Kohana::find_file('media', 'css/style', 'css');
  *
  *     // Returns an array of all the "mimes" configuration file
  *     Kohana::find_file('config', 'mimes');
  *
  * @param   string   directory name (views, i18n, classes, extensions, etc.)
  * @param   string   filename with subdirectory
  * @param   string   extension to search for
  * @param   boolean  return an array of files?
  * @return  array    a list of files when $array is TRUE
  * @return  string   single file path
  */
 public static function find_file($dir, $file, $ext = NULL, $array = FALSE)
 {
     // Use the defined extension by default
     $ext = $ext === NULL ? EXT : '.' . $ext;
     // Create a partial path of the filename
     $path = $dir . DIRECTORY_SEPARATOR . $file . $ext;
     if (Kohana::$caching === TRUE and isset(Kohana::$_files[$path])) {
         // This path has been cached
         return Kohana::$_files[$path];
     }
     if (Kohana::$profiling === TRUE and class_exists('Profiler', FALSE)) {
         // Start a new benchmark
         $benchmark = Profiler::start('Kohana', __FUNCTION__);
     }
     if ($array or $dir === 'config' or $dir === 'i18n' or $dir === 'messages') {
         // Include paths must be searched in reverse
         $paths = array_reverse(Kohana::$_paths);
         // Array of files that have been found
         $found = array();
         foreach ($paths as $dir) {
             if (is_file($dir . $path)) {
                 // This path has a file, add it to the list
                 $found[] = $dir . $path;
             }
         }
     } else {
         // The file has not been found yet
         $found = FALSE;
         foreach (Kohana::$_paths as $dir) {
             if (is_file($dir . $path)) {
                 // A path has been found
                 $found = $dir . $path;
                 // Stop searching
                 break;
             }
         }
     }
     if (Kohana::$caching === TRUE) {
         // Add the path to the cache
         Kohana::$_files[$path] = $found;
         // Files have been changed
         Kohana::$_files_changed = TRUE;
     }
     if (isset($benchmark)) {
         // Stop the benchmark
         Profiler::stop($benchmark);
     }
     return $found;
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:74,代码来源:core.php

示例3: find_file

 /**
  * Searches for a file in the [Cascading Filesystem](kohana/files), and
  * returns the path to the file that has the highest precedence, so that it
  * can be included.
  *
  * When searching the "config", "messages", or "i18n" directories, or when
  * the `$array` flag is set to true, an array of all the files that match
  * that path in the [Cascading Filesystem](kohana/files) will be returned.
  * These files will return arrays which must be merged together.
  *
  * If no extension is given, the default extension (`EXT` set in
  * `index.php`) will be used.
  *
  *     // Returns an absolute path to views/template.php
  *     Kohana::find_file('views', 'template');
  *
  *     // Returns an absolute path to media/css/style.scss
  *     Kohana::find_file('media', 'css/style', 'css');
  *
  *     // Returns an array of all the "mimes" configuration files
  *     Kohana::find_file('config', 'mimes');
  *
  * @param   string  $dir   directory name (views, i18n, classes, extensions, etc.)
  * @param   string  $file  filename with subdirectory
  * @param   string  $ext   extension to search for
  * @param   boolean $array return an array of files?
  *
  * @return  array   a list of files when $array is TRUE
  * @return  string  single file path
  */
 public static function find_file($dir, $file, $ext = null, $array = false)
 {
     if ($ext === null) {
         // Use the default extension
         $ext = EXT;
     } elseif ($ext) {
         // Prefix the extension with a period
         $ext = ".{$ext}";
     } else {
         // Use no extension
         $ext = '';
     }
     // Create a partial path of the filename
     $path = $dir . DIRECTORY_SEPARATOR . $file . $ext;
     if (Kohana::$caching === true and isset(Kohana::$_files[$path . ($array ? '_array' : '_path')])) {
         // This path has been cached
         return Kohana::$_files[$path . ($array ? '_array' : '_path')];
     }
     if (Kohana::$profiling === true and class_exists('Profiler', false)) {
         // Start a new benchmark
         $benchmark = Profiler::start('Kohana', __FUNCTION__);
     }
     if ($array or $dir === 'config' or $dir === 'i18n' or $dir === 'messages') {
         // Include paths must be searched in reverse
         $paths = array_reverse(Kohana::$_paths);
         // Array of files that have been found
         $found = [];
         foreach ($paths as $dir) {
             if (is_file($dir . $path)) {
                 // This path has a file, add it to the list
                 $found[] = $dir . $path;
             }
         }
     } else {
         // The file has not been found yet
         $found = false;
         foreach (Kohana::$_paths as $dir) {
             if (is_file($dir . $path)) {
                 // A path has been found
                 $found = $dir . $path;
                 // Stop searching
                 break;
             }
         }
     }
     if (Kohana::$caching === true) {
         // Add the path to the cache
         Kohana::$_files[$path . ($array ? '_array' : '_path')] = $found;
         // Files have been changed
         Kohana::$_files_changed = true;
     }
     if (isset($benchmark)) {
         // Stop the benchmark
         Profiler::stop($benchmark);
     }
     return $found;
 }
开发者ID:s4urp8n,项目名称:kohana-admin,代码行数:87,代码来源:Core.php


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