PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
← All changes | Libs/adminify-framework/fields/switcher/switcher.php +22 -24 4.1.17 → 3.2.4.1 View file →
@@ -1,5 +1,6 @@
1 -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
1 +<?php if ( ! defined( 'ABSPATH' ) ) {
2 + die; } // Cannot access directly.
2 3 /**
3 4 *
4 5 * Field: switcher
5 6 *
@@ -4,37 +5,34 @@
4 5 * Field: switcher
5 6 *
6 7 * @since 1.0.0
7 8 * @version 1.0.0
8 - *
9 9 */
10 10 if ( ! class_exists( 'ADMINIFY_Field_switcher' ) ) {
11 - class ADMINIFY_Field_switcher extends ADMINIFY_Fields {
11 + class ADMINIFY_Field_switcher extends ADMINIFY_Fields {
12 12
13 - public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 - parent::__construct( $field, $value, $unique, $where, $parent );
15 - }
13 + public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 + parent::__construct( $field, $value, $unique, $where, $parent );
15 + }
16 16
17 - public function render() {
17 + public function render() {
18 + $active = ( ! empty( $this->value ) ) ? ' adminify--active' : '';
19 + $text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'adminify' );
20 + $text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'adminify' );
21 + $text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: ' . esc_attr( $this->field['text_width'] ) . 'px;"' : '';
18 22
19 - $active = ( ! empty( $this->value ) ) ? ' adminify--active' : '';
20 - $text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'adminify' );
21 - $text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'adminify' );
22 - $text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: '. esc_attr( $this->field['text_width'] ) .'px;"': '';
23 + echo wp_kses_post( $this->field_before() );
23 24
24 - echo $this->field_before();
25 + echo '<div class="adminify--switcher' . esc_attr( $active ) . '"' . wp_kses_post( $text_width ) . '>';
26 + echo '<span class="adminify--on">' . wp_kses_post( $text_on ) . '</span>';
27 + echo '<span class="adminify--off">' . wp_kses_post( $text_off ) . '</span>';
28 + echo '<span class="adminify--ball"></span>';
29 + echo '<input type="hidden" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes() ) . ' />';
30 + echo '</div>';
25 31
26 - echo '<div class="adminify--switcher'. esc_attr( $active ) .'"'. $text_width .'>';
27 - echo '<span class="adminify--on">'. esc_attr( $text_on ) .'</span>';
28 - echo '<span class="adminify--off">'. esc_attr( $text_off ) .'</span>';
29 - echo '<span class="adminify--ball"></span>';
30 - echo '<input type="hidden" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .' />';
31 - echo '</div>';
32 + echo ( ! empty( $this->field['label'] ) ) ? '<span class="adminify--label">' . wp_kses_post( $this->field['label'] ) . '</span>' : '';
32 33
33 - echo ( ! empty( $this->field['label'] ) ) ? '<span class="adminify--label">'. wp_kses_post( $this->field['label'] ) . '</span>' : '';
34 + echo wp_kses_post( $this->field_after() );
35 + }
34 36
35 - echo $this->field_after();
36 -
37 - }
38 -
39 - }
37 + }
40 38 }