Changeset 2546916
- Timestamp:
- 06/12/2021 09:42:59 PM (5 years ago)
- Location:
- metabox-header-color
- Files:
-
- 8 edited
- 1 copied
-
assets/banner-772x250.png (modified) (1 prop) (previous)
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
tags/1.6 (copied) (copied from metabox-header-color/trunk)
-
tags/1.6/js/init.js (modified) (1 diff)
-
tags/1.6/kl-metabox-header-color.php (modified) (3 diffs)
-
tags/1.6/readme.txt (modified) (3 diffs)
-
trunk/js/init.js (modified) (1 diff)
-
trunk/kl-metabox-header-color.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
metabox-header-color/assets/banner-772x250.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
metabox-header-color/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
metabox-header-color/tags/1.6/js/init.js
r694255 r2546916 1 jQuery(document).ready(function($){ 1 jQuery(document).ready(function ($) { 2 $("#hex_code_bg").wpColorPicker({ 3 change: function (event, ui) { 4 // console.log(ui.color.toString()); 5 $("h2.hndle").css({ backgroundColor: ui.color.toString() }); 6 }, 7 }); 2 8 3 cpargs = { 4 change: function( event, ui ) { 5 jQuery(this).val( ui.color.toString() ); 6 id = $(this).attr('id'); 7 if ( id == 'hex_code_bg' ) { 8 $('h3.hndle').css({ backgroundColor: $(this).val() }); 9 } 10 if ( id == 'hex_code_tx' ) { 11 $('h3.hndle').css({ color: $(this).val() }); 12 } 13 if ( id == 'hex_code_sh' ) { 14 $('h3.hndle').css({ textShadow: '0 1px 0 ' + $(this).val() }); 15 } 16 } 17 }; 9 $("#hex_code_tx").wpColorPicker({ 10 change: function (event, ui) { 11 $("h2.hndle").css({ color: ui.color.toString() }); 12 }, 13 }); 18 14 19 jQuery('.colorpick').wpColorPicker( cpargs ); 20 15 $("#hex_code_sh").wpColorPicker({ 16 change: function (event, ui) { 17 $("h2.hndle").css({ textShadow: "0 1px 0 " + ui.color.toString() }); 18 }, 19 }); 21 20 }); -
metabox-header-color/tags/1.6/kl-metabox-header-color.php
r694255 r2546916 1 1 <?php 2 2 /* 3 * Plugin Name: Metabox Header Color 4 * Plugin URI: http://trepmal.com/plugins/metabox-header-color/ 5 * Description: Change the color for metabox headers 6 * Version: 1.6 7 * Author: Kailey Lampert 8 * Author URI: kaileylampert.com 9 * License: GPLv2 or later 10 * TextDomain: metabox-header-color 11 * DomainPath: 12 * Network: 13 */ 3 Plugin Name: Metabox Header Color 4 Plugin URI: http://trepmal.com/plugins/metabox-header-color/ 5 Description: Change the color for metabox headers 6 Author: Kailey Lampert 7 Version: 1.6 8 Author URI: http://kaileylampert.com/ 9 */ 10 /* 11 Copyright (C) 2011 Kailey Lampert 14 12 15 $kl_metaboxheadercolor = new KL_metaboxheadercolor(); 13 This program is free software: you can redistribute it and/or modify 14 it under the terms of the GNU General Public License as published by 15 the Free Software Foundation, either version 3 of the License, or 16 (at your option) any later version. 16 17 17 class KL_metaboxheadercolor { 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 18 22 19 function KL_metaboxheadercolor() { 20 register_activation_hook( __FILE__, array( &$this, 'activate' ) ); 21 add_action( 'admin_head', array( &$this, 'metaboxheadercolor' ) ); 22 add_action( 'admin_menu', array( &$this, 'menu' ) ); 23 You should have received a copy of the GNU General Public License 24 along with this program. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 $metabox_header_color = new Metabox_Header_Color(); 28 29 class Metabox_Header_Color { 30 31 function __construct() { 32 register_activation_hook( __FILE__, array( $this, 'activate' ) ); 33 add_action( 'admin_head', array( $this, 'metaboxheadercolor' ) ); 34 add_action( 'admin_menu', array( $this, 'menu' ) ); 23 35 } 24 25 36 function activate() { 26 add_option( 'kl-metabox-header-color', array( 'bg' => '#9df', 'tx' => '#666', 'sh' => '#fff' ) ); 37 add_option( 'kl-metabox-header-color', [ 38 'bg' => '#9df', 39 'tx' => '#666', 40 'sh' => '#fff' 41 ], 'no' ); 27 42 } 28 43 29 44 function metaboxheadercolor() { 30 if ( isset( $_POST[ 'hex_code' ] ) && is_array( $_POST[ 'hex_code' ] ) ) { 31 // check_admin_referer( 'kl-metabox-header-color_save' ); 32 if ( ! wp_verify_nonce( $_POST['na_klmhc-save'], 'nn_klmhc-save' ) ) { 33 echo '<div class="error"><p>'. __('Nonce verification failed.', 'metabox-header-color' ) .'</p></div>'; 34 } else { 35 update_option( 'kl-metabox-header-color', $_POST[ 'hex_code' ] ); 45 46 $hex_codes = get_option( 'kl-metabox-header-color', [] ); 47 48 if ( isset( $_POST[ 'submitted' ] ) ) { 49 if ( is_array( $_POST[ 'hex_code' ] ) ) { 50 check_admin_referer( 'kl-metabox-header-color_save' ); 51 52 $hex_codes = $_POST['hex_code']; 53 $hex_codes = array_intersect_key( $hex_codes, [ 'bg' => true, 'tx' => true, 'sh' => true ] ); 54 $hex_codes = array_map( 'sanitize_hex_color', $hex_codes ); 55 56 update_option( 'kl-metabox-header-color', $hex_codes ); 36 57 } 37 58 } 38 59 39 extract( get_option( 'kl-metabox-header-color' ) );40 60 ?><style type="text/css"> 41 61 .widgets-sortables .widget-top, 42 .postbox h3, 43 .stuffbox h3, 44 .ui-sortable .postbox h3 { 45 background: <?php echo $bg; ?>; 46 color: <?php echo $tx; ?>; 47 text-shadow: 0 1px 0 <?php echo $sh; ?>; 48 } 49 #widget-list .widget-top { 50 color: auto; 62 .postbox-header { 63 background: <?php echo esc_html( $hex_codes['bg'] ); ?>; 64 color: <?php echo esc_html( $hex_codes['tx'] ); ?>; 65 text-shadow: 0 1px 0 <?php echo esc_html( $hex_codes['sh'] ); ?>; 51 66 } 52 67 </style><?php … … 54 69 55 70 function menu() { 56 add_options_page( __( 'Metabox Header Color', 'metabox-header-color' ), __( 'Metabox Header Color', 'metabox-header-color' ), 'administrator', __FILE__, array( &$this, 'page' ) ); 57 add_action( 'admin_enqueue_scripts', array( &$this, 'scripts' ) ); 58 } 59 60 function scripts( $hook ) { 61 if ( $hook != 'settings_page_metabox-header-color/kl-metabox-header-color' ) return; 62 wp_enqueue_script('wp-color-picker'); 63 wp_enqueue_style('wp-color-picker'); 64 65 wp_enqueue_script( 'klmetaboxheadercolorinit', plugins_url( 'js/init.js', __FILE__ ), array('wp-color-picker') ); 66 71 add_options_page( 'Metabox Header Color', 'Metabox Header Color', 'administrator', __FILE__, array( $this, 'page' ) ); 67 72 } 68 73 69 74 function page() { 70 75 71 $color = get_option( 'kl-metabox-header-color' ); 76 wp_enqueue_script( 'metabox_header_color', plugins_url( 'js/init.js', __FILE__ ), [ 'wp-color-picker' ] ); 77 78 $color = get_option( 'kl-metabox-header-color', [] ); 72 79 ?> 73 80 <div class="wrap"> 74 <h2><?php _e( 'Choose Metabox Header Color', 'metabox-header-color' ); ?></h2>81 <h2><?php esc_html_e( 'Choose Metabox Header Color' ); ?></h2> 75 82 <div class="metabox-holder"> 76 <div class="postbox "> 77 <h3 class="hndle"><span><?php _e( 'Preview changes here', 'metabox-header-color' ); ?></span></h3> 83 <div class="postbox"> 84 <div class="postbox-header"><h2 class="hndle ui-sortable-handle"><?php esc_html_e( 'Preview changes here'); ?></h2></div> 85 78 86 <div class="inside"> 79 87 <form method="post" style="padding:10px;"> 88 <input type="hidden" name="submitted" /> 80 89 <?php 81 extract( get_option( 'kl-metabox-header-color' ) );82 wp_nonce_field( ' nn_klmhc-save', 'na_klmhc-save' );90 extract(get_option( 'kl-metabox-header-color' ) ); 91 wp_nonce_field( 'kl-metabox-header-color_save' ); 83 92 ?> 84 <p style="width: 30%; float: left; margin: 0;"><label for="hex_code_bg"><?php _e( 'Background Color:', 'metabox-header-color' ); ?> </label><br /> 85 <input type="text" name="hex_code[bg]" id="hex_code_bg" value="<?php echo $bg; ?>" class="colorpick" /></p> 86 87 <p style="width: 30%; float: left; margin: 0 2%;"><label for="hex_code_tx"><?php _e( 'Text Color:', 'metabox-header-color' ); ?> </label><br /> 88 <input type="text" name="hex_code[tx]" id="hex_code_tx" value="<?php echo $tx; ?>" class="colorpick" /></p> 89 90 <p style="width: 30%; float: left; margin: 0;"><label for="hex_code_sh"><?php _e( 'Shadow Color:', 'metabox-header-color' ); ?> </label><br /> 91 <input type="text" name="hex_code[sh]" id="hex_code_sh" value="<?php echo $sh; ?>" class="colorpick" /></p> 92 93 <p style="width: 6%; float: left; margin: 2% 0;"><?php submit_button( __( 'Save', 'metabox-header-color' ), 'primary', 'submit', false ); ?></p> 94 95 <p class="clear"><?php _e( 'Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.', 'metabox-header-color' ); ?></p> 93 <p><label for="hex_code_bg">Background Color: </label> 94 <input type="text" name="hex_code[bg]" id="hex_code_bg" value="<?php echo esc_attr( $color['bg'] ); ?>" /></p> 95 <p><label for="hex_code_tx">Text Color: </label> 96 <input type="text" name="hex_code[tx]" id="hex_code_tx" value="<?php echo esc_attr( $color['tx'] ); ?>" /></p> 97 <p><label for="hex_code_sh">Shadow Color: </label> 98 <input type="text" name="hex_code[sh]" id="hex_code_sh" value="<?php echo esc_attr( $color['sh'] ); ?>" /></p> 99 <?php submit_button( __('Save'), 'primary' ); ?> 96 100 </form> 97 101 </div> 98 102 </div> 99 103 </div> 104 <p>Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.</p> 100 105 </div> 101 106 <?php … … 103 108 } // end function page 104 109 105 } // end class KL_metaboxheadercolor 106 //eof 110 } // end class -
metabox-header-color/tags/1.6/readme.txt
r694255 r2546916 4 4 Tags: metabox, style, mu-compatible 5 5 Requires at least: 2.8 6 Tested up to: 3.57 Stable tag: 1.56 Tested up to: 5.7 7 Stable tag: trunk 8 8 9 9 Change the color for the metabox headers … … 11 11 == Description == 12 12 13 Change the color for the metabox headers.13 This plugin isn't very useful today. 14 14 15 * [I'm on twitter](http://twitter.com/trepmal) 15 Change the color for the metabox headers for easy visibility. 16 16 17 17 == Installation == … … 27 27 28 28 == Changelog == 29 30 = 1.6 =31 * use core color picker32 * translatable33 29 34 30 = 1.5 = -
metabox-header-color/trunk/js/init.js
r694255 r2546916 1 jQuery(document).ready(function($){ 1 jQuery(document).ready(function ($) { 2 $("#hex_code_bg").wpColorPicker({ 3 change: function (event, ui) { 4 // console.log(ui.color.toString()); 5 $("h2.hndle").css({ backgroundColor: ui.color.toString() }); 6 }, 7 }); 2 8 3 cpargs = { 4 change: function( event, ui ) { 5 jQuery(this).val( ui.color.toString() ); 6 id = $(this).attr('id'); 7 if ( id == 'hex_code_bg' ) { 8 $('h3.hndle').css({ backgroundColor: $(this).val() }); 9 } 10 if ( id == 'hex_code_tx' ) { 11 $('h3.hndle').css({ color: $(this).val() }); 12 } 13 if ( id == 'hex_code_sh' ) { 14 $('h3.hndle').css({ textShadow: '0 1px 0 ' + $(this).val() }); 15 } 16 } 17 }; 9 $("#hex_code_tx").wpColorPicker({ 10 change: function (event, ui) { 11 $("h2.hndle").css({ color: ui.color.toString() }); 12 }, 13 }); 18 14 19 jQuery('.colorpick').wpColorPicker( cpargs ); 20 15 $("#hex_code_sh").wpColorPicker({ 16 change: function (event, ui) { 17 $("h2.hndle").css({ textShadow: "0 1px 0 " + ui.color.toString() }); 18 }, 19 }); 21 20 }); -
metabox-header-color/trunk/kl-metabox-header-color.php
r694255 r2546916 1 1 <?php 2 2 /* 3 * Plugin Name: Metabox Header Color 4 * Plugin URI: http://trepmal.com/plugins/metabox-header-color/ 5 * Description: Change the color for metabox headers 6 * Version: 1.6 7 * Author: Kailey Lampert 8 * Author URI: kaileylampert.com 9 * License: GPLv2 or later 10 * TextDomain: metabox-header-color 11 * DomainPath: 12 * Network: 13 */ 3 Plugin Name: Metabox Header Color 4 Plugin URI: http://trepmal.com/plugins/metabox-header-color/ 5 Description: Change the color for metabox headers 6 Author: Kailey Lampert 7 Version: 1.6 8 Author URI: http://kaileylampert.com/ 9 */ 10 /* 11 Copyright (C) 2011 Kailey Lampert 14 12 15 $kl_metaboxheadercolor = new KL_metaboxheadercolor(); 13 This program is free software: you can redistribute it and/or modify 14 it under the terms of the GNU General Public License as published by 15 the Free Software Foundation, either version 3 of the License, or 16 (at your option) any later version. 16 17 17 class KL_metaboxheadercolor { 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 18 22 19 function KL_metaboxheadercolor() { 20 register_activation_hook( __FILE__, array( &$this, 'activate' ) ); 21 add_action( 'admin_head', array( &$this, 'metaboxheadercolor' ) ); 22 add_action( 'admin_menu', array( &$this, 'menu' ) ); 23 You should have received a copy of the GNU General Public License 24 along with this program. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 $metabox_header_color = new Metabox_Header_Color(); 28 29 class Metabox_Header_Color { 30 31 function __construct() { 32 register_activation_hook( __FILE__, array( $this, 'activate' ) ); 33 add_action( 'admin_head', array( $this, 'metaboxheadercolor' ) ); 34 add_action( 'admin_menu', array( $this, 'menu' ) ); 23 35 } 24 25 36 function activate() { 26 add_option( 'kl-metabox-header-color', array( 'bg' => '#9df', 'tx' => '#666', 'sh' => '#fff' ) ); 37 add_option( 'kl-metabox-header-color', [ 38 'bg' => '#9df', 39 'tx' => '#666', 40 'sh' => '#fff' 41 ], 'no' ); 27 42 } 28 43 29 44 function metaboxheadercolor() { 30 if ( isset( $_POST[ 'hex_code' ] ) && is_array( $_POST[ 'hex_code' ] ) ) { 31 // check_admin_referer( 'kl-metabox-header-color_save' ); 32 if ( ! wp_verify_nonce( $_POST['na_klmhc-save'], 'nn_klmhc-save' ) ) { 33 echo '<div class="error"><p>'. __('Nonce verification failed.', 'metabox-header-color' ) .'</p></div>'; 34 } else { 35 update_option( 'kl-metabox-header-color', $_POST[ 'hex_code' ] ); 45 46 $hex_codes = get_option( 'kl-metabox-header-color', [] ); 47 48 if ( isset( $_POST[ 'submitted' ] ) ) { 49 if ( is_array( $_POST[ 'hex_code' ] ) ) { 50 check_admin_referer( 'kl-metabox-header-color_save' ); 51 52 $hex_codes = $_POST['hex_code']; 53 $hex_codes = array_intersect_key( $hex_codes, [ 'bg' => true, 'tx' => true, 'sh' => true ] ); 54 $hex_codes = array_map( 'sanitize_hex_color', $hex_codes ); 55 56 update_option( 'kl-metabox-header-color', $hex_codes ); 36 57 } 37 58 } 38 59 39 extract( get_option( 'kl-metabox-header-color' ) );40 60 ?><style type="text/css"> 41 61 .widgets-sortables .widget-top, 42 .postbox h3, 43 .stuffbox h3, 44 .ui-sortable .postbox h3 { 45 background: <?php echo $bg; ?>; 46 color: <?php echo $tx; ?>; 47 text-shadow: 0 1px 0 <?php echo $sh; ?>; 48 } 49 #widget-list .widget-top { 50 color: auto; 62 .postbox-header { 63 background: <?php echo esc_html( $hex_codes['bg'] ); ?>; 64 color: <?php echo esc_html( $hex_codes['tx'] ); ?>; 65 text-shadow: 0 1px 0 <?php echo esc_html( $hex_codes['sh'] ); ?>; 51 66 } 52 67 </style><?php … … 54 69 55 70 function menu() { 56 add_options_page( __( 'Metabox Header Color', 'metabox-header-color' ), __( 'Metabox Header Color', 'metabox-header-color' ), 'administrator', __FILE__, array( &$this, 'page' ) ); 57 add_action( 'admin_enqueue_scripts', array( &$this, 'scripts' ) ); 58 } 59 60 function scripts( $hook ) { 61 if ( $hook != 'settings_page_metabox-header-color/kl-metabox-header-color' ) return; 62 wp_enqueue_script('wp-color-picker'); 63 wp_enqueue_style('wp-color-picker'); 64 65 wp_enqueue_script( 'klmetaboxheadercolorinit', plugins_url( 'js/init.js', __FILE__ ), array('wp-color-picker') ); 66 71 add_options_page( 'Metabox Header Color', 'Metabox Header Color', 'administrator', __FILE__, array( $this, 'page' ) ); 67 72 } 68 73 69 74 function page() { 70 75 71 $color = get_option( 'kl-metabox-header-color' ); 76 wp_enqueue_script( 'metabox_header_color', plugins_url( 'js/init.js', __FILE__ ), [ 'wp-color-picker' ] ); 77 78 $color = get_option( 'kl-metabox-header-color', [] ); 72 79 ?> 73 80 <div class="wrap"> 74 <h2><?php _e( 'Choose Metabox Header Color', 'metabox-header-color' ); ?></h2>81 <h2><?php esc_html_e( 'Choose Metabox Header Color' ); ?></h2> 75 82 <div class="metabox-holder"> 76 <div class="postbox "> 77 <h3 class="hndle"><span><?php _e( 'Preview changes here', 'metabox-header-color' ); ?></span></h3> 83 <div class="postbox"> 84 <div class="postbox-header"><h2 class="hndle ui-sortable-handle"><?php esc_html_e( 'Preview changes here'); ?></h2></div> 85 78 86 <div class="inside"> 79 87 <form method="post" style="padding:10px;"> 88 <input type="hidden" name="submitted" /> 80 89 <?php 81 extract( get_option( 'kl-metabox-header-color' ) );82 wp_nonce_field( ' nn_klmhc-save', 'na_klmhc-save' );90 extract(get_option( 'kl-metabox-header-color' ) ); 91 wp_nonce_field( 'kl-metabox-header-color_save' ); 83 92 ?> 84 <p style="width: 30%; float: left; margin: 0;"><label for="hex_code_bg"><?php _e( 'Background Color:', 'metabox-header-color' ); ?> </label><br /> 85 <input type="text" name="hex_code[bg]" id="hex_code_bg" value="<?php echo $bg; ?>" class="colorpick" /></p> 86 87 <p style="width: 30%; float: left; margin: 0 2%;"><label for="hex_code_tx"><?php _e( 'Text Color:', 'metabox-header-color' ); ?> </label><br /> 88 <input type="text" name="hex_code[tx]" id="hex_code_tx" value="<?php echo $tx; ?>" class="colorpick" /></p> 89 90 <p style="width: 30%; float: left; margin: 0;"><label for="hex_code_sh"><?php _e( 'Shadow Color:', 'metabox-header-color' ); ?> </label><br /> 91 <input type="text" name="hex_code[sh]" id="hex_code_sh" value="<?php echo $sh; ?>" class="colorpick" /></p> 92 93 <p style="width: 6%; float: left; margin: 2% 0;"><?php submit_button( __( 'Save', 'metabox-header-color' ), 'primary', 'submit', false ); ?></p> 94 95 <p class="clear"><?php _e( 'Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.', 'metabox-header-color' ); ?></p> 93 <p><label for="hex_code_bg">Background Color: </label> 94 <input type="text" name="hex_code[bg]" id="hex_code_bg" value="<?php echo esc_attr( $color['bg'] ); ?>" /></p> 95 <p><label for="hex_code_tx">Text Color: </label> 96 <input type="text" name="hex_code[tx]" id="hex_code_tx" value="<?php echo esc_attr( $color['tx'] ); ?>" /></p> 97 <p><label for="hex_code_sh">Shadow Color: </label> 98 <input type="text" name="hex_code[sh]" id="hex_code_sh" value="<?php echo esc_attr( $color['sh'] ); ?>" /></p> 99 <?php submit_button( __('Save'), 'primary' ); ?> 96 100 </form> 97 101 </div> 98 102 </div> 99 103 </div> 104 <p>Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.</p> 100 105 </div> 101 106 <?php … … 103 108 } // end function page 104 109 105 } // end class KL_metaboxheadercolor 106 //eof 110 } // end class -
metabox-header-color/trunk/readme.txt
r694255 r2546916 4 4 Tags: metabox, style, mu-compatible 5 5 Requires at least: 2.8 6 Tested up to: 3.57 Stable tag: 1.56 Tested up to: 5.7 7 Stable tag: trunk 8 8 9 9 Change the color for the metabox headers … … 11 11 == Description == 12 12 13 Change the color for the metabox headers.13 This plugin isn't very useful today. 14 14 15 * [I'm on twitter](http://twitter.com/trepmal) 15 Change the color for the metabox headers for easy visibility. 16 16 17 17 == Installation == … … 27 27 28 28 == Changelog == 29 30 = 1.6 =31 * use core color picker32 * translatable33 29 34 30 = 1.5 =
Note: See TracChangeset
for help on using the changeset viewer.