<?php /**
 * Redux Framework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * any later version.
 *
 * Redux Framework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.&#13;
 *&#13;
 * @package     ReduxFramework&#13;
 * @author      ReduxFramework Team&#13;
 * @version     3.0.5&#13;
 */&#13;
&#13;
// Exit if accessed directly&#13;
if( !defined( 'ABSPATH' ) ) exit;&#13;
&#13;
&#13;
&#13;
// Don't duplicate me!&#13;
if( !class_exists( 'ReduxFramework' ) ) {&#13;
&#13;
    /**&#13;
     * Main ReduxFramework class&#13;
     *&#13;
     * @since       1.0.0&#13;
     */&#13;
    class ReduxFramework {&#13;
&#13;
        public static $_version = '3.0.5';&#13;
        public static $_dir; &#13;
        public static $_url;        &#13;
/**&#13;
&#13;
&#13;
            &#13;
            $defaults['footer_credit']      = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="'%20.%20%24this-&gt;framework_url%20.%20'" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>';&#13;
            $defaults['help_tabs']          = array();&#13;
            $defaults['help_sidebar']       = ''; // __( '', 'redux-framework' );&#13;
            $defaults['database']           = ''; // possible: options, theme_mods, theme_mods_expanded, transient&#13;
            $defaults['customizer']         = false; // setting to true forces get_theme_mod_expanded&#13;
            $defaults['global_variable']    = '';&#13;
            $defaults['output']             = true; // Dynamically generate CSS&#13;
            $defaults['transient_time']     = 60 * MINUTE_IN_SECONDS;&#13;
&#13;
            // The defaults are set so it will preserve the old behavior.&#13;
            $defaults['default_show']       = false; // If true, it shows the default value&#13;
            $defaults['default_mark']       = ''; // What to print by the field's title if the value shown is default&#13;
*/&#13;
        public static $_properties;&#13;
&#13;
        static function init() {&#13;
            // Windows-proof constants: replace backward by forward slashes&#13;
            // Thanks to: @peterbouwmeester&#13;
            /** @noinspection PhpUndefinedFunctionInspection */&#13;
            $fslashed_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );&#13;
            $fslashed_abs = trailingslashit( str_replace( '\\', '/', ABSPATH ) );&#13;
            // Fix for when Wordpress is not in the wp-content directory&#13;
            if (strpos($fslashed_dir,$fslashed_abs) === false) {&#13;
                $parts = explode('/', $fslashed_abs);&#13;
                $test = str_replace('/'.max($parts), '', $fslashed_abs);&#13;
                if (strpos($fslashed_dir,$test) !== false) {&#13;
                    $fslashed_abs = $test;&#13;
                }&#13;
            }&#13;
&#13;
            self::$_dir = $fslashed_dir;&#13;
            self::$_url = site_url( str_replace( $fslashed_abs, '', $fslashed_dir ) );&#13;
&#13;
            self::$_properties = array( &#13;
                'args' =&gt; array(&#13;
                    'opt_name' =&gt; array(&#13;
                            'required', &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Option Name', &#13;
                            'desc'=&gt;'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', &#13;
                            'default'=&gt;''&#13;
                        ),&#13;
                    'google_api_key' =&gt; array(&#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Google Web Fonts API Key', &#13;
                            'desc'=&gt;'Key used to request Google Webfonts. Google fonts are omitted without this.', &#13;
                            'default'=&gt;''&#13;
                        ),&#13;
                    'last_tab' =&gt; array( // Do we need this?&#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Last Tab', &#13;
                            'desc'=&gt;'Last tab used.', &#13;
                            'default'=&gt;'0'&#13;
                        ),  &#13;
                    'menu_icon' =&gt; array( &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Default Menu Icon', &#13;
                            'desc'=&gt;'Default menu icon used by sections when one is not specified.', &#13;
                            'default'=&gt; self::$_url . 'assets/img/menu_icon.png'&#13;
                        ),                  &#13;
&#13;
                    'menu_title' =&gt; array( &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Menu Title', &#13;
                            'desc'=&gt;'Label displayed when the admin menu is available.', &#13;
                            'default'=&gt; __( 'Options', 'redux-framework' )&#13;
                        ),              &#13;
                    'page_title' =&gt; array( &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Page Title', &#13;
                            'desc'=&gt;'Title used on the panel page.', &#13;
                            'default'=&gt; __( 'Options', 'redux-framework' )&#13;
                        ),  &#13;
                   'page_icon' =&gt; array( &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Page Title', &#13;
                            'desc'=&gt;'Icon class to be used on the options page.', &#13;
                            'default'=&gt; 'icon-themes'&#13;
                        ),      &#13;
                   'page_slug' =&gt; array( &#13;
                            'required', &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Page Slug', &#13;
                            'desc'=&gt;'Slug used to access options panel.', &#13;
                            'default'=&gt; '_options'&#13;
                        ),    &#13;
                   'page_cap' =&gt; array( &#13;
                            'required', &#13;
                            'data_type'=&gt;'string', &#13;
                            'label'=&gt;'Page Capabilities', &#13;
                            'desc'=&gt;'Permissions needed to access the options panel.', &#13;
                            'default'=&gt; 'manage_options'&#13;
                        ),  &#13;
                   'page_cap' =&gt; array( &#13;
                            'required', &#13;
                            'type'=&gt;'string', &#13;
                            'label'=&gt;'Page Capabilities', &#13;
                            'desc'=&gt;'Permissions needed to access the options panel.', &#13;
                            'default'=&gt; 'manage_options'&#13;
                        ),&#13;
                    'page_type' =&gt; array(&#13;
                        'required', &#13;
                        'data_type' =&gt; 'varchar',&#13;
                        'label' =&gt; 'Page Type',&#13;
                        'desc' =&gt; 'Specify if the admin menu should appear or not.',&#13;
                        'default' =&gt; 'menu',&#13;
                        'form' =&gt; array('type' =&gt; 'select', 'options' =&gt; array('menu' =&gt; 'Admin Menu', 'submenu' =&gt; 'Submenu Only')),&#13;
                        'validation' =&gt; array('required'),&#13;
                    ), &#13;
                    'page_parent' =&gt; array(&#13;
                        'required', &#13;
                        'data_type' =&gt; 'varchar',&#13;
                        'label' =&gt; 'Page Parent',&#13;
                        'desc' =&gt; 'Specify if the admin menu should appear or not.',&#13;
                        'default' =&gt; 'themes.php',&#13;
                        'form' =&gt; array('type' =&gt; 'select', 'options' =&gt; array('index.php' =&gt; 'Dashboard', 'edit.php' =&gt; 'Posts', 'upload.php' =&gt; 'Media', 'link-manager.php' =&gt; 'Links', 'edit.php?post_type=page' =&gt; 'pages', 'edit-comments.php' =&gt; 'Comments', 'themes.php' =&gt; 'Appearance', 'plugins.php' =&gt; 'Plugins', 'users.php' =&gt; 'Users', 'tools.php' =&gt; 'Tools', 'options-general.php' =&gt; 'Settings', )),&#13;
                        'validation' =&gt; array('required'),&#13;
                    ),                       &#13;
                   'page_position' =&gt; array( &#13;
                            'type'=&gt;'int', &#13;
                            'label'=&gt;'Page Position', &#13;
                            'desc'=&gt;'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', &#13;
                            'default'=&gt; null&#13;
                        ),  &#13;
                    'enqueue' =&gt; array(&#13;
                            'required', &#13;
                            'data_type'=&gt;'boolen', &#13;
                            'form' =&gt; array('type' =&gt; 'radio', 'options' =&gt; array(true =&gt; 'Enabled', false =&gt; 'Disabled')),&#13;
                            'label'=&gt;'Enqueue Files', &#13;
                            'desc'=&gt;'Global shut-off for custom CSS enqueing by the framework', &#13;
                            'default'=&gt;true&#13;
                        ),&#13;
                    'allow_sub_menu' =&gt; array(&#13;
                            'data_type'=&gt;'boolen', &#13;
                            'form' =&gt; array('type' =&gt; 'radio', 'options' =&gt; array(true =&gt; 'Enabled', false =&gt; 'Disabled')),&#13;
                            'label'=&gt;'Allow Submenu', &#13;
                            'desc'=&gt;'Turn on or off the submenu that will typically be shown under Appearance.', &#13;
                            'default'=&gt;true&#13;
                        ),                        &#13;
                    'show_import_export' =&gt; array(&#13;
                            'data_type'=&gt;'boolen', &#13;
                            'form' =&gt; array('type' =&gt; 'radio', 'options' =&gt; array(true =&gt; 'Show', false =&gt; 'Hide')),&#13;
                            'label'=&gt;'Show Import/Export', &#13;
                            'desc'=&gt;'Show/Hide the import/export tab.', &#13;
                            'default'=&gt;true&#13;
                        ),  &#13;
                    'dev_mode' =&gt; array(&#13;
                            'data_type'=&gt;'boolen', &#13;
                            'form' =&gt; array('type' =&gt; 'radio', 'options' =&gt; array(true =&gt; 'Enabled', false =&gt; 'Disabled')),&#13;
                            'label'=&gt;'Developer Mode', &#13;
                            'desc'=&gt;'Turn on or off the dev mode tab.', &#13;
                            'default'=&gt;false&#13;
                        ), &#13;
                    'system_info' =&gt; array(&#13;
                            'data_type'=&gt;'boolen', &#13;
                            'form' =&gt; array('type' =&gt; 'radio', 'options' =&gt; array(true =&gt; 'Enabled', false =&gt; 'Disabled')),&#13;
                            'label'=&gt;'System Info', &#13;
                            'desc'=&gt;'Turn on or off the system info tab.', &#13;
                            'default'=&gt;false&#13;
                        ),                                                         &#13;
                ),&#13;
            );  &#13;
&#13;
&#13;
        }      &#13;
&#13;
        // Protected vars&#13;
        // These two are actually really unnecessary and should be deprecated&#13;
        protected $framework_url        = 'http://www.reduxframework.com/';&#13;
&#13;
        public $instance			= null;&#13;
&#13;
        // Public vars&#13;
        public $page                = '';&#13;
        public $args                = array();&#13;
        public $sections            = array();&#13;
        public $extra_tabs          = array();&#13;
        public $errors              = array();&#13;
        public $warnings            = array();&#13;
        public $options             = array();&#13;
        public $options_defaults    = null;&#13;
		public $folds    			= array();&#13;
		public $url 				= '';&#13;
		public $path 				= '';&#13;
		public $output 				= array(); // Fields with CSS output selectors&#13;
&#13;
        public $fieldsValues        = array(); //all fields values in an id=&gt;value array so we can check dependencies&#13;
        public $fieldsHidden        = array(); //all fields that didnt pass the dependency test and are hidden&#13;
&#13;
        /**&#13;
         * Class Constructor. Defines the args for the theme options class&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       array $sections Panel sections.&#13;
         * @param       array $args Class constructor arguments.&#13;
         * @param       array $extra_tabs Extra panel tabs.&#13;
         * @return      void&#13;
         */&#13;
        public function __construct( $sections = array(), $args = array(), $extra_tabs = array() ) {&#13;
            &#13;
            // Create defaults array&#13;
            $defaults = array();&#13;
&#13;
            $defaults['opt_name']           = ''; // Must be defined by theme/plugin&#13;
            $defaults['google_api_key']     = ''; // Must be defined to add google fonts to the typography module&#13;
            $defaults['last_tab']           = '0';&#13;
            $defaults['menu_icon']          = self::$_url . 'assets/img/menu_icon.png';&#13;
            if (defined('MP6')) {&#13;
            	$defaults['menu_icon'] 		= '';&#13;
            }&#13;
            $defaults['menu_title']         = __( 'Options', 'redux-framework' );&#13;
            $defaults['page_icon']          = 'icon-themes';&#13;
            $defaults['page_title']         = __( 'Options', 'redux-framework' );&#13;
            $defaults['page_slug']          = '_options';&#13;
            $defaults['page_cap']           = 'manage_options';&#13;
            $defaults['page_type']          = 'menu';&#13;
            $defaults['page_parent']        = 'themes.php';&#13;
            $defaults['page_position']      = null;&#13;
            $defaults['enqueue']      		= true;&#13;
            $defaults['allow_sub_menu']     = true;&#13;
            $defaults['show_import_export'] = true;&#13;
            $defaults['dev_mode']           = false;&#13;
            $defaults['system_info']        = false;&#13;
            $defaults['footer_credit']      = '';&#13;
            $defaults['help_tabs']          = array();&#13;
            $defaults['help_sidebar']       = ''; // __( '', 'redux-framework' );&#13;
            $defaults['database'] 			= ''; // possible: options, theme_mods, theme_mods_expanded, transient&#13;
            $defaults['customizer'] 		= false; // setting to true forces get_theme_mod_expanded&#13;
			$defaults['global_variable'] 	= '';&#13;
			$defaults['output'] 			= true; // Dynamically generate CSS&#13;
            /** @noinspection PhpUndefinedConstantInspection */&#13;
            $defaults['transient_time'] 	= 60 * MINUTE_IN_SECONDS;&#13;
&#13;
            // The defaults are set so it will preserve the old behavior.&#13;
            $defaults['default_show']		= false; // If true, it shows the default value&#13;
            $defaults['default_mark']		= ''; // What to print by the field's title if the value shown is default&#13;
&#13;
	    	// Set values&#13;
            $this-&gt;args = wp_parse_args( $args, $defaults );&#13;
&#13;
			if ( empty( $this-&gt;path ) ) {&#13;
            	$this-&gt;path = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );&#13;
            	$this-&gt;url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this-&gt;path ) );&#13;
            }&#13;
