PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / libs / factory / forms / controls / gradient.php
robin-image-optimizer / libs / factory / forms / controls Last commit date
customs 5 months ago holders 5 months ago checkbox.php 5 months ago color-and-opacity.php 5 months ago color.php 5 months ago datepicker-range.php 5 months ago dropdown-and-colors.php 5 months ago dropdown.php 5 months ago font.php 5 months ago google-font.php 5 months ago gradient.php 5 months ago hidden.php 5 months ago index.php 5 months ago integer.php 5 months ago list.php 5 months ago multiple-textbox.php 5 months ago paddings-editor.php 5 months ago pattern.php 5 months ago radio-colors.php 5 months ago radio.php 5 months ago textarea.php 5 months ago textbox.php 5 months ago url.php 5 months ago wp-editor.php 5 months ago
gradient.php
99 lines
1 <?php
2
3 /**
4 * Gradient picker Control
5 *
6 * Main options:
7 * name => a name of the control
8 * title => Заголовок
9 * colors => массив цветов для градиента
10 * Пример: array("#000 0% 0.5", "#e70303 100% 1")
11 * filldirection => Направление градиента(top, left)
12 * Пример: 90deg
13 * value => a value to show in the control
14 * default => a default value of the control if the "value" option is not specified
15 *
16 * @package core
17 * @since 1.0.0
18 */
19
20 // Exit if accessed directly
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit;
23 }
24
25 if ( ! class_exists( 'Wbcr_FactoryForms600_GradientControl' ) ) {
26 class Wbcr_FactoryForms600_GradientControl extends Wbcr_FactoryForms600_Control {
27
28 public $type = 'gradient';
29
30 /**
31 * Shows the html markup of the control.
32 *
33 * @since 1.0.0
34 * @return void
35 */
36 public function html() {
37 $name = $this->getNameOnForm();
38 $value = esc_attr( $this->getValue() );
39
40 if ( ! empty( $value ) ) {
41
42 $values = json_decode( stripcslashes( htmlspecialchars_decode( $value ) ) );
43
44 $points = '';
45
46 foreach ( $values->color_points as $split_values ) {
47 $points .= $split_values . ',';
48 }
49
50 $points = rtrim( $points, ',' );
51
52 $this->addHtmlData( 'points', $points );
53 $this->addHtmlData( 'directions', $values->filldirection );
54 } else {
55 $this->addHtmlData( 'directions', 'top' );
56 }
57 ?>
58 <script>
59 if( !window.factory ) {
60 window.factory = {};
61 }
62 if( !window.factory.res ) {
63 window.factory.res = {};
64 }
65 factory.res.resVertical = '<?php _e( 'vertical', 'robin-image-optimizer' ); ?>';
66 factory.res.resHorizontal = '<?php _e( 'horizontal', 'robin-image-optimizer' ); ?>';
67 </script>
68 <div <?php $this->attrs(); ?>>
69 <div class="factory-gradient-picker">
70 <ul class="gradientPicker-pallets">
71 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#1bbc9d" data-secondary="#16a086"></li>
72 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#2fcc71" data-secondary="#27ae61"></li>
73 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#3598dc" data-secondary="#2a80b9"></li>
74 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#9c59b8" data-secondary="#8f44ad"></li>
75 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#34495e" data-secondary="#2d3e50"></li>
76 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#f1c40f" data-secondary="#f49c14"></li>
77 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#e84c3d" data-secondary="#c1392b"></li>
78 <li class="factory-preset-gradient factory-primary-gradient" data-primary="#ecf0f1" data-secondary="#bec3c7"></li>
79 </ul>
80 <canvas class='gradientPicker-preview'></canvas>
81 <div class='factory-points'></div>
82 <div class='factory-color-picker-container'>
83 <div class="factory-slider-container">
84 <div class="factory-slider">
85 <input type="text" class="factory-input-text factory-color-hex"/>
86
87 <div class="factory-bar"></div>
88 <div class="factory-visible-value">100%</div>
89 </div>
90 </div>
91 <div class="factory-color-picker"></div>
92 </div>
93 </div>
94 <input type="hidden" id="<?php echo esc_attr( $name ); ?>" class="factory-result" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $value ); ?>">
95 </div>
96 <?php
97 }
98 }
99 }