public static function compile_sass($parent) { if (!empty(self::$path)) { if (!class_exists('scssc') && !isset($GLOBALS['redux_scss_compiler'])) { $GLOBALS['redux_scss_compiler'] = true; require "scssphp/scss.inc.php"; } $scss = new scssc(); $scss->setImportPaths(self::$path); if (!$parent->args['dev_mode']) { $scss->setFormatter("scss_formatter_compressed"); } $new_css = ''; foreach (self::$import as $import) { $new_css .= $scss->compile($import); } if ($new_css != '') { if ($parent->args['sass']['page_output']) { echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>'; } else { $filesystem = $parent->filesystem; $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css'); $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css)); } } } }
public static function compile_sass($parent) { if (!empty(self::$path)) { require "scssphp/scss.inc.php"; $scss = new scssc(); $scss->setImportPaths(self::$path); if (!$parent->args['dev_mode']) { $scss->setFormatter("scss_formatter_compressed"); } $new_css = ''; foreach (self::$import as $import) { $new_css .= $scss->compile($import); } if ($new_css != '') { if ($parent->args['sass']['page_output']) { echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>'; } else { //Redux_Functions::initWpFilesystem(); //global $wp_filesystem; $filesystem = $parent->filesystem; $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css'); //$ret_val = $wp_filesystem->put_contents($css_file, $new_css, FS_CHMOD_FILE); $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css)); } } } }
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))); }
public function __construct() { // This is needed. Bah WordPress bugs. ;) if (defined('BOW_TEMPLATE_DIR') && strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(BOW_TEMPLATE_DIR)) !== false) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { // This is needed. Bah WordPress bugs. ;) if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
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; }
public function ftp_form() { if (isset($this->parent->ftp_form) && !empty($this->parent->ftp_form)) { echo '<div class="wrap"><div class="error"><p>'; echo __('Unable to modify required files. Please ensure that', 'redux-framework'); echo ' <code>' . Redux_Helpers::cleanFilePath(trailingslashit(WP_CONTENT_DIR)) . '/uploads/</code> '; echo __('has the proper read/write permissions or enter your FTP information below.', 'redux-framework'); echo '</p></div><h2></h2>' . $this->parent->ftp_form . '</div>'; } }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } if (true == Redux_Helpers::isTheme(__FILE__)) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } // This is needed. Bah WordPress bugs. <img draggable="false" class="emoji" alt="😉" src="http://s.w.org/images/core/emoji/72x72/1f609.png"> if (true == Redux_Helpers::isTheme(__FILE__)) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } // This is needed. Bah WordPress bugs. ;) if (true == Redux_Helpers::isTheme(__FILE__) || true == Redux_Helpers::isTheme(get_template_directory() . '/inc/plugins/redux.php')) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { if (!class_exists("ReduxFramework")) { return; } // This is needed. Bah WordPress bugs. ;) if (defined('TEMPLATEPATH') && strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } // This is needed. Bah WordPress bugs. ;) if (TRUE == Redux_Helpers::isTheme(__FILE__)) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } // This is needed. Bah WordPress bugs. ;) if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } }
/** * 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) { $this->parent = $parent; $this->upload_dir = ReduxFramework::$_upload_dir . 'advanced-customizer/'; $this->upload_url = ReduxFramework::$_upload_url . 'advanced-customizer/'; //add_action('wp_head', array( $this, '_enqueue_new' )); if ($parent->args['customizer'] == false) { return; } // Override the ReduxCore class add_filter("redux/extension/{$this->parent->args['opt_name']}/customizer", array($this, 'remove_core_customizer_class')); global $pagenow, $wp_customize; if (!isset($wp_customize) && $pagenow !== "customize.php" && $pagenow !== "admin-ajax.php") { return; } if ($pagenow !== "customize.php" && $pagenow !== "admin-ajax.php" && !isset($GLOBALS['wp_customize'])) { //return; } if (empty($this->_extension_dir)) { $this->_extension_dir = Redux_Helpers::get_extension_dir(dirname(__FILE__)); $this->_extension_url = Redux_Helpers::get_extension_url(dirname(__FILE__)); } self::get_post_values(); // 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('customize_save', ); if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == "on") { $this->parent->args['customizer_only'] = true; } if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == "on" && isset($_POST['customized']) && !empty($_POST['customized']) && !isset($_POST['action'])) { add_action("redux/options/{$this->parent->args['opt_name']}/options", array($this, '_override_values'), 100); } add_action('customize_register', array($this, '_register_customizer_controls')); // Create controls add_action('wp_head', array($this, 'customize_preview_init')); //add_action( 'customize_save', array( $this, 'customizer_save_before' ) ); // Before save add_action('customize_save_after', array(&$this, 'customizer_save_after')); // After save // Add global controls CSS file add_action('customize_controls_print_scripts', array($this, 'enqueue_controls_css')); add_action('customize_controls_init', array($this, 'enqueue_panel_css')); //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( "wp_footer", array( $this, '_enqueue_new' ), 100 ); //$this->_enqueue_new(); }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } // This is needed. Bah WordPress bugs. ;) if (true == Redux_Helpers::isTheme(__FILE__)) { $this->initSettings(); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } add_action('redux/page/ro_settings/enqueue', array($this, 'redux_custom_css')); }
/** * Validate Color to RGBA * Takes the user's input color value and returns it only if it's a valid color. * * @since ReduxFramework 3.0.3 */ function validate_color_rgba($color) { if ($color == "transparent") { return $color; } $color = str_replace('#', '', $color); if (strlen($color) == 3) { $color = $color . $color; } if (preg_match('/^[a-f0-9]{6}$/i', $color)) { $color = '#' . $color; } return array('hex' => $color, 'rgba' => Redux_Helpers::hex2rgba($color)); }
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; }*/ }
public static function isFieldInUse($parent, $field) { foreach ($parent->sections as $k => $section) { if (!isset($section['title'])) { continue; } if (isset($section['fields']) && !empty($section['fields'])) { if (Redux_Helpers::recursive_array_search($field, $section['fields'])) { return true; continue; } } } }
public function support_hash() { if (!wp_verify_nonce($_POST['nonce'], 'redux-support-hash')) { die; } $data = get_option('redux_support_hash'); $data = array(); $data = wp_parse_args($data, array('check' => '', 'identifier' => '')); $generate_hash = true; $system_info = Redux_Helpers::compileSystemStatus(); $newHash = md5(json_encode($system_info)); $return = array(); if ($newHash == $data['check']) { unset($generate_hash); } $post_data = array('hash' => md5(network_site_url() . '-' . $_SERVER['REMOTE_ADDR']), 'site' => esc_url(home_url('/')), 'tracking' => Redux_Helpers::getTrackingObject(), 'system_status' => $system_info); $post_data = json_encode($post_data); if ($generate_hash) { $data['check'] = $newHash; $data['identifier'] = ""; $response = wp_remote_post('http://support.redux.io/v1/', array('method' => 'POST', 'timeout' => 65, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'compress' => true, 'headers' => array(), 'body' => array('data' => $post_data))); if (is_wp_error($response)) { echo json_encode(array('status' => 'error', 'message' => $response->get_error_message())); die(1); } else { $response_code = wp_remote_retrieve_response_code($response); if ($response_code == 200) { $response = wp_remote_retrieve_body($response); $return = json_decode($response, true); if (isset($return['identifier'])) { $data['identifier'] = $return['identifier']; update_option('redux_support_hash', $data); } } else { $response = wp_remote_retrieve_body($response); echo json_encode(array('status' => 'error', 'message' => $response)); } } } if (!empty($data['identifier'])) { $return['status'] = "success"; $return['identifier'] = $data['identifier']; } else { $return['status'] = "error"; $return['message'] = __("Support hash could not be generated. Please try again later.", 'redux-framework'); } echo json_encode($return); die(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) { $this->parent = $parent; if (empty($this->extension_dir)) { //$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); } $this->field_name = 'options_object'; self::$theInstance = $this; $this->is_field = Redux_Helpers::isFieldInUse($parent, 'options_object'); if (!$this->is_field && $this->parent->args['dev_mode'] && $this->parent->args['show_options_object']) { $this->add_section(); } add_filter('redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(&$this, 'overload_field_path')); // Adds the local field }
public function __construct() { if (!class_exists('ReduxFramework')) { return; } if (true == Redux_Helpers::isTheme(__FILE__)) { $this->initSettings(); add_action('init', array($this, 'onUpdated'), 10); } else { add_action('plugins_loaded', array($this, 'initSettings'), 10); } if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'theme-options') { add_action('admin_enqueue_scripts', array($this, 'load_scripts')); } }
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))); }
/** * 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) { $this->parent = $parent; if (empty($this->extension_dir)) { //$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); } $this->field_name = 'import_export'; self::$theInstance = $this; add_action("wp_ajax_redux_link_options-" . $this->parent->args['opt_name'], array($this, "link_options")); add_action("wp_ajax_nopriv_redux_link_options-" . $this->parent->args['opt_name'], array($this, "link_options")); add_action("wp_ajax_redux_download_options-" . $this->parent->args['opt_name'], array($this, "download_options")); add_action("wp_ajax_nopriv_redux_download_options-" . $this->parent->args['opt_name'], array($this, "download_options")); do_action("redux/options/{$this->parent->args['opt_name']}/import", array($this, 'remove_cookie')); $this->is_field = Redux_Helpers::isFieldInUse($parent, 'import_export'); if (!$this->is_field && $this->parent->args['show_import_export']) { $this->add_section(); } add_filter('redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(&$this, 'overload_field_path')); // Adds the local field add_filter('upload_mimes', array($this, 'custom_upload_mimes')); }
public function output() { if ((!isset($this->field['output']) || !is_array($this->field['output'])) && !isset($this->field['compiler'])) { return; } if (!empty($this->value)) { $mode = isset($this->field['mode']) && !empty($this->field['mode']) ? $this->field['mode'] : 'color'; if ($this->value['alpha'] == "0.00" || empty($this->value['color'])) { $style = $mode . ':transparent;'; } elseif (!empty($this->value['color'])) { $style = $mode . ':rgba(' . Redux_Helpers::hex2rgba($this->value['color']) . ',' . $this->value['alpha'] . ');'; } if (!empty($this->field['output']) && is_array($this->field['output'])) { $css = Redux_Functions::parseCSS($this->field['output'], $style, $this->value); $this->parent->outputCSS .= $css; } if (!empty($this->field['compiler']) && is_array($this->field['compiler'])) { $css = Redux_Functions::parseCSS($this->field['compiler'], $style, $this->value); $this->parent->compilerCSS .= $css; } } }
public function output() { if ((!isset($this->field['output']) || !is_array($this->field['output'])) && !isset($this->field['compiler'])) { return; } $style = ''; if (!empty($this->value)) { $mode = isset($this->field['mode']) && !empty($this->field['mode']) ? $this->field['mode'] : 'color'; if ($this->value['alpha'] == "0.00" || empty($this->value['color'])) { $style .= $mode . ':transparent;'; } elseif (!empty($this->value['color'])) { $style .= $mode . ':rgba(' . Redux_Helpers::hex2rgba($this->value['color']) . ',' . $this->value['alpha'] . ');'; } if (!empty($this->field['output']) && is_array($this->field['output'])) { $keys = implode(",", $this->field['output']); $this->parent->outputCSS .= $keys . "{" . $style . '}'; } if (!empty($this->field['compiler']) && is_array($this->field['compiler'])) { $keys = implode(",", $this->field['compiler']); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; } } }
private function set_localized_data() { $this->parent->localize_data['required'] = $this->parent->required; $this->parent->localize_data['fonts'] = $this->parent->fonts; $this->parent->localize_data['required_child'] = $this->parent->required_child; $this->parent->localize_data['fields'] = $this->parent->fields; if (isset($this->parent->font_groups['google'])) { $this->parent->localize_data['googlefonts'] = $this->parent->font_groups['google']; } if (isset($this->parent->font_groups['std'])) { $this->parent->localize_data['stdfonts'] = $this->parent->font_groups['std']; } if (isset($this->parent->font_groups['customfonts'])) { $this->parent->localize_data['customfonts'] = $this->parent->font_groups['customfonts']; } $this->parent->localize_data['folds'] = $this->parent->folds; // Make sure the children are all hidden properly. foreach ($this->parent->fields as $key => $value) { if (in_array($key, $this->parent->fieldsHidden)) { foreach ($value as $k => $v) { if (!in_array($k, $this->parent->fieldsHidden)) { $this->parent->fieldsHidden[] = $k; $this->parent->folds[$k] = "hide"; } } } } if (isset($this->parent->args['dev_mode']) && $this->parent->args['dev_mode'] == true || $this->parent->args['dev_mode'] == false && isset($this->parent->args['forced_dev_mode_off']) && $this->parent->args['forced_dev_mode_off'] == true) { $nonce = wp_create_nonce('redux-ads-nonce'); $base = admin_url('admin-ajax.php') . '?action=redux_p&nonce=' . $nonce . '&url='; $this->parent->localize_data['rAds'] = Redux_Helpers::rURL_fix($base, $this->parent->args['opt_name']); } $this->parent->localize_data['fieldsHidden'] = $this->parent->fieldsHidden; $this->parent->localize_data['options'] = $this->parent->options; $this->parent->localize_data['defaults'] = $this->parent->options_defaults; /** * Save pending string * filter 'redux/{opt_name}/localize/save_pending * * @param string save_pending string */ $save_pending = apply_filters("redux/{$this->parent->args['opt_name']}/localize/save_pending", esc_html__('You have changes that are not saved. Would you like to save them now?', 'redux-framework')); /** * Reset all string * filter 'redux/{opt_name}/localize/reset * * @param string reset all string */ $reset_all = apply_filters("redux/{$this->parent->args['opt_name']}/localize/reset", esc_html__('Are you sure? Resetting will lose all custom values.', 'redux-framework')); /** * Reset section string * filter 'redux/{opt_name}/localize/reset_section * * @param string reset section string */ $reset_section = apply_filters("redux/{$this->parent->args['opt_name']}/localize/reset_section", esc_html__('Are you sure? Resetting will lose all custom values in this section.', 'redux-framework')); /** * Preset confirm string * filter 'redux/{opt_name}/localize/preset * * @param string preset confirm string */ $preset_confirm = apply_filters("redux/{$this->parent->args['opt_name']}/localize/preset", esc_html__('Your current options will be replaced with the values of this preset. Would you like to proceed?', 'redux-framework')); global $pagenow; $this->parent->localize_data['args'] = array('save_pending' => $save_pending, 'reset_confirm' => $reset_all, 'reset_section_confirm' => $reset_section, 'preset_confirm' => $preset_confirm, 'please_wait' => esc_html__('Please Wait', 'redux-framework'), 'opt_name' => $this->parent->args['opt_name'], 'slug' => $this->parent->args['page_slug'], 'hints' => $this->parent->args['hints'], 'disable_save_warn' => $this->parent->args['disable_save_warn'], 'class' => $this->parent->args['class'], 'ajax_save' => $this->parent->args['ajax_save'], 'menu_search' => $pagenow . '?page=' . $this->parent->args['page_slug'] . "&tab="); $this->parent->localize_data['ajax'] = array('console' => esc_html__('There was an error saving. Here is the result of your action:', 'redux-framework'), 'alert' => esc_html__('There was a problem with your action. Please try again or reload the page.', 'redux-framework')); $this->get_warnings_and_errors_array(); wp_localize_script('redux-js', 'redux', $this->parent->localize_data); wp_enqueue_script('redux-js'); // Enque the JS now }
public static function getExtensions($opt_name = "", $key = "") { if (empty($opt_name)) { Redux::getAllExtensions(); if (empty($key)) { return self::$extension_paths; } else { if (isset(self::$extension_paths[$key])) { return self::$extension_paths[$key]; } } } else { if (empty(self::$uses_extensions[$opt_name])) { Redux::getInstanceExtensions($opt_name); } if (empty(self::$uses_extensions[$opt_name])) { return false; } $instanceExtensions = array(); foreach (self::$uses_extensions[$opt_name] as $extension) { $class_file = end(self::$extensions[$extension]); $name = str_replace('.php', '', basename($extension)); $extension_class = 'ReduxFramework_Extension_' . $name; $instanceExtensions[$extension] = array('path' => $class_file, 'class' => $extension_class, 'version' => Redux_Helpers::get_template_version($class_file)); } return $instanceExtensions; } return false; }
public static function init() { $dir = Redux_Helpers::cleanFilePath(dirname(__FILE__)); // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester self::$_dir = trailingslashit($dir); self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL)); // See if Redux is a plugin or not if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false || strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory_uri())) !== false || strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(WP_CONTENT_DIR . '/themes/')) !== false) { self::$_is_plugin = false; } else { // Check if plugin is a symbolic link, see if it's a plugin. If embedded, we can't do a thing. if (strpos(self::$_dir, ABSPATH) === false) { if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $is_plugin = false; foreach (get_plugins() as $key => $value) { if (is_plugin_active($key) && strpos($key, 'redux-framework.php') !== false) { self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR . '/plugins/' . plugin_dir_path($key) . 'ReduxCore/')); $is_plugin = true; } } if (!$is_plugin) { self::$_is_plugin = false; } } } if (self::$_is_plugin == true || self::$_as_plugin == true) { self::$_url = plugin_dir_url(__FILE__); } else { if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) { $relative_url = str_replace(Redux_Helpers::cleanFilePath(get_template_directory()), '', self::$_dir); self::$_url = trailingslashit(get_template_directory_uri() . $relative_url); } else { if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) { $relative_url = str_replace(Redux_Helpers::cleanFilePath(get_stylesheet_directory()), '', self::$_dir); self::$_url = trailingslashit(get_stylesheet_directory_uri() . $relative_url); } else { $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::$_url = trailingslashit(self::$wp_content_url . $relative_url); } } } self::$_url = apply_filters("redux/_url", self::$_url); self::$_dir = apply_filters("redux/_dir", self::$_dir); self::$_is_plugin = apply_filters("redux/_is_plugin", self::$_is_plugin); }
public function load_first() { $plugin_dir = Redux_Helpers::cleanFilePath(WP_PLUGIN_DIR) . '/'; $self_file = Redux_Helpers::cleanFilePath(__FILE__); $path = str_replace($plugin_dir, '', $self_file); $path = str_replace('class.redux-plugin.php', 'redux-framework.php', $path); if ($plugins = get_option('active_plugins')) { if ($key = array_search($path, $plugins)) { array_splice($plugins, $key, 1); array_unshift($plugins, $path); update_option('active_plugins', $plugins); } } }
public function in_field() { $this->is_field = Redux_Helpers::isFieldInUse($this->parent, 'import_export'); }