&#13;
            if ( $this-&gt;args['global_variable'] !== false ) {&#13;
            	if ( $this-&gt;args['global_variable'] == "" ) {&#13;
            		$this-&gt;args['global_variable'] = str_replace('-', '_', $this-&gt;args['opt_name']);	&#13;
            	}&#13;
            	$variable = $this-&gt;args['global_variable'];&#13;
            	global $$variable;&#13;
            	if ( empty( $$variable ) ) {&#13;
            		$this-&gt;options = $this-&gt;get_options();&#13;
            	}&#13;
            }&#13;
&#13;
		    $this-&gt;sections = apply_filters('redux-sections',$sections);&#13;
&#13;
			$this-&gt;extra_tabs = $extra_tabs;&#13;
&#13;
            // Set option with defaults&#13;
            add_action( 'init', array( &amp;$this, '_set_default_options' ) );&#13;
&#13;
            // Options page&#13;
            add_action( 'admin_menu', array( &amp;$this, '_options_page' ) );&#13;
&#13;
            // Register setting&#13;
            add_action( 'admin_init', array( &amp;$this, '_register_setting' ) );&#13;
&#13;
			// Register extensions&#13;
            add_action( 'init', array( &amp;$this, '_register_extensions' ), 2 );&#13;
&#13;
            // Any dynamic CSS output, let's run&#13;
            add_action( 'wp_head', array( &amp;$this, '_enqueue_output' ), 100 );&#13;
&#13;
            // Hook into the WP feeds for downloading exported settings&#13;
            add_action( 'do_feed_reduxopts-' . $this-&gt;args['opt_name'], array( &amp;$this, '_download_options' ), 1, 1 );&#13;
&#13;
            // Load plugin text domain&#13;
            add_action( 'wp_loaded', array( &amp;$this, '_internationalization' ) );&#13;
            &#13;
        }&#13;
&#13;
        /**&#13;
         * Load the plugin text domain for translation.&#13;
         *&#13;
         * @since    3.0.5&#13;
         */&#13;
        public function _internationalization() {&#13;
&#13;
            $domain = 'redux-framework';&#13;
            $locale = apply_filters( 'plugin_locale', get_locale(), $domain );&#13;
            load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );&#13;
            load_textdomain( $domain, dirname( __FILE__ ) . '/languages/' . $domain . '-' . $locale . '.mo' );&#13;
&#13;
        }&#13;
&#13;
        public function get_instance() {&#13;
        	return $this-&gt;instance;&#13;
        }&#13;
&#13;
        /**&#13;
         * -&gt;_get_default(); This is used to return the default value if default_show is set&#13;
         *&#13;
         * @since       1.0.1&#13;
         * @access      public&#13;
         * @param       string $opt_name The option name to return&#13;
         * @param       mixed $default (null)  The value to return if default not set&#13;
         * @return      mixed $default&#13;
         */&#13;
        public function _get_default( $opt_name, $default = null ) {&#13;
            if( $this-&gt;args['default_show'] == true ) {&#13;
&#13;
                if( is_null( $this-&gt;options_defaults ) ) {&#13;
                	$this-&gt;_default_values(); // fill cache&#13;
                }&#13;
&#13;
                $default = array_key_exists( $opt_name, $this-&gt;options_defaults ) ? $this-&gt;options_defaults[$opt_name] : $default;&#13;
            }&#13;
            return $default;&#13;
        }&#13;
&#13;
        /**&#13;
         * -&gt;get(); This is used to return and option value from the options array&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       string $opt_name The option name to return&#13;
         * @param       mixed $default (null) The value to return if option not set&#13;
         * @return      mixed&#13;
         */&#13;
        public function get( $opt_name, $default = null ) {&#13;
            return ( !empty( $this-&gt;options[$opt_name] ) ) ? $this-&gt;options[$opt_name] : $this-&gt;_get_default( $opt_name, $default );&#13;
        }&#13;
&#13;
        /**&#13;
         * -&gt;set(); This is used to set an arbitrary option in the options array&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       string $opt_name The name of the option being added&#13;
         * @param       mixed $value The value of the option being added&#13;
         * @return      void&#13;
         */&#13;
        public function set( $opt_name = '', $value = '' ) {&#13;
            if( $opt_name != '' ) {&#13;
                $this-&gt;options[$opt_name] = $value;&#13;
				$this-&gt;set_options( $this-&gt;options );&#13;
            }&#13;
        }&#13;
&#13;
&#13;
		/**&#13;
		 * -&gt;set_options(); This is used to set an arbitrary option in the options array&#13;
		 *&#13;
		 * @since ReduxFramework 3.0.0&#13;
		 * @param mixed $value the value of the option being added&#13;
		 */&#13;
		function set_options( $value = '' ) {&#13;
			$value['REDUX_last_saved'] = time();&#13;
			if( !empty($value) ) {&#13;
				if ( $this-&gt;args['database'] === 'transient' ) {&#13;
					set_transient( $this-&gt;args['opt_name'] . '-transient', $value, $this-&gt;args['transient_time'] );&#13;
				} else if ( $this-&gt;args['database'] === 'theme_mods' ) {&#13;
					set_theme_mod( $this-&gt;args['opt_name'] . '-mods', $value );	&#13;
				} else if ( $this-&gt;args['database'] === 'theme_mods_expanded' ) {&#13;
					foreach ( $value as $k=&gt;$v ) {&#13;
						set_theme_mod( $k, $v );&#13;
					}&#13;
				} else {&#13;
					update_option( $this-&gt;args['opt_name'], $value );&#13;
				}&#13;
				// Set a global variable by the global_variable agument.&#13;
				if ( $this-&gt;args['global_variable'] ) {&#13;
					$options = $this-&gt;args['global_variable'];&#13;
					global $$options;&#13;
					$$options = $value;					&#13;
				}&#13;
				do_action( 'redux-saved-' . $this-&gt;args['opt_name'] , $value );&#13;
			}&#13;
		}&#13;
&#13;
		/**&#13;
		 * -&gt;get_options(); This is used to get options from the database&#13;
		 *&#13;
		 * @since ReduxFramework 3.0.0&#13;
		 */&#13;
		function get_options() {&#13;
			$defaults = false;&#13;
			if ( !empty( $this-&gt;defaults ) ) {&#13;
				$defaults = $this-&gt;defaults;&#13;
			}			&#13;
&#13;
			if ( $this-&gt;args['database'] === "transient" ) {&#13;
				$result = get_transient( $this-&gt;args['opt_name'] . '-transient' );&#13;
			} else if ($this-&gt;args['database'] === "theme_mods" ) {&#13;
				$result = get_theme_mod( $this-&gt;args['opt_name'] . '-mods' );&#13;
			} else if ( $this-&gt;args['database'] === 'theme_mods_expanded' ) {&#13;
				$result = get_theme_mods();&#13;
			} else {&#13;
				$result = get_option( $this-&gt;args['opt_name']);&#13;
			}&#13;
			if ( empty( $result ) &amp;&amp; !empty( $defaults ) ) {&#13;
				$results = $defaults;&#13;
				$this-&gt;set_options($results);&#13;
			}			&#13;
			// Set a global variable by the global_variable agument.&#13;
			if ( $this-&gt;args['global_variable'] ) {&#13;
				$options = $this-&gt;args['global_variable'];&#13;
				global $$options;&#13;
				$$options = $result;			&#13;
			}&#13;
			//print_r($result);&#13;
			return $result;&#13;
		}&#13;
&#13;
/**&#13;
		 * -&gt;get_options(); This is used to get options from the database&#13;
		 *&#13;
		 * @since ReduxFramework 3.0.0&#13;
		 */&#13;
		function get_wordpress_data($type = false, $args = array()) {&#13;
			$data = "";&#13;
			if ( !empty($type) ) {&#13;
&#13;
				/**&#13;
					Use data from Wordpress to populate options array&#13;
				**/&#13;
				if (!empty($type) &amp;&amp; empty($data)) {&#13;
					if (empty($args)) {&#13;
						$args = array();&#13;
					}&#13;
					$data = array();&#13;
					$args = wp_parse_args($args, array());	&#13;
					if ($type == "categories" || $type == "category") {&#13;
						$cats = get_categories($args); &#13;
						if (!empty($cats)) {		&#13;
							foreach ( $cats as $cat ) {&#13;
								$data[$cat-&gt;term_id] = $cat-&gt;name;&#13;
							}//foreach&#13;
						} // If&#13;
					} else if ($type == "menus" || $type == "menu") {&#13;
						$menus = wp_get_nav_menus($args);&#13;
						if(!empty($menus)) {&#13;
							foreach ($menus as $item) {&#13;
								$data[$item-&gt;term_id] = $item-&gt;name;&#13;
							}//foreach&#13;
						}//if&#13;
					} else if ($type == "pages" || $type == "page") {&#13;
						$pages = get_pages($args); &#13;
						if (!empty($pages)) {&#13;
							foreach ( $pages as $page ) {&#13;
								$data[$page-&gt;ID] = $page-&gt;post_title;&#13;
							}//foreach&#13;
						}//if&#13;
					} else if ($type == "posts" || $type == "post") {&#13;
						$posts = get_posts($args); &#13;
						if (!empty($posts)) {&#13;
							foreach ( $posts as $post ) {&#13;
								$data[$post-&gt;ID] = $post-&gt;post_title;&#13;
							}//foreach&#13;
						}//if&#13;
					} else if ($type == "post_type" || $type == "post_types") {&#13;
						$post_types = get_post_types($args, 'object'); &#13;
						if (!empty($post_types)) {&#13;
							foreach ( $post_types as $k =&gt; $post_type ) {&#13;
								$data[$k] = $post_type-&gt;labels-&gt;name;&#13;
							}//foreach&#13;
						}//if&#13;
					} else if ($type == "tags" || $type == "tag") {&#13;
						$tags = get_tags($args); &#13;
						if (!empty($tags)) {&#13;
							foreach ( $tags as $tag ) {&#13;
								$data[$tag-&gt;term_id] = $tag-&gt;name;&#13;
							}//foreach&#13;
						}//if&#13;
					} else if ($type == "menu_location" || $type == "menu_locations") {&#13;
						global $_wp_registered_nav_menus;&#13;
						foreach($_wp_registered_nav_menus as $k =&gt; $v) {&#13;
		           			$data[$k] = $v;&#13;
		        		}&#13;
					}//if&#13;
					else if ($type == "elusive-icons" || $type == "elusive-icon" || $type == "elusive" || &#13;
							 $type == "font-icon" || $type == "font-icons" || $type == "icons") {&#13;
						$font_icons = apply_filters('redux-font-icons',array());&#13;
						foreach($font_icons as $k) {&#13;
		           			$data[$k] = $k;&#13;
		        		}&#13;
					}else if ($type == "roles") {&#13;
						global $wp_roles;&#13;
                        $data = $wp_roles-&gt;get_names();&#13;
					}else if ($type == "capabilities") {&#13;
						global $wp_roles;&#13;
                        foreach( $wp_roles-&gt;roles as $role ){&#13;
                            foreach( $role['capabilities'] as $key =&gt; $cap ){&#13;
                                $data[$key] = ucwords(str_replace('_', ' ', $key));&#13;
                            }&#13;
                        }&#13;
					}else if ($type == "callback") {&#13;
						$data = call_user_func($args[0]);&#13;
					}//if			&#13;
				}//if&#13;
			}//if&#13;
&#13;
			return $data;&#13;
		}		&#13;
