本文整理汇总了PHP中Helpers::file_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::file_cache方法的具体用法?PHP Helpers::file_cache怎么用?PHP Helpers::file_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::file_cache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_hash
function create_hash() {
# .htaccess file
$htaccess = file_exists('./.htaccess') ? '.htaccess:'.filemtime('./.htaccess') : '';
# serialize the file cache
$file_cache = serialize(Helpers::file_cache());
# create an md5 of the two collections
return md5($htaccess.$file_cache);
}
示例2: collate_partials
static function collate_partials($dir = './templates/partials') {
foreach(Helpers::file_cache($dir) as $file) {
if($file['is_folder']) {
self::collate_partials($file['path']);
} else {
self::$partials[] = $file['path'];
}
}
}
示例3: collate_partials
static function collate_partials($dir = false)
{
if (!$dir) {
$dir = Config::$templates_folder . '/partials';
}
foreach (Helpers::file_cache($dir) as $file) {
if ($file['is_folder']) {
self::collate_partials($file['path']);
} else {
self::$partials[] = $file['path'];
}
}
}
示例4: __construct
function __construct($file_path, $template_file)
{
# generate an md5 hash from the file_path
$this->path_hash = $this->generate_hash($file_path);
# generate an md5 hash from the current state of the site content
$htaccess = file_exists(Config::$root_folder . '.htaccess') ? '.htaccess:' . filemtime(Config::$root_folder . '.htaccess') : '';
$file_cache = serialize(Helpers::file_cache());
$content_hash = $this->generate_hash($htaccess . $file_cache);
# combine the two hashes to create a cachefile name
$this->cachefile = Config::$cache_folder . '/pages/' . $this->cache_prefix . $this->path_hash . '-' . $content_hash;
# store the hash
$this->hash = $this->cache_prefix . $this->path_hash . '-' . $content_hash;
}
示例5: create_full_cache
function create_full_cache($pages = null)
{
$search_fields = array('url', 'file_path', 'title', 'author', 'content');
$store = array();
if (!isset($pages)) {
$pages = Helpers::file_cache('./content');
}
foreach ($pages as $page) {
if ($page['is_folder']) {
$current_page = AssetFactory::get($page['path']);
# Skip for password protected pages
if ($current_page['password_protect'] || $current_page['hide_from_search']) {
continue;
}
# Only save search field data
foreach ($current_page as $key => $value) {
if (!in_array($key, $search_fields)) {
unset($current_page[$key]);
}
}
$store[] = $current_page;
$children = self::create_full_cache(Helpers::file_cache($page['path']));
if (is_array($children)) {
$store = array_merge($store, $children);
}
}
}
return $store;
}
示例6: create_full_cache
function create_full_cache($pages = null)
{
$search_fields = array('url', 'file_path', 'title', 'author', 'content', 'object_name', 'designer', 'builder', 'category', 'tags', 'contributors', 'realisation_place', 'required_hardware', 'license', 'client');
$store = array();
if (!isset($pages)) {
$pages = Helpers::file_cache('./content');
}
foreach ($pages as $page) {
if ($page['is_folder']) {
$current_page = AssetFactory::get($page['path']);
# Skip for password protected pages
if (isset($current_page['password_protect']) || isset($current_page['hide_from_search'])) {
continue;
}
# Only save search field data
foreach ($current_page as $key => $value) {
if (!in_array($key, $search_fields)) {
unset($current_page[$key]);
}
}
$store[] = $current_page;
$children = self::create_full_cache(Helpers::file_cache($page['path']));
if (is_array($children)) {
$store = array_merge($store, $children);
}
}
}
return $store;
}