本文整理汇总了PHP中Preferences::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::Load方法的具体用法?PHP Preferences::Load怎么用?PHP Preferences::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
/**
* @access private
* @return string
*/
function _SavePage()
{
// Load the main-preferences file
$this->_Preferences->Load('system/settings.php');
// Load the preferences files of the modules (if there are some)
// get the activated modules
$modulesActivated = unserialize($this->_Config->Get('modules_activated'));
// some data aviailable?
if (is_array($modulesActivated)) {
if (count($modulesActivated) >= 0) {
foreach ($modulesActivated as $moduleName) {
$settingsFile = "modules/{$moduleName}/{$moduleName}_settings.php";
if (file_exists($settingsFile)) {
// Load the config file of this module
$this->_Preferences->Load($settingsFile);
}
}
}
}
if (count($this->_Preferences->Settings) <= 0) {
return $this->GetPage('');
}
// Go through all preferences entries
foreach ($this->_Preferences->Settings as $settings) {
foreach ($settings as $setting) {
$settingValue = GetPostOrGet('setting_' . $setting['name']);
//TODO : value-type-check!!
if (!empty($settingValue) || is_numeric($settingValue) && $settingValue == 0 || $setting['datatype'] == 'string0') {
$currentValue = $this->_Config->Get($setting['name']);
// Check if something has changed
if ($currentValue != $settingValue) {
// TODO: check the data before saving
$this->_Config->Save($setting['name'], $settingValue);
}
}
}
}
// Show the 'main-view'
return $this->GetPage('');
}