本文整理汇总了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':
//.........这里部分代码省略.........