Changeset 1865996
- Timestamp:
- 04/29/2018 12:15:34 PM (8 years ago)
- Location:
- admin-bar-styler
- Files:
-
- 12 added
- 4 edited
-
tags/1.1.0 (added)
-
tags/1.1.0/alar-admin-bar-styler.php (added)
-
tags/1.1.0/index.html (added)
-
tags/1.1.0/languages (added)
-
tags/1.1.0/languages/index.html (added)
-
tags/1.1.0/readme.txt (added)
-
tags/1.1.0/scripts (added)
-
tags/1.1.0/scripts/index.html (added)
-
tags/1.1.0/scripts/scripts.js (added)
-
tags/1.1.0/styles (added)
-
tags/1.1.0/styles/index.html (added)
-
tags/1.1.0/styles/styles.css (added)
-
trunk/alar-admin-bar-styler.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/scripts/scripts.js (modified) (2 diffs)
-
trunk/styles/styles.css (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin-bar-styler/trunk/alar-admin-bar-styler.php
r1865958 r1865996 3 3 * Plugin Name: Admin Bar Styler 4 4 * Description: Colorize the admin bar to match your site style, or make a visual distinction between different environments such as DEV, QA, UAT, PROD. 5 * Version: 1. 0.05 * Version: 1.1.0 6 6 * Author: John Alarcon 7 7 * Author URI: https://johnalarcon.com … … 42 42 */ 43 43 public function init() { 44 // Add a Settings link to the core plugin admin page. 45 add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_action_link')); 46 // Register settings and admin menu. 44 47 add_action('admin_init', array($this, 'register_settings')); 45 48 add_action('admin_menu', array($this, 'register_admin_menu')); 46 add_action('admin_bar_menu', array($this, 'add_label_to_admin_bar'), 1);49 // Enqueued styles (and script for admin). 47 50 add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_and_styles')); 51 add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_and_styles')); 52 // Inlined styles. 48 53 add_action('admin_enqueue_scripts', array($this, 'inline_styles')); 49 54 add_action('wp_enqueue_scripts', array($this, 'inline_styles')); 50 add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_action_link')); 55 // Settings link in core plugin view. 56 add_action('admin_bar_menu', array($this, 'add_label_to_admin_bar'), 1); 51 57 } 52 58 … … 92 98 93 99 $options = get_option('admin_bar_styler', array()); 94 // Open content wrapper and print title.95 100 echo '<div class="wrap">'; 96 101 echo '<h1>'.__('Admin Bar Styler', 'alar-admin-bar-styler').'</h1>'; … … 100 105 wp_nonce_field('admin_bar_styler_nonce'); 101 106 echo '<table class="form-table">'."\n"; 102 103 echo '<tr valign="top">'."\n"; 104 echo '<th scope="row"><label for="enviro_label">'.__('Text Label', 'alar-environment-indicator').'</label></th>'."\n"; 105 echo '<td>'; 106 echo '<input type="text" name="admin_bar_styler[label]" id="enviro_label" value="'.esc_attr($options['label']).'" /><br />'; 107 echo '<span class="description"><label for="enviro_label">'.__('Optional label shown at upper left', 'alar-environment-indicator').'</label></span>'; 108 echo '</td>'."\n"; 109 echo '</tr>'."\n"; 110 111 echo '<tr valign="top">'."\n"; 112 echo '<th scope="row"><label for="enviro_bg_color">'.__('Admin Bar Color', 'alar-environment-indicator').'</label></th>'."\n"; 113 echo '<td>'; 114 echo '<input type="color" name="admin_bar_styler[bg_color]" id="enviro_bg_color" value="'.esc_attr($options['bg_color']).'" /><br />'; 115 echo '<span class="description"><label for="enviro_bg_color">'.__('Primay color for admin bar', 'alar-environment-indicator').'</label></span>'; 116 echo '</td>'."\n"; 117 echo '</tr>'."\n"; 118 119 echo '<tr valign="top">'."\n"; 120 echo '<th scope="row"><label for="enviro_hover_color">'.__('Admin Bar Hover', 'alar-environment-indicator').'</label></th>'."\n"; 121 echo '<td>'; 122 echo '<input type="color" name="admin_bar_styler[hover_color]" id="enviro_hover_color" value="'.esc_attr($options['hover_color']).'" /><br />'; 123 echo '<span class="description"><label for="enviro_hover_color">'.__('Hover color for admin bar', 'alar-environment-indicator').'</label></span>'; 124 echo '</td>'."\n"; 125 echo '</tr>'."\n"; 126 127 echo '<tr valign="top">'."\n"; 128 echo '<th scope="row"><label for="enviro_font_color">'.__('Font Color', 'alar-environment-indicator').'</label></th>'."\n"; 129 echo '<td>'; 130 echo '<input type="color" name="admin_bar_styler[font_color]" id="enviro_font_color" value="'.esc_attr($options['font_color']).'" /><br />'; 131 echo '<span class="description"><label for="enviro_font_color">'.__('Color for menu items', 'alar-environment-indicator').'</label></span>'; 132 echo '</td>'."\n"; 133 echo '</tr>'."\n"; 134 135 echo '<tr valign="top">'."\n"; 136 echo '<th scope="row"><label for="enviro_presets">'.__('Preset Schemes', 'alar-environment-indicator').'</label></th>'."\n"; 137 echo '<td>'; 138 echo '<style> 139 140 </style>'; 107 echo '<tr valign="top">'."\n"; 108 echo '<th scope="row"><label for="admin-bar-styler-label">'.__('Text Label', 'alar-admin-bar-styler').'</label></th>'."\n"; 109 echo '<td>'; 110 echo '<input type="text" name="admin_bar_styler[label]" id="admin-bar-styler-label" value="'.esc_attr($options['label']).'" /><br />'; 111 echo '<span class="description"><label for="admin-bar-styler-label">'.__('Optional label shown at upper left', 'alar-admin-bar-styler').'</label></span>'; 112 echo '</td>'."\n"; 113 echo '</tr>'."\n"; 114 echo '<tr valign="top">'."\n"; 115 echo '<th scope="row"><label for="admin-bar-styler-bg-color">'.__('Admin Bar Color', 'alar-admin-bar-styler').'</label></th>'."\n"; 116 echo '<td>'; 117 echo '<input type="color" name="admin_bar_styler[bg_color]" id="admin-bar-styler-bg-color" value="'.esc_attr($options['bg_color']).'" /><br />'; 118 echo '<span class="description"><label for="admin-bar-styler-bg-color">'.__('Primay color for admin bar', 'alar-admin-bar-styler').'</label></span>'; 119 echo '</td>'."\n"; 120 echo '</tr>'."\n"; 121 echo '<tr valign="top">'."\n"; 122 echo '<th scope="row"><label for="admin-bar-styler-hover-color">'.__('Admin Bar Hover', 'alar-admin-bar-styler').'</label></th>'."\n"; 123 echo '<td>'; 124 echo '<input type="color" name="admin_bar_styler[hover_color]" id="admin-bar-styler-hover-color" value="'.esc_attr($options['hover_color']).'" /><br />'; 125 echo '<span class="description"><label for="admin-bar-styler-hover-color">'.__('Hover color for admin bar', 'alar-admin-bar-styler').'</label></span>'; 126 echo '</td>'."\n"; 127 echo '</tr>'."\n"; 128 echo '<tr valign="top">'."\n"; 129 echo '<th scope="row"><label for="admin-bar-styler-font-color">'.__('Font Color', 'alar-admin-bar-styler').'</label></th>'."\n"; 130 echo '<td>'; 131 echo '<input type="color" name="admin_bar_styler[font_color]" id="admin-bar-styler-font-color" value="'.esc_attr($options['font_color']).'" /><br />'; 132 echo '<span class="description"><label for="admin-bar-styler-font-color">'.__('Color for menu items', 'alar-admin-bar-styler').'</label></span>'; 133 echo '</td>'."\n"; 134 echo '</tr>'."\n"; 135 echo '<tr valign="top">'."\n"; 136 echo '<th scope="row"><label for="admin-bar-styler-presets">'.__('Preset Schemes', 'alar-admin-bar-styler').'</label></th>'."\n"; 137 echo '<td>'; 141 138 echo '<div style="margin:20px 0;">'; 142 echo '<span class="admin _bar_styler_preset red">'.__('Text', 'alar-admin-bar-styler').'</span>';143 echo '<span class="admin _bar_styler_preset yellow">'.__('Text', 'alar-admin-bar-styler').'</span>';144 echo '<span class="admin _bar_styler_preset green">'.__('Text', 'alar-admin-bar-styler').'</span>';145 echo '<span class="admin _bar_styler_preset blue">'.__('Text', 'alar-admin-bar-styler').'</span>';139 echo '<span class="admin-bar-styler-preset red">'.__('Text', 'alar-admin-bar-styler').'</span>'; 140 echo '<span class="admin-bar-styler-preset yellow">'.__('Text', 'alar-admin-bar-styler').'</span>'; 141 echo '<span class="admin-bar-styler-preset blue">'.__('Text', 'alar-admin-bar-styler').'</span>'; 142 echo '<span class="admin-bar-styler-preset green">'.__('Text', 'alar-admin-bar-styler').'</span>'; 146 143 echo '</div>'; 147 144 echo '<span class="description">'.__('Click to load a preset', 'alar-admin-bar-styler').'</span></td>'."\n"; 148 145 echo '</tr>'."\n"; 149 // Wrap up the table.150 146 echo '</table>'."\n"; 151 152 // Serve up the submit button.153 147 submit_button(); 154 148 echo '</form>'."\n"; 155 149 echo '</div>'."\n"; 156 157 150 } 158 151 … … 162 155 public function enqueue_scripts_and_styles() { 163 156 GLOBAL $plugin_page; 157 wp_enqueue_style('admin-bar-styler', plugins_url('/styles/styles.css', __FILE__)); 164 158 if (strstr($plugin_page, 'admin-bar-styler')) { 165 wp_enqueue_style('admin-bar-styler', plugins_url('/styles/styles.css', __FILE__));166 159 wp_enqueue_script('admin-bar-styler', plugins_url('/scripts/scripts.js', __FILE__), array('jquery')); 167 160 } … … 191 184 * Inline styles. 192 185 * 193 * Inlining CSS only works if the style sheet is already enqueued. Even194 * though this plugin doesn't use a stylesheet, the handle must still be195 * registered and enqueued ahead of the inline styles being added.196 *197 186 */ 198 187 public function inline_styles() { … … 201 190 $this->update_settings(); 202 191 } 203 // Aforementioned requirements.204 wp_register_style('enviro-css', false);205 wp_enqueue_style('enviro-css');206 192 // Inline the CSS. 207 193 $options = get_option('admin_bar_styler', array()); … … 217 203 $css .= '#wpadminbar #adminbarsearch::before {color: '.$options['font_color'].' !important;}'; 218 204 $css .= '#wpadminbar .ab-top-menu > li.admin-bar-styler-label > div.ab-empty-item {color: '.$options['font_color'].' !important;font-size:18pt;font-weight:bold;}'; 219 wp_add_inline_style(' enviro-css', $css);205 wp_add_inline_style('admin-bar-styler', $css); 220 206 } 221 207 -
admin-bar-styler/trunk/readme.txt
r1865958 r1865996 1 1 === Admin Bar Style === 2 2 Contributors: johnalarcon 3 Tags: admin bar, admin bar color, colorizer, admin style, environment indicator3 Tags: admin bar, admin bar color, admin bar style, colorizer, environment indicator 4 4 Donate link: https://johnalarcon.com 5 5 Requires at least: 4.9 6 6 Tested up to: 4.9.5 7 7 Requires PHP: 7.2 8 Stable tag: 1. 0.08 Stable tag: 1.1.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 22 22 * Search for "admin bar styler" and download the plugin. 23 23 * Install using the plugin admin interface. 24 25 == Changelog == 26 ## 1.1.0 27 - Enhance: rework script/style enqueuing. 28 - Enhance: added comments for clarity. 29 - Remove: enqueue pre inline styles; no longer necessary. 30 - Fix: Reorder preset scheme colors from RYGB to RYBG. 31 - Fix: Update label/ID prefixes since plugin was renamed for public use. 32 - Fix: Update text domain to reflect new plugin name. 33 34 ## 1.0.0 35 - Initial creation. -
admin-bar-styler/trunk/scripts/scripts.js
r1865958 r1865996 2 2 * Plugin Name: Admin Bar Styler 3 3 * Description: Colorize the admin bar to match your site style, or make a visual distinction between different environments such as DEV, QA, UAT, PROD. 4 * Version: 1. 0.04 * Version: 1.1.0 5 5 * Author: John Alarcon 6 6 * Author URI: https://johnalarcon.com … … 25 25 jQuery(document).ready(function($) { 26 26 27 $(".admin _bar_styler_preset.red").click(function(){28 $("# enviro_bg_color").val("#d32f2f");29 $("# enviro_font_color").val("#dddddd");30 $("# enviro_hover_color").val("#b71c1c");27 $(".admin-bar-styler-preset.red").click(function(){ 28 $("#admin-bar-styler-bg-color").val("#d32f2f"); 29 $("#admin-bar-styler-font-color").val("#dddddd"); 30 $("#admin-bar-styler-hover-color").val("#b71c1c"); 31 31 }); 32 $(".admin _bar_styler_preset.yellow").click(function(){33 $("# enviro_bg_color").val("#fdd835");34 $("# enviro_font_color").val("#555555");35 $("# enviro_hover_color").val("#ffeb3b");32 $(".admin-bar-styler-preset.yellow").click(function(){ 33 $("#admin-bar-styler-bg-color").val("#fdd835"); 34 $("#admin-bar-styler-font-color").val("#555555"); 35 $("#admin-bar-styler-hover-color").val("#ffeb3b"); 36 36 }); 37 $(".admin _bar_styler_preset.green").click(function(){38 $("# enviro_bg_color").val("#1b5e20");39 $("# enviro_font_color").val("#dddddd");40 $("# enviro_hover_color").val("#558b2f");37 $(".admin-bar-styler-preset.green").click(function(){ 38 $("#admin-bar-styler-bg-color").val("#1b5e20"); 39 $("#admin-bar-styler-font-color").val("#dddddd"); 40 $("#admin-bar-styler-hover-color").val("#558b2f"); 41 41 }); 42 $(".admin _bar_styler_preset.blue").click(function(){43 $("# enviro_bg_color").val("#1565c0");44 $("# enviro_font_color").val("#dddddd");45 $("# enviro_hover_color").val("#0d47a1");42 $(".admin-bar-styler-preset.blue").click(function(){ 43 $("#admin-bar-styler-bg-color").val("#1565c0"); 44 $("#admin-bar-styler-font-color").val("#dddddd"); 45 $("#admin-bar-styler-hover-color").val("#0d47a1"); 46 46 }); 47 47 -
admin-bar-styler/trunk/styles/styles.css
r1865958 r1865996 2 2 * Plugin Name: Admin Bar Styler 3 3 * Description: Colorize the admin bar to match your site style, or make a visual distinction between different environments such as DEV, QA, UAT, PROD. 4 * Version: 1. 0.04 * Version: 1.1.0 5 5 * Author: John Alarcon 6 6 * Author URI: https://johnalarcon.com … … 23 23 * 24 24 */ 25 .admin _bar_styler_preset {25 .admin-bar-styler-preset { 26 26 margin-right:5px; 27 27 padding:15px; … … 29 29 color: #ddd; 30 30 } 31 .admin _bar_styler_preset.red {31 .admin-bar-styler-preset.red { 32 32 background: #d32f2f; 33 33 } 34 .admin _bar_styler_preset.yellow {34 .admin-bar-styler-preset.yellow { 35 35 background: #fdd835; 36 36 color: #555; 37 37 } 38 .admin _bar_styler_preset.green {38 .admin-bar-styler-preset.green { 39 39 background: #1b5e20; 40 40 } 41 .admin _bar_styler_preset.blue {41 .admin-bar-styler-preset.blue { 42 42 background: #1565c0; 43 43 }
Note: See TracChangeset
for help on using the changeset viewer.