public static function save() { if (!is_null(self::_import())) { return; } $settings = PrisnaGWTConfig::getDefaults(); $result = array(); foreach ($settings as $key => $setting) { $value = PrisnaGWTCommon::getVariable($setting['id'], 'POST'); switch ($key) { case 'languages': $value = PrisnaGWTCommon::getVariable(str_replace('languages', 'languages_order', $setting['id']), 'POST'); if ($value !== false) { $value = explode(',', $value); if ($value !== $setting['value']) { $result[$key] = array('value' => $value); } else { unset($result[$key]); } } else { unset($result[$key]); } break; case 'import': case 'export': continue; break; default: if ($key == 'id' || PrisnaGWTCommon::endsWith($key, '_class') && $key != 'language_selector_class' && $key != 'translated_to_class') { $value = trim(PrisnaGWTCommon::cleanId($value)); } else { if ($key == 'translated_to_class') { $value = trim(PrisnaGWTCommon::cleanId($value, '-', false)); } } $unset_template = PrisnaGWTCommon::endsWith($key, '_template') && PrisnaGWTCommon::stripBreakLinesAndTabs($value) == PrisnaGWTCommon::stripBreakLinesAndTabs($setting['value']); if (!$unset_template && $value !== false && $value != $setting['value']) { $result[$key] = array('value' => $value); } else { unset($result[$key]); } break; } } if (array_key_exists('display_mode', $result) && $result['display_mode']['value'] == 'tabbed' && !array_key_exists('banner', $result)) { $result['banner'] = array('value' => 'false'); } self::_commit(PrisnaGWTConfig::getDbSettingsName(), $result); }
protected function _set_options() { $this->collection = new PrisnaGWTItemCollection(); foreach ($this->values as $key => $value) { $this->collection->add(new PrisnaGWTExclitemOptionField((object) array('id' => PrisnaGWTCommon::cleanId($this->id . '_' . $key, '_'), 'name' => $this->id, 'checked' => is_array($this->value) ? in_array((string) $key, $this->value, true) : false, 'option' => $key, 'indent' => $value['indent'] * 20, 'value' => $value['value'])), $key); } }