-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-bar-colorize.php
68 lines (59 loc) · 1.79 KB
/
admin-bar-colorize.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
<?php
/**
* @package admin-bar-colorize
*/
/*
Plugin Name: Admin Bar Colorize
Author: Kod42 Team
Author URI: http://kod42.ru/
Description: Custom color for admin bar.
Version: 1.0
Text Domain: admin-bar-colorize
*/
$admin_bar_colorize_default_colors = array (
'primary' => '#23282d',
'secondary' => '#23282d',
'highlight' => '#0073aa',
'text' => '#FFFFFF',
);
function admin_bar_colorize_get_color($name)
{
global $admin_bar_colorize_default_colors;
$options = get_option( 'admin_bar_colorize_settings' );
return (isset($options[$name])) ? $options[$name] : $admin_bar_colorize_default_colors[$name];
}
function _abc_color($name)
{
echo admin_bar_colorize_get_color($name);
}
function admin_bar_colorize_input_render($name)
{
$default = admin_bar_colorize_get_color($name);
echo "<input class=\"admin-bar-colorize-color\" id=\"admin_bar_colorize_{$name}_color\" name=\"admin_bar_colorize_settings[{$name}]\" value=\"$default\">";
}
function admin_bar_colorize_init_language()
{
$plugin_dir = basename(dirname(__FILE__));
load_plugin_textdomain( 'admin-bar-colorize', false, $plugin_dir.'/languages' );
}
include('settings_functions.php');
function admin_bar_colorize_init()
{
admin_bar_colorize_init_language();
}
add_action('plugins_loaded', 'admin_bar_colorize_init');
function admin_bar_colorize_head() {
include ('style.php');
wp_enqueue_script( 'jq_color_picker_min', plugin_dir_url( __FILE__ ) . 'js/jqColorPicker.min.js' );
echo '<script type="text/javascript">'; ?>
$j=jQuery.noConflict();
$j(document).ready(function() {
$j('.admin-bar-colorize-color').colorPicker({
opacity: false,
});
});
<?php echo '</script>';
}
add_action('wp_head','admin_bar_colorize_head');
add_action('admin_head', 'admin_bar_colorize_head');
?>