&#13;
        /**&#13;
         * -&gt;show(); This is used to echo and option value from the options array&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       string $opt_name The name of the option being shown&#13;
         * @param       mixed $default The value to show if $opt_name isn't set&#13;
         * @return      void&#13;
         */&#13;
        public function show( $opt_name, $default = '' ) {&#13;
            $option = $this-&gt;get( $opt_name );&#13;
            if( !is_array( $option ) &amp;&amp; $option != '' ) {&#13;
                echo $option;&#13;
            } elseif( $default != '' ) {&#13;
                echo $this-&gt;_get_default( $opt_name, $default );&#13;
            }&#13;
        }&#13;
&#13;
        /**&#13;
         * Get default options into an array suitable for the settings API&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      array $this-&gt;options_defaults&#13;
         */&#13;
        public function _default_values() {&#13;
            if( !is_null( $this-&gt;sections ) &amp;&amp; is_null( $this-&gt;options_defaults ) ) {&#13;
                // fill the cache&#13;
                foreach( $this-&gt;sections as $section ) {&#13;
                    if( isset( $section['fields'] ) ) {&#13;
                        foreach( $section['fields'] as $field ) {&#13;
                            if( isset( $field['default'] ) ) {&#13;
                            	$this-&gt;options_defaults[$field['id']] = $field['default'];&#13;
                            }&#13;
                        }&#13;
                    }&#13;
                }&#13;
            }&#13;
            return $this-&gt;options_defaults;&#13;
        }&#13;
&#13;
&#13;
		/**&#13;
		 * Get fold values into an array suitable for setting folds&#13;
		 *&#13;
		 * @since ReduxFramework 1.0.0&#13;
		 */&#13;
		function _fold_values() {&#13;
		    /*&#13;
		    Folds work by setting the folds value like so&#13;
		    $this-&gt;folds['parentID']['parentValue'][] = 'childId'&#13;
		    */&#13;
		    $folds = array();&#13;
		    if( !is_null( $this-&gt;sections ) &amp;&amp; is_null( $this-&gt;options_defaults ) ) {&#13;
				foreach( $this-&gt;sections as $section ) {&#13;
				    if( isset( $section['fields'] ) ) {&#13;
						foreach( $section['fields'] as $field ) {&#13;
                            //if we have required option in group field&#13;
                            if(isset($field['subfields']) &amp;&amp; is_array($field['subfields'])){&#13;
                                foreach ($field['subfields'] as $subfield) {&#13;
                                    if(isset($subfield['required']))&#13;
                                        $this-&gt;get_fold($subfield);&#13;
                                }&#13;
                            }&#13;
						    if( isset( $field['required'] ) ) {&#13;
                                $this-&gt;get_fold($field);&#13;
						    }&#13;
						}&#13;
				    }&#13;
				}&#13;
			}&#13;
			/*&#13;
			$parents = array();&#13;
			$toHide = array();&#13;
			foreach ($folds as $k=&gt;$fold) { // ParentFolds WITHOUT parents&#13;
				if ( empty( $fold['children'] ) || !empty( $fold['children']['parents'] ) ) {&#13;
					continue;&#13;
				}&#13;
				$fold['value'] = $this-&gt;options[$k];&#13;
				foreach ($fold['children'] as $key =&gt;$value) {&#13;
					if ($key == $fold['value']) {&#13;
						unset($fold['children'][$key]);&#13;
					}&#13;
				}&#13;
				if (empty($fold['children'])) {&#13;
					continue;&#13;
				}&#13;
				foreach ($fold['children'] as $key =&gt; $value) {&#13;
					foreach ($value as $k=&gt; $hidden) {&#13;
						$toHide[$hidden]=true;&#13;
						&#13;
					}&#13;
				}				&#13;
				$parents[] = $fold;&#13;
			}&#13;
&#13;
&#13;
&#13;
			print_r($parents);&#13;
			print_r($toHide);&#13;
*/&#13;
			return $this-&gt;folds;&#13;
		    &#13;
		}&#13;
&#13;
        function get_fold($field){&#13;
            if ( !is_array( $field['required'] ) ) {&#13;
                /*&#13;
                Example variable:&#13;
                    $var = array(&#13;
                    'fold' =&gt; 'id'&#13;
                    );&#13;
                */&#13;
                $this-&gt;folds[$field['required']]['children'][1][] = $field['id'];&#13;
                $this-&gt;folds[$field['id']]['parent'] = $field['required'];&#13;
            } else {&#13;
                $parent = $foldk = $field['required'][0];&#13;
                $comparison = $field['required'][1];&#13;
                $value = $foldv = $field['required'][2];                                                                                    &#13;
                //foreach( $field['required'] as $foldk=&gt;$foldv ) {&#13;
                    &#13;
&#13;
                    if ( is_array( $value ) ) {&#13;
                        /*&#13;
                        Example variable:&#13;
                            $var = array(&#13;
                            'fold' =&gt; array( 'id' , '=', array(1, 5) )&#13;
                            );&#13;
                        */&#13;
                        &#13;
                        foreach ($value as $foldvValue) {&#13;
                            //echo 'id: '.$field['id']." key: ".$foldk.' f-val-'.print_r($foldv)." foldvValue".$foldvValue;&#13;
                            $this-&gt;folds[$foldk]['children'][$foldvValue][] = $field['id'];&#13;
                            $this-&gt;folds[$field['id']]['parent'] = $foldk;&#13;
                        }&#13;
                    } else {&#13;
                        &#13;
                        //!DOVY If there's a problem, this is where it's at. These two cases.&#13;
                        //This may be able to solve this issue if these don't work&#13;
                        //if (count($field['fold']) == count($field['fold'], COUNT_RECURSIVE)) {&#13;
                        //}&#13;
&#13;
                        if (count($field['required']) === 1 &amp;&amp; is_numeric($foldk)) {&#13;
                            /*&#13;
                            Example variable:&#13;
                                $var = array(&#13;
                                'fold' =&gt; array( 'id' )&#13;
                                );&#13;
                            */  &#13;
                            $this-&gt;folds[$field['id']]['parent'] = $foldk;&#13;
                            $this-&gt;folds[$foldk]['children'][1][] = $field['id'];&#13;
                        } else {&#13;
                            /*&#13;
                            Example variable:&#13;
                                $var = array(&#13;
                                'fold' =&gt; array( 'id' =&gt; 1 )&#13;
                                );&#13;
                            */                      &#13;
                            if (empty($foldv)) {&#13;
                                $foldv = 0;&#13;
                            }&#13;
                            $this-&gt;folds[$field['id']]['parent'] = $foldk;&#13;
                            $this-&gt;folds[$foldk]['children'][$foldv][] = $field['id'];    &#13;
                        }&#13;
                    }&#13;
                //}&#13;
            }&#13;
            return $this-&gt;folds;&#13;
        }&#13;
&#13;
        /**&#13;
         * Set default options on admin_init if option doesn't exist&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _set_default_options() {&#13;
&#13;
        	$this-&gt;instance = $this;&#13;
&#13;
		    // Get args&#13;
		    $this-&gt;args = apply_filters( 'redux-args-'.$this-&gt;args['opt_name'], $this-&gt;args );&#13;
&#13;
		    // Fix the global variable name&#13;
            if ( $this-&gt;args['global_variable'] == "" &amp;&amp; $this-&gt;args['global_variable'] !== false ) {&#13;
            	$this-&gt;args['global_variable'] = str_replace('-', '_', $this-&gt;args['opt_name']);&#13;
            }&#13;
&#13;
		    // Get sections&#13;
		    $this-&gt;sections = apply_filters( 'redux-sections-' . $this-&gt;args['opt_name'], $this-&gt;sections );&#13;
&#13;
		    // Get extra tabs&#13;
		    $this-&gt;extra_tabs = apply_filters( 'redux-extra-tabs-' . $this-&gt;args['opt_name'], $this-&gt;extra_tabs );&#13;
&#13;
		    // Grab database values&#13;
		    $this-&gt;options = $this-&gt;get_options();&#13;
&#13;
            // Get the fold values&#13;
            $this-&gt;folds = $this-&gt;_fold_values();		    &#13;
&#13;
		    // Set defaults if empty&#13;
		    if( empty( $this-&gt;options ) &amp;&amp; !empty( $this-&gt;sections ) ) {&#13;
				$defaults = $this-&gt;_default_values();&#13;
				$this-&gt;set_options( $defaults );&#13;
				$this-&gt;options = $defaults;&#13;
		    }&#13;
	    &#13;
        }&#13;
&#13;
        /**&#13;
         * Class Options Page Function, creates main options page.&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return&#13;
         */&#13;
        function _options_page() {&#13;
            if( $this-&gt;args['page_type'] == 'submenu' ) {&#13;
                $this-&gt;page = add_theme_page(&#13;
                    $this-&gt;args['page_title'],&#13;
                    $this-&gt;args['menu_title'],&#13;
                    $this-&gt;args['page_cap'],&#13;
                    $this-&gt;args['page_slug'],&#13;
                    array( &amp;$this, '_options_page_html' )&#13;
                );&#13;
            } else {&#13;
                $this-&gt;page = add_theme_page(&#13;
                    $this-&gt;args['menu_title'],&#13;
                    $this-&gt;args['page_cap'],&#13;
                    $this-&gt;args['page_slug'],&#13;
                    array( &amp;$this, '_options_page_html' ),&#13;
                    $this-&gt;args['menu_icon'],&#13;
                    $this-&gt;args['page_position']&#13;
                );&#13;
&#13;
                if( true === $this-&gt;args['allow_sub_menu'] ) {&#13;
                    if( !isset( $section['type'] ) || $section['type'] != 'divide' ) {&#13;
&#13;
                        foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
                            if ( !isset( $section['title'] ) )&#13;
                                continue;&#13;
&#13;
                            if ( isset( $section['submenu'] ) &amp;&amp; $section['submenu'] == false )&#13;
                                continue;&#13;
&#13;
                            add_theme_page(&#13;
                                $this-&gt;args['page_slug'],&#13;
                                $section['title'],&#13;
                                $section['title'],&#13;
                                $this-&gt;args['page_cap'],&#13;
                                $this-&gt;args['page_slug'] . '&amp;tab=' . $k,&#13;
                                create_function( '$a', "return null;" )&#13;
                            );&#13;
                        }&#13;
&#13;
                        // Remove parent submenu item instead of adding null item.&#13;
                        remove_submenu_page( $this-&gt;args['page_slug'], $this-&gt;args['page_slug'] );&#13;
                    }&#13;
&#13;
                    if( true === $this-&gt;args['show_import_export'] ) {&#13;
                        add_theme_page(&#13;
                            $this-&gt;args['page_slug'],&#13;
                            __( 'Import / Export', 'redux-framework' ),&#13;
                            __( 'Import / Export', 'redux-framework' ),&#13;
                            $this-&gt;args['page_cap'],&#13;
                            $this-&gt;args['page_slug'] . '&amp;tab=import_export_default', &#13;
                            create_function( '$a', "return null;" )&#13;
                        );&#13;
                    }&#13;
&#13;
                    foreach( $this-&gt;extra_tabs as $k =&gt; $tab ) {&#13;
                        add_theme_page(&#13;
                            $this-&gt;args['page_slug'],&#13;
                            $tab['title'],&#13;
                            $tab['title'],&#13;
                            $this-&gt;args['page_cap'],&#13;
                            $this-&gt;args['page_slug'] . '&amp;tab=' . $k, &#13;
                            create_function( '$a', "return null;" )&#13;
                        );&#13;
                    }&#13;
&#13;
                    if( true === $this-&gt;args['dev_mode'] ) {&#13;
                        add_theme_page(&#13;
                            $this-&gt;args['page_slug'],&#13;
                            __( 'Options Object', 'redux-framework' ),&#13;
                            __( 'Options Object', 'redux-framework' ),&#13;
                            $this-&gt;args['page_cap'],&#13;
                            $this-&gt;args['page_slug'] . '&amp;tab=dev_mode_default',&#13;
                            create_function('$a', "return null;")&#13;
                        );&#13;
                    }&#13;
&#13;
                    if( true === $this-&gt;args['system_info'] ) {&#13;
                        add_theme_page(&#13;
                            $this-&gt;args['page_slug'],&#13;
                            __( 'System Info', 'redux-framework' ),&#13;
                            __( 'System Info', 'redux-framework' ),&#13;
                            $this-&gt;args['page_cap'],&#13;
                            $this-&gt;args['page_slug'] . '&amp;tab=system_info_default',&#13;
                            create_function( '$a', "return null;" )&#13;
                        );&#13;
                    }&#13;
                }&#13;
            }&#13;
&#13;
            add_action( 'admin_print_styles-' . $this-&gt;page, array( &amp;$this, '_enqueue' ) );&#13;
            &#13;
            add_action( 'load-' . $this-&gt;page, array( &amp;$this, '_load_page' ) );&#13;
        }&#13;
