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'];
 }
 protected static function _import()
 {
     $settings = PrisnaGWTConfig::getDefaults(true);
     $key = $settings['import']['id'];
     $value = PrisnaGWTCommon::getVariable($key, 'POST');
     if ($value === false || PrisnaGWTValidator::isEmpty($value)) {
         return null;
     }
     $decode = base64_decode($value);
     if ($decode === false) {
         self::_set_imported_status(false);
         return false;
     }
     $unserialize = @unserialize($decode);
     if (!is_array($unserialize)) {
         self::_set_imported_status(false);
         return false;
     }
     $result = array();
     foreach ($settings as $key => $setting) {
         if (in_array($key, array('import', 'export'))) {
             continue;
         }
         if (array_key_exists($key, $unserialize)) {
             $result[$key] = $unserialize[$key];
         }
     }
     if (count($result) == 0) {
         self::_set_imported_status(false);
         return false;
     }
     self::_commit(PrisnaGWTConfig::getDbSettingsName(), $result);
     self::_set_imported_status(true);
     return true;
 }
 protected function _gen_options()
 {
     $this->align_mode = PrisnaGWTConfig::getSettingValue('align_mode');
     $this->_gen_layout();
     $this->_gen_languages();
     $this->_gen_google_analytics();
     $this->_gen_banner();
     $this->_gen_flags();
     $result = array();
     foreach ($this->_properties as $key => $property) {
         if (array_key_exists('option_id', $property) && !PrisnaGWTValidator::isEmpty($property['option_id'])) {
             $result[$key] = array('option_id' => $property['option_id'], 'value' => $this->_prepare_option_value($key, $property['value']));
         }
     }
     $this->options_formatted = PrisnaGWTCommon::renderObject($result, array('type' => 'html', 'content' => "\t\t{{ option_id }}: {{ value }},\n"));
     $this->options_formatted = preg_replace('/,\\n$/', "\n", $this->options_formatted);
 }
 public function output($_template = 'select.tpl', $_html_encode = false)
 {
     $this->collection_formatted = $this->collection->render(array('type' => 'html', 'content' => '{{ collection }}'), $_html_encode);
     $result = parent::render(array('type' => 'file', 'content' => '/admin/' . $_template, 'meta_tag_rules' => array(array('expression' => property_exists($this, 'post_id') && !PrisnaGWTValidator::isEmpty($this->post_id), 'tag' => 'has_post_id'))), $_html_encode);
     return $result;
 }
 protected static function displayHideBlock($_name, $_html, $_state)
 {
     if ($_state) {
         $_names = array("{{ {$_name}:begin }}", "{{ {$_name}:end }}");
         $results = str_replace($_names, '', $_html);
     } else {
         $occurrence_ini = strpos($_html, "{{ {$_name}:begin }}");
         $occurrence_end = strpos($_html, "{{ {$_name}:end }}", $occurrence_ini);
         $last_occurrence_ini = 0;
         $positions = array();
         $results = $_html;
         while (!PrisnaGWTValidator::isEmpty($occurrence_ini) && PrisnaGWTValidator::isInteger($occurrence_ini) && !PrisnaGWTValidator::isEmpty($occurrence_end) && PrisnaGWTValidator::isInteger($occurrence_end)) {
             $positions[] = array($occurrence_ini, $occurrence_end);
             $occurrence_ini = strpos($_html, "{{ {$_name}:begin }}", $occurrence_end);
             $occurrence_end = strpos($_html, "{{ {$_name}:end }}", $occurrence_ini);
         }
         $_name_length = strlen("{{ {$_name}:end }}");
         $results = $_html;
         rsort($positions);
         foreach ($positions as $position) {
             $results = substr_replace($results, '', $position[0], $position[1] - $position[0] + $_name_length);
         }
     }
     return $results;
 }