本文整理汇总了PHP中cache::getFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP cache::getFileName方法的具体用法?PHP cache::getFileName怎么用?PHP cache::getFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cache
的用法示例。
在下文中一共展示了cache::getFileName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBlog
public static function getBlog()
{
$cacheFile = cache::getFileName(0, 'rpBlog');
// every 12 hours
if (cache::exist($cacheFile, 43200)) {
$content = json_decode(cache::read($cacheFile), true);
} else {
$content = apiserver::getBlogFile();
cache::write($content, $cacheFile);
}
$return = [];
foreach ($content as $blog) {
$return[] = '
<div class="item">
<div class="circle"></div>
<div class="text">
<p><a target="_blank" href="' . $blog['link'] . '">' . $blog['name'] . '</a></p>
<small>' . date(lang::get('dateformat'), strtotime($blog['date'])) . '</small>
</div>
</div>
';
}
return implode(PHP_EOL, $return);
}
示例2: mail
<?php
if (type::get('checkversion', 'int', 0) == 1) {
$cacheFile = cache::getFileName(0, 'dynaoVersion');
cache::exist($cacheFile, 0);
echo message::success(lang::get('connection_again'), true);
}
if (ajax::is()) {
if (type::super('text')) {
$mail = mail('info@dynao.de', 'Neue Idee', type::super('text'), 'From: ' . dyn::get('user')->get('firstname') . ' ' . dyn::get('user')->get('name') . '<' . dyn::get('user')->get('email') . '>');
if ($mail) {
ajax::addReturn(message::success(lang::get('idea_send')));
} else {
ajax::addReturn(message::danger(lang::get('idea_error')));
}
} else {
ajax::addReturn(message::danger(lang::get('idea_empty')));
}
}
$versionCheck = dyn::checkDynVersion();
if ($versionCheck === lang::get('version_fail_connect')) {
$message = lang::get('version_fail_connect');
$message .= '<br /><a href="' . url::backend('dashboard', ['subpage' => 'overview', 'checkversion' => 1]) . '">' . lang::get('try_again') . '</a>';
echo message::danger($message, true);
} elseif ($versionCheck) {
echo message::danger($versionCheck, true);
}
$stats = [];
$sql = sql::factory();
$numPages = $sql->num('SELECT * FROM ' . sql::table('structure'));
$sql = sql::factory();
示例3: getModules
public static function getModules()
{
$cacheFile = cache::getFileName(0, 'dynaoModules');
// jeden halben Tag
if (cache::exist($cacheFile, 43200)) {
$content = json_decode(cache::read($cacheFile), true);
} else {
$content = apiserver::getModulesFile();
cache::write($content, $cacheFile);
}
$table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]);
$table->addCollsLayout('60, 140, *, 110');
$table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell();
$table->addSection('tbody');
if (is_null($content) || !$content) {
$table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]);
} else {
foreach ($content as $addon) {
$perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10);
if ($perc < 33) {
$class = 'danger';
} elseif ($perc < 66) {
$class = 'warning';
} else {
$class = 'success';
}
$table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('import') . '</a>');
}
}
return $table->show();
}
示例4: loadCache
/**
* Den Cache laden
*/
protected static function loadCache()
{
$cacheFile = cache::getFileName(0, 'autoloadcache');
if (!cache::exist($cacheFile, 3600)) {
return;
}
list(self::$classes, self::$dirs) = json_decode(cache::read($cacheFile), true);
}
示例5: getAddons
public static function getAddons()
{
$cacheFile = cache::getFileName(0, 'dynaoAddons');
// jeden halben Tag
if (cache::exist($cacheFile, 43200)) {
$content = json_decode(cache::read($cacheFile), true);
} else {
$server = 'http://api.dynao.de/addons.json';
$ch = curl_init($server);
curl_setopt($ch, CURLOPT_PORT, 80);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla (Statuscheck-Script)');
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 300);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl = curl_exec($ch);
curl_close($ch);
$content = json_decode($curl, true);
cache::write($content, $cacheFile);
}
$table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]);
$table->addCollsLayout('60, 140, *, 110');
$table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell();
$table->addSection('tbody');
if (is_null($content)) {
$table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]);
} else {
foreach ($content as $addon) {
$perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10);
if ($perc < 33) {
$class = 'danger';
} elseif ($perc < 66) {
$class = 'warning';
} else {
$class = 'success';
}
$table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('download') . '</a>');
}
}
return $table->show();
}