Version Description
- First stable release.
Download this release
Release Info
Developer | manafactory |
Plugin | Ginger – EU Cookie Law |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- admin/ginger.about.php +5 -0
- admin/ginger.admin.php +56 -0
- admin/ginger.utils.php +72 -0
- admin/js/ginger.js +34 -0
- admin/js/jquery.repeater-master/.gitignore +2 -0
- admin/js/jquery.repeater-master/.jshintrc +15 -0
- admin/js/jquery.repeater-master/jquery.repeater.js +805 -0
- admin/partial/banner.php +139 -0
- admin/partial/bar.php +71 -0
- admin/partial/dialog.php +79 -0
- admin/partial/general.php +117 -0
- admin/partial/link.php +95 -0
- admin/partial/policy.php +99 -0
- admin/partial/url.php +99 -0
- front/css/cookies-enabler.css +153 -0
- front/gingerfront.utils.php +269 -0
- front/js/cookies-enabler.js +449 -0
- front/js/cookies-enabler.min.js +1 -0
- ginger-eu-cookie-law.php +23 -0
- img/ginger-color.png +0 -0
- img/ginger.png +0 -0
- languages/ginger-it_IT.mo +0 -0
- languages/ginger-it_IT.po +335 -0
- readme.txt +58 -0
admin/ginger.about.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2>About EU Cookie Law</h2>
|
3 |
+
|
4 |
+
|
5 |
+
</div>
|
admin/ginger.admin.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$key= $_GET["tab"];
|
3 |
+
if($key == "") $key = "general";
|
4 |
+
$key ="ginger_".$key;
|
5 |
+
|
6 |
+
if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_options')){
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
if(isset($_POST["submit"])){
|
11 |
+
$params = $_POST;
|
12 |
+
unset($params["submit"]);
|
13 |
+
unset($params["ginger_options"]);
|
14 |
+
unset($params["_wp_http_referer"]);
|
15 |
+
if ($key=='ginger_policy'){
|
16 |
+
if ($_POST["choice"]=="new_page"){
|
17 |
+
$id_privacy_new_page=save_privacy_page($_POST["privacy_page_title"],$_POST["privacy_page_content"]);
|
18 |
+
$privacy_page_id=$id_privacy_new_page;
|
19 |
+
}else{
|
20 |
+
$privacy_page_id=$_POST["ginger_privacy_page"];
|
21 |
+
}
|
22 |
+
update_option($key, $privacy_page_id);
|
23 |
+
}else{
|
24 |
+
update_option($key, $params);
|
25 |
+
}
|
26 |
+
echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
|
27 |
+
}
|
28 |
+
|
29 |
+
$options = get_option($key); ?>
|
30 |
+
|
31 |
+
<div class="wrap">
|
32 |
+
<h2>Ginger - EU Cookie Law</h2>
|
33 |
+
<hr>
|
34 |
+
<h2 class="nav-tab-wrapper">
|
35 |
+
<a href="admin.php?page=ginger-setup" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ($_GET["tab"] == "" )) ? 'nav-tab-active' : ''; ?>"><?php _e("General Configuration", "ginger"); ?></a>
|
36 |
+
<a href="admin.php?page=ginger-setup&tab=banner" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ($_GET["tab"] == "banner" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Banner Setup", "ginger"); ?></a>
|
37 |
+
<a href="admin.php?page=ginger-setup&tab=policy" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ($_GET["tab"] == "policy" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Privacy Policy", "ginger"); ?></a>
|
38 |
+
<?php do_action("ginger_add_tab_menu"); ?>
|
39 |
+
</h2>
|
40 |
+
<form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>&tab=<?php echo $_GET["tab"]; ?>" <?php if ($_GET["tab"]=='url'){echo 'class="repeater"';}?>>
|
41 |
+
<?php wp_nonce_field('save_ginger_options', 'ginger_options'); ?>
|
42 |
+
<?php
|
43 |
+
switch($_GET["tab"]){
|
44 |
+
case "":
|
45 |
+
include('partial/general.php');
|
46 |
+
break;
|
47 |
+
case "banner":
|
48 |
+
include('partial/banner.php');
|
49 |
+
break;
|
50 |
+
case "policy":
|
51 |
+
include('partial/policy.php');
|
52 |
+
break;
|
53 |
+
}?>
|
54 |
+
<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
|
55 |
+
</form>
|
56 |
+
</div>
|
admin/ginger.utils.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* File per la gestione del backend e delle funzionalità
|
4 |
+
*
|
5 |
+
*
|
6 |
+
*
|
7 |
+
*
|
8 |
+
* */
|
9 |
+
|
10 |
+
//Inizzializzo il plugin e le relative pagine del plugin
|
11 |
+
add_action( 'admin_menu', 'register_ginger_menu_page' );
|
12 |
+
function register_ginger_menu_page(){
|
13 |
+
add_menu_page( 'ginger', 'Ginger Cookie', 'manage_options', 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
|
14 |
+
do_action("ginger_add_menu");
|
15 |
+
// add_submenu_page( 'ginger-setup', "About", __("About EU Law", "ginger"), 'manage_options', 'ginger-about', 'ginger_about_menu_page');
|
16 |
+
}
|
17 |
+
function ginger_menu_page(){
|
18 |
+
require_once(plugin_dir_path( __FILE__ )."/ginger.admin.php");
|
19 |
+
}
|
20 |
+
function ginger_about_menu_page(){
|
21 |
+
require_once(plugin_dir_path( __FILE__ )."/ginger.about.php");
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
//Aggingo style e script per ginger backend
|
26 |
+
add_action( 'admin_enqueue_scripts', 'ginger_add_color_picker' );
|
27 |
+
function ginger_add_color_picker( $hook ) {
|
28 |
+
if( is_admin() ) {
|
29 |
+
// Add the color picker css file
|
30 |
+
wp_enqueue_style( 'wp-color-picker' );
|
31 |
+
// Include our custom jQuery file with WordPress Color Picker dependency
|
32 |
+
wp_enqueue_script( 'ginger-script-handle', plugins_url( 'js/ginger.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
//Salvataggio e creazione pagina cookie policy
|
37 |
+
function save_privacy_page($title,$content){
|
38 |
+
$my_post = array(
|
39 |
+
'post_title' => $title,
|
40 |
+
'post_content' => $content,
|
41 |
+
'post_status' => 'publish',
|
42 |
+
'post_author' => '',
|
43 |
+
'post_category' => '',
|
44 |
+
'post_type' => 'page'
|
45 |
+
);
|
46 |
+
$id = wp_insert_post( $my_post );
|
47 |
+
return($id);
|
48 |
+
}
|
49 |
+
|
50 |
+
//TODO questo è da spostare
|
51 |
+
function is_ginger_multilang_active(){
|
52 |
+
$ginger_active="true";
|
53 |
+
if(is_plugin_active('sitepress-multilingual-cms/sitepress.php') and ($ginger_active)) {
|
54 |
+
$active=true;
|
55 |
+
}else{
|
56 |
+
$active=false;
|
57 |
+
}
|
58 |
+
return $active;
|
59 |
+
}
|
60 |
+
//Attivazione plugin abilito le impostazioni di base se non inserite.
|
61 |
+
function ginger_plugin_activate() {
|
62 |
+
$options = get_option('ginger_general');
|
63 |
+
if (!is_array($options)){
|
64 |
+
$options = array('enable_ginger' => '0', 'ginger_cache' => 'yes', 'ginger_opt' => 'in', 'ginger_scroll' => '1', 'ginger_click_out' => '0' );
|
65 |
+
update_option('ginger_general', $options);
|
66 |
+
|
67 |
+
$options = array('ginger_banner_type' => 'bar', 'ginger_banner_position' => 'top', 'ginger_banner_text' => '','ginger_Iframe_text' =>'', 'accept_cookie_button_text' => 'Accept', 'disable_cookie_button_text'=> 'Disable', 'disable_cookie_button_status' => '0', 'read_more_button_text' => 'Read More', 'read_more_button_status' => '0', 'theme_ginger' => 'light', 'background_color' =>'', 'text_color' =>'', 'button_color' =>'', 'link_color' =>'');
|
68 |
+
update_option('ginger_banner', $options);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
|
admin/js/ginger.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
|
3 |
+
// Add Color Picker to all inputs that have 'color-field' class
|
4 |
+
$(function() {
|
5 |
+
$('.color-field').wpColorPicker();
|
6 |
+
});
|
7 |
+
|
8 |
+
})( jQuery );
|
9 |
+
|
10 |
+
function select_privacy_page(){
|
11 |
+
|
12 |
+
document.getElementById('privacy_page_select').disabled=false;
|
13 |
+
document.getElementById('new_page_privacy').style.display='none';
|
14 |
+
document.getElementById('new_page_privacy').style.display='none';
|
15 |
+
}
|
16 |
+
|
17 |
+
function new_privacy_page(){
|
18 |
+
|
19 |
+
document.getElementById('privacy_page_select').disabled=true;
|
20 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
21 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
22 |
+
}
|
23 |
+
function disable_text_banner_button(id){
|
24 |
+
|
25 |
+
document.getElementById(id).disabled=true;
|
26 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
27 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
28 |
+
}
|
29 |
+
function enable_text_banner_button(id){
|
30 |
+
|
31 |
+
document.getElementById(id).disabled=false;
|
32 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
33 |
+
document.getElementById('new_page_privacy').style.display='inline';
|
34 |
+
}
|
admin/js/jquery.repeater-master/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
node_modules
|
2 |
+
bower_components
|
admin/js/jquery.repeater-master/.jshintrc
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
// http://www.jshint.com/docs/options/
|
3 |
+
"curly": true,
|
4 |
+
"immed": true,
|
5 |
+
"latedef": true,
|
6 |
+
"unused": true,
|
7 |
+
"trailing": true,
|
8 |
+
"boss": true,
|
9 |
+
"loopfunc": true,
|
10 |
+
"node": true,
|
11 |
+
"browser": true,
|
12 |
+
"jquery": true,
|
13 |
+
"newcap": false,
|
14 |
+
"predef": ["React"]
|
15 |
+
}
|
admin/js/jquery.repeater-master/jquery.repeater.js
ADDED
@@ -0,0 +1,805 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// jquery.repeater version 1.0.0
|
2 |
+
// https://github.com/DubFriend/jquery.repeater
|
3 |
+
// (MIT) 11-04-2015
|
4 |
+
// Brian Detering <BDeterin@gmail.com> (http://www.briandetering.net/)
|
5 |
+
(function ($) {
|
6 |
+
'use strict';
|
7 |
+
|
8 |
+
var identity = function (x) {
|
9 |
+
return x;
|
10 |
+
};
|
11 |
+
|
12 |
+
var isArray = function (value) {
|
13 |
+
return $.isArray(value);
|
14 |
+
};
|
15 |
+
|
16 |
+
var isObject = function (value) {
|
17 |
+
return !isArray(value) && (value instanceof Object);
|
18 |
+
};
|
19 |
+
|
20 |
+
var isFunction = function (value) {
|
21 |
+
return value instanceof Function;
|
22 |
+
};
|
23 |
+
|
24 |
+
var indexOf = function (object, value) {
|
25 |
+
return $.inArray(value, object);
|
26 |
+
};
|
27 |
+
|
28 |
+
var inArray = function (array, value) {
|
29 |
+
return indexOf(array, value) !== -1;
|
30 |
+
};
|
31 |
+
|
32 |
+
var foreach = function (collection, callback) {
|
33 |
+
for(var i in collection) {
|
34 |
+
if(collection.hasOwnProperty(i)) {
|
35 |
+
callback(collection[i], i, collection);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
};
|
39 |
+
|
40 |
+
var last = function (array) {
|
41 |
+
return array[array.length - 1];
|
42 |
+
};
|
43 |
+
|
44 |
+
var mapToArray = function (collection, callback) {
|
45 |
+
var mapped = [];
|
46 |
+
foreach(collection, function (value, key, coll) {
|
47 |
+
mapped.push(callback(value, key, coll));
|
48 |
+
});
|
49 |
+
return mapped;
|
50 |
+
};
|
51 |
+
|
52 |
+
var mapToObject = function (collection, callback, keyCallback) {
|
53 |
+
var mapped = {};
|
54 |
+
foreach(collection, function (value, key, coll) {
|
55 |
+
key = keyCallback ? keyCallback(key, value) : key;
|
56 |
+
mapped[key] = callback(value, key, coll);
|
57 |
+
});
|
58 |
+
return mapped;
|
59 |
+
};
|
60 |
+
|
61 |
+
var map = function (collection, callback, keyCallback) {
|
62 |
+
return isArray(collection) ?
|
63 |
+
mapToArray(collection, callback) :
|
64 |
+
mapToObject(collection, callback, keyCallback);
|
65 |
+
};
|
66 |
+
|
67 |
+
var filter = function (collection, callback) {
|
68 |
+
var filtered;
|
69 |
+
|
70 |
+
if(isArray(collection)) {
|
71 |
+
filtered = [];
|
72 |
+
foreach(collection, function (val, key, coll) {
|
73 |
+
if(callback(val, key, coll)) {
|
74 |
+
filtered.push(val);
|
75 |
+
}
|
76 |
+
});
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
filtered = {};
|
80 |
+
foreach(collection, function (val, key, coll) {
|
81 |
+
if(callback(val, key, coll)) {
|
82 |
+
filtered[key] = val;
|
83 |
+
}
|
84 |
+
});
|
85 |
+
}
|
86 |
+
|
87 |
+
return filtered;
|
88 |
+
};
|
89 |
+
|
90 |
+
var call = function (collection, functionName, args) {
|
91 |
+
return map(collection, function (object, name) {
|
92 |
+
return object[functionName].apply(object, args || []);
|
93 |
+
});
|
94 |
+
};
|
95 |
+
|
96 |
+
//execute callback immediately and at most one time on the minimumInterval,
|
97 |
+
//ignore block attempts
|
98 |
+
var throttle = function (minimumInterval, callback) {
|
99 |
+
var timeout = null;
|
100 |
+
return function () {
|
101 |
+
var that = this, args = arguments;
|
102 |
+
if(timeout === null) {
|
103 |
+
timeout = setTimeout(function () {
|
104 |
+
timeout = null;
|
105 |
+
}, minimumInterval);
|
106 |
+
callback.apply(that, args);
|
107 |
+
}
|
108 |
+
};
|
109 |
+
};
|
110 |
+
|
111 |
+
|
112 |
+
var mixinPubSub = function (object) {
|
113 |
+
object = object || {};
|
114 |
+
var topics = {};
|
115 |
+
|
116 |
+
object.publish = function (topic, data) {
|
117 |
+
foreach(topics[topic], function (callback) {
|
118 |
+
callback(data);
|
119 |
+
});
|
120 |
+
};
|
121 |
+
|
122 |
+
object.subscribe = function (topic, callback) {
|
123 |
+
topics[topic] = topics[topic] || [];
|
124 |
+
topics[topic].push(callback);
|
125 |
+
};
|
126 |
+
|
127 |
+
object.unsubscribe = function (callback) {
|
128 |
+
foreach(topics, function (subscribers) {
|
129 |
+
var index = indexOf(subscribers, callback);
|
130 |
+
if(index !== -1) {
|
131 |
+
subscribers.splice(index, 1);
|
132 |
+
}
|
133 |
+
});
|
134 |
+
};
|
135 |
+
|
136 |
+
return object;
|
137 |
+
};
|
138 |
+
// jquery.input version 0.0.0
|
139 |
+
// https://github.com/DubFriend/jquery.input
|
140 |
+
// (MIT) 09-04-2014
|
141 |
+
// Brian Detering <BDeterin@gmail.com> (http://www.briandetering.net/)
|
142 |
+
(function ($) {
|
143 |
+
'use strict';
|
144 |
+
|
145 |
+
var createBaseInput = function (fig, my) {
|
146 |
+
var self = mixinPubSub(),
|
147 |
+
$self = fig.$;
|
148 |
+
|
149 |
+
self.getType = function () {
|
150 |
+
throw 'implement me (return type. "text", "radio", etc.)';
|
151 |
+
};
|
152 |
+
|
153 |
+
self.$ = function (selector) {
|
154 |
+
return selector ? $self.find(selector) : $self;
|
155 |
+
};
|
156 |
+
|
157 |
+
self.disable = function () {
|
158 |
+
self.$().prop('disabled', true);
|
159 |
+
self.publish('isEnabled', false);
|
160 |
+
};
|
161 |
+
|
162 |
+
self.enable = function () {
|
163 |
+
self.$().prop('disabled', false);
|
164 |
+
self.publish('isEnabled', true);
|
165 |
+
};
|
166 |
+
|
167 |
+
my.equalTo = function (a, b) {
|
168 |
+
return a === b;
|
169 |
+
};
|
170 |
+
|
171 |
+
my.publishChange = (function () {
|
172 |
+
var oldValue;
|
173 |
+
return function (e, domElement) {
|
174 |
+
var newValue = self.get();
|
175 |
+
if(!my.equalTo(newValue, oldValue)) {
|
176 |
+
self.publish('change', { e: e, domElement: domElement });
|
177 |
+
}
|
178 |
+
oldValue = newValue;
|
179 |
+
};
|
180 |
+
}());
|
181 |
+
|
182 |
+
return self;
|
183 |
+
};
|
184 |
+
|
185 |
+
|
186 |
+
var createInput = function (fig, my) {
|
187 |
+
var self = createBaseInput(fig, my);
|
188 |
+
|
189 |
+
self.get = function () {
|
190 |
+
return self.$().val();
|
191 |
+
};
|
192 |
+
|
193 |
+
self.set = function (newValue) {
|
194 |
+
self.$().val(newValue);
|
195 |
+
};
|
196 |
+
|
197 |
+
self.clear = function () {
|
198 |
+
self.set('');
|
199 |
+
};
|
200 |
+
|
201 |
+
my.buildSetter = function (callback) {
|
202 |
+
return function (newValue) {
|
203 |
+
callback.call(self, newValue);
|
204 |
+
};
|
205 |
+
};
|
206 |
+
|
207 |
+
return self;
|
208 |
+
};
|
209 |
+
|
210 |
+
var inputEqualToArray = function (a, b) {
|
211 |
+
a = isArray(a) ? a : [a];
|
212 |
+
b = isArray(b) ? b : [b];
|
213 |
+
|
214 |
+
var isEqual = true;
|
215 |
+
if(a.length !== b.length) {
|
216 |
+
isEqual = false;
|
217 |
+
}
|
218 |
+
else {
|
219 |
+
foreach(a, function (value) {
|
220 |
+
if(!inArray(b, value)) {
|
221 |
+
isEqual = false;
|
222 |
+
}
|
223 |
+
});
|
224 |
+
}
|
225 |
+
|
226 |
+
return isEqual;
|
227 |
+
};
|
228 |
+
|
229 |
+
var createInputButton = function (fig) {
|
230 |
+
var my = {},
|
231 |
+
self = createInput(fig, my);
|
232 |
+
|
233 |
+
self.getType = function () {
|
234 |
+
return 'button';
|
235 |
+
};
|
236 |
+
|
237 |
+
self.$().on('change', function (e) {
|
238 |
+
my.publishChange(e, this);
|
239 |
+
});
|
240 |
+
|
241 |
+
return self;
|
242 |
+
};
|
243 |
+
|
244 |
+
var createInputCheckbox = function (fig) {
|
245 |
+
var my = {},
|
246 |
+
self = createInput(fig, my);
|
247 |
+
|
248 |
+
self.getType = function () {
|
249 |
+
return 'checkbox';
|
250 |
+
};
|
251 |
+
|
252 |
+
self.get = function () {
|
253 |
+
var values = [];
|
254 |
+
self.$().filter(':checked').each(function () {
|
255 |
+
values.push($(this).val());
|
256 |
+
});
|
257 |
+
return values;
|
258 |
+
};
|
259 |
+
|
260 |
+
self.set = function (newValues) {
|
261 |
+
newValues = isArray(newValues) ? newValues : [newValues];
|
262 |
+
|
263 |
+
self.$().each(function () {
|
264 |
+
$(this).prop('checked', false);
|
265 |
+
});
|
266 |
+
|
267 |
+
foreach(newValues, function (value) {
|
268 |
+
self.$().filter('[value="' + value + '"]')
|
269 |
+
.prop('checked', true);
|
270 |
+
});
|
271 |
+
};
|
272 |
+
|
273 |
+
my.equalTo = inputEqualToArray;
|
274 |
+
|
275 |
+
self.$().change(function (e) {
|
276 |
+
my.publishChange(e, this);
|
277 |
+
});
|
278 |
+
|
279 |
+
return self;
|
280 |
+
};
|
281 |
+
|
282 |
+
var createInputEmail = function (fig) {
|
283 |
+
var my = {},
|
284 |
+
self = createInputText(fig, my);
|
285 |
+
|
286 |
+
self.getType = function () {
|
287 |
+
return 'email';
|
288 |
+
};
|
289 |
+
|
290 |
+
return self;
|
291 |
+
};
|
292 |
+
|
293 |
+
var createInputFile = function (fig) {
|
294 |
+
var my = {},
|
295 |
+
self = createBaseInput(fig, my);
|
296 |
+
|
297 |
+
self.getType = function () {
|
298 |
+
return 'file';
|
299 |
+
};
|
300 |
+
|
301 |
+
self.get = function () {
|
302 |
+
return last(self.$().val().split('\\'));
|
303 |
+
};
|
304 |
+
|
305 |
+
self.clear = function () {
|
306 |
+
// http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery
|
307 |
+
this.$().each(function () {
|
308 |
+
$(this).wrap('<form>').closest('form').get(0).reset();
|
309 |
+
$(this).unwrap();
|
310 |
+
});
|
311 |
+
};
|
312 |
+
|
313 |
+
self.$().change(function (e) {
|
314 |
+
my.publishChange(e, this);
|
315 |
+
// self.publish('change', self);
|
316 |
+
});
|
317 |
+
|
318 |
+
return self;
|
319 |
+
};
|
320 |
+
|
321 |
+
var createInputHidden = function (fig) {
|
322 |
+
var my = {},
|
323 |
+
self = createInput(fig, my);
|
324 |
+
|
325 |
+
self.getType = function () {
|
326 |
+
return 'hidden';
|
327 |
+
};
|
328 |
+
|
329 |
+
self.$().change(function (e) {
|
330 |
+
my.publishChange(e, this);
|
331 |
+
});
|
332 |
+
|
333 |
+
return self;
|
334 |
+
};
|
335 |
+
var createInputMultipleFile = function (fig) {
|
336 |
+
var my = {},
|
337 |
+
self = createBaseInput(fig, my);
|
338 |
+
|
339 |
+
self.getType = function () {
|
340 |
+
return 'file[multiple]';
|
341 |
+
};
|
342 |
+
|
343 |
+
self.get = function () {
|
344 |
+
// http://stackoverflow.com/questions/14035530/how-to-get-value-of-html-5-multiple-file-upload-variable-using-jquery
|
345 |
+
var fileListObject = self.$().get(0).files || [],
|
346 |
+
names = [], i;
|
347 |
+
|
348 |
+
for(i = 0; i < (fileListObject.length || 0); i += 1) {
|
349 |
+
names.push(fileListObject[i].name);
|
350 |
+
}
|
351 |
+
|
352 |
+
return names;
|
353 |
+
};
|
354 |
+
|
355 |
+
self.clear = function () {
|
356 |
+
// http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery
|
357 |
+
this.$().each(function () {
|
358 |
+
$(this).wrap('<form>').closest('form').get(0).reset();
|
359 |
+
$(this).unwrap();
|
360 |
+
});
|
361 |
+
};
|
362 |
+
|
363 |
+
self.$().change(function (e) {
|
364 |
+
my.publishChange(e, this);
|
365 |
+
});
|
366 |
+
|
367 |
+
return self;
|
368 |
+
};
|
369 |
+
|
370 |
+
var createInputMultipleSelect = function (fig) {
|
371 |
+
var my = {},
|
372 |
+
self = createInput(fig, my);
|
373 |
+
|
374 |
+
self.getType = function () {
|
375 |
+
return 'select[multiple]';
|
376 |
+
};
|
377 |
+
|
378 |
+
self.get = function () {
|
379 |
+
return self.$().val() || [];
|
380 |
+
};
|
381 |
+
|
382 |
+
self.set = function (newValues) {
|
383 |
+
self.$().val(
|
384 |
+
newValues === '' ? [] : isArray(newValues) ? newValues : [newValues]
|
385 |
+
);
|
386 |
+
};
|
387 |
+
|
388 |
+
my.equalTo = inputEqualToArray;
|
389 |
+
|
390 |
+
self.$().change(function (e) {
|
391 |
+
my.publishChange(e, this);
|
392 |
+
});
|
393 |
+
|
394 |
+
return self;
|
395 |
+
};
|
396 |
+
|
397 |
+
var createInputPassword = function (fig) {
|
398 |
+
var my = {},
|
399 |
+
self = createInputText(fig, my);
|
400 |
+
|
401 |
+
self.getType = function () {
|
402 |
+
return 'password';
|
403 |
+
};
|
404 |
+
|
405 |
+
return self;
|
406 |
+
};
|
407 |
+
|
408 |
+
var createInputRadio = function (fig) {
|
409 |
+
var my = {},
|
410 |
+
self = createInput(fig, my);
|
411 |
+
|
412 |
+
self.getType = function () {
|
413 |
+
return 'radio';
|
414 |
+
};
|
415 |
+
|
416 |
+
self.get = function () {
|
417 |
+
return self.$().filter(':checked').val() || null;
|
418 |
+
};
|
419 |
+
|
420 |
+
self.set = function (newValue) {
|
421 |
+
if(!newValue) {
|
422 |
+
self.$().each(function () {
|
423 |
+
$(this).prop('checked', false);
|
424 |
+
});
|
425 |
+
}
|
426 |
+
else {
|
427 |
+
self.$().filter('[value="' + newValue + '"]').prop('checked', true);
|
428 |
+
}
|
429 |
+
};
|
430 |
+
|
431 |
+
self.$().change(function (e) {
|
432 |
+
my.publishChange(e, this);
|
433 |
+
});
|
434 |
+
|
435 |
+
return self;
|
436 |
+
};
|
437 |
+
|
438 |
+
var createInputRange = function (fig) {
|
439 |
+
var my = {},
|
440 |
+
self = createInput(fig, my);
|
441 |
+
|
442 |
+
self.getType = function () {
|
443 |
+
return 'range';
|
444 |
+
};
|
445 |
+
|
446 |
+
self.$().change(function (e) {
|
447 |
+
my.publishChange(e, this);
|
448 |
+
});
|
449 |
+
|
450 |
+
return self;
|
451 |
+
};
|
452 |
+
|
453 |
+
var createInputSelect = function (fig) {
|
454 |
+
var my = {},
|
455 |
+
self = createInput(fig, my);
|
456 |
+
|
457 |
+
self.getType = function () {
|
458 |
+
return 'select';
|
459 |
+
};
|
460 |
+
|
461 |
+
self.$().change(function (e) {
|
462 |
+
my.publishChange(e, this);
|
463 |
+
});
|
464 |
+
|
465 |
+
return self;
|
466 |
+
};
|
467 |
+
|
468 |
+
var createInputText = function (fig) {
|
469 |
+
var my = {},
|
470 |
+
self = createInput(fig, my);
|
471 |
+
|
472 |
+
self.getType = function () {
|
473 |
+
return 'text';
|
474 |
+
};
|
475 |
+
|
476 |
+
self.$().on('change keyup keydown', function (e) {
|
477 |
+
my.publishChange(e, this);
|
478 |
+
});
|
479 |
+
|
480 |
+
return self;
|
481 |
+
};
|
482 |
+
|
483 |
+
var createInputTextarea = function (fig) {
|
484 |
+
var my = {},
|
485 |
+
self = createInput(fig, my);
|
486 |
+
|
487 |
+
self.getType = function () {
|
488 |
+
return 'textarea';
|
489 |
+
};
|
490 |
+
|
491 |
+
self.$().on('change keyup keydown', function (e) {
|
492 |
+
my.publishChange(e, this);
|
493 |
+
});
|
494 |
+
|
495 |
+
return self;
|
496 |
+
};
|
497 |
+
|
498 |
+
var createInputURL = function (fig) {
|
499 |
+
var my = {},
|
500 |
+
self = createInputText(fig, my);
|
501 |
+
|
502 |
+
self.getType = function () {
|
503 |
+
return 'url';
|
504 |
+
};
|
505 |
+
|
506 |
+
return self;
|
507 |
+
};
|
508 |
+
|
509 |
+
var buildFormInputs = function (fig) {
|
510 |
+
var inputs = {},
|
511 |
+
$self = fig.$;
|
512 |
+
|
513 |
+
var constructor = fig.constructorOverride || {
|
514 |
+
button: createInputButton,
|
515 |
+
text: createInputText,
|
516 |
+
url: createInputURL,
|
517 |
+
email: createInputEmail,
|
518 |
+
password: createInputPassword,
|
519 |
+
range: createInputRange,
|
520 |
+
textarea: createInputTextarea,
|
521 |
+
select: createInputSelect,
|
522 |
+
'select[multiple]': createInputMultipleSelect,
|
523 |
+
radio: createInputRadio,
|
524 |
+
checkbox: createInputCheckbox,
|
525 |
+
file: createInputFile,
|
526 |
+
'file[multiple]': createInputMultipleFile,
|
527 |
+
hidden: createInputHidden
|
528 |
+
};
|
529 |
+
|
530 |
+
var addInputsBasic = function (type, selector) {
|
531 |
+
var $input = isObject(selector) ? selector : $self.find(selector);
|
532 |
+
|
533 |
+
$input.each(function () {
|
534 |
+
var name = $(this).attr('name');
|
535 |
+
inputs[name] = constructor[type]({
|
536 |
+
$: $(this)
|
537 |
+
});
|
538 |
+
});
|
539 |
+
};
|
540 |
+
|
541 |
+
var addInputsGroup = function (type, selector) {
|
542 |
+
var names = [],
|
543 |
+
$input = isObject(selector) ? selector : $self.find(selector);
|
544 |
+
|
545 |
+
if(isObject(selector)) {
|
546 |
+
inputs[$input.attr('name')] = constructor[type]({
|
547 |
+
$: $input
|
548 |
+
});
|
549 |
+
}
|
550 |
+
else {
|
551 |
+
// group by name attribute
|
552 |
+
$input.each(function () {
|
553 |
+
if(indexOf(names, $(this).attr('name')) === -1) {
|
554 |
+
names.push($(this).attr('name'));
|
555 |
+
}
|
556 |
+
});
|
557 |
+
|
558 |
+
foreach(names, function (name) {
|
559 |
+
inputs[name] = constructor[type]({
|
560 |
+
$: $self.find('input[name="' + name + '"]')
|
561 |
+
});
|
562 |
+
});
|
563 |
+
}
|
564 |
+
};
|
565 |
+
|
566 |
+
|
567 |
+
if($self.is('input, select, textarea')) {
|
568 |
+
if($self.is('input[type="button"], button, input[type="submit"]')) {
|
569 |
+
addInputsBasic('button', $self);
|
570 |
+
}
|
571 |
+
else if($self.is('textarea')) {
|
572 |
+
addInputsBasic('textarea', $self);
|
573 |
+
}
|
574 |
+
else if(
|
575 |
+
$self.is('input[type="text"]') ||
|
576 |
+
$self.is('input') && !$self.attr('type')
|
577 |
+
) {
|
578 |
+
addInputsBasic('text', $self);
|
579 |
+
}
|
580 |
+
else if($self.is('input[type="password"]')) {
|
581 |
+
addInputsBasic('password', $self);
|
582 |
+
}
|
583 |
+
else if($self.is('input[type="email"]')) {
|
584 |
+
addInputsBasic('email', $self);
|
585 |
+
}
|
586 |
+
else if($self.is('input[type="url"]')) {
|
587 |
+
addInputsBasic('url', $self);
|
588 |
+
}
|
589 |
+
else if($self.is('input[type="range"]')) {
|
590 |
+
addInputsBasic('range', $self);
|
591 |
+
}
|
592 |
+
else if($self.is('select')) {
|
593 |
+
if($self.is('[multiple]')) {
|
594 |
+
addInputsBasic('select[multiple]', $self);
|
595 |
+
}
|
596 |
+
else {
|
597 |
+
addInputsBasic('select', $self);
|
598 |
+
}
|
599 |
+
}
|
600 |
+
else if($self.is('input[type="file"]')) {
|
601 |
+
if($self.is('[multiple]')) {
|
602 |
+
addInputsBasic('file[multiple]', $self);
|
603 |
+
}
|
604 |
+
else {
|
605 |
+
addInputsBasic('file', $self);
|
606 |
+
}
|
607 |
+
}
|
608 |
+
else if($self.is('input[type="hidden"]')) {
|
609 |
+
addInputsBasic('hidden', $self);
|
610 |
+
}
|
611 |
+
else if($self.is('input[type="radio"]')) {
|
612 |
+
addInputsGroup('radio', $self);
|
613 |
+
}
|
614 |
+
else if($self.is('input[type="checkbox"]')) {
|
615 |
+
addInputsGroup('checkbox', $self);
|
616 |
+
}
|
617 |
+
else {
|
618 |
+
throw 'invalid input type';
|
619 |
+
}
|
620 |
+
}
|
621 |
+
else {
|
622 |
+
addInputsBasic('button', 'input[type="button"], button, input[type="submit"]');
|
623 |
+
addInputsBasic('text', 'input[type="text"]');
|
624 |
+
addInputsBasic('password', 'input[type="password"]');
|
625 |
+
addInputsBasic('email', 'input[type="email"]');
|
626 |
+
addInputsBasic('url', 'input[type="url"]');
|
627 |
+
addInputsBasic('range', 'input[type="range"]');
|
628 |
+
addInputsBasic('textarea', 'textarea');
|
629 |
+
addInputsBasic('select', 'select:not([multiple])');
|
630 |
+
addInputsBasic('select[multiple]', 'select[multiple]');
|
631 |
+
addInputsBasic('file', 'input[type="file"]:not([multiple])');
|
632 |
+
addInputsBasic('file[multiple]', 'input[type="file"][multiple]');
|
633 |
+
addInputsBasic('hidden', 'input[type="hidden"]');
|
634 |
+
addInputsGroup('radio', 'input[type="radio"]');
|
635 |
+
addInputsGroup('checkbox', 'input[type="checkbox"]');
|
636 |
+
}
|
637 |
+
|
638 |
+
return inputs;
|
639 |
+
};
|
640 |
+
|
641 |
+
$.fn.inputVal = function (newValue) {
|
642 |
+
var $self = $(this);
|
643 |
+
|
644 |
+
var inputs = buildFormInputs({ $: $self });
|
645 |
+
|
646 |
+
if($self.is('input, textarea, select')) {
|
647 |
+
if(typeof newValue === 'undefined') {
|
648 |
+
return inputs[$self.attr('name')].get();
|
649 |
+
}
|
650 |
+
else {
|
651 |
+
inputs[$self.attr('name')].set(newValue);
|
652 |
+
return $self;
|
653 |
+
}
|
654 |
+
}
|
655 |
+
else {
|
656 |
+
if(typeof newValue === 'undefined') {
|
657 |
+
return call(inputs, 'get');
|
658 |
+
}
|
659 |
+
else {
|
660 |
+
foreach(newValue, function (value, inputName) {
|
661 |
+
inputs[inputName].set(value);
|
662 |
+
});
|
663 |
+
return $self;
|
664 |
+
}
|
665 |
+
}
|
666 |
+
};
|
667 |
+
|
668 |
+
$.fn.inputOnChange = function (callback) {
|
669 |
+
var $self = $(this);
|
670 |
+
var inputs = buildFormInputs({ $: $self });
|
671 |
+
foreach(inputs, function (input) {
|
672 |
+
input.subscribe('change', function (data) {
|
673 |
+
callback.call(data.domElement, data.e);
|
674 |
+
});
|
675 |
+
});
|
676 |
+
return $self;
|
677 |
+
};
|
678 |
+
|
679 |
+
$.fn.inputDisable = function () {
|
680 |
+
var $self = $(this);
|
681 |
+
call(buildFormInputs({ $: $self }), 'disable');
|
682 |
+
return $self;
|
683 |
+
};
|
684 |
+
|
685 |
+
$.fn.inputEnable = function () {
|
686 |
+
var $self = $(this);
|
687 |
+
call(buildFormInputs({ $: $self }), 'enable');
|
688 |
+
return $self;
|
689 |
+
};
|
690 |
+
|
691 |
+
$.fn.inputClear = function () {
|
692 |
+
var $self = $(this);
|
693 |
+
call(buildFormInputs({ $: $self }), 'clear');
|
694 |
+
return $self;
|
695 |
+
};
|
696 |
+
|
697 |
+
}(jQuery));
|
698 |
+
|
699 |
+
$.fn.repeater = function(fig) {
|
700 |
+
|
701 |
+
fig = fig || {};
|
702 |
+
|
703 |
+
$(this).each(function () {
|
704 |
+
|
705 |
+
var $self = $(this);
|
706 |
+
|
707 |
+
var show = fig.show || function () {
|
708 |
+
$(this).show();
|
709 |
+
};
|
710 |
+
|
711 |
+
var hide = fig.hide || function (removeElement) {
|
712 |
+
removeElement();
|
713 |
+
};
|
714 |
+
|
715 |
+
var $list = $self.find('[data-repeater-list]');
|
716 |
+
|
717 |
+
var $itemTemplate = $list.find('[data-repeater-item]')
|
718 |
+
.first().clone().hide();
|
719 |
+
|
720 |
+
var $firstDeleteButton = $(this).find('[data-repeater-item]')
|
721 |
+
.first()
|
722 |
+
.find('[data-repeater-delete]');
|
723 |
+
|
724 |
+
if(fig.isFirstItemUndeletable && $firstDeleteButton) {
|
725 |
+
$firstDeleteButton.remove();
|
726 |
+
}
|
727 |
+
|
728 |
+
var groupName = $list.data('repeater-list');
|
729 |
+
|
730 |
+
var setIndexes = function () {
|
731 |
+
$list.find('[data-repeater-item]').each(function (index) {
|
732 |
+
$(this).find('[name]').each(function () {
|
733 |
+
// match non empty brackets (ex: "[foo]")
|
734 |
+
var matches = $(this).attr('name').match(/\[[^\]]+\]/g);
|
735 |
+
|
736 |
+
var name = matches ?
|
737 |
+
// strip "[" and "]" characters
|
738 |
+
last(matches).replace(/\[|\]/g, '') :
|
739 |
+
$(this).attr('name');
|
740 |
+
|
741 |
+
var newName = groupName + '[' + index + '][' + name + ']' +
|
742 |
+
($(this).is(':checkbox') ? '[]' : '');
|
743 |
+
|
744 |
+
$(this).attr('name', newName);
|
745 |
+
});
|
746 |
+
});
|
747 |
+
|
748 |
+
$list.find('input[name][checked]')
|
749 |
+
.removeAttr('checked')
|
750 |
+
.prop('checked', true);
|
751 |
+
};
|
752 |
+
|
753 |
+
setIndexes();
|
754 |
+
|
755 |
+
var setItemsValues = function ($item, values) {
|
756 |
+
var index;
|
757 |
+
index = $item.find('[name]').first()
|
758 |
+
.attr('name').match(/\[([0-9]*)\]/)[1];
|
759 |
+
|
760 |
+
$item.inputVal(map(values, identity, function (name) {
|
761 |
+
var nameIfNotCheckbox = groupName + '[' + index + '][' + name + ']';
|
762 |
+
return $item.find('[name="' + nameIfNotCheckbox + '"]').length ?
|
763 |
+
nameIfNotCheckbox : nameIfNotCheckbox + '[]';
|
764 |
+
}));
|
765 |
+
};
|
766 |
+
|
767 |
+
var appendItem = (function () {
|
768 |
+
var setupTemplate = function ($item) {
|
769 |
+
var defaultValues = fig.defaultValues;
|
770 |
+
|
771 |
+
$item.find('[name]').each(function () {
|
772 |
+
$(this).inputClear();
|
773 |
+
});
|
774 |
+
|
775 |
+
if(defaultValues) {
|
776 |
+
setItemsValues($item, defaultValues);
|
777 |
+
}
|
778 |
+
};
|
779 |
+
|
780 |
+
return function ($item) {
|
781 |
+
$list.append($item);
|
782 |
+
setIndexes();
|
783 |
+
setupTemplate($item);
|
784 |
+
};
|
785 |
+
}());
|
786 |
+
|
787 |
+
$self.find('[data-repeater-create]').click(function () {
|
788 |
+
var $item = $itemTemplate.clone();
|
789 |
+
appendItem($item);
|
790 |
+
show.call($item.get(0));
|
791 |
+
});
|
792 |
+
|
793 |
+
$list.on('click', '[data-repeater-delete]', function () {
|
794 |
+
var self = $(this).closest('[data-repeater-item]').get(0);
|
795 |
+
hide.call(self, function () {
|
796 |
+
$(self).remove();
|
797 |
+
setIndexes();
|
798 |
+
});
|
799 |
+
});
|
800 |
+
|
801 |
+
});
|
802 |
+
|
803 |
+
return this;
|
804 |
+
};
|
805 |
+
}(jQuery));
|
admin/partial/banner.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="form-table striped">
|
2 |
+
<thead>
|
3 |
+
<tr>
|
4 |
+
<td colspan="2">
|
5 |
+
<h2><?php _e("Banner Setup", "ginger"); ?></h2>
|
6 |
+
</td>
|
7 |
+
</tr>
|
8 |
+
</thead>
|
9 |
+
<tbody>
|
10 |
+
<tr>
|
11 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Choose Banner Type", "ginger"); ?></th>
|
12 |
+
<td>
|
13 |
+
<fieldset>
|
14 |
+
<legend class="screen-reader-text"><span><?php _e("Choose Banner Type", "ginger"); ?></span></legend>
|
15 |
+
<p><label><input name="ginger_banner_type" type="radio" value="bar" class="tog" <?php if($options["ginger_banner_type"] == "bar") echo ' checked="checked" '; ?>><?php _e("Bar", "ginger"); ?></label></p>
|
16 |
+
<p><label><input name="ginger_banner_type" type="radio" value="dialog" class="tog" <?php if($options["ginger_banner_type"] == "dialog") echo ' checked="checked" '; ?>><?php _e("Dialog", "ginger"); ?></label></p>
|
17 |
+
</fieldset>
|
18 |
+
</td>
|
19 |
+
</tr>
|
20 |
+
<tr>
|
21 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Banner Position", "ginger"); ?></th>
|
22 |
+
<td>
|
23 |
+
<fieldset>
|
24 |
+
<legend class="screen-reader-text"><span><?php _e("Banner Position", "ginger"); ?></span></legend>
|
25 |
+
<p><label><input name="ginger_banner_position" type="radio" value="top" class="tog" <?php if($options["ginger_banner_position"] == "top") echo ' checked="checked" '; ?>><?php _e("Top", "ginger"); ?></label></p>
|
26 |
+
<p><label><input name="ginger_banner_position" type="radio" value="bottom" class="tog" <?php if($options["ginger_banner_position"] == "bottom") echo ' checked="checked" '; ?>><?php _e("Bottom", "ginger"); ?></label></p>
|
27 |
+
</fieldset>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
<tr>
|
31 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Banner Text", "ginger"); ?></th>
|
32 |
+
<td>
|
33 |
+
<fieldset>
|
34 |
+
<legend class="screen-reader-text"><span><?php _e("Banner Text", "ginger"); ?></span></legend>
|
35 |
+
<p><label><?php wp_editor( $options["ginger_banner_text"], "ginger_bar_text", array( 'textarea_name' => "ginger_banner_text" , 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true ) );?>
|
36 |
+
<br><small><?php _e('You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page defined in <a href="admin.php?page=ginger-setup&tab=policy">Privacy Policy Tab</a>', "ginger"); ?></small>
|
37 |
+
</label>
|
38 |
+
</p>
|
39 |
+
</fieldset>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<tr>
|
43 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Iframe Text", "ginger"); ?></th>
|
44 |
+
<td>
|
45 |
+
<fieldset>
|
46 |
+
<legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
|
47 |
+
<p><label><?php wp_editor( $options["ginger_Iframe_text"], "ginger_Iframe_text", array( 'textarea_name' => "ginger_Iframe_text" , 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true ) );?></label></p>
|
48 |
+
</fieldset>
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
<tr>
|
52 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Customize your banner buttons", "ginger"); ?></th>
|
53 |
+
<td>
|
54 |
+
<fieldset>
|
55 |
+
<legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
|
56 |
+
<p><label><b><?php _e("Accept cookie Button", "ginger"); ?></b></label>
|
57 |
+
</p>
|
58 |
+
<p>
|
59 |
+
<label><?php _e("Text", "ginger"); ?></label>
|
60 |
+
<input name="accept_cookie_button_text" id="accept_cookie_button_text" type="text" value="<?php if ($options['accept_cookie_button_text']!=""){ echo $options['accept_cookie_button_text'];}else{ echo _e('Accept Cookie', 'ginger');}?>">
|
61 |
+
</p>
|
62 |
+
<p>
|
63 |
+
<label><b><?php _e("Disable cookie Button", "ginger"); ?></b></label>
|
64 |
+
</p>
|
65 |
+
<p>
|
66 |
+
<label><?php _e("Text", "ginger"); ?></label>
|
67 |
+
<input name="disable_cookie_button_text" id="disable_cookie_button_text" type="text" value="<?php if ($options['disable_cookie_button_text']!=""){ echo $options['disable_cookie_button_text'];}else{ echo _e('Disable Cookie', 'ginger');}?>">
|
68 |
+
<?php echo _e('Enable:','ginger')?>
|
69 |
+
<label><?php echo _e('Yes','ginger')?> </label>
|
70 |
+
<input type="radio" name="disable_cookie_button_status" value="1" <?php if ($options['disable_cookie_button_status']=="1" or $options['disable_cookie_button_status']==""){ echo 'checked';}?> onclick="enable_text_banner_button('disable_cookie_button_text');">
|
71 |
+
<label><?php echo _e('No','ginger')?> </label>
|
72 |
+
<input type="radio" name="disable_cookie_button_status" value="0" <?php if ($options['disable_cookie_button_status']=="0"){ echo 'checked';}?> onclick="disable_text_banner_button('disable_cookie_button_text');">
|
73 |
+
</p>
|
74 |
+
<p>
|
75 |
+
<label><b><?php _e("Read More Button", "ginger"); ?></b></label>
|
76 |
+
</p>
|
77 |
+
<p>
|
78 |
+
<label><?php _e("Text", "ginger"); ?></label>
|
79 |
+
<input name="read_more_button_text" id="read_more_button_text" type="text" value="<?php if ($option['read_more_button_text']!=""){ echo $options['read_more_button_text'];}else{ echo _e('Read More', 'ginger');}?>">
|
80 |
+
<?php echo _e('Enable:','ginger')?>
|
81 |
+
<label><?php echo _e('Yes','ginger')?> </label>
|
82 |
+
<input type="radio" name="read_more_button_status" value="1" <?php if ($options['read_more_button_status']=="1" or $options['read_more_button_status']==""){ echo 'checked';}?> onclick="enable_text_banner_button('read_more_button_text');">
|
83 |
+
<label><?php echo _e('No','ginger')?> </label>
|
84 |
+
<input type="radio" name="read_more_button_status" value="0" <?php if ($options['read_more_button_status']=="0"){ echo 'checked';}?> onclick="disable_text_banner_button('read_more_button_text');">
|
85 |
+
</p>
|
86 |
+
</fieldset>
|
87 |
+
</td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Choose Ginger Theme", "ginger"); ?></th>
|
91 |
+
<td>
|
92 |
+
<fieldset>
|
93 |
+
<legend class="screen-reader-text"><span><?php _e("Choose Ginger Theme", "ginger"); ?></span></legend>
|
94 |
+
<p><label><input name="theme_ginger" type="radio" value="light" class="tog" <?php if($options["theme_ginger"] == "light") echo ' checked="checked" '; ?>><?php _e("Light Theme", "ginger"); ?></label></p>
|
95 |
+
<p><label><input name="theme_ginger" type="radio" value="dark" class="tog" <?php if($options["theme_ginger"] == "dark") echo ' checked="checked" '; ?>><?php _e("Dark Theme", "ginger"); ?></label></p>
|
96 |
+
</fieldset>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<tr>
|
100 |
+
<td colspan="2">
|
101 |
+
<h2><?php _e("Customize your Ginger theme", "ginger"); ?></h2>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
<tr>
|
105 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Background", "ginger"); ?></th>
|
106 |
+
<td>
|
107 |
+
<fieldset>
|
108 |
+
<legend class="screen-reader-text"><span><?php _e("Background", "ginger"); ?></span></legend>
|
109 |
+
<p><label><input type="text" name="background_color" value="<?php echo $options["background_color"]; ?>" class="color-field" ></label></p>
|
110 |
+
</fieldset>
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Text", "ginger"); ?></th>
|
115 |
+
<td>
|
116 |
+
<fieldset>
|
117 |
+
<legend class="screen-reader-text"><span><?php _e("Text", "ginger"); ?></span></legend>
|
118 |
+
<p><label><input type="text" name="text_color" value="<?php echo $options["text_color"]; ?>" class="color-field" ></label></p>
|
119 |
+
</fieldset>
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Button", "ginger"); ?></th>
|
124 |
+
<td>
|
125 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e("Button", "ginger"); ?></span></legend>
|
126 |
+
<p><label><input type="text" name="button_color" value="<?php echo $options["button_color"]; ?>" class="color-field" ></label></p>
|
127 |
+
</fieldset>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
<tr>
|
131 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Link", "ginger"); ?></th>
|
132 |
+
<td>
|
133 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e("Link", "ginger"); ?></span></legend>
|
134 |
+
<p><label><input type="text" name="link_color" value="<?php echo $options["link_color"]; ?>" class="color-field" ></label></p>
|
135 |
+
</fieldset>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
</tbody>
|
139 |
+
</table>
|
admin/partial/bar.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Banner Bar Setup", "ginger"); ?></h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</thead>
|
12 |
+
<tbody>
|
13 |
+
<tr>
|
14 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Bar Position", "ginger"); ?></th>
|
15 |
+
<td><fieldset><legend class="screen-reader-text"><span><?php _e("Bar Position", "ginger"); ?></span></legend>
|
16 |
+
<p><label><input name="ginger_bar_position" type="radio" value="top" class="tog" <?php if($options["ginger_bar_position"] == "top") echo ' checked="checked" '; ?>><?php _e("Top", "ginger"); ?></label></p>
|
17 |
+
<p><label><input name="ginger_bar_position" type="radio" value="bottom" class="tog" <?php if($options["ginger_bar_position"] == "bottom") echo ' checked="checked" '; ?>><?php _e("Bottom", "ginger"); ?></label></p>
|
18 |
+
</fieldset></td>
|
19 |
+
</tr>
|
20 |
+
|
21 |
+
<tr>
|
22 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Banner Text", "ginger"); ?></th>
|
23 |
+
<td><fieldset><legend class="screen-reader-text"><span><?php _e("Bar Text", "ginger"); ?></span></legend>
|
24 |
+
<p><label>
|
25 |
+
<?php wp_editor( $options["ginger_bar_text"], "ginger_bar_text", array( 'textarea_name' => "ginger_bar_text" , 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true ) );
|
26 |
+
|
27 |
+
?>
|
28 |
+
|
29 |
+
<br><small><?php _e('You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page defined in <a href="admin.php?page=ginger-setup&tab=policy">Privacy Policy Tab</a>', "ginger"); ?></small>
|
30 |
+
</label></p>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<tr>
|
34 |
+
<td colspan="2">
|
35 |
+
<h2><?php _e("Colors", "ginger"); ?></h2>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
|
39 |
+
<tr>
|
40 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Background", "ginger"); ?></th>
|
41 |
+
<td><fieldset><legend class="screen-reader-text"><span><?php _e("Background", "ginger"); ?></span></legend><p><label>
|
42 |
+
<input type="text" name="background_color" value="<?php echo $options["background_color"]; ?>" class="color-field" >
|
43 |
+
|
44 |
+
</label></p>
|
45 |
+
</td>
|
46 |
+
</tr>
|
47 |
+
|
48 |
+
<tr>
|
49 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Text", "ginger"); ?></th>
|
50 |
+
<td><fieldset><legend class="screen-reader-text"><span><?php _e("Text", "ginger"); ?></span></legend><p><label>
|
51 |
+
<input type="text" name="text_color" value="<?php echo $options["text_color"]; ?>" class="color-field" >
|
52 |
+
|
53 |
+
</label></p>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
|
57 |
+
<tr>
|
58 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Link", "ginger"); ?></th>
|
59 |
+
<td><fieldset><legend class="screen-reader-text"><span><?php _e("Link", "ginger"); ?></span></legend><p><label>
|
60 |
+
<input type="text" name="link_color" value="<?php echo $options["link_color"]; ?>" class="color-field" >
|
61 |
+
|
62 |
+
</label></p>
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
</tbody></table>
|
69 |
+
|
70 |
+
|
71 |
+
<?php
|
admin/partial/dialog.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Banner Dialog Setup", "ginger"); ?></h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</thead>
|
12 |
+
<tbody>
|
13 |
+
|
14 |
+
<tr>
|
15 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Dialog Text", "ginger"); ?></th>
|
16 |
+
<td>
|
17 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e("DialogText", "ginger"); ?></span></legend>
|
18 |
+
<p>
|
19 |
+
<label>
|
20 |
+
<?php wp_editor( $options["ginger_dialog_text"], "ginger_dialog_text", array( 'textarea_name' => "ginger_dialog_text" , 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true ) );
|
21 |
+
|
22 |
+
?>
|
23 |
+
|
24 |
+
<br><small><?php _e('You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page defined in <a href="admin.php?page=ginger-setup&tab=policy">Privacy Policy Tab</a>', "ginger"); ?></small>
|
25 |
+
</label>
|
26 |
+
</p>
|
27 |
+
</fieldset>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
<tr>
|
31 |
+
<td colspan="2">
|
32 |
+
<h2><?php _e("Colors", "ginger"); ?></h2>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
|
36 |
+
<tr>
|
37 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Background", "ginger"); ?></th>
|
38 |
+
<td>
|
39 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e("Background", "ginger"); ?></span></legend>
|
40 |
+
<p>
|
41 |
+
<label>
|
42 |
+
<input type="text" name="background_color" value="<?php echo $options["background_color"]; ?>" class="color-field" >
|
43 |
+
|
44 |
+
</label>
|
45 |
+
</p>
|
46 |
+
</fieldset>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
|
50 |
+
<tr>
|
51 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Text", "ginger"); ?></th>
|
52 |
+
<td>
|
53 |
+
<fieldset><legend class="screen-reader-text"><span><?php _e("Text", "ginger"); ?></span></legend>
|
54 |
+
<p>
|
55 |
+
<label>
|
56 |
+
<input type="text" name="text_color" value="<?php echo $options["text_color"]; ?>" class="color-field" >
|
57 |
+
</label>
|
58 |
+
</p>
|
59 |
+
</fieldset>
|
60 |
+
</td>
|
61 |
+
</tr>
|
62 |
+
|
63 |
+
<tr>
|
64 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Link", "ginger"); ?></th>
|
65 |
+
<td>
|
66 |
+
<fieldset>
|
67 |
+
<legend class="screen-reader-text"><span><?php _e("Link", "ginger"); ?></span></legend>
|
68 |
+
<p><label>
|
69 |
+
<input type="text" name="link_color" value="<?php echo $options["link_color"]; ?>" class="color-field" >
|
70 |
+
|
71 |
+
</label>
|
72 |
+
</p>
|
73 |
+
</fieldset>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
</tbody>
|
77 |
+
</table>
|
78 |
+
|
79 |
+
|
admin/partial/general.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Ginger is currently", "ginger"); ?>: <b><?php if($options["enable_ginger"]) _e("enabled", "ginger"); else _e("disabled", "ginger"); ?></b> </h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</thead>
|
12 |
+
<tbody>
|
13 |
+
<tr>
|
14 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Enable Ginger", "ginger"); ?></th>
|
15 |
+
<td>
|
16 |
+
<fieldset>
|
17 |
+
<legend class="screen-reader-text"><span><?php _e("Enable Ginger", "ginger"); ?></span></legend>
|
18 |
+
<p>
|
19 |
+
<label>
|
20 |
+
<input name="enable_ginger" type="radio" value="1" class="tog" <?php if($options["enable_ginger"] == "1") echo ' checked="checked" '; ?>><?php _e("Enabled", "ginger"); ?>
|
21 |
+
</label>
|
22 |
+
</p>
|
23 |
+
<p>
|
24 |
+
<label>
|
25 |
+
<input name="enable_ginger" type="radio" value="0" class="tog" <?php if($options["enable_ginger"] == "0") echo ' checked="checked" '; ?>><?php _e("Disabled", "ginger"); ?>
|
26 |
+
</label>
|
27 |
+
</p>
|
28 |
+
</fieldset>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
<tr>
|
32 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Do you have a cache system?", "ginger"); ?></th>
|
33 |
+
<td>
|
34 |
+
<fieldset>
|
35 |
+
<legend class="screen-reader-text"><span><?php _e("Do you have a cache system?", "ginger"); ?></span></legend>
|
36 |
+
<p>
|
37 |
+
<label>
|
38 |
+
<input name="ginger_cache" type="radio" value="yes" class="tog" <?php if($options["ginger_cache"] == "yes") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
|
39 |
+
</label>
|
40 |
+
</p>
|
41 |
+
<p>
|
42 |
+
<label>
|
43 |
+
<input name="ginger_cache" type="radio" value="no" class="tog" <?php if($options["ginger_cache"] == "no") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
|
44 |
+
</label>
|
45 |
+
</p>
|
46 |
+
</fieldset>
|
47 |
+
</td>
|
48 |
+
</tr>
|
49 |
+
<tr>
|
50 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Cookie Confirmation Type", "ginger"); ?></th>
|
51 |
+
<td>
|
52 |
+
<fieldset>
|
53 |
+
<legend class="screen-reader-text"><span><?php _e("Cookie Confirmation Type", "ginger"); ?></span></legend>
|
54 |
+
<p>
|
55 |
+
<label>
|
56 |
+
<input name="ginger_opt" type="radio" value="in" class="tog" <?php if($options["ginger_opt"] == "in") echo ' checked="checked" '; ?>><?php _e("Opt-In", "ginger"); ?>
|
57 |
+
</label>
|
58 |
+
<small>
|
59 |
+
(<?php _e("Cookies are disabled until banner is accepted", "ginger"); ?>)
|
60 |
+
</small>
|
61 |
+
</p>
|
62 |
+
<p>
|
63 |
+
<label>
|
64 |
+
<input name="ginger_opt" type="radio" value="out" class="tog" <?php if($options["ginger_opt"] == "out") echo ' checked="checked" '; ?>><?php _e("Opt-Out", "ginger"); ?>
|
65 |
+
</label>
|
66 |
+
<small>
|
67 |
+
(<?php _e("Cookies are disabled only if explicitly requested", "ginger"); ?>)
|
68 |
+
</small>
|
69 |
+
</p>
|
70 |
+
</fieldset>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
<tr>
|
74 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Let scroll to confirm", "ginger"); ?></th>
|
75 |
+
<td>
|
76 |
+
<fieldset>
|
77 |
+
<legend class="screen-reader-text">
|
78 |
+
<span><?php _e("Let scroll to confirm", "ginger"); ?></span>
|
79 |
+
</legend>
|
80 |
+
<p>
|
81 |
+
<label>
|
82 |
+
<input name="ginger_scroll" type="radio" value="1" class="tog" <?php if($options["ginger_scroll"] == "1") echo ' checked="checked" '; ?>><?php _e("Scroll to accept cookie", "ginger"); ?>
|
83 |
+
</label>
|
84 |
+
</p>
|
85 |
+
<p>
|
86 |
+
<label>
|
87 |
+
<input name="ginger_scroll" type="radio" value="0" class="tog" <?php if($options["ginger_scroll"] == "0") echo ' checked="checked" '; ?>><?php _e("Keep banner after scroll", "ginger"); ?>
|
88 |
+
</label>
|
89 |
+
</p>
|
90 |
+
</fieldset>
|
91 |
+
</td>
|
92 |
+
</tr>
|
93 |
+
<tr>
|
94 |
+
<th scope="row" style="padding-left:20px;"><?php _e("Click out of banner to accept cookie", "ginger"); ?></th>
|
95 |
+
<td>
|
96 |
+
<fieldset>
|
97 |
+
<legend class="screen-reader-text">
|
98 |
+
<span><?php _e("Click out of banner to accept cookie", "ginger"); ?></span>
|
99 |
+
</legend>
|
100 |
+
<p>
|
101 |
+
<label>
|
102 |
+
<input name="ginger_click_out" type="radio" value="1" class="tog" <?php if($options["ginger_click_out"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
|
103 |
+
</label>
|
104 |
+
</p>
|
105 |
+
<p>
|
106 |
+
<label>
|
107 |
+
<input name="ginger_click_out" type="radio" value="0" class="tog" <?php if($options["ginger_click_out"] == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
|
108 |
+
</label>
|
109 |
+
</p>
|
110 |
+
</fieldset>
|
111 |
+
</td>
|
112 |
+
</tr>
|
113 |
+
</tbody>
|
114 |
+
</table>
|
115 |
+
|
116 |
+
|
117 |
+
|
admin/partial/link.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Link", "ginger"); ?></h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
<tr>
|
12 |
+
<td>
|
13 |
+
<div data-repeater-list="group-a">
|
14 |
+
<?php
|
15 |
+
|
16 |
+
if ($options) {
|
17 |
+
foreach ($options['group-a'] as $option) {
|
18 |
+
?>
|
19 |
+
<div data-repeater-item>
|
20 |
+
|
21 |
+
URL: <input type="text" name="ginger_url" value="<?php echo $option['ginger_url'];?>"/>
|
22 |
+
|
23 |
+
Enable: SI <input type="radio" name="ginger_url_enable" value="1" <?php if ($option['ginger_url_enable']==1){ echo 'checked';}?>/>
|
24 |
+
NO <input type="radio" name="ginger_url_enable" value="0" <?php if ($option['ginger_url_enable']==0){ echo 'checked';}?>/>
|
25 |
+
|
26 |
+
|
27 |
+
<input data-repeater-delete type="button" value="Delete"/>
|
28 |
+
</div>
|
29 |
+
<?php
|
30 |
+
}
|
31 |
+
}else{
|
32 |
+
?>
|
33 |
+
<div data-repeater-item>
|
34 |
+
|
35 |
+
URL: <input type="text" name="ginger_url" value=""/>
|
36 |
+
|
37 |
+
Enable: SI <input type="radio" name="ginger_url_enable" value="1" />
|
38 |
+
NO <input type="radio" name="ginger_url_enable" value="0" />
|
39 |
+
|
40 |
+
|
41 |
+
<input data-repeater-delete type="button" value="Delete"/>
|
42 |
+
</div>
|
43 |
+
<?php
|
44 |
+
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
</div>
|
48 |
+
<input data-repeater-create type="button" value="Add Url"/>
|
49 |
+
|
50 |
+
</td>
|
51 |
+
|
52 |
+
</tr>
|
53 |
+
</thead>
|
54 |
+
</table>
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
<script src="../wp-content/plugins/ginger/admin/js/jquery.repeater-master/jquery.repeater.js"></script>
|
61 |
+
<script>
|
62 |
+
jQuery(document).ready(function () {
|
63 |
+
'use strict';
|
64 |
+
jQuery('.repeater').repeater({
|
65 |
+
defaultValues: {
|
66 |
+
//'textarea-input': 'foo',
|
67 |
+
'ginger_url': '',
|
68 |
+
//'select-input': 'B',
|
69 |
+
//'checkbox-input': ['A', 'B'],
|
70 |
+
'ginger_url_enable': '1'
|
71 |
+
},
|
72 |
+
show: function () {
|
73 |
+
jQuery(this).slideDown();
|
74 |
+
},
|
75 |
+
hide: function (deleteElement) {
|
76 |
+
if(confirm('Are you sure you want to delete this element?')) {
|
77 |
+
jQuery(this).slideUp(deleteElement);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
});
|
81 |
+
});
|
82 |
+
</script>
|
83 |
+
<?php
|
84 |
+
|
85 |
+
|
86 |
+
?>
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
<?php
|
94 |
+
|
95 |
+
|
admin/partial/policy.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Privacy Policy Setup", "ginger"); ?></h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</thead>
|
12 |
+
<tbody>
|
13 |
+
|
14 |
+
<tr>
|
15 |
+
<th scope="row" style="padding-left:20px;"><label><input name="choice" type="radio" value="page" onclick="select_privacy_page()" <?php if($options != "") echo ' checked="checked" '; ?>> <?php _e("Select your privacy policy page", "ginger"); ?></label></th>
|
16 |
+
</tr>
|
17 |
+
<tr>
|
18 |
+
<td colspan="2">
|
19 |
+
<fieldset>
|
20 |
+
<legend class="screen-reader-text">
|
21 |
+
<span><?php _e("DialogText", "ginger"); ?></span>
|
22 |
+
</legend>
|
23 |
+
<?php
|
24 |
+
|
25 |
+
$args = array(
|
26 |
+
'sort_order' => 'asc',
|
27 |
+
'sort_column' => 'post_title',
|
28 |
+
'hierarchical' => 1,
|
29 |
+
'exclude' => '',
|
30 |
+
'include' => '',
|
31 |
+
'meta_key' => '',
|
32 |
+
'meta_value' => '',
|
33 |
+
'authors' => '',
|
34 |
+
'child_of' => 0,
|
35 |
+
'parent' => -1,
|
36 |
+
'exclude_tree' => '',
|
37 |
+
'number' => '',
|
38 |
+
'offset' => 0,
|
39 |
+
'post_type' => 'page',
|
40 |
+
'post_status' => 'publish',
|
41 |
+
'suppress_filters' => false
|
42 |
+
);
|
43 |
+
$pages = get_pages($args);
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
?>
|
49 |
+
<p>
|
50 |
+
<label>
|
51 |
+
<?php _e('Privacy Policy page','ginger');?>
|
52 |
+
</label>
|
53 |
+
<select name="ginger_privacy_page" id="privacy_page_select" <?php if($options == "") echo ' disabled="true"'; ?>>
|
54 |
+
<option value="">Select page</option>
|
55 |
+
<?php
|
56 |
+
foreach ($pages as $page){
|
57 |
+
?>
|
58 |
+
|
59 |
+
<option value="<?php echo $page->ID;?>" <?php if($options == $page->ID) echo ' selected="selected" '; ?>><?php echo $page->post_title; ?></option>
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
<?php
|
65 |
+
}
|
66 |
+
?>
|
67 |
+
</select>
|
68 |
+
</p>
|
69 |
+
</fieldset>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
<tr>
|
73 |
+
<th scope="row" style="padding-left:20px;"><label><input name="choice" type="radio" value="new_page" onclick="new_privacy_page()"><?php _e("or create your privacy policy page", "ginger"); ?></label></th>
|
74 |
+
</tr>
|
75 |
+
<tr>
|
76 |
+
<td colspan="2"><fieldset>
|
77 |
+
<div id="new_page_privacy" style="display: none">
|
78 |
+
<p>
|
79 |
+
<label>
|
80 |
+
<?php _e("Title", "ginger"); ?><input name="privacy_page_title" id="privacy_page_title" type="text" value="Privacy Policy">
|
81 |
+
</label>
|
82 |
+
</p>
|
83 |
+
<p>
|
84 |
+
<label>
|
85 |
+
<fieldset>
|
86 |
+
<legend class="screen-reader-text">
|
87 |
+
<span><?php _e("DialogText", "ginger"); ?></span>
|
88 |
+
</legend>
|
89 |
+
<?php
|
90 |
+
wp_editor( '', "ginger_dialog_text", array( 'textarea_name' => "privacy_page_content" , 'media_buttons' => false, 'textarea_rows' => 10, 'teeny' => true ) );
|
91 |
+
?>
|
92 |
+
</fieldset>
|
93 |
+
</label>
|
94 |
+
</p>
|
95 |
+
</div>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
</tbody>
|
99 |
+
</table>
|
admin/partial/url.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<table class="form-table striped">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<td colspan="2">
|
8 |
+
<h2><?php _e("Link", "ginger"); ?></h2>
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
<tr>
|
12 |
+
<td>
|
13 |
+
<div data-repeater-list="group-a">
|
14 |
+
<?php
|
15 |
+
|
16 |
+
if ($options['group-a']) {
|
17 |
+
foreach ($options['group-a'] as $option) {
|
18 |
+
?>
|
19 |
+
<div data-repeater-item>
|
20 |
+
|
21 |
+
URL: <input type="text" name="ginger_url" value="<?php echo $option['ginger_url'];?>"/>
|
22 |
+
|
23 |
+
Enable: SI <input type="radio" name="ginger_url_enable" value="1" <?php if ($option['ginger_url_enable']==1){ echo 'checked';}?>/>
|
24 |
+
NO <input type="radio" name="ginger_url_enable" value="0" <?php if ($option['ginger_url_enable']==0){ echo 'checked';}?>/>
|
25 |
+
|
26 |
+
|
27 |
+
<input data-repeater-delete type="button" value="Delete" class="button button-primary"/>
|
28 |
+
</div>
|
29 |
+
<?php
|
30 |
+
}
|
31 |
+
}else{
|
32 |
+
?>
|
33 |
+
<div data-repeater-item>
|
34 |
+
|
35 |
+
<?php _e("URL", "ginger"); ?>: <input type="text" name="ginger_url" value=""/>
|
36 |
+
|
37 |
+
<?php _e("Enable", "ginger"); ?>: <?php _e("YES", "ginger"); ?> <input type="radio" name="ginger_url_enable" value="1" />
|
38 |
+
<?php _e("NO", "ginger"); ?> <input type="radio" name="ginger_url_enable" value="0" />
|
39 |
+
|
40 |
+
|
41 |
+
<input data-repeater-delete type="button" value="Delete" class="button button-primary"/>
|
42 |
+
</div>
|
43 |
+
<?php
|
44 |
+
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
|
48 |
+
|
49 |
+
</div>
|
50 |
+
<p style="margin-top: 20px"><input data-repeater-create type="button" class="button button-primary" value="Add Url"/></p>
|
51 |
+
|
52 |
+
</td>
|
53 |
+
|
54 |
+
</tr>
|
55 |
+
</thead>
|
56 |
+
</table>
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
<script src="../wp-content/plugins/ginger/admin/js/jquery.repeater-master/jquery.repeater.js"></script>
|
63 |
+
<script>
|
64 |
+
jQuery(document).ready(function () {
|
65 |
+
'use strict';
|
66 |
+
jQuery('.repeater').repeater({
|
67 |
+
defaultValues: {
|
68 |
+
//'textarea-input': 'foo',
|
69 |
+
'ginger_url': '',
|
70 |
+
//'select-input': 'B',
|
71 |
+
//'checkbox-input': ['A', 'B'],
|
72 |
+
'ginger_url_enable': '1'
|
73 |
+
},
|
74 |
+
show: function () {
|
75 |
+
jQuery(this).slideDown();
|
76 |
+
},
|
77 |
+
hide: function (deleteElement) {
|
78 |
+
if(confirm('Are you sure you want to delete this element?')) {
|
79 |
+
jQuery(this).slideUp(deleteElement);
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
84 |
+
});
|
85 |
+
});
|
86 |
+
</script>
|
87 |
+
<?php
|
88 |
+
|
89 |
+
|
90 |
+
?>
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
<?php
|
98 |
+
|
99 |
+
|
front/css/cookies-enabler.css
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*{
|
2 |
+
box-sizing: border-box;
|
3 |
+
margin: 0;
|
4 |
+
padding: 0;
|
5 |
+
}
|
6 |
+
|
7 |
+
p{
|
8 |
+
margin-bottom: 1em;
|
9 |
+
}
|
10 |
+
|
11 |
+
.ginger-banner{
|
12 |
+
position: fixed;
|
13 |
+
left: 0;
|
14 |
+
right: 0;
|
15 |
+
background-color: white;
|
16 |
+
padding: 1em;
|
17 |
+
color: #232323;
|
18 |
+
font-size: 1em;
|
19 |
+
z-index: 99999998 !important;
|
20 |
+
}
|
21 |
+
|
22 |
+
.ginger-banner.top{
|
23 |
+
top: 0;
|
24 |
+
border-bottom: 1px solid #000;
|
25 |
+
}
|
26 |
+
.ginger-banner.bottom{
|
27 |
+
bottom: 0;
|
28 |
+
border-top: 1px solid #000;
|
29 |
+
}
|
30 |
+
.ginger-banner.dialog{
|
31 |
+
width: 300px;
|
32 |
+
border: 1px solid #000;
|
33 |
+
box-shadow:1px 1px 2px #000;
|
34 |
+
-moz-box-shadow:1px 1px 2px #000;
|
35 |
+
-webkit-box-shadow:1px 1px 2px #000;
|
36 |
+
right: 10px;
|
37 |
+
left: initial;
|
38 |
+
}
|
39 |
+
.ginger-banner.dialog.top{
|
40 |
+
top: 10px;
|
41 |
+
}
|
42 |
+
.ginger-banner.dialog.bottom{
|
43 |
+
bottom: 10px;
|
44 |
+
}
|
45 |
+
.ginger-banner div.ginger-button-wrapper{
|
46 |
+
width: 100%;
|
47 |
+
float: left;
|
48 |
+
}
|
49 |
+
.ginger-banner .ginger-button-wrapper div.ginger-button{
|
50 |
+
margin-left: auto;
|
51 |
+
margin-right: auto;
|
52 |
+
width: 40%;
|
53 |
+
}
|
54 |
+
.ginger-accept, .ginger-dismiss, .ginger-disable{
|
55 |
+
width: 160px;
|
56 |
+
float: left;
|
57 |
+
text-align: center;
|
58 |
+
margin-top: 8px !important;
|
59 |
+
margin-bottom: 6px !important;
|
60 |
+
display: block;
|
61 |
+
padding: 8px 16px !important;
|
62 |
+
background-color: #f1d600 !important;
|
63 |
+
color: #111 !important;
|
64 |
+
margin-right: 12px !important;
|
65 |
+
text-decoration: none !important;
|
66 |
+
font-size:12pt !important;
|
67 |
+
font-weight: 600;
|
68 |
+
letter-spacing: -0.05em;
|
69 |
+
transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, box-shadow 0.2s ease-in-out 0s;
|
70 |
+
-moz-transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, -moz-box-shadow 0.2s ease-in-out 0s;
|
71 |
+
-webkit-transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, -webkit-box-shadow 0.2s ease-in-out 0s;
|
72 |
+
}
|
73 |
+
|
74 |
+
.ginger-disable{
|
75 |
+
background-color: #aaa;
|
76 |
+
}
|
77 |
+
|
78 |
+
.ginger-accept:hover,
|
79 |
+
.ginger-dismiss:hover,
|
80 |
+
.ginger-disable:hover{
|
81 |
+
margin-top: 8px !important;
|
82 |
+
margin-bottom: 6px !important;
|
83 |
+
display: block;
|
84 |
+
padding: 8px 16px !important;
|
85 |
+
background-color: #f1d600 !important;
|
86 |
+
color: #111 !important;
|
87 |
+
margin-right: 12px !important;
|
88 |
+
text-decoration: none !important;
|
89 |
+
font-size:12pt !important;
|
90 |
+
font-weight: 600;
|
91 |
+
letter-spacing: -0.05em;
|
92 |
+
|
93 |
+
box-shadow:1px 1px 2px #000;
|
94 |
+
-moz-box-shadow:1px 1px 2px #000;
|
95 |
+
-webkit-box-shadow:1px 1px 2px #000;
|
96 |
+
|
97 |
+
transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, box-shadow 0.2s ease-in-out 0s;
|
98 |
+
-moz-transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, -moz-box-shadow 0.2s ease-in-out 0s;
|
99 |
+
-webkit-transition:background 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, -webkit-box-shadow 0.2s ease-in-out 0s;
|
100 |
+
}
|
101 |
+
|
102 |
+
.ginger-dismiss{
|
103 |
+
position: absolute;
|
104 |
+
font-size: .8em;
|
105 |
+
right: 1em;
|
106 |
+
top: 1em;
|
107 |
+
background-color: #ccc;
|
108 |
+
color: #333;
|
109 |
+
}
|
110 |
+
|
111 |
+
.ginger-iframe-placeholder{
|
112 |
+
padding: 1em;
|
113 |
+
background-color: #eee;
|
114 |
+
margin: 1em 0;
|
115 |
+
text-align: center;
|
116 |
+
}
|
117 |
+
.ginger-iframe-placeholder a.ginger-accept{
|
118 |
+
float: none;
|
119 |
+
margin-left: auto;
|
120 |
+
margin-right: auto !important;
|
121 |
+
}
|
122 |
+
|
123 |
+
.ginger-iframe-placeholder p{
|
124 |
+
margin: 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
iframe{
|
128 |
+
width: 100%;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
/* Dark theme */
|
134 |
+
|
135 |
+
.ginger-banner.dark{
|
136 |
+
background: #000000;
|
137 |
+
color: white;
|
138 |
+
}
|
139 |
+
.ginger-banner.dark a{
|
140 |
+
color: #d7d7d7;
|
141 |
+
text-decoration: underline;
|
142 |
+
}
|
143 |
+
.ginger-banner.dialog{
|
144 |
+
border: 1px solid white;
|
145 |
+
box-shadow:1px 1px 2px white;
|
146 |
+
-moz-box-shadow:1px 1px 2px white;
|
147 |
+
-webkit-box-shadow:1px 1px 2px white;
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
|
front/gingerfront.utils.php
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: matteobarale
|
5 |
+
* Date: 11/06/15
|
6 |
+
* Time: 15:48
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
// Register style sheet.
|
11 |
+
add_action( 'wp_enqueue_scripts', 'ginger_style_script' );
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register style sheet.
|
15 |
+
*/
|
16 |
+
function ginger_style_script() {
|
17 |
+
wp_register_style( 'ginger-style', plugin_dir_url( __FILE__ ) . 'css/cookies-enabler.css' );
|
18 |
+
wp_enqueue_style( 'ginger-style' );
|
19 |
+
}
|
20 |
+
|
21 |
+
function ginger_scirpt(){ ?>
|
22 |
+
<?php
|
23 |
+
//Recupero le informazioni necessarie per stampare il banner
|
24 |
+
$option_ginger_general = get_option('ginger_general');
|
25 |
+
$option_ginger_bar = get_option('ginger_banner');
|
26 |
+
if($option_ginger_general['enable_ginger'] != 1) return;
|
27 |
+
//Verifoco la tipologia di accettazione dei cookie
|
28 |
+
if($option_ginger_general['ginger_scroll'] == 1):
|
29 |
+
$type_scroll = 'true';
|
30 |
+
else:
|
31 |
+
$type_scroll = 'false';
|
32 |
+
endif;
|
33 |
+
//Verifico se è abilitato il click sulla pagina
|
34 |
+
if($option_ginger_general['ginger_click_out'] == 1):
|
35 |
+
$click_outside = 'true';
|
36 |
+
else:
|
37 |
+
$click_outside = 'false';
|
38 |
+
endif;
|
39 |
+
//Recupero le impostazioni per il banner
|
40 |
+
//Testo Banner
|
41 |
+
if($option_ginger_bar['ginger_banner_text']):
|
42 |
+
$ginger_text = $option_ginger_bar['ginger_banner_text'];
|
43 |
+
//Recupero privacy policy se presente
|
44 |
+
if(strpos($ginger_text, '{{privacy_page}}') !== false):
|
45 |
+
$privacy_policy = get_option('ginger_policy', true);
|
46 |
+
$privacy_policy = get_post($privacy_policy);
|
47 |
+
$privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . $privacy_policy->post_title . '</a>';
|
48 |
+
$ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
|
49 |
+
endif;
|
50 |
+
|
51 |
+
else:
|
52 |
+
$ginger_text = 'This website uses cookies.';
|
53 |
+
endif;
|
54 |
+
//Definisco se è bar modal top o bottom
|
55 |
+
if($option_ginger_bar['ginger_banner_position'] == 'top'):
|
56 |
+
$banner_class = 'top';
|
57 |
+
else:
|
58 |
+
$banner_class = 'bottom';
|
59 |
+
endif;
|
60 |
+
if($option_ginger_bar['ginger_banner_type'] == 'dialog'):
|
61 |
+
$banner_class .= ' dialog';
|
62 |
+
endif;
|
63 |
+
if($option_ginger_bar['ginger_banner_type'] == 'dialog'):
|
64 |
+
$banner_class .= ' dialog';
|
65 |
+
endif;
|
66 |
+
if($option_ginger_bar['theme_ginger'] == 'dark'):
|
67 |
+
$banner_class .= ' dark';
|
68 |
+
endif;
|
69 |
+
//Recupero Testo Iframe
|
70 |
+
if($option_ginger_bar['ginger_Iframe_text']):
|
71 |
+
$ginger_iframe_text = $option_ginger_bar['ginger_Iframe_text'];
|
72 |
+
else:
|
73 |
+
$ginger_iframe_text = 'This website uses cookies.';
|
74 |
+
endif;
|
75 |
+
//Recupero Label
|
76 |
+
if($option_ginger_bar['accept_cookie_button_text']):
|
77 |
+
$label_accept_cookie = $option_ginger_bar['accept_cookie_button_text'];
|
78 |
+
else:
|
79 |
+
$label_accept_cookie = __('Enable Cookies', 'ginger');
|
80 |
+
endif;
|
81 |
+
//Recupero Label
|
82 |
+
if($option_ginger_bar['disable_cookie_button_text']):
|
83 |
+
$label_disable_cookie = $option_ginger_bar['disable_cookie_button_text'];
|
84 |
+
else:
|
85 |
+
$label_disable_cookie = __('Disable Cookies', 'ginger');
|
86 |
+
endif;
|
87 |
+
//Recupero style custom
|
88 |
+
if($option_ginger_bar['background_color'] || $option_ginger_bar['text_color'] ||$option_ginger_bar['link_color'] ): ?>
|
89 |
+
<style>
|
90 |
+
.ginger-banner{
|
91 |
+
<?php if($option_ginger_bar['background_color']): ?> background-color: <?php echo $option_ginger_bar['background_color']; ?>;<?php endif; ?>
|
92 |
+
<?php if($option_ginger_bar['text_color']): ?> color: <?php echo $option_ginger_bar['text_color']; ?>;<?php endif; ?>
|
93 |
+
}
|
94 |
+
<?php if($option_ginger_bar['link_color']): ?>
|
95 |
+
.ginger-banner a{
|
96 |
+
<?php if($option_ginger_bar['link_color']): ?> color: <?php echo $option_ginger_bar['link_color']; ?>;<?php endif; ?>
|
97 |
+
}
|
98 |
+
<?php endif;?>
|
99 |
+
</style>
|
100 |
+
<?php endif;?>
|
101 |
+
<!-- Ginger Script -->
|
102 |
+
<script src="<?php echo plugin_dir_url( __FILE__ ); ?>js/cookies-enabler.min.js"></script>
|
103 |
+
<!-- Init the script -->
|
104 |
+
<script>
|
105 |
+
COOKIES_ENABLER.init({
|
106 |
+
scriptClass: 'ginger-script',
|
107 |
+
iframeClass: 'ginger-iframe',
|
108 |
+
acceptClass: 'ginger-accept',
|
109 |
+
disableClass: 'ginger-disable',
|
110 |
+
dismissClass: 'ginger-dismiss',
|
111 |
+
bannerClass: 'ginger-banner <?php echo $banner_class; ?>',
|
112 |
+
bannerHTML:
|
113 |
+
document.getElementById('ginger-banner-html') !== null ?
|
114 |
+
document.getElementById('ginger-banner-html').innerHTML :
|
115 |
+
'<p>'
|
116 |
+
+ '<?php echo $ginger_text; ?>'
|
117 |
+
+ '<\/p>'
|
118 |
+
+ '<div class="ginger-button-wrapper">'
|
119 |
+
+ '<div class="ginger-button">'
|
120 |
+
+ '<a href="#" class="ginger-accept">'
|
121 |
+
+ '<?php echo $label_accept_cookie; ?>'
|
122 |
+
+ '<\/a>'
|
123 |
+
<?php if($option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
|
124 |
+
+ '<a href="#" class="ginger-disable">'
|
125 |
+
+ '<?php echo $label_disable_cookie; ?>'
|
126 |
+
+ '<\/a>'
|
127 |
+
<?php endif; ?>
|
128 |
+
+ '<\/div>'
|
129 |
+
+ '<\/div>',
|
130 |
+
eventScroll: <?php echo $type_scroll; ?>,
|
131 |
+
scrollOffset: 20,
|
132 |
+
clickOutside: <?php echo $click_outside; ?>,
|
133 |
+
cookieName: 'ginger-cookie',
|
134 |
+
cookieDuration: '365',
|
135 |
+
iframesPlaceholder: true,
|
136 |
+
iframesPlaceholderClass: 'ginger-iframe-placeholder',
|
137 |
+
iframesPlaceholderHTML:
|
138 |
+
document.getElementById('ginger-iframePlaceholder-html') !== null ?
|
139 |
+
document.getElementById('ginger-iframePlaceholder-html').innerHTML :
|
140 |
+
'<p><?php echo $ginger_iframe_text; ?>'
|
141 |
+
+'<a href="#" class="ginger-accept"><?php echo $label_accept_cookie; ?></a>'
|
142 |
+
+'<\/p>',
|
143 |
+
onEnable: function(){
|
144 |
+
//console.log('enable callback');
|
145 |
+
},
|
146 |
+
onDismiss: function(){
|
147 |
+
//console.log('dismiss callback');
|
148 |
+
}
|
149 |
+
});
|
150 |
+
</script>
|
151 |
+
<!-- End Ginger Script -->
|
152 |
+
|
153 |
+
<?php }
|
154 |
+
|
155 |
+
add_action('wp_footer', 'ginger_scirpt');
|
156 |
+
|
157 |
+
//Ginger Start
|
158 |
+
function ginger_run(){
|
159 |
+
$option_ginger_general = get_option('ginger_general');
|
160 |
+
if($option_ginger_general['enable_ginger'] != 1) return;
|
161 |
+
if($_COOKIE['ginger-cookie'] && $_COOKIE['ginger-cookie'] == 'Y'):
|
162 |
+
if($option_ginger_general['ginger_cache'] == 'no') return;
|
163 |
+
endif;
|
164 |
+
if($option_ginger_general['ginger_opt'] == 'in'):
|
165 |
+
ob_start();
|
166 |
+
add_action('shutdown', '__shutdown', 0);
|
167 |
+
add_filter('final_output', 'ginger_parse_dom', $output);
|
168 |
+
endif;
|
169 |
+
}
|
170 |
+
add_action('init', 'ginger_run');
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
function __shutdown(){
|
175 |
+
$final = '';
|
176 |
+
|
177 |
+
// We'll need to get the number of ob levels we're in, so that we can iterate over each, collecting
|
178 |
+
// that buffer's output into the final output.
|
179 |
+
$levels = count(ob_get_level());
|
180 |
+
|
181 |
+
for ($i = 0; $i < $levels; $i++){
|
182 |
+
$final .= ob_get_clean();
|
183 |
+
}
|
184 |
+
|
185 |
+
// Apply any filters to the final output
|
186 |
+
echo apply_filters('final_output', $final);
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
+
function ginger_parse_dom($output){
|
193 |
+
|
194 |
+
$ginger_script_tags = array(
|
195 |
+
'platform.twitter.com/widgets.js',
|
196 |
+
'apis.google.com/js/plusone.js',
|
197 |
+
'apis.google.com/js/platform.js',
|
198 |
+
'connect.facebook.net',
|
199 |
+
'platform.linkedin.com',
|
200 |
+
'assets.pinterest.com',
|
201 |
+
'www.youtube.com/iframe_api',
|
202 |
+
'www.google-analytics.com/analytics.js',
|
203 |
+
'google-analytics.com/ga.js'
|
204 |
+
);
|
205 |
+
do_action('ginger_add_scripts');
|
206 |
+
|
207 |
+
$ginger_iframe_tags = array(
|
208 |
+
'youtube.com',
|
209 |
+
'platform.twitter.com',
|
210 |
+
'www.facebook.com/plugins/like.php',
|
211 |
+
'apis.google.com',
|
212 |
+
'www.google.com/maps/embed/'
|
213 |
+
);
|
214 |
+
do_action('ginger_add_iframe');
|
215 |
+
|
216 |
+
libxml_use_internal_errors(true);
|
217 |
+
$doc = new DOMDocument();
|
218 |
+
|
219 |
+
// load the HTML string we want to strip
|
220 |
+
$doc->loadHTML($output);
|
221 |
+
|
222 |
+
// get all the script tags
|
223 |
+
$script_tags = $doc->getElementsByTagName('script');
|
224 |
+
|
225 |
+
foreach($script_tags as $script):
|
226 |
+
$src_script = $script->getAttribute('src');
|
227 |
+
if($src_script):
|
228 |
+
if(strpos_arr($src_script, $ginger_script_tags) !== false ):
|
229 |
+
$script->setAttribute("class", "ginger-script");
|
230 |
+
$script->setAttribute("type", "text/plain");
|
231 |
+
endif;
|
232 |
+
endif;
|
233 |
+
if($script->nodeValue):
|
234 |
+
$key = strpos_arr($script->nodeValue, $ginger_script_tags);
|
235 |
+
if($key !== false ):
|
236 |
+
if($ginger_script_tags[$key] == 'www.google-analytics.com/analytics.js' || $ginger_script_tags[$key] == 'google-analytics.com/ga.js')
|
237 |
+
if(strpos($script->nodeValue, 'anonymizeIp') !== false ):
|
238 |
+
continue;
|
239 |
+
endif;
|
240 |
+
$script->setAttribute("class", "ginger-script");
|
241 |
+
$script->setAttribute("type", "text/plain");
|
242 |
+
endif;
|
243 |
+
endif;
|
244 |
+
endforeach;
|
245 |
+
// get all the iframe tags
|
246 |
+
$iframe_tags = $doc->getElementsByTagName('iframe');
|
247 |
+
foreach($iframe_tags as $iframe):
|
248 |
+
$src_iframe = $iframe->getAttribute('src');
|
249 |
+
if($src_iframe):
|
250 |
+
if(strpos_arr($src_iframe, $ginger_iframe_tags) !== false ):
|
251 |
+
$iframe->removeAttribute('src');
|
252 |
+
$iframe->setAttribute("data-ce-src", $src_iframe);
|
253 |
+
$iframe->setAttribute("class", "ginger-iframe");
|
254 |
+
endif;
|
255 |
+
endif;
|
256 |
+
endforeach;
|
257 |
+
// get the HTML string back
|
258 |
+
$output = $doc->saveHTML();
|
259 |
+
libxml_use_internal_errors(false);
|
260 |
+
return $output;
|
261 |
+
}
|
262 |
+
|
263 |
+
function strpos_arr($haystack, $needle) {
|
264 |
+
if(!is_array($needle)) $needle = array($needle);
|
265 |
+
foreach($needle as $key => $what) {
|
266 |
+
if(($pos = strpos($haystack, $what))!==false) return $key;
|
267 |
+
}
|
268 |
+
return false;
|
269 |
+
}
|
front/js/cookies-enabler.js
ADDED
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Made with milk and cookies by Nicholas Ruggeri and Gianmarco Simone
|
2 |
+
// https://github.com/nicholasruggeri/cookies-enabler
|
3 |
+
// https://github.com/nicholasruggeri
|
4 |
+
// https://github.com/gsimone
|
5 |
+
|
6 |
+
window.COOKIES_ENABLER = window.COOKIES_ENABLER || (function () {
|
7 |
+
|
8 |
+
'use strict'
|
9 |
+
|
10 |
+
var defaults = {
|
11 |
+
|
12 |
+
scriptClass: 'ce-script',
|
13 |
+
iframeClass: 'ce-iframe',
|
14 |
+
|
15 |
+
acceptClass: 'ce-accept',
|
16 |
+
disableClass: 'ce-disable',
|
17 |
+
dismissClass: 'ce-dismiss',
|
18 |
+
|
19 |
+
bannerClass: 'ce-banner',
|
20 |
+
bannerHTML:
|
21 |
+
|
22 |
+
document.getElementById('ce-banner-html') !== null ?
|
23 |
+
|
24 |
+
document.getElementById('ce-banner-html').innerHTML :
|
25 |
+
|
26 |
+
'<p>This website uses cookies. '
|
27 |
+
+'<a href="#" class="ce-accept">'
|
28 |
+
+'Enable Cookies'
|
29 |
+
+'</a>'
|
30 |
+
+'</p>',
|
31 |
+
eventScroll: false,
|
32 |
+
scrollOffset: 200,
|
33 |
+
clickOutside: false,
|
34 |
+
cookieName: 'ce-cookie',
|
35 |
+
cookieDuration: '365',
|
36 |
+
|
37 |
+
iframesPlaceholder: true,
|
38 |
+
iframesPlaceholderHTML:
|
39 |
+
|
40 |
+
document.getElementById('ce-iframePlaceholder-html') !== null ?
|
41 |
+
|
42 |
+
document.getElementById('ce-iframePlaceholder-html').innerHTML :
|
43 |
+
|
44 |
+
'<p>To view this content you need to'
|
45 |
+
+'<a href="#" class="ce-accept">Enable Cookies</a>'
|
46 |
+
+'</p>',
|
47 |
+
|
48 |
+
iframesPlaceholderClass: 'ce-iframe-placeholder',
|
49 |
+
|
50 |
+
onEnable: '',
|
51 |
+
onDismiss: '',
|
52 |
+
onDisable: ''
|
53 |
+
|
54 |
+
},
|
55 |
+
opts, domElmts, start_Y;
|
56 |
+
|
57 |
+
function _extend() {
|
58 |
+
|
59 |
+
var i, key;
|
60 |
+
for (i=1; i<arguments.length; i++)
|
61 |
+
for (key in arguments[i])
|
62 |
+
if(arguments[i].hasOwnProperty(key))
|
63 |
+
arguments[0][key] = arguments[i][key];
|
64 |
+
return arguments[0];
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
function _debounce(func, wait, immediate) {
|
69 |
+
var timeout;
|
70 |
+
return function() {
|
71 |
+
var context = this, args = arguments;
|
72 |
+
var later = function() {
|
73 |
+
timeout = null;
|
74 |
+
if (!immediate) func.apply(context, args);
|
75 |
+
};
|
76 |
+
var callNow = immediate && !timeout;
|
77 |
+
clearTimeout(timeout);
|
78 |
+
timeout = setTimeout(later, wait);
|
79 |
+
if (callNow) func.apply(context, args);
|
80 |
+
};
|
81 |
+
}
|
82 |
+
|
83 |
+
function _getClosestParentWithClass(el, parentClass) {
|
84 |
+
|
85 |
+
do {
|
86 |
+
if (_hasClass(el, parentClass)) {
|
87 |
+
// tag name is found! let's return it. :)
|
88 |
+
return el;
|
89 |
+
}
|
90 |
+
} while (el = el.parentNode);
|
91 |
+
|
92 |
+
return null;
|
93 |
+
}
|
94 |
+
|
95 |
+
function _hasClass(el, cls) {
|
96 |
+
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
97 |
+
}
|
98 |
+
|
99 |
+
var handleScroll = function() {
|
100 |
+
|
101 |
+
if (Math.abs(window.pageYOffset - start_Y) > opts.scrollOffset) enableCookies();
|
102 |
+
|
103 |
+
};
|
104 |
+
|
105 |
+
var bindUI = function() {
|
106 |
+
|
107 |
+
domElmts = {
|
108 |
+
accept: document.getElementsByClassName(opts.acceptClass),
|
109 |
+
disable: document.getElementsByClassName(opts.disableClass),
|
110 |
+
banner: document.getElementsByClassName(opts.bannerClass),
|
111 |
+
dismiss: document.getElementsByClassName(opts.dismissClass)
|
112 |
+
}
|
113 |
+
|
114 |
+
var i,
|
115 |
+
accept = domElmts.accept,
|
116 |
+
accept_l = accept.length,
|
117 |
+
disable = domElmts.disable,
|
118 |
+
disable_l = disable.length,
|
119 |
+
dismiss = domElmts.dismiss,
|
120 |
+
dismiss_l = dismiss.length;
|
121 |
+
|
122 |
+
if (opts.eventScroll) {
|
123 |
+
window.addEventListener('load', function(){
|
124 |
+
|
125 |
+
start_Y = window.pageYOffset;
|
126 |
+
window.addEventListener('scroll', handleScroll);
|
127 |
+
|
128 |
+
});
|
129 |
+
}
|
130 |
+
|
131 |
+
if (opts.clickOutside) {
|
132 |
+
|
133 |
+
document.addEventListener("click", function(e){
|
134 |
+
|
135 |
+
var element = e.target;
|
136 |
+
|
137 |
+
// ignore the click if it is inside of any of the elements created by this plugin
|
138 |
+
if(
|
139 |
+
_getClosestParentWithClass(element, opts.iframesPlaceholderClass) ||
|
140 |
+
_getClosestParentWithClass(element, opts.disableClass) ||
|
141 |
+
_getClosestParentWithClass(element, opts.bannerClass) ||
|
142 |
+
_getClosestParentWithClass(element, opts.dismissClass) ||
|
143 |
+
_getClosestParentWithClass(element, opts.disableClass)
|
144 |
+
){
|
145 |
+
return false;
|
146 |
+
}
|
147 |
+
|
148 |
+
enableCookies();
|
149 |
+
|
150 |
+
});
|
151 |
+
}
|
152 |
+
|
153 |
+
for (i = 0; i < accept_l; i++) {
|
154 |
+
|
155 |
+
accept[i].addEventListener("click", function(ev) {
|
156 |
+
ev.preventDefault();
|
157 |
+
enableCookies(ev);
|
158 |
+
});
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
for (i = 0; i < disable_l; i++) {
|
163 |
+
|
164 |
+
disable[i].addEventListener("click", function(ev) {
|
165 |
+
ev.preventDefault();
|
166 |
+
disableCookies(ev);
|
167 |
+
});
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
for (i = 0; i < dismiss_l; i++) {
|
172 |
+
|
173 |
+
dismiss[i].addEventListener("click", function (ev) {
|
174 |
+
ev.preventDefault();
|
175 |
+
banner.dismiss();
|
176 |
+
});
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
};
|
181 |
+
|
182 |
+
var init = function(options) {
|
183 |
+
|
184 |
+
opts = _extend({}, defaults, options);
|
185 |
+
|
186 |
+
if (cookie.get() == 'Y') {
|
187 |
+
|
188 |
+
if (typeof opts.onEnable === "function") opts.onEnable();
|
189 |
+
|
190 |
+
scripts.get();
|
191 |
+
iframes.get();
|
192 |
+
|
193 |
+
} else if (cookie.get() == 'N'){
|
194 |
+
|
195 |
+
if (typeof opts.onDisable === "function") opts.onDisable();
|
196 |
+
|
197 |
+
iframes.hide();
|
198 |
+
bindUI();
|
199 |
+
|
200 |
+
} else {
|
201 |
+
|
202 |
+
banner.create();
|
203 |
+
iframes.hide();
|
204 |
+
bindUI();
|
205 |
+
|
206 |
+
}
|
207 |
+
};
|
208 |
+
|
209 |
+
var enableCookies = _debounce(function(event) {
|
210 |
+
|
211 |
+
if (typeof event != "undefined" && event.type === 'click'){
|
212 |
+
|
213 |
+
event.preventDefault();
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
if (cookie.get() != 'Y') {
|
218 |
+
|
219 |
+
cookie.set();
|
220 |
+
scripts.get();
|
221 |
+
|
222 |
+
iframes.get();
|
223 |
+
iframes.removePlaceholders();
|
224 |
+
|
225 |
+
banner.dismiss();
|
226 |
+
window.removeEventListener('scroll', handleScroll);
|
227 |
+
|
228 |
+
if (typeof opts.onEnable === "function") opts.onEnable();
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
}, 250, false);
|
233 |
+
|
234 |
+
var disableCookies = function(event){
|
235 |
+
|
236 |
+
if (typeof event != "undefined" && event.type === 'click'){
|
237 |
+
|
238 |
+
event.preventDefault();
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
if (cookie.get() != 'N'){
|
243 |
+
|
244 |
+
cookie.set('N');
|
245 |
+
|
246 |
+
banner.dismiss();
|
247 |
+
window.removeEventListener('scroll', handleScroll);
|
248 |
+
|
249 |
+
if (typeof opts.onDisable === "function") opts.onDisable();
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
var banner = (function() {
|
256 |
+
|
257 |
+
function create() {
|
258 |
+
|
259 |
+
var el = '<div class="'+ opts.bannerClass +'">'
|
260 |
+
+ opts.bannerHTML
|
261 |
+
+'</div>';
|
262 |
+
|
263 |
+
document.body.insertAdjacentHTML('beforeend', el);
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
function dismiss(){
|
268 |
+
|
269 |
+
domElmts.banner[0].style.display = 'none';
|
270 |
+
|
271 |
+
if (typeof opts.onDismiss === "function") opts.onDismiss();
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
return{
|
276 |
+
|
277 |
+
create: create,
|
278 |
+
dismiss: dismiss
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
})();
|
283 |
+
|
284 |
+
var cookie = (function() {
|
285 |
+
|
286 |
+
function set(val){
|
287 |
+
|
288 |
+
var value = typeof val !== "undefined" ? val : "Y",
|
289 |
+
date, expires;
|
290 |
+
|
291 |
+
if (opts.cookieDuration) {
|
292 |
+
date = new Date();
|
293 |
+
date.setTime(date.getTime()+(opts.cookieDuration*24*60*60*1000));
|
294 |
+
expires = "; expires="+date.toGMTString();
|
295 |
+
} else {
|
296 |
+
expires = "";
|
297 |
+
}
|
298 |
+
document.cookie = opts.cookieName +"="+ value+expires +"; path=/";
|
299 |
+
}
|
300 |
+
|
301 |
+
function get(){
|
302 |
+
|
303 |
+
var cookies = document.cookie.split(";"),
|
304 |
+
l = cookies.length,
|
305 |
+
i, x, y;
|
306 |
+
|
307 |
+
for (i = 0; i < l; i++){
|
308 |
+
x = cookies[i].substr(0,cookies[i].indexOf("="));
|
309 |
+
y = cookies[i].substr(cookies[i].indexOf("=")+1);
|
310 |
+
x = x.replace(/^\s+|\s+$/g,"");
|
311 |
+
if (x == opts.cookieName) {
|
312 |
+
return unescape(y);
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
}
|
317 |
+
|
318 |
+
return{
|
319 |
+
set: set,
|
320 |
+
get: get
|
321 |
+
}
|
322 |
+
|
323 |
+
})();
|
324 |
+
|
325 |
+
var iframes = (function() {
|
326 |
+
|
327 |
+
function makePlaceholder(iframe) {
|
328 |
+
|
329 |
+
var placeholderElement = document.createElement('div');
|
330 |
+
|
331 |
+
placeholderElement.className = opts.iframesPlaceholderClass;
|
332 |
+
|
333 |
+
placeholderElement.innerHTML = opts.iframesPlaceholderHTML;
|
334 |
+
|
335 |
+
iframe.parentNode.insertBefore(placeholderElement, iframe);
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
function removePlaceholders() {
|
340 |
+
|
341 |
+
var iframePlaceholders = document.getElementsByClassName(opts.iframesPlaceholderClass),
|
342 |
+
n = iframePlaceholders.length,
|
343 |
+
i;
|
344 |
+
|
345 |
+
for (i = n - 1; i >= 0; i--){
|
346 |
+
|
347 |
+
iframePlaceholders[i].remove();
|
348 |
+
|
349 |
+
}
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
function hide() {
|
354 |
+
|
355 |
+
var iframes = document.getElementsByClassName(opts.iframeClass),
|
356 |
+
n = iframes.length,
|
357 |
+
src, iframe, i;
|
358 |
+
|
359 |
+
for (i = 0; i < n; i++){
|
360 |
+
|
361 |
+
iframe = iframes[i];
|
362 |
+
iframe.style.display = 'none';
|
363 |
+
|
364 |
+
if (opts.iframesPlaceholder) makePlaceholder(iframe);
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
function get() {
|
371 |
+
|
372 |
+
var iframes = document.getElementsByClassName(opts.iframeClass),
|
373 |
+
n = iframes.length,
|
374 |
+
src, iframe, i;
|
375 |
+
|
376 |
+
for (i = 0; i < n; i++){
|
377 |
+
|
378 |
+
iframe = iframes[i];
|
379 |
+
|
380 |
+
src = iframe.attributes[ 'data-ce-src' ].value;
|
381 |
+
iframe.src = src;
|
382 |
+
iframe.style.display = 'block';
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
return{
|
389 |
+
hide: hide,
|
390 |
+
get: get,
|
391 |
+
removePlaceholders: removePlaceholders
|
392 |
+
}
|
393 |
+
|
394 |
+
})();
|
395 |
+
|
396 |
+
var scripts = (function() {
|
397 |
+
|
398 |
+
function get() {
|
399 |
+
|
400 |
+
var scripts = document.getElementsByClassName(opts.scriptClass),
|
401 |
+
n = scripts.length,
|
402 |
+
documentFragment = document.createDocumentFragment(),
|
403 |
+
i, y, s, attrib, el;
|
404 |
+
|
405 |
+
for (i = 0; i < n; i++){
|
406 |
+
|
407 |
+
if (scripts[i].hasAttribute('data-ce-src')){
|
408 |
+
|
409 |
+
if (typeof postscribe === "undefined"){
|
410 |
+
postscribe(scripts[i].parentNode, '<script src="' + scripts[i].getAttribute("data-ce-src") + '"></script>');
|
411 |
+
}
|
412 |
+
|
413 |
+
} else {
|
414 |
+
|
415 |
+
s = document.createElement('script');
|
416 |
+
s.type = 'text/javascript';
|
417 |
+
for (y = 0; y < scripts[i].attributes.length; y++) {
|
418 |
+
attrib = scripts[i].attributes[y];
|
419 |
+
if (attrib.specified) {
|
420 |
+
if ((attrib.name != 'type') && (attrib.name != 'class')){
|
421 |
+
s.setAttribute(attrib.name, attrib.value);
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
s.innerHTML = scripts[i].innerHTML;
|
426 |
+
documentFragment.appendChild(s);
|
427 |
+
|
428 |
+
}
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
document.body.appendChild(documentFragment);
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
return{
|
437 |
+
get: get
|
438 |
+
}
|
439 |
+
|
440 |
+
})();
|
441 |
+
|
442 |
+
|
443 |
+
return {
|
444 |
+
init: init,
|
445 |
+
enableCookies: enableCookies,
|
446 |
+
dismissBanner: banner.dismiss
|
447 |
+
};
|
448 |
+
|
449 |
+
}());
|
front/js/cookies-enabler.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
window.COOKIES_ENABLER=window.COOKIES_ENABLER||function(){"use strict";function e(){var e,n;for(e=1;e<arguments.length;e++)for(n in arguments[e])arguments[e].hasOwnProperty(n)&&(arguments[0][n]=arguments[e][n]);return arguments[0]}function n(e,n,t){var s;return function(){var a=this,i=arguments,o=function(){s=null,t||e.apply(a,i)},r=t&&!s;clearTimeout(s),s=setTimeout(o,n),r&&e.apply(a,i)}}function t(e,n){do if(s(e,n))return e;while(e=e.parentNode);return null}function s(e,n){return(" "+e.className+" ").indexOf(" "+n+" ")>-1}var a,i,o,r={scriptClass:"ce-script",iframeClass:"ce-iframe",acceptClass:"ce-accept",disableClass:"ce-disable",dismissClass:"ce-dismiss",bannerClass:"ce-banner",bannerHTML:null!==document.getElementById("ce-banner-html")?document.getElementById("ce-banner-html").innerHTML:'<p>This website uses cookies. <a href="#" class="ce-accept">Enable Cookies</a></p>',eventScroll:!1,scrollOffset:200,clickOutside:!1,cookieName:"ce-cookie",cookieDuration:"365",iframesPlaceholder:!0,iframesPlaceholderHTML:null!==document.getElementById("ce-iframePlaceholder-html")?document.getElementById("ce-iframePlaceholder-html").innerHTML:'<p>To view this content you need to<a href="#" class="ce-accept">Enable Cookies</a></p>',iframesPlaceholderClass:"ce-iframe-placeholder",onEnable:"",onDismiss:"",onDisable:""},c=function(){Math.abs(window.pageYOffset-o)>a.scrollOffset&&u()},l=function(){i={accept:document.getElementsByClassName(a.acceptClass),disable:document.getElementsByClassName(a.disableClass),banner:document.getElementsByClassName(a.bannerClass),dismiss:document.getElementsByClassName(a.dismissClass)};var e,n=i.accept,s=n.length,r=i.disable,l=r.length,d=i.dismiss,p=d.length;for(a.eventScroll&&window.addEventListener("load",function(){o=window.pageYOffset,window.addEventListener("scroll",c)}),a.clickOutside&&document.addEventListener("click",function(e){var n=e.target;return t(n,a.iframesPlaceholderClass)||t(n,a.disableClass)||t(n,a.bannerClass)||t(n,a.dismissClass)||t(n,a.disableClass)?!1:void u()}),e=0;s>e;e++)n[e].addEventListener("click",function(e){e.preventDefault(),u(e)});for(e=0;l>e;e++)r[e].addEventListener("click",function(e){e.preventDefault(),m(e)});for(e=0;p>e;e++)d[e].addEventListener("click",function(e){e.preventDefault(),f.dismiss()})},d=function(n){a=e({},r,n),"Y"==p.get()?("function"==typeof a.onEnable&&a.onEnable(),b.get(),g.get()):"N"==p.get()?("function"==typeof a.onDisable&&a.onDisable(),g.hide(),l()):(f.create(),g.hide(),l())},u=n(function(e){"undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"Y"!=p.get()&&(p.set(),b.get(),g.get(),g.removePlaceholders(),f.dismiss(),window.removeEventListener("scroll",c),"function"==typeof a.onEnable&&a.onEnable())},250,!1),m=function(e){"undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"N"!=p.get()&&(p.set("N"),f.dismiss(),window.removeEventListener("scroll",c),"function"==typeof a.onDisable&&a.onDisable())},f=function(){function e(){var e='<div class="'+a.bannerClass+'">'+a.bannerHTML+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function n(){i.banner[0].style.display="none","function"==typeof a.onDismiss&&a.onDismiss()}return{create:e,dismiss:n}}(),p=function(){function e(e){var n,t,s="undefined"!=typeof e?e:"Y";a.cookieDuration?(n=new Date,n.setTime(n.getTime()+24*a.cookieDuration*60*60*1e3),t="; expires="+n.toGMTString()):t="",document.cookie=a.cookieName+"="+s+t+"; path=/"}function n(){var e,n,t,s=document.cookie.split(";"),i=s.length;for(e=0;i>e;e++)if(n=s[e].substr(0,s[e].indexOf("=")),t=s[e].substr(s[e].indexOf("=")+1),n=n.replace(/^\s+|\s+$/g,""),n==a.cookieName)return unescape(t)}return{set:e,get:n}}(),g=function(){function e(e){var n=document.createElement("div");n.className=a.iframesPlaceholderClass,n.innerHTML=a.iframesPlaceholderHTML,e.parentNode.insertBefore(n,e)}function n(){var e,n=document.getElementsByClassName(a.iframesPlaceholderClass),t=n.length;for(e=t-1;e>=0;e--)n[e].remove()}function t(){var n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],n.style.display="none",a.iframesPlaceholder&&e(n)}function s(){var e,n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],e=n.attributes["data-ce-src"].value,n.src=e,n.style.display="block"}return{hide:t,get:s,removePlaceholders:n}}(),b=function(){function e(){var e,n,t,s,i=document.getElementsByClassName(a.scriptClass),o=i.length,r=document.createDocumentFragment();for(e=0;o>e;e++)if(i[e].hasAttribute("data-ce-src"))"undefined"==typeof postscribe&&postscribe(i[e].parentNode,'<script src="'+i[e].getAttribute("data-ce-src")+'"></script>');else{for(t=document.createElement("script"),t.type="text/javascript",n=0;n<i[e].attributes.length;n++)s=i[e].attributes[n],s.specified&&"type"!=s.name&&"class"!=s.name&&t.setAttribute(s.name,s.value);t.innerHTML=i[e].innerHTML,r.appendChild(t)}document.body.appendChild(r)}return{get:e}}();return{init:d,enableCookies:u,dismissBanner:f.dismiss}}();
|
ginger-eu-cookie-law.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Ginger - EU Cookie Law
|
4 |
+
Plugin URI: http://manafactory.it/
|
5 |
+
Description: Make your website compliant with EU Cookie Policy.
|
6 |
+
Version: 1.0
|
7 |
+
Author: Manafactory
|
8 |
+
Author URI: http://manafactory.it/
|
9 |
+
License: GPLv2 or later
|
10 |
+
Text Domain: ginger
|
11 |
+
*/
|
12 |
+
load_plugin_textdomain( 'ginger', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
13 |
+
|
14 |
+
//Gestione Backend
|
15 |
+
if(is_admin()){
|
16 |
+
require_once("admin/ginger.utils.php");
|
17 |
+
}
|
18 |
+
//Gestione Frontend
|
19 |
+
if(!is_admin()){
|
20 |
+
require_once("front/gingerfront.utils.php");
|
21 |
+
}
|
22 |
+
|
23 |
+
register_activation_hook( __FILE__, 'ginger_plugin_activate' );
|
img/ginger-color.png
ADDED
Binary file
|
img/ginger.png
ADDED
Binary file
|
languages/ginger-it_IT.mo
ADDED
Binary file
|
languages/ginger-it_IT.po
ADDED
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2015 Automattic
|
2 |
+
# This file is distributed under the GNU General Public License v2 or later.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: _s 1.0.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tags/_s\n"
|
7 |
+
"POT-Creation-Date: 2015-06-18 13:07+0100\n"
|
8 |
+
"PO-Revision-Date: 2015-06-18 13:37+0100\n"
|
9 |
+
"Last-Translator: \n"
|
10 |
+
"Language-Team: \n"
|
11 |
+
"Language: it_IT\n"
|
12 |
+
"MIME-Version: 1.0\n"
|
13 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
+
"Content-Transfer-Encoding: 8bit\n"
|
15 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
16 |
+
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
17 |
+
"X-Generator: Poedit 1.5.4\n"
|
18 |
+
"X-Poedit-KeywordsList: _e;__\n"
|
19 |
+
"X-Poedit-Basepath: .\n"
|
20 |
+
"X-Poedit-SearchPath-0: /var/www/sitolocale/wp-content/plugins/ginger\n"
|
21 |
+
|
22 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:42
|
23 |
+
msgid "Updated!"
|
24 |
+
msgstr "Aggiornato!"
|
25 |
+
|
26 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:54
|
27 |
+
msgid "General Configuration"
|
28 |
+
msgstr "Configurazione Generale"
|
29 |
+
|
30 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:55
|
31 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:8
|
32 |
+
msgid "Banner Setup"
|
33 |
+
msgstr "Banner Setup"
|
34 |
+
|
35 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:57
|
36 |
+
msgid "Privacy Policy"
|
37 |
+
msgstr "Privacy Policy"
|
38 |
+
|
39 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:58
|
40 |
+
msgid "Edit Url"
|
41 |
+
msgstr "Url Setup"
|
42 |
+
|
43 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:61
|
44 |
+
msgid "WPML Setup"
|
45 |
+
msgstr "WPML Setup"
|
46 |
+
|
47 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.admin.php:99
|
48 |
+
msgid "Save Changes"
|
49 |
+
msgstr "Aggiorna"
|
50 |
+
|
51 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/ginger.utils.php:15
|
52 |
+
msgid "About EU Law"
|
53 |
+
msgstr "About EU Law"
|
54 |
+
|
55 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:8
|
56 |
+
msgid "Wpml Setup"
|
57 |
+
msgstr "Wpml Setup"
|
58 |
+
|
59 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:14
|
60 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:15
|
61 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:14
|
62 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:15
|
63 |
+
msgid "Banner Position"
|
64 |
+
msgstr "Posizione Banner"
|
65 |
+
|
66 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:16
|
67 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:16
|
68 |
+
msgid "Top"
|
69 |
+
msgstr "In alto"
|
70 |
+
|
71 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:17
|
72 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:17
|
73 |
+
msgid "Bottom"
|
74 |
+
msgstr "In basso"
|
75 |
+
|
76 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:22
|
77 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:23
|
78 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:22
|
79 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:23
|
80 |
+
msgid "Banner Text"
|
81 |
+
msgstr "Testo Banner"
|
82 |
+
|
83 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:29
|
84 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:29
|
85 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:22
|
86 |
+
msgid ""
|
87 |
+
"You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page "
|
88 |
+
"defined in <a href=\"admin.php?page=ginger-setup&tab=policy\">Privacy Policy "
|
89 |
+
"Tab</a>"
|
90 |
+
msgstr ""
|
91 |
+
"Puoi usare la sintassi <code>{{privacy_page}}</code> per linkare alla pagina "
|
92 |
+
"Privacy Policy definita in <a href=\"admin.php?page=ginger-setup&tab=policy"
|
93 |
+
"\">Privacy Policy Tab</a>"
|
94 |
+
|
95 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:34
|
96 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:35
|
97 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:34
|
98 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:35
|
99 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:47
|
100 |
+
msgid "Iframe Text"
|
101 |
+
msgstr "Testo Iframe"
|
102 |
+
|
103 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:47
|
104 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:28
|
105 |
+
msgid "Colors"
|
106 |
+
msgstr "Colori"
|
107 |
+
|
108 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:52
|
109 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:53
|
110 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:109
|
111 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:110
|
112 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:33
|
113 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:34
|
114 |
+
msgid "Background"
|
115 |
+
msgstr "Sfondo"
|
116 |
+
|
117 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:61
|
118 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:62
|
119 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:55
|
120 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:66
|
121 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:83
|
122 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:118
|
123 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:119
|
124 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:42
|
125 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:43
|
126 |
+
msgid "Text"
|
127 |
+
msgstr "Testo"
|
128 |
+
|
129 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:70
|
130 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/addon/wpml_addon.php:71
|
131 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/link.php:8
|
132 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/url.php:8
|
133 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:134
|
134 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:135
|
135 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:51
|
136 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:52
|
137 |
+
msgid "Link"
|
138 |
+
msgstr "Link"
|
139 |
+
|
140 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/url.php:35
|
141 |
+
msgid "URL"
|
142 |
+
msgstr "URL"
|
143 |
+
|
144 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/url.php:37
|
145 |
+
msgid "Enable"
|
146 |
+
msgstr "Abilitato"
|
147 |
+
|
148 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/url.php:37
|
149 |
+
msgid "YES"
|
150 |
+
msgstr "SI"
|
151 |
+
|
152 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/url.php:38
|
153 |
+
msgid "NO"
|
154 |
+
msgstr "NO"
|
155 |
+
|
156 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:8
|
157 |
+
msgid "Ginger is currently"
|
158 |
+
msgstr "Ginger è attualmente"
|
159 |
+
|
160 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:8
|
161 |
+
msgid "enabled"
|
162 |
+
msgstr "abilitato"
|
163 |
+
|
164 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:8
|
165 |
+
msgid "disabled"
|
166 |
+
msgstr "disabilitato"
|
167 |
+
|
168 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:14
|
169 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:15
|
170 |
+
msgid "Enable Ginger"
|
171 |
+
msgstr "Abilita Ginger"
|
172 |
+
|
173 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:16
|
174 |
+
msgid "Enabled"
|
175 |
+
msgstr "Abilitato"
|
176 |
+
|
177 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:17
|
178 |
+
msgid "Disabled"
|
179 |
+
msgstr "Disabilitato"
|
180 |
+
|
181 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:23
|
182 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:24
|
183 |
+
msgid "Choose Banner Type"
|
184 |
+
msgstr "Scegli il tipo di banner"
|
185 |
+
|
186 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:26
|
187 |
+
msgid "Bar"
|
188 |
+
msgstr "Barra"
|
189 |
+
|
190 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:27
|
191 |
+
msgid "Dialog"
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:32
|
195 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:33
|
196 |
+
msgid "Do you have a cache system?"
|
197 |
+
msgstr "Hai un sistema di cache"
|
198 |
+
|
199 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:34
|
200 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:58
|
201 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:71
|
202 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:87
|
203 |
+
msgid "Yes"
|
204 |
+
msgstr "Si"
|
205 |
+
|
206 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:35
|
207 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:59
|
208 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:73
|
209 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:89
|
210 |
+
msgid "No"
|
211 |
+
msgstr "No"
|
212 |
+
|
213 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:40
|
214 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:41
|
215 |
+
msgid "Cookie Confirmation Type"
|
216 |
+
msgstr "Tipo di conferma dei cookie"
|
217 |
+
|
218 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:42
|
219 |
+
msgid "Opt-In"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:42
|
223 |
+
msgid "Cookies are disabled until banner is accepted"
|
224 |
+
msgstr "I cookie sono disabilitati finchè il banner non è accettato"
|
225 |
+
|
226 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:43
|
227 |
+
msgid "Opt-Out"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:43
|
231 |
+
msgid "Cookies are disabled only if explicitly requested"
|
232 |
+
msgstr "I cookie sono disabilitati solo se esplicitamente richiesto"
|
233 |
+
|
234 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:48
|
235 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:49
|
236 |
+
msgid "Let scroll to confirm"
|
237 |
+
msgstr "Scrolla per confermare"
|
238 |
+
|
239 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:50
|
240 |
+
msgid "Scroll to accept cookie"
|
241 |
+
msgstr "Scrolla per accettare i cookie"
|
242 |
+
|
243 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:51
|
244 |
+
msgid "Keep banner after scroll"
|
245 |
+
msgstr "Non abilitare i cookie con lo scroll"
|
246 |
+
|
247 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:56
|
248 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/general.php:57
|
249 |
+
msgid "Click out of banner to accept cookie"
|
250 |
+
msgstr "Clicca fuori dal banner per accettare i cookie"
|
251 |
+
|
252 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:46
|
253 |
+
msgid "Customize your banner buttons"
|
254 |
+
msgstr "Personalizza i tuoi Bunner Buttons"
|
255 |
+
|
256 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:50
|
257 |
+
msgid "Accept cookie Button"
|
258 |
+
msgstr "Button Accetta Cookie"
|
259 |
+
|
260 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:57
|
261 |
+
msgid "Accept Cookie"
|
262 |
+
msgstr "Accetta Cookie"
|
263 |
+
|
264 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:61
|
265 |
+
msgid "Disable cookie Button"
|
266 |
+
msgstr "Button Disabilita Cookie "
|
267 |
+
|
268 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:68
|
269 |
+
msgid "Disable Cookie"
|
270 |
+
msgstr "Disabilita Cookie"
|
271 |
+
|
272 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:70
|
273 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:86
|
274 |
+
msgid "Enable:"
|
275 |
+
msgstr "Abilita:"
|
276 |
+
|
277 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:78
|
278 |
+
msgid "Read More Button"
|
279 |
+
msgstr "Button Read More "
|
280 |
+
|
281 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:85
|
282 |
+
msgid "Read More"
|
283 |
+
msgstr "Read More"
|
284 |
+
|
285 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:96
|
286 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:97
|
287 |
+
msgid "Choose Ginger Theme"
|
288 |
+
msgstr "Scegli il tema Ginger"
|
289 |
+
|
290 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:98
|
291 |
+
msgid "Light Theme"
|
292 |
+
msgstr "Light Theme"
|
293 |
+
|
294 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:99
|
295 |
+
msgid "Dark Theme"
|
296 |
+
msgstr "Dark Theme"
|
297 |
+
|
298 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:104
|
299 |
+
msgid "Customize your Ginger theme"
|
300 |
+
msgstr "Personalizza il tuo tema Ginger"
|
301 |
+
|
302 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:127
|
303 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/banner.php:128
|
304 |
+
msgid "Button"
|
305 |
+
msgstr "Button"
|
306 |
+
|
307 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:8
|
308 |
+
msgid "Banner Dialog Setup"
|
309 |
+
msgstr "Banner Dialog Setup"
|
310 |
+
|
311 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:15
|
312 |
+
msgid "Dialog Text"
|
313 |
+
msgstr "Testo Dialog "
|
314 |
+
|
315 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/dialog.php:16
|
316 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:18
|
317 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:79
|
318 |
+
msgid "DialogText"
|
319 |
+
msgstr "Testo Dialog "
|
320 |
+
|
321 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:8
|
322 |
+
msgid "Privacy Policy Setup"
|
323 |
+
msgstr "Privacy Policy Setup"
|
324 |
+
|
325 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:15
|
326 |
+
msgid "Select your privacy policy page"
|
327 |
+
msgstr "Seleziona la tua pagina privacy policy"
|
328 |
+
|
329 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:68
|
330 |
+
msgid "or create your privacy policy page"
|
331 |
+
msgstr "oppure crea la tua pagina privacy policy "
|
332 |
+
|
333 |
+
#: /var/www/sitolocale/wp-content/plugins/ginger/admin/partial/policy.php:73
|
334 |
+
msgid "Title"
|
335 |
+
msgstr "Titolo"
|
readme.txt
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: manafactory, webgrafia, matteobarale
|
3 |
+
Tags: EU Cookie Law, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia
|
4 |
+
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.4.2
|
6 |
+
Stable tag: 1.0
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Ginger allows to show a configurable banner and blocks the most common third party cookies complying with European Cookie Laws.
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Ginger allows to show a configurable banner and blocks the most common third party cookies complying with European Cookie Laws.
|
14 |
+
It works in opt-in 0r opt-out mode, in order to be compliant with all EU implementation.
|
15 |
+
|
16 |
+
Plug’n' play, it doesn’t need customization of theme or plugins files.
|
17 |
+
|
18 |
+
Features:
|
19 |
+
|
20 |
+
* Position, style, colour, type and banner configurable
|
21 |
+
* Opt-in or Opt-out mode
|
22 |
+
* All caching systems compliant
|
23 |
+
* Javascript and iframe block
|
24 |
+
* iframe lock if javascript disabled
|
25 |
+
|
26 |
+
|
27 |
+
== Installation ==
|
28 |
+
|
29 |
+
1. Upload ginger to the `/wp-content/plugins/` directory
|
30 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
31 |
+
1. Enable, configure settings and banner in Ginger Configuration Page (follow the gingerman)
|
32 |
+
|
33 |
+
== Frequently Asked Questions ==
|
34 |
+
|
35 |
+
= Do I need of coding theme or plugins? =
|
36 |
+
|
37 |
+
Absolutely not. Is really plug'n play
|
38 |
+
|
39 |
+
= It block Cookies before esplicitly accepted by user? =
|
40 |
+
|
41 |
+
Sure, you can choose opt-in or opt-out mode to let it work as you wish.
|
42 |
+
|
43 |
+
= It use jQuery? =
|
44 |
+
|
45 |
+
No, you can be safe from plugins conflict, is developed using Cookies Enabler Js Library developed by Nicholas Ruggeri: https://github.com/nicholasruggeri/cookies-enabler
|
46 |
+
|
47 |
+
|
48 |
+
== Screenshots ==
|
49 |
+
|
50 |
+
1. General Configuration Page: here you can enable banner and choose from opt-in (for Italia as example) or opt-out mode
|
51 |
+
2. Banner setup: dialog or banner, colors, posizions, etc
|
52 |
+
3. Privacy Policy Setup Page
|
53 |
+
4. Front-end example of light banner in footer, with iframe locked before approvation in opt-in mode
|
54 |
+
|
55 |
+
== Changelog ==
|
56 |
+
|
57 |
+
= 1.0 =
|
58 |
+
* First stable release.
|