当前位置: 首页>>代码示例>>PHP>>正文


PHP CFactory::getCache方法代码示例

本文整理汇总了PHP中CFactory::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::getCache方法的具体用法?PHP CFactory::getCache怎么用?PHP CFactory::getCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFactory的用法示例。


在下文中一共展示了CFactory::getCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: remove

 public function remove($tag)
 {
     $oZendCache = CFactory::getCache('core');
     if ($tag == COMMUNITY_CACHE_TAG_ALL) {
         $oZendCache->clean(Zend_Cache::CLEANING_MODE_ALL);
     } else {
         $oZendCache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tag);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:cache.php

示例2: display

 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $script = '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
     $mainframe->addCustomHeadTag($script);
     $groupId = JRequest::getVar('groupid', '', 'GET');
     if (!empty($groupId)) {
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
     }
     //page title
     $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
     // Get category id from the query string if there are any.
     $categoryId = JRequest::getInt('categoryid', 0);
     $limitstart = JRequest::getVar('limitstart', 0);
     $category =& JTable::getInstance('EventCategory', 'CTable');
     $category->load($categoryId);
     if (isset($category) && $category->id != 0) {
         $document->setTitle(JText::sprintf('CC VIEW BY CATEGORY NAME', JText::_($this->escape($category->name))));
     } else {
         $document->setTitle(JText::_('CC BROWSE EVENTS TITLE'));
     }
     $this->showSubmenu();
     $feedLink = CRoute::_('index.php?option=com_community&view=events&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE ALL EVENTS FEED') . '" href="' . $feedLink . '"/>';
     $mainframe->addCustomHeadTag($feed);
     // loading neccessary files here.
     CFactory::load('libraries', 'filterbar');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'event');
     CFactory::load('models', 'events');
     $data = new stdClass();
     $sorted = JRequest::getVar('sort', 'startdate', 'GET');
     /* begin: UNLIMITED LEVEL BREADCRUMBS PROCESSING */
     if ($category->parent == COMMUNITY_NO_PARENT) {
         $this->addPathway($category->name, CRoute::_('index.php?option=com_community&view=events&categoryid=' . $category->id));
     } else {
         // Parent Category
         $parentsInArray = array();
         $n = 0;
         $parentId = $category->id;
         $parent =& JTable::getInstance('EventCategory', 'CTable');
         do {
             $parent->load($parentId);
             $parentId = $parent->parent;
             $parentsInArray[$n]['id'] = $parent->id;
             $parentsInArray[$n]['parent'] = $parent->parent;
             $parentsInArray[$n]['name'] = $parent->name;
             $n++;
         } while ($parent->parent > COMMUNITY_NO_PARENT);
         for ($i = count($parentsInArray) - 1; $i >= 0; $i--) {
             $this->addPathway($parentsInArray[$i]['name'], CRoute::_('index.php?option=com_community&view=events&categoryid=' . $parentsInArray[$i]['id']));
         }
     }
     /* end: UNLIMITED LEVEL BREADCRUMBS PROCESSING */
     $model = CFactory::getModel('events');
     $cache = CFactory::getCache('Core');
     if (!($data->categories = $cache->load('_events_category_' . $categoryId))) {
         // Get the categories
         $data->categories = $model->getCategories(CEventHelper::ALL_TYPES, $categoryId);
         $cache->save($data->categories, NULL, array(COMMUNITY_CACHE_TAG_EVENTS_CAT));
     }
     CFactory::load('helpers', 'event');
     $event =& JTable::getInstance('Event', 'CTable');
     $handler = CEventHelper::getHandler($event);
     if (!($eventsHTML = $cache->load('_events_eventList_' . $categoryId . '_' . $limitstart))) {
         // It is safe to pass 0 as the category id as the model itself checks for this value.
         $data->events = $model->getEvents($category->id, null, $sorted, null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId());
         // Get pagination object
         $data->pagination = $model->getPagination();
         // Get the template for the event category lists
         $eventsHTML = $this->_getEventsHTML($data->events, false, $data->pagination);
         $cache->save($eventsHTML, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS, COMMUNITY_CACHE_TAG_EVENTS));
     }
     $tmpl = new CTemplate();
     $sortItems = array('latest' => JText::_('CC SORT EVENT CREATED'), 'startdate' => JText::_('CC SORT EVENT STARTDATE'));
     $tmpl->set('handler', $handler);
     $tmpl->set('index', true);
     $tmpl->set('categories', $data->categories);
     $tmpl->set('eventsHTML', $eventsHTML);
     $tmpl->set('config', $config);
     $tmpl->set('category', $category);
     $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'startdate'));
     $tmpl->set('my', $my);
     echo $tmpl->fetch('events.index');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:94,代码来源:view.html.php

