function clearPluginSettingCache() { $gCacheStorage = globalCacheStorage::getInstance(); $context = Model_Context::getInstance(); $context->unsetProperty('plugin.setting'); $gCacheStorage->purge(); $pageCache = pageCache::getInstance(); $pageCache->reset('PluginSettings'); $pageCache->purge(); }
function clearPluginSettingCache() { global $pluginSetting, $gCacheStorage; $gCacheStorage->purge(); if (!empty($pluginSetting)) { $pluginSetting = array(); } $pageCache = pageCache::getInstance(); $pageCache->reset('PluginSettings'); $pageCache->purge(); }
public static function getBlock($name) { $sql = sql::factory(); $sql->query("SELECT * FROM " . sql::table('blocks') . " WHERE name = '" . $name . "'")->result(); if (!self::isInCategory($sql->get('is-structure'), $sql->getArray('structure'))) { return ''; } else { if (!pageCache::exist($sql->get('id'), false, 'block')) { pageCache::generateArticle($sql->get('id'), true); } $content = pageCache::read($sql->get('id'), 'block'); return pageArea::getEval($content); } }
public function getTemplate() { ob_start(); if (!pageCache::exist($this->get('id'))) { pageCache::generateArticle($this->get('id')); } $content = pageCache::read($this->get('id')); $content = pageArea::getEval($content); $content = extension::get('FRONTEND_OUTPUT', $content); dyn::add('content', $content); include dir::template(dyn::get('template'), $this->get('template')); $content = ob_get_contents(); ob_end_clean(); return $content; }
<?php /// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) define('NO_SESSION', true); define('__TEXTCUBE_LOGIN__', true); define('__TEXTCUBE_CUSTOM_HEADER__', true); require ROOT . '/library/preprocessor.php'; importlib("model.blog.feed"); requireStrictBlogURL(); $children = array(); $cache = pageCache::getInstance(); $cache->reset('linesRSS'); if (!$cache->load()) { $result = getLinesFeed(getBlogId(), 'public', 'rss'); if ($result !== false) { $cache->reset('linesRSS'); $cache->contents = $result; $cache->update(); } } header('Content-Type: application/rss+xml; charset=utf-8'); fireEvent('FeedOBStart'); echo fireEvent('ViewLinesRSS', $cache->contents); fireEvent('FeedOBEnd');
function purgeItems($items) { if (!empty($items)) { $cache = pageCache::getInstance(); foreach ($items as $item) { $cache->reset(); $cache->name = $item; $cache->purge(); } } }
function setCommentsOnRSS($blogid, $commentsOnRSS) { $ctx = Model_Context::getInstance(); if ($commentsOnRSS == $ctx->getProperty('blog.commentsOnRSS')) { return true; } if (Setting::setBlogSettingGlobal('commentsOnRSS', $commentsOnRSS) === false) { return false; } $ctx->setProperty('blog.commentsOnRSS', $commentsOnRSS); $cache = pageCache::getInstance(); $cache->name = 'commentRSS'; $cache->purge(); return true; }
} if (ajax::is()) { $sort = type::post('array', 'array'); $sql = sql::factory(); $sql->setTable('structure_area'); foreach ($sort as $s => $s_id) { $sql->setWhere('id=' . $s_id . ' AND block = 0'); $sql->addPost('sort', $s + 1); $sql->update(); } pageCache::generateArticle($structure_id); ajax::addReturn(message::success(lang::get('save_sorting'), true)); } if ($action == 'delete' && dyn::get('user')->hasPerm('page[delete]')) { $id = pageAreaAction::delete($id); pageCache::deleteFile($id); echo message::success(lang::get('structure_content_delete')); } $pageSql = sql::factory(); $pageSql->result('SELECT name FROM ' . sql::table('structure') . ' WHERE id = ' . $structure_id); if ($action == 'add' || $action == 'edit') { $where = 'AND s.id = ' . $id; } else { $where = ''; } $sql = sql::factory(); $sql->result('SELECT s.*, m.name, m.output, m.input FROM ' . sql::table('structure_area') . ' as s LEFT JOIN ' . sql::table('module') . ' as m ON m.id = s.modul
function getEntryContentView($blogid, $id, $content, $formatter, $keywords = array(), $type = 'Post', $useAbsolutePath = true, $bRssMode = false) { $context = Model_Context::getInstance(); importlib('model.blog.attachment'); importlib('model.blog.keyword'); importlib('blogskin'); $context = Model_Context::getInstance(); $cacheKey = 'entry-' . $id . '-' . $type . ($bRssMode ? 'format' : 'summarize') . ($useAbsolutePath ? 'absoultePath' : 'relativePath') . $context->getProperty('blog.displaymode', 'desktop'); $cache = pageCache::getInstance(); $cache->reset($cacheKey); if (!defined('__TEXTCUBE_NO_ENTRY_CACHE__') && $cache->load()) { // If cached content exists. $view = $cache->contents; } else { // No cache is found. $content = fireEvent('Format' . $type . 'Content', $content, $id); $func = $bRssMode ? 'summarizeContent' : 'formatContent'; $view = $func($blogid, $id, $content, $formatter, $keywords, $useAbsolutePath); if ($context->getProperty('blog.displaymode', 'desktop') == 'mobile') { $view = stripHTML($view, array('a', 'abbr', 'acronym', 'address', 'b', 'blockquote', 'br', 'caption', 'cite', 'code', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'iframe', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 'q', 's', 'samp', 'span', 'strike', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u', 'ul', 'var')); } if (!$useAbsolutePath) { $view = avoidFlashBorder($view); } if (!empty($keywords) && is_array($keywords)) { $view = bindKeywords($keywords, $view); } // image resampling if (Setting::getBlogSettingGlobal('resamplingDefault') == true) { preg_match_all("@<img.+src=['\"](.+)['\"](.*)/?>@Usi", $view, $images, PREG_SET_ORDER); $view = preg_replace("@<img.+src=['\"].+['\"].*/?>@Usi", '[#####_#####_#####_image_#####_#####_#####]', $view); $contentWidth = Utils_Misc::getContentWidth(); if (count($images) > 0) { for ($i = 0; $i < count($images); $i++) { if (strtolower(Utils_Misc::getFileExtension($images[$i][1])) == 'gif') { $view = preg_replace('@\\[#####_#####_#####_image_#####_#####_#####\\]@', $images[$i][0], $view, 1); continue; } $attributes = preg_match('/(style="cursor: pointer;" onclick="open_img\\((.[^"]+)\\); return false;")/si', $images[$i][2], $matches) ? ' ' . $matches[1] : ''; $attributes .= preg_match('/(alt="([^"]*)")/si', $images[$i][2], $matches) ? ' ' . $matches[1] : ' alt="resize"'; $attributes .= preg_match('/(title="([^"]*)")/si', $images[$i][2], $matches) ? $title = ' ' . $matches[1] : ''; $tempFileName = array_pop(explode('/', $images[$i][1])); if (preg_match('/(.+)\\.w(\\d{1,})\\-h(\\d{1,})\\.(.+)/', $tempFileName, $matches)) { $tempFileName = $matches[1] . '.' . $matches[4]; } $newImage = $images[$i][0]; if (file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$tempFileName}")) { $tempAttributes = Utils_Misc::getAttributesFromString($images[$i][2]); $tempOriginInfo = getimagesize(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$tempFileName}"); if (isset($tempAttributes['width']) && $tempOriginInfo[0] > $tempAttributes['width']) { $image = Utils_Image::getInstance(); list($tempImageURL, $tempImageWidth, $tempImageHeight, $tempImageSrc) = $image->getImageResizer($tempFileName, array('width' => $tempAttributes['width'])); $newImage = "<img src=\"{$tempImageURL}\" width=\"{$tempImageWidth}\" height=\"{$tempImageHeight}\"{$attributes}/>"; } } $view = preg_replace('@\\[#####_#####_#####_image_#####_#####_#####\\]@', $newImage, $view, 1); } } } $cache->contents = $view; $cache->update(); } $cache->reset(); $view = fireEvent('View' . $type . 'Content', $view, $id); return $view; }
function invalidateCaches() { unset($_SESSION['tags']); // Purge cache attached to session. pageCache::purgeCache(); // Purge page cache shared by sessions. }
<?php if ($action == 'deleteCache') { cache::clear(); pageCache::clearAll(); extension::get('SETTINGS_DELETE_CACHE'); echo message::success(lang::get('delete_cache_success'), true); } if ($action == 'loadTemplate') { $template = new template(dyn::get('template')); if ($template->install(true) !== true) { echo message::danger(lang::get('load_template_failed'), true); } else { echo message::success(lang::get('load_template_success'), true); } } ?> <div class="row"> <div class="col-lg-8"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title pull-left"><?php echo lang::get('general'); ?> </h3> <div class="pull-right"> <a href="<?php echo url::backend('settings', ['subpage' => 'main', 'action' => 'deleteCache']); ?> " class="btn btn-sm btn-default"><?php echo lang::get('delete_cache');
function setCommentsOnRSS($blogid, $commentsOnRSS) { global $blog; requireModel('blog.feed'); if ($commentsOnRSS == $blog['commentsOnRSS']) { return true; } if (Setting::setBlogSettingGlobal('commentsOnRSS', $commentsOnRSS) === false) { return false; } $blog['commentsOnRSS'] = $commentsOnRSS; $cache = pageCache::getInstance(); $cache->name = 'commentRSS'; $cache->purge(); return true; }
} if (ajax::is()) { $sort = type::post('array', 'array'); $sql = sql::factory(); $sql->setTable('structure_area'); foreach ($sort as $s => $s_id) { $sql->setWhere('id=' . $s_id . ' AND block = 1'); $sql->addPost('sort', $s + 1); $sql->update(); } pageCache::generateArticle($structure_id, true); ajax::addReturn(message::success(lang::get('save_sorting'), true)); } if ($action == 'delete') { $id = pageAreaAction::delete($id, true); pageCache::deleteFile($id, 'block'); echo message::success(lang::get('structure_content_delete')); } $blockSql = sql::factory(); $blockSql->result('SELECT name FROM ' . sql::table('blocks') . ' WHERE id = ' . $structure_id); ?> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title pull-left"><?php echo $blockSql->get('name'); ?> </h3> <div class="pull-right"> <a href="<?php