本文整理汇总了PHP中Piwik_Url::saveTrustedHostnameInConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::saveTrustedHostnameInConfig方法的具体用法?PHP Piwik_Url::saveTrustedHostnameInConfig怎么用?PHP Piwik_Url::saveTrustedHostnameInConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::saveTrustedHostnameInConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGeneralSettings
public function setGeneralSettings()
{
Piwik::checkUserIsSuperUser();
$response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format'));
try {
$this->checkTokenInUrl();
$enableBrowserTriggerArchiving = Piwik_Common::getRequestVar('enableBrowserTriggerArchiving');
$todayArchiveTimeToLive = Piwik_Common::getRequestVar('todayArchiveTimeToLive');
Piwik_ArchiveProcessing::setBrowserTriggerArchiving((bool) $enableBrowserTriggerArchiving);
Piwik_ArchiveProcessing::setTodayArchiveTimeToLive($todayArchiveTimeToLive);
// Update email settings
$mail = array();
$mail['transport'] = Piwik_Common::getRequestVar('mailUseSmtp') == '1' ? 'smtp' : '';
$mail['port'] = Piwik_Common::getRequestVar('mailPort', '');
$mail['host'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailHost', ''));
$mail['type'] = Piwik_Common::getRequestVar('mailType', '');
$mail['username'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailUsername', ''));
$mail['password'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailPassword', ''));
$mail['encryption'] = Piwik_Common::getRequestVar('mailEncryption', '');
Piwik_Config::getInstance()->mail = $mail;
// update branding settings
$branding = Piwik_Config::getInstance()->branding;
$branding['use_custom_logo'] = Piwik_Common::getRequestVar('useCustomLogo', '0');
Piwik_Config::getInstance()->branding = $branding;
// update trusted host settings
$trustedHosts = Piwik_Common::getRequestVar('trustedHosts', false, 'json');
if ($trustedHosts !== false) {
Piwik_Url::saveTrustedHostnameInConfig($trustedHosts);
}
Piwik_Config::getInstance()->forceSave();
$toReturn = $response->getResponse();
} catch (Exception $e) {
$toReturn = $response->getResponseException($e);
}
echo $toReturn;
}