本文整理汇总了PHP中VirtualHost::getCurrentVirtualHost方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtualHost::getCurrentVirtualHost方法的具体用法?PHP VirtualHost::getCurrentVirtualHost怎么用?PHP VirtualHost::getCurrentVirtualHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualHost
的用法示例。
在下文中一共展示了VirtualHost::getCurrentVirtualHost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
//$this->setCountry("Earth");
$this->setEndpointUrl("http://maps.google.com/maps/geo?");
//API Key will be collected from the database in future
if (!($vhost = VirtualHost::getCurrentVirtualHost())) {
$this->setAPIKey("0");
} else {
$this->setAPIKey($vhost->getGoogleAPIKey());
}
}
示例2: 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();
}
示例3: elseif
*/
/**
* Load common include file
*/
require_once 'admin_common.php';
require_once 'classes/Node.php';
require_once 'classes/Network.php';
require_once 'classes/AbstractGeocoder.php';
require_once 'classes/MainUI.php';
require_once 'classes/Server.php';
$ui = MainUI::getObject();
$ui->setTitle(_("Hotspot location map"));
if (!empty($_REQUEST['node_id'])) {
$node = Node::getObject($_REQUEST['node_id']);
// Add Google Maps JavaScript ( must set config values )
$html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=" . VirtualHost::getCurrentVirtualHost()->getGoogleAPIKey() . "\" type=\"text/javascript\"></script>";
$ui->appendHtmlHeadContent($html_headers);
// Create HTML body
$html = _("Click anywhere on the map to extract the GIS location, then click on the button to save the data.") . "<br>";
$html .= "<div id=\"map_frame\"></div>\n";
$html .= "<input type='button' value='" . _("Use these coordinates") . "' onClick='setLocationInOriginalWindow();'>\n";
$ui->addContent('main_area_middle', $html);
if (($gisLocation = $node->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} elseif (($gisLocation = $node->getNetwork()->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} else {
$html .= "<div class='error'>" . _("Error: You need to set the GIS coordinates of the center of your network") . "</div\n";
$gisLocation = null;
}
if ($gisLocation !== null) {
//pretty_print_r($gisLocation);
$lat = $gisLocation->getLatitude();
示例4: define
* @version Subversion $Id$
* @link http://www.wifidog.org/
*/
/* 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) {
示例5: Exception
// Init ALL smarty values
$smarty->assign('DEPRECATEDisSuperAdmin', false);
$smarty->assign('selectNetworkUI', null);
/**
* Define user security levels for the template
*
* These values are used in the default template of WiFoDog but could be used
* in a customized template to restrict certain links to specific user
* access levels.
*/
$smarty->assign('DEPRECATEDisSuperAdmin', $currentUser && $currentUser->DEPRECATEDisSuperAdmin());
/*
* Header JavaScripts
*/
// Add Google Maps JavaScript (must set config values)
if (!($vhost = VirtualHost::getCurrentVirtualHost())) {
throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname"));
}
$html_headers = "<script src='http://maps.google.com/maps?file=api&v=2&&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>";
$html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>";
$html = null;
/*
* Main content
*/
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Set network selector
$preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork();
//$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();"));
$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();"));
$smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));