protected static function _compare_settings($_id, $_setting_1, $_setting_2) { if (PrisnaGWTCommon::endsWith($_id, '_template') || PrisnaGWTCommon::endsWith($_id, '_template_dd')) { return PrisnaGWTCommon::stripBreakLinesAndTabs($_setting_1['value']) == PrisnaGWTCommon::stripBreakLinesAndTabs($_setting_2['value']); } if ($_id == 'override') { if ($_setting_1['value'] != $_setting_2['value'] && PrisnaGWTValidator::isEmpty($_setting_1['value'])) { return true; } } if ($_id == 'languages') { return $_setting_1['value'] === $_setting_2['value']; } return $_setting_1['value'] == $_setting_2['value']; }
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); }
public static function getFilesPaths($_folder, $_globals = false) { $contents = @scandir($_folder); $result = array(); if (empty($contents)) { return $result; } foreach ($contents as $name) { $file = $_folder . '/' . $name; if (PrisnaGWTCommon::endsWith($name, '.xml') && !PrisnaGWTCommon::startsWith($name, 'permalinks') && !PrisnaGWTCommon::startsWith($name, 'log_') && @is_file($file) && ($_globals || !PrisnaGWTCommon::endsWith($name, 'global.xml'))) { $result[] = $file; } } return $result; }