function _init() { $this->_storage = new ITStorage2('builder-exports', array('version' => builder_get_data_version('builder-exports'), 'autoload' => false)); $this->_exports = $this->_storage->load(); if (!is_array($this->_exports['exports'])) { $this->_exports['exports'] = array(); } uasort($this->_exports['exports'], array($this, '_sort_exports')); if (!empty($_REQUEST['action'])) { $action = $_REQUEST['action']; } else { if (!empty($_REQUEST['action2'])) { $action = $_REQUEST['action2']; } } $cancel = isset($_REQUEST['cancel']); if (!empty($action)) { if ('export' === $action && false === $cancel) { $this->_export(); } else { if ('import' === $action && false === $cancel) { $this->_import(); } else { if ('import_methods' === $action) { $this->_parent->_nonce = "import_methods_guid_{$_REQUEST['guid']}"; } else { if ('import_customize' === $action) { $this->_parent->_nonce = "import_customize_guid_{$_REQUEST['guid']}"; } else { if ('import_conflicts' === $action) { $this->_parent->_nonce = "import_conflicts_guid_{$_REQUEST['guid']}"; } else { if ('import_confirm' === $action) { $this->_parent->_nonce = "import_confirm_guid_{$_REQUEST['guid']}"; } else { if ('import_run' === $action) { $this->_parent->_nonce = "import_run_guid_{$_REQUEST['guid']}"; if (false === $cancel) { add_action('admin_init', array($this, 'run_import')); } } else { if ('delete' === $action && false === $cancel) { $this->_delete(); } } } } } } } } } if (true === $cancel) { unset($_REQUEST['action']); } builder_add_settings_editor_box(__('Site Exports', 'it-l10n-Builder-Cohen'), null, array('var' => 'site_exports', '_builtin' => true, 'tab' => 'import-export')); builder_add_settings_editor_box(__('Export Data', 'it-l10n-Builder-Cohen'), null, array('var' => 'export', '_builtin' => true, 'tab' => 'import-export')); builder_add_settings_editor_box(__('Import Data', 'it-l10n-Builder-Cohen'), null, array('var' => 'import', '_builtin' => true, 'tab' => 'import-export')); }
function ITThemeSettings() { $this->_storage_version = builder_get_data_version('theme-settings'); $this->_page_title = _x('Theme Settings', 'page title', 'it-l10n-Builder-Cohen'); $this->_menu_title = _x('Settings', 'menu title', 'it-l10n-Builder-Cohen'); $this->ITCoreClass(); $this->_file = __FILE__; }
function builder_load_theme_settings($set_global = false) { $storage = new ITStorage2('builder-theme-settings', builder_get_data_version('theme-settings')); $settings = $storage->load(); if (true === $set_global) { $GLOBALS['wp_theme_options'] = $settings; } return $settings; }
function BuilderLayoutEditor() { $this->_storage_version = builder_get_data_version('layout-settings'); $this->_page_title = _x('Manage Layouts and Views', 'page title', 'it-l10n-Builder-Paige'); $this->_menu_title = _x('Layouts & Views', 'menu title', 'it-l10n-Builder-Paige'); $this->ITCoreClass(); $this->_file = __FILE__; require_once builder_main_get_builder_core_path() . '/lib/layout-engine/layout-meta-box.php'; // This action has to be pushed back in order to allow the after_switch_theme action to fire first. remove_action('init', array(&$this, 'init'), 0); add_action('init', array(&$this, 'init'), 1000); }
function _get_updated_layout_settings($layout_settings, $export_data, $post_data, $meta, $attachments = array()) { $layouts = $this->_get_updated_layouts($layout_settings, $export_data, $post_data, $attachments); $views = $this->_get_updated_views($layout_settings, $export_data, $post_data, $meta, $layouts); $layout_settings['layouts'] = $layouts['data']; $layout_settings['views'] = $views['data']; unset($layouts['data']); unset($views['data']); if (!empty($post_data['default_layout'])) { list($source, $guid) = explode('-', $post_data['default_layout']); if (isset($layouts['guids'][$source][$guid]) && isset($layout_settings['layouts'][$layouts['guids'][$source][$guid]])) { $guid = $layouts['guids'][$source][$guid]; } else { if (isset($layouts['guids']['site'][$layout_settings['default']]) && isset($layout_settings['layouts'][$layouts['guids']['site'][$layout_settings['default']]])) { $guid = $layouts['guids']['site'][$layout_settings['default']]; } else { if (isset($layouts['guids']['import'][$export_data['default']]) && isset($layout_settings['layouts'][$layouts['guids']['import'][$export_data['default']]])) { $guid = $layouts['guids']['import'][$export_data['default']]; } } } if (isset($layout_settings['layouts'][$guid])) { $layout_settings['default'] = $guid; } else { $layout_settings['default'] = key($layout_settings['layouts']); } } else { if ('replace' === $post_data['method']) { $layout_settings['default'] = $export_data['default']; } } if (!isset($layout_settings['layouts'][$layout_settings['default']])) { $layout_settings['default'] = key($layout_settings['layouts']); } $layout_settings['layouts'] = ITUtility::sort_array($layout_settings['layouts'], 'description'); $info = array('layouts' => $layouts, 'views' => $views); $upgrade_data = array('data' => $layout_settings, 'current_version' => builder_get_data_version('layout-settings')); require_once dirname(__FILE__) . '/upgrade-storage.php'; $upgrade_data = apply_filters('it_storage_upgrade_layout_settings', $upgrade_data); $layout_settings = $upgrade_data['data']; return array('data' => $layout_settings, 'info' => $info); }
function _force_load_layout_settings() { $storage_version = builder_get_data_version('layout-settings'); $storage = new ITStorage('layout_settings', $storage_version); $this->_layout_settings = apply_filters('it_storage_load_layout_settings', array()); }
function get_version() { return builder_get_data_version('theme-settings'); }