本文整理汇总了PHP中CacheHandler类的典型用法代码示例。如果您正苦于以下问题:PHP CacheHandler类的具体用法?PHP CacheHandler怎么用?PHP CacheHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CacheHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Returns the current template directory
*
* @since 1.0
* @see get_option
* @todo This is dirrrty dirrrty code. Fix ASAP.
*
* @param string $view Name of the current view
* @param string $prefix String to prefix to the cache ID, defaults to template name
* @return string
*/
public static function load($view = 'chrono', $prefix = '')
{
if (empty($prefix)) {
$prefix = get_option('template');
}
$current = Templates::get_current();
$view_file = $view . '.php';
$cache = new CacheHandler();
$cache->begin_caching($prefix . $_SERVER['REQUEST_URI']);
if (file_exists($current['Template Dir'] . '/' . $view_file)) {
require_once $current['Template Dir'] . '/' . $view_file;
} else {
require_once $current['Template Dir'] . '/index.php';
}
$cache->end_caching($prefix . $_SERVER['REQUEST_URI']);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:27,代码来源:class-templates.php
示例2: read
function read($session_key)
{
if (!$session_key || !$this->session_started) {
return;
}
$oCacheHandler =& CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$cache_key = 'object:' . $session_key;
$output->data = $oCacheHandler->get($cache_key);
}
if (!$output->data) {
$args->session_key = $session_key;
$columnList = array('session_key', 'cur_mid', 'val');
$output = executeQuery('session.getSession', $args, $columnList);
// Confirm there is a table created if read error occurs
if (!$output->toBool()) {
$oDB =& DB::getInstance();
if (!$oDB->isTableExists('session')) {
$oDB->createTableByXmlFile($this->module_path . 'schemas/session.xml');
}
if (!$oDB->isColumnExists("session", "cur_mid")) {
$oDB->addColumn('session', "cur_mid", "varchar", 128);
}
$output = executeQuery('session.getSession', $args);
}
// Check if there is a table created in case there is no "cur_mid" value in the sessions information
if (!isset($output->data->cur_mid)) {
$oDB =& DB::getInstance();
if (!$oDB->isColumnExists("session", "cur_mid")) {
$oDB->addColumn('session', "cur_mid", "varchar", 128);
}
}
}
return $output->data->val;
}
开发者ID:relip,项目名称:xe-core,代码行数:35,代码来源:session.model.php
示例3: isInsertedTodayStatus
/**
* Check if a row of today's counter status exists
*
* @param integer $site_srl Site_srl
* @return bool
*/
function isInsertedTodayStatus($site_srl = 0)
{
$args = new stdClass();
$args->regdate = date('Ymd');
$insertedTodayStatus = false;
$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
if ($oCacheHandler->isSupport()) {
$cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
$insertedTodayStatus = $oCacheHandler->get($cache_key);
}
if ($insertedTodayStatus === false) {
if ($site_srl) {
$args->site_srl = $site_srl;
$output = executeQuery('counter.getSiteTodayStatus', $args);
} else {
$output = executeQuery('counter.getTodayStatus', $args);
}
$insertedTodayStatus = !!$output->data->count;
if ($insertedTodayStatus && $oCacheHandler->isSupport()) {
$oCacheHandler->put($cache_key, TRUE);
$_old_date = date('Ymd', strtotime('-1 day'));
$oCacheHandler->delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
}
}
return $insertedTodayStatus;
}
开发者ID:rubythonode,项目名称:xe-core,代码行数:32,代码来源:counter.model.php
示例4: getLayout
/**
* Get one of layout information created in the DB
* Return DB info + XML info of the generated layout
* @param int $layout_srl
* @return object info of layout
**/
function getLayout($layout_srl)
{
// cache controll
$oCacheHandler =& CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$cache_key = 'object:' . $layout_srl;
$layout_info = $oCacheHandler->get($cache_key);
}
if (!$layout_info) {
// Get information from the DB
$args->layout_srl = $layout_srl;
$output = executeQuery('layout.getLayout', $args);
if (!$output->data) {
return;
}
// Return xml file informaton after listing up the layout and extra_vars
$layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);
// If deleted layout files, delete layout instance
// if (!$layout_info) {
// $oLayoutController = &getAdminController('layout');
// $oLayoutController->deleteLayout($layout_srl);
// return;
// }
//insert in cache
if ($oCacheHandler->isSupport()) {
$oCacheHandler->put($cache_key, $layout_info);
}
}
return $layout_info;
}
开发者ID:relip,项目名称:xe-core,代码行数:36,代码来源:layout.model.php
示例5: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove module extend cache
FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
// remove debug files
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
$oModuleModel = getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = NULL;
$oModule = getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove cache
$truncated = array();
$oObjectCacheHandler = CacheHandler::getInstance('object');
$oTemplateCacheHandler = CacheHandler::getInstance('template');
if ($oObjectCacheHandler->isSupport()) {
$truncated[] = $oObjectCacheHandler->truncate();
}
if ($oTemplateCacheHandler->isSupport()) {
$truncated[] = $oTemplateCacheHandler->truncate();
}
if (count($truncated) && in_array(FALSE, $truncated)) {
return new Object(-1, 'msg_self_restart_cache_engine');
}
// remove cache dir
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if ($tmp_dir) {
FileHandler::removeDir('./files/' . $tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type = Context::getDBType();
if ($db_type == 'cubrid') {
$db = DB::getInstance();
$db->deleteDuplicateIndexes();
}
// check autoinstall packages
$oAutoinstallAdminController = getAdminController('autoinstall');
$oAutoinstallAdminController->checkInstalled();
$this->setMessage('success_updated');
}
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:59,代码来源:admin.admin.controller.php
示例6: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
$temp_cache_dir = './files/cache_' . time();
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove debug files
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
$oModuleModel =& getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = null;
$oModule =& getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove cache
$truncated = array();
$oObjectCacheHandler =& CacheHandler::getInstance('object');
$oTemplateCacheHandler =& CacheHandler::getInstance('template');
if ($oObjectCacheHandler->isSupport()) {
$truncated[] = $oObjectCacheHandler->truncate();
}
if ($oTemplateCacheHandler->isSupport()) {
$truncated[] = $oTemplateCacheHandler->truncate();
}
if (count($truncated) && in_array(false, $truncated)) {
return new Object(-1, 'msg_self_restart_cache_engine');
}
// remove cache dir
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if ($tmp_dir) {
FileHandler::removeDir('./files/' . $tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type =& Context::getDBType();
if ($db_type == 'cubrid') {
$db =& DB::getInstance();
$db->deleteDuplicateIndexes();
}
$this->setMessage('success_updated');
}
开发者ID:relip,项目名称:xe-core,代码行数:54,代码来源:admin.admin.controller.php
示例7: clearSumCache
function clearSumCache()
{
if ($_POST['option_clear_sum'] == 'on') {
$qry = DBFactory::getDBQuery();
$qry->execute("DELETE FROM kb3_sum_alliance");
$qry->execute("DELETE FROM kb3_sum_corp");
$qry->execute("DELETE FROM kb3_sum_pilot");
// Clear page and query cache as well since they also contain the
// summaries.
CacheHandler::removeByAge('SQL', 0, true);
CacheHandler::removeByAge('store', 0, true);
$_POST['option_clear_sum'] == 'off';
}
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:14,代码来源:option_acache.php
示例8: get
/**
* Get an image.
*
* Returns an image resource or false on failure. Fetches the image from
* CCP if needed.
* @param integer $id
* @param integer $size
* @return resource Image resource or false on failure.
*/
static function get($id, $size = 64)
{
$id = (int) $id;
$size = (int) $size;
if ($size != 32 && $size != 64) {
return false;
}
if (!$id) {
return imagecreatefromjpeg("img/portrait_0_{$size}.jpg");
}
// If it's in the cache then read it from there.
if (CacheHandler::exists("{$id}_{$size}.png", "img")) {
return imagecreatefrompng(CacheHandler::getInternal("{$id}_{$size}.png", "img"));
} else {
$img = self::fetchImage($id, $size);
imagepng($img, CacheHandler::getInternal("{$id}_{$size}.png", "img"));
return $img ? $img : imagecreatefromjpeg("img/portrait_0_{$size}.jpg");
}
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:28,代码来源:shipImage.php
示例9: procMagiccontentSetup
function procMagiccontentSetup()
{
$req = Context::getRequestVars();
$widget_sequence = $req->widget_sequence;
$is_complete = $req->is_complete;
unset($req->is_complete);
unset($req->widget_sequence);
unset($req->act);
foreach ($req as $key => $value) {
if ($value == '') {
unset($req->{$key});
}
}
$serialize_data = serialize($req);
$args = new stdClass();
$args->data = $serialize_data;
$args->widget_sequence = $widget_sequence;
$args->is_complete = $is_complete;
if ($is_complete == 1) {
$dargs = new stdClass();
$dargs->widget_sequence = $widget_sequence;
$dargs->is_complete = 0;
$output = executeQuery('magiccontent.deleteMagicContentData', $dargs);
}
$oMagiccontentModel =& getModel('magiccontent');
if ($oMagiccontentModel->getSetupData($widget_sequence, $is_complete) === false) {
$args->data_srl = getNextSequence();
$output = executeQuery('magiccontent.insertMagicContentData', $args);
} else {
$output = executeQuery('magiccontent.updateMagicContentData', $args);
}
$oCacheHandler = CacheHandler::getInstance('template');
if ($oCacheHandler->isSupport()) {
$key = 'widget_cache:' . $widget_sequence;
$oCacheHandler->delete($key);
}
$lang_type = Context::getLangType();
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
FileHandler::removeFile($cache_file);
return new Object(0, 'success');
}
开发者ID:ilbecms,项目名称:xe_module_magiccontent,代码行数:41,代码来源:magiccontent.controller.php
示例10: _loadFromDB
/**
* Get data from database, and set the value to documentItem object
* @param bool $load_extra_vars
* @return void
*/
function _loadFromDB($load_extra_vars = true)
{
if (!$this->document_srl) {
return;
}
// cache controll
$oCacheHandler =& CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport() && !count($this->columnList)) {
$cache_key = 'object_document_item:' . $this->document_srl;
$output = $oCacheHandler->get($cache_key);
}
if (!$output) {
$args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocument', $args, $this->columnList);
//insert in cache
if ($output->data->document_srl && $oCacheHandler->isSupport()) {
$oCacheHandler->put($cache_key, $output);
}
}
$this->setAttribute($output->data, $load_extra_vars);
}
开发者ID:relip,项目名称:xe-core,代码行数:26,代码来源:document.item.php
示例11: procAjaxboardAdminDeleteAjaxboard
function procAjaxboardAdminDeleteAjaxboard()
{
$module_srl = Context::get('module_srl');
$oModuleController = getController('module');
$output = $oModuleController->deleteModule($module_srl);
if (!$output->toBool()) {
return $output;
}
$oCacheHandler = CacheHandler::getInstance('object', NULL, true);
if ($oCacheHandler->isSupport()) {
$object_key = 'module_ajaxboard_module_srls';
$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$oCacheHandler->delete($cache_key);
$object_key = 'module_ajaxboard_linked_info';
$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$oCacheHandler->delete($cache_key);
$object_key = 'module_ajaxboard_notify_info';
$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$oCacheHandler->delete($cache_key);
}
$this->setMessage('success_deleted');
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAjaxboardAdminContent'));
}
开发者ID:swhite523,项目名称:ajaxboard,代码行数:23,代码来源:ajaxboard.admin.controller.php
示例12: _loadFromDB
/**
* Get data from database, and set the value to documentItem object
* @param bool $load_extra_vars
* @return void
*/
function _loadFromDB($load_extra_vars = true)
{
if (!$this->document_srl) {
return;
}
$document_item = false;
$cache_put = false;
$columnList = array();
$this->columnList = array();
// cache controll
$oCacheHandler = CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
$document_item = $oCacheHandler->get($cache_key);
if ($document_item !== false) {
$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
}
}
$args = new stdClass();
$args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocument', $args, $columnList);
if ($document_item === false) {
$document_item = $output->data;
//insert in cache
if ($document_item && $oCacheHandler->isSupport()) {
$oCacheHandler->put($cache_key, $document_item);
}
} else {
$document_item->readed_count = $output->data->readed_count;
$document_item->voted_count = $output->data->voted_count;
$document_item->blamed_count = $output->data->blamed_count;
$document_item->comment_count = $output->data->comment_count;
$document_item->trackback_count = $output->data->trackback_count;
}
$this->setAttribute($document_item, $load_extra_vars);
}
开发者ID:jominhyun,项目名称:xe-core,代码行数:41,代码来源:document.item.php
示例13: deleteReview
/**
* @brief Delete comment
**/
function deleteReview($review_srl, $is_admin = false, $isMoveToTrash = false)
{
// create the comment model object
$oCommentModel =& getModel('store_review');
// check if comment already exists
$comment = $oCommentModel->getReview($review_srl);
if ($comment->review_srl != $review_srl) {
return new Object(-1, 'msg_invalid_request');
}
$item_srl = $comment->item_srl;
// call a trigger (before)
$output = ModuleHandler::triggerCall('store_review.deleteReview', 'before', $comment);
if (!$output->toBool()) {
return $output;
}
// check if child comment exists on the comment
$child_count = $oCommentModel->getChildCommentCount($review_srl);
if ($child_count > 0) {
return new Object(-1, 'fail_to_delete_have_children');
}
// check if permission is granted
if (!$is_admin && !$comment->isGranted()) {
return new Object(-1, 'msg_not_permitted');
}
// begin transaction
$oDB =& DB::getInstance();
$oDB->begin();
// Delete
$args->review_srl = $review_srl;
$output = executeQuery('store_review.deleteReview', $args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$output = executeQuery('store_review.deleteReviewList', $args);
// update the number of comments
$comment_count = $oCommentModel->getReviewCount($item_srl);
/*
// create the controller object of the document
$oDocumentController = &getController('document');
// update comment count of the article posting
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
*/
// call a trigger (after)
if ($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('store_review.deleteReview', 'after', $comment);
if (!$trigger_output->toBool()) {
$oDB->rollback();
return $trigger_output;
}
}
if (!$isMoveToTrash) {
$this->_deleteDeclaredComments($args);
$this->_deleteVotedComments($args);
}
// commit
$oDB->commit();
$output->add('item_srl', $item_srl);
//remove from cache
$oCacheHandler =& CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$oCacheHandler->invalidateGroupKey('commentList');
}
return $output;
}
开发者ID:seoeun,项目名称:xe-module-store_review,代码行数:72,代码来源:store_review.controller.php
示例14: getAttachInfo
/**
* @brief 자식 게시판 정보 반환
* @param int $module_srl
* @return array
*/
function getAttachInfo($module_srl)
{
if (!$module_srl) {
return array();
}
// 캐시 및 메모리 키값을 위한 해시 생성
$hash_id = md5('module_srl:' . $module_srl);
// 메모리에서 자식 게시판 정보 불러오기
$attach_info = $GLOBALS['__timeline__']['attach_info'][$hash_id];
// 메모리에 값이 없는 경우
if (is_null($attach_info)) {
$attach_info = FALSE;
$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
// 캐시에서 자식 게시판 정보 불러오기
if ($oCacheHandler->isSupport()) {
$object_key = 'attach_info:' . $hash_id;
$cache_key = $oCacheHandler->getGroupKey('timeline', $object_key);
$attach_info = $oCacheHandler->get($cache_key);
}
// 저장된 캐시가 없거나 캐시를 사용할 수 없는 경우
if ($attach_info === FALSE) {
$attach_info = array();
$args = new stdClass();
$args->module_srl = $module_srl;
// DB에서 자식 게시판 정보 불러오기
$output = executeQueryArray('timeline.getAttachInfo', $args);
foreach ($output->data as $item) {
$attach_info[] = $item->target_srl;
}
// 캐시 저장
if ($oCacheHandler->isSupport()) {
$oCacheHandler->put($cache_key, $attach_info);
}
}
// 메모리 저장
$GLOBALS['__timeline__']['attach_info'][$hash_id] = $attach_info;
}
return $attach_info;
}
开发者ID:ajkj,项目名称:xe-module-timeline,代码行数:44,代码来源:timeline.model.php
示例15: CacheHandler
<?php
require_once 'include/CacheHandler.php';
$cacheObj = new CacheHandler();
$results = $cacheObj->getFromCache();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB10lEQVQ4jX1TO2tUQRQelIgiGEt7CwVBhLvzzcZq73xnA4uQbht/QFBLFQnaWIivxcZXE8TCJkSw8REfnWkiRhEiCMEHgkERjGHnjKLCXovcXTfX3D1wiuGc78E3M8bkldVqm6O48bIOHs0fadWZslLighJZaXs8isRs29v9/4Fj6hIl/gwg+Nn2thUFV5R4ueKTnT1wliRDSrwaqF7HpUAEJTqROKmCuWVJhlfVPU4NBBPvlW6q7/xLiRNKzGTN5kajxJfB6vaYEp1CHl9VbCvSXTNB7HgUXFbiYiQmVTCvxO98+a4Sz9cP1Z0zxhgTPK4r8TQSt5VYUY+FSHdT6/asCs4Xw1TBfaV7sJZAbCu/yntKeyt4HFK6Z0pkeXhHYx2VSMwaY0ygPVJwYJeU9oUSn5S4kTX3bFKxE7nqR2OMaY8mu/P5jBIfig4mvtf2bQ/E2yiYXk3ZPenZ9u6N0j5W4rXW7I4g9nAxg0X17ngg3nUHfQ4+Z6N7ty5LMqyCeRUcVMFcjyD6SkM9Forp/iOwSzGtjuXOumEuRl9prHnOgS4NxJ0gOFNw0O2OEg+j4EB22mwo/VRZkgz1EwSiHWmvttPKrlLQukQjI1tiWh371nDbBu39BUbXq0cwWvsKAAAAAElFTkSuQmCC" rel="icon" type="image/x-icon" />
<title>Idea House</title>
<link rel="stylesheet" href="salvattore.css">
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Idea House</h1>
<div id="timeline" data-columns="4">
<?php
foreach ($results as $result) {
?>
<div class="item line-<?php
echo $result['metadata']['data_source'];
?>
开发者ID:aimanbaharum,项目名称:ideas-aggregator,代码行数:31,代码来源:index.php
示例16: deleteCategory
/**
* Delete a category
* @param int $category_srl
* @return object
*/
function deleteCategory($category_srl)
{
$args = new stdClass();
$args->category_srl = $category_srl;
$oDocumentModel = getModel('document');
$category_info = $oDocumentModel->getCategory($category_srl);
// Display an error that the category cannot be deleted if it has a child
$output = executeQuery('document.getChildCategoryCount', $args);
if (!$output->toBool()) {
return $output;
}
if ($output->data->count > 0) {
return new Object(-1, 'msg_cannot_delete_for_child');
}
// Delete a category information
$output = executeQuery('document.deleteCategory', $args);
if (!$output->toBool()) {
return $output;
}
$this->makeCategoryFile($category_info->module_srl);
// remvove cache
$oCacheHandler = CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$page = 0;
while (true) {
$args = new stdClass();
$args->category_srl = $category_srl;
$args->list_count = 100;
$args->page = ++$page;
$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
if ($output->data == array()) {
break;
}
foreach ($output->data as $val) {
//remove document item from cache
$cache_key = 'document_item:' . getNumberingPath($val->document_srl) . $val->document_srl;
$oCacheHandler->delete($cache_key);
}
}
}
// Update category_srl of the documents in the same category to 0
$args = new stdClass();
$args->target_category_srl = 0;
$args->source_category_srl = $category_srl;
$output = executeQuery('document.updateDocumentCategory', $args);
return $output;
}
开发者ID:Gunmania,项目名称:xe-core,代码行数:52,代码来源:document.controller.php
示例17: deleteModuleExtraVars
/**
* @brief Remove extra vars from the module
**/
function deleteModuleExtraVars($module_srl)
{
$args->module_srl = $module_srl;
return executeQuery('module.deleteModuleExtraVars', $args);
//remove from cache
$oCacheHandler =& CacheHandler::getInstance('object');
if ($oCacheHandler->isSupport()) {
$cache_key = 'object:module_extra_vars_' . $module_srl;
$oCacheHandler->delete($cache_key);
}
}
开发者ID:relip,项目名称:xe-core,代码行数:14,代码来源:module.controller.php
示例18: getPortraitURL
/**
* Return the URL for the alliance's portrait. If the alliance has a
* portrait in the board's img/alliances directory, that portrait will be
* used
*
* @param integer $size The desired portrait size.
* @return string URL for a portrait.
*/
function getPortraitURL($size = 128)
{
if (isset($this->imgurl[$size])) {
return $this->imgurl[$size];
}
if (file_exists("img/alliances/" . $this->getUnique() . ".png")) {
if ($size == 128) {
$this->imgurl[$size] = IMG_HOST . "/img/alliances/" . $this->getUnique() . ".png";
} else {
if (CacheHandler::exists($this->getUnique() . "_{$size}.png", 'img')) {
$this->imgurl[$size] = KB_HOST . "/" . CacheHandler::getExternal($this->getUnique() . "_{$size}.png", 'img');
} else {
$this->imgurl[$size] = KB_HOST . '/?a=thumb&type=alliance&id=' . $this->getUnique() . '&size=' . $size;
}
}
$this->putCache();
} else {
if ($this->getExternalID()) {
$this->imgurl[$size] = imageURL::getURL('Alliance', $this->getExternalID(), $size);
$this->putCache();
} else {
$this->imgurl[$size] = imageURL::getURL('Alliance', 1, $size);
}
}
return $this->imgurl[$size];
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:34,代码来源:class.alliance.php
示例19: procLayoutAdminUpdate
/**
* Update layout information
* Apply a title of the new layout and extra vars
* @return Object
*/
function procLayoutAdminUpdate()
{
// Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida ..
$extra_vars = Context::getRequestVars();
unset($extra_vars->module);
unset($extra_vars->act);
unset($extra_vars->layout_srl);
unset($extra_vars->layout);
unset($extra_vars->title);
unset($extra_vars->apply_layout);
unset($extra_vars->apply_mobile_view);
$is_sitemap = $extra_vars->is_sitemap;
unset($extra_vars->is_sitemap);
$args = Context::gets('layout_srl', 'title');
// Get layout information
$oLayoutModel = getModel('layout');
$oMenuAdminModel = getAdminModel('menu');
$layout_info = $oLayoutModel->getLayout($args->layout_srl);
if ($layout_info->menu) {
$menus = get_object_vars($layout_info->menu);
}
if (count($menus)) {
foreach ($menus as $menu_id => $val) {
$menu_srl = Context::get($menu_id);
if (!$menu_srl) {
continue;
}
// if menu is -1, get default menu in site
if ($menu_srl == -1) {
$oModuleModel = getModel('module');
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
$tmpArgs->url = $start_module->mid;
$tmpArgs->site_srl = 0;
$output = executeQuery('menu.getMenuItemByUrl', $tmpArgs);
if (!$output->toBool()) {
return new Object(-1, 'fail_to_update');
}
$menu_srl = $output->data->menu_srl;
}
$output = $oMenuAdminModel->getMenu($menu_srl);
$menu_srl_list[] = $menu_srl;
$menu_name_list[$menu_srl] = $output->title;
$apply_layout = Context::get('apply_layout');
$apply_mobile_view = Context::get('apply_mobile_view');
if ($apply_layout == 'Y' || $apply_mobile_view == 'Y') {
$menu_args = new stdClass();
$menu_args->menu_srl = $menu_srl;
$menu_args->site_srl = $layout_info->site_srl;
$output = executeQueryArray('layout.getLayoutModules', $menu_args);
if ($output->data) {
$modules = array();
for ($i = 0; $i < count($output->data); $i++) {
$modules[] = $output->data[$i]->module_srl;
}
if (count($modules)) {
$update_args = new stdClass();
$update_args->module_srls = implode(',', $modules);
if ($apply_layout == "Y") {
$update_args->layout_srl = $args->layout_srl;
}
if ($layout_info->layout_type == "M") {
if (Context::get('apply_mobile_view') == "Y") {
$update_args->use_mobile = "Y";
}
$output = executeQuery('layout.updateModuleMLayout', $update_args);
} else {
$output = executeQuery('layout.updateModuleLayout', $update_args);
}
$oCacheHandler = CacheHandler::getInstance('object', null, true);
if ($oCacheHandler->isSupport()) {
$oCacheHandler->invalidateGroupKey('site_and_module');
}
}
}
}
}
}
$tmpDir = sprintf('./files/attach/images/%s/tmp', $args->layout_srl);
// Separately handle if a type of extra_vars is an image
if ($layout_info->extra_var) {
foreach ($layout_info->extra_var as $name => $vars) {
if ($vars->type != 'image') {
continue;
}
$fileName = $extra_vars->{$name};
if ($vars->value == $fileName) {
continue;
}
FileHandler::removeFile($vars->value);
if (!$fileName) {
continue;
}
$pathInfo = pathinfo($fileName);
$tmpFileName = sprintf('%s/tmp/%s', $pathInfo['dirname'], $pathInfo['basename']);
if (!FileHandler::moveFile($tmpFileName, $fileName)) {
//.........这里部分代码省略.........
开发者ID:ddmshu,项目名称:xe-core,代码行数:101,代码来源:layout.admin.controller.php
示例20: moduleUpdate
//.........这里部分代码省略.........
// Get extra vars if exist
$doc_args = null;
$doc_args->module_srl = $module_srl;
$doc_args->list_count = $per_page;
$doc_args->sort_index = 'list_order';
$doc_args->order_type = 'asc';
for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) {
$output = executeQueryArray('document.getDocumentList', $doc_args);
if ($output->toBool() && $output->data && count($output->data)) {
foreach ($output->data as $document) {
if (!$document) {
continue;
}
foreach ($document as $key => $var) {
if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') {
continue;
}
$var_idx = str_replace('extra_vars', '', $key);
$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars' . $var_idx, $lang_code);
}
}
}
}
// for total_pages
}
// if count
}
// Additional variables of the module, remove
$module_info->grant = null;
$module_info->extra_vars = null;
$module_info->skin_vars = null;
$module_info->admin_id = null;
executeQuery('module.updateModule', $module_info);
$oCacheHandler = CacheHandler::getInstance('object', null, true);
if ($oCacheHandler->isSupport()) {
$oCacheHandler->invalidateGroupKey('site_and_module');
}
}
}
// Various column drop
$oDB->dropColumn('modules', 'grants');
$oDB->dropColumn('modules', 'admin_id');
$oDB->dropColumn('modules', 'skin_vars');
$oDB->dropColumn('modules', 'extra_vars');
}
// Rights of all modules/skins transferring the information into a table Update grants
if (!$oDB->isColumnExists('sites', 'default_language')) {
$oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false);
}
// extra_vars * Remove Column
for ($i = 1; $i <= 20; $i++) {
if (!$oDB->isColumnExists("documents", "extra_vars" . $i)) {
continue;
}
$oDB->dropColumn('documents', 'extra_vars' . $i);
}
// Enter the main site information sites on the table
$args = new stdClass();
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if (!$output->data) {
// Basic mid, language Wanted
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
$domain = Context::getDefaultUrl();
$url_info = parse_url($domain);
$domain = $url_info['host'] . (!empty($url_info['port']) && $url_info['port'] != 80 ? ':' . $url_info['port'] : '') . $url_info['path'];
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:67,代码来源:module.class.php
注:本文中的CacheHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论