Plugin Directory

Changeset 2264552


Ignore:
Timestamp:
03/20/2020 02:04:03 PM (6 years ago)
Author:
zedna
Message:

v1.2 custom styles

Location:
zedna-cookies-bar/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zedna-cookies-bar/trunk/css/zedna-cookies-bar.css

    r2258840 r2264552  
    3030}
    3131
     32#zedna-cookies-bar .cross {
     33    position: absolute;
     34    top: 5px;
     35    right: 5px;
     36    color: #000;
     37    z-index: 10;
     38    font-size: 30px;
     39    font-family: helvetica, arial, sans-serif;
     40    font-weight: bold;
     41    text-decoration: none;
     42}
     43
    3244button#zednaAcceptCookies {
    3345    margin: 0 10px;
  • zedna-cookies-bar/trunk/readme.txt

    r2258840 r2264552  
    44Requires at least: 3.8
    55Tested up to: 5.4
    6 Stable tag: 1.0
     6Stable tag: 1.2
    77License: GPL3
    88License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    1212== Description ==
    1313Small cookies bar to inform visitors that your website uses cookies without beign too disturbing.
    14 User can setup colors of text, bar and button. You can also choose to show bar at the top or bottom of the page.
     14User can setup colors of text, bar and button. You can also choose to show bar at the top or bottom of the page. You can also add custom css.
    1515And frontend is independent on jQuery.
    1616
  • zedna-cookies-bar/trunk/zedna-cookies-bar.php

    r2259843 r2264552  
    77Author: Radek Mezulanik
    88Author URI: https://www.mezulanik.cz
    9 Version: 1.1
     9Version: 1.2
    1010License: GPL3
    1111*/
     
    2626    $cookie_bar_bg_color = (get_option('zedna_cookies_bar_bg_color') != '') ? get_option('zedna_cookies_bar_bg_color') : '#2e363f';
    2727    $cookie_bar_text_color = (get_option('zedna_cookies_bar_text_color') != '') ? get_option('zedna_cookies_bar_text_color') : '#ffffff';
     28    $cookie_bar_link_color = (get_option('zedna_cookies_bar_link_color') != '') ? get_option('zedna_cookies_bar_link_color') : '#ffffff';
    2829    $cookie_bar_position = (get_option('zedna_cookies_bar_position') != '') ? get_option('zedna_cookies_bar_position') : 'bottom';
     30    $cookie_bar_custom_css = (get_option('zedna_cookies_bar_custom_css') != '') ? get_option('zedna_cookies_bar_custom_css') : '';
     31    $cookies_bar_show_button = (get_option('zedna_cookies_bar_show_button') != '') ? get_option('zedna_cookies_bar_show_button') : 'yes';
    2932?>
    3033<script>
     
    5154        <th scope="row"><?php _e('Button Text', 'zedna-cookies-bar'); ?></th>
    5255        <td><input type="text" size="20" name="zedna_cookies_bar_button" value="<?php echo esc_attr( $button_text ); ?>" /> <small>(e.g. I Agree)</small></td>
    53         </tr>
     56                </tr>
     57                <tr valign="top">
     58        <th scope="row"><?php _e('Show button', 'zedna-cookies-bar'); ?></th>
     59        <td>
     60                    <select name='zedna_cookies_bar_show_button'>
     61                        <?php
     62                        if ($cookie_bar_position == "bottom"){
     63                        echo "<option value='yes'>".__('Yes','zedna-cookies-bar')."</option>
     64                        <option value='no' selected=selected>".__('No','zedna-cookies-bar')."</option>";
     65                        }else{
     66                        echo "<option value='yes' selected=selected>".__('Yes','zedna-cookies-bar')."</option>
     67                        <option value='no'>".__('No','zedna-cookies-bar')."</option>";
     68                        }
     69                        ?>
     70                    </select>   
     71                </td>
     72                </tr>
    5473        <tr valign="top">
    5574        <th scope="row"><?php _e('Button background color', 'zedna-cookies-bar'); ?></th>
     
    7089                <tr valign="top">
    7190        <th scope="row"><?php _e('Bar link color', 'zedna-cookies-bar'); ?></th>
    72         <td><input type="text" name="zedna_cookies_bar_link_color" value="<?php echo esc_attr( $cookie_bar_text_color ); ?>" class="zedna_cookies_bar_link_color" data-default-color="#ffffff" /></td>
     91        <td><input type="text" name="zedna_cookies_bar_link_color" value="<?php echo esc_attr( $cookie_bar_link_color ); ?>" class="zedna_cookies_bar_link_color" data-default-color="#ffffff" /></td>
    7392                </tr>
    7493                <tr valign="top">
     
    88107                </td>
    89108                </tr>
     109                <tr valign="top">
     110        <th scope="row"><?php _e('Custom styles', 'zedna-cookies-bar'); ?></th>
     111        <td>
     112                <textarea name="zedna_cookies_bar_custom_css" class="zedna_cookies_bar_custom_css" rows="4" cols="50"><?php echo esc_attr( $cookie_bar_custom_css ); ?></textarea>
     113                <small>Use identifier #zedna-cookies-bar</small>
     114                </td>
     115                </tr>
    90116    </table>
    91117    <?php submit_button(); ?>
     
    112138    register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_link_color' );
    113139    register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_position' );
     140    register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_custom_css' );
     141    register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_show_button' );
    114142}
    115143add_action( 'admin_init', 'zedna_cookies_bar_settings' );
     
    124152        delete_option( 'zedna_cookies_bar_link_color' );
    125153        delete_option( 'zedna_cookies_bar_position' );
     154        delete_option( 'zedna_cookies_bar_custom_css' );
     155        delete_option( 'zedna_cookies_bar_show_button' );
    126156}
    127157register_deactivation_hook( __FILE__, 'zedna_cookies_bar_deactivation' );
     
    150180
    151181function zedna_cookies_bar() {
     182$cookies_bar_show_button = get_option('zedna_cookies_bar_show_button');
    152183$zedna_cookies_bar_message_output = get_option( 'zedna_cookies_bar_message' );
    153184$zedna_cookies_bar_button_output = esc_attr( get_option('zedna_cookies_bar_button') );
     
    156187?>
    157188<!-- Cookies bar -->
    158 <div id="zedna-cookies-bar" class="<?php echo esc_attr( get_option('zedna_cookies_bar_position') ); ?>" style="background-color:<?php echo esc_attr( get_option('zedna_cookies_bar_bg_color') ); ?>;color:<?php echo esc_attr( get_option('zedna_cookies_bar_text_color') ); ?>;"><?php echo $zedna_cookies_bar_message_output; ?> <button id="zednaAcceptCookies" <?php if (get_option('zedna_cookies_bar_btn_bg_color') == true) { ?> style="background-color:<?php echo esc_attr( get_option('zedna_cookies_bar_btn_bg_color') ); ?>;color:<?php echo esc_attr( get_option('zedna_cookies_bar_btn_text_color') ); ?>;" <?php } ?> onclick="zednaAcceptCookies();"><?php echo $zedna_cookies_bar_button_output; ?></button></div>
    159 <style>#zedna-cookies-bar a{color: <?php echo esc_attr( get_option('zedna_cookies_bar_link_color') ); ?>}</style>
     189<div id="zedna-cookies-bar" class="<?php echo strlen($cookie_bar_custom_css) > 0 ? esc_attr( get_option('zedna_cookies_bar_position') ) : '';?>" style="background-color:<?php echo esc_attr( get_option('zedna_cookies_bar_bg_color') ); ?>;color:<?php echo esc_attr( get_option('zedna_cookies_bar_text_color') ); ?>;"><?php echo $zedna_cookies_bar_message_output; ?> <?php if($cookies_bar_show_button == 'yes'){?><button id="zednaAcceptCookies" <?php if (get_option('zedna_cookies_bar_btn_bg_color') == true) { ?> style="background-color:<?php echo esc_attr( get_option('zedna_cookies_bar_btn_bg_color') ); ?>;color:<?php echo esc_attr( get_option('zedna_cookies_bar_btn_text_color') ); ?>;" <?php } ?> onclick="zednaAcceptCookies();"><?php echo $zedna_cookies_bar_button_output; ?></button><?php } ?>
     190<?php if($cookies_bar_show_button == 'no'):?>
     191<a class="cross" onclick="zednaAcceptCookies();">&times;</a>
     192<?php endif;?>
     193</div>
     194<style>
     195#zedna-cookies-bar a{color: <?php echo esc_attr( get_option('zedna_cookies_bar_link_color') ); ?>}
     196<?php echo esc_attr( get_option('zedna_cookies_bar_custom_css') )?>
     197<?php if($cookies_bar_show_button == 'no'):?>
     198    #zedna-cookies-bar .cross{color: <?php echo esc_attr( get_option('zedna_cookies_bar_btn_text_color') ); ?>}
     199    <?php endif;?>
     200</style>
    160201<!-- End Cookies bar -->
    161202<?php
Note: See TracChangeset for help on using the changeset viewer.