PluginProbe
QuadMenu – Mega Menu / 1.8.9
QuadMenu – Mega Menu v1.8.9
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / lib / redux / rgba / field_rgba.php

field_rgba.php in QuadMenu – Mega Menu 1.8.9, at lib/redux/rgba/field_rgba.php

87 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6 // Don't duplicate me!
7 if (!class_exists('ReduxFramework_rgba')) {
8
9 class ReduxFramework_rgba {
10
11 function __construct($field = array(), $value = '', $parent) {
12
13 $this->parent = $parent;
14 $this->field = $field;
15 $this->value = $value;
16
17 if (isset($this->value['color']) && isset($this->value['alpha'])) {
18 $this->value = Redux_Helpers::hex2rgba($this->value['color'], $this->value['alpha']);
19 }
20
21 if (isset($this->field['default']['color']) && isset($this->field['default']['alpha'])) {
22 $this->field['default'] = Redux_Helpers::hex2rgba($this->field['default']['color'], $this->field['default']['alpha']);
23 }
24
25 if (empty(self::$_extension_dir)) {
26 $this->_extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__)));
27 $this->_extension_url = site_url(str_replace(trailingslashit(str_replace('\\', '/', ABSPATH)), '', $this->_extension_dir));
28 }
29 }
30
31 public function render() {
32
33 echo '<input data-alpha="true" data-id="' . $this->field['id'] . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" id="' . $this->field['id'] . '-color" class="redux-color redux-rgba redux-rgba-init ' . $this->field['class'] . '" type="text" value="' . $this->value . '" data-oldcolor="" data-default-color="' . ( isset($this->field['default']) ? $this->field['default'] : "" ) . '" />';
34 echo '<input type="hidden" class="redux-saved-color" id="' . $this->field['id'] . '-saved-color' . '" value="">';
35
36 if (!isset($this->field['transparent']) || $this->field['transparent'] !== false) {
37
38 $tChecked = "";
39
40 if ($this->value == "transparent") {
41 $tChecked = ' checked="checked"';
42 }
43
44 echo '<label for="' . $this->field['id'] . '-transparency" class="color-transparency-check"><input type="checkbox" class="checkbox color-transparency ' . $this->field['class'] . '" id="' . $this->field['id'] . '-transparency" data-id="' . $this->field['id'] . '-color" value="1"' . $tChecked . '> ' . __('Transparent', 'redux-framework') . '</label>';
45 }
46 }
47
48 public function enqueue() {
49
50 wp_enqueue_style('wp-color-picker');
51
52 wp_register_script('wp-color-picker-alpha', $this->_extension_url . 'wp-color-picker-alpha' . Redux_Functions::isMin() . '.js', array('jquery', 'wp-color-picker'));
53
54 wp_localize_script('wp-color-picker-alpha', 'et_pb_color_picker_strings', array(
55 'legacy_pick' => esc_html__('Select', 'quadmenu'),
56 'legacy_current' => esc_html__('Color', 'quadmenu'),
57 ));
58
59 wp_enqueue_script(
60 'redux-field-rgba-js', $this->_extension_url . 'field_rgba' . Redux_Functions::isMin() . '.js', array('jquery', 'wp-color-picker-alpha', 'redux-js'), time(), true
61 );
62 }
63
64 public function output() {
65 $style = '';
66
67 if (!empty($this->value)) {
68 $mode = ( isset($this->field['mode']) && !empty($this->field['mode']) ? $this->field['mode'] : 'color' );
69
70 $style .= $mode . ':' . $this->value . ';';
71
72 if (!empty($this->field['output']) && is_array($this->field['output'])) {
73 $css = Redux_Functions::parseCSS($this->field['output'], $style, $this->value);
74 $this->parent->outputCSS .= $css;
75 }
76
77 if (!empty($this->field['compiler']) && is_array($this->field['compiler'])) {
78 $css = Redux_Functions::parseCSS($this->field['compiler'], $style, $this->value);
79 $this->parent->compilerCSS .= $css;
80 }
81 }
82 }
83
84 }
85
86 }
87