Completed
Push — develop ( 2d809e...4b580b )
by Aristeides
03:12
created

Kirki_Modules_Resize::get_instance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Allows resizing the customizer pane.
4
 *
5
 * @package     Kirki
6
 * @category    Modules
7
 * @author      Aristeides Stathopoulos
8
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
9
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
10
 * @since       3.0.0
11
 */
12
13
/**
14
 * The Kirki_Modules_Resize object.
15
 */
16
class Kirki_Modules_Resize {
17
18
	/**
19
	 * The object instance.
20
	 *
21
	 * @static
22
	 * @access private
23
	 * @since 3.0.0
24
	 * @var object
25
	 */
26
	private static $instance;
27
28
	/**
29
	 * Constructor.
30
	 *
31
	 * @access protected
32
	 * @since 3.0.0
33
	 */
34
	protected function __construct() {
35
		add_action( 'customize_controls_print_scripts', array( $this, 'enqueue_scripts' ) );
36
	}
37
38
	/**
39
	 * Gets an instance of this object.
40
	 * Prevents duplicate instances which avoid artefacts and improves performance.
41
	 *
42
	 * @static
43
	 * @access public
44
	 * @since 3.0.0
45
	 * @return object
46
	 */
47
	public static function get_instance() {
48
		if ( ! self::$instance ) {
49
			self::$instance = new self();
50
		}
51
		return self::$instance;
52
	}
53
54
	/**
55
	 * Enqueue scripts.
56
	 *
57
	 * @access public
58
	 * @since 3.0.0
59
	 */
60
	public function enqueue_scripts() {
61
62
		wp_enqueue_script( 'kirki-customizer-resize', trailingslashit( Kirki::$url ) . 'modules/resize/resize.js', array( 'jquery-ui-resizable' ) );
63
		wp_enqueue_style( 'kirki-customizer-resize', trailingslashit( Kirki::$url ) . 'modules/resize/resize.css' );
64
	}
65
}
66