本文整理匯總了PHP中core\Config::dynamicLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::dynamicLoad方法的具體用法?PHP Config::dynamicLoad怎麽用?PHP Config::dynamicLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core\Config
的用法示例。
在下文中一共展示了Config::dynamicLoad方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
/**
* Saves the new settings and calls the render
*
* @param array $args
* Array containing the request
*/
public function save(array $args)
{
/* Save the settings */
if (isset($_REQUEST['language'])) {
$settings['lang'] = $_REQUEST['language'];
} else {
$settings['lang'] = \Core\Config::$DEFAULT_LANG;
}
if (isset($_REQUEST['theme'])) {
$settings['theme'] = $_REQUEST['theme'];
} else {
$settings['theme'] = \Core\Config::$DEFAULT_CSS_THEME;
}
/* REMOTE_SERVER_IP must have http:// at the start of the string */
if (isset($_REQUEST['serverIp'])) {
$prefix = 'http://';
$settings['serverIp'] = $_REQUEST['serverIp'];
if (!(substr($settings['serverIp'], 0, strlen($prefix)) === $prefix)) {
$settings['serverIp'] = $prefix . $settings['serverIp'];
}
} else {
$settings['serverIp'] = \Core\Config::$REMOTE_SERVER_IP;
}
/* Cache string for the latest change in generated javascripts */
$settings['cacheTime'] = time();
$ctrl = $this->model->saveSettings($settings);
/* Loads the new settings */
\Core\Config::dynamicLoad();
/* Reloads the model and renders the page */
$this->model = new settingsModel();
$this->view = new settingsView($this->model);
$this->view->render();
/* Renders the notification */
if ($ctrl === TRUE) {
$this->view->renderNotification(_('Settings saved successfully'), 'success');
} else {
$this->view->renderNotification(_('Error saving settings'), 'danger');
\Core\Logger::logWarning('Failed to save settings');
}
}