本文整理汇总了PHP中Assets::cache_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::cache_path方法的具体用法?PHP Assets::cache_path怎么用?PHP Assets::cache_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::cache_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPaths
/**
* Set paths and urls for future processing
*/
public static function setPaths()
{
// Set Assets Path
if (!is_dir(self::$assets_dir)) {
throw new Assets\AssetsException('The provided directory "' . self::$assets_dir . '" does not exist.');
}
// Set cache path and url
self::$cache_path = self::$assets_dir . self::$cache_dir;
self::$cache_url = self::$base_url . self::$cache_dir;
}
示例2: _paths
/**
* Setup paths
*/
private static function _paths()
{
// Start benchmark
if (self::$_enable_benchmark) {
self::$_ci->benchmark->mark("Assets::paths()_start");
}
// Set the assets base path
self::$base_path = reduce_double_slashes(realpath(self::$assets_dir));
// Now set the assets base URL
if (!self::$base_url) {
self::$base_url = reduce_double_slashes(config_item('base_url') . '/' . self::$assets_dir);
} else {
self::$base_url = self::$base_url . self::$assets_dir;
}
// Auto protocol
if (stripos(self::$base_url, '//') === 0) {
$slash = '/';
} else {
$slash = '';
}
// And finally the paths and URL's to the css and js assets
self::$js_path = reduce_double_slashes(self::$base_path . '/' . self::$js_dir);
self::$js_url = $slash . reduce_double_slashes(self::$base_url . '/' . self::$js_dir);
self::$css_path = reduce_double_slashes(self::$base_path . '/' . self::$css_dir);
self::$css_url = $slash . reduce_double_slashes(self::$base_url . '/' . self::$css_dir);
self::$img_path = reduce_double_slashes(self::$base_path . '/' . self::$img_dir);
self::$img_url = $slash . reduce_double_slashes(self::$base_url . '/' . self::$img_dir);
self::$cache_path = reduce_double_slashes(self::$base_path . '/' . self::$cache_dir);
self::$cache_url = $slash . reduce_double_slashes(self::$base_url . '/' . self::$cache_dir);
if (!self::$freeze) {
// Check if all directories exist
if (!is_dir(self::$js_path)) {
if (!@mkdir(self::$js_path, 0755)) {
exit('Error with JS directory.');
}
}
if (!is_dir(self::$css_path)) {
if (!@mkdir(self::$css_path, 0755)) {
exit('Error with CSS directory.');
}
}
if (!is_dir(self::$cache_path)) {
if (!@mkdir(self::$cache_path, 0777)) {
exit('Error with CACHE directory.');
}
}
// Try to make the cache direcory writable
if (is_dir(self::$cache_path) and !is_really_writable(self::$cache_path)) {
@chmod(self::$cache_path, 0777);
}
// If it's still not writable throw error
if (!is_dir(self::$cache_path) or !is_really_writable(self::$cache_path)) {
exit('Error with CACHE directory.');
}
}
// End benchmark
if (self::$_enable_benchmark) {
self::$_ci->benchmark->mark("Assets::paths()_end");
}
}
示例3: _paths
/**
* Setup paths
* @return [type] [description]
*/
private static function _paths()
{
// Set the assets base path
self::$base_path = reduce_double_slashes(realpath(self::$assets_dir));
// Now set the assets base URL
self::$base_url = reduce_double_slashes(config_item('base_url') . '/' . self::$assets_dir);
// And finally the paths and URL's to the css and js assets
self::$js_path = reduce_double_slashes(self::$base_path . '/' . self::$js_dir);
self::$js_url = reduce_double_slashes(self::$base_url . '/' . self::$js_dir);
self::$css_path = reduce_double_slashes(self::$base_path . '/' . self::$css_dir);
self::$css_url = reduce_double_slashes(self::$base_url . '/' . self::$css_dir);
self::$img_path = reduce_double_slashes(self::$base_path . '/' . self::$img_dir);
self::$img_url = reduce_double_slashes(self::$base_url . '/' . self::$img_dir);
self::$cache_path = reduce_double_slashes(self::$base_path . '/' . self::$cache_dir);
self::$cache_url = reduce_double_slashes(self::$base_url . '/' . self::$cache_dir);
// Check if all directories exist
if (!is_dir(self::$js_path)) {
if (!@mkdir(self::$js_path, 0755)) {
exit('Error with JS directory.');
}
}
if (!is_dir(self::$css_path)) {
if (!@mkdir(self::$css_path, 0755)) {
exit('Error with CSS directory.');
}
}
if (!is_dir(self::$cache_path)) {
if (!@mkdir(self::$cache_path, 0777)) {
exit('Error with CACHE directory.');
}
}
// Try to make the cache direcory writable
if (is_dir(self::$cache_path) and !is_really_writable(self::$cache_path)) {
@chmod(self::$cache_path, 0777);
}
// If it's still not writable throw error
if (!is_dir(self::$cache_path) or !is_really_writable(self::$cache_path)) {
exit('Error with CACHE directory.');
}
}