本文整理汇总了PHP中Redux_Helpers::hex2rgba方法的典型用法代码示例。如果您正苦于以下问题:PHP Redux_Helpers::hex2rgba方法的具体用法?PHP Redux_Helpers::hex2rgba怎么用?PHP Redux_Helpers::hex2rgba使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redux_Helpers
的用法示例。
在下文中一共展示了Redux_Helpers::hex2rgba方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: output
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;
}
}
}
示例3: output
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 . '}';
}
}
}
示例4: render
/**
* Field Render Function.
*
* Takes the vars and outputs the HTML for the field in the settings
*
* @since 1.0.0
* @access public
* @return void
*/
public function render()
{
$defaults = array('color' => '#000000', 'alpha' => 1, 'rgba' => '');
$this->value = wp_parse_args($this->value, $defaults);
$field_id = $this->field['id'];
// Color picker container
echo '<div
class="redux-color-rgba-container' . $this->field['class'] . '"
data-id="' . $field_id . '"
data-show-input="' . $this->field['options']['show_input'] . '"
data-show-initial="' . $this->field['options']['show_initial'] . '"
data-show-alpha="' . $this->field['options']['show_alpha'] . '"
data-show-palette="' . $this->field['options']['show_palette'] . '"
data-show-palette-only="' . $this->field['options']['show_palette_only'] . '"
data-show-selection-palette="' . $this->field['options']['show_selection_palette'] . '"
data-max-palette-size="' . $this->field['options']['max_palette_size'] . '"
data-allow-empty="' . $this->field['options']['allow_empty'] . '"
data-clickout-fires-change="' . $this->field['options']['clickout_fires_change'] . '"
data-choose-text="' . $this->field['options']['choose_text'] . '"
data-cancel-text="' . $this->field['options']['cancel_text'] . '"
data-input-text="' . $this->field['options']['input_text'] . '"
data-show-buttons="' . $this->field['options']['show_buttons'] . '"
data-palette="' . urlencode(json_encode($this->field['options']['palette'])) . '"
>';
// Colour picker layout
$opt_name = $this->parent->args['opt_name'];
if ('' == $this->value['color']) {
$color = '';
} else {
$color = 'rgba(' . Redux_Helpers::hex2rgba($this->value['color']) . ',' . $this->value['alpha'] . ')';
}
echo '<input
name="' . $opt_name . '[' . $field_id . '][color]"
id="' . $field_id . '-color"
class="redux-color-rgba"
type="text"
value="' . $this->value['color'] . '"
data-color="' . $color . '"
data-id="' . $field_id . '"
data-current-color="' . $this->value['color'] . '"
data-block-id="' . $field_id . '"
/>';
echo '<input
type="hidden"
class="redux-hidden-color"
data-id="' . $field_id . '-color"
id="' . $field_id . '-color"
value="' . $this->value['color'] . '"
/>';
// Hidden input for alpha channel
echo '<input
type="hidden"
class="redux-hidden-alpha"
data-id="' . $field_id . '-alpha"
name="' . $opt_name . '[' . $field_id . '][alpha]' . '"
id="' . $field_id . '-alpha"
value="' . $this->value['alpha'] . '"
/>';
// Hidden input for rgba
echo '<input
type="hidden"
class="redux-hidden-rgba"
data-id="' . $field_id . '-rgba"
name="' . $opt_name . '[' . $field_id . '][rgba]' . '"
id="' . $field_id . '-rgba"
value="' . $this->value['rgba'] . '"
/>';
echo '</div>';
}
示例5: rgba
.folio-slidebar .sb-slidebar{
background-color: rgba(<?php
echo Redux_Helpers::hex2rgba($fdata['slidebar_nav_background']);
?>
, <?php
echo $fdata['slidebar_nav_bk_opacity'];
?>
);
}
/*.folio-slidebar .sb-slidebar .logo{
margin-top: 0;
padding: 24px 14px 24px 24px;
}*/
.sb-slidebar .main-nav ul li a{
color: rgba(<?php
echo Redux_Helpers::hex2rgba($fdata['slidebar_menu_typo']['color']);
?>
, 1);
font-size: <?php
echo $fdata['slidebar_menu_typo']['font-size'];
?>
;
<?php
if (isset($fdata['slidebar_menu_typo']['font-style'])) {
?>
font-style: <?php
echo $fdata['slidebar_menu_typo']['font-style'] != '' ? $fdata['slidebar_menu_typo']['font-style'] : 'normal';
?>
;
font-weight: <?php
echo $fdata['slidebar_menu_typo']['font-weight'];
示例6: getColorVal
/**
* getColorVal. Returns formatted color val in hex or rgba.
*
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css
*
* @since 1.0.0
* @access private
* @return string
*/
private function getColorVal()
{
// No notices
$color = '';
$alpha = 1;
$rgba = '';
// Must be an array
if (is_array($this->value)) {
// Enum array to parse values
foreach ($this->value as $id => $val) {
// Sanitize alpha
if ($id == 'alpha') {
$alpha = !empty($val) ? $val : 1;
} elseif ($id == 'color') {
$color = !empty($val) ? $val : '';
} elseif ($id == 'rgba') {
$rgba = !empty($val) ? $val : '';
$rgba = Redux_Helpers::hex2rgba($color, $alpha);
}
}
// Only build rgba output if alpha ia less than 1
if ($alpha < 1 && $alpha != '') {
$color = $rgba;
}
}
return $color;
}
示例7: array
metaboxes =>
widget areas =>
shortcodes =>
icon select => gallery
tracking =>
* */
$iconMap = array('repeater' => 'tags', 'social-profiles' => 'group', 'js-button' => 'hand-down', 'multi-media' => 'picture', 'css-layout' => 'fullscreen', 'color-schemes' => 'adjust-alt', 'custom-fonts' => 'fontsize', 'live-search' => 'search', 'support-faqs' => 'question', 'date-time' => 'calendar', 'premium-support' => 'fire', 'metaboxes' => 'magic', 'widget-areas' => 'inbox-box', 'shortcodes' => 'shortcode', 'icon-select' => 'gallery', 'accordion' => 'lines');
$colors = array('8CC63F', '8CC63F', '0A803B', '25AAE1', '0F75BC', 'F7941E', 'F1592A', 'ED217C', 'BF1E2D', '8569CF', '0D9FD8', '8AD749', 'EECE00', 'F8981F', 'F80E27', 'F640AE');
shuffle($colors);
echo '<style type="text/css">';
?>
<?php
foreach ($colors as $key => $color) {
echo '.theme-browser .theme.color' . esc_html($key) . ' .theme-screenshot{background-color:' . esc_html(Redux_Helpers::hex2rgba($color, 0.45)) . ';}';
echo '.theme-browser .theme.color' . esc_html($key) . ':hover .theme-screenshot{background-color:' . esc_html(Redux_Helpers::hex2rgba($color, 0.75)) . ';}';
}
echo '</style>';
$color = 1;
?>
<div class="wrap about-wrap">
<h1><?php
esc_html_e('Redux Framework - Extensions', 'redux-framework');
?>
</h1>
<div class="about-text">
<?php
printf(__('Supercharge your Redux experience. Our extensions provide you with features that will take your products to the next level.', 'redux-framework'), esc_html($this->display_version));
?>
</div>
示例8: az_page_header
//.........这里部分代码省略.........
$bg_mode_repeat = 'background-repeat: no-repeat;';
} else {
if ($title_header_background_repeat == 'repeat') {
$bg_mode_repeat = 'background-repeat: repeat;';
} else {
if ($title_header_background_repeat == 'repeat_x') {
$bg_mode_repeat = 'background-repeat: repeat-x;';
} else {
if ($title_header_background_repeat == 'repeat_y') {
$bg_mode_repeat = 'background-repeat: repeat-y;';
} else {
$bg_mode_repeat = 'background-repeat: no-repeat; background-size: cover;';
}
}
}
}
// Output Title Header Image Output
if (!empty($title_header_background_image['url'])) {
$bg_mode_output = ' style="background-image: url(' . $title_header_background_image['url'] . '); background-position:' . $bg_mode_position . '; ' . $bg_mode_repeat . '"';
}
if (!empty($title_header_height) && !empty($title_header_background_image['url'])) {
$bg_mode_output = ' style="background-image: url(' . $title_header_background_image['url'] . '); background-position:' . $bg_mode_position . '; ' . $bg_mode_repeat . ' height: ' . esc_attr($title_header_height) . 'px;"';
}
// Output Title Header Image Parallax
if (!empty($title_header_background_image_parallax['url'])) {
$bg_mode_parallax = ' style="background-image: url(' . $title_header_background_image_parallax['url'] . ');"';
}
if (!empty($title_header_height) && !empty($title_header_background_image_parallax['url'])) {
$bg_mode_parallax = ' style="background-image: url(' . $title_header_background_image_parallax['url'] . '); height: ' . esc_attr($title_header_height) . 'px;"';
}
// Check Mask Module
$mask_output = $mask_rgba_value = null;
if ($check_title_header_mask == 'mask_color' || $check_title_header_mask == 'mask_pattern_color') {
$mask_rgba_value = Redux_Helpers::hex2rgba('' . $title_header_mask_color['color'] . '', '' . $title_header_mask_color['alpha'] . '');
}
if ($check_title_header_mask == 'mask_color') {
$mask_output = '<span class="overlay-bg" style="background-color: ' . $mask_rgba_value . ';"></span>';
} else {
if ($check_title_header_mask == 'mask_pattern') {
$mask_output = '<span class="overlay-pattern" style="background-image: url(' . $title_header_mask_pattern['url'] . '); opacity: ' . $title_header_mask_pattern_opacity . ';"></span>';
} else {
if ($check_title_header_mask == 'mask_pattern_color') {
$mask_output = '<span class="overlay-pattern" style="background-image: url(' . $title_header_mask_pattern['url'] . '); opacity: ' . $title_header_mask_pattern_opacity . ';"></span><span class="overlay-bg" style="background-color: ' . $mask_rgba_value . ';"></span>';
} else {
$mask_output = '';
}
}
}
// Check Video Module
$wrap_video_check = $video_mobile_out = $bg_self_image_visibility = $alternative_button_self = $alternative_button_yt = $alternative_button_vimeo = $video_output = $video_loop = $video_autoplay = $video_vol = $self_button_play_output = $vimeo_video_id = $vimeo_player_id = $vimeo_vol = $vimeo_autoplay = $vimeo_loop = $vimeo_button_play_output = $escape_url_yt = $youtube_video_url = $youtube_container = $youtube_vol = $youtube_autoplay = $youtube_loop = null;
// Start Video Vimeo
if ($check_title_header_video == 'vimeo_embed_code') {
// Check Video Mobile/Tablets Settings
if ($title_header_video_mobile_settings == 'lightbox') {
$video_mobile_out = 'fancybox-media fancybox-video-popup';
} else {
$video_mobile_out = 'new-window-video';
}
$vimeo_video_id = esc_attr($title_header_video_vimeo_id);
$vimeo_player_id = uniqid();
// Mobile Image
$bg_video_image = !empty($title_header_video_image['url']) ? 'background-image: url(' . $title_header_video_image['url'] . ');' : '';
// Mute Audio
if ($title_header_video_vimeo_vol == 'off') {
$vimeo_vol = '1';
} else {
示例9: redux_extensions
/**
* Render Changelog Screen
*
* @access public
* @since 2.0.3
* @return void
*/
public function redux_extensions()
{
/*
repeater =>
social profiles =>
js button =>
multi media =>
css layout =>
color schemes => adjust-alt
custom fonts => fontsize
code mirror => view-mode
live search => search
support faq's => question
date time picker =>
premium support =>
metaboxes =>
widget areas =>
shortcodes =>
icon select => gallery
tracking =>
* */
$iconMap = array('repeater' => 'asl', 'social-profiles' => 'group', 'js-button' => 'hand-down', 'multi-media' => 'picture', 'css-layout' => 'fullscreen', 'color-schemes' => 'adjust-alt', 'custom-fonts' => 'fontsize', 'codemirror' => 'view-mode', 'live-search' => 'search', 'support-faqs' => 'question', 'date-time' => 'calendar', 'premium-support' => 'fire', 'metaboxes' => 'magic', 'widget-areas' => 'inbox-box', 'shortcodes' => 'shortcode', 'icon-select' => 'gallery');
$colors = array('8CC63F', '8CC63F', '0A803B', '25AAE1', '0F75BC', 'F7941E', 'F1592A', 'ED217C', 'BF1E2D', '8569CF', '0D9FD8', '8AD749', 'EECE00', 'F8981F', 'F80E27', 'F640AE');
shuffle($colors);
echo '<style type="text/css">';
?>
<?php
foreach ($colors as $key => $color) {
echo '.theme-browser .theme.color' . $key . ' .theme-screenshot{background-color:' . Redux_Helpers::hex2rgba($color, 0.45) . ';}';
echo '.theme-browser .theme.color' . $key . ':hover .theme-screenshot{background-color:' . Redux_Helpers::hex2rgba($color, 0.75) . ';}';
}
echo '</style>';
$color = 1;
?>
<div class="wrap about-wrap">
<h1><?php
_e('Redux Framework - Extensions', 'redux-framework');
?>
</h1>
<div
class="about-text"><?php
printf(__('Supercharge your Redux experience. Our extensions provide you with features that will take your products to the next level.', 'redux-framework'), $this->display_version);
?>
</div>
<div
class="redux-badge"><i
class="el el-redux"></i><span><?php
printf(__('Version %s', 'redux-framework'), ReduxFramework::$_version);
?>
</span>
</div>
<?php
$this->tabs();
?>
<p class="about-description"><?php
_e("While some are built specificially for developers, extensions such as Custom Fonts are sure to make any user happy.", 'redux-framework');
?>
</p>
<div class="extensions">
<div class="feature-section theme-browser rendered" style="clear:both;">
<?php
$data = get_transient('redux-extensions-fetch');
if (empty($data)) {
$data = json_decode(wp_remote_retrieve_body(wp_remote_get('http://reduxframework.com/wp-admin/admin-ajax.php?action=get_redux_extensions')), true);
if (!empty($data)) {
set_transient('redux-extensions-fetch', $data, 24 * HOUR_IN_SECONDS);
}
}
function shuffle_assoc($list)
{
if (!is_array($list)) {
return $list;
}
$keys = array_keys($list);
shuffle($keys);
$random = array();
foreach ($keys as $key) {
$random[$key] = $list[$key];
}
return $random;
}
$data = shuffle_assoc($data);
foreach ($data as $key => $extension) {
?>
<div class="theme color<?php
echo $color;
//.........这里部分代码省略.........
示例10: get_the_terms
// Get the Categories from Portfolio for Filter
$terms = get_the_terms($post->ID, 'project-category');
$list_categories = NULL;
if (!empty($terms)) {
foreach ($terms as $term) {
$list_categories .= strtolower(str_replace(" ", "-", $term->slug)) . ' ';
}
}
// Colorize FX
$colorize_fx_project = $colorize_fx_class = $colorize_hover = '';
if ($portfolio_colorize_effect == true) {
$colorize_fx_project = get_post_meta($post->ID, 'az_colorize_project_fx', true);
if (!empty($colorize_fx_project['color'])) {
$color_output = $colorize_fx_project['color'];
$alpha_output = $colorize_fx_project['alpha'];
$colorize_rgba_output = Redux_Helpers::hex2rgba('' . $color_output . '', '' . $alpha_output . '');
$colorize_hover = ' style="background-color: ' . $colorize_rgba_output . ';"';
$colorize_fx_class = ' colorize-portfolio-item';
} else {
$color_output = $alpha_output = $colorize_hover = $colorize_fx_class = '';
}
}
// Start Item
$output .= '
<div' . setClass(array('single-portfolio-item', $portfolio_columns_count, $list_categories)) . '>';
// Featured Image
if (has_post_thumbnail()) {
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_image_src($thumb, 'full');
if ($portfolio_layout_mode == "masonry-ly-portfolio") {
$tw = max(floor($img_url[1] / 480), 1);
示例11: esc_attr
} else {
if ($check_img_repeat == 'repeat') {
$bg_img_repeat = 'background-repeat: repeat;';
} else {
if ($check_img_repeat == 'repeat_x') {
$bg_img_repeat = 'background-repeat: repeat-x;';
} else {
if ($check_img_repeat == 'repeat_y') {
$bg_img_repeat = 'background-repeat: repeat-y;';
} else {
$bg_img_repeat = 'background-repeat: no-repeat; background-size: cover;';
}
}
}
}
$rgba_value = Redux_Helpers::hex2rgba('' . $options_alice['left_side_overaly_mask_color']['color'] . '', '' . $options_alice['left_side_overaly_mask_color']['alpha'] . '');
$bg_slogan_class = 'bg-image-slogan';
$bg_overlay_mask = '<span class="bg-image-slogan-mask" style="background-color: ' . $rgba_value . ';"></span>';
$bg_background_image = ' style="background-image: url(' . $options_alice['left_side_background_image']['url'] . '); background-position:' . $bg_img_position . '; ' . $bg_img_repeat . '"';
}
}
// Slogan Text Color
$slogant_text_color = !empty($options_alice['left_side_header_slogan_text_color']) ? ' style="color: ' . $options_alice['left_side_header_slogan_text_color'] . ';"' : '';
?>
<div id="my-menu" class="<?php
echo esc_attr($bg_slogan_visibility);
?>
">
<?php
if ($options_alice['left_side_slogan_visibility'] == 'show') {
示例12: url
if (!empty($search_title_image['url'])) {
$bg_mode_output = ' style="background-image: url(' . $search_title_image['url'] . '); background-position:' . $bg_mode_position . '; ' . $bg_mode_repeat . '"';
}
if (!empty($search_title_height) && !empty($search_title_image['url'])) {
$bg_mode_output = ' style="background-image: url(' . $search_title_image['url'] . '); background-position:' . $bg_mode_position . '; ' . $bg_mode_repeat . ' height: ' . esc_attr($search_title_height) . 'px;"';
}
// Output Title Header Image Parallax
if (!empty($search_title_image_parallax['url'])) {
$bg_mode_parallax = ' style="background-image: url(' . $search_title_image_parallax['url'] . ');"';
}
if (!empty($search_title_height) && !empty($search_title_image_parallax['url'])) {
$bg_mode_parallax = ' style="background-image: url(' . $search_title_image_parallax['url'] . '); height: ' . esc_attr($search_title_height) . 'px;"';
}
// Check Mask Module
if ($search_title_mask == 'mask_color' || $search_title_mask == 'mask_pattern_color') {
$mask_rgba_value = Redux_Helpers::hex2rgba('' . $search_title_mask_bg['color'] . '', '' . $search_title_mask_bg['alpha'] . '');
}
if ($search_title_mask == 'mask_color') {
$mask_output = '<span class="overlay-bg" style="background-color: ' . $mask_rgba_value . ';"></span>';
} else {
if ($search_title_mask == 'mask_pattern') {
$mask_output = '<span class="overlay-pattern" style="background-image: url(' . $search_title_mask_pattern['url'] . '); opacity: ' . $search_title_mask_pattern_opacity . ';"></span>';
} else {
if ($search_title_mask == 'mask_pattern_color') {
$mask_output = '<span class="overlay-pattern" style="background-image: url(' . $search_title_mask_pattern['url'] . '); opacity: ' . $search_title_mask_pattern_opacity . ';"></span><span class="overlay-bg" style="background-color: ' . $mask_rgba_value . ';"></span>';
} else {
$mask_output = '';
}
}
}
?>