public function render($_options, $_html_encode = false) { $this->_prepare_settings(); $is_importing = PrisnaGWTAdminEvents::isSavingSettings() && PrisnaGWTValidator::isBool(self::getImportedStatus()); if (!array_key_exists('meta_tag_rules', $_options)) { $_options['meta_tag_rules'] = array(); } $_options['meta_tag_rules'][] = array('expression' => PrisnaGWTAdminEvents::isSavingSettings() && !$is_importing, 'tag' => 'just_saved'); $_options['meta_tag_rules'][] = array('expression' => $is_importing && self::getImportedStatus(), 'tag' => 'just_imported_success'); $_options['meta_tag_rules'][] = array('expression' => $is_importing && !self::getImportedStatus(), 'tag' => 'just_imported_fail'); $_options['meta_tag_rules'][] = array('expression' => !version_compare($GLOBALS['wp_version'], PRISNA_GWT__MINIMUM_WP_VERSION, '<'), 'tag' => 'wp_version_check'); $_options['meta_tag_rules'][] = array('expression' => PrisnaGWTAdminEvents::isResetingSettings(), 'tag' => 'just_reseted'); return parent::render($_options, $_html_encode); }
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; }
public static function getSettingValue($_name, $_force = false) { $setting = self::getSetting($_name, $_force); if (is_null($setting)) { return null; } $result = $setting['value']; if (PrisnaGWTValidator::isBool($result)) { $result = $result == 'true' || $result === true; } 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; }