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


PHP DataModel::getSitesSignature方法代码示例

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


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

示例1: showAll

 function showAll()
 {
     $idSite = getRequestVar('site', -1, 'int');
     if ($idSite == -1) {
         $allSiteArchive = DataModel::getSites();
     } else {
         $allSiteArchive[] = new Site($idSite);
     }
     $uniqCacheId = DataModel::getSitesSignature() . date("Y-m-d") . serialize($_GET) . '.rss';
     // Set a few options
     $options = array('cacheDir' => DIR_CACHE_RSS, 'lifeTime' => CACHE_RSS_LIFETIME);
     // Create a Cache_Lite object
     $Cache_Lite = new Cache_Lite($options);
     if (time() % 500 === 0) {
         $Cache_Lite->clean();
     }
     // Test if thereis a valide cache for this id
     if (SMARTY_DEBUG || !($allData = $Cache_Lite->get($uniqCacheId))) {
         $dataTmp = $this->data;
         $o_config =& PmvConfig::getInstance();
         $allItems = array();
         foreach ($allSiteArchive as $id => $infoSite) {
             $allArchives = $dataTmp->getLastArchives(NB_DAYS_FOR_RSS_ITEMS, 0, DATE_NORMAL, $infoSite);
             $i = 0;
             foreach ($allArchives as $date => $o_archive) {
                 //var_dump($date);
                 $this->request->setDate($o_archive->date->get());
                 $this->request->setModuleName('view_visits_rss');
                 $o_mod = new ViewVisitsRss($infoSite);
                 $o_mod->init($this->request, $this->tpl, $o_archive);
                 //var_dump($o_mod->data->archive->date->get());
                 $rssContent = $o_mod->showAll(true);
                 $dateRss = date("r", time() - 100 * $i++ - 10 * $id);
                 $item['pubDate'] = $dateRss;
                 $url = PHPMV_URL . "/?site=" . $infoSite->getId() . "&mod=view_visits&date=" . $o_archive->date->get();
                 $item['guid'] = $url;
                 //"http://www.phpmyvisites.us/".md5($dateRss);
                 $item['link'] = $url;
                 $item['title'] = vsprintf($GLOBALS['lang']['rss_titre'], array($infoSite->getName(), $date));
                 $rssContent = $item['title'] . $rssContent;
                 $item['author'] = "phpmyvisites@gmail.com (phpMyVisites)";
                 $item['date_ts'] = time() - 10 * $id;
                 $item['description'] = $rssContent;
                 $item['date_ts'] = $o_archive->date->getTimestamp();
                 $allItems[] = $item;
                 $urls[] = $url;
             }
         }
         $GLOBALS['sorting_index'] = 'date_ts';
         uasort($allItems, "sortingDataInfo");
         $channel['title'] = "phpMyVisites stats by RSS";
         $channel['link'] = "http://www.phpmyvisites.us";
         $channel['description'] = "Enjoy phpmyvisites power ! :)";
         $channel['pubDate'] = date("r");
         $channel['generator'] = "phpMyVisites";
         $channel['language'] = $GLOBALS['lang']['lang_iso'];
         $channel['lastBuildDate'] = date("r");
         foreach ($allItems as $chan) {
             unset($chan['date_ts']);
             $channel[] = $chan;
         }
         $rss = array('channel' => $channel);
         // An array of serializer options
         $serializer_options = array('addDecl' => TRUE, 'encoding' => 'UTF-8', 'indent' => '  ', 'rootName' => 'rss', 'defaultTagName' => 'item', 'rootAttributes' => array('version' => '2.0'));
         $Serializer =& new XML_Serializer($serializer_options);
         // Serialize the data structure
         $Serializer->setOption("keyAttribute", "rdf:about");
         $status = $Serializer->serialize($rss);
         $allData = $Serializer->getSerializedData();
         $Cache_Lite->save($allData);
     }
     $this->displayRss($allData);
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:73,代码来源:ViewRss.class.php


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