&#13;
        /**&#13;
         * Enqueue CSS/JS for options page&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @global      $wp_styles&#13;
         * @return      void&#13;
         */&#13;
        public function _enqueue_output() {&#13;
			foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
                if( isset($section['type'] ) &amp;&amp; $section['type'] == 'divide' ) {&#13;
                    continue;&#13;
                }&#13;
                if( isset( $section['fields'] ) ) {&#13;
                    foreach( $section['fields'] as $fieldk =&gt; $field ) {&#13;
						if( isset( $field['type'] ) ) {&#13;
                            $field_class = 'ReduxFramework_' . $field['type'];&#13;
                            if( !class_exists( $field_class ) ) {&#13;
                                $class_file = apply_filters( 'redux-typeclass-load', self::$_dir . 'inc/fields/' . $field['type'] . '/field_' . $field['type'] . '.php', $field_class );&#13;
                                if( $class_file ) {&#13;
                                    /** @noinspection PhpIncludeInspection */&#13;
                                    require_once( $class_file );&#13;
                                }&#13;
                            }	&#13;
&#13;
                            if( !empty( $this-&gt;options[$field['id']] ) &amp;&amp; class_exists( $field_class ) &amp;&amp; method_exists( $field_class, 'output' ) ) {&#13;
                            	if ( !empty($field['output']) &amp;&amp; !is_array( $field['output'] ) ) {&#13;
                					$field['output'] = array( $field['output'] );&#13;
                				}&#13;
								$value = isset($this-&gt;options[$field['id']])?$this-&gt;options[$field['id']]:'';&#13;
                				$enqueue = new $field_class( $field, $value, $this );&#13;
                                $enqueue-&gt;output();&#13;
                            }&#13;
                        }       	&#13;
                    }&#13;
                }&#13;
            }&#13;
        }        &#13;
&#13;
        /**&#13;
         * Enqueue CSS/JS for options page&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @global      $wp_styles&#13;
         * @return      void&#13;
         */&#13;
        public function _enqueue() {&#13;
            global $wp_styles;&#13;
&#13;
    	    wp_enqueue_script('jquery');&#13;
	        wp_enqueue_script('jquery-ui-core');&#13;
            add_thickbox();&#13;
&#13;
            wp_register_style(&#13;
                'redux-css',&#13;
                self::$_url . 'assets/css/style.css',&#13;
                array( 'farbtastic' ),&#13;
                time(),&#13;
                'all'&#13;
            );&#13;
&#13;
            wp_register_style(&#13;
                'redux-elusive-icon',&#13;
                self::$_url . 'assets/css/vendor/elusive-icons/elusive-webfont.css',&#13;
                array(),&#13;
                time(),&#13;
                'all'&#13;
            );&#13;
&#13;
            wp_register_style(&#13;
                'redux-elusive-icon-ie7',&#13;
                self::$_url . 'assets/css/vendor/elusive-icons/elusive-webfont-ie7.css',&#13;
                array(),&#13;
                time(),&#13;
                'all'&#13;
            );&#13;
&#13;
            wp_register_style(&#13;
                'select2-css',&#13;
                self::$_url . 'assets/js/vendor/select2/select2.css',&#13;
                array(),&#13;
                time(),&#13;
                'all'&#13;
            );          &#13;
&#13;
            $wp_styles-&gt;add_data( 'redux-elusive-icon-ie7', 'conditional', 'lte IE 7' );&#13;
&#13;
            wp_register_style(&#13;
                'jquery-ui-css',&#13;
                apply_filters( 'redux-ui-theme', self::$_url . 'assets/css/vendor/jquery-ui-bootstrap/jquery-ui-1.10.0.custom.css' ),&#13;
                '',&#13;
                time(),&#13;
                'all'&#13;
            );&#13;
            wp_enqueue_style( 'jquery-ui-css' );&#13;
&#13;
            wp_enqueue_style( 'redux-lte-ie8' );&#13;
&#13;
            wp_enqueue_style( 'redux-css' );&#13;
&#13;
            wp_enqueue_style( 'redux-elusive-icon' );&#13;
            wp_enqueue_style( 'redux-elusive-icon-ie7' );&#13;
&#13;
            if ( $this-&gt;args['dev_mode'] === true) { // Pretty object output&#13;
	            wp_enqueue_script(&#13;
	                'json-view-js',&#13;
	                self::$_url . 'assets/js/vendor/jsonview.min.js',&#13;
	                array( 'jquery' ),&#13;
	                time(),&#13;
	                true&#13;
	            );&#13;
            }&#13;
&#13;
            wp_enqueue_script(&#13;
                'redux-js',&#13;
                //self::$_url . 'assets/js/admin.js',// DEBUG ONLY&#13;
                self::$_url . 'assets/js/admin.min.js',&#13;
                array( 'jquery','jquery-cookie' ),&#13;
                time(),&#13;
                true&#13;
            );&#13;
&#13;
            wp_enqueue_script(&#13;
                'jquery-cookie',&#13;
                self::$_url . 'assets/js/vendor/cookie.js',&#13;
                array( 'jquery' ),&#13;
                time(),&#13;
                true&#13;
            );&#13;
&#13;
            wp_register_script( &#13;
                'select2-js', &#13;
                self::$_url . 'assets/js/vendor/select2/select2.min.js',&#13;
                array( 'jquery' ),&#13;
                time(),&#13;
                true&#13;
            );&#13;
&#13;
            wp_register_script(&#13;
                'jquery-tipsy',&#13;
                self::$_url . 'assets/js/vendor/jquery.tipsy.js',&#13;
                array( 'jquery' ),&#13;
                time(),&#13;
                true&#13;
            ); &#13;
&#13;
            wp_register_script(&#13;
                'jquery-numeric',&#13;
                self::$_url . 'assets/js/vendor/jquery.numeric.js ',&#13;
                array( 'jquery' ),&#13;
                time(),&#13;
                true&#13;
            );    &#13;
            &#13;
            $localize = array(&#13;
                    'save_pending'      =&gt; __( 'You have changes that are not saved. Would you like to save them now?', 'redux-framework' ), &#13;
                    'reset_confirm'     =&gt; __( 'Are you sure? Resetting will loose all custom values.', 'redux-framework' ), &#13;
                    'preset_confirm'    =&gt; __( 'Your current options will be replaced with the values of this preset. Would you like to proceed?', 'redux-framework' ), &#13;
                    'opt_name'          =&gt; $this-&gt;args['opt_name'],&#13;
                    'folds'				=&gt; $this-&gt;folds,&#13;
                    'options'			=&gt; $this-&gt;options,&#13;
                    'defaults'			=&gt; $this-&gt;options_defaults,&#13;
                    'slug'              =&gt; $this-&gt;args['page_slug']&#13;
                );       &#13;
&#13;
            // Construct the errors array. &#13;
            $errors = get_transient( 'redux-errors-' . $this-&gt;args['opt_name'] );&#13;
            if( isset( $_GET['settings-updated'] ) &amp;&amp; $_GET['settings-updated'] == 'true' &amp;&amp; !empty( $errors ) ) {&#13;
            	$theTotal = 0;&#13;
                $theErrors = array();&#13;
            	foreach($errors as $error) {&#13;
            		$theErrors[$error['section_id']]['errors'][] = $error;&#13;
            		if (!isset($theErrors[$error['section_id']]['total'])) {&#13;
            			$theErrors[$error['section_id']]['total'] = 0;&#13;
            		}&#13;
            		$theErrors[$error['section_id']]['total']++;&#13;
					$theTotal++;&#13;
            	}&#13;
            	delete_transient( 'redux-errors-' . $this-&gt;args['opt_name'] );&#13;
            	$localize['errors'] = array('total'=&gt;$theTotal, 'errors'=&gt;$theErrors);&#13;
            }&#13;
&#13;
            // Construct the errors array. &#13;
            $warnings = get_transient( 'redux-warnings-' . $this-&gt;args['opt_name'] );&#13;
            if( isset( $_GET['settings-updated'] ) &amp;&amp; $_GET['settings-updated'] == 'true' &amp;&amp; !empty( $warnings ) ) {&#13;
            	$theTotal = 0;&#13;
                $theWarnings = array();&#13;
            	foreach($warnings as $warning) {&#13;
            		$theWarnings[$warning['section_id']]['warnings'][] = $warning;&#13;
            		if (!isset($theWarnings[$warning['section_id']]['total'])) {&#13;
            			$theWarnings[$warning['section_id']]['total'] = 0;&#13;
            		}&#13;
            		$theWarnings[$warning['section_id']]['total']++;&#13;
					$theTotal++;&#13;
            	}&#13;
            	delete_transient( 'redux-warnings-' . $this-&gt;args['opt_name'] );&#13;
            	$localize['warnings'] = array('total'=&gt;$theTotal, 'warnings'=&gt;$theWarnings);&#13;
            }&#13;
            &#13;
            // Values used by the javascript&#13;
            wp_localize_script(&#13;
                'redux-js', &#13;
                'redux_opts', &#13;
                $localize&#13;
            );&#13;
&#13;
            do_action( 'redux-enqueue-' . $this-&gt;args['opt_name'] );&#13;
&#13;
            foreach( $this-&gt;sections as $section ) {&#13;
                if( isset( $section['fields'] ) ) {&#13;
                    foreach( $section['fields'] as $field ) {&#13;
                        if( isset( $field['type'] ) ) {&#13;
                            $field_class = 'ReduxFramework_' . $field['type'];&#13;
&#13;
                            if( !class_exists( $field_class ) ) {&#13;
                                $class_file = apply_filters( 'redux-typeclass-load', self::$_dir . 'inc/fields/' . $field['type'] . '/field_' . $field['type'] . '.php', $field_class );&#13;
&#13;
                                if( $class_file ) {&#13;
                                    /** @noinspection PhpIncludeInspection */&#13;
                                    require_once( $class_file );&#13;
                                }&#13;
&#13;
                            }&#13;
&#13;
                            if( class_exists( $field_class ) &amp;&amp; method_exists( $field_class, 'enqueue' ) ) {&#13;
                                $enqueue = new $field_class( '', '', $this );&#13;
                                $enqueue-&gt;enqueue();&#13;
                            }&#13;
                        }&#13;
                    }&#13;
                }&#13;
            }&#13;
        }&#13;
&#13;
        /**&#13;
         * Download the options file, or display it&#13;
         *&#13;
         * @since       3.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _download_options(){&#13;
            /** @noinspection PhpUndefinedConstantInspection */&#13;
            if( !isset( $_GET['secret'] ) || $_GET['secret'] != md5( AUTH_KEY . SECURE_AUTH_KEY ) ) {&#13;
                wp_die( 'Invalid Secret for options use' );&#13;
                exit;&#13;
            }&#13;
&#13;
            if( !isset( $_GET['feed'] ) ){&#13;
                wp_die( 'No Feed Defined' );&#13;
                exit;&#13;
            }&#13;
&#13;
            $backup_options = $this-&gt;get_options( str_replace( 'redux-', '', $_GET['feed'] ) );&#13;
            $backup_options['redux-backup'] = '1';&#13;
            $content = json_encode( $backup_options );&#13;
&#13;
            if( isset( $_GET['action'] ) &amp;&amp; $_GET['action'] == 'download_options' ) {&#13;
                header( 'Content-Description: File Transfer' );&#13;
                header( 'Content-type: application/txt' );&#13;
                header( 'Content-Disposition: attachment; filename="' . str_replace( 'redux-', '', $_GET['feed'] ) . '_backup_' . date( 'd-m-Y' ) . '.json"' );&#13;
                header( 'Content-Transfer-Encoding: binary' );&#13;
                header( 'Expires: 0' );&#13;
                header( 'Cache-Control: must-revalidate' );&#13;
                header( 'Pragma: public' );&#13;
                echo $content;&#13;
                exit;&#13;
            } else {&#13;
                header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); &#13;
                header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT"); &#13;
                header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );&#13;
                header( 'Cache-Control: no-store, no-cache, must-revalidate' );&#13;
                header( 'Cache-Control: post-check=0, pre-check=0', false );&#13;
                header( 'Pragma: no-cache' );&#13;
&#13;
                // Can't include the type. Thanks old Firefox and IE. BAH.&#13;
                //header("Content-type: application/json");&#13;
                echo $content;&#13;
                exit;&#13;
            }&#13;
        }&#13;
