Issues (377)

field/class-kirki-field-editor.php (1 issue)

1
<?php
2
/**
3
 * Override field methods
4
 *
5
 * @package     Kirki
6
 * @subpackage  Controls
7
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
8
 * @license    https://opensource.org/licenses/MIT
9
 * @since       2.2.7
10
 */
11
12
/**
13
 * Field overrides.
14
 */
15
class Kirki_Field_Editor extends Kirki_Field {
16
17
	/**
18
	 * Sets the control type.
19
	 *
20
	 * @access protected
21
	 */
22
	protected function set_type() {
23
		global $wp_version;
24
25
		if ( version_compare( $wp_version, '4.8' ) >= 0 ) {
26
			$this->type = 'kirki-editor';
27
			return;
28
		}
29
30
		// Fallback for older WordPress versions.
31
		$this->type = 'kirki-generic';
32
		if ( ! is_array( $this->choices ) ) {
0 ignored issues
show
The condition is_array($this->choices) is always true.
Loading history...
33
			$this->choices = array();
34
		}
35
		$this->choices['element'] = 'textarea';
36
		$this->choices['rows']    = '5';
37
	}
38
39
	/**
40
	 * Sets the $sanitize_callback
41
	 *
42
	 * @access protected
43
	 */
44
	protected function set_sanitize_callback() {
45
46
		// If a custom sanitize_callback has been defined,
47
		// then we don't need to proceed any further.
48
		if ( ! empty( $this->sanitize_callback ) ) {
49
			return;
50
		}
51
		$this->sanitize_callback = 'wp_kses_post';
52
	}
53
}
54