本文整理汇总了PHP中getCacheName函数的典型用法代码示例。如果您正苦于以下问题:PHP getCacheName函数的具体用法?PHP getCacheName怎么用?PHP getCacheName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCacheName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: after_action
/**
* Executed after performing the action hooks
*
* Increases counter and purge cache
*/
public function after_action()
{
if ($this->autoinc) {
global $ID;
p_set_metadata($ID, array('bureaucracy' => array($this->get_key() => $this->opt['value'] + 1)));
// Force rerendering by removing the instructions cache file
$cache_fn = getCacheName(wikiFN($ID) . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.' . 'i');
if (file_exists($cache_fn)) {
unlink($cache_fn);
}
}
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:17,代码来源:number.php
示例2: __construct
/**
* Constructor
*
* Loads the cache
*/
public function __construct()
{
global $conf;
$this->logfile = fullpath($conf['metadir'] . '/' . $this->getConf('accesslog'));
// file not found? assume absolute path
if (!file_exists($this->logfile)) {
$this->logfile = $this->getConf('accesslog');
}
// load the cache file
$this->logcache = getCacheName($this->getConf('accesslog'), '.statdisplay');
if (file_exists($this->logcache)) {
$this->logdata = unserialize(io_readFile($this->logcache, false));
}
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:19,代码来源:log.php
示例3: _purgecache
/**
* Check for pages changes and eventually purge cache.
*
* @author Samuele Tognini <[email protected]>
*
* @param Doku_Event $event
* @param mixed $param not defined
*/
function _purgecache(&$event, $param)
{
global $ID;
global $conf;
/** @var cache_parser $cache */
$cache =& $event->data;
if (!isset($cache->page)) {
return;
}
//purge only xhtml cache
if ($cache->mode != "xhtml") {
return;
}
//Check if it is an pagequery page
if (!p_get_metadata($ID, 'pagequery')) {
return;
}
$aclcache = $this->getConf('aclcache');
if ($conf['useacl']) {
$newkey = false;
if ($aclcache == 'user') {
//Cache per user
if ($_SERVER['REMOTE_USER']) {
$newkey = $_SERVER['REMOTE_USER'];
}
} else {
if ($aclcache == 'groups') {
//Cache per groups
global $INFO;
if ($INFO['userinfo']['grps']) {
$newkey = implode('#', $INFO['userinfo']['grps']);
}
}
}
if ($newkey) {
$cache->key .= "#" . $newkey;
$cache->cache = getCacheName($cache->key, $cache->ext);
}
}
//Check if a page is more recent than purgefile.
if (@filemtime($cache->cache) < @filemtime($conf['cachedir'] . '/purgefile')) {
$event->preventDefault();
$event->stopPropagation();
$event->result = false;
}
}
开发者ID:unfoldingWord-dev,项目名称:pagequery,代码行数:54,代码来源:action.php
示例4: handle_cache_aggregation
/**
* For pages containing an aggregation, add the last modified date of the database itself
* to the cache dependencies
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return bool
*/
public function handle_cache_aggregation(Doku_Event $event, $param)
{
global $INPUT;
/** @var \cache_parser $cache */
$cache = $event->data;
if ($cache->mode != 'xhtml') {
return true;
}
if (!$cache->page) {
return true;
}
// not a page cache
$meta = p_get_metadata($cache->page, 'plugin struct');
if (isset($meta['hasaggregation'])) {
/** @var helper_plugin_struct_db $db */
$db = plugin_load('helper', 'struct_db');
// cache depends on last database save
$cache->depends['files'][] = $db->getDB()->getAdapter()->getDbFile();
// dynamic renders should never overwrite the default page cache
// we need this in additon to handle_cache_dynamic() below because we can only
// influence if a cache is used, not that it will be written
if ($INPUT->has(SearchConfigParameters::$PARAM_FILTER) || $INPUT->has(SearchConfigParameters::$PARAM_OFFSET) || $INPUT->has(SearchConfigParameters::$PARAM_SORT)) {
$cache->key .= 'dynamic';
}
// cache depends on today's date
if ($meta['hasaggregation'] & SearchConfig::$CACHE_DATE) {
$oldage = $cache->depends['age'];
$newage = time() - mktime(0, 0, 1);
// time since first second today
$cache->depends['age'] = min($oldage, $newage);
}
// cache depends on current user
if ($meta['hasaggregation'] & SearchConfig::$CACHE_USER) {
$cache->key .= ';' . $INPUT->server->str('REMOTE_USER');
}
// rebuild cachename
$cache->cache = getCacheName($cache->key, $cache->ext);
}
return true;
}
开发者ID:cosmocode,项目名称:dokuwiki-plugin-struct,代码行数:49,代码来源:cache.php
示例5: checkUpdateMessages
/**
* Check for new messages from upstream
*
* @author Andreas Gohr <[email protected]>
*/
function checkUpdateMessages()
{
global $conf;
global $INFO;
global $updateVersion;
if (!$conf['updatecheck']) {
return;
}
if ($conf['useacl'] && !$INFO['ismanager']) {
return;
}
$cf = getCacheName($updateVersion, '.updmsg');
$lm = @filemtime($cf);
// check if new messages needs to be fetched
if ($lm < time() - 60 * 60 * 24 || $lm < @filemtime(DOKU_INC . DOKU_SCRIPT)) {
@touch($cf);
dbglog("checkUpdateMessages(): downloading messages to " . $cf);
$http = new DokuHTTPClient();
$http->timeout = 12;
$resp = $http->get(DOKU_MESSAGEURL . $updateVersion);
if (is_string($resp) && ($resp == "" || substr(trim($resp), -1) == '%')) {
// basic sanity check that this is either an empty string response (ie "no messages")
// or it looks like one of our messages, not WiFi login or other interposed response
io_saveFile($cf, $resp);
} else {
dbglog("checkUpdateMessages(): unexpected HTTP response received");
}
} else {
dbglog("checkUpdateMessages(): messages up to date");
}
$data = io_readFile($cf);
// show messages through the usual message mechanism
$msgs = explode("\n%\n", $data);
foreach ($msgs as $msg) {
if ($msg) {
msg($msg, 2);
}
}
}
开发者ID:esoule,项目名称:dokuwiki,代码行数:44,代码来源:infoutils.php
示例6: getAdjustedSVG
/**
* Gets a local scalable copy of the SVG with its dimensions
*
* @param $id
* @param int $cachetime
* @return bool|array either array($file, $width, $height) or false if no cache available
*/
public function getAdjustedSVG($id, $cachetime = -1)
{
$info = $this->getInfo();
$cachefile = getCacheName($id . $info['date'], '.svg');
$cachedate = @filemtime($cachefile);
if ($cachedate && $cachetime < time() - $cachedate) {
list($width, $height) = $this->readSVGsize($cachefile);
return array($cachefile, $width, $height);
}
// still here, create a new cache file
if (preg_match('/^https?:\\/\\//i', $id)) {
io_download($id, $cachefile);
#FIXME make max size configurable
} else {
@copy(mediaFN($id), $cachefile);
}
clearstatcache(false, $cachefile);
// adjust the size in the cache file
if (file_exists($cachefile)) {
list($width, $height) = $this->readSVGsize($cachefile, true);
return array($cachefile, $width, $height);
}
return false;
}
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:31,代码来源:helper.php
示例7: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <[email protected]>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
// The generated script depends on some dynamic options
$cache = getCacheName('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
// array of core files
$files = array(DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/events.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/ajax.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/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/subscriptions.js', DOKU_TPLINC . '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'];
}
// check cache age & handle conditional request
header('Cache-Control: public, max-age=3600');
header('Pragma: public');
if (js_cacheok($cache, $files)) {
http_conditionalRequest(filemtime($cache));
if ($conf['allowdebug']) {
header("X-CacheUsed: {$cache}");
}
// finally send output
if ($conf['gzip_output'] && http_gzip_valid($cache)) {
header('Vary: Accept-Encoding');
header('Content-Encoding: gzip');
readfile($cache . ".gz");
} else {
if (!http_sendfile($cache)) {
readfile($cache);
}
}
return;
} else {
http_conditionalRequest(time());
}
// start output buffering and build the script
ob_start();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . DOKU_TPL . "';";
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
js_runonstart("addEvent(document,'click',closePopups)");
js_runonstart('addTocToggle()');
js_runonstart("initSizeCtl('size__ctl','wiki__text')");
js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)");
if ($conf['locktime'] != 0) {
js_runonstart("locktimer.init(" . ($conf['locktime'] - 60) . ",'" . js_escape($lang['willexpire']) . "'," . $conf['usedraft'] . ")");
}
js_runonstart('scrollToMarker()');
js_runonstart('focusMarker()');
// 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
// save cache file
io_saveFile($cache, $js);
if (function_exists('gzopen')) {
io_saveFile("{$cache}.gz", $js);
}
// finally send output
if ($conf['gzip_output']) {
header('Vary: Accept-Encoding');
header('Content-Encoding: gzip');
print gzencode($js, 9, FORCE_GZIP);
} else {
print $js;
}
}
开发者ID:ryankask,项目名称:dokuwiki,代码行数:95,代码来源:js.php
示例8: ajax_draftdel
/**
* Delete a draft
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_draftdel()
{
$id = cleanID($_REQUEST['id']);
if (empty($id)) {
return;
}
$client = $_SERVER['REMOTE_USER'];
if (!$client) {
$client = clientIP(true);
}
$cname = getCacheName($client . $id, '.draft');
@unlink($cname);
}
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:18,代码来源:ajax.php
示例9: p_xhtml_cached_geshi
/**
* Wrapper for GeSHi Code Highlighter, provides caching of its output
*
* @author Christopher Smith <[email protected]>
*/
function p_xhtml_cached_geshi($code, $language)
{
$cache = getCacheName($language . $code, ".code");
if (@file_exists($cache) && !$_REQUEST['purge'] && filemtime($cache) > filemtime(DOKU_INC . 'inc/geshi.php')) {
$highlighted_code = io_readFile($cache, false);
@touch($cache);
} else {
require_once DOKU_INC . 'inc/geshi.php';
$geshi = new GeSHi($code, strtolower($language), DOKU_INC . 'inc/geshi');
$geshi->set_encoding('utf-8');
$geshi->enable_classes();
$geshi->set_header_type(GESHI_HEADER_PRE);
$geshi->set_overall_class("code {$language}");
$geshi->set_link_target($conf['target']['extern']);
$highlighted_code = $geshi->parse_code();
io_saveFile($cache, $highlighted_code);
}
return $highlighted_code;
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:24,代码来源:parserutils.php
示例10: pageinfo
/**
* Return info about the current document as associative
* array.
*
* @author Andreas Gohr <[email protected]>
*/
function pageinfo()
{
global $ID;
global $REV;
global $USERINFO;
global $conf;
// include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
// FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
$info['id'] = $ID;
$info['rev'] = $REV;
if ($_SERVER['REMOTE_USER']) {
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($ID);
$info['subscribed'] = is_subscribed($ID, $_SERVER['REMOTE_USER']);
$info['client'] = $_SERVER['REMOTE_USER'];
// if some outside auth were used only REMOTE_USER is set
if (!$info['userinfo']['name']) {
$info['userinfo']['name'] = $_SERVER['REMOTE_USER'];
}
} else {
$info['perm'] = auth_aclcheck($ID, '', null);
$info['subscribed'] = false;
$info['client'] = clientIP(true);
}
$info['namespace'] = getNS($ID);
$info['locked'] = checklock($ID);
$info['filepath'] = realpath(wikiFN($ID));
$info['exists'] = @file_exists($info['filepath']);
if ($REV) {
//check if current revision was meant
if ($info['exists'] && @filemtime($info['filepath']) == $REV) {
$REV = '';
} else {
//really use old revision
$info['filepath'] = realpath(wikiFN($ID, $REV));
$info['exists'] = @file_exists($info['filepath']);
}
}
$info['rev'] = $REV;
if ($info['exists']) {
$info['writable'] = is_writable($info['filepath']) && $info['perm'] >= AUTH_EDIT;
} else {
$info['writable'] = $info['perm'] >= AUTH_CREATE;
}
$info['editable'] = $info['writable'] && empty($info['lock']);
$info['lastmod'] = @filemtime($info['filepath']);
//load page meta data
$info['meta'] = p_get_metadata($ID);
//who's the editor
if ($REV) {
$revinfo = getRevisionInfo($ID, $REV, 1024);
} else {
$revinfo = isset($info['meta']['last_change']) ? $info['meta']['last_change'] : getRevisionInfo($ID, $info['lastmod'], 1024);
}
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
// See also $INFO['meta']['last_change'] which is the most recent log line for page $ID.
// Use $INFO['meta']['last_change']['type']==='e' in place of $info['minor'].
if ($revinfo['user']) {
$info['editor'] = $revinfo['user'];
} else {
$info['editor'] = $revinfo['ip'];
}
// draft
$draft = getCacheName($info['client'] . $ID, '.draft');
if (@file_exists($draft)) {
if (@filemtime($draft) < @filemtime(wikiFN($ID))) {
// remove stale draft
@unlink($draft);
} else {
$info['draft'] = $draft;
}
}
return $info;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:82,代码来源:common.php
示例11: pageinfo
/**
* Return info about the current document as associative
* array.
*
* @author Andreas Gohr <[email protected]>
*
* @return array with info about current document
*/
function pageinfo()
{
global $ID;
global $REV;
global $RANGE;
global $lang;
/* @var Input $INPUT */
global $INPUT;
$info = basicinfo($ID);
// include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
// FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
$info['id'] = $ID;
$info['rev'] = $REV;
if ($INPUT->server->has('REMOTE_USER')) {
$sub = new Subscription();
$info['subscribed'] = $sub->user_subscription();
} else {
$info['subscribed'] = false;
}
$info['locked'] = checklock($ID);
$info['filepath'] = fullpath(wikiFN($ID));
$info['exists'] = file_exists($info['filepath']);
$info['currentrev'] = @filemtime($info['filepath']);
if ($REV) {
//check if current revision was meant
if ($info['exists'] && $info['currentrev'] == $REV) {
$REV = '';
} elseif ($RANGE) {
//section editing does not work with old revisions!
$REV = '';
$RANGE = '';
msg($lang['nosecedit'], 0);
} else {
//really use old revision
$info['filepath'] = fullpath(wikiFN($ID, $REV));
$info['exists'] = file_exists($info['filepath']);
}
}
$info['rev'] = $REV;
if ($info['exists']) {
$info['writable'] = is_writable($info['filepath']) && $info['perm'] >= AUTH_EDIT;
} else {
$info['writable'] = $info['perm'] >= AUTH_CREATE;
}
$info['editable'] = $info['writable'] && empty($info['locked']);
$info['lastmod'] = @filemtime($info['filepath']);
//load page meta data
$info['meta'] = p_get_metadata($ID);
//who's the editor
$pagelog = new PageChangeLog($ID, 1024);
if ($REV) {
$revinfo = $pagelog->getRevisionInfo($REV);
} else {
if (!empty($info['meta']['last_change']) && is_array($info['meta']['last_change'])) {
$revinfo = $info['meta']['last_change'];
} else {
$revinfo = $pagelog->getRevisionInfo($info['lastmod']);
// cache most recent changelog line in metadata if missing and still valid
if ($revinfo !== false) {
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
}
}
//and check for an external edit
if ($revinfo !== false && $revinfo['date'] != $info['lastmod']) {
// cached changelog line no longer valid
$revinfo = false;
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
// See also $INFO['meta']['last_change'] which is the most recent log line for page $ID.
// Use $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT in place of $info['minor'].
if ($revinfo['user']) {
$info['editor'] = $revinfo['user'];
} else {
$info['editor'] = $revinfo['ip'];
}
// draft
$draft = getCacheName($info['client'] . $ID, '.draft');
if (file_exists($draft)) {
if (@filemtime($draft) < @filemtime(wikiFN($ID))) {
// remove stale draft
@unlink($draft);
} else {
$info['draft'] = $draft;
}
}
return $info;
//.........这里部分代码省略.........
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:101,代码来源:common.php
示例12: __construct
/**
* @param string $key primary identifier
* @param string $ext file extension
*/
public function __construct($key, $ext)
{
$this->key = $key;
$this->ext = $ext;
$this->cache = getCacheName($key, $ext);
}
开发者ID:kevinlovesing,项目名称:dokuwiki,代码行数:10,代码来源:cache.php
示例13: registerOnLoad
function registerOnLoad($js)
{
global $ID;
global $lang;
$preview_button = $lang['btn_preview'];
$fckg_conf_direction = $this->getConf('direction');
if ($fckg_conf_direction == "dokuwiki") {
$fckg_lang_direction = $lang['direction'];
} else {
$fckg_lang_direction = $fckg_conf_direction;
}
$media_tmp_ns = preg_match('/:/', $ID) ? preg_replace('/:\\w+$/', "", $ID, 1) : "";
$locktimer_msg = "Your lock for editing this page is about to expire in a minute.\\n" . "You can reset the timer by clicking the Back-up button.";
$meta_fn = metaFN($ID, '.fckg');
$meta_id = 'meta/' . str_replace(':', '/', $ID) . '.fckg';
global $INFO;
global $conf;
global $USERINFO;
$_OS = strtolower(PHP_OS);
$cname = getCacheName($INFO['client'] . $ID, '.draft');
$open_upload = $this->getConf('open_upload');
$editor_backup = $this->getConf('editor_bak');
$create_folder = $this->getConf('create_folder');
if (!isset($INFO['userinfo']) && !$open_upload) {
$user_type = 'visitor';
} else {
$user_type = 'user';
}
// if no ACL is used always return upload rights
if ($conf['useacl']) {
$client = $_SERVER['REMOTE_USER'];
} else {
$client = "";
}
$fnencode = isset($conf['fnencode']) ? $conf['fnencode'] : 'url';
$user_groups = $USERINFO['grps'];
if (!$user_groups) {
$user_groups = array();
}
if (@in_array("guest", $user_groups)) {
$create_folder = 'n';
$user_type = 'visitor';
}
$user_groups = implode(";;", $user_groups);
if ($INFO['isadmin'] || $INFO['ismanager']) {
$client = "";
}
$user_name = $USERINFO['name'];
$user_email = $USERINFO['mail'];
$ver_anteater = mktime(0, 0, 0, 11, 7, 2010);
$dwiki_version = mktime(0, 0, 0, 01, 01, 2008);
if (isset($conf['fnencode'])) {
$ver_anteater = mktime(0, 0, 0, 11, 7, 2010);
$dwiki_version = mktime(0, 0, 0, 11, 7, 2010);
} else {
if (function_exists('getVersionData')) {
$verdata = getVersionData();
if (isset($verdata) && preg_match('/(\\d+)-(\\d+)-(\\d+)/', $verdata['date'], $ver_date)) {
if ($ver_date[1] >= 2005 && ($ver_date[3] > 0 && $ver_date[3] < 31) && ($ver_date[2] > 0 && $ver_date[2] <= 12)) {
// month day year
$dwiki_version = @mktime(0, 0, 0, $ver_date[2], $ver_date[3], $ver_date[1]);
if (!$dwiki_version) {
$dwiki_version = mktime(0, 0, 0, 01, 01, 2008);
}
$ver_anteater = mktime(0, 0, 0, 11, 7, 2010);
}
}
}
}
$default_fb = $this->getConf('default_fb');
if ($default_fb == 'none') {
$client = "";
}
$doku_base = DOKU_BASE;
return <<<end_of_string
<script type='text/javascript'>
//<![CDATA[
if(window.dw_locktimer) {
var locktimer = dw_locktimer;
}
var FCKRecovery = "";
var oldonload = window.onload;
var ourLockTimerINI = false;
var oldBeforeunload;
var fckg_onload = function() { {$js} };
jQuery(window).bind('load',{},fckg_onload);
function fckgEditorTextChanged() {
window.textChanged = false;
oldBeforeunload();
if(window.dwfckTextChanged) {
return LANG.notsavedyet;
}
}
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:helper.php
示例14: get_resized_image
function get_resized_image($width, $height, $override_sizetype = '', $filetype = '')
{
global $ihConf;
$sizetype = $override_sizetype == '' ? $this->sizetype : $override_sizetype;
switch ($sizetype) {
case 'large':
$file_extension = $ihConf['large']['filetype'] == 'no_change' ? $this->extension : '.' . $ihConf['large']['filetype'];
$background = $ihConf['large']['bg'];
$quality = $ihConf['large']['quality'];
$width = $ihConf['large']['width'];
$height = $ihConf['large']['height'];
break;
case 'medium':
$file_extension = $ihConf['medium']['filetype'] == 'no_change' ? $this->extension : '.' . $ihConf['medium']['filetype'];
$background = $ihConf['medium']['bg'];
$quality = $ihConf['medium']['quality'];
break;
case 'small':
$file_extension = $ihConf['small']['filetype'] == 'no_change' ? $this->extension : '.' . $ihConf['small']['filetype'];
$background = $ihConf['small']['bg'];
$quality = $ihConf['small']['quality'];
break;
default:
$file_extension = $this->extension;
$background = $ihConf['default']['bg'];
$quality = $ihConf['default']['quality'];
break;
}
list($newwidth, $newheight, $resize) = $this->calculate_size($width, $height);
// set canvas dimensions
if ($newwidth > 0 && $newheight > 0) {
$this->canvas['width'] = $newwidth;
$this->canvas['height'] = $newheight;
}
$this->initialize_overlays($sizetype);
// override filetype?
$file_extension = $filetype == '' ? $file_extension : $filetype;
// Do we need to resize, watermark, zoom or convert to another filetype?
if ($resize || $this->watermark['file'] != '' || $this->zoom['file'] != '' || $file_extension != $this->extension) {
$local = getCacheName($this->src . $this->watermark['file'] . $this->zoom['file'] . $quality . $background . $ihConf['watermark']['gravity'] . $ihConf['zoom']['gravity'], '.image.' . $newwidth . 'x' . $newheight . $file_extension);
//echo $local . '<br />';
$mtime = @filemtime($local);
// 0 if not exists
if ($mtime > @filemtime($this->filename) && $mtime > @filemtime($this->watermark['file']) && $mtime > @filemtime($this->zoom['file']) || $this->resize_imageIM($file_extension, $local, $background, $quality) || $this->resize_imageGD($file_extension, $local, $background, $quality)) {
return str_replace($ihConf['dir']['docroot'], '', $local);
}
//still here? resizing failed
}
return $this->src;
}
开发者ID:andychang88,项目名称:daddy-store.com,代码行数:50,代码来源:bmz_image_handler.class.php
示例15: getLocalBinary
/**
* Returns the local binary to use
*
* Downloads it if necessary
*
* @return bool|string
*/
protected function getLocalBinary()
{
global $conf;
$bin = $this->getBinaryName();
if (!$bin) {
return false;
}
// check distributed files first
if (file_exists(__DIR__ . '/ditaa/' . $bin)) {
return __DIR__ . '/ditaa/' . $bin;
}
$info = $this->getInfo();
$cache = getCacheName($info['date'], ".{$bin}");
if (file_exists($cache)) {
return $cache;
}
$url = 'https://github.com/akavel/ditaa/releases/download/g1.0.0/' . $bin;
if (io_download($url, $cache, false, '', 0)) {
@chmod($cache, $conf['dmode']);
return $cache;
}
return false;
}
开发者ID:splitbrain,项目名称:dokuwiki-plugin-ditaa,代码行数:30,代码来源:syntax.php
示例16: ajax_draftdel
/**
* Delete a draft
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_draftdel()
{
global $INPUT;
$id = cleanID($INPUT->str('id'));
if (empty($id)) {
return;
}
$client = $_SERVER['REMOTE_USER'];
if (!$client) {
$client = clientIP(true);
}
$cname = getCacheName($client . $id, '.draft');
@unlink($cname);
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:19,代码来源:ajax.php
示例17: cache
function cache($key, $ext)
{
$this->key = $key;
$this->ext = $ext;
$this->cache = getCacheName($key, $ext);
}
开发者ID:pyfun,项目名称:dokuwiki,代码行数:6,代码来源:cache.php
示例18: _preprocess
//.........这里部分代码省略.........
if(preg_match("/\\w+/",$matches[2])) {
$matches[4] = str_replace("CHEVRONescC", ">>",$matches[4]);
$matches[4] = str_replace("CHEVRONescO", "<<",$matches[4]);
$matches[4] = preg_replace("/<(?!\\s)/ms", "__GESHI_OPEN__", $matches[4]);
}
else {
if( preg_match("/MULTI/",$matches[0])) {
$open = "< ";
$close = " >";
}
else {
$open = "<";
$close = ">";
}
$matches[4] = preg_replace("/<(?!\\s)/ms", $open, $matches[4]);
$matches[4] = preg_replace("/(?<!\\s)>/ms", $close, $matches[4]);
}
$matches[4] = str_replace("\\"", "__GESHI_QUOT__", $matches[4]);
return "<" . $matches[1] . $matches[2] . $matches[3] . $matches[4] . $matches[5];'), $text);
/* \n_ckgedit_NPBBR_\n: the final \n prevents this from iterfering with next in line markups
-- in particular tables which require a new line and margin left
this may leave an empty paragraph in the xhtml, which is removed below
*/
$text = preg_replace('/<\\/(code|file)>(\\s*)(?=[^\\w])(\\s*)/m', "</\$1>\n_ckgedit_NPBBR_\n\$2", $text);
$text = preg_replace_callback('/~~START_HTML_BLOCK~~.*?CLOSE_HTML_BLOCK/ms', create_function('$matches', '$matches[0] = str_replace("_ckgedit_NPBBR_","",$matches[0]);
return $matches[0];'), $text);
$text = preg_replace_callback('/(\\|\\s*)(<code>|<file>)(.*?)(<\\/code>|<\\/file>)\\n_ckgedit_NPBBR_(?=.*?\\|)/ms', create_function('$matches', '$matches[2] = preg_replace("/<code>/ms", "TPRE_CODE", $matches[2]);
$matches[2] = preg_replace("/<file>/ms", "TPRE_FILE", $matches[2]);
$matches[4] = "TPRE_CLOSE";
$matches[3] = preg_replace("/^\\n+/", "TC_NL",$matches[3]);
$matches[3] = preg_replace("/\\n/ms", "TC_NL",$matches[3]);
return $matches[1] . $matches[2] . trim($matches[3]) . $matches[4];'), $text);
$text = preg_replace('/TPRE_CLOSE\\s+/ms', "TPRE_CLOSE", $text);
$text = preg_replace('/<(?!code|file|del|sup|sub|\\/\\/|\\s|\\/del|\\/code|\\/file|\\/sup|\\/sub)/ms', "<", $text);
$text = str_replace('%%<', '%%<', $text);
}
if ($this->getConf('duplicate_notes')) {
$text = preg_replace_callback('/\\(\\((.*?)\\)\\)/ms', create_function('$matches', 'static $count = 0;
$count++;
$ins = "FNoteINSert" . $count;
$needles = array("[","]", "/", ".", "*", "_","\'","<",">","%", "{", "}", "\\\\","(");
$replacements = array("[","]","/", ".", "*", "_", "'", "<",">","%", "{","}", "\","(");
$matches[1] = str_replace($needles, $replacements, $matches[1]);
return "(($ins" . $matches[1] . "))" ;'), $text);
}
$text = preg_replace('/^\\>/ms', "_QUOT_", $text);
// dw quotes
$text = str_replace('>>', 'CHEVRONescC', $text);
$text = str_replace('<<', 'CHEVRONescO', $text);
$text = preg_replace('/(={3,}.*?)(\\{\\{.*?\\}\\})(.*?={3,})/', "\$1\$3\n\$2", $text);
$email_regex = '/\\/\\/\\<\\/\\/(.*?@.*?)>/';
$text = preg_replace($email_regex, "<\$1>", $text);
$text = preg_replace('/{{(.*)\\.swf(\\s*)}}/ms', "__SWF__\$1.swf\$2__FWS__", $text);
$this->xhtml = $this->_render_xhtml($text);
$this->xhtml = str_replace("__IWIKI_FSLASH__", "⁄", $this->xhtml);
if ($this->getConf('duplicate_notes')) {
$this->xhtml = preg_replace("/FNoteINSert\\d+/ms", "", $this->xhtml);
}
$this->xhtml = str_replace("__GESHI_QUOT__", '"', $this->xhtml);
$this->xhtml = str_replace("__GESHI_OPEN__", "< ", $this->xhtml);
$this->xhtml = str_replace('CHEVRONescC', '>>', $this->xhtml);
$this->xhtml = str_replace('CHEVRONescO', '<<', $this->xhtml);
$this->xhtml = preg_replace('/_QUOT_/ms', '>', $this->xhtml);
// dw quotes
if ($pos !== false) {
$this->xhtml = preg_replace_callback('/(TPRE_CODE|TPRE_FILE)(.*?)(TPRE_CLOSE)/ms', create_function('$matches', '$matches[1] = preg_replace("/TPRE_CODE/","<pre class=\'code\'>\\n", $matches[1]);
$matches[1] = preg_replace("/TPRE_FILE/","<pre class=\'file\'>\\n", $matches[1]);
$matches[2] = preg_replace("/TC_NL/ms", "\\n", $matches[2]);
$matches[3] = "</pre>";
return $matches[1] . $matches[2] . $matches[3];'), $this->xhtml);
}
$this->xhtml = preg_replace_callback('/~~START_HTML_BLOCK~~[\\n\\s]*(.*?)CLOSE_HTML_BLOCK/ms', create_function('$matches', '$matches[1] = str_replace("&","&",$matches[1]);
$matches[1] = html_entity_decode($matches[1],ENT_QUOTES, "UTF-8");
$matches[1] = preg_replace("/<\\/?code.*?>/", "",$matches[1]);
$matches[1] = preg_replace("/^\\s*<\\/p>/","",$matches[1]);
$tmp = explode("\\n", $matches[1]);
for($n=0; $n<7; $n++) {
if( (preg_match("/(<p>\\s*)*( |\\s+)<\\/p>/",$tmp[$n])) || (preg_match("/^\\s+$/",$tmp[$n]))) {
unset($tmp[$n]);
}
}
return "~~START_HTML_BLOCK~~" . implode("\\n",$tmp) . "CLOSE_HTML_BLOCK"; '), $this->xhtml);
$this->xhtml = preg_replace_callback('/(<pre)(.*?)(>)(.*?)(<\\/pre>)/ms', create_function('$matches', '$matches[4] = preg_replace("/(\\||\\^)[ ]+(\\||\\^)/ms","$1 $2" , $matches[4]);
return $matches[1] . $matches[2] . $matches[3] . $matches[4] . $matches[5];'), $this->xhtml);
$this->xhtml = preg_replace_callback('/~~MULTI_PLUGIN_OPEN~~(.*?)~~MULTI_PLUGIN_CLOSE~~/ms', create_function('$matches', 'return str_replace("<", "< ",$matches[0]);'), $this->xhtml);
$cname = getCacheName($INFO['client'] . $ID, '.draft.fckl');
if (file_exists($cname)) {
$cdata = unserialize(io_readFile($cname, false));
$cdata['text'] = urldecode($cdata['text']);
preg_match_all("/<\\/(.*?)\\>/", $cdata['text'], $matches);
/* exclude drafts saved from preview mode */
if (!in_array('code', $matches[1]) && !in_array('file', $matches[1]) && !in_array('nowiki', $matches[1])) {
$this->draft_text = $cdata['text'];
$this->draft_found = true;
msg($this->getLang('draft_msg'));
}
unlink($cname);
}
return true;
}
开发者ID:a-gundy,项目名称:ckgedit,代码行数:101,代码来源:edit.php
示例19: getCacheName
$pl->gfx_error('maxzoom');
}
if ($data['inv'] < 1.0) {
$data['inv'] = 1.0;
}
// original size, no upscaling
// calculate tile boundaries
$data['tlx'] = (int) ($data['col'] * $data['ts'] * $data['inv']);
$data['tly'] = (int) ($data['row'] * $data['ts'] * $data['inv']);
$data['brx'] = (int) ($data['tlx'] + $data['ts'] * $data['inv']);
$data['bry'] = (int) ($data['tly'] + $data['ts'] * $data['inv']);
if ($data['tlx'] > $data['width'] || $data['tly'] > $data['height']) {
$pl->gfx_error('blank');
}
// cache times
$data['cache'] = getCacheName($data['file'], '.pv.' . $data['zoom'] . '-' . $data['col'] . '-' . $data['row'] . '.jpg');
$data['cachet'] = @filemtime($data['cache']);
// (re)generate
if ($data['cachet'] < $data['mtime']) {
$pl->tile_lock($data);
if ($conf['im_convert']) {
$pl->tile_im($data);
} else {
$pl->tile_gd($data);
}
$pl->tile_unlock($data);
}
// send
header('Content-type: image/jpeg');
http_conditionalRequest(max($data['mtime'], $data['selft']));
//use x-sendfile header to pass the delivery to compatible webservers
开发者ID:splitbrain,项目名称:dokuwiki-plugin-panoview,代码行数:31,代码来源:tiles.p |
请发表评论