&#13;
        /**&#13;
         * Show page help&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _load_page() {&#13;
&#13;
            // Do admin head action for this page&#13;
            add_action( 'admin_head', array( &amp;$this, 'admin_head' ) );&#13;
&#13;
            // Do admin footer text hook&#13;
            add_filter( 'admin_footer_text', array( &amp;$this, 'admin_footer_text' ) );&#13;
&#13;
            $screen = get_current_screen();&#13;
&#13;
            if( is_array( $this-&gt;args['help_tabs'] ) ) {&#13;
                foreach( $this-&gt;args['help_tabs'] as $tab ) {&#13;
                    $screen-&gt;add_help_tab( $tab );&#13;
                }&#13;
            }&#13;
&#13;
            if( $this-&gt;args['help_sidebar'] != '' )&#13;
                $screen-&gt;set_help_sidebar( $this-&gt;args['help_sidebar'] );&#13;
&#13;
            do_action( 'redux-load-page-' . $this-&gt;args['opt_name'], $screen );&#13;
        }&#13;
&#13;
        /**&#13;
         * Do action redux-admin-head for options page&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function admin_head() {&#13;
            do_action( 'redux-admin-head-' . $this-&gt;args['opt_name'], $this );&#13;
        }&#13;
&#13;
        /**&#13;
         * Return footer text&#13;
         *&#13;
         * @since       2.0.0&#13;
         * @access      public&#13;
         * @return      string $this-&gt;args['footer_credit']&#13;
         */&#13;
        public function admin_footer_text( ) {&#13;
            return $this-&gt;args['footer_credit'];&#13;
        }&#13;
&#13;
        /**&#13;
         * Register Option for use&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _register_setting() {&#13;
&#13;
            register_setting( $this-&gt;args['opt_name'] . '_group', $this-&gt;args['opt_name'], array( &amp;$this,'_validate_options' ) );&#13;
&#13;
            if( is_null( $this-&gt;sections ) ) return;&#13;
&#13;
            $runUpdate = false;&#13;
&#13;
            foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
                if( isset($section['type'] ) &amp;&amp; $section['type'] == 'divide' ) {&#13;
                    continue;&#13;
                }&#13;
&#13;
				if ( empty( $section['id'] ) ) {&#13;
                	//$section['id'] = strtolower( str_replace( " ", "", $section['title'] ) );	&#13;
                    $section['id'] = sanitize_html_class( $section['title'] );	&#13;
                }                   &#13;
&#13;
                // DOVY! Replace $k with $section['id'] when ready&#13;
                $section = apply_filters( 'redux-section-' . $k . '-modifier-' . $this-&gt;args['opt_name'], $section );&#13;
&#13;
                add_settings_section( $this-&gt;args['opt_name'] . $k . '_section', $section['title'], array( &amp;$this, '_section_desc' ), $this-&gt;args['opt_name'] . $k . '_section_group' );&#13;
&#13;
                if( isset( $section['fields'] ) ) {&#13;
                    foreach( $section['fields'] as $fieldk =&gt; $field ) {&#13;
                    	&#13;
                    	$th = "";&#13;
                        if( isset( $field['title'] ) &amp;&amp; isset( $field['type'] ) &amp;&amp; $field['type'] !== "info" &amp;&amp; $field['type'] !== "group" ) {&#13;
			    			$default_mark = ( !empty($field['default']) &amp;&amp; isset($this-&gt;options[$field['id']]) &amp;&amp; $this-&gt;options[$field['id']] == $field['default'] &amp;&amp; !empty( $this-&gt;args['default_mark'] ) &amp;&amp; isset( $field['default'] ) ) ? $this-&gt;args['default_mark'] : '';&#13;
                            if (!empty($field['title'])) {&#13;
                                $th = $field['title'] . $default_mark."";&#13;
                            }&#13;
          &#13;
						    if( isset( $field['subtitle'] ) ) {&#13;
								$th .= '<span class="description">' . $field['subtitle'] . '</span>';&#13;
						    }&#13;
&#13;
                         &#13;
                           &#13;
                        } &#13;
						if (!isset($field['id'])) {&#13;
							print_r($field);&#13;
						}&#13;
						// Set the default if it's a new field&#13;
						if (!isset($this-&gt;options[$field['id']])) {&#13;
			                if( is_null( $this-&gt;options_defaults ) ) {&#13;
			                	$this-&gt;_default_values(); // fill cache&#13;
			                }&#13;
			                if ( !empty( $this-&gt;options_defaults ) ) {&#13;
			                	$this-&gt;options[$field['id']] = array_key_exists( $field['id'], $this-&gt;options_defaults ) ? $this-&gt;options_defaults[$field['id']] : '';	&#13;
			                }&#13;
							$runUpdate = true;&#13;
						}						&#13;
&#13;
						if ( $this-&gt;args['default_show'] === true &amp;&amp; isset( $field['default'] ) &amp;&amp; isset($this-&gt;options[$field['id']]) &amp;&amp; $this-&gt;options[$field['id']] != $field['default'] &amp;&amp; $field['type'] !== "info" &amp;&amp; $field['type'] !== "group" ) {&#13;
							$default_output = "";&#13;
						    if (!is_array($field['default'])) {&#13;
								if ( !empty( $field['options'][$field['default']] ) ) {&#13;
									if (!empty($field['options'][$field['default']]['alt'])) {&#13;
										$default_output .= $field['options'][$field['default']]['alt'] . ', ';&#13;
									} else {&#13;
										// TODO: This serialize fix may not be the best solution. Look into it. PHP 5.4 error without serialize&#13;
										$default_output .= serialize($field['options'][$field['default']]).", ";	&#13;
									}&#13;
								} else if ( !empty( $field['options'][$field['default']] ) ) {&#13;
									$default_output .= $field['options'][$field['default']].", ";&#13;
								} else if ( !empty( $field['default'] ) ) {&#13;
									$default_output .= $field['default'] . ', ';&#13;
								}&#13;
						    } else {&#13;
								foreach( $field['default'] as $defaultk =&gt; $defaultv ) {&#13;
									if (!empty($field['options'][$defaultv]['alt'])) {&#13;
										$default_output .= $field['options'][$defaultv]['alt'] . ', ';&#13;
									} else if ( !empty( $field['options'][$defaultv] ) ) {&#13;
										$default_output .= $field['options'][$defaultv].", ";&#13;
									} else if ( !empty( $field['options'][$defaultk] ) ) {&#13;
										$default_output .= $field['options'][$defaultk].", ";&#13;
									} else if ( !empty( $defaultv ) ) {&#13;
										$default_output .= $defaultv.', ';&#13;
									}&#13;
								}&#13;
						   	}&#13;
							if ( !empty( $default_output ) ) {&#13;
							    $default_output = __( 'Default', 'redux-framework' ) . ": " . substr($default_output, 0, -2);&#13;
							}				   	&#13;
						    $th .= '<span class="showDefaults">'.$default_output.'</span>';&#13;
			            }&#13;
			            if (!isset($field['class'])) { // No errors please&#13;
			            	$field['class'] = "";&#13;
			            }&#13;
			            $field = apply_filters( 'redux-field-' . $field['id'] . 'modifier-' . $this-&gt;args['opt_name'], $field );&#13;
						if ( !empty( $this-&gt;folds[$field['id']]['parent'] ) ) { // This has some fold items, hide it by default&#13;
						    $field['class'] .= " fold";&#13;
						}&#13;
						if ( !empty( $this-&gt;folds[$field['id']]['children'] ) ) { // Sets the values you shoe fold children on&#13;
						    $field['class'] .= " foldParent";&#13;
						}&#13;
&#13;
						if ( !empty( $field['compiler'] ) ) {&#13;
							$field['class'] .= " compiler";&#13;
						}&#13;
						$this-&gt;sections[$k]['fields'][$fieldk] = $field;&#13;
&#13;
                        if( isset( $this-&gt;args['display_source'] ) ) {&#13;
                            $th .= '<div id="'.$field['id'].'-settings" style="display:none;"><pre>'.var_export($this-&gt;sections[$k]['fields'][$fieldk], true).'</pre></div>';&#13;
                            $th .= '<br><a href="#TB_inline?width=600&amp;height=800&amp;inlineId='.%24field%5B'id'%5D.'-settings" class="thickbox"><small>View Source</small></a>';&#13;
                        }                           &#13;
&#13;
                        add_settings_field( $fieldk . '_field', $th, array( &amp;$this, '_field_input' ), $this-&gt;args['opt_name'] . $k . '_section_group', $this-&gt;args['opt_name'] . $k . '_section', $field ); // checkbox&#13;
                    }&#13;
                }&#13;
            }&#13;
&#13;
            do_action( 'redux-register-settings-' . $this-&gt;args['opt_name'] );&#13;
&#13;
			if ($runUpdate) { // Always update the DB with new fields&#13;
				$this-&gt;set_options( $this-&gt;options );&#13;
			}&#13;
&#13;
			if (get_transient( 'redux-compiler-' . $this-&gt;args['opt_name'] ) ) {&#13;
				delete_transient( 'redux-compiler-' . $this-&gt;args['opt_name'] );&#13;
				do_action( 'redux-compiler-' . $this-&gt;args['opt_name'], $this-&gt;options );&#13;
			}				&#13;
&#13;
        }&#13;
&#13;
        /**&#13;
         * Register Extensions for use&#13;
         *&#13;
         * @since       3.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _register_extensions() {        	&#13;
        	&#13;
        	$path = dirname( __FILE__ ) . '/extensions';&#13;
			$folders = scandir( $path, 1 );		   &#13;
&#13;
		    foreach($folders as $folder){&#13;
&#13;
		    	if ($folder === '.' or $folder === '..' or !is_dir($path . '/' . $folder) ) {&#13;
		    		continue;	&#13;
		    	} &#13;
				$extension_class = 'ReduxFramework_Extension_' . $folder;&#13;
&#13;
                if( !class_exists( $extension_class ) ) {&#13;
                    $class_file = apply_filters( 'redux-extensionclass-load', $this-&gt;path . 'extensions/' . $folder . '/extension_' . $folder . '.php', $extension_class );&#13;
&#13;
                    if( $class_file ) {&#13;
                        /** @noinspection PhpIncludeInspection */&#13;
                        require_once( $class_file );&#13;
                        $extension = new $extension_class( $this );&#13;
                 	}&#13;
                }&#13;
                		   		&#13;
		    }    &#13;
&#13;
		    do_action( 'redux-register-extensions-' . $this-&gt;args['opt_name'], $this );        			&#13;
&#13;
        }        &#13;
