本文整理匯總了PHP中Piwik\Url::saveTrustedHostnameInConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::saveTrustedHostnameInConfig方法的具體用法?PHP Url::saveTrustedHostnameInConfig怎麽用?PHP Url::saveTrustedHostnameInConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Url
的用法示例。
在下文中一共展示了Url::saveTrustedHostnameInConfig方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setTrustedHosts
/**
* @internal
*/
public function setTrustedHosts($trustedHosts)
{
Piwik::checkUserHasSuperUserAccess();
if (!Controller::isGeneralSettingsAdminEnabled()) {
throw new Exception('General settings admin is ont enabled');
}
if (!empty($trustedHosts)) {
Url::saveTrustedHostnameInConfig($trustedHosts);
Config::getInstance()->forceSave();
}
return true;
}
示例2: saveGeneralSettings
private function saveGeneralSettings()
{
if (!self::isGeneralSettingsAdminEnabled()) {
// General settings + Beta channel + SMTP settings is disabled
return;
}
// General Setting
$enableBrowserTriggerArchiving = Common::getRequestVar('enableBrowserTriggerArchiving');
$todayArchiveTimeToLive = Common::getRequestVar('todayArchiveTimeToLive');
Rules::setBrowserTriggerArchiving((bool) $enableBrowserTriggerArchiving);
Rules::setTodayArchiveTimeToLive($todayArchiveTimeToLive);
// update beta channel setting
$debug = Config::getInstance()->Debug;
$debug['allow_upgrades_to_beta'] = Common::getRequestVar('enableBetaReleaseCheck', '0', 'int');
Config::getInstance()->Debug = $debug;
// Update email settings
$mail = array();
$mail['transport'] = Common::getRequestVar('mailUseSmtp') == '1' ? 'smtp' : '';
$mail['port'] = Common::getRequestVar('mailPort', '');
$mail['host'] = Common::unsanitizeInputValue(Common::getRequestVar('mailHost', ''));
$mail['type'] = Common::getRequestVar('mailType', '');
$mail['username'] = Common::unsanitizeInputValue(Common::getRequestVar('mailUsername', ''));
$mail['password'] = Common::unsanitizeInputValue(Common::getRequestVar('mailPassword', ''));
$mail['encryption'] = Common::getRequestVar('mailEncryption', '');
Config::getInstance()->mail = $mail;
// update trusted host settings
$trustedHosts = Common::getRequestVar('trustedHosts', false, 'json');
if ($trustedHosts !== false) {
Url::saveTrustedHostnameInConfig($trustedHosts);
}
Config::getInstance()->forceSave();
$pluginUpdateCommunication = new UpdateCommunication();
if (Common::getRequestVar('enablePluginUpdateCommunication', '0', 'int')) {
$pluginUpdateCommunication->enable();
} else {
$pluginUpdateCommunication->disable();
}
}
示例3: setGeneralSettings
public function setGeneralSettings()
{
Piwik::checkUserIsSuperUser();
$response = new ResponseBuilder(Common::getRequestVar('format'));
try {
$this->checkTokenInUrl();
$this->saveGeneralSettings();
// update trusted host settings
$trustedHosts = Common::getRequestVar('trustedHosts', false, 'json');
if ($trustedHosts !== false) {
Url::saveTrustedHostnameInConfig($trustedHosts);
}
// update branding settings
$branding = Config::getInstance()->branding;
$branding['use_custom_logo'] = Common::getRequestVar('useCustomLogo', '0');
Config::getInstance()->branding = $branding;
Config::getInstance()->forceSave();
$toReturn = $response->getResponse();
} catch (Exception $e) {
$toReturn = $response->getResponseException($e);
}
return $toReturn;
}