本文整理汇总了PHP中save_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP save_cache函数的具体用法?PHP save_cache怎么用?PHP save_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
$name = str_replace(LOCALE_GLYPH_OF, '', $name);
}
$g_glyphs[$glyph['entry']] = array('name' => (string) $name, 'description' => (string) spell_desc($glyph['spellid']), 'icon' => (string) $glyph['iconname'], 'type' => (int) ($glyph['typeflags'] & 1 ? 2 : 1), 'classs' => (int) $glyph['subclass'], 'skill' => (int) 2);
}
save_cache(25, 'x', $g_glyphs);
}
echo 'var g_glyphs=' . php2js($g_glyphs);
break;
case 'talent-icon':
$iconname = strtolower($_GET['icon']);
if (!$DB->selectCell('SELECT 1 FROM ?_spellicons WHERE iconname = ?', $iconname)) {
exit;
}
if ($name = load_cache(21, $iconname)) {
header('Content-type: image/jpeg');
imagejpeg(imagecreatefromjpeg('cache/images/' . $iconname . '.jpg'));
} else {
header('Content-type: image/jpeg');
$im = @imagecreatefromjpeg('images/icons/medium/' . $iconname . '.jpg');
if (!$im) {
exit;
}
imagetograyscale($im);
imagejpeg($im, 'cache/images/' . $iconname . '.jpg');
imagejpeg($im);
save_cache(21, $iconname, $iconname);
}
break;
default:
break;
}
示例2: JOIN
SELECT c.?#, c.entry
{
, l.name_loc?d as `name_loc`
, l.subname_loc' . $_SESSION['locale'] . ' as `subname_loc`
}
FROM ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE 1=1
{AND type=?}
{AND family=?}
AND factiontemplateID=faction_A
ORDER BY minlevel DESC, name
{LIMIT ?d}
', $npc_cols[0], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, $type != '' ? $type : DBSIMPLE_SKIP, isset($family) ? $family : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$npcs = array();
foreach ($rows as $numRow => $row) {
$npcs[$numRow] = array();
$npcs[$numRow] = creatureinfo2($row);
}
save_cache(5, $cache_str, $npcs);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('NPCs'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => '[0, 4,' . $type . ',' . $family . ']');
$smarty->assign('page', $page);
if (count($npcs >= 0)) {
$smarty->assign('npcs', $npcs);
}
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('npcs.tpl');
示例3: unset
$itemset['spells'][$x]['bonus'] = $row['bonus' . $j];
$x++;
}
}
for ($i = 0; $i <= $x - 1; $i++) {
for ($j = $i; $j <= $x - 1; $j++) {
if ($itemset['spells'][$j]['bonus'] < $itemset['spells'][$i]['bonus']) {
unset($tmp);
$tmp = $itemset['spells'][$i];
$itemset['spells'][$i] = $itemset['spells'][$j];
$itemset['spells'][$j] = $tmp;
}
}
}
}
save_cache(8, $id, $itemset);
}
$smarty->assign('itemset', $itemset);
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $itemset['name'] . ' - ' . $smarty->get_config_vars('Item_Sets'), 'tab' => 0, 'type' => 4, 'typeid' => $itemset['entry'], 'path' => '[0, 2]');
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// --Передаем данные шаблонизатору--
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems)) {
$smarty->assign('allitems', $allitems);
}
if (isset($allitems)) {
示例4: foreach
} else {
$spells['sort'] = "'name'";
// просто спеллы
$rows = $DB->select('
SELECT
?#, `s`.`spellID`
FROM ?_spell s, ?_spellicons i
WHERE
i.id=s.spellicon
{LIMIT ?d}
', $spell_cols[2], $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
}
foreach ($rows as $i => $row) {
$spells['data'][] = spellinfo2($row);
}
save_cache(15, $cache_str, $spells);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => ($title ? $title . ' - ' : '') . $smarty->get_config_vars('Spells'), 'tab' => 0, 'type' => 6, 'typeid' => 0, 'path' => "[0, 1, " . intval($s1) . ", " . intval($s2) . ", " . intval($s3) . "]", 'sort' => isset($spells['sort']) ? $spells['sort'] : "'level','name'");
$smarty->assign('page', $page);
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems)) {
$smarty->assign('allitems', $allitems);
}
if (count($allspells) >= 0) {
$smarty->assign('allspells', $allspells);
}
if (count($spells) >= 0) {
$smarty->assign('spells', $spells['data']);
示例5: IN
global $DB, $quest_class, $quest_cols;
$rows = $DB->select('
SELECT ?#
FROM ?_quest_template q
WHERE
1 = 1
{ AND ZoneOrSort = ? }
{ AND ZoneOrSort IN (?a) }
ORDER BY Title
{LIMIT ?d}
', $quest_cols[2], isset($ZoneOrSort) ? $ZoneOrSort : DBSIMPLE_SKIP, (!isset($ZoneOrSort) and $Type) ? $quest_class[$Type] : DBSIMPLE_SKIP, $UDWBaseconf['limit'] > 0 ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP);
$quests = array();
foreach ($rows as $numRow => $row) {
$quests[] = GetQuestInfo($row, QUEST_DATAFLAG_LISTINGS);
}
save_cache(12, $cache_str, $quests);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => '[0, 3,' . $Type . ' ,' . $ZoneOrSort . ']');
$smarty->assign('page', $page);
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if ($allitems) {
$smarty->assign('allitems', $allitems);
}
if ($quests) {
$smarty->assign('quests', $quests);
}
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('quests.tpl');
示例6: cache_key
<?php
require_once 'includes/allitemsets.php';
$smarty->config_load($conf_file, 'itemset');
$cache_key = cache_key();
if (!($itemsets = load_cache(ITEMSET_LISTING, $cache_key))) {
unset($itemsets);
$rows = $DB->select('
SELECT ?#
FROM ?_itemset
ORDER by name_loc' . $_SESSION['locale'] . '
{LIMIT ?d}', $itemset_col[0], $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$itemsets = array();
foreach ($rows as $row) {
$itemsets[] = itemsetinfo2($row);
}
save_cache(ITEMSET_LISTING, $cache_key, $itemsets);
}
$smarty->assign('itemsets', $itemsets);
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Item_Sets'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => '[0, 2]');
$smarty->assign('page', $page);
// --Передаем данные шаблонизатору--
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Запускаем шаблонизатор
$smarty->display('itemsets.tpl');
示例7: array
WHERE
ReqCreatureOrGOId1=?
OR ReqCreatureOrGOId2=?
OR ReqCreatureOrGOId3=?
OR ReqCreatureOrGOId4=?
', $quest_cols[2], $id, $id, $id, $id);
if ($rows_qo) {
$npc['objectiveof'] = array();
foreach ($rows_qo as $numRow => $row) {
$npc['objectiveof'][] = GetQuestInfo($row, 0xffffff);
}
}
unset($rows_qo);
// Положения созданий божих:
position($npc['entry'], 'creature');
save_cache(1, $npc['entry'], $npc);
}
global $page;
$page = array('Mapper' => true, 'Book' => false, 'Title' => $npc['name'] . ' - ' . $smarty->get_config_vars('NPCs'), 'tab' => 0, 'type' => 1, 'typeid' => $npc['entry'], 'path' => '[0,4,' . $npc['type'] . ']');
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems)) {
$smarty->assign('allitems', $allitems);
}
if (isset($allspells)) {
$smarty->assign('allspells', $allspells);
}
$smarty->assign('npc', $npc);
// Количество MySQL запросов
示例8: unset
if (!($items = load_cache(7, $cache_key))) {
unset($items);
// Составляем запрос к БД, выполняющий поиск по заданным классу и подклассу
$rows = $DB->select('
SELECT ?#, i.entry, maxcount
{, l.name_loc?d AS name_loc}
FROM ?_icons, item_template i
{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
WHERE
id=displayid
{ AND class = ? }
{ AND subclass = ? }
{ AND InventoryType = ? }
ORDER BY quality DESC, name
{ LIMIT ?d }
', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, isset($class) ? $class : DBSIMPLE_SKIP, isset($subclass) ? $subclass : DBSIMPLE_SKIP, isset($type) ? $type : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$items = array();
foreach ($rows as $row) {
$items[] = iteminfo2($row);
}
save_cache(7, $cache_key, $items);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Items'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => path(0, 0, $type, $subclass, $class));
$smarty->assign('page', $page);
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('allitems', $allitems);
$smarty->assign('items', $items);
// Загружаем страницу
$smarty->display('items.tpl');
示例9: achievementinfo2
$object['criteria_of'][] = achievementinfo2($row);
}
}
// Положения объектофф:
$object['position'] = position($object['entry'], 'gameobject');
// Исправить type, чтобы подсвечивались event-овые объекты
if ($object['position']) {
foreach ($object['position'] as $z => $zone) {
foreach ($zone['points'] as $p => $pos) {
if ($pos['type'] == 0 && ($events = event_find(array('object_guid' => $pos['guid'])))) {
$names = array_select_key(event_name($events), 'name');
$object['position'][$z]['points'][$p]['type'] = 4;
$object['position'][$z]['points'][$p]['events'] = implode(", ", $names);
}
}
}
}
save_cache(OBJECT_PAGE, $cache_key, $object);
}
global $page;
$page = array('Mapper' => true, 'Book' => $object['pagetext'] ? true : false, 'Title' => $object['name'] . ' - ' . $smarty->get_config_vars('Objects'), 'tab' => 0, 'type' => 2, 'typeid' => $object['entry'], 'username' => $_SESSION['username'], 'path' => path(0, 5, $object['type']));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
$smarty->assign('screenshots', getscreenshots($page['type'], $page['typeid']));
$smarty->assign('wh_ss', get_wowhead_screenshots($page['type'], $page['typeid'], 'page'));
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('reputation', getreputation($page['username']));
$smarty->assign('object', $object);
$smarty->display('object.tpl');
示例10: JOIN
// Цель критерии
$rows = $DB->select('
SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID
FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
WHERE
a.icon = s.id
AND a.id = c.refAchievement
AND c.type IN (?a)
AND c.value1 = ?d
GROUP BY a.id
ORDER BY a.name_loc?d
', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM), $item['entry'], $_SESSION['locale']);
if ($rows) {
$item['criteria_of'] = array();
foreach ($rows as $row) {
allachievementsinfo2($row['id']);
$item['criteria_of'][] = achievementinfo2($row);
}
}
save_cache(ITEM_PAGE, $cache_key, $item);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $item['name'] . ' - ' . $smarty->get_config_vars('Items'), 'tab' => 0, 'type' => 3, 'typeid' => $item['entry'], 'path' => path(0, 0, $item['type'], $item['subclass'], $item['classs']));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('item', $item);
$smarty->display('item.tpl');
示例11: cache_key
$cache_key = cache_key($class, $subclass, $type);
if (!($items = load_cache(ITEM_LISTING, $cache_key))) {
unset($items);
// Составляем запрос к БД, выполняющий поиск по заданным классу и подклассу
$rows = $DB->select('
SELECT ?#, i.entry, maxcount
{, l.name_loc?d AS name_loc}
FROM ?_icons, item_template i
{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
WHERE
id=displayid
{ AND class = ? }
{ AND subclass = ? }
{ AND InventoryType = ? }
ORDER BY quality DESC, name
{ LIMIT ?d }
', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, isset($class) ? $class : DBSIMPLE_SKIP, isset($subclass) ? $subclass : DBSIMPLE_SKIP, isset($type) ? $type : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$items = array();
foreach ($rows as $row) {
$items[] = iteminfo2($row);
}
save_cache(ITEM_LISTING, $cache_key, $items);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $smarty->get_config_vars('Items'), 'tab' => 0, 'type' => 0, 'typeid' => 0, 'path' => path(0, 0, $type, $subclass, $class));
$smarty->assign('page', $page);
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('items', $items);
// Загружаем страницу
$smarty->display('items.tpl');
示例12: array_unshift
array_unshift($achievement['series'], $tmp);
}
}
$tmp = end($achievement['series']);
while ($tmp) {
$end = end($achievement['series']);
$tmp = $DB->selectRow('
SELECT id, name_loc?d AS name, parent
FROM ?_achievement
WHERE parent = ?
', $_SESSION['locale'], $end['id']);
if ($tmp) {
array_push($achievement['series'], $tmp);
}
}
if (count($achievement['series']) <= 1) {
unset($achievement['series']);
}
save_cache(ACHIEVEMENT_PAGE, $cache_key, $achievement);
}
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $achievement['name'] . ' - ' . $smarty->get_config_vars('Achievement'), 'tab' => 0, 'type' => 9, 'typeid' => $achievement['id'], 'path' => path(0, 9, $achievement['category2'], $achievement['category1']));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('achievement', $achievement);
// Загружаем страницу
$smarty->display('achievement.tpl');
示例13: position
// мы - героик �ПС, определ�ем позицию по нормалу
$npc['position'] = position($normal_entry, 'creature', 2);
} else {
// мы - нормал �ПС или �ПС без �ложно�ти
$npc['position'] = position($npc['entry'], 'creature', 1);
}
// И�править type, чтобы под�вечивали�ь event-овые NPC
if ($npc['position']) {
foreach ($npc['position'] as $z => $zone) {
foreach ($zone['points'] as $p => $pos) {
if ($pos['type'] == 0 && ($events = event_find(array('creature_guid' => $pos['guid'])))) {
$names = array_select_key(event_name($events), 'name');
$npc['position'][$z]['points'][$p]['type'] = 4;
$npc['position'][$z]['points'][$p]['events'] = implode(", ", $names);
}
}
}
}
save_cache(NPC_PAGE, $cache_key, $npc);
}
}
global $page;
$page = array('Mapper' => true, 'Book' => false, 'Title' => $npc['name'] . ' - ' . $smarty->get_config_vars('NPCs'), 'tab' => 0, 'type' => 1, 'typeid' => $npc['entry'], 'path' => path(0, 4, $npc['type']));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
$smarty->assign('npc', $npc);
// Количе�тво MySQL запро�ов
$smarty->assign('mysql', $DB->getStatistics());
// Запу�каем шаблонизатор
$smarty->display('npc.tpl');
示例14: str_normalize
if ($spell['name']) {
$x .= 'name: \'' . str_normalize($spell['name']) . '\',';
}
if ($spell['icon']) {
$x .= 'icon: \'' . str_normalize($spell['icon']) . '\',';
}
if ($spell['info']) {
$x .= 'tooltip: \'' . str_normalize($spell['info']) . '\'';
}
$x .= '});';
break;
case 'quest':
if (!($quest = load_cache(11, $id))) {
require_once 'includes/allquests.php';
$quest = GetDBQuestInfo($id, QUEST_DATAFLAG_AJAXTOOLTIP);
$quest['tooltip'] = GetQuestTooltip($quest);
save_cache(11, $id, $quest);
}
$x .= '$WowheadPower.registerQuest(' . $id . ', 0,{';
if ($quest['name']) {
$x .= 'name: \'' . str_normalize($quest['name']) . '\',';
}
if ($quest['tooltip']) {
$x .= 'tooltip: \'' . str_normalize($quest['tooltip']) . '\'';
}
$x .= '});';
break;
default:
break;
}
echo $x;
示例15: array
$achievements = array();
$achievements['data'] = array();
foreach ($rows as $row) {
$achievements['data'][] = achievementinfo2($row);
}
if (isset($category)) {
$catrow = $DB->selectRow('
SELECT c1.id, c1.name_loc?d AS name, c2.id AS id2
FROM ?_achievementcategory c1
LEFT JOIN (?_achievementcategory c2) ON c1.parentAchievement != -1 AND c1.parentAchievement = c2.id
WHERE
c1.id = ?
', $_SESSION['locale'], $category);
if ($catrow) {
$achievements['category1'] = $catrow['id'];
$achievements['category2'] = $catrow['id2'];
$achievements['category'] = $catrow['name'];
}
}
save_cache(24, $cache_key, $achievements);
}
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => ($achievements['category'] ? $achievements['category'] . ' - ' : '') . $smarty->get_config_vars('Achievements'), 'tab' => 0, 'type' => 9, 'typeid' => 0, 'path' => path(0, 9, $achievements['category1'], $achievements['category2']));
$smarty->assign('page', $page);
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
$smarty->assign('allachievements', $allachievements);
$smarty->assign('achievements', $achievements);
// Загружаем страницу
$smarty->display('achievements.tpl');