&#13;
        /**&#13;
         * Validate the Options options before insertion&#13;
         *&#13;
         * @since       3.0.0&#13;
         * @access      public&#13;
         * @param       array $plugin_options The options array&#13;
         * @return      &#13;
         */&#13;
        public function _validate_options( $plugin_options ) {&#13;
&#13;
            set_transient( 'redux-saved-' . $this-&gt;args['opt_name'], '1', 1000 );&#13;
&#13;
            if( !empty( $plugin_options['import'] ) ) {&#13;
                if( $plugin_options['import_code'] != '' ) {&#13;
                    $import = $plugin_options['import_code'];&#13;
                } elseif( $plugin_options['import_link'] != '' ) {&#13;
                    $import = wp_remote_retrieve_body( wp_remote_get( $plugin_options['import_link'] ) );&#13;
                }&#13;
&#13;
                if ( !empty( $import ) ) {&#13;
                    $imported_options = json_decode( htmlspecialchars_decode( $import ), true );&#13;
                }&#13;
&#13;
                if( !empty( $imported_options ) &amp;&amp; is_array( $imported_options ) &amp;&amp; isset( $imported_options['redux-backup'] ) &amp;&amp; $imported_options['redux-backup'] == '1' ) {&#13;
                    $plugin_options['REDUX_imported'] = 1;&#13;
                	foreach($imported_options as $key =&gt; $value) {&#13;
                		$plugin_options[$key] = $value;&#13;
                	}                    &#13;
                    &#13;
                    // Remove the import/export tab cookie.&#13;
                    if( $_COOKIE['redux_current_tab'] == 'import_export_default' ) {&#13;
                        setcookie( 'redux_current_tab', '', 1, '/' );&#13;
                    }&#13;
&#13;
                    set_transient( 'redux-compiler-' . $this-&gt;args['opt_name'], '1', 1000 );&#13;
                    $plugin_options['REDUX_COMPILER'] = time();&#13;
                    unset( $plugin_options['defaults'], $plugin_options['compiler'], $plugin_options['import'], $plugin_options['import_code'] );&#13;
				    if ( $this-&gt;args['database'] == 'transient' || $this-&gt;args['database'] == 'theme_mods' || $this-&gt;args['database'] == 'theme_mods_expanded' ) {&#13;
						$this-&gt;set_options( $plugin_options );&#13;
						return $this-&gt;options;&#13;
				    }&#13;
                    return $plugin_options;&#13;
                }&#13;
            } else {&#13;
            	$plugin_options['REDUX_imported'] = false;&#13;
            }&#13;
&#13;
            if( !empty( $plugin_options['defaults'] ) ) {&#13;
                $plugin_options = $this-&gt;_default_values();&#13;
                set_transient( 'redux-compiler-' . $this-&gt;args['opt_name'], '1', 1000 );&#13;
                $plugin_options['REDUX_COMPILER'] = time();&#13;
                unset( $plugin_options['defaults'], $plugin_options['compiler'], $plugin_options['import'], $plugin_options['import_code'] );&#13;
				if ( $this-&gt;args['database'] == 'transient' || $this-&gt;args['database'] == 'theme_mods' || $this-&gt;args['database'] == 'theme_mods_expanded' ) {&#13;
				    $this-&gt;set_options( $plugin_options );&#13;
					return $this-&gt;options;&#13;
				}&#13;
                return $plugin_options;&#13;
            }&#13;
&#13;
            // Validate fields (if needed)&#13;
            $plugin_options = $this-&gt;_validate_values( $plugin_options, $this-&gt;options );&#13;
&#13;
            if( $this-&gt;errors ) {&#13;
            	set_transient( 'redux-errors-' . $this-&gt;args['opt_name'], $this-&gt;errors, 1000 );&#13;
            }&#13;
&#13;
            if( $this-&gt;warnings ) {&#13;
            	set_transient( 'redux-warnings-' . $this-&gt;args['opt_name'], $this-&gt;warnings, 1000 );&#13;
            }               &#13;
&#13;
            do_action( 'redux-validate-' . $this-&gt;args['opt_name'], $plugin_options, $this-&gt;options );&#13;
&#13;
            if( !empty( $plugin_options['compiler'] ) ) {&#13;
            	$plugin_options['REDUX_COMPILER'] = time();&#13;
            	set_transient( 'redux-compiler-' . $this-&gt;args['opt_name'], '1', 2000 );&#13;
            }&#13;
&#13;
            unset( $plugin_options['defaults'] );&#13;
            unset( $plugin_options['import'] );&#13;
            unset( $plugin_options['import_code'] );&#13;
            unset( $plugin_options['import_link'] );&#13;
            unset( $plugin_options['compiler'] );&#13;
		    if ( $this-&gt;args['database'] == 'transient' || $this-&gt;args['database'] == 'theme_mods' || $this-&gt;args['database'] == 'theme_mods_expanded' ) {&#13;
				$this-&gt;set_options( $plugin_options );&#13;
				return $this-&gt;options;&#13;
		    }&#13;
            return $plugin_options;&#13;
        }&#13;
&#13;
        /**&#13;
         * Validate values from options form (used in settings api validate function)&#13;
         * calls the custom validation class for the field so authors can override with custom classes&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       array $plugin_options&#13;
         * @param       array $options&#13;
         * @return      array $plugin_options&#13;
         */&#13;
        public function _validate_values( $plugin_options, $options ) {&#13;
            foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
                if( isset( $section['fields'] ) ) {&#13;
                    foreach( $section['fields'] as $field ) {&#13;
                        $field['section_id'] = $k;&#13;
&#13;
                        if( isset( $field['type'] ) &amp;&amp; ( $field['type'] == 'checkbox' || $field['type'] == 'checkbox_hide_below' || $field['type'] == 'checkbox_hide_all' ) ) {&#13;
                            if( !isset( $plugin_options[$field['id']] ) )&#13;
                                $plugin_options[$field['id']] = 0;&#13;
                        }&#13;
&#13;
                        if( isset( $field['type'] ) &amp;&amp; $field['type'] == 'multi_text' ) continue; // We can't validate this yet&#13;
&#13;
                        if( !isset( $plugin_options[$field['id']] ) || $plugin_options[$field['id']] == '' ) continue;&#13;
&#13;
                        // Force validate of custom field types&#13;
                        if( isset( $field['type'] ) &amp;&amp; !isset( $field['validate'] ) ) {&#13;
                            if( $field['type'] == 'color' || $field['type'] == 'color_gradient' ) {&#13;
                                $field['validate'] = 'color';&#13;
                            } elseif( $field['type'] == 'date' ) {&#13;
                                $field['validate'] = 'date';&#13;
                            }&#13;
                        }&#13;
&#13;
                        if( isset( $field['validate'] ) ) {&#13;
                            $validate = 'Redux_Validation_' . $field['validate'];&#13;
&#13;
                            if( !class_exists( $validate ) ) {&#13;
                                $class_file = apply_filters( 'redux-validateclass-load', self::$_dir . 'inc/validation/' . $field['validate'] . '/validation_' . $field['validate'] . '.php', $validate );&#13;
&#13;
                                if( $class_file ) {&#13;
                                    /** @noinspection PhpIncludeInspection */&#13;
                                    require_once( $class_file );&#13;
                                }&#13;
&#13;
                            }&#13;
&#13;
                            if( class_exists( $validate ) ) {&#13;
                            	//!DOVY - DB saving stuff. Is this right?&#13;
                            	if ( empty ( $options[$field['id']] ) ) {&#13;
                            		$options[$field['id']] = '';&#13;
                            	}&#13;
&#13;
                                $validation = new $validate( $field, $plugin_options[$field['id']], $options[$field['id']] );&#13;
                                $plugin_options[$field['id']] = $validation-&gt;value;&#13;
&#13;
                                if( isset( $validation-&gt;error ) )&#13;
                                    $this-&gt;errors[] = $validation-&gt;error;&#13;
&#13;
                                if( isset( $validation-&gt;warning) )&#13;
                                    $this-&gt;warnings[] = $validation-&gt;warning;&#13;
&#13;
                                continue;&#13;
                            }&#13;
                        }&#13;
&#13;
                        if( isset( $field['validate_callback'] ) &amp;&amp; function_exists( $field['validate_callback'] ) ) {&#13;
                            $callbackvalues = call_user_func( $field['validate_callback'], $field, $plugin_options[$field['id']], $options[$field['id']] );&#13;
                            $plugin_options[$field['id']] = $callbackvalues['value'];&#13;
&#13;
                            if( isset( $callbackvalues['error'] ) )&#13;
                                $this-&gt;errors[] = $callbackvalues['error'];&#13;
&#13;
                            if( isset( $callbackvalues['warning'] ) )&#13;
                                $this-&gt;warnings[] = $callbackvalues['warning'];&#13;
                        }&#13;
                    }&#13;
                }&#13;
            }&#13;
&#13;
            return $plugin_options;&#13;
        }&#13;
