function active_init() { global $builder_settings_tabs; $tab_order = array_keys($builder_settings_tabs); $this->_editor_tabs = apply_filters('builder_filter_theme_settings_tabs', $builder_settings_tabs); $this->_tab_order = apply_filters('builder_filter_theme_settings_tab_order', $tab_order); ksort($this->_tab_order); $this->_active_tab = !empty($_REQUEST['editor_tab']) ? $_REQUEST['editor_tab'] : reset($this->_tab_order); if (!isset($this->_editor_tabs[$this->_active_tab])) { ITError::fatal('The active tab for the Theme Settings page does not exist in the theme_settings_tabs array. This indicates that some custom code added a tab using the builder_filter_theme_settings_tab_order filter but did not update the registered tabs using the builder_filter_theme_settings_tabs filter.'); } require_once dirname(__FILE__) . '/class.settings-tab.php'; foreach ((array) $this->_editor_tabs as $id => $tab) { if (is_null($tab['class'])) { continue; } if (!empty($tab['file']) && is_file($tab['file'])) { require_once $tab['file']; } if (!class_exists($tab['class'])) { ITError::fatal("The {$this->_editor_tabs[$this->_active_tab]['class']} class should have been registered. However, the class was not found."); } $object = new $tab['class']($this); if ($id == $this->_active_tab) { $this->_tab_object = $object; } } $this->_tabless_self_link = $this->_self_link; $this->_self_link .= "&editor_tab={$this->_active_tab}"; if (method_exists($this->_tab_object, 'init')) { $this->_tab_object->init(); } if (isset($_POST['save']) && method_exists($this->_tab_object, 'save_handler')) { $this->_tab_object->save_handler(); } if (isset($_POST['reset']) && method_exists($this->_tab_object, 'reset_handler')) { $this->_tab_object->reset_handler(); } }
function ITStorage2($var, $args = array()) { if (is_string($args)) { $args = array('version' => $args); } $default_args = array('version' => 0, 'autoload' => true); $args = wp_parse_args($args, $default_args); $this->_var = $var; $this->_option_name = "it-storage-{$var}"; $this->_storage_version = $args['version']; $this->_autoload = !$args['autoload'] || 'no' === $args['autoload'] ? 'no' : 'yes'; if (empty($this->_var)) { ITError::fatal('empty_parameter:0', 'Unable to store or retrieve data due to empty first parameter passed to ITStorage2.'); } add_action('it_storage_reset', array(&$this, 'reset')); add_action('it_storage_remove', array(&$this, 'remove')); add_action("it_storage_clear_cache_{$this->_var}", array(&$this, 'clear_cache')); add_action("it_storage_save_{$this->_var}", array(&$this, 'save')); add_action("it_storage_reset_{$this->_var}", array(&$this, 'reset')); add_action("it_storage_remove_{$this->_var}", array(&$this, 'remove')); add_filter("it_storage_load_{$this->_var}", array(&$this, 'load')); }
function _load() { if (false == $this->_use_storage) { return; } if (!isset($this->_storage) || !is_callable(array($this->_storage, 'load'))) { ITError::fatal("empty_var:class_var:{$this->_class}->_storage", "The {$this->_class} class did not set the \$this->_storage variable. This should be set by the ITPostType class, ensure that the ITPostType::ITPostType() method is called."); } $this->_options = $this->_storage->load(); }
public static function sort_array_by_index($array, $index) { if (!is_array($array)) { ITError::fatal('invalid_var:parameter:array', 'Invalid data was passed to ITUtility::sort_array_by_index. This indicates a code bug.'); } $new_array = array(); $indexes = array(); foreach ((array) $array as $sub_index => $sub_array) { $indexes[$sub_index] = $sub_array[$index]; } asort($indexes); foreach ((array) $indexes as $sub_index => $sub_value) { $new_array[] = $array[$sub_index]; } return $new_array; }