Changeset 2283017
- Timestamp:
- 04/14/2020 09:54:03 AM (6 years ago)
- Location:
- zedna-cookies-bar/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
zedna-cookies-bar.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
zedna-cookies-bar/trunk/readme.txt
r2282974 r2283017 25 25 26 26 == Changelog == 27 = Version 1.4 = 28 Added JS callback 29 27 30 = Version 1.3 = 28 31 Fixed showing button condition -
zedna-cookies-bar/trunk/zedna-cookies-bar.php
r2282974 r2283017 7 7 Author: Radek Mezulanik 8 8 Author URI: https://www.mezulanik.cz 9 Version: 1. 39 Version: 1.4 10 10 License: GPL3 11 11 */ … … 32 32 $cookie_bar_custom_css = (get_option('zedna_cookies_bar_custom_css') != '') ? get_option('zedna_cookies_bar_custom_css') : ''; 33 33 $cookies_bar_show_button = (get_option('zedna_cookies_bar_show_button') != '') ? get_option('zedna_cookies_bar_show_button') : 'yes'; 34 $cookie_bar_custom_js = (get_option('zedna_cookies_bar_custom_js') != '') ? get_option('zedna_cookies_bar_custom_js') : ''; 34 35 ?> 35 36 <script> … … 121 122 <th scope="row"><?php _e('Custom styles', 'zedna-cookies-bar'); ?></th> 122 123 <td> 123 <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>124 <textarea name="zedna_cookies_bar_custom_css" class="zedna_cookies_bar_custom_css" rows="10" cols="50"><?php echo esc_attr( $cookie_bar_custom_css ); ?></textarea> 124 125 <small>Use identifier #zedna-cookies-bar</small> 126 </td> 127 </tr> 128 <tr valign="top"> 129 <th scope="row"><?php _e('Custom javascript', 'zedna-cookies-bar'); ?></th> 130 <td> 131 <table> 132 <tr> 133 <td> 134 <pre>function zednaAcceptCookies() {</pre> 135 </td> 136 </tr> 137 <tr> 138 <td> 139 <textarea name="zedna_cookies_bar_custom_js" class="zedna_cookies_bar_custom_js" rows="10" cols="50"><?php echo esc_attr( $cookie_bar_custom_js ); ?></textarea> 140 <small>Callback function is called when user agree with cookie consent.</small> 141 </td> 142 </tr> 143 <tr> 144 <td> 145 <pre> 146 } 147 </pre> 148 </td> 149 </tr> 150 </table> 125 151 </td> 126 152 </tr> … … 153 179 register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_close' ); 154 180 register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_close_color' ); 181 register_setting( 'zedna-cookies-bar-settings', 'zedna_cookies_bar_custom_js' ); 155 182 } 156 183 add_action( 'admin_init', 'zedna_cookies_bar_settings' ); … … 169 196 delete_option( 'zedna_cookies_bar_close' ); 170 197 delete_option( 'zedna_cookies_bar_close_color' ); 198 delete_option( 'zedna_cookies_bar_custom_js' ); 171 199 } 172 200 register_uninstall_hook( __FILE__, 'zedna_cookies_bar_uninstall' ); … … 199 227 $zedna_cookies_bar_button_output = esc_attr( get_option('zedna_cookies_bar_button') ); 200 228 $zedna_cookies_bar_close_output = esc_attr( get_option('zedna_cookies_bar_close') ); 229 $zedna_cookies_bar_close_callback = htmlspecialchars_decode( get_option('zedna_cookies_bar_custom_js') ); 201 230 if ( empty( $zedna_cookies_bar_message_output ) ) $zedna_cookies_bar_message_output = "By browsing this website you are agreeing to our <a href='".get_home_url()."' target='_blank' rel='nofollow'>cookies policy</a>."; 202 231 if ( empty( $zedna_cookies_bar_button_output ) ) $zedna_cookies_bar_button_output = "I Agree"; … … 216 245 <?php endif;?> 217 246 </style> 247 <script type="text/javascript"> 248 function zednaAcceptCookiesCallback(){ 249 <?php echo $zedna_cookies_bar_close_callback;?> 250 } 251 </script> 218 252 <!-- End Cookies bar --> 219 253 <?php
Note: See TracChangeset
for help on using the changeset viewer.