&#13;
        /**&#13;
         * HTML OUTPUT.&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @return      void&#13;
         */&#13;
        public function _options_page_html() {&#13;
&#13;
            $saved = get_transient( 'redux-saved-' . $this-&gt;args['opt_name'] );&#13;
            if ( $saved ) {&#13;
            	delete_transient( 'redux-saved-' . $this-&gt;args['opt_name'] );	&#13;
            }&#13;
            echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for Wordpress alerts and warnings&#13;
&#13;
            echo '<div class="clear"></div>';&#13;
            echo '<div class="wrap">';&#13;
&#13;
            // Do we support JS?&#13;
            echo '<noscript><div class="no-js">' . __( 'Warning- This options panel will not work properly without javascript!', 'redux-framework' ) . '</div></noscript>';&#13;
&#13;
            // Security is vital!&#13;
            echo '<input type="hidden" id="ajaxsecurity" name="security" value="' . wp_create_nonce( 'of_ajax_nonce' ) . '">';&#13;
&#13;
            do_action( 'redux-page-before-form-' . $this-&gt;args['opt_name'] );&#13;
&#13;
            // Main container&#13;
            echo '<div id="redux-container">';&#13;
            echo '<form method="post" action="./options.php" enctype="multipart/form-data" id="redux-form-wrapper">';&#13;
&#13;
            echo '<input type="hidden" id="redux-compiler-hook" name="' . $this-&gt;args['opt_name'] . '[compiler]" value="">';&#13;
&#13;
            settings_fields( $this-&gt;args['opt_name'] . '_group' );&#13;
&#13;
            // Last tab?&#13;
            if( empty( $this-&gt;options['last_tab'] ) )&#13;
                $this-&gt;options['last_tab'] = '';&#13;
&#13;
            $this-&gt;options['last_tab'] = ( isset( $_GET['tab'] ) &amp;&amp; !$saved ) ? $_GET['tab'] : $this-&gt;options['last_tab'];&#13;
&#13;
            echo '<input type="hidden" id="last_tab" name="' . $this-&gt;args['opt_name'] . '[last_tab]" value="' . $this-&gt;options['last_tab'] . '">';&#13;
&#13;
            // Header area&#13;
            echo '<div id="redux-header">';&#13;
                &#13;
            if( !empty( $this-&gt;args['display_name'] ) ) {&#13;
                echo '<div class="display_header">';&#13;
                echo '<h2>' . $this-&gt;args['display_name'] . '</h2>';&#13;
&#13;
                if( !empty( $this-&gt;args['display_version'] ) )&#13;
                    echo '<span>' . $this-&gt;args['display_version'] . '</span>';&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            // Page icon&#13;
            // DOVY!&#13;
            echo '<div id="' . $this-&gt;args['page_icon'] . '" class="icon32"></div>';&#13;
&#13;
            echo '<div class="clear"></div>';&#13;
            echo '</div>';&#13;
&#13;
            // Intro text&#13;
            if( isset( $this-&gt;args['intro_text'] ) ) {&#13;
                echo '<div id="redux-intro-text">';&#13;
                echo $this-&gt;args['intro_text'];&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            // Stickybar&#13;
            echo '<div id="redux-sticky">';&#13;
            echo '<div id="info_bar">';&#13;
            echo '<a href="javascript:void(0);" id="expand_options">' . __( 'Expand', 'redux-framework' ) . '</a>';&#13;
            echo '<div class="redux-action_bar">';&#13;
            submit_button( __( 'Save Changes', 'redux-framework'), 'primary', 'redux_save', false );&#13;
            echo '&nbsp;';&#13;
            submit_button( __( 'Reset to Defaults', 'redux-framework' ), 'secondary', $this-&gt;args['opt_name'] . '[defaults]', false );&#13;
            echo '</div>';&#13;
&#13;
            echo '<div class="redux-ajax-loading" alt="' . __( 'Working...', 'redux-framework' ) . '">&nbsp;</div>';&#13;
            echo '<div class="clear"></div>';&#13;
            echo '</div>';&#13;
&#13;
            // Warning bar&#13;
            if( isset( $_GET['settings-updated'] ) &amp;&amp; $_GET['settings-updated'] == 'true' &amp;&amp; $saved == '1' ) {&#13;
                if( isset( $this-&gt;options['REDUX_imported'] ) &amp;&amp; $this-&gt;options['REDUX_imported'] === 1 ) {&#13;
                    echo '<div id="redux-imported">' . apply_filters( 'redux-imported-text-' . $this-&gt;args['opt_name'], '<strong>' . __( 'Settings Imported!', 'redux-framework' ) ) . '</strong></div>';&#13;
                } else {&#13;
                    echo '<div id="redux-save">' . apply_filters( 'redux-saved-text-' . $this-&gt;args['opt_name'], '<strong>'.__( 'Settings Saved!', 'redux-framework' ) ) . '</strong></div>';&#13;
                }&#13;
            }&#13;
&#13;
            echo '<div id="redux-save-warn">' . apply_filters( 'redux-changed-text-' . $this-&gt;args['opt_name'], '<strong>'.__( 'Settings have changed, you should save them!', 'redux-framework' ) ) . '</strong></div>';&#13;
            echo '<div id="redux-field-errors"><strong><span></span> ' . __( 'error(s) were found!', 'redux-framework' ) . '</strong></div>';&#13;
            echo '<div id="redux-field-warnings"><strong><span></span> ' . __( 'warning(s) were found!', 'redux-framework' ) . '</strong></div>';&#13;
&#13;
            echo '</div>';&#13;
&#13;
            echo '<div class="clear"></div>';&#13;
&#13;
            // Sidebar&#13;
            echo '<div id="redux-sidebar">';&#13;
            echo '<ul id="redux-group-menu">';&#13;
            foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
            	if( (isset($this-&gt;args['icon_type']) &amp;&amp; $this-&gt;args['icon_type'] == 'image') || (isset($section['icon_type']) &amp;&amp; $section['icon_type'] == 'image')) {&#13;
                //if( !empty( $this-&gt;args['icon_type'] ) &amp;&amp; $this-&gt;args['icon_type'] == 'image' ) {&#13;
                    $icon = ( !isset( $section['icon'] ) ) ? '' : '<img class="image_icon_type" src="'%20.%20%24section%5B'icon'%5D%20.%20'"> ';&#13;
                } else {&#13;
                    $icon_class = ( !isset( $section['icon_class'] ) ) ? '' : ' ' . $section['icon_class'];&#13;
                    $icon = ( !isset( $section['icon'] ) ) ? '<i class="icon-cog' . $icon_class . '"></i> ' : '<i class="icon-' . $section['icon'] . $icon_class . '"></i> ';&#13;
                }&#13;
&#13;
				if (isset($section['type']) &amp;&amp; $section['type'] == "divide") {&#13;
					echo '<li class="divide">&nbsp;</li>';&#13;
				} else {&#13;
					// DOVY! REPLACE $k with $section['ID'] when used properly.&#13;
	                echo '<li id="' . $k . '_section_group_li" class="redux-group-tab-link-li">';&#13;
	                echo '<a href="javascript:void(0);" id="' . $k . '_section_group_li_a" class="redux-group-tab-link-a" data-rel="' . $k . '">' . $icon . '<span class="group_title">' . $section['title'] . '</span></a>';&#13;
	                if ( !empty( $section['sections'] ) ) {&#13;
	                	echo '<ul id="' . $k . '_section_group_li_subsections" class="sub">';&#13;
	                	foreach ($section['sections'] as $k2 =&gt; $subsection) {&#13;
	                		echo '<li id="' . $k . '_section_group_li" class="redux-group-tab-link-li">';&#13;
	                		echo '<a href="javascript:void(0);" id="' . $k . '_section_group_subsection_li_a" class="redux-group-tab-link-a" data-rel="' . $k .'sub-'.$k2.'"><span class="group_title">' . $subsection['title'] . '</span></a>';&#13;
	                		echo '</li>';&#13;
	                	}&#13;
	                	echo '</ul>';&#13;
	                }&#13;
	                echo '</li>';							&#13;
				}                &#13;
            }&#13;
&#13;
            echo '<li class="divide">&nbsp;</li>';&#13;
&#13;
            do_action( 'redux-page-after-sections-menu-' . $this-&gt;args['opt_name'], $this );&#13;
&#13;
            if( $this-&gt;args['show_import_export'] === true ) {&#13;
                echo '<li id="import_export_default_section_group_li" class="redux-group-tab-link-li">';&#13;
&#13;
                if( !empty( $this-&gt;args['icon_type'] ) &amp;&amp; $this-&gt;args['icon_type'] == 'image' ) {&#13;
                    $icon = ( !isset( $this-&gt;args['import_icon'] ) ) ? '' : '<img src="'%20.%20%24this-&gt;args%5B'import_icon'%5D%20.%20'"> ';&#13;
                } else {&#13;
                    $icon_class = ( !isset( $this-&gt;args['import_icon_class'] ) ) ? '' : ' ' . $this-&gt;args['import_icon_class'];&#13;
                    $icon = ( !isset( $this-&gt;args['import_icon'] ) ) ? '<i class="icon-refresh' . $icon_class . '"></i>' : '<i class="icon-' . $this-&gt;args['import_icon'] . $icon_class . '"></i> ';&#13;
                }&#13;
&#13;
                echo '<a href="javascript:void(0);" id="import_export_default_section_group_li_a" class="redux-group-tab-link-a" data-rel="import_export_default">' . $icon . ' <span class="group_title">' . __( 'Import / Export', 'redux-framework' ) . '</span></a>';&#13;
                echo '</li>';&#13;
     &#13;
                echo '<li class="divide">&nbsp;</li>';&#13;
            }&#13;
&#13;
            if( is_array( $this-&gt;extra_tabs ) ) {&#13;
                foreach( $this-&gt;extra_tabs as $k =&gt; $tab ) {&#13;
                    if( !empty( $this-&gt;args['icon_type'] ) &amp;&amp; $this-&gt;args['icon_type'] == 'image' ) {&#13;
                        $icon = ( !isset( $tab['icon'] ) ) ? '' : '<img src="'%20.%20%24tab%5B'icon'%5D%20.%20'"> ';&#13;
                    } else {&#13;
                        $icon_class = ( !isset( $tab['icon_class'] ) ) ? '' : ' ' . $tab['icon_class'];&#13;
                        $icon = ( !isset( $tab['icon'] ) ) ? '<i class="icon-cog' . $icon_class . '"></i> ' : '<i class="icon-' . $tab['icon'] . $icon_class . '"></i> ';&#13;
                    }&#13;
                    echo '<li id="' . $k . '_section_group_li" class="redux-group-tab-link-li">';&#13;
                    echo '<a href="javascript:void(0);" id="' . $k . '_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="' . $k . '">' . $icon . '<span class="group_title">' . $tab['title'] . '</span></a>';&#13;
                    echo '</li>';&#13;
                }&#13;
            }&#13;
&#13;
            if( $this-&gt;args['dev_mode'] === true ) {&#13;
                echo '<li id="dev_mode_default_section_group_li" class="redux-group-tab-link-li">';&#13;
&#13;
                if( !empty( $this-&gt;args['icon_type'] ) &amp;&amp; $this-&gt;args['icon_type'] == 'image' ) {&#13;
                    $icon = ( !isset( $this-&gt;args['dev_mode_icon'] ) ) ? '' : '<img src="'%20.%20%24this-&gt;args%5B'dev_mode_icon'%5D%20.%20'"> ';&#13;
                } else {&#13;
                    $icon_class = ( !isset( $this-&gt;args['dev_mode_icon_class'] ) ) ? '' : ' ' . $this-&gt;args['dev_mode_icon_class'];&#13;
                    $icon = ( !isset( $this-&gt;args['dev_mode_icon'] ) ) ? '<i class="icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this-&gt;args['dev_mode_icon'] . $icon_class . '"></i> ';&#13;
                }&#13;
&#13;
                echo '<a href="javascript:void(0);" id="dev_mode_default_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="dev_mode_default">' . $icon . ' <span class="group_title">' . __( 'Options Object', 'redux-framework' ) . '</span></a>';&#13;
                echo '</li>';&#13;
            }&#13;
&#13;
            if( $this-&gt;args['system_info'] === true ) {&#13;
                echo '<li id="system_info_default_section_group_li" class="redux-group-tab-link-li">';&#13;
&#13;
                if( !empty( $this-&gt;args['icon_type'] ) &amp;&amp; $this-&gt;args['icon_type'] == 'image' ) {&#13;
                    $icon = ( !isset( $this-&gt;args['system_info_icon'] ) ) ? '' : '<img src="'%20.%20%24this-&gt;args%5B'system_info_icon'%5D%20.%20'"> ';&#13;
                } else {&#13;
                    $icon_class = ( !isset( $this-&gt;args['system_info_icon_class'] ) ) ? '' : ' ' . $this-&gt;args['system_info_icon_class'];&#13;
                    $icon = ( !isset( $this-&gt;args['system_info_icon'] ) ) ? '<i class="icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this-&gt;args['system_info_icon'] . $icon_class . '"></i> ';&#13;
                }&#13;
&#13;
                echo '<a href="javascript:void(0);" id="system_info_default_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="system_info_default">' . $icon . ' <span class="group_title">' . __( 'System Info', 'redux-framework' ) . '</span></a>';&#13;
                echo '</li>';&#13;
            }&#13;
&#13;
            echo '</ul>';&#13;
            echo '</div>';&#13;
&#13;
            echo '<div id="redux-main">';&#13;
&#13;
            foreach( $this-&gt;sections as $k =&gt; $section ) {&#13;
                echo '<div id="' . $k . '_section_group' . '" class="redux-group-tab">';&#13;
                if ( !empty( $section['sections'] ) ) {&#13;
                	//$tabs = "";&#13;
		            echo '<div id="' . $k . '_section_tabs' . '" class="redux-section-tabs">';&#13;
		            echo '<ul>';                	&#13;
                	foreach ($section['sections'] as $subkey =&gt; $subsection) {&#13;
                		echo '<li><a href="#'.%24k.'_section-tab-'.%24subkey.'">'.$subsection['title'].'</a></li>';&#13;
                	}&#13;
		            echo '</ul>';&#13;
               		foreach ($section['sections'] as $subkey =&gt; $subsection) {&#13;
               			echo '<div id="' . $k .'sub-'.$subkey. '_section_group' . '" class="redux-group-tab">';&#13;
                		echo '<div id="'.$k.'_section-tab-'.$subkey.'">';&#13;
                		echo "hello".$subkey;&#13;
                		do_settings_sections( $this-&gt;args['opt_name'] . $k . '_tab_'.$subkey.'_section_group' );	&#13;
                		echo "</div>";&#13;
                	}&#13;
                	echo "</div>";&#13;
                } else {&#13;
                	do_settings_sections( $this-&gt;args['opt_name'] . $k . '_section_group' );	&#13;
                }&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            if( $this-&gt;args['show_import_export'] === true ) {&#13;
                echo '<div id="import_export_default_section_group' . '" class="redux-group-tab">';&#13;
&#13;
                echo '<h3>' . __( 'Import / Export Options', 'redux-framework' ) . '</h3>';&#13;
                echo '<h4>' . __( 'Import Options', 'redux-framework' ) . '</h4>';&#13;
                echo '<p><a href="javascript:void(0);" id="redux-import-code-button" class="button-secondary">' . __( 'Import from file', 'redux-framework' ) . '</a> <a href="javascript:void(0);" id="redux-import-link-button" class="button-secondary">' . __( 'Import from URL', 'redux-framework' ) . '</a></p>';&#13;
&#13;
                echo '<div id="redux-import-code-wrapper">';&#13;
&#13;
                echo '<div class="redux-section-desc">';&#13;
                echo '<p class="description" id="import-code-description">' . apply_filters( 'redux-import-file-description', __( 'Input your backup file below and hit Import to restore your sites options from a backup.', 'redux-framework' ) ) . '</p>';&#13;
                echo '</div>';&#13;
&#13;
                echo '<textarea id="import-code-value" name="' . $this-&gt;args['opt_name'] . '[import_code]" class="large-text noUpdate" rows="8"></textarea>';&#13;
&#13;
                echo '</div>';&#13;
&#13;
                echo '<div id="redux-import-link-wrapper">';&#13;
&#13;
                echo '<div class="redux-section-desc">';&#13;
                echo '<p class="description" id="import-link-description">' . apply_filters( 'redux-import-link-description', __( 'Input the URL to another sites options set and hit Import to load the options from that site.', 'redux-framework' ) ) . '</p>';&#13;
                echo '</div>';&#13;
&#13;
                echo '<input type="text" id="import-link-value" name="' . $this-&gt;args['opt_name'] . '[import_link]" class="large-text noUpdate" value="">';&#13;
&#13;
                echo '</div>';&#13;
&#13;
                echo '<p id="redux-import-action"><input type="submit" id="redux-import" name="' . $this-&gt;args['opt_name'] . '[import]" class="button-primary" value="' . __( 'Import', 'redux-framework' ) . '">&nbsp;&nbsp;<span>' . apply_filters( 'redux-import-warning', __( 'WARNING! This will overwrite all existing option values, please proceed with caution!', 'redux-framework' ) ) . '</span></p>';&#13;
                echo '<div class="hr"></div><div class="inner"><span>&nbsp;</span></div></div>';&#13;
&#13;
                echo '<h4>' . __( 'Export Options', 'redux-framework' ) . '</h4>';&#13;
                echo '<div class="redux-section-desc">';&#13;
                echo '<p class="description">' . apply_filters( 'redux-backup-description', __( 'Here you can copy/download your current option settings. Keep this safe as you can use it as a backup should anything go wrong, or you can use it to restore your settings on this site (or any other site).', 'redux-framework' ) ) . '</p>';&#13;
                echo '</div>';&#13;
&#13;
                /** @noinspection PhpUndefinedConstantInspection */&#13;
                echo '<p><a href="javascript:void(0);" id="redux-export-code-copy" class="button-secondary">' . __( 'Copy', 'redux-framework' ) . '</a> <a href="'%20.%20add_query_arg(%20array(%20'feed'%20=&gt;%20'reduxopts-'%20.%20%24this-&gt;args%5B'opt_name'%5D,%20'action'%20=&gt;%20'download_options',%20'secret'%20=&gt;%20md5(%20AUTH_KEY%20.%20SECURE_AUTH_KEY%20)%20),%20site_url()%20)%20.%20'" id="redux-export-code-dl" class="button-primary">' . __( 'Download', 'redux-framework' ) . '</a> <a href="javascript:void(0);" id="redux-export-link" class="button-secondary">' . __( 'Copy Link', 'redux-framework' ) . '</a></p>';&#13;
                $backup_options = $this-&gt;options;&#13;
                $backup_options['redux-backup'] = '1';&#13;
                echo '<textarea class="large-text noUpdate" id="redux-export-code" rows="8">';&#13;
                print_r( json_encode( $backup_options ) );&#13;
                echo '</textarea>';&#13;
                /** @noinspection PhpUndefinedConstantInspection */&#13;
                echo '<input type="text" class="large-text noUpdate" id="redux-export-link-value" value="' . add_query_arg( array( 'feed' =&gt; 'reduxopts-' . $this-&gt;args['opt_name'], 'secret' =&gt; md5( AUTH_KEY.SECURE_AUTH_KEY ) ), site_url() ) . '">';&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            if( is_array( $this-&gt;extra_tabs ) ) {&#13;
                foreach( $this-&gt;extra_tabs as $k =&gt; $tab ) {&#13;
                    echo '<div id="' . $k . '_section_group' . '" class="redux-group-tab">';&#13;
                    echo '<h3>' . $tab['title'] . '</h3>';&#13;
                    echo $tab['content'];&#13;
                    echo '</div>';&#13;
                }&#13;
            }&#13;
&#13;
            if( $this-&gt;args['dev_mode'] === true ) {&#13;
                echo '<div id="dev_mode_default_section_group' . '" class="redux-group-tab">';&#13;
                echo '<h3>' . __( 'Options Object', 'redux-framework' ) . '</h3>';&#13;
                echo '<div class="redux-section-desc">';&#13;
&#13;
                echo '<div id="redux-object-browser"></div>';&#13;
&#13;
                echo '</div>';&#13;
&#13;
                echo '<div id="redux-object-json" class="hide">'.json_encode($this-&gt;options).'</div>';&#13;
&#13;
                echo '<a href="#" id="consolePrintObject" class="button">' . __( 'Show Object in Javascript Console Object', 'redux-framework' ) . '</a>';&#13;
                // END Javascript object debug&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            if( $this-&gt;args['system_info'] === true ) {&#13;
                require_once 'inc/sysinfo.php';&#13;
                $system_info = new Simple_System_Info();&#13;
&#13;
                echo '<div id="system_info_default_section_group' . '" class="redux-group-tab">';&#13;
                echo '<h3>' . __( 'System Info', 'redux-framework' ) . '</h3>';&#13;
&#13;
                echo '<div id="redux-system-info">';&#13;
                echo $system_info-&gt;get( true );&#13;
                echo '</div>';&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            do_action( 'redux-page-after-sections-' . $this-&gt;args['opt_name'], $this );&#13;
&#13;
            echo '<div class="clear"></div>';&#13;
            echo '</div>';&#13;
            echo '<div class="clear"></div>';&#13;
&#13;
            echo '<div id="redux-sticky-padder" style="display: none;">&nbsp;</div>';&#13;
            echo '<div id="redux-footer-sticky"><div id="redux-footer">';&#13;
&#13;
            if( isset( $this-&gt;args['share_icons'] ) ) {&#13;
                echo '<div id="redux-share">';&#13;
&#13;
                foreach( $this-&gt;args['share_icons'] as $link ) {&#13;
                    echo '<a href="'%20.%20%24link%5B'link'%5D%20.%20'" title="' . $link['title'] . '" target="_blank"><img src="'%20.%20%24link%5B'img'%5D%20.%20'"></a>';&#13;
                }&#13;
&#13;
                echo '</div>';&#13;
            }&#13;
&#13;
            echo '<div class="redux-action_bar">';&#13;
            submit_button( __( 'Save Changes', 'redux-framework'), 'primary', 'redux_save', false );&#13;
            echo '&nbsp;';&#13;
            submit_button( __( 'Reset to Defaults', 'redux-framework'), 'secondary', $this-&gt;args['opt_name'] . '[defaults]', false );&#13;
            echo '</div>';&#13;
&#13;
            echo '<div class="redux-ajax-loading" alt="' . __( 'Working...', 'redux-framework') . '">&nbsp;</div>';&#13;
            echo '<div class="clear"></div>';&#13;
&#13;
            echo '</div>';&#13;
            echo '';&#13;
            echo '</div></form></div>';&#13;
&#13;
            echo ( isset( $this-&gt;args['footer_text'] ) ) ? '<div id="redux-sub-footer">' . $this-&gt;args['footer_text'] . '</div>' : '';&#13;
&#13;
            do_action( 'redux-page-after-form-' . $this-&gt;args['opt_name'] );&#13;
&#13;
            echo '<div class="clear"></div>';&#13;
&#13;
            echo '</div><!--wrap-->';&#13;
&#13;
            if ( $this-&gt;args['dev_mode'] === true ) {&#13;
&#13;
            	echo '<br><div class="redux-timer">' . get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds</div>';&#13;
&#13;
            	if ( defined('SAVEQUERIES') &amp;&amp; SAVEQUERIES ) {&#13;
								global $wpdb;&#13;
								echo '<!--\n';
								print_r($wpdb->queries);
								echo '\n-->';&#13;
							}&#13;
&#13;
            }&#13;
&#13;
                &#13;
        }&#13;
&#13;
        /**&#13;
         * Section HTML OUTPUT.&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       array $section&#13;
         * @return      void&#13;
         */&#13;
        public function _section_desc( $section ) {&#13;
            $id = trim( rtrim( $section['id'], '_section' ), $this-&gt;args['opt_name'] );&#13;
&#13;
            if( isset( $this-&gt;sections[$id]['desc'] ) &amp;&amp; !empty( $this-&gt;sections[$id]['desc'] ) ) {&#13;
            	echo '<div class="redux-section-desc">' . $this-&gt;sections[$id]['desc'] . '</div>';&#13;
            }&#13;
        }&#13;
&#13;
        /**&#13;
         * Field HTML OUTPUT.&#13;
         *&#13;
         * Gets option from options array, then calls the specific field type class - allows extending by other devs&#13;
         *&#13;
         * @since       1.0.0&#13;
         * @access      public&#13;
         * @param       array $fields&#13;
         * @return      void&#13;
         */&#13;
        public function _field_input( $field, $v = "" ) {&#13;
&#13;
            if( isset( $field['callback'] ) &amp;&amp; function_exists( $field['callback'] ) ) {&#13;
                $value = ( isset( $this-&gt;options[$field['id']] ) ) ? $this-&gt;options[$field['id']] : '';&#13;
                do_action( 'redux-before-field-' . $this-&gt;args['opt_name'], $field, $value );&#13;
                call_user_func( $field['callback'], $field, $value );&#13;
                do_action( 'redux-after-field-' . $this-&gt;args['opt_name'], $field, $value );&#13;
                return;&#13;
            }&#13;
&#13;
            if( isset( $field['type'] ) ) {&#13;
                $field_class = 'ReduxFramework_' . $field['type'];&#13;
&#13;
                if( !class_exists( $field_class ) ) {&#13;
                    $class_file = apply_filters( 'redux-typeclass-load', self::$_dir . 'inc/fields/' . $field['type'] . '/field_' . $field['type'] . '.php', $field_class );&#13;
&#13;
                    if( $class_file ) {&#13;
                        /** @noinspection PhpIncludeInspection */&#13;
                        require_once($class_file);&#13;
                    }&#13;
&#13;
                }&#13;
&#13;
                if( class_exists( $field_class ) ) {&#13;
                    $value = isset($this-&gt;options[$field['id']])?$this-&gt;options[$field['id']]:'';&#13;
                    if ($v != "") {&#13;
                    	$value = $v;&#13;
                    }&#13;
                    do_action( 'redux-before-field-' . $this-&gt;args['opt_name'], $field, $value );&#13;
                    $render = new $field_class( $field, $value, $this );&#13;
                    &#13;
                    ob_start();&#13;
                    $render-&gt;render();&#13;
                    $_render = apply_filters('redux-field-'.$this-&gt;args['opt_name'],ob_get_contents(),$field);&#13;
                    ob_end_clean();&#13;
&#13;
                    //save the values into a unique array in case we need it for dependencies&#13;
                    $this-&gt;fieldsValues[$field['id']] = (isset($value['url']) &amp;&amp; is_array($value) )?$value['url']:$value;&#13;
                    //create default data und class string and checks the dependencies of an object&#13;
                    extract($this-&gt;check_dependencies($field));&#13;
&#13;
					echo '<fieldset id="'.$this-&gt;args['opt_name'].'-'.$field['id'].'" class="redux-field redux-container-'.$field['type'].' '.$class_string.'" data-id="'.$field['id'].'">';&#13;
	                    echo $_render;&#13;
&#13;
	                    if (!empty($field['desc'])) {&#13;
	                    	$field['description'] = $field['desc'];&#13;
	                    }&#13;
                    &#13;
                    echo ( isset( $field['description'] ) &amp;&amp; $field['type'] != "info" &amp;&amp; $field['type'] != "group" &amp;&amp; !empty( $field['description'] ) ) ? '<div class="description field-desc">' . $field['description'] . '</div>' : '';&#13;
&#13;
                    echo '</fieldset>';&#13;
&#13;
                    do_action( 'redux-after-field-' . $this-&gt;args['opt_name'], $field, $value );&#13;
                }&#13;
            }&#13;
        } // function&#13;
&#13;
        /**&#13;
         * Checks dependencies between objects based on the $field['required'] array&#13;
         *&#13;
         * If the array is set it needs to have exactly 3 entries.&#13;
         * The first entry describes which field should be monitored by the current field. eg: "content"&#13;
         * The second entry describes the comparison parameter. eg: "equals, not, is_larger, is_smaller ,contains"&#13;
         * The third entry describes the value that we are comparing against.&#13;
         *&#13;
         * Example: if the required array is set to array('content','equals','Hello World'); then the current&#13;
         * field will only be displayed if the field with id "content" has exactly the value "Hello World"&#13;
         * &#13;
         * @param array $field&#13;
         * @return array $params&#13;
         */&#13;
        public function check_dependencies($field) {&#13;
            $params = array('data_string' =&gt; "", 'class_string' =&gt; "");&#13;
&#13;
            if (!empty($field['required'])) {&#13;
                $data['check-field'] = $field['required'][0];&#13;
                $data['check-comparison'] = $field['required'][1];&#13;
                $data['check-value'] = $field['required'][2];&#13;
                $params['data_string'] = $this-&gt;create_data_string($data);&#13;
                $return = false;&#13;
                //required field must not be hidden. otherwise hide this one by default&#13;
                if (!isset($this-&gt;fieldsHidden[$data['check-field']])) {&#13;
                    if (isset($this-&gt;fieldsValues[$data['check-field']])) {&#13;
                        //$value1 = isset($this-&gt;fieldsValues[$data['check-field']]['url'])?isset($this-&gt;fieldsValues[$data['check-field']]['url']):$this-&gt;fieldsValues[$data['check-field']];&#13;
                        $value1 = $this-&gt;fieldsValues[$data['check-field']];&#13;
                        $value2 = $data['check-value'];&#13;
                        switch ($data['check-comparison']) {&#13;
                            case '=': &#13;
                            case 'equals': &#13;
                                if(is_array($value2)){&#13;
                                    if(in_array($value1, $value2))&#13;
                                       $return = true;  &#13;
                                }else{&#13;
                                    if ($value1 == $value2)&#13;
                                        $return = true; &#13;
                                }&#13;
                                break;&#13;
                            case '!=':    &#13;
                            case 'not':&#13;
                                if(is_array($value2)){&#13;
                                    if(!in_array($value1, $value2))&#13;
                                       $return = true;  &#13;
                                }else{ &#13;
                                    if ($value1 != $value2)&#13;
                                        $return = true; &#13;
                                }&#13;
                                break;&#13;
                            case '&gt;':    &#13;
                            case 'greater':    &#13;
                            case 'is_larger': &#13;
                                if ($value1 &gt; $value2)&#13;
                                    $return = true; &#13;
                                break;&#13;
                            case 'fieldsHidden[$field['id']] = true;&#13;
                }else{&#13;
                    $params['class_string'] = ' showFold ';&#13;
                }&#13;
            }&#13;
            return $params;&#13;
        }&#13;
&#13;
        /**&#13;
         * converts an array into a html data string&#13;
         *&#13;
         * @param array $data example input: array('id'=&gt;'true')&#13;
         * @return string $data_string example output: data-id='true'&#13;
         */&#13;
        public function create_data_string($data = array()){&#13;
            $data_string = "";&#13;
            &#13;
            foreach($data as $key=&gt;$value){&#13;
                if(is_array($value)) $value = implode("|",$value);&#13;
                $data_string .= " data-$key='$value' ";&#13;
            }&#13;
        &#13;
            return $data_string;&#13;
        } &#13;
    } // class&#13;
    ReduxFramework::init();&#13;
&#13;
} // if&#13;
&#13;
&#13;
