本文整理匯總了PHP中VirtualHost::getDefaultVirtualHost方法的典型用法代碼示例。如果您正苦於以下問題:PHP VirtualHost::getDefaultVirtualHost方法的具體用法?PHP VirtualHost::getDefaultVirtualHost怎麽用?PHP VirtualHost::getDefaultVirtualHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類VirtualHost
的用法示例。
在下文中一共展示了VirtualHost::getDefaultVirtualHost方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDefaultNetwork
/**
* Get the default network
*
* @return object A Network object, NEVER returns null.
*
* @static
* @access public
*/
public static function getDefaultNetwork()
{
$retval = null;
$vhost = VirtualHost::getCurrentVirtualHost();
if ($vhost == null) {
$vhost = VirtualHost::getDefaultVirtualHost();
}
return $vhost->getDefaultNetwork();
}
示例2: define
*/
/* This section deals with PATHs used in URLs and local content
* BASE_SSL_PATH should be used to enter SSL mode (if available)
* BASE_NON_SSL_PATH should be used to break out of SSL mode of when we
* explicitely do not want someting to be referenced over http
* BASE_URL_PATH should be used in all other cases to avoid needless SSL warning
*
* */
require_once 'classes/VirtualHost.php';
/**
* Check for SSL support
*/
try {
$vhost = VirtualHost::getCurrentVirtualHost();
if ($vhost == null) {
$vhost = VirtualHost::getDefaultVirtualHost();
}
if ($vhost->isSSLAvailable()) {
/**
* @ignore
*/
define("SSL_AVAILABLE", true);
} else {
/**
* @ignore
*/
define("SSL_AVAILABLE", false);
}
} catch (Exception $e) {
//Leave this catch here, in case the schema update hasn't yet been done.
define("SSL_AVAILABLE", false);
示例3: setDefaultVirtualHost
/**
* Set as the default server
*
* @param VirtualHost $vhost
*
* @return bool True on success, false on failure
*/
public function setDefaultVirtualHost(VirtualHost $vhost)
{
$db = AbstractDb::getObject();
$vhostIdStr = $db->escapeString($vhost->getId());
// Init values
$_retVal = false;
if ($vhostIdStr != VirtualHost::getDefaultVirtualHost()->getId()) {
$sql = "UPDATE server SET default_virtual_host = '{$vhostIdStr}';\n";
$_retVal = $db->execSqlUpdate($sql, false);
$this->refresh();
}
return $_retVal;
}
示例4: isDefaultVirtualHost
/**
* Is this vhost the server's default?
*
* @return bool True or false
*/
public function isDefaultVirtualHost()
{
// Init values
$retVal = false;
if (VirtualHost::getDefaultVirtualHost()->getId() == $this->getId()) {
$retVal = true;
}
return $retVal;
}