本文整理匯總了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);
/**
//.........這裏部分代碼省略.........