示例3: _getFeaturedAlbum

 private function _getFeaturedAlbum()
 {
     $featuredList = array();
     $cache = CFactory::getCache('Core');
     $config = CFactory::getConfig();
     if (!($featuredList = $cache->load('_photos_featuredList'))) {
         CFactory::load('libraries', 'featured');
         $featured = new CFeatured(FEATURED_ALBUMS);
         $featuredAlbums = $featured->getItemIds();
         foreach ($featuredAlbums as $album) {
             $table =& JTable::getInstance('Album', 'CTable');
             $table->load($album);
             $table->thumbnail = $table->getCoverThumbPath();
             $table->thumbnail = $table->thumbnail ? JURI::root() . $table->thumbnail : JURI::root() . 'components/com_community/assets/album_thumb.jpg';
             if ($table->location != '') {
                 CFactory::load('libraries', 'mapping');
                 $zoomableMap = CMapping::drawZoomableMap($table->location, 220, 150);
             } else {
                 $zoomableMap = "";
             }
             $table->zoomableMap = $zoomableMap;
             $featuredList[] = $table;
         }
         $cache->save($featuredList, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS, COMMUNITY_CACHE_TAG_ALBUMS));
     }
     $tmpl = new CTemplate();
     CFactory::load('helpers', 'owner');
     $photoTag = CFactory::getModel('phototagging');
     //add photos info in featured list
     //$handler	= $this->_getHandler();
     $photoModel = CFactory::getModel('photos');
     if (is_array($featuredList)) {
         foreach ($featuredList as &$fl) {
             // bind photo links
             $fl->photos = $photoModel->getPhotos($fl->id, 5);
             //set the photo limit to be configurable by admin
             $photos =& $fl->photos;
             $maxTime = '';
             $tagRecords = array();
             // Get all photos from album
             for ($i = 0; $i < count($photos); $i++) {
                 $item =& JTable::getInstance('Photo', 'CTable');
                 $item->bind($photos[$i]);
                 $photos[$i] = $item;
                 $photo =& $photos[$i];
                 $photo->link = CRoute::_('index.php?option=com_community&view=photos&task=photo&userid=' . $fl->creator . '&albumid=' . $photo->albumid) . '#photoid=' . $photo->id;
                 //Cannot use handler as Handler needs userid obtained from Get. In here, userid might not exists in $_GET
                 //$handler->getPhotoURI( $photo->id , $photo->albumid );
                 $tagRecords[] = $photoTag->getTaggedList($photo->id);
                 //Get last update
                 $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime;
             }
             $people = array();
             // Get the people in the tags
             foreach ($tagRecords as $tag) {
                 foreach ($tag as $t) {
                     $people[] = $t->userid;
                 }
             }
             $people = array_unique($people);
             foreach ($people as &$person) {
                 $person = CFactory::getUser($person);
             }
             //bind tagged person in the album
             $fl->tagged = $people;
             //bind album desc
             $maxTime = new JDate($maxTime);
             $fl->lastUpdated = CActivityStream::_createdLapse($maxTime, false);
         }
     }
     //try to get the photos within this album
     // Get show photo location map by default
     $photoMapsDefault = $config->get('photosmapdefault');
     return $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('featuredList', $featuredList)->set('photoModel', $photoModel)->set('photoMapsDefault', $photoMapsDefault)->fetch('photos.album.featured');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:75,代码来源:view.html.php

示例4: ajaxGetNewestVideos

 public function ajaxGetNewestVideos($limit)
 {
     $limit = max(0, $limit);
     $cache = CFactory::getCache('Core');
     $intRandom = rand(COMMUNITY_CACHE_RANDOM_MIN, COMMUNITY_CACHE_RANDOM_MAX);
     $my = CFactory::getUser();
     $permissions = $my->id == 0 ? 0 : 20;
     if (!($html = $cache->load('frontpage_ajaxGetNewestVideos_' . $permissions . '_' . $intRandom))) {
         $html = '';
         $oversampledTotal = $limit * COMMUNITY_OVERSAMPLING_FACTOR;
         $model = CFactory::getModel('videos');
         $filter = array('status' => 'ready', 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => 'latest', 'limit' => $oversampledTotal);
         $latestVideos = $model->getVideos($filter, true);
         if (!empty($latestVideos)) {
             shuffle($latestVideos);
             $maxLatestCount = count($latestVideos) > $limit ? $limit : count($latestVideos);
             $html = $this->prepareVideosData($latestVideos, $maxLatestCount, $objResponse);
         } else {
             $html = JText::_('COM_COMMUNITY_VIDEOS_NO_VIDEO');
         }
         $cache->save($html, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS));
     }
     $objResponse = new JAXResponse();
     $objResponse->addAssign('latest-videos-container', 'innerHTML', $html);
     $objResponse->addScriptCall("joms.filters.hideLoading();");
     return $objResponse->sendResponse();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:27,代码来源:frontpage.php

示例5: __call

 /**
  * Triggered when invoking inaccessible method in an object.
  * 	 
  **/
 public function __call($methodName, $arguments)
 {
     // Cache is set in the model class.
     if (($oCache = CCache::load($this->oModel)) && ($aSetting = $oCache->getMethod($methodName))) {
         $cacheAction = $aSetting['action'];
         $aCacheTag = $aSetting['tag'];
         $oZendCache = CFactory::getCache('core');
         $className = get_class($this->oModel);
         // Genereate cache file.
         if ($cacheAction == CCache::ACTION_SAVE) {
             if (!($data = $oZendCache->load($className . '_' . $methodName . '_' . md5(serialize($arguments))))) {
                 $data = call_user_func_array(array($this->oModel, $methodName), $arguments);
                 $oZendCache->save($data, NULL, $aCacheTag);
             }
             // Remove cache file.
         } elseif ($cacheAction == CCache::ACTION_REMOVE) {
             $oCache->remove($aCacheTag);
             $data = call_user_func_array(array($this->oModel, $methodName), $arguments);
         }
     } else {
         $data = call_user_func_array(array($this->oModel, $methodName), $arguments);
     }
     return $data;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:28,代码来源:core.php


注:本文中的CFactory::getCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。