-
Notifications
You must be signed in to change notification settings - Fork 56
/
customizer-library.php
executable file
·94 lines (74 loc) · 2.2 KB
/
customizer-library.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Customizer Library
*
* @package Customizer_Library
* @author Devin Price, The Theme Foundry
* @license GPL-2.0+
* @version 1.3.0
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Continue if the Customizer_Library isn't already in use.
if ( ! class_exists( 'Customizer_Library' ) ) :
// Helper functions to output the customizer controls.
require plugin_dir_path( __FILE__ ) . 'extensions/interface.php';
// Helper functions for customizer sanitization.
require plugin_dir_path( __FILE__ ) . 'extensions/sanitization.php';
// Helper functions to build the inline CSS.
require plugin_dir_path( __FILE__ ) . 'extensions/style-builder.php';
// Helper functions for fonts.
require plugin_dir_path( __FILE__ ) . 'extensions/fonts.php';
// Utility functions for the customizer.
require plugin_dir_path( __FILE__ ) . 'extensions/utilities.php';
// Customizer preview functions.
require plugin_dir_path( __FILE__ ) . 'extensions/preview.php';
// Textarea control
if ( version_compare( $GLOBALS['wp_version'], '4.0', '<' ) ) {
require plugin_dir_path( __FILE__ ) . 'custom-controls/textarea.php';
}
// Arbitrary content controls
require plugin_dir_path( __FILE__ ) . 'custom-controls/content.php';
/**
* Class wrapper with useful methods for interacting with the theme customizer.
*/
class Customizer_Library {
/**
* The one instance of Customizer_Library.
*
* @since 1.0.0.
*
* @var Customizer_Library_Styles The one instance for the singleton.
*/
private static $instance;
/**
* The array for storing $options.
*
* @since 1.0.0.
*
* @var array Holds the options array.
*/
public $options = array();
/**
* Instantiate or return the one Customizer_Library instance.
*
* @since 1.0.0.
*
* @return Customizer_Library
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
public function add_options( $options = array() ) {
$this->options = array_merge( $options, $this->options );
}
public function get_options() {
return $this->options;
}
}
endif;