PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.0.1
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.0.1
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / admin / ta-framework / fields / spinner / spinner.php

spinner.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.0.1, at admin/ta-framework/fields/spinner/spinner.php

70 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) {
2 die; } // Cannot access directly.
3 /**
4 *
5 * Field: spinner
6 *
7 * @since 1.0.0
8 * @version 1.0.0
9 */
10 if ( ! class_exists( 'DRK_LITE_Field_spinner' ) ) {
11 class DRK_LITE_Field_spinner extends DRK_LITE_Fields {
12
13 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 parent::__construct( $field, $value, $unique, $where, $parent );
15 }
16
17 public function render() {
18
19 $args = wp_parse_args(
20 $this->field,
21 array(
22 'max' => 100,
23 'min' => 0,
24 'step' => 1,
25 'unit' => '',
26 )
27 );
28
29 echo wp_kses_post( $this->field_before() );
30
31 echo '<div class="drk_lite--spin"><input type="number" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post($this->field_attributes( array( 'class' => 'drk_lite-input-number' ) )) . ' data-min="' . esc_attr( $args['min'] ) . '" data-max="' . esc_attr( $args['max'] ) . '" data-step="' . esc_attr( $args['step'] ) . '" data-unit="' . esc_attr( $args['unit'] ) . '" step="any" /></div>';
32
33 echo wp_kses_post( $this->field_after() );
34 }
35
36 public function enqueue() {
37
38 if ( ! wp_script_is( 'jquery-ui-spinner' ) ) {
39 wp_enqueue_script( 'jquery-ui-spinner' );
40 }
41 }
42
43 public function output() {
44
45 $output = '';
46 $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
47 $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
48 $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
49 $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
50
51 if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
52 foreach ( $elements as $key_property => $element ) {
53 if ( is_numeric( $key_property ) ) {
54 if ( $mode ) {
55 $output = implode( ',', $elements ) . '{' . $mode . ':' . $this->value . $unit . $important . ';}';
56 }
57 break;
58 } else {
59 $output .= $element . '{' . $key_property . ':' . $this->value . $unit . $important . '}';
60 }
61 }
62 }
63
64 $this->parent->output_css .= $output;
65
66 return $output;
67 }
68 }
69 }
70