Plugin Directory

Changeset 2546916


Ignore:
Timestamp:
06/12/2021 09:42:59 PM (5 years ago)
Author:
trepmal
Message:

Update to version 1.6 from GitHub

Location:
metabox-header-color
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • metabox-header-color/assets/banner-772x250.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • metabox-header-color/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • metabox-header-color/tags/1.6/js/init.js

    r694255 r2546916  
    1 jQuery(document).ready(function($){
     1jQuery(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  });
    28
    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  });
    1814
    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  });
    2120});
  • metabox-header-color/tags/1.6/kl-metabox-header-color.php

    r694255 r2546916  
    11<?php
    22/*
    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  */
     3Plugin Name: Metabox Header Color
     4Plugin URI: http://trepmal.com/plugins/metabox-header-color/
     5Description: Change the color for metabox headers
     6Author: Kailey Lampert
     7Version: 1.6
     8Author URI: http://kaileylampert.com/
     9*/
     10/*
     11    Copyright (C) 2011  Kailey Lampert
    1412
    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.
    1617
    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.
    1822
    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
     29class 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' ) );
    2335    }
    24 
    2536    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' );
    2742    }
    2843
    2944    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 );
    3657            }
    3758        }
    3859
    39         extract( get_option( 'kl-metabox-header-color' ) );
    4060        ?><style type="text/css">
    4161        .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'] ); ?>;
    5166        }
    5267        </style><?php
     
    5469
    5570    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' ) );
    6772    }
    6873
    6974    function page() {
    7075
    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', [] );
    7279        ?>
    7380        <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>
    7582            <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
    7886                    <div class="inside">
    7987                        <form method="post" style="padding:10px;">
     88                            <input type="hidden" name="submitted" />
    8089                            <?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' );
    8392                            ?>
    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' ); ?>
    96100                        </form>
    97101                    </div>
    98102                </div>
    99103            </div>
     104            <p>Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.</p>
    100105        </div>
    101106        <?php
     
    103108    } // end function page
    104109
    105 } // end class KL_metaboxheadercolor
    106 //eof
     110} // end class
  • metabox-header-color/tags/1.6/readme.txt

    r694255 r2546916  
    44Tags: metabox, style, mu-compatible
    55Requires at least: 2.8
    6 Tested up to: 3.5
    7 Stable tag: 1.5
     6Tested up to: 5.7
     7Stable tag: trunk
    88
    99Change the color for the metabox headers
     
    1111== Description ==
    1212
    13 Change the color for the metabox headers.
     13This plugin isn't very useful today.
    1414
    15 * [I'm on twitter](http://twitter.com/trepmal)
     15Change the color for the metabox headers for easy visibility.
    1616
    1717== Installation ==
     
    2727
    2828== Changelog ==
    29 
    30 = 1.6 =
    31 * use core color picker
    32 * translatable
    3329
    3430= 1.5 =
  • metabox-header-color/trunk/js/init.js

    r694255 r2546916  
    1 jQuery(document).ready(function($){
     1jQuery(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  });
    28
    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  });
    1814
    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  });
    2120});
  • metabox-header-color/trunk/kl-metabox-header-color.php

    r694255 r2546916  
    11<?php
    22/*
    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  */
     3Plugin Name: Metabox Header Color
     4Plugin URI: http://trepmal.com/plugins/metabox-header-color/
     5Description: Change the color for metabox headers
     6Author: Kailey Lampert
     7Version: 1.6
     8Author URI: http://kaileylampert.com/
     9*/
     10/*
     11    Copyright (C) 2011  Kailey Lampert
    1412
    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.
    1617
    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.
    1822
    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
     29class 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' ) );
    2335    }
    24 
    2536    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' );
    2742    }
    2843
    2944    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 );
    3657            }
    3758        }
    3859
    39         extract( get_option( 'kl-metabox-header-color' ) );
    4060        ?><style type="text/css">
    4161        .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'] ); ?>;
    5166        }
    5267        </style><?php
     
    5469
    5570    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' ) );
    6772    }
    6873
    6974    function page() {
    7075
    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', [] );
    7279        ?>
    7380        <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>
    7582            <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
    7886                    <div class="inside">
    7987                        <form method="post" style="padding:10px;">
     88                            <input type="hidden" name="submitted" />
    8089                            <?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' );
    8392                            ?>
    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' ); ?>
    96100                        </form>
    97101                    </div>
    98102                </div>
    99103            </div>
     104            <p>Settings will be preserved if the plugin is deactivated. Settings will be removed if plugin is deleted.</p>
    100105        </div>
    101106        <?php
     
    103108    } // end function page
    104109
    105 } // end class KL_metaboxheadercolor
    106 //eof
     110} // end class
  • metabox-header-color/trunk/readme.txt

    r694255 r2546916  
    44Tags: metabox, style, mu-compatible
    55Requires at least: 2.8
    6 Tested up to: 3.5
    7 Stable tag: 1.5
     6Tested up to: 5.7
     7Stable tag: trunk
    88
    99Change the color for the metabox headers
     
    1111== Description ==
    1212
    13 Change the color for the metabox headers.
     13This plugin isn't very useful today.
    1414
    15 * [I'm on twitter](http://twitter.com/trepmal)
     15Change the color for the metabox headers for easy visibility.
    1616
    1717== Installation ==
     
    2727
    2828== Changelog ==
    29 
    30 = 1.6 =
    31 * use core color picker
    32 * translatable
    3329
    3430= 1.5 =
Note: See TracChangeset for help on using the changeset viewer.