function _add_script_vars($script_id, $widget_id, $data, $frontend = true, $backend = false) { if ($this->is_fontend_rendering) { if ($frontend !== true) { return; } } else { if ($backend !== true) { return; } } if (!isset($this->footer_data[$script_id])) { $this->footer_data[$script_id] = array(); } if (!isset($this->footer_data[$script_id][$widget_id])) { $this->footer_data[$script_id][$widget_id] = array(); } $this->footer_data[$script_id][$widget_id] = xtreme_merge_options($data, $this->footer_data[$script_id][$widget_id]); }
function xtreme_validate_framework() { //check if we activated or previewed the first time and attached the missing options $needed_options = array(XF_OPTIONS, XF_LAYOUTS, XF_TEMPLATES, XF_WIDGET_PERMISSIONS); $install_options = array(); foreach ($needed_options as $option) { if (get_option($option) === false) { $install_options[] = $option; } } if (count($install_options) > 0 || version_compare(get_option(XF_VERSION_FIELD), XF_VERSION, '<')) { $file_xml = XF_ADMIN_DIR . '/install/xtreme-one-install-config.xml'; $defaults = false; if (file_exists($file_xml)) { $processor = new xtreme_xml_processor(); $xml = file_get_contents($file_xml); $xml = str_replace('[install]', XF_ACTIVE_STYLESHEET, $xml); $defaults = $processor->_convert_to_array(XF_VERSION, $xml); } if ($defaults !== false && is_array($defaults)) { //perform install first foreach ($install_options as $option) { if (isset($defaults[$option])) { update_option($option, $defaults[$option]); } } //perform upgrade secondly if (version_compare(get_option(XF_VERSION_FIELD), XF_VERSION, '<')) { foreach ($needed_options as $option) { if (!in_array($option, $install_options)) { $o = get_option($option); $n = $defaults[$option]; if (is_array($n) || is_array($o)) { if (!is_array($n)) { $n = xtreme_merge_options(array(), $o); } elseif (!is_array($o)) { if (!empty($o)) { $n = xtreme_merge_options($n, (array) $o); } } else { $n = xtreme_merge_options($n, $o); } } else { $n = $o; } update_option($option, $n); } } update_option(XF_VERSION_FIELD, XF_VERSION); if (is_admin()) { global $xtreme_backend; $xtreme_backend->generate_theme(); } } } else { $errors = get_option(XF_UPDATE_ERRORS, array()); $error = __('There was an error during install/upgrade of <b>Xtreme One</b> Theme Framework. The default value definition file is missing or damaged.', XF_TEXTDOMAIN); if (!in_array($error, $errors)) { $errors[] = $error; } update_option(XF_UPDATE_ERRORS, $errors); } } }