当前位置: 首页>>代码示例>>PHP>>正文


PHP RevSliderFunctions::rgba2hex方法代码示例

本文整理汇总了PHP中RevSliderFunctions::rgba2hex方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctions::rgba2hex方法的具体用法?PHP RevSliderFunctions::rgba2hex怎么用?PHP RevSliderFunctions::rgba2hex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RevSliderFunctions的用法示例。


在下文中一共展示了RevSliderFunctions::rgba2hex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_style_settings_to_layer

 /**
  * add missing new style fields to the layers as all layers would be broken without this
  * @since 5.0
  */
 public static function add_style_settings_to_layer($sliders = false)
 {
     $sr = new RevSlider();
     $sl = new RevSliderSlide();
     $operations = new RevSliderOperations();
     if ($sliders === false) {
         //do it on all Sliders
         $sliders = $sr->getArrSliders(false);
     } else {
         $sliders = array($sliders);
     }
     $styles = $operations->getCaptionsContentArray();
     if (!empty($sliders) && is_array($sliders)) {
         foreach ($sliders as $slider) {
             $slides = $slider->getSlides();
             $staticID = $sl->getStaticSlideID($slider->getID());
             if ($staticID !== false) {
                 $msl = new RevSliderSlide();
                 if (strpos($staticID, 'static_') === false) {
                     $staticID = 'static_' . $slider->getID();
                 }
                 $msl->initByID($staticID);
                 if ($msl->getID() !== '') {
                     $slides = array_merge($slides, array($msl));
                 }
             }
             if (!empty($slides) && is_array($slides)) {
                 foreach ($slides as $slide) {
                     $layers = $slide->getLayers();
                     if (!empty($layers) && is_array($layers)) {
                         foreach ($layers as $lk => $layer) {
                             $static_styles = (array) RevSliderFunctions::getVal($layer, 'static_styles', array());
                             $def_val = (array) RevSliderFunctions::getVal($layer, 'deformation', array());
                             $defh_val = (array) RevSliderFunctions::getVal($layer, 'deformation-hover', array());
                             if (empty($def_val)) {
                                 //add parallax always!
                                 $def_val['parallax'] = RevSliderFunctions::getVal($layer, 'parallax_level', '-');
                                 $layers[$lk]['deformation'] = $def_val;
                                 //check for selected style in styles, then add all deformations to the layer
                                 $cur_style = RevSliderFunctions::getVal($layer, 'style', '');
                                 if (trim($cur_style) == '') {
                                     continue;
                                 }
                                 $wws = false;
                                 foreach ($styles as $style) {
                                     if ($style['handle'] == '.tp-caption.' . $cur_style) {
                                         $wws = $style;
                                         break;
                                     }
                                 }
                                 if ($wws == false) {
                                     continue;
                                 }
                                 $css_idle = '';
                                 $css_hover = '';
                                 $wws['params'] = (array) $wws['params'];
                                 $wws['hover'] = (array) $wws['hover'];
                                 $wws['advanced'] = (array) $wws['advanced'];
                                 if (isset($wws['params']['font-family'])) {
                                     $def_val['font-family'] = $wws['params']['font-family'];
                                 }
                                 if (isset($wws['params']['padding'])) {
                                     $raw_pad = $wws['params']['padding'];
                                     if (!is_array($raw_pad)) {
                                         $raw_pad = explode(' ', $raw_pad);
                                     }
                                     switch (count($raw_pad)) {
                                         case 1:
                                             $raw_pad = array($raw_pad[0], $raw_pad[0], $raw_pad[0], $raw_pad[0]);
                                             break;
                                         case 2:
                                             $raw_pad = array($raw_pad[0], $raw_pad[1], $raw_pad[0], $raw_pad[1]);
                                             break;
                                         case 3:
                                             $raw_pad = array($raw_pad[0], $raw_pad[1], $raw_pad[2], $raw_pad[1]);
                                             break;
                                     }
                                     $def_val['padding'] = $raw_pad;
                                 }
                                 if (isset($wws['params']['font-style'])) {
                                     $def_val['font-style'] = $wws['params']['font-style'];
                                 }
                                 if (isset($wws['params']['text-decoration'])) {
                                     $def_val['text-decoration'] = $wws['params']['text-decoration'];
                                 }
                                 if (isset($wws['params']['background-color'])) {
                                     if (RevSliderFunctions::isrgb($wws['params']['background-color'])) {
                                         $def_val['background-color'] = RevSliderFunctions::rgba2hex($wws['params']['background-color']);
                                     } else {
                                         $def_val['background-color'] = $wws['params']['background-color'];
                                     }
                                 }
                                 if (isset($wws['params']['background-transparency'])) {
                                     $def_val['background-transparency'] = $wws['params']['background-transparency'];
                                     if ($def_val['background-transparency'] > 1) {
                                         $def_val['background-transparency'] /= 100;
//.........这里部分代码省略.........
开发者ID:dawnthemes,项目名称:tkb,代码行数:101,代码来源:plugin-update.class.php

示例2: putCreativeLayer


//.........这里部分代码省略.........
             $htmlPosY = ' data-y="' . $myVer . '" data-voffset="' . $myTop . '"';
             $static_styles = RevSliderFunctions::getVal($layer, 'static_styles', array());
             if (!empty($static_styles)) {
                 $static_styles = (array) $static_styles;
                 if (!empty($static_styles['font-size'])) {
                     if (is_object($static_styles['font-size'])) {
                         $ss_fs = RevSliderFunctions::normalize_device_settings($static_styles['font-size'], $enabled_sizes, 'html-array');
                         if (strpos($ss_fs, '[') !== false) {
                             $static_data .= str_replace('px', '', '			data-fontsize="' . $ss_fs . '"') . "\n";
                         }
                     }
                 }
                 if (!empty($static_styles['line-height'])) {
                     if (is_object($static_styles['line-height'])) {
                         $ss_lh = RevSliderFunctions::normalize_device_settings($static_styles['line-height'], $enabled_sizes, 'html-array');
                         if (strpos($ss_lh, '[') !== false) {
                             $static_data .= str_replace('px', '', '			data-lineheight="' . $ss_lh . '"') . "\n";
                         }
                     }
                 }
                 if (!empty($static_styles['font-weight'])) {
                     if (is_object($static_styles['font-weight'])) {
                         $ss_fw = RevSliderFunctions::normalize_device_settings($static_styles['font-weight'], $enabled_sizes, 'html-array');
                         if (strpos($ss_fw, '[') !== false) {
                             $static_data .= str_replace('px', '', '			data-fontweight="' . $ss_fw . '"') . "\n";
                         }
                     }
                 }
                 if (!empty($static_styles['color'])) {
                     if (is_object($static_styles['color'])) {
                         $def_val = (array) RevSliderFunctions::getVal($layer, 'deformation', array());
                         foreach ($static_styles['color'] as $sk => $sv) {
                             if (strpos($sv, 'rgb') !== false) {
                                 $static_styles['color']->{$sk} = RevSliderFunctions::rgba2hex($sv);
                             }
                             $color_trans = RevSliderFunctions::getVal($def_val, 'color-transparency', 1);
                             if ($color_trans > 0) {
                                 $color_trans *= 100;
                             }
                             $color_trans = intval($color_trans);
                             $static_styles['color']->{$sk} = RevSliderFunctions::hex2rgba($static_styles['color']->{$sk}, $color_trans);
                         }
                         $ss_c = RevSliderFunctions::normalize_device_settings($static_styles['color'], $enabled_sizes, 'html-array');
                         if (strpos($ss_c, '[') !== false) {
                             $static_data .= '			data-color="' . $ss_c . '"' . "\n";
                         }
                     }
                 }
             }
             $max_width = RevSliderFunctions::getVal($layer, 'max_width', 'auto');
             $max_height = RevSliderFunctions::getVal($layer, 'max_height', 'auto');
             $white_space = RevSliderFunctions::getVal($layer, 'whitespace', 'nowrap');
             $cover_mode = RevSliderFunctions::getVal($layer, 'cover_mode', array());
             if (is_string($cover_mode)) {
                 $cover_mode = array('desktop' => $cover_mode, 'notebook' => $cover_mode, 'tablet' => $cover_mode, 'mobile' => $cover_mode);
             } else {
                 //change to array
                 $cover_mode = (array) $cover_mode;
             }
             if (is_object($max_width)) {
                 $max_width = RevSliderFunctions::normalize_device_settings($max_width, $enabled_sizes);
                 if ($max_width->desktop == 'auto') {
                     $max_width->desktop = 'none';
                 }
                 if ($max_width->notebook == 'auto') {
                     $max_width->notebook = 'none';
开发者ID:surreal8,项目名称:wptheme,代码行数:67,代码来源:output.class.php


注:本文中的RevSliderFunctions::rgba2hex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。