ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-kirki-field-radio.php (1110B)


      1 <?php
      2 /**
      3  * Override field methods
      4  *
      5  * @package     Kirki
      6  * @subpackage  Controls
      7  * @copyright   Copyright (c) 2016, Aristeides Stathopoulos
      8  * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
      9  * @since       2.2.7
     10  */
     11 
     12 if ( ! class_exists( 'Kirki_Field_Radio' ) ) {
     13 
     14 	/**
     15 	 * Field overrides.
     16 	 */
     17 	class Kirki_Field_Radio extends Kirki_Field {
     18 
     19 		/**
     20 		 * Sets the control type.
     21 		 *
     22 		 * @access protected
     23 		 */
     24 		protected function set_type() {
     25 
     26 			$this->type = 'kirki-radio';
     27 			// Tweaks for backwards-compatibility:
     28 			// Prior to version 0.8 radio-buttonset & radio-image were part of the radio control.
     29 			if ( in_array( $this->mode, array( 'buttonset', 'image' ) ) ) {
     30 				$this->type = 'radio-' . $this->mode;
     31 			}
     32 
     33 		}
     34 
     35 		/**
     36 		 * Sets the $sanitize_callback
     37 		 *
     38 		 * @access protected
     39 		 */
     40 		protected function set_sanitize_callback() {
     41 
     42 			// If a custom sanitize_callback has been defined,
     43 			// then we don't need to proceed any further.
     44 			if ( ! empty( $this->sanitize_callback ) ) {
     45 				return;
     46 			}
     47 			$this->sanitize_callback = 'esc_attr';
     48 
     49 		}
     50 	}
     51 }