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


PHP WikiFactory::isUsed方法代码示例

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


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

示例1: __construct

 /**
  * __construct
  *
  * discover which wikia we handle
  *
  * @access public
  * @author Krzysztof Krzyżaniak <eloy@wikia-inc.com>
  *
  * @param integer $id default null    explicit set wiki id
  * @param bool|string $server_name default false    explicit set server name
  *
  * @return WikiFactoryLoader object
  */
 public function __construct($id = null, $server_name = false)
 {
     global $wgDBname, $wgDevelEnvironment, $wgDevelDomains;
     global $wgWikiFactoryDomains, $wgExternalSharedDB;
     $this->mCommandLine = false;
     if (!is_null($id)) {
         /**
          * central / dofus / memory-alpha case
          */
         $this->mCityID = $id;
         if ($server_name === false) {
             $this->mServerName = empty($_SERVER['SERVER_NAME']) ? false : $_SERVER['SERVER_NAME'];
         } else {
             $this->mServerName = $server_name;
         }
     } elseif (!empty($_SERVER['SERVER_NAME'])) {
         /**
          * normal http request
          */
         $this->mServerName = strtolower($_SERVER['SERVER_NAME']);
         $this->mCityID = false;
     } elseif (getenv("SERVER_ID")) {
         /**
          * interactive/cmdline
          */
         $this->mCityID = getenv("SERVER_ID");
         $this->mServerName = false;
         $this->mCommandLine = true;
     } elseif (getenv("SERVER_DBNAME")) {
         $this->mCityDB = getenv("SERVER_DBNAME");
         $this->mServerName = false;
         $this->mCommandLine = true;
         $this->mCityID = false;
     } else {
         /**
          * hardcoded exit, nothing can be done at this point
          */
         echo "Cannot tell which wiki it is (neither SERVER_NAME, SERVER_ID nor SERVER_DBNAME is defined)\n";
         exit(1);
     }
     /**
      * initalizations
      */
     $this->mDebug = false;
     $this->mOldServerName = false;
     $this->mAlternativeDomainUsed = false;
     $this->mDBname = !empty($wgExternalSharedDB) ? $wgExternalSharedDB : "wikicities";
     $this->mDomain = array();
     $this->mVariables = array();
     $this->mIsWikiaActive = 0;
     $this->mAlwaysFromDB = 0;
     $this->mWikiID = 0;
     $this->mDBhandler = null;
     $this->mCityDB = false;
     if (!empty($wgDevelEnvironment)) {
         $this->mDebug = true;
         $this->mAlwaysFromDB = 1;
     }
     /**
      * @author Krzysztof Krzyżaniak <eloy@wikia-inc.com>
      *
      * handle additional domains, we have plenty of domains which should
      * redirect to <wikia>.wikia.com. They should be added to
      * $wgWikiFactoryDomains variable (which is simple list). When
      * additional domain is detected we do simple replace:
      *
      * muppets.wikia.org => muppets.wikia.com
      *
      * additionally we remove www. before matching
      */
     if (isset($wgWikiFactoryDomains) && is_array($wgWikiFactoryDomains)) {
         foreach ($wgWikiFactoryDomains as $domain) {
             /**
              * remove www from domain
              */
             $name = preg_replace("/^www\\./", "", $this->mServerName);
             $pattern = "/{$domain}\$/";
             if ($domain !== "wikia.com" && preg_match($pattern, $name)) {
                 $this->mOldServerName = $this->mServerName;
                 $this->mServerName = str_replace($domain, "wikia.com", $name);
                 $this->mAlternativeDomainUsed = true;
                 break;
             }
         }
     }
     WikiFactory::isUsed(true);
     /**
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:WikiFactoryLoader.php


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