-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
80 lines (73 loc) · 2.13 KB
/
bootstrap.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
<?php
/**
* Bootstrap the control.
*
* Addon control for the Kirki Toolkit for WordPress.
* Adds a new colorpicker control to the WordPress Customizer,
* allowing developers to build colorpickers that automatically suggest accessible link colors
* depending on the value of a background color and the surrounding-text.
*
* @package wcag-linkcolor
* @category Addon
* @author Ari Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter(
'kirki_control_types',
/**
* Registers the control with Kirki.
*
* @since 1.0
* @param array $controls An array of controls registered with the Kirki Framework.
* @return array
*/
function( $controls ) {
require_once __DIR__ . '/src/Control/WCAGTextColor.php';
$controls['kirki-wcag-tc'] = '\WPLemon\Control\WCAGTextColor';
return $controls;
}
);
add_action(
'customize_register',
/**
* Registers the control type and make it eligible for
* JS templating in the Customizer.
*
* @since 1.0
* @param WP_Customize $wp_customize The Customizer object.
* @return void
*/
function( $wp_customize ) {
require_once __DIR__ . '/src/Control/WCAGTextColor.php';
$wp_customize->register_control_type( '\WPLemon\Control\WCAGTextColor' );
// Add class aliases for backwards compatibility.
class_alias( '\WPLemon\Control\WCAGTextColor', 'Kirki_WCAG_Text_Color' );
},
0
);
/**
* Autoload Field for the Kirki v4.0 API.
*
* @since 2.0
*/
spl_autoload_register(
/**
* Autoload the class.
*
* @param string $class The class-name.
*/
function( $class ) {
if ( 'WPLemon\Field\WCAGTextColor' === $class || '\WPLemon\Field\WCAGTextColor' === $class ) {
require_once __DIR__ . '/src/Field/WCAGTextColor.php';
}
if ( 'WPLemon\Control\WCAGTextColor' === $class || '\WPLemon\Control\WCAGTextColor' === $class ) {
require_once __DIR__ . '/src/Control/WCAGTextColor.php';
}
}, false, true
);