本文整理汇总了PHP中RevSliderFunctions::hex2rgba方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctions::hex2rgba方法的具体用法?PHP RevSliderFunctions::hex2rgba怎么用?PHP RevSliderFunctions::hex2rgba使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctions
的用法示例。
在下文中一共展示了RevSliderFunctions::hex2rgba方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseDbArrayToCss
public static function parseDbArrayToCss($cssArray, $nl = "\n\r")
{
$css = '';
$deformations = self::get_deformation_css_tags();
$transparency = array('color' => 'color-transparency', 'background-color' => 'background-transparency', 'border-color' => 'border-transparency');
$check_parameters = array('border-width' => 'px', 'border-radius' => 'px', 'padding' => 'px', 'font-size' => 'px', 'line-height' => 'px');
foreach ($cssArray as $id => $attr) {
$stripped = '';
if (strpos($attr['handle'], '.tp-caption') !== false) {
$stripped = trim(str_replace('.tp-caption', '', $attr['handle']));
}
$attr['advanced'] = json_decode($attr['advanced'], true);
$styles = json_decode(str_replace("'", '"', $attr['params']), true);
$styles_adv = $attr['advanced']['idle'];
if ($stripped == '.News-Title') {
/*echo '<pre>';
print_r($attr);
echo '</pre>';
exit;*/
}
$css .= $attr['handle'];
if (!empty($stripped)) {
$css .= ', ' . $stripped;
}
$css .= " {" . $nl;
if (is_array($styles) || is_array($styles_adv)) {
if (is_array($styles)) {
foreach ($styles as $name => $style) {
if (in_array($name, $deformations) && $name !== 'css_cursor') {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($styles[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $styles[$transparency[$name]] * 100);
}
}
if (!is_array($name) && isset($check_parameters[$name])) {
$style = RevSliderFunctions::add_missing_val($style, $check_parameters[$name]);
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$ret = self::check_for_modifications($name, $style);
if ($ret['name'] == 'cursor' && $ret['style'] == 'auto') {
continue;
}
$css .= $ret['name'] . ':' . $ret['style'] . ";" . $nl;
}
}
if (is_array($styles_adv)) {
foreach ($styles_adv as $name => $style) {
if (in_array($name, $deformations) && $name !== 'css_cursor') {
continue;
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$ret = self::check_for_modifications($name, $style);
if ($ret['name'] == 'cursor' && $ret['style'] == 'auto') {
continue;
}
$css .= $ret['name'] . ':' . $ret['style'] . ";" . $nl;
}
}
}
$css .= "}" . $nl . $nl;
//add hover
$setting = json_decode($attr['settings'], true);
if (isset($setting['hover']) && $setting['hover'] == 'true') {
$hover = json_decode(str_replace("'", '"', $attr['hover']), true);
$hover_adv = $attr['advanced']['hover'];
if (is_array($hover) || is_array($hover_adv)) {
$css .= $attr['handle'] . ":hover";
if (!empty($stripped)) {
$css .= ', ' . $stripped . ':hover';
}
$css .= " {" . $nl;
if (is_array($hover)) {
foreach ($hover as $name => $style) {
if (in_array($name, $deformations) && $name !== 'css_cursor') {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($hover[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $hover[$transparency[$name]] * 100);
}
}
if (!is_array($name) && isset($check_parameters[$name])) {
$style = RevSliderFunctions::add_missing_val($style, $check_parameters[$name]);
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$ret = self::check_for_modifications($name, $style);
if ($ret['name'] == 'cursor' && $ret['style'] == 'auto') {
continue;
}
$css .= $ret['name'] . ':' . $ret['style'] . ";" . $nl;
//.........这里部分代码省略.........
示例2: parseDbArrayToCss
public static function parseDbArrayToCss($cssArray, $nl = "\n\r")
{
$css = '';
$deformations = self::get_deformation_css_tags();
$transparency = array('color' => 'color-transparency', 'background-color' => 'background-transparency', 'border-color' => 'border-transparency');
foreach ($cssArray as $id => $attr) {
$stripped = '';
if (strpos($attr['handle'], '.tp-caption') !== false) {
$stripped = trim(str_replace('.tp-caption', '', $attr['handle']));
}
$attr['advanced'] = json_decode($attr['advanced'], true);
$styles = json_decode(str_replace("'", '"', $attr['params']), true);
$styles_adv = $attr['advanced']['idle'];
$css .= $attr['handle'];
if (!empty($stripped)) {
$css .= ', ' . $stripped;
}
$css .= " {" . $nl;
if (is_array($styles) || is_array($styles_adv)) {
if (is_array($styles)) {
foreach ($styles as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($styles[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $styles[$transparency[$name]] * 100);
}
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
if (is_array($styles_adv)) {
foreach ($styles_adv as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
}
$css .= "}" . $nl . $nl;
//add hover
$setting = json_decode($attr['settings'], true);
if (@$setting['hover'] == 'true') {
$hover = json_decode(str_replace("'", '"', $attr['hover']), true);
$hover_adv = $attr['advanced']['hover'];
if (is_array($hover) || is_array($hover_adv)) {
$css .= $attr['handle'] . ":hover";
if (!empty($stripped)) {
$css .= ', ' . $stripped . ':hover';
}
$css .= " {" . $nl;
if (is_array($hover)) {
foreach ($hover as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($hover[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $hover[$transparency[$name]] * 100);
}
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
if (is_array($hover_adv)) {
foreach ($hover_adv as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
$css .= "}" . $nl . $nl;
}
}
}
return $css;
}
示例3: putSliderBase
//.........这里部分代码省略.........
}
}
//set wrapper and slider class:
$sliderWrapperClass = "rev_slider_wrapper";
$sliderClass = "rev_slider";
switch ($sliderType) {
case "responsitive":
//@since 5.0: obsolete now, was custom
//@since 5.0: obsolete now, was custom
case "fixed":
//@since 5.0: obsolete now
//@since 5.0: obsolete now
case 'auto':
case 'fullwidth':
$sliderWrapperClass .= " fullwidthbanner-container";
$sliderClass .= " fullwidthabanner";
// KRISZTIAN REMOVED SOME LINE
//$bannerStyle .= "max-height:".$bannerHeight."px;height:".$bannerHeight."px;";
//$containerStyle .= "max-height:".$bannerHeight."px;";
break;
case 'fullscreen':
$sliderWrapperClass .= " fullscreen-container";
$sliderClass .= " fullscreenbanner";
break;
default:
$bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
$containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
break;
}
$maxWidth = $this->slider->getParam('max_width', '0', RevSlider::FORCE_NUMERIC);
if ($maxWidth > 0 && $this->slider->getParam('slider_type') == 'auto') {
$containerStyle .= 'max-width:' . $maxWidth . 'px;';
}
$htmlTimerBar = "";
$enable_progressbar = $this->slider->getParam('enable_progressbar', 'on');
$timerBar = $this->slider->getParam('show_timerbar', 'top');
$progress_height = $this->slider->getParam('progress_height', '5');
$progress_opa = $this->slider->getParam('progress_opa', '15');
$progressbar_color = $this->slider->getParam('progressbar_color', '#000000');
if ($enable_progressbar !== 'on' || $slider_type == 'hero') {
$timerBar = 'hide';
}
$progress_style = ' style="height: ' . esc_attr($progress_height) . 'px; background-color: ' . RevSliderFunctions::hex2rgba($progressbar_color, $progress_opa) . ';"';
switch ($timerBar) {
case "top":
$htmlTimerBar = '<div class="tp-bannertimer"' . $progress_style . '></div>';
break;
case "bottom":
$htmlTimerBar = '<div class="tp-bannertimer tp-bottom"' . $progress_style . '></div>';
break;
case "hide":
$htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="visibility: hidden !important;"></div>';
break;
}
//check inner / outer border
$paddingType = $this->slider->getParam("padding_type", "outer");
if ($paddingType == "inner") {
$sliderWrapperClass .= " tp_inner_padding";
}
global $revSliderVersion;
$add_alias = '';
if (is_super_admin() || is_admin_bar_showing()) {
if (current_user_can('edit_theme_options')) {
$add_alias = ' data-alias="' . esc_attr($this->slider->getAlias()) . '"';
}
}
echo $htmlBeforeSlider . "\n";
echo '<div id="' . $this->sliderHtmlID_wrapper . '" class="' . $sliderWrapperClass . '"' . $add_alias;
$show_alternate = $this->slider->getParam("show_alternative_type", "off");
if ($show_alternate !== 'off') {
$show_alternate_image = $this->slider->getParam("show_alternate_image", "");
echo ' data-aimg="' . $show_alternate_image . '" ';
if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
echo ' data-amobile="enabled" ';
} else {
echo ' data-amobile="disabled" ';
}
if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') {
echo ' data-aie8="enabled" ';
} else {
echo ' data-aie8="disabled" ';
}
}
echo ' style="' . $containerStyle . '">' . "\n";
echo '<!-- START REVOLUTION SLIDER ' . $revSliderVersion . ' ' . $sliderType . ' mode -->' . "\n";
echo ' <div id="' . $this->sliderHtmlID . '"';
echo ' class="' . $sliderClass . $do_overflow . '"';
echo ' style="' . $bannerStyle . '"';
echo ' data-version="' . $revSliderVersion . '">' . "\n";
echo $this->putSlides($gal_ids, $order);
echo $htmlTimerBar;
echo ' </div>' . "\n";
$this->putJS($markup_export);
echo '</div>';
echo '<!-- END REVOLUTION SLIDER -->';
} catch (Exception $e) {
$message = $e->getMessage();
$this->putErrorMessage($message);
}
}
示例4: convert_any_rgb_or_rgba
/**
* change rgb, rgba and hex to rgba like 120,130,50,0.5 (no () and rgb/rgba)
* @since: 5.2.0
**/
public function convert_any_rgb_or_rgba($css, $type)
{
if (strpos($css, 'rgb') !== false) {
//$css = explode(')', explode('(', $css)[1])[0];
$css_1 = explode('(', $css);
$css_2 = explode(')', $css_1[1]);
$css = $css_2[0];
} else {
if ($type === "color-rgba") {
$css = RevSliderFunctions::hex2rgba($css, false, true);
} else {
$css = RevSliderFunctions::hex2rgba($css, false, true, true);
}
}
if ($type === "color-rgba" && count(explode(',', $css)) < 4) {
$css .= ',1';
}
return $css;
}