/** * Class Constructor. Defines the args for the theme options class * @since 1.0.0 * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. // REMOVE * @return \ReduxFramework */ public function __construct($sections = array(), $args = array(), $extra_tabs = array()) { global $wp_version; // Disregard WP AJAX 'heartbeat'call. Why waste resources? if (isset($_POST) && isset($_POST['action']) && $_POST['action'] == 'heartbeat') { // Hook, for purists. if (!has_action('redux/ajax/heartbeat')) { do_action('redux/ajax/heartbeat', $this); } // Buh bye! return; } // Pass parent pointer to function helper. Redux_Functions::$_parent = $this; // Set values $this->args = wp_parse_args($args, $this->args); if (empty($this->args['transient_time'])) { $this->args['transient_time'] = 60 * MINUTE_IN_SECONDS; } if (empty($this->args['footer_credit'])) { $this->args['footer_credit'] = '<span id="footer-thankyou">' . sprintf(__('Options panel created using %1$s', 'redux-framework'), '<a href="' . esc_url($this->framework_url) . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version) . '</span>'; } if (empty($this->args['menu_title'])) { $this->args['menu_title'] = __('Options', 'redux-framework'); } if (empty($this->args['page_title'])) { $this->args['page_title'] = __('Options', 'redux-framework'); } /** * filter 'redux/args/{opt_name}' * @param array $args ReduxFramework configuration */ $this->args = apply_filters("redux/args/{$this->args['opt_name']}", $this->args); /** * filter 'redux/options/{opt_name}/args' * @param array $args ReduxFramework configuration */ $this->args = apply_filters("redux/options/{$this->args['opt_name']}/args", $this->args); if (!empty($this->args['opt_name'])) { /** SHIM SECTION Old variables and ways of doing things that need correcting. ;) **/ // Variable name change if (!empty($this->args['page_cap'])) { $this->args['page_permissions'] = $this->args['page_cap']; unset($this->args['page_cap']); } if (!empty($this->args['page_position'])) { $this->args['page_priority'] = $this->args['page_position']; unset($this->args['page_position']); } if (!empty($this->args['page_type'])) { $this->args['menu_type'] = $this->args['page_type']; unset($this->args['page_type']); } // Get rid of extra_tabs! Not needed. if (is_array($extra_tabs) && !empty($extra_tabs)) { foreach ($extra_tabs as $tab) { array_push($this->sections, $tab); } } // Move to the first loop area! /** * filter 'redux-sections' * @deprecated * @param array $sections field option sections */ $this->sections = apply_filters('redux-sections', $sections); // REMOVE LATER /** * filter 'redux-sections-{opt_name}' * @deprecated * @param array $sections field option sections */ $this->sections = apply_filters("redux-sections-{$this->args['opt_name']}", $this->sections); // REMOVE LATER /** * filter 'redux/options/{opt_name}/sections' * @param array $sections field option sections */ $this->sections = apply_filters("redux/options/{$this->args['opt_name']}/sections", $this->sections); /** * Construct hook * action 'redux/construct' * @param object $this ReduxFramework */ do_action('redux/construct', $this); // Set the default values $this->_default_cleanup(); // Internataionalization $this->_internationalization(); // Register extra extensions $this->_register_extensions(); // Grab database values $this->get_options(); // Tracking $this->_tracking(); // Set option with defaults //add_action( 'init', array( &$this, '_set_default_options' ), 101 ); // Options page add_action('admin_menu', array($this, '_options_page')); // Admin Bar menu add_action('admin_bar_menu', array($this, '_admin_bar_menu'), 999); // Register setting add_action('admin_init', array($this, '_register_settings')); // Display admin notices in dev_mode if (true == $this->args['dev_mode']) { include_once self::$_dir . 'inc/debug.php'; $this->debug = new ReduxDebugObject($this); if (true == $this->args['update_notice']) { add_action('admin_init', array($this, '_update_check')); } } // Display admin notices add_action('admin_notices', array($this, '_admin_notices')); // Check for dismissed admin notices. add_action('admin_init', array($this, '_dismiss_admin_notice'), 9); // Enqueue the admin page CSS and JS if (isset($_GET['page']) && $_GET['page'] == $this->args['page_slug']) { add_action('admin_enqueue_scripts', array($this, '_enqueue')); } // Any dynamic CSS output, let's run add_action('wp_head', array(&$this, '_enqueue_output'), 150); require_once self::$_dir . 'inc/fields/import_export/import_export.php'; $this->import_export = new Redux_import_export($this); // mod_rewrite check Redux_Functions::modRewriteCheck(); } /** * Loaded hook * * action 'redux/loaded' * @param object $this ReduxFramework */ do_action('redux/loaded', $this); }