本文整理汇总了PHP中cache类的典型用法代码示例。如果您正苦于以下问题:PHP cache类的具体用法?PHP cache怎么用?PHP cache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
public function template($c)
{
$conn = $this->conn($c);
// connection
$cache = new cache();
$data["homepage_general"] = $cache->index($c, "homepage_general");
$data["homepage_files"] = $cache->index($c, "homepage_files");
/* languages */
$languages = $cache->index($c, "languages");
$data["languages"] = json_decode($languages);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
/* website menu header & footer */
$menu_array = $cache->index($c, "main_menu");
$menu_array = json_decode($menu_array);
if ($menu_array) {
$model_template_main_menu = new model_template_main_menu();
$data["main_menu"] = $model_template_main_menu->nav($menu_array, "header");
$data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer");
}
/* components */
$components = $cache->index($c, "components");
$data["components"] = json_decode($components);
/* multimedia */
$multimedia = $cache->index($c, "multimedia");
$data["multimedia"] = json_decode($multimedia);
$news = $cache->index($c, "news");
$data["news"] = json_decode($news);
$events = $cache->index($c, "events");
$data["events"] = json_decode($events);
@(include $c["website.directory"] . "/homepage.php");
}
示例2: archive_cache
public function archive_cache($cache_id, $comment, $months = 0)
{
global $opt, $login, $translate;
$log = cachelog::createNew($cache_id, $login->userid);
if ($log === false) {
echo $this->name . ": cannot create log for cache {$cache_id}\n";
} else {
$cache = new cache($cache_id);
if (!$cache->setStatus(3) || !$cache->save()) {
echo $this->name . ": cannot change status of cache {$cache_id}\n";
} else {
// create log
$log->setType(cachelog::LOGTYPE_ARCHIVED, true);
$log->setOcTeamComment(true);
$log->setDate(date('Y-m-d'));
// Log without time, so that owner reactions will always appear AFTER
// the system log, no matter if logged with or without date.
// create log text in appropriate language
$translated_comment = $translate->t($comment, '', '', 0, '', 1, $cache->getDefaultDescLanguage());
$translated_comment = str_replace('%1', $months, $translated_comment);
$log->setText('<p>' . $translated_comment . '</p>');
$log->setTextHtml(1);
if (!$log->save()) {
echo $this->name . ": could not save archive log for cache {$cache_id}\n";
}
}
}
}
示例3: show_alert
private function show_alert($index)
{
if (valid_input($index, VALIDATE_NUMBERS, VALIDATE_NONEMPTY) == false) {
return;
} else {
if ($index >= count($this->alerts)) {
return;
}
}
list($title, $type, $column) = $this->alerts[(int) $index];
$cache = new cache($this->db, "dashboard_" . $this->user->username);
if (($list = $cache->{$column}) === NULL) {
$function = "get_" . $type . "_statistics";
$list = $this->model->{$function}($column);
$cache->store($column, $list, $this->settings->dashboard_page_refresh * 60 - 1);
}
if ($list == false) {
return;
}
$this->output->open_tag("list", array("title" => $title));
foreach ($list as $name => $item) {
$this->output->add_tag("item", $name, array("count" => $item["today"], "change" => $item["change"]));
}
$this->output->close_tag();
}
示例4: execute
public function execute()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
/* Update menu
*/
if ($this->model->menu_oke($_POST["menu"]) == false) {
$this->show_menu_form($_POST["menu"]);
} else {
if ($this->model->update_menu($_POST["menu"]) == false) {
$this->output->add_tag("result", "Error while updating menu.");
} else {
$this->output->add_tag("result", "The menu has been updated.");
$this->user->log_action("menu updated");
header("X-Hiawatha-Cache-Remove: all");
$cache = new cache($this->db, "menu");
$cache->store("last_updated", time(), 365 * DAY);
}
}
} else {
/* Show menu
*/
if (($menu = $this->model->get_menu()) === false) {
$this->output->add_tag("result", "Error loading menu.");
} else {
$this->show_menu_form($menu);
}
}
}
示例5: template
public function template($c, $page)
{
$conn = $this->conn($c);
$cache = new cache();
$text_general = $cache->index($c, "text_general");
$data["text_general"] = json_decode($text_general, true);
$welcomepage_categories = $cache->index($c, "welcomepage_categories");
$data["welcomepage_categories"] = json_decode($welcomepage_categories, true);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
$sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":id" => $_SESSION["batumi_id"]));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$data["userdata"] = $fetch;
} else {
redirect::url(WEBSITE);
}
/* catalog list */
$userlist = $cache->index($c, "userlist");
$data['userlist'] = json_decode($userlist, true);
$include = WEB_DIR . "/momxmareblismarTva.php";
if (file_exists($include)) {
@(include $include);
} else {
$controller = new error_page();
}
}
示例6: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
// The generated script depends on some dynamic options
$cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
$cache->_event = 'JS_CACHE_USE';
// load minified version for some files
$min = $conf['compress'] ? '.min' : '';
// array of core files
$files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir() . 'script.js');
// add possible plugin scripts and userscript
$files = array_merge($files, js_pluginscripts());
if (isset($config_cascade['userscript']['default'])) {
$files[] = $config_cascade['userscript']['default'];
}
$cache_files = array_merge($files, getConfigFiles('main'));
$cache_files[] = __FILE__;
// check cache age & handle conditional request
// This may exit if a cache can be used
$cache_ok = $cache->useCache(array('files' => $cache_files));
http_cached($cache->cache, $cache_ok);
// start output buffering and build the script
ob_start();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . tpl_basedir() . "';";
// FIXME: Move those to JSINFO
print "var DOKU_UHN = " . (int) useHeading('navigation') . ";";
print "var DOKU_UHC = " . (int) useHeading('content') . ";";
// load JS specific translations
$json = new JSON();
$lang['js']['plugins'] = js_pluginstrings();
echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
// load toolbar
toolbar_JSdefines('toolbar');
// load files
foreach ($files as $file) {
echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
js_load($file);
echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
}
// init stuff
if ($conf['locktime'] != 0) {
js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
}
// init hotkeys - must have been done after init of toolbar
# disabled for FS#1958 js_runonstart('initializeHotkeys()');
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
// compress whitespace and comments
if ($conf['compress']) {
$js = js_compress($js);
}
$js .= "\n";
// https://bugzilla.mozilla.org/show_bug.cgi?id=316033
http_cached_finish($cache->cache, $js);
}
示例7: template
public function template($c, $page)
{
$conn = $this->conn($c);
$cache = new cache();
$text_general = $cache->index($c, "text_general");
$data["text_general"] = json_decode($text_general, true);
$welcomepage_categories = $cache->index($c, "welcomepage_categories");
$data["welcomepage_categories"] = json_decode($welcomepage_categories, true);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
/* Upload Users profile picture */
if (isset($_FILES["profileimage"]["name"])) {
$model_template_upload_user_logo = new model_template_upload_user_logo();
$upload = $model_template_upload_user_logo->upload($c);
}
$sql = 'SELECT `username`,`user_type`,`namelname`,`dob`,`email`,`mobile`,`address`,`picture` FROM `studio404_users` WHERE `id`=:id';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":id" => $_SESSION["batumi_id"]));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$data["userdata"] = $fetch;
} else {
redirect::url(WEBSITE);
}
$include = WEB_DIR . "/profilisredaqtireba.php";
if (file_exists($include)) {
@(include $include);
} else {
$controller = new error_page();
}
}
示例8: index
public function index()
{
$data = ['text' => "tolga"];
$cache = new cache();
$cache->cacheStart();
_log_("heder.txt");
self::view('home/index', $data);
$cache->cacheEnd();
}
示例9: template
public function template($c)
{
$conn = $this->conn($c);
// connection
$cache = new cache();
$team_general = $cache->index($c, "team_general");
$data["team_general"] = json_decode($team_general, true);
$team_list = $cache->index($c, "team_list");
$data["team_list"] = json_decode($team_list);
/* languages */
$languages = $cache->index($c, "languages");
$data["languages"] = json_decode($languages);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
/* website menu header & footer */
$menu_array = $cache->index($c, "main_menu");
$menu_array = json_decode($menu_array);
$model_template_main_menu = new model_template_main_menu();
$data["main_menu"] = $model_template_main_menu->nav($menu_array, "header");
$data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer");
/* website left menu */
$left_menu = $cache->index($c, "left_menu");
$left_menu = json_decode($left_menu);
$data["left_menu"] = $model_template_main_menu->left($left_menu);
/* breadcrups */
$breadcrups = $cache->index($c, "breadcrups");
$data["breadcrups"] = json_decode($breadcrups);
/* components */
$components = $cache->index($c, "components");
$data["components"] = json_decode($components);
@(include $c["website.directory"] . "/team.php");
}
示例10: nav
public function nav($menu_array, $type)
{
// echo "<pre>";
// print_r($menu_array);
// echo "</pre>";
$get_slug_from_url = new get_slug_from_url();
$slug = $get_slug_from_url->slug();
if ($type == "header") {
$o = '<ul class="nav navbar-nav">';
for ($x = 0; $x < count($menu_array->date); $x++) {
$active = $menu_array->slug[$x] == $slug ? 'active' : '';
if ($menu_array->sub[$x]) {
$o .= '<li class="dropdown ' . $active . '">';
$o .= '<a href="' . MAIN_DIR . $menu_array->slug[$x] . '?v=<?=$menu_array->idx[$x]?>" class="sub_menu_arrow dropdown-toggle" data-toggle="dropdown">' . $menu_array->title[$x] . '</a>';
$o .= $this->sub($menu_array->sub[$x], $slug, "header");
$o .= '</li>';
} else {
$o .= '<li class="' . $active . '"><a href="' . MAIN_DIR . $menu_array->slug[$x] . '?v=' . $menu_array->idx[$x] . '">' . $menu_array->title[$x] . '</a></li>';
}
}
$o .= '</ul>';
} else {
if ($type == "footer") {
$o = '';
for ($x = 0; $x < count($menu_array->date); $x++) {
if ($menu_array->sub[$x]) {
// if($x==1){ $offset = ' col-sm-offset-1'; }else{ $offset=""; }
// $o .= '<div class="col-sm-2'.$offset.'"><ul class="text_formats_blue">';
$o .= '<div class="col-sm-2"><ul class="text_formats_blue">';
$o .= '<li>';
//'.MAIN_DIR.$menu_array->slug[$x].'
$o .= '<a href="javascript:;"><span>' . $menu_array->title[$x] . '</span></a>';
$o .= '</li>';
$o .= $this->sub($menu_array->sub[$x], $slug, "footer");
$o .= '</ul></div>';
}
}
$o .= '<div class="col-sm-2"><ul class="text_formats_blue">';
$o .= '<li>';
$contactname = LANG == "en" ? 'Contact us' : 'კონტაქტი';
$o .= '<a href="' . MAIN_DIR . 'contact-us"><span>' . $contactname . '</span></a>';
$o .= '</li>';
/* language variables */
$cache = new cache();
$language_data = $cache->index($_SESSION["c"], "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
$o .= '<li>' . $data["language_data"]["hotlinelabel"] . '</li>';
$o .= '<li>' . $data["language_data"]["hotlinevalue"] . '</li>';
$o .= '</ul></div>';
}
}
return $o;
}
示例11: template
public function template($c)
{
$conn = $this->conn($c);
// connection
$cache = new cache();
$homepage_general = $cache->index($c, "homepage_general");
$data["homepage_general"] = json_decode($homepage_general);
$text_general = $cache->index($c, "text_general");
$data["text_general"] = json_decode($text_general, true);
$photo_gallery_list = $cache->index($c, "photo_gallery_list");
$data["photo_gallery_list"] = json_decode($photo_gallery_list);
/* languages */
$languages = $cache->index($c, "languages");
$data["languages"] = json_decode($languages);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
/* website menu header & footer */
$menu_array = $cache->index($c, "main_menu");
$menu_array = json_decode($menu_array);
$model_template_main_menu = new model_template_main_menu();
$data["main_menu"] = $model_template_main_menu->nav($menu_array, "header");
$data["footer_menu"] = $model_template_main_menu->nav($menu_array, "footer");
/* website left menu */
/* fotogallery */
$fotogallery = $cache->index($c, "files_");
$data["fotogallery"] = json_decode($fotogallery);
/* components */
$components = $cache->index($c, "components");
$data["components"] = json_decode($components);
@(include $c["website.directory"] . "/photogallery.php");
}
示例12: index
public function index($name = '')
{
$data = ['text' => $name];
$cache = new cache();
$cache->app_url = "core";
$cache->caching = false;
$cache->cacheStart();
_log_("heder.txt");
$this->view('home/index', $data);
$cache->cacheEnd();
}
示例13: template
public function template($c, $page)
{
$conn = $this->conn($c);
$cache = new cache();
$text_general = $cache->index($c, "text_general");
$data["text_general"] = json_decode($text_general, true);
/* categories list */
$welcomepage_categories = $cache->index($c, "welcomepage_categories");
$data["welcomepage_categories"] = json_decode($welcomepage_categories, true);
/* all columns catalog table */
$catalog_table_columns = $cache->index($c, "catalog_table_columns");
$data["catalog_table_columns"] = json_decode($catalog_table_columns, true);
/* all columns catalog table */
// $select_form = $cache->index($c,"select_form");
// $data["select_form"] = json_decode($select_form,true);
$cid = Input::method("GET", "parent");
$select_form = new select_form();
$data["select_form"] = $select_form->form($c, $cid, LANG_ID);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
$sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":id" => $_SESSION["batumi_id"]));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$data["userdata"] = $fetch;
} else {
redirect::url(WEBSITE);
}
if (Input::method("GET", "parent") != "") {
$parent = 'SELECT `idx`,`title` FROM `studio404_pages` WHERE `idx`=:idx AND `cid`=4 AND `status`!=1 AND `lang`=:lang';
$prepareParent = $conn->prepare($parent);
$prepareParent->execute(array(":idx" => Input::method("GET", "parent"), ":lang" => LANG_ID));
if ($prepareParent->rowCount() > 0) {
$parent_fetch = $prepareParent->fetch(PDO::FETCH_ASSOC);
$data["parent_idx"] = $parent_fetch["idx"];
$data["parent_title"] = $parent_fetch["title"];
} else {
redirect::url(WEBSITE . LANG . "/katalogis-marTva");
}
} else {
redirect::url(WEBSITE . LANG . "/katalogis-marTva");
}
$include = WEB_DIR . "/formismarTva.php";
if (file_exists($include)) {
@(include $include);
} else {
$controller = new error_page();
}
}
示例14: template
public function template($c, $page)
{
$conn = $this->conn($c);
// connection
$cache = new cache();
$welcomepage_categories = $cache->index($c, "welcomepage_categories");
$data["welcomepage_categories"] = json_decode($welcomepage_categories, true);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
$sql = 'SELECT `namelname`,`picture` FROM `studio404_users` WHERE `id`=:id';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":id" => $_SESSION["batumi_id"]));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$data["userdata"] = $fetch;
} else {
redirect::url(WEBSITE);
}
$sql2 = 'SELECT
`studio404_messages`.*,
`studio404_users`.`namelname` AS fromusername
FROM
`studio404_messages`, `studio404_users`
WHERE
`studio404_messages`.`fromuser`="' . $_SESSION["batumi_id"] . '" AND
`studio404_messages`.`draft`=1 AND
NOT FIND_IN_SET("' . $_SESSION["batumi_id"] . '",`studio404_messages`.`status`) AND
`studio404_messages`.`tousers`=`studio404_users`.`id`
ORDER BY `studio404_messages`.`date` DESC LIMIT 20';
$prepare2 = $conn->prepare($sql2);
$prepare2->execute();
if ($prepare2->rowCount() > 0) {
$fetch2 = $prepare2->fetchAll(PDO::FETCH_ASSOC);
$data["messages"] = $fetch2;
} else {
$data["messages"] = array();
}
$catalog_general = $cache->index($c, "catalog_general");
$data["catalog_general"] = json_decode($catalog_general, true);
$catalogitemsnovisiable = $cache->index($c, "catalogitemsnovisiable");
$data["catalogitems"] = json_decode($catalogitemsnovisiable, true);
$include = WEB_DIR . "/draft.php";
if (file_exists($include)) {
@(include $include);
} else {
$controller = new error_page();
}
}
示例15: select_all
public function select_all($c)
{
$cache = new cache();
$footernavigation = $cache->index($c, "footernavigation");
$out["footernavigation"] = json_decode($footernavigation, true);
$o = '';
foreach ($out["footernavigation"] as $value) {
$o .= '<ul>';
$o .= '<span>' . $value['title'] . ': </span> ';
$o .= $this->select_sub($c, $value['idx']);
$o .= '</ul>';
}
return $o;
}