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


PHP WikiFactory::DBToDomain方法代码示例

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


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

示例1: execute

 public function execute($subpage)
 {
     global $wgUser, $wgOut, $wgRequest, $wgCityId, $wgDBname, $wgLang;
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     // Set the current wiki ID, DB name and user from globals
     $this->mCityId = $wgCityId;
     $this->mCityDBName = $wgDBname;
     $this->mUser = $wgUser;
     // Check the current $wgUser against the set of groups WikiStats recognizes
     $this->userIsSpecial = WikiStats::isAllowed();
     $this->mFromDate = $wgRequest->getVal("wsfrom", WIKISTATS_MIN_STATS_YEAR . WIKISTATS_MIN_STATS_MONTH);
     $this->mToDate = $wgRequest->getVal("wsto", date("Ym"));
     $this->mTitle = Title::makeTitle(NS_SPECIAL, "WikiStats");
     $this->mAction = $wgRequest->getVal("action", "");
     $this->mXLS = $wgRequest->getVal("wsxls", false);
     $this->mMonth = $wgRequest->getVal("wsmonth", 0);
     $this->mLimit = $wgRequest->getVal("wslimit", WIKISTATS_WIKIANS_RANK_NBR);
     $this->mAllWikis = 0;
     // Use the first part of the subpage as the action
     if ($subpage) {
         $path = explode("/", $subpage);
         $this->mAction = $path[0];
     }
     // Redirect to the default action if one hasn't been set
     if (empty($this->mAction)) {
         $wgOut->redirect($this->mTitle->getFullURL("action={$this->defaultAction}"));
     }
     // Split out the the from and to month and year for convenience
     if (preg_match("/^([0-9]{4})([0-9]{1,2})/", $this->mFromDate, $m)) {
         list(, $this->fromYear, $this->fromMonth) = $m;
     } else {
         $wgOut->showErrorPage("Bad parameters", "wikistats_error_malformed_date");
         return;
     }
     if (preg_match("/^([0-9]{4})([0-9]{1,2})/", $this->mToDate, $m)) {
         list(, $this->toYear, $this->toMonth) = $m;
     } else {
         $wgOut->showErrorPage("Bad parameters", "wikistats_error_malformed_date");
         return;
     }
     $domain = $all = "";
     if ($this->userIsSpecial) {
         $this->mLang = $wgRequest->getVal("wslang", "");
         $this->mHub = $wgRequest->getVal("wscat", "");
         $this->mNS = $wgRequest->getIntArray("wsns", "");
         $domain = $wgRequest->getVal("wswiki", "");
         $all = $wgRequest->getVal("wsall", 0);
         $this->mNamespaces = $wgLang->getNamespaces();
     }
     // Override some values if we're special and got a domain (or 'all')
     if ($domain == 'all' || $all == 1) {
         $this->mCityId = 0;
         $this->mCityDBName = WIKISTATS_CENTRAL_ID;
         $this->mCityDomain = 'all';
         $this->mAllWikis = 1;
     } elseif (!empty($domain) && $this->userIsSpecial == 1) {
         $this->mCityId = WikiFactory::DomainToId($domain);
         $this->mCityDBName = WikiFactory::IDToDB($this->mCityId);
         $this->mCityDomain = $domain;
     } else {
         $this->mCityDomain = WikiFactory::DBToDomain($this->mCityDBName);
     }
     $this->mStats = WikiStats::newFromId($this->mCityId);
     $this->mPredefinedNamespaces = $this->mStats->getPageNSList();
     $this->mStats->setStatsDate(array('fromMonth' => $this->fromMonth, 'fromYear' => $this->fromYear, 'toMonth' => $this->toMonth, 'toYear' => $this->toYear));
     $this->mStats->setHub($this->mHub);
     $this->mStats->setLang($this->mLang);
     #---
     $this->mSkin = RequestContext::getMain()->getSkin();
     if (is_object($this->mSkin)) {
         $skinname = get_class($this->mSkin);
         $skinname = strtolower(str_replace("Skin", "", $skinname));
         $this->mSkinName = $skinname;
     }
     $this->showForm();
     if ($this->mAction) {
         $func = 'show' . ucfirst(strtolower($this->mAction));
         if (method_exists($this, $func)) {
             $this->{$func}($subpage);
         }
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:88,代码来源:SpecialWikiStats_body.php


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