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


PHP modules::file_path方法代码示例

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


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

示例1: output

 /**
  * Outputs data
  *
  * @access	public
  * @param	mixed	$asset		The asset
  * @param	string	$group		Group
  * @param	bool	$default	If the group should be the default __{$asset}__ only
  * @return	void
  */
 public function output($asset = null, $group = null, $default = false, $just_link = false)
 {
     $this->super->benchmark->mark("assets::output(" . $asset . "/" . $group . ")_start");
     $output = '';
     $files = array();
     $file_names = array();
     if (is_null($asset)) {
         return;
     }
     // Override $group
     if ($default == true) {
         $group = $this->default_group[$asset];
     }
     // All files?
     if (is_null($group)) {
         if (isset($this->queue[$asset])) {
             foreach ($this->queue[$asset] as $group => $details) {
                 $output .= $this->output($asset, $group, $default, $just_link);
             }
             return $output;
         }
     } else {
         if (!isset($this->outputted)) {
             $this->outputted = array();
         }
         if (!isset($this->outputted[$asset])) {
             $this->outputted[$asset] = array();
         }
         if (in_array($group, $this->outputted[$asset])) {
             //return;
         } else {
             if (isset($this->queue[$asset][$group])) {
                 $files = $this->queue[$asset][$group];
                 $this->outputted[$asset][] = $group;
             } else {
                 return;
             }
         }
     }
     if (empty($files)) {
         return;
     }
     $file_names = array();
     // Try and find the actual files:
     foreach ($files as $index => $value) {
         $found = false;
         $file = $value['file'];
         foreach ($this->path[$asset] as $location) {
             if (file_exists($location . DIRECTORY_SEPARATOR . $file)) {
                 $found = true;
                 $files[$index]['path'] = reduce_double_slashes($location . DIRECTORY_SEPARATOR);
             }
         }
         // Uh oh
         if (!isset($files[$index]['path'])) {
             // Check if a module has been specified
             $path = '';
             $module = $this->super->router->get_module();
             // Is this in a sub-folder? If so, parse out the filename and path.
             if (($last_slash = strrpos($file, '/')) !== FALSE) {
                 $path = substr($file, 0, ++$last_slash - 1);
                 $file = substr($file, $last_slash);
             }
             $_file = modules::file_path($module, $this->dir[$asset] . DIRECTORY_SEPARATOR . $path, $file);
             if (is_null($_file)) {
                 $segments = explode(DIRECTORY_SEPARATOR, $path);
                 $module = $segments[0];
                 array_shift($segments);
                 $path = implode(DIRECTORY_SEPARATOR, $segments);
                 $_file = modules::file_path($module, $this->dir[$asset] . DIRECTORY_SEPARATOR . $path, $file);
             }
             if (!is_null($_file)) {
                 $found = true;
                 $files[$index]['file'] = basename($_file);
                 $files[$index]['path'] = reduce_double_slashes(dirname($_file)) . DIRECTORY_SEPARATOR;
             }
         }
         if ($found) {
             $file_names[] = $file;
         } else {
             unset($files[$index]);
         }
     }
     $cache_name = sha1(implode(',', $file_names)) . '.' . current($this->config['file_types'][$asset]);
     $cache_path = reduce_double_slashes($this->config['cache_path'] . DIRECTORY_SEPARATOR . $this->config['paths'][$asset] . DIRECTORY_SEPARATOR . $cache_name);
     // Keep regenerating cache if development mode
     if (ENVIRONMENT == 'development' || !$this->super->cache->file->get($cache_path)) {
         $output = '';
         $time = time();
         switch ($asset) {
             case 'styles':
//.........这里部分代码省略.........
开发者ID:escproxy,项目名称:RPS,代码行数:101,代码来源:Assets.php


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