public function load() { $redux = new ReduxFramework(); $redux->init(); //if ( ! empty( $redux ) ) { $dir = ReduxFramework::$_dir . '../'; if (!ReduxFramework::$_is_plugin) { $errors = array(); if (file_exists($dir . '.tx')) { $errors[] = ".tx/"; } if (file_exists($dir . 'bin')) { $errors[] = "bin/"; } if (file_exists($dir . 'tests')) { $errors[] = "tests/"; } if (file_exists($dir . '.gitignore')) { $errors[] = ".gitignore"; } if (file_exists($dir . '.git')) { $errors[] = ".git/"; } if (file_exists($dir . 'node_modules')) { $errors[] = "node_modules/"; } if (file_exists($dir . '.travis.yml')) { $errors[] = ".travis.yml"; } if (file_exists($dir . 'bootstrap_tests.php')) { $errors[] = "bootstrap_tests.php"; } if (file_exists($dir . 'phpunit.xml')) { $errors[] = "phpunit.xml"; } if (file_exists($dir . '.ds_store')) { $errors[] = ".ds_store"; } if (file_exists($dir . 'codestyles')) { $errors[] = "codestyles/"; } if (!empty($errors)) { ?> <div class="error"> <p><?php echo 'The following directories & files are still located in your <strong>Redux</strong> directory. They may cause errors in Theme-Check.'; echo '<br /><ul style="margin-left:15px;">'; foreach ($errors as $error) { echo '<li><strong>~/' . $error . '</strong></li>'; } ?> </ul></p></div><?php } } }
public static function init() { global $wp_filesystem; // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); self::$_url = self::$wp_content_url . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } // Create our private upload directory Redux_Functions::initWpFilesystem(); self::$_upload_dir = trailingslashit($wp_filesystem->wp_content_dir()) . '/redux/'; self::$_upload_url = trailingslashit(content_url()) . '/redux/'; if (function_exists('sys_get_temp_dir')) { $tmp = sys_get_temp_dir(); if (empty($tmp)) { $tmpDir = self::$_upload_url . 'tmp'; if (file_exists($tmpDir)) { Redux_Helpers::rmdir($tmpDir); } putenv('TMPDIR=' . self::$_upload_dir . 'tmp'); } } // Ensure it exists if (!is_dir(self::$_upload_dir)) { // Create the directory $wp_filesystem->mkdir(self::$_upload_dir); } }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); self::$_url = self::$wp_content_url . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } // Create our private upload directory $upload = wp_upload_dir(); self::$_upload_dir = Redux_Helpers::cleanFilePath($upload['basedir']) . '/redux/'; self::$_upload_url = Redux_Helpers::cleanFilePath($upload['baseurl']) . '/redux/'; // Ensure it exists if (!is_dir(self::$_upload_dir)) { global $wp_filesystem; // Init wp_filesystem Redux_Functions::initWpFilesystem(); // Create the directory $wp_filesystem->mkdir(self::$_upload_dir); } }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 3.0.0 */ function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args); $this->field = $field; $this->value = $value; //$this->render(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args); $this->field = $field; $this->value = $value; $this->parent = $parent; }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); $wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL); self::$_url = trailingslashit($wp_content_url) . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } /** Still need to port these. $defaults['footer_credit'] = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="' . $this->framework_url . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>'; $defaults['help_tabs'] = array(); $defaults['help_sidebar'] = ''; // __( '', 'redux-framework' ); $defaults['database'] = ''; // possible: options, theme_mods, theme_mods_expanded, transient $defaults['customizer'] = false; // setting to true forces get_theme_mod_expanded $defaults['global_variable'] = ''; $defaults['output'] = true; // Dynamically generate CSS $defaults['transient_time'] = 60 * MINUTE_IN_SECONDS; // The defaults are set so it will preserve the old behavior. $defaults['default_show'] = false; // If true, it shows the default value $defaults['default_mark'] = ''; // What to print by the field's title if the value shown is default **/ self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false))); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args); $this->field = $field; $this->value = $value; $this->add_text = isset($this->field['add_text']) ? $this->field['add_text'] : __('Add More', 'redux-framework'); $this->show_empty = isset($this->field['show_empty']) ? $this->field['show_empty'] : true; }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); $this->field = $field; $this->value = $value; $this->googleAPIKey = $parent->args['google_api_key']; //$this->render(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->field['msg'] = isset($this->field['msg']) ? $this->field['msg'] : __('You must not enter any special characters in this field, all special characters have been removed.', 'redux-framework'); $this->value = $value; $this->current = $current; $this->validate(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->field['msg'] = isset($this->field['msg']) ? $this->field['msg'] : __('You must not enter any HTML in this field, all HTML tags have been removed.', 'redux'); $this->value = $value; $this->current = $current; $this->validate(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->field['msg'] = isset($this->field['msg']) ? $this->field['msg'] : __('You must provide a comma separated list of numerical values for this option.', 'redux-framework'); $this->value = $value; $this->current = $current; $this->validate(); }
/** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * @since Redux_Options 1.0.0 */ function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args); $this->field = $field; $this->value = $value; if (!is_array($this->value) && isset($this->field['options'])) { $this->value = $this->field['options']; } }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 3.0.4 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->field['msg'] = isset($this->field['msg']) ? $this->field['msg'] : __('This field must be a valid color value.', 'redux-framework'); $this->value = $value; $this->current = $current; $this->validate(); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field, $value, $current) { parent::__construct(); $this->field = $field; $this->field['msg'] = isset($this->field['msg']) ? $this->field['msg'] : __('You must provide a valid email for this option.', 'redux-framework'); $this->value = $value; $this->current = $current; $this->validate(); }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = '/themeoptions/'; self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); self::$_url = get_template_directory_uri() . $relative_url; }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); $this->field = $field; $this->value = $value; if (!empty($this->field['data']) && empty($this->field['options'])) { if (empty($this->field['args'])) { $this->field['args'] = array(); } $this->field['options'] = $parent->get_wordpress_data($this->field['data'], $this->field['args']); } }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args); $this->field = $field; $this->value = $value; // Create defaults array $defaults = array('mode' => '', 'path' => '', 'remote_api_url' => '', 'version' => '', 'item_name' => '', 'author' => '', 'mode' => ''); $this->field = wp_parse_args($this->field, $defaults); $defaults = array('license' => '', 'status' => ''); $this->value = wp_parse_args($this->value, $defaults); $this->parent = $parent; }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); $this->field = $field; $this->value = $value; if (!empty($this->field['data']) && empty($this->field['options'])) { if (empty($this->field['args'])) { $this->field['args'] = array(); } $this->field['options'] = $parent->get_wordpress_data($this->field['data'], $this->field['args']); } $this->field['data_class'] = isset($this->field['multi_layout']) ? 'data-' . $this->field['multi_layout'] : 'data-full'; }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); self::$_url = self::$wp_content_url . $relative_url; // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { self::$_is_plugin = false; } }
static function init() { // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__))); $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR)); $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir)); $relative_url = str_replace($wp_content_dir, '', self::$_dir); $wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL); self::$_url = trailingslashit($wp_content_url) . $relative_url; // See if Redux is a plugin or not if (defined('TEMPLATEPATH') && strpos(__FILE__, TEMPLATEPATH) !== false) { self::$_is_plugin = false; } self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false))); }
static function init() { // Windows-proof constants: replace backward by forward slashes // Thanks to: @peterbouwmeester /** @noinspection PhpUndefinedFunctionInspection */ $fslashed_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); $fslashed_abs = trailingslashit(str_replace('\\', '/', ABSPATH)); // Fix for when Wordpress is not in the wp-content directory if (strpos($fslashed_dir, $fslashed_abs) === false) { $parts = explode('/', $fslashed_abs); $test = str_replace('/' . max($parts), '', $fslashed_abs); if (strpos($fslashed_dir, $test) !== false) { $fslashed_abs = $test; } } self::$_dir = $fslashed_dir; self::$_url = site_url(str_replace($fslashed_abs, '', $fslashed_dir)); self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_cap' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'page_cap' => array('required', 'type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'page_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_position' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'enqueue' => array('required', 'data_type' => 'boolen', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Enqueue Files', 'desc' => 'Global shut-off for custom CSS enqueing by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'boolen', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'boolen', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'boolen', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'boolen', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false))); }
/** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct($field = array(), $value = '', $parent) { parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); $this->field = $field; $this->value = $value; //$this->render(); if (!empty($this->field['data']) && empty($this->field['options'])) { if (empty($this->field['args'])) { $this->field['args'] = array(); } if ($this->field['data'] == "elusive-icons" || $this->field['data'] == "elusive-icon" || $this->field['data'] == "elusive") { $icons_file = ReduxFramework::$_dir . 'inc/fields/select/fontawesome-icons.php'; $icons_file = apply_filters('redux-font-icons-file', $icons_file); if (file_exists($icons_file)) { require_once $icons_file; } } $this->field['options'] = $parent->get_wordpress_data($this->field['data'], $this->field['args']); } }
/** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. * @return void */ public function __construct($parent) { global $pagenow; if ($pagenow !== "customize.php" && $pagenow !== "admin-ajax.php") { return; } if ($parent->args['customizer'] === false) { return; } parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); // Create defaults array $defaults = array(); /* customize_controls_init customize_controls_enqueue_scripts customize_controls_print_styles customize_controls_print_scripts customize_controls_print_footer_scripts */ add_action('admin_init', array(&$this, '_enqueue'), 30); // Customizer control scripts add_action('customize_register', array(&$this, '_register_customizer_controls')); // Create controls add_action('wp_enqueue_scripts', array(&$this, '_enqueue_previewer_css')); // Enqueue previewer css add_action('wp_enqueue_scripts', array(&$this, '_enqueue_previewer_js')); // Enqueue previewer javascript add_action('customize_save', array(&$this, 'customizer_save_before')); // Before save add_action('customize_save_after', array(&$this, 'customizer_save_after')); // After save if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); $this->extension_url = site_url(str_replace(trailingslashit(str_replace('\\', '/', ABSPATH)), '', $this->extension_dir)); // Easier to read and less buggy way to find out correct url, but applicable // only if wp-content found. Othewise fall back to old URL detection code. if (preg_match("/wp-content\\/(.*)/", $this->extension_dir, $match)) { $this->extension_url = site_url('/wp-content/' . $match[1]); } } }
/** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. * @return void */ public function __construct($parent) { global $pagenow; if ($pagenow !== "customize.php" && $pagenow !== "admin-ajax.php") { return; } if ($parent->args['customizer'] === false) { return; } parent::__construct($parent->sections, $parent->args, $parent->extra_tabs); // Create defaults array $defaults = array(); /* customize_controls_init customize_controls_enqueue_scripts customize_controls_print_styles customize_controls_print_scripts customize_controls_print_footer_scripts */ add_action('admin_init', array(&$this, '_enqueue'), 30); // Customizer control scripts add_action('customize_register', array(&$this, '_register_customizer_controls')); // Create controls add_action('wp_enqueue_scripts', array(&$this, '_enqueue_previewer_css')); // Enqueue previewer css add_action('wp_enqueue_scripts', array(&$this, '_enqueue_previewer_js')); // Enqueue previewer javascript add_action('customize_save', array(&$this, 'customizer_save_before')); // Before save add_action('customize_save_after', array(&$this, 'customizer_save_after')); // After save if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); $this->extension_url = site_url(str_replace(trailingslashit(str_replace('\\', '/', ABSPATH)), '', $this->extension_dir)); } }
/** * Include necessary files * * @access public * @since 3.1.3 * @return void */ public function includes() { // Include ReduxCore if (file_exists(dirname(__FILE__) . '/ReduxCore/framework.php')) { require_once dirname(__FILE__) . '/ReduxCore/framework.php'; } if (isset(ReduxFramework::$_as_plugin)) { ReduxFramework::$_as_plugin = true; } if (file_exists(dirname(__FILE__) . '/ReduxCore/redux-extensions/config.php')) { require_once dirname(__FILE__) . '/ReduxCore/redux-extensions/config.php'; } // Include demo config, if demo mode is active if ($this->options['demo'] && file_exists(dirname(__FILE__) . '/sample/sample-config.php')) { require_once dirname(__FILE__) . '/sample/sample-config.php'; } }
private function set_redux_content() { $upload_dir = wp_upload_dir(); self::$_upload_dir = $upload_dir['basedir'] . '/redux/'; self::$_upload_url = $upload_dir['baseurl'] . '/redux/'; if (!is_dir(self::$_upload_dir)) { $this->filesystem->execute('mkdir', self::$_upload_dir); } }
public function addPanel() { $this->version = OT_VERSION; $sections = $this->getSections(); $this->data = get_option('option_tree'); if (!empty($sections) && class_exists('ReduxFramework')) { $args = array('opt_name' => $this->framework . '2Redux_Panel', 'save_defaults' => false, 'menu_title' => $this->framework . ' 2 Redux', 'output' => false, 'show_import_export' => false, 'page_slug' => $this->framework . 'Redux_Converter', 'enqueue' => false, 'intro_text' => '<p>This is your panel converted. Saving will be saved to a transient value which gets reset every hour. <a href="./admin.php?page=' . $this->framework . '_2_redux">Proceed here</a> to get the export code you would need to migrate from ' . $this->framework . ' to Redux.</p>'); $theme = wp_get_theme(); $args['display_name'] = $theme->get('Name'); $args['display_version'] = $theme->get('Version'); $args['google_api_key'] = 'AIzaSyAX_2L_UzCDPEnAHTG7zhESRVpMPS4ssII'; $sections[] = array('type' => 'divide'); $sections[] = array('title' => 'Convert to Redux!', 'icon' => 'el-icon-asl', 'fields' => array(array('id' => 'redux_conversion_welcome', 'type' => 'info', 'title' => __("Rest assured, you're making the right choice.", 'redux-framework-demo'), 'desc' => "Converting to a new framework is not always easy, in fact it's downright <strong>painful</strong>. We don't think it has to be that way. That's why we created this converter plugin.<br /><br />Fill out the items below and download a fully function Redux Framework class. <a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3WQGEY4NSYE38' target='_blank'>Be sure to donate</a>. Every bit helps."), array('id' => 'redux_convert_refresh_data', 'type' => 'checkbox', 'title' => __('Reset Panel to Old Data', 'redux-framework-demo'), 'subtitle' => __('Reset this panel to match what is inside ' . $this->framework . '.', 'redux-framework-demo'), 'options' => array(1 => 'Reset this panel to match what is stored in ' . $this->framework . '.')), array('id' => 'redux_opt_name', 'type' => 'text', 'title' => __('Database name, aka Redux opt_name', 'redux-framework-demo'), 'subtitle' => __('Choose the place where your data will be stored in the database.', 'redux-framework-demo'), 'desc' => 'Once this is specified, Redux will take care of the rest. It is suggested to use a different key than you previously had. Data migration code will be provided.', 'default' => 'redux_converter'), array('id' => 'redux_convert_data', 'type' => 'switch', 'title' => __('Add Data Migration', 'redux-framework-demo'), 'subtitle' => __('Don\'t just implement a new panel, but migrate your old data as well.', 'redux-framework-demo'), 'default' => 1, 'desc' => 'A function will be provided which will, on theme activation/upgrade, migrate your data to your new Redux opt_name location denoted above. This makes it super easy to convert even if you have many users! <span style="color: maroon;">Please verify data migrates properly. Redux takes no responsibility if a field does not convert as it should.</span> If you find a bug, <a href="https://github.com/ReduxFramework/redux-converter/issues" target="_blank">please submit it to us</a>!'), array('id' => 'redux_global_variable', 'type' => 'text', 'title' => __('Redux Global Variable', 'redux-framework-demo'), 'subtitle' => __('Redux provides a global variable for your access your panel data anywhere within wordpress.', 'redux-converter'), 'desc' => 'By default the global variable is the same as the opt_name. If you want it to be something else (or your old variable), choose a name here. All standard variable rules apply (no spaces, dashes, or other odd symbols). ' . $this->framework . '\'s typical variables (if you wanted to keep your code as is) are $data or $smof_data.'), array('id' => 'redux_delete_old_data', 'type' => 'checkbox', 'title' => __('Delete Old Panel Data?', 'redux-framework-demo'), 'subtitle' => __('We strongly suggest you don\'t do this, but it is your choice.', 'redux-framework-demo'), 'desc' => '<span style="color: red;">There is no undoing this. If something in the conversion goes bad, your previously set data will be lost. It is suggested to leave this be just in case.</span>', 'options' => array(1 => 'Remove old data on migration')), array('id' => 'redux_download_file', 'type' => 'raw', 'content' => '<center><input type="hidden" class="convertToReduxNonce" value="' . wp_create_nonce('convertToRedux' . $this->framework) . '"><a href="#" target="_blank" class="button button-primary redux-converter-action">View Redux Config File</a> <a href="#" data-action="download" class="button button-primary redux-converter-action">Download Redux Config File</a></center>'))); $ReduxFramework = new ReduxFramework($sections, $args); //print_r(get_option( 'option_tree' )); //print_r(ot_get_option('my_category_checkbox')); //echo ot_get_option('my_category_checkbox'); $convertData = false; if (empty($ReduxFramework->options) || isset($ReduxFramework->options['redux_convert_refresh_data']) && $ReduxFramework->options['redux_convert_refresh_data'] == 1) { $convertData = true; $ReduxFramework->options = get_option('option_tree'); } foreach ($sections as $section) { if (isset($section['fields'])) { foreach ($section['fields'] as $field) { if ($convertData && isset($ReduxFramework->options[$field['id']]) && !empty($ReduxFramework->options[$field['id']])) { $ReduxFramework->options[$field['id']] = $this->convertValue($ReduxFramework->options[$field['id']], $field); // Not sure why this happens. Huh. } if (isset($field['required'])) { $ReduxFramework->get_fold($field); } } } } } }
private function set_redux_content() { $upload_dir = wp_upload_dir(); self::$_upload_dir = $upload_dir['basedir'] . '/redux/'; self::$_upload_url = str_replace(array('https://', 'http://'), '//', $upload_dir['baseurl'] . '/redux/'); }
private function set_redux_content() { $upload_dir = wp_upload_dir(); self::$_upload_dir = $upload_dir['basedir'] . '/redux/'; self::$_upload_url = $upload_dir['baseurl'] . '/redux/'; }