-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwp-color-picker-alpha.php
53 lines (46 loc) · 1.6 KB
/
wp-color-picker-alpha.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
<?php
/**
* Plugin Name: WP Color Picker Alpha
* Plugin URI: https://github.com/kallookoo/wp-color-picker-alpha
* Description: Plugin to test the wp-color-picker-alpha script, creating an options page, and a new section on the current theme.
* Version: 3.0.4
* Author: Sergio ( kallookoo )
* Author URI: https://dsergio.com/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
* @package WP Color Picker Alpha
*/
namespace kallookoo\wpcpa;
defined( 'ABSPATH' ) || exit;
spl_autoload_register(
function ( $item ) {
if ( 0 === strncmp( __NAMESPACE__, $item, 15 ) ) {
$item = str_replace( array( '\\', '_' ), array( '/', '-' ), strtolower( substr( $item, 15 ) ) );
$item = preg_replace( '@([^/]+)$@', 'class-$1.php', $item );
if ( file_exists( __DIR__ . '/includes' . $item ) ) {
require_once __DIR__ . '/includes' . $item;
}
}
}
);
define( 'WP_COLOR_PICKER_ALPHA_PLUGIN_FILE', __FILE__ );
// Random name to force for check the version of the script.
define( 'WP_COLOR_PICKER_ALPHA_SCRIPT_NAME', md5( __FILE__ ) . time() );
add_action( 'after_setup_theme', __NAMESPACE__ . '\Plugin::after_setup_theme', PHP_INT_MAX );
/**
* Remove all plugin data when deactivated.
*
* @since 3.0.0
*/
function on_deactivation() {
// Option page.
delete_option( 'wp-color-picker-alpha' );
// Customize.
delete_option( 'wp-color-picker-alpha-customize' );
// Widget.
delete_option( 'widget_color-picker-alpha' );
// Cache of the list of the fields.
wp_cache_delete( 'wp-color-picker-alpha-options' );
}
register_deactivation_hook( __FILE__, __NAMESPACE__ . '\on_deactivation' );