PluginProbe
Easy Hotel – Powerful Hotel Booking / 2.0.4
Easy Hotel – Powerful Hotel Booking v2.0.4
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / admin / includes / framework / fields / switcher / switcher.php

switcher.php in Easy Hotel – Powerful Hotel Booking 2.0.4, at admin/includes/framework/fields/switcher/switcher.php

41 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * Field: switcher
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'ESHB_Field_switcher' ) ) {
11 class ESHB_Field_switcher extends ESHB_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 $active = ( ! empty( $this->value ) ) ? ' csf--active' : '';
20 $text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'easy-hotel' );
21 $text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'easy-hotel' );
22 $text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: '. esc_attr( $this->field['text_width'] ) .'px;"': '';
23
24 echo wp_kses_post($this->field_before());
25
26 echo '<div class="csf--switcher'. esc_attr( $active ) .'"'. esc_attr($text_width) .'>';
27 echo '<span class="csf--on">'. esc_attr( $text_on ) .'</span>';
28 echo '<span class="csf--off">'. esc_attr( $text_off ) .'</span>';
29 echo '<span class="csf--ball"></span>';
30 echo '<input type="hidden" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. esc_attr($this->field_attributes()) .' />';
31 echo '</div>';
32
33 echo ( ! empty( $this->field['label'] ) ) ? '<span class="csf--label">'. esc_attr( $this->field['label'] ) . '</span>' : '';
34
35 echo wp_kses_post($this->field_after());
36
37 }
38
39 }
40 }
41