本文整理汇总了PHP中Redux_Helpers类的典型用法代码示例。如果您正苦于以下问题:PHP Redux_Helpers类的具体用法?PHP Redux_Helpers怎么用?PHP Redux_Helpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Redux_Helpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile_sass
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));
}
}
}
}
示例2: compile_sass
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));
}
}
}
}
示例3: init
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)));
}
示例4: __construct
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);
}
}
示例5: __construct
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);
}
}
示例6: init
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;
}
示例7: ftp_form
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>';
}
}
示例8: __construct
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);
}
}
示例9: __construct
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);
}
}
示例10: __construct
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);
}
}
示例11: __construct
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);
}
}
示例12: __construct
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);
}
}
示例13: __construct
/**
* 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();
}
示例14: __construct
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'));
}
示例15: validate_color_rgba
/**
* 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));
}