PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / hello-wpstream / framework / customizer-controls / class-wpstream-range-control.php

class-wpstream-range-control.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.8, at hello-wpstream/framework/customizer-controls/class-wpstream-range-control.php

87 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Range control
4 *
5 * @package wpstream-theme
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( ! class_exists( 'Wpstream_Range_Control' ) ) {
14 /**
15 * Custom control for range settings.
16 */
17 class Wpstream_Range_Control extends WP_Customize_Control {
18 /**
19 * Control type.
20 *
21 * @var string
22 */
23 public $type = 'wpstream_range';
24
25 /**
26 * Constructor method.
27 *
28 * @param WP_Customize_Manager $manager Customizer manager instance.
29 * @param string $id Control ID.
30 * @param array $args Additional arguments.
31 */
32 public function __construct( $manager, $id, $args = array() ) {
33
34 parent::__construct( $manager, $id, $args );
35
36 $defaults = array(
37 'min' => 8,
38 'max' => 30,
39 'step' => 1,
40 'unit' => '',
41 );
42
43 $args = wp_parse_args( $args, $defaults );
44
45 $this->min = $args['min'];
46 $this->max = $args['max'];
47 $this->step = $args['step'];
48 $this->unit = $args['unit'];
49 }
50
51 /**
52 * Render content for the custom control.
53 */
54 public function render_content() {
55 ?>
56 <label>
57 <?php if ( ! empty( $this->label ) ) : ?>
58 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
59 <?php endif; ?>
60 <div class="wpstream_customizer_slider_wrapper" >
61 <input class="range-slider"
62 min="<?php echo esc_attr( $this->min ); ?>"
63 max="<?php echo esc_attr( $this->max ); ?>"
64 step="<?php echo esc_attr( $this->step ); ?>"
65 type="range"
66 data-unit="<?php echo esc_attr( $this->unit ); ?>"
67 <?php $this->link(); ?>
68 value="<?php echo esc_attr( $this->value() ); ?>"
69 >
70 <input class="range-input"
71 type="number"
72 min="<?php echo esc_attr( $this->min ); ?>"
73 max="<?php echo esc_attr( $this->max ); ?>"
74 step="<?php echo esc_attr( $this->step ); ?>"
75 value="<?php echo esc_attr( $this->value() ); ?>"
76 <?php $this->link(); ?>
77 >
78 <?php if (!empty($this->unit)): ?>
79 <span class="wpstream_customizer_slider_value" ><?php echo esc_html( $this->unit ); ?></span>
80 <?php endif; ?>
81 </div>
82 </label>
83 <?php
84 }
85 }
86 }
87