PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.2
Pods – Custom Content Types and Fields v3.3.9.2
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / ui / fields / color.php
pods / ui / fields Last commit date
_comment.php 1 day ago _db.php 1 day ago _hidden.php 1 day ago _label.php 1 day ago _row.php 1 day ago attachment.php 1 day ago checkbox.php 1 day ago cleditor.php 1 day ago codemirror.php 1 day ago color.php 1 day ago currency.php 1 day ago date.php 1 day ago datetime.php 1 day ago email.php 1 day ago link.php 1 day ago number.php 1 day ago oembed.php 1 day ago password.php 1 day ago phone.php 1 day ago radio.php 1 day ago select.php 1 day ago slider.php 1 day ago slug.php 1 day ago text.php 1 day ago textarea.php 1 day ago time.php 1 day ago tinymce.php 1 day ago website.php 1 day ago
color.php
65 lines
1 <?php
2
3 // Don't load directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
9
10 wp_enqueue_style( 'wp-color-picker' );
11
12 if ( ! is_admin() ) {
13 wp_enqueue_script(
14 'iris',
15 admin_url( 'js/iris.min.js' ),
16 array(
17 'jquery-ui-draggable',
18 'jquery-ui-slider',
19 'jquery-touch-punch',
20 ),
21 '3.5',
22 [
23 'in_footer' => true,
24 ]
25 );
26 wp_enqueue_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), '3.5', true );
27 $colorpicker_l10n = array(
28 'clear' => __( 'Clear', 'pods' ),
29 'defaultString' => __( 'Default', 'pods' ),
30 'pick' => __( 'Select Color', 'pods' ),
31 'current' => __( 'Current Color', 'pods' ),
32 );
33 wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n );
34 } else {
35 wp_enqueue_script( 'wp-color-picker' );
36 }
37
38 $attributes = array();
39 $attributes['type'] = 'text';
40 $attributes['value'] = $value;
41 $attributes['tabindex'] = 2;
42 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
43 ?>
44 <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
45
46 <script type="text/javascript">
47 jQuery( function () {
48 jQuery( '#color_<?php echo esc_js( $attributes['id'] ); ?>' ).hide();
49
50 var pods_wp_color_obj_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?> = jQuery( '#<?php echo esc_js( $attributes['id'] ); ?>' ).wpColorPicker();
51
52 pods_wp_color_obj_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>.parents( '.wp-picker-container' ).find( '.iris-slider-offset' ).removeClass( 'ui-widget-content ui-slider-vertical' );
53
54 jQuery( '#<?php echo esc_js( $attributes['id'] ); ?>' ).on( 'focus blur', function () {
55 jQuery( '#color_<?php echo esc_js( $attributes['id'] ); ?>' ).slideToggle();
56 } );
57
58 jQuery( '#<?php echo esc_js( $attributes['id'] ); ?>' ).on( 'keyup', function () {
59 var color = jQuery( this ).val();
60
61 if ( '' != color.replace( '#', '' ) && color.match( '#' ) )pods_wp_color_obj_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>.wpColorPicker( 'color', color );
62 } );
63 } );
64 </script>
65