本文整理汇总了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');
}
}