本文整理汇总了PHP中Essential_Grid_Base::hex2rgba方法的典型用法代码示例。如果您正苦于以下问题:PHP Essential_Grid_Base::hex2rgba方法的具体用法?PHP Essential_Grid_Base::hex2rgba怎么用?PHP Essential_Grid_Base::hex2rgba使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Essential_Grid_Base
的用法示例。
在下文中一共展示了Essential_Grid_Base::hex2rgba方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_element_css
/**
* add all styles from an element to queue
*/
public function add_element_css($settings, $element_class)
{
//check if element_class already set, only proceed if it is not set
if (isset($this->layers_css[$this->id]['idle'][$element_class])) {
return true;
}
$idle = array();
$hover = array();
$do_hover = false;
$do_important = '';
if (isset($settings['enable-hover']) && $settings['enable-hover'] == 'on') {
$do_hover = true;
}
if (isset($settings['force-important']) && $settings['force-important'] == 'true') {
$do_important = ' !important';
}
if (!empty($settings)) {
$attributes = Essential_Grid_Item_Element::get_existing_elements(true);
foreach ($attributes as $style => $attr) {
if ($attr['style'] == 'hover' && !$do_hover) {
continue;
}
if (!isset($settings[$style]) || empty($settings[$style]) || $settings[$style] == '') {
continue;
}
if ($attr['style'] != 'idle' && $attr['style'] != 'hover') {
continue;
}
$set_style = $attr['style'] == 'idle' ? $style : str_replace('-hover', '', $style);
if ($attr['type'] == 'multi-text') {
if (!isset($settings[$style . '-unit'])) {
$settings[$style . '-unit'] = 'px';
}
$set_unit = $settings[$style . '-unit'];
if ($set_style == 'box-shadow' || $set_style == 'background-color') {
$multi_string = '';
foreach ($settings[$style] as $val) {
$multi_string .= $val . $set_unit . ' ';
}
//get box shadow color
$shadow_color = $attr['style'] == 'idle' ? $settings['shadow-color'] : $settings['shadow-color-hover'];
//get box shadow transaprency
$shadow_transparency = $attr['style'] == 'idle' ? $settings['shadow-alpha'] : $settings['shadow-alpha-hover'];
$shadow_color = Essential_Grid_Base::hex2rgba($shadow_color, $shadow_transparency);
$multi_string .= ' ' . $shadow_color;
if ($attr['style'] == 'idle') {
$idle['-moz-' . $set_style] = $multi_string;
$idle['-webkit-' . $set_style] = $multi_string;
$idle[$set_style] = $multi_string;
} else {
$hover['-moz-' . $set_style] = $multi_string;
$hover['-webkit-' . $set_style] = $multi_string;
$hover[$set_style] = $multi_string;
}
} elseif ($set_style == 'border') {
if ($attr['style'] == 'idle') {
$idle['border-top-width'] = isset($settings[$style][0]) ? $settings[$style][0] . $set_unit : '0' . $set_unit;
$idle['border-right-width'] = isset($settings[$style][1]) ? $settings[$style][1] . $set_unit : '0' . $set_unit;
$idle['border-bottom-width'] = isset($settings[$style][2]) ? $settings[$style][2] . $set_unit : '0' . $set_unit;
$idle['border-left-width'] = isset($settings[$style][3]) ? $settings[$style][3] . $set_unit : '0' . $set_unit;
} else {
$hover['border-top-width'] = isset($settings[$style][0]) ? $settings[$style][0] . $set_unit : '0' . $set_unit;
$hover['border-right-width'] = isset($settings[$style][1]) ? $settings[$style][1] . $set_unit : '0' . $set_unit;
$hover['border-bottom-width'] = isset($settings[$style][2]) ? $settings[$style][2] . $set_unit : '0' . $set_unit;
$hover['border-left-width'] = isset($settings[$style][3]) ? $settings[$style][3] . $set_unit : '0' . $set_unit;
}
} else {
$multi_string = '';
foreach ($settings[$style] as $val) {
$multi_string .= $val . $set_unit . ' ';
}
if ($attr['style'] == 'idle') {
$idle[$set_style] = $multi_string;
} else {
$hover[$set_style] = $multi_string;
}
}
} else {
if ($set_style == 'background-color') {
//get bg color transaprency
$bg_color_transparency = $attr['style'] == 'idle' ? $settings['bg-alpha'] : $settings['bg-alpha-hover'];
$bg_color_rgba = Essential_Grid_Base::hex2rgba($settings[$style], $bg_color_transparency);
// we only need rgba in backend
if ($attr['style'] == 'idle') {
$idle[$set_style] = $bg_color_rgba;
} else {
$hover[$set_style] = $bg_color_rgba;
}
} else {
if ($set_style == 'border') {
if ($attr['style'] == 'idle') {
$idle['border-style'] = 'solid';
} else {
$hover['border-style'] = 'solid';
}
}
if ($set_style == 'font-style' && $settings[$style] == 'true') {
//.........这里部分代码省略.........