示例#1
0
function clearPluginSettingCache()
{
    $gCacheStorage = globalCacheStorage::getInstance();
    $context = Model_Context::getInstance();
    $context->unsetProperty('plugin.setting');
    $gCacheStorage->purge();
    $pageCache = pageCache::getInstance();
    $pageCache->reset('PluginSettings');
    $pageCache->purge();
}
示例#2
0
function clearPluginSettingCache()
{
    global $pluginSetting, $gCacheStorage;
    $gCacheStorage->purge();
    if (!empty($pluginSetting)) {
        $pluginSetting = array();
    }
    $pageCache = pageCache::getInstance();
    $pageCache->reset('PluginSettings');
    $pageCache->purge();
}
示例#3
0
<?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();
         }
     }
 }
示例#5
0
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;
}
示例#6
0
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;
}
示例#7
0
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;
}