Ginger – EU Cookie Law - Version 4.1.7

Version Description

  • added reset cookie shortcode
  • added role access to settings page
  • notice bugfix
Download this release

Release Info

Developer matteobarale
Plugin Icon 128x128 Ginger – EU Cookie Law
Version 4.1.7
Comparing to
See all releases

Code changes from version 4.1.6 to 4.1.7

admin/ginger.admin.php CHANGED
@@ -1,125 +1,74 @@
1
  <?php
2
- if(isset($_GET['tab'])):
3
- $tab = $_GET['tab'];
4
- $key = "ginger_". $tab;
5
- else:
6
- $tab = 'general';
7
- $key = "ginger_general";
8
- endif;
9
-
10
- if($tab == 'banner'):
11
- wp_enqueue_script('jquery-textarea', plugins_url('/ginger/admin/js/jquery_lined_textarea/jquery-linedtextarea.js'), array( 'jquery' ) );
12
- wp_enqueue_style('textarea-style', plugins_url('/ginger/admin/js/jquery_lined_textarea/jquery-linedtextarea.css'));
13
- endif;
14
- if($tab == 'general' || $tab==''):
15
- wp_enqueue_script('repeater', plugins_url('/ginger/admin/js/jquery.repeater-master/jquery.repeater.js'), array( 'jquery' ) );
16
- endif;
17
-
18
- if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_options')){
19
- return;
20
- }
21
-
22
- if(isset($_POST["submit"])){
23
- $params = $_POST;
24
- unset($params["submit"]);
25
- unset($params["ginger_options"]);
26
- unset($params["_wp_http_referer"]);
27
-
28
- if ($key == 'ginger_banner'){
29
-
30
- if (isset($params["disable_cookie_button_status"]) && $params["disable_cookie_button_status"]!='1'){
31
- $params["disable_cookie_button_status"]='0';
32
- }
33
- if (isset($params["read_more_button_status"]) && $params["read_more_button_status"]!='1'){
34
- $params["read_more_button_status"]='0';
35
- }
36
-
37
- }
38
- if ($key=='ginger_policy'){
39
- if ($_POST["choice"]=="new_page"){
40
-
41
- // controllo se il nome della privacy page è già esistente.
42
- $title_post = sanitize_text_field($_POST["privacy_page_title"]);
43
- $content_post = wp_kses_post($_POST["privacy_page_content"]);
44
- $control_page = get_page_by_title( $title_post , '', 'page' );
45
- if ($control_page){
46
- if ($control_page->post_status == 'publish') {
47
- $control_page_id = $control_page->ID;
48
- $privacy_page_id = $control_page_id;
49
- echo '<div class="updated"><p>'.__( 'The page with the specified title already exists and is your current privacy policy page!', 'ginger' ).'</p></div>';
50
-
51
- }else{
52
 
53
- $id_privacy_new_page = save_privacy_page($title_post, $content_post);
54
- $privacy_page_id = $id_privacy_new_page;
55
- }
 
 
 
56
 
57
- }else{
58
- $id_privacy_new_page = save_privacy_page($title_post,$content_post);
59
- $privacy_page_id = $id_privacy_new_page;
60
- }
61
-
62
- }else{
63
- $privacy_page_id = intval($_POST["ginger_privacy_page"]);
64
- }
65
- if(is_int($privacy_page_id)):
66
- update_option($key, $privacy_page_id);
67
- endif;
68
- update_option($key.'_disable_ginger', $_POST["ginger_privacy_click_scroll"]);
69
- update_option($key.'_disable_logger', $_POST["ginger_disable_logger"] == '1');
70
-
71
- }else{
72
- update_option($key, $params);}
73
- echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
74
- }
75
 
76
  $options = get_option($key);
77
- if ($key=='ginger_policy'):
78
 
79
  $options = get_option($key);
80
  // recupero la option per il disable click out e scroll in privacy policy page
81
- $options2 = get_option($key.'_disable_ginger');
82
- $options_disable_logger = get_option($key.'_disable_logger');
83
 
84
  endif;
85
  ?>
86
 
87
  <div class="wrap">
88
- <h2>Ginger - EU Cookie Law</h2>
89
- <hr>
90
- <h2 class="nav-tab-wrapper">
91
- <a href="admin.php?page=ginger-setup" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ((!isset($_GET["tab"]) || $_GET["tab"] == "" ) || (isset($_GET["tab"]) && $_GET["tab"] == "general"))) ? 'nav-tab-active' : ''; ?>"><?php _e("General Configuration", "ginger"); ?></a>
92
- <a href="admin.php?page=ginger-setup&tab=banner" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "banner" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Banner Setup", "ginger"); ?></a>
93
- <a href="admin.php?page=ginger-setup&tab=policy" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "policy" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Privacy Policy", "ginger"); ?></a>
94
- <?php do_action("ginger_add_tab_menu"); ?>
95
- <a href="admin.php?page=ginger-setup&tab=more" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "more" )) ? 'nav-tab-active' : ''; ?>"><?php _e("More", "ginger"); ?></a>
96
-
97
- </h2>
98
- <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?><?php if(isset($tab)) echo '&tab=' . $tab; ?>" <?php echo 'class="repeater"';?>>
 
 
 
 
 
 
 
 
 
99
  <?php wp_nonce_field('save_ginger_options', 'ginger_options'); ?>
100
- <?php
101
- switch($tab){
102
- case "general":
103
- include('partial/general.php');
104
  break;
105
- case "banner":
106
- include('partial/banner.php');
107
- break;
108
- case "policy":
109
  include('partial/policy.php');
110
  break;
111
- case "more":
112
- include('partial/more.php');
113
  break;
114
- }
115
- if($tab != "more"){
116
- ?>
117
- <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
118
- <?php
119
- }
120
- ?>
 
 
 
 
 
 
 
121
  </form>
 
122
  </div>
123
-
124
-
125
-
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ /**
4
+ *
5
+ */
6
+ add_action('admin_footer', 'ginger_save_javascript');
7
+ list($tab, $key) = tabSelection();
8
+ equeueScript($tab);
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  $options = get_option($key);
12
+ if ($key == 'ginger_policy'):
13
 
14
  $options = get_option($key);
15
  // recupero la option per il disable click out e scroll in privacy policy page
16
+ $options2 = get_option($key . '_disable_ginger');
17
+ $options_disable_logger = get_option($key . '_disable_logger');
18
 
19
  endif;
20
  ?>
21
 
22
  <div class="wrap">
23
+ <h2>Ginger - EU Cookie Law</h2>
24
+ <hr>
25
+ <h2 class="nav-tab-wrapper">
26
+ <a href="admin.php?page=ginger-setup"
27
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ((!isset($_GET["tab"]) || $_GET["tab"] == "") || (isset($_GET["tab"]) && $_GET["tab"] == "general"))) ? 'nav-tab-active' : ''; ?>"><?php _e("General Configuration", "ginger"); ?></a>
28
+ <a href="admin.php?page=ginger-setup&tab=banner"
29
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "banner")) ? 'nav-tab-active' : ''; ?>"><?php _e("Banner Setup", "ginger"); ?></a>
30
+ <a href="admin.php?page=ginger-setup&tab=policy"
31
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "policy")) ? 'nav-tab-active' : ''; ?>"><?php _e("Privacy Policy", "ginger"); ?></a>
32
+ <a href="admin.php?page=ginger-setup&tab=admin-permission"
33
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "admin-permission")) ? 'nav-tab-active' : ''; ?>"><?php _e("Admin Permission", "ginger"); ?></a>
34
+ <a href="admin.php?page=ginger-setup&tab=shortcode"
35
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "shortcode")) ? 'nav-tab-active' : ''; ?>"><?php _e("Shortcode", "ginger"); ?></a>
36
+ <?php do_action("ginger_add_tab_menu"); ?>
37
+ <a href="admin.php?page=ginger-setup&tab=ginger_policy"
38
+ class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (isset($_GET["tab"]) && $_GET["tab"] == "ginger_policy")) ? 'nav-tab-active' : ''; ?>" style="float: right"><?php _e("Ginger Policy", "ginger"); ?></a>
39
+ </h2>
40
+ <?php if ($tab != 'shortcode'): ?>
41
+ <form id="ginger_save_data" method="post"
42
+ action="admin.php?page=<?php echo $_GET["page"]; ?><?php if (isset($tab)) echo '&tab=' . $tab; ?>" <?php echo 'class="repeater"'; ?>>
43
  <?php wp_nonce_field('save_ginger_options', 'ginger_options'); ?>
44
+ <?php endif; ?>
45
+ <?php switch ($tab) :
46
+ case "general":
47
+ include('partial/general.php');
48
  break;
49
+ case "banner":
50
+ include('partial/banner.php');
51
+ break;
52
+ case "policy":
53
  include('partial/policy.php');
54
  break;
55
+ case "admin-permission":
56
+ include('partial/admin-permission.php');
57
  break;
58
+ case "shortcode":
59
+ include('partial/shortcode.php');
60
+ break;
61
+ case "ginger_policy":
62
+ include('partial/ginger-cookie-policy.php');
63
+ break;
64
+ default:
65
+ include('partial/general.php');
66
+ endswitch; ?>
67
+ <?php if ($tab != 'shortcode' && $tab != 'ginger_policy'): ?>
68
+ <p class="submit">
69
+ <input type="submit" name="submit" id="submit" class="button button-primary"
70
+ value="<?php _e("Save Changes", "ginger"); ?>">
71
+ </p>
72
  </form>
73
+ <?php endif; ?>
74
  </div>
 
 
 
admin/ginger.pointer.php CHANGED
@@ -61,7 +61,7 @@ if (!class_exists("gingerSimpleNote")) {
61
  }
62
  });
63
  // ]]></script>
64
- <?php
65
  }
66
 
67
  function init_admin()
61
  }
62
  });
63
  // ]]></script>
64
+ <?php
65
  }
66
 
67
  function init_admin()
admin/ginger.utils.php CHANGED
@@ -7,72 +7,90 @@
7
  *
8
  * */
9
 
10
- //Inizializzo il plugin e le relative pagine del plugin
11
- add_action( 'admin_menu', 'register_ginger_menu_page' );
12
- function register_ginger_menu_page(){
 
13
  global $ginger_menu_hook;
14
 
15
- $capability = apply_filters('ginger_admin_menu_capability', 'manage_options');
16
 
17
- $ginger_menu_hook = add_menu_page( 'ginger', 'Ginger Cookie', $capability, 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
18
  do_action("ginger_add_menu");
19
 
20
 
21
  if ($ginger_menu_hook) {
22
- if(function_exists("get_current_screen"))
23
- add_action( 'load-' . $ginger_menu_hook, 'ginger_add_help' );
24
  }
25
 
26
  }
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- function ginger_menu_page(){
30
- require_once(plugin_dir_path( __FILE__ )."/ginger.admin.php");
31
  }
32
 
33
  //Aggingo style e script per ginger backend
34
- add_action( 'admin_enqueue_scripts', 'ginger_add_admin_js' );
35
- function ginger_add_admin_js( $hook ) {
36
- if( is_admin() ) {
37
- if(isset($_GET["page"])) {
38
- $page = $_GET["page"];
39
- if ( substr( $page, 0, 6 ) == "ginger" ) {
40
- // Add the color picker css file
41
- wp_enqueue_style( 'wp-color-picker' );
42
- // Include our custom jQuery file with WordPress Color Picker dependency
43
- wp_enqueue_script( 'ginger-script-handle', plugins_url( 'js/ginger.js', __FILE__ ), array(), false, true );
44
- wp_enqueue_script( 'ginger-script-color', plugins_url( 'js/ginger.color.js', __FILE__ ), array( "wp-color-picker" ), false, true );
45
- }
46
- }
 
 
47
  }
48
  }
49
 
50
 
51
  function ginger_add_help()
52
  {
53
- if(function_exists("get_current_screen")){
54
  $screen = get_current_screen();
55
 
56
  $screen->add_help_tab(array(
57
- 'id' => 'ginger_help_tab1',
58
- 'title' => __('Configuration', "ginger"),
59
  'content' => '<p>' . __('<b>Cache system</b>: with cache radiobutton enabled html output will be the same for every users, and javascript will be unlocked on document ready. Without cache parsing is disabled for user that have accepted cookies. ', "ginger") . '</p>' .
60
  '<p>' . __('<b>Stress mode</b>: show a small banner for users that have not accepted cookies.', "ginger") . '</p>'
61
 
62
- ,
63
  )
64
  );
65
  $screen->add_help_tab(array(
66
- 'id' => 'ginger_help_tab2',
67
- 'title' => __('Banner Setup', "ginger"),
68
  'content' => '<p>' . __('<b>Banner text</b>: text to show in Ginger banner. {{privacy_page}} shortcode will be replaced with title and link of privacy policy page, defined in Provacy Policy Tab.', "ginger") . '</p>' .
69
  '<p>' . __('<b>Iframe text</b>: text to show in substitution of blocked iframe. If you have a Youtube Embed, this will be replaced by this text until Cookie are not accepted by users.', "ginger") . '</p>' .
70
  '<p>' . __('<b>Custom CSS</b>: override css rules to customize your banner. As example, to customize font family you can try this: <code>.ginger_banner{font-family: Arial, Verdana;}</code>', "ginger") . '</p>'
71
  )
72
  );
73
  $screen->add_help_tab(array(
74
- 'id' => 'ginger_help_tab3',
75
- 'title' => __('Privacy Policy', "ginger"),
76
  'content' => '<p>' . __('Select here your Privacy Policy page to be linked in substitution of <code>{{privacy_page}}</code> shortcode inside text banner.', "ginger") . '</p>' .
77
  '<p>' . __('You can create here an empty Privacy Policy Page, but remember to add your text!', "ginger") . '</p>',
78
  )
@@ -88,20 +106,69 @@ function ginger_add_help()
88
  }
89
 
90
 
91
-
92
  //Salvataggio e creazione pagina cookie policy
93
- function save_privacy_page($title,$content){
 
94
  $my_post = array(
95
- 'post_title' => $title,
96
- 'post_content' => $content,
97
- 'post_status' => 'publish',
98
- 'post_author' => '',
99
- 'post_category' => '',
100
- 'post_type' => 'page'
101
  );
102
 
103
 
104
- $id = wp_insert_post( $my_post );
105
- return($id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
 
7
  *
8
  * */
9
 
10
+ //Init Plugin and backend page
11
+ add_action('admin_menu', 'register_ginger_menu_page');
12
+ function register_ginger_menu_page()
13
+ {
14
  global $ginger_menu_hook;
15
 
16
+ $capability = apply_filters('ginger_admin_menu_capability', 'manage_options');
17
 
18
+ $ginger_menu_hook = add_menu_page('ginger', 'Ginger Cookie', $capability, 'ginger-setup', 'ginger_menu_page', plugins_url('ginger/img/ginger-color.png'));
19
  do_action("ginger_add_menu");
20
 
21
 
22
  if ($ginger_menu_hook) {
23
+ if (function_exists("get_current_screen"))
24
+ add_action('load-' . $ginger_menu_hook, 'ginger_add_help');
25
  }
26
 
27
  }
28
 
29
+ /**
30
+ *
31
+ * @return mixed
32
+ */
33
+ function ginger_admin_permission_filter( ) {
34
+ $return_cap = 'manage_options';
35
+ $capability = get_option('ginger_admin-permission');
36
+ if(isset($capability['ginger_role_choice']) && !empty($capability['ginger_role_choice'])){
37
+ $return_cap = $capability['ginger_role_choice'];
38
+ }
39
+ return $return_cap;
40
+ }
41
+ add_filter( 'ginger_admin_menu_capability', 'ginger_admin_permission_filter', 10, 3 );
42
+
43
+ function ginger_menu_page()
44
+ {
45
 
46
+ require_once(plugin_dir_path(__FILE__) . "/ginger.admin.php");
 
47
  }
48
 
49
  //Aggingo style e script per ginger backend
50
+ add_action('admin_enqueue_scripts', 'ginger_add_admin_js');
51
+ function ginger_add_admin_js($hook)
52
+ {
53
+ if (is_admin()) {
54
+ if (isset($_GET["page"])) {
55
+ $page = $_GET["page"];
56
+ if (substr($page, 0, 6) == "ginger") {
57
+ // Add the color picker css file
58
+ wp_enqueue_script('clipboard-js', plugins_url('js/clipboard.min.js', __FILE__), '', false, true);
59
+ wp_enqueue_style('wp-color-picker');
60
+ // Include our custom jQuery file with WordPress Color Picker dependency
61
+ wp_enqueue_script('ginger-script-handle', plugins_url('js/ginger.js', __FILE__), array(), false, true);
62
+ wp_enqueue_script('ginger-script-color', plugins_url('js/ginger.color.js', __FILE__), array("wp-color-picker"), false, true);
63
+ }
64
+ }
65
  }
66
  }
67
 
68
 
69
  function ginger_add_help()
70
  {
71
+ if (function_exists("get_current_screen")) {
72
  $screen = get_current_screen();
73
 
74
  $screen->add_help_tab(array(
75
+ 'id' => 'ginger_help_tab1',
76
+ 'title' => __('Configuration', "ginger"),
77
  'content' => '<p>' . __('<b>Cache system</b>: with cache radiobutton enabled html output will be the same for every users, and javascript will be unlocked on document ready. Without cache parsing is disabled for user that have accepted cookies. ', "ginger") . '</p>' .
78
  '<p>' . __('<b>Stress mode</b>: show a small banner for users that have not accepted cookies.', "ginger") . '</p>'
79
 
80
+ ,
81
  )
82
  );
83
  $screen->add_help_tab(array(
84
+ 'id' => 'ginger_help_tab2',
85
+ 'title' => __('Banner Setup', "ginger"),
86
  'content' => '<p>' . __('<b>Banner text</b>: text to show in Ginger banner. {{privacy_page}} shortcode will be replaced with title and link of privacy policy page, defined in Provacy Policy Tab.', "ginger") . '</p>' .
87
  '<p>' . __('<b>Iframe text</b>: text to show in substitution of blocked iframe. If you have a Youtube Embed, this will be replaced by this text until Cookie are not accepted by users.', "ginger") . '</p>' .
88
  '<p>' . __('<b>Custom CSS</b>: override css rules to customize your banner. As example, to customize font family you can try this: <code>.ginger_banner{font-family: Arial, Verdana;}</code>', "ginger") . '</p>'
89
  )
90
  );
91
  $screen->add_help_tab(array(
92
+ 'id' => 'ginger_help_tab3',
93
+ 'title' => __('Privacy Policy', "ginger"),
94
  'content' => '<p>' . __('Select here your Privacy Policy page to be linked in substitution of <code>{{privacy_page}}</code> shortcode inside text banner.', "ginger") . '</p>' .
95
  '<p>' . __('You can create here an empty Privacy Policy Page, but remember to add your text!', "ginger") . '</p>',
96
  )
106
  }
107
 
108
 
 
109
  //Salvataggio e creazione pagina cookie policy
110
+ function save_privacy_page($title, $content)
111
+ {
112
  $my_post = array(
113
+ 'post_title' => $title,
114
+ 'post_content' => $content,
115
+ 'post_status' => 'publish',
116
+ 'post_author' => '',
117
+ 'post_category' => '',
118
+ 'post_type' => 'page'
119
  );
120
 
121
 
122
+ $id = wp_insert_post($my_post);
123
+ return ($id);
124
+ }
125
+
126
+
127
+ /**
128
+ * Admin tab selection
129
+ * @return array
130
+ */
131
+ function tabSelection()
132
+ {
133
+ if (isset($_GET['tab'])) {
134
+ $tab = $_GET['tab'];
135
+ $key = "ginger_" . $tab;
136
+ } else {
137
+ $tab = 'general';
138
+ $key = "ginger_general";
139
+ }
140
+ return array($tab, $key);
141
+ }
142
+
143
+
144
+ /**
145
+ * Enqueue Correct style adn script
146
+ * @param $tab
147
+ */
148
+ function equeueScript($tab)
149
+ {
150
+ if ($tab == 'banner'):
151
+ wp_enqueue_script('jquery-textarea', plugins_url('/ginger/admin/js/jquery_lined_textarea/jquery-linedtextarea.js'), array('jquery'));
152
+ wp_enqueue_style('textarea-style', plugins_url('/ginger/admin/js/jquery_lined_textarea/jquery-linedtextarea.css'));
153
+ endif;
154
+ if ($tab == 'general' || $tab == ''):
155
+ wp_enqueue_script('repeater', plugins_url('/ginger/admin/js/jquery.repeater-master/jquery.repeater.js'), array('jquery'));
156
+ endif;
157
+ }
158
+
159
+
160
+ /**
161
+ * Return value if exist
162
+ * @param $array
163
+ * @param $index
164
+ * @return bool|mixed
165
+ */
166
+ function ginger_check_value($array, $index)
167
+ {
168
+ if (is_array($array) && isset($array[$index])) {
169
+ return $array[$index];
170
+ } else {
171
+ return false;
172
+ }
173
  }
174
 
admin/img/logo-head.png CHANGED
File without changes
admin/inc/admin-permission.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 28/05/18
6
+ * Time: 11:22
7
+ */
8
+
9
+ /**
10
+ * Get all registerd Role
11
+ * @return array
12
+ */
13
+ function getAllRegisterdRole(){
14
+ global $wp_roles;
15
+ $all_roles = $wp_roles->roles;
16
+ $editable_roles = apply_filters('editable_roles', $all_roles);
17
+ return $editable_roles;
18
+ }
19
+
20
+
21
+ function get_first_role_permission($capabilites){
22
+ reset($capabilites);
23
+ $first_cap = key($capabilites);
24
+ return $first_cap;
25
+ }
26
+
27
+ /**
28
+ * Get selcted Role permission
29
+ * @return string
30
+ */
31
+ function getSelectedPermissionLevel()
32
+ {
33
+ $ginger_admin_permission = get_option('ginger_admin-permission');
34
+ if ($ginger_admin_permission && isset($ginger_admin_permission['ginger_role_choice']) && !empty($ginger_admin_permission['ginger_role_choice'])) {
35
+ $selectedRole = $ginger_admin_permission['ginger_role_choice'];
36
+ } else {
37
+ $selectedRole = '';
38
+ }
39
+ return $selectedRole;
40
+ }
admin/inc/ginger.save.config.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 28/05/18
6
+ * Time: 11:49
7
+ */
8
+
9
+
10
+ add_action('wp_ajax_ginger_save_action', 'ginger_save_action');
11
+
12
+ function ginger_save_action()
13
+ {
14
+ if (isset($_POST["key"]) && !empty($_POST["key"])) {
15
+ $key = $_POST["key"];
16
+ } else {
17
+ list($tab, $key) = tabSelection();
18
+ }
19
+ echo $key;
20
+ if (isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_options')) {
21
+ return;
22
+ }
23
+
24
+ if (isset($_POST["submit"])) {
25
+ $params = $_POST;
26
+ unset($params["submit"]);
27
+ unset($params["ginger_options"]);
28
+ unset($params["_wp_http_referer"]);
29
+ unset($params["pll_ajax_backend"]);
30
+ unset($params["action"]);
31
+ unset($params["action"]);
32
+
33
+ if ($key == 'ginger_banner') {
34
+
35
+ if (isset($params["disable_cookie_button_status"]) && $params["disable_cookie_button_status"] != '1') {
36
+ $params["disable_cookie_button_status"] = '0';
37
+ }
38
+ if (isset($params["read_more_button_status"]) && $params["read_more_button_status"] != '1') {
39
+ $params["read_more_button_status"] = '0';
40
+ }
41
+
42
+ }
43
+ if ($key == 'ginger_policy') {
44
+ if ($params["choice"] == "new_page") {
45
+ // controllo se il nome della privacy page è già esistente.
46
+ $title_post = sanitize_text_field($params["privacy_page_title"]);
47
+ $content_post = wp_kses_post($params["privacy_page_content"]);
48
+ $control_page = get_page_by_title($title_post, '', 'page');
49
+ if ($control_page) {
50
+ $title_post = $title_post . ' ginger';
51
+ }
52
+ $id_privacy_new_page = save_privacy_page($title_post, $content_post);
53
+ $privacy_page_id = (int)$id_privacy_new_page;
54
+ $params["choice"] = 'page';
55
+ $params["ginger_privacy_page"] = $privacy_page_id;
56
+
57
+ } elseif (isset($params["ginger_privacy_page"]) && !empty($params["ginger_privacy_page"])) {
58
+ $params["ginger_privacy_page"] = (int)$params["ginger_privacy_page"];
59
+ }
60
+ update_option($key . '_disable_ginger', $params["ginger_privacy_click_scroll"]);
61
+ update_option($key . '_disable_logger', $params["ginger_disable_logger"] == '1');
62
+ }
63
+ update_option($key, $params);
64
+ echo '<div class="updated"><p>' . __('Updated!', 'ginger') . '</p></div>';
65
+ }
66
+
67
+ wp_die(); // this is required to terminate immediately and return a proper response
68
+ }
69
+
70
+
71
+ // Write our JS below here
72
+
73
+ function ginger_save_javascript()
74
+ {
75
+ list($tab, $key) = tabSelection();
76
+
77
+ ?>
78
+ <script type="text/javascript">
79
+ jQuery(document).ready(function () {
80
+ jQuery('#submit').on('click', function (e) {
81
+ e.preventDefault();
82
+
83
+ jQuery("body").append('<div id="overloader" ' +
84
+ 'style="position: fixed;\n' +
85
+ ' top: 0;\n' +
86
+ ' left: 0;\n' +
87
+ ' z-index: 99999;\n' +
88
+ ' width: 100%;\n' +
89
+ ' height: 100%;\n' +
90
+ ' background: rgba(0, 0, 0, 0.5);">' +
91
+ '<div id="saveMessage" style="color: white; width: 100%; text-align: center;height: 100%;top: 50%;position: absolute;font-size: 2rem;">Saving....</div></div>');
92
+
93
+ const data = {
94
+ 'action': 'ginger_save_action',
95
+ 'submit': true,
96
+ 'key': "<?php echo $key; ?>"
97
+ };
98
+
99
+ jQuery.each(jQuery('#ginger_save_data').serializeArray(), function (i, field) {
100
+ data[field.name] = field.value;
101
+ });
102
+
103
+ console.log(data);
104
+
105
+
106
+ jQuery.post(ajaxurl, data, function (response) {
107
+
108
+ jQuery('#saveMessage').text('Saved!');
109
+ setTimeout(function () {
110
+ jQuery('#overloader').remove();
111
+ }, 1000);
112
+
113
+ console.log(response);
114
+ });
115
+ });
116
+
117
+ });
118
+ </script>
119
+ <?php
120
+ }
121
+
122
+
123
+ add_action('wp_ajax_ginger_save_info', 'ginger_save_info');
124
+
125
+ function ginger_save_info()
126
+ {
127
+
128
+ if (isset($_POST) && !empty($_POST)) {
129
+ foreach ($_POST as $key => $value) {
130
+ if (substr($key, 0, 7) === 'ginger_') {
131
+ update_option($key, $value, false);
132
+ echo 'Added: ' . $key;
133
+ }
134
+ }
135
+ }
136
+
137
+ wp_die(); // this is required to terminate immediately and return a proper response
138
+ }
139
+
140
+
141
+
142
+ add_action('wp_ajax_ginger_share_to_ws', 'ginger_share_to_ws');
143
+
144
+ function ginger_share_to_ws()
145
+ {
146
+ ginger_send_data();
147
+ wp_die(); // this is required to terminate immediately and return a proper response
148
+ }
admin/js/clipboard.min.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*!
2
+ * clipboard.js v2.0.0
3
+ * https://zenorocha.github.io/clipboard.js
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=3)}([function(t,e,n){var o,r,i;!function(a,c){r=[t,n(7)],o=c,void 0!==(i="function"==typeof o?o.apply(e,r):o)&&(t.exports=i)}(0,function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(t){return t&&t.__esModule?t:{default:t}}(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),a=function(){function t(e){n(this,t),this.resolveOptions(e),this.initSelection()}return i(t,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,o.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,o.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=a})},function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return r(t,e,n);if(c.nodeList(t))return i(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function r(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function i(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return u(document.body,t,e,n)}var c=n(6),u=n(5);t.exports=o},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){r.off(t,o),e.apply(n,arguments)}var r=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;for(o;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var o,r,i;!function(a,c){r=[t,n(0),n(2),n(1)],o=c,void 0!==(i="function"==typeof o?o.apply(e,r):o)&&(t.exports=i)}(0,function(t,e,n,o){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=r(e),s=r(n),f=r(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),p=function(t){function e(t,n){i(this,e);var o=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return o.resolveOptions(n),o.listenClick(t),o}return c(e,t),h(e,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===d(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,f.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(s.default);t.exports=p})},function(t,e){function n(t,e){for(;t&&t.nodeType!==o;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var o=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}t.exports=n},function(t,e,n){function o(t,e,n,o,r){var a=i.apply(this,arguments);return t.addEventListener(n,a,r),{destroy:function(){t.removeEventListener(n,a,r)}}}function r(t,e,n,r,i){return"function"==typeof t.addEventListener?o.apply(null,arguments):"function"==typeof n?o.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return o(t,e,n,r,i)}))}function i(t,e,n,o){return function(n){n.delegateTarget=a(n.target,e),n.delegateTarget&&o.call(t,n)}}var a=n(4);t.exports=r},function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e){function n(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}t.exports=n}])});
admin/js/ginger.color.js CHANGED
File without changes
admin/js/ginger.js CHANGED
@@ -64,3 +64,73 @@ function en_dis_able_add_on(id,id_img,id_text){
64
  }
65
 
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  }
67
+
68
+ function ginger_share_data(){
69
+
70
+ jQuery(document).ready(function () {
71
+ jQuery('#ginger_share_data').on('click', function (e) {
72
+ e.preventDefault();
73
+ const email_auth = jQuery(this).data('email');
74
+ const url = 'http://ginger.manafactory.it/user/create';
75
+ const data = {
76
+ email: email_auth,
77
+ };
78
+
79
+ const ginger_statistic_share = jQuery('#ginger_informations_share').val();
80
+ const ginger_informations_share = jQuery('#ginger_informations_share').val();
81
+
82
+
83
+
84
+ const request = jQuery.ajax({
85
+ url: url,
86
+ type: 'POST',
87
+ data: JSON.stringify(data),
88
+ processData: false,
89
+ contentType: 'application/json',
90
+ success: function(data, textStatus, request){
91
+ const token = request.getResponseHeader('x-auth');
92
+ const data_token = {
93
+ 'action': 'ginger_save_info',
94
+ ginger_token: token,
95
+ ginger_share_data: true,
96
+ ginger_email_share_data: email_auth,
97
+ ginger_statistic_share: ginger_statistic_share,
98
+ ginger_informations_share: ginger_informations_share
99
+ };
100
+ jQuery.post(ajaxurl, data_token, function (response) {
101
+
102
+ const data_token = {
103
+ 'action': 'ginger_share_to_ws',
104
+ };
105
+ jQuery.post(ajaxurl, data_token, function (response) {
106
+ tb_remove();
107
+ });
108
+ });
109
+ },
110
+ error: function (request, textStatus, errorThrown) {
111
+ alert(request.getResponseHeader('some_header'));
112
+ }
113
+ });
114
+ });
115
+ });
116
+ }
117
+
118
+
119
+
120
+
121
+
122
+ if(ClipboardJS.isSupported()){
123
+ const clipboard = new ClipboardJS('.btn');
124
+ clipboard.on('success', function(e) {
125
+ e.trigger.innerHTML = 'Copied!';
126
+ setTimeout(function() {
127
+ e.trigger.innerHTML = 'Copy to clipboard';
128
+ e.clearSelection();
129
+ }, 1000, e);
130
+ });
131
+
132
+ clipboard.on('error', function(e) {
133
+ console.error('Action:', e.action);
134
+ console.error('Trigger:', e.trigger);
135
+ });
136
+ }
admin/js/jquery.repeater-master/.gitignore CHANGED
File without changes
admin/js/jquery.repeater-master/.jshintrc CHANGED
File without changes
admin/js/jquery.repeater-master/jquery.repeater.js CHANGED
File without changes
admin/js/jquery.repeater-master/jquery.repeater.min.js CHANGED
File without changes
admin/js/jquery_lined_textarea/jquery-linedtextarea.css CHANGED
File without changes
admin/js/jquery_lined_textarea/jquery-linedtextarea.js CHANGED
File without changes
admin/partial/admin-permission.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin permission role page
4
+ */
5
+
6
+ require_once plugin_dir_path( __DIR__ ) . 'inc/admin-permission.php';
7
+ $registerdRoles = getAllRegisterdRole();
8
+ $selectedRole = getSelectedPermissionLevel();
9
+ ?>
10
+
11
+
12
+ <h3>
13
+ <?php _e("Admin Permission", "ginger"); ?>
14
+ </h3>
15
+
16
+ <p>
17
+ <?php _e("Please, select minimum role can access to the settings page of Ginger", "ginger"); ?>
18
+ </p>
19
+
20
+ <div>
21
+ <form>
22
+ <?php foreach ($registerdRoles as $key => $role): ?>
23
+ <?php $firstRole = get_first_role_permission($role['capabilities']); ?>
24
+ <input
25
+ type="radio"
26
+ name="ginger_role_choice"
27
+ value="<?php echo $firstRole; ?>"
28
+ <?php checked( $selectedRole, $firstRole, true ); ?>
29
+ <?php if($firstRole == 'switch_themes' && $selectedRole == '') {
30
+ echo 'checked';
31
+ }?>
32
+ > <?php echo $role['name']; ?>
33
+ <br/>
34
+ <?php endforeach ; ?>
35
+ </form>
36
+ </div>
37
+
38
+
39
+
40
+
admin/partial/banner.php CHANGED
@@ -12,13 +12,19 @@
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"
16
- class="tog" <?php if (is_array($options) && $options["ginger_banner_type"] == "bar") echo ' checked="checked" '; ?>><?php _e("Bar", "ginger"); ?>
17
- </label></p>
 
 
 
18
 
19
- <p><label><input name="ginger_banner_type" type="radio" value="dialog"
20
- class="tog" <?php if (is_array($options) && $options["ginger_banner_type"] == "dialog") echo ' checked="checked" '; ?>><?php _e("Dialog", "ginger"); ?>
21
- </label></p>
 
 
 
22
  </fieldset>
23
  </td>
24
  </tr>
@@ -43,7 +49,7 @@
43
  <fieldset>
44
  <legend class="screen-reader-text"><span><?php _e("Banner Text", "ginger"); ?></span></legend>
45
  <p><label><?php
46
- if(is_array($options)) {
47
  if (function_exists("wp_editor"))
48
  wp_editor(stripslashes($options["ginger_banner_text"]), "ginger_bar_text", array('textarea_name' => "ginger_banner_text", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
49
  else
@@ -63,7 +69,7 @@
63
  <fieldset>
64
  <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
65
  <p><label><?php
66
- if(is_array($options)) {
67
  if (function_exists("wp_editor"))
68
  wp_editor(stripslashes($options["ginger_Iframe_text"]), "ginger_Iframe_text", array('textarea_name' => "ginger_Iframe_text", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
69
  else
@@ -115,7 +121,7 @@
115
 
116
 
117
  <img id="img_disable_cookie_button_status"
118
- src="<?php if (is_array($options) && isset($options['disable_cookie_button_status']) && $options['disable_cookie_button_status'] == "1") {
119
  echo plugins_url('ginger/img/ok.png');
120
  } else {
121
  echo plugins_url('ginger/img/xx.png');
@@ -151,7 +157,8 @@
151
  <td>
152
  <fieldset>
153
  <legend class="screen-reader-text"><span><?php _e("Background", "ginger"); ?></span></legend>
154
- <p><label><input type="text" name="background_color" value="<?php if(is_array($options)) echo $options["background_color"]; ?>"
 
155
  class="color-field"></label></p>
156
  </fieldset>
157
  </td>
@@ -161,7 +168,8 @@
161
  <td>
162
  <fieldset>
163
  <legend class="screen-reader-text"><span><?php _e("Text", "ginger"); ?></span></legend>
164
- <p><label><input type="text" name="text_color" value="<?php if(is_array($options)) echo $options["text_color"]; ?>"
 
165
  class="color-field"></label></p>
166
  </fieldset>
167
  </td>
@@ -172,7 +180,8 @@
172
  <td>
173
  <fieldset>
174
  <legend class="screen-reader-text"><span><?php _e("Button", "ginger"); ?></span></legend>
175
- <p><label><input type="text" name="button_color" value="<?php if(is_array($options)) echo $options["button_color"]; ?>"
 
176
  class="color-field"></label></p>
177
  </fieldset>
178
  </td>
@@ -182,7 +191,8 @@
182
  <td>
183
  <fieldset>
184
  <legend class="screen-reader-text"><span><?php _e("Button Text Color", "ginger"); ?></span></legend>
185
- <p><label><input type="text" name="button_text_color" value="<?php if(is_array($options)) echo $options["button_text_color"]; ?>"
 
186
  class="color-field"></label></p>
187
  </fieldset>
188
  </td>
@@ -192,7 +202,8 @@
192
  <td>
193
  <fieldset>
194
  <legend class="screen-reader-text"><span><?php _e("Link", "ginger"); ?></span></legend>
195
- <p><label><input type="text" name="link_color" value="<?php if(is_array($options)) echo $options["link_color"]; ?>"
 
196
  class="color-field"></label></p>
197
  </fieldset>
198
  </td>
@@ -206,10 +217,12 @@
206
  <th scope="row" style="padding-left:20px;"><?php _e("Insert here your banner custom CSS", "ginger"); ?></th>
207
  <td>
208
  <fieldset>
209
- <legend class="screen-reader-text"><span><?php _e("Insert here your banner custom CSS", "ginger"); ?></span></legend>
 
210
  <p>
211
  <label>
212
- <textarea name = "ginger_css" cols="100" rows="20" class="lined"><?php if(is_array($options)) echo $options["ginger_css"];?></textarea>
 
213
 
214
  </label>
215
  </p>
@@ -220,9 +233,9 @@
220
  </table>
221
 
222
  <script>
223
- jQuery(function() {
224
- jQuery(".lined").linedtextarea(
225
- {selectedLine: 1}
226
- );
227
- });
228
  </script>
12
  <td>
13
  <fieldset>
14
  <legend class="screen-reader-text"><span><?php _e("Choose Banner Type", "ginger"); ?></span></legend>
15
+ <p>
16
+ <label>
17
+ <input name="ginger_banner_type" type="radio" value="bar"
18
+ class="tog" <?php if (is_array($options) && $options["ginger_banner_type"] == "bar") echo ' checked="checked" '; ?>><?php _e("Bar", "ginger"); ?>
19
+ </label>
20
+ </p>
21
 
22
+ <p>
23
+ <label>
24
+ <input name="ginger_banner_type" type="radio" value="dialog"
25
+ class="tog" <?php if (is_array($options) && $options["ginger_banner_type"] == "dialog") echo ' checked="checked" '; ?>><?php _e("Dialog", "ginger"); ?>
26
+ </label>
27
+ </p>
28
  </fieldset>
29
  </td>
30
  </tr>
49
  <fieldset>
50
  <legend class="screen-reader-text"><span><?php _e("Banner Text", "ginger"); ?></span></legend>
51
  <p><label><?php
52
+ if (is_array($options)) {
53
  if (function_exists("wp_editor"))
54
  wp_editor(stripslashes($options["ginger_banner_text"]), "ginger_bar_text", array('textarea_name' => "ginger_banner_text", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
55
  else
69
  <fieldset>
70
  <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
71
  <p><label><?php
72
+ if (is_array($options)) {
73
  if (function_exists("wp_editor"))
74
  wp_editor(stripslashes($options["ginger_Iframe_text"]), "ginger_Iframe_text", array('textarea_name' => "ginger_Iframe_text", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
75
  else
121
 
122
 
123
  <img id="img_disable_cookie_button_status"
124
+ src="<?php if (is_array($options) && isset($options['disable_cookie_button_status']) && $options['disable_cookie_button_status'] == "1") {
125
  echo plugins_url('ginger/img/ok.png');
126
  } else {
127
  echo plugins_url('ginger/img/xx.png');
157
  <td>
158
  <fieldset>
159
  <legend class="screen-reader-text"><span><?php _e("Background", "ginger"); ?></span></legend>
160
+ <p><label><input type="text" name="background_color"
161
+ value="<?php if (is_array($options)) echo $options["background_color"]; ?>"
162
  class="color-field"></label></p>
163
  </fieldset>
164
  </td>
168
  <td>
169
  <fieldset>
170
  <legend class="screen-reader-text"><span><?php _e("Text", "ginger"); ?></span></legend>
171
+ <p><label><input type="text" name="text_color"
172
+ value="<?php if (is_array($options)) echo $options["text_color"]; ?>"
173
  class="color-field"></label></p>
174
  </fieldset>
175
  </td>
180
  <td>
181
  <fieldset>
182
  <legend class="screen-reader-text"><span><?php _e("Button", "ginger"); ?></span></legend>
183
+ <p><label><input type="text" name="button_color"
184
+ value="<?php if (is_array($options)) echo $options["button_color"]; ?>"
185
  class="color-field"></label></p>
186
  </fieldset>
187
  </td>
191
  <td>
192
  <fieldset>
193
  <legend class="screen-reader-text"><span><?php _e("Button Text Color", "ginger"); ?></span></legend>
194
+ <p><label><input type="text" name="button_text_color"
195
+ value="<?php if (is_array($options)) echo $options["button_text_color"]; ?>"
196
  class="color-field"></label></p>
197
  </fieldset>
198
  </td>
202
  <td>
203
  <fieldset>
204
  <legend class="screen-reader-text"><span><?php _e("Link", "ginger"); ?></span></legend>
205
+ <p><label><input type="text" name="link_color"
206
+ value="<?php if (is_array($options)) echo $options["link_color"]; ?>"
207
  class="color-field"></label></p>
208
  </fieldset>
209
  </td>
217
  <th scope="row" style="padding-left:20px;"><?php _e("Insert here your banner custom CSS", "ginger"); ?></th>
218
  <td>
219
  <fieldset>
220
+ <legend class="screen-reader-text">
221
+ <span><?php _e("Insert here your banner custom CSS", "ginger"); ?></span></legend>
222
  <p>
223
  <label>
224
+ <textarea name="ginger_css" cols="100" rows="20"
225
+ class="lined"><?php if (is_array($options)) echo $options["ginger_css"]; ?></textarea>
226
 
227
  </label>
228
  </p>
233
  </table>
234
 
235
  <script>
236
+ jQuery(function () {
237
+ jQuery(".lined").linedtextarea(
238
+ {selectedLine: 1}
239
+ );
240
+ });
241
  </script>
admin/partial/bar.php CHANGED
File without changes
admin/partial/dialog.php CHANGED
File without changes
admin/partial/general.php CHANGED
@@ -1,326 +1,381 @@
1
- <table class="form-table striped">
2
- <thead>
3
- <tr>
4
- <td colspan="2">
5
- <h2><?php _e("Ginger is currently", "ginger"); ?>: <b><?php if(is_array($options) && $options["enable_ginger"]) _e("enabled", "ginger"); else _e("disabled", "ginger"); ?></b> </h2>
6
- </td>
7
- </tr>
8
- </thead>
9
- <tbody>
10
- <tr>
11
- <th scope="row" style="padding-left:20px;"><?php _e("Enable Ginger", "ginger"); ?></th>
12
- <td>
13
- <fieldset>
14
- <legend class="screen-reader-text"><span><?php _e("Enable Ginger", "ginger"); ?></span></legend>
15
- <p>
16
- <label>
17
- <input name="enable_ginger" type="radio" value="1" class="tog" <?php if(is_array($options) && $options["enable_ginger"] == "1") echo ' checked="checked" '; ?>><?php _e("Enabled", "ginger"); ?>
18
- </label>
19
- </p>
20
- <p>
21
- <label>
22
- <input name="enable_ginger" type="radio" value="0" class="tog" <?php if(is_array($options) && $options["enable_ginger"] == "0") echo ' checked="checked" '; ?>><?php _e("Disabled", "ginger"); ?>
23
- </label>
24
- </p>
25
- </fieldset>
26
- </td>
27
- </tr>
28
- <tr>
29
- <th scope="row" style="padding-left:20px;"><?php _e("Do you have a cache system?", "ginger"); ?></th>
30
- <td>
31
- <fieldset>
32
- <legend class="screen-reader-text"><span><?php _e("Do you have a cache system?", "ginger"); ?></span></legend>
33
- <p>
34
- <label>
35
- <input name="ginger_cache" type="radio" value="yes" class="tog" <?php if(is_array($options) && $options["ginger_cache"] == "yes") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
36
- </label>
37
- </p>
38
- <p>
39
- <label>
40
- <input name="ginger_cache" type="radio" value="no" class="tog" <?php if(is_array($options) && $options["ginger_cache"] == "no") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
41
- </label>
42
- </p>
43
- <p>
44
- <small style="padding-top: 20px">
45
- <i>(<?php _e("If you have a caching system (W3TC, Varnish, WP Super Cash...) choose YES. Ginger will optimize websites performances", "ginger"); ?>)</i>
46
- </small>
47
- </p>
48
- </fieldset>
49
- </td>
50
- </tr>
51
- <tr>
52
- <th scope="row" style="padding-left:20px;"><?php _e("Cookie Confirmation Type", "ginger"); ?></th>
53
- <td>
54
- <fieldset>
55
- <legend class="screen-reader-text"><span><?php _e("Cookie Confirmation Type", "ginger"); ?></span></legend>
56
- <p>
57
- <label>
58
- <input name="ginger_opt" type="radio" value="in" class="tog" <?php if(is_array($options) && $options["ginger_opt"] == "in") echo ' checked="checked" '; ?>><?php _e("Opt-In", "ginger"); ?>
59
- </label>
60
- <small>
61
- (<?php _e("Cookies are disabled until banner is accepted", "ginger"); ?>)
62
- </small>
63
- </p>
64
- <p>
65
- <label>
66
- <input name="ginger_opt" type="radio" value="out" class="tog" <?php if(is_array($options) && $options["ginger_opt"] == "out") echo ' checked="checked" '; ?>><?php _e("Opt-Out", "ginger"); ?>
67
- </label>
68
- <small>
69
- (<?php _e("Cookies are disabled only if explicitly requested", "ginger"); ?>)
70
- </small>
71
- </p>
72
- <p>
73
- <small style="padding-top: 20px">
74
- <i>(<?php _e("Choose OPT-IN if you're in Italy", "ginger"); ?>)</i>
75
- </small>
76
- </p>
77
- </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- </td>
80
- </tr>
81
- <tr>
82
- <th scope="row" style="padding-left:20px;"><?php _e("Let scroll to confirm", "ginger"); ?></th>
83
- <td>
84
- <fieldset>
85
- <legend class="screen-reader-text">
86
- <span><?php _e("Let scroll to confirm", "ginger"); ?></span>
87
- </legend>
88
- <p>
89
- <label>
90
- <input name="ginger_scroll" type="radio" value="1" class="tog" <?php if(is_array($options) && $options["ginger_scroll"] == "1") echo ' checked="checked" '; ?>><?php _e("Scroll to accept cookie", "ginger"); ?>
91
- </label>
92
- </p>
93
- <p>
94
- <label>
95
- <input name="ginger_scroll" type="radio" value="0" class="tog" <?php if(is_array($options) && $options["ginger_scroll"] == "0") echo ' checked="checked" '; ?>><?php _e("Keep banner after scroll", "ginger"); ?>
96
- </label>
97
- </p>
98
- </fieldset>
99
- </td>
100
- </tr>
101
- <tr>
102
- <th scope="row" style="padding-left:20px;"><?php _e("Click out of banner to accept cookie", "ginger"); ?></th>
103
- <td>
104
- <fieldset>
105
- <legend class="screen-reader-text">
106
- <span><?php _e("Click out of banner to accept cookie", "ginger"); ?></span>
107
- </legend>
108
- <p>
109
- <label>
110
- <input name="ginger_click_out" type="radio" value="1" class="tog" <?php if(is_array($options) && $options["ginger_click_out"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
111
- </label>
112
- </p>
113
- <p>
114
- <label>
115
- <input name="ginger_click_out" type="radio" value="0" class="tog" <?php if(is_array($options) && $options["ginger_click_out"] == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
116
- </label>
117
- </p>
118
- </fieldset>
119
- </td>
120
- </tr>
121
- <tr>
122
- <th scope="row" style="padding-left:20px;"><?php _e("Force reload page", "ginger"); ?></th>
123
- <td>
124
- <fieldset>
125
- <legend class="screen-reader-text">
126
- <span><?php _e("Force reload page", "ginger"); ?></span>
127
- </legend>
128
- <p>
129
- <label>
130
- <input name="ginger_force_reload" type="radio" value="1" class="tog" <?php if(is_array($options) && $options["ginger_force_reload"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
131
- </label>
132
- </p>
133
- <p>
134
- <label>
135
- <input name="ginger_force_reload" type="radio" value="0" class="tog" <?php if(is_array($options) && $options["ginger_force_reload"] == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
136
- </label>
137
- </p>
138
- </fieldset>
139
- </td>
140
- </tr>
141
- <tr>
142
- <th scope="row" style="padding-left:20px;"><?php _e("Stress Mode", "ginger"); ?></th>
143
- <td>
144
- <fieldset>
145
- <legend class="screen-reader-text">
146
- <span><?php _e("Keep banner until acceptance", "ginger"); ?></span>
147
- </legend>
148
- <p>
149
- <label>
150
- <input name="ginger_keep_banner" type="radio" value="1" class="tog" <?php if(is_array($options) && $options["ginger_keep_banner"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
151
- </label>
152
- </p>
153
- <p>
154
- <label>
155
- <input name="ginger_keep_banner" type="radio" value="0" class="tog" <?php if(is_array($options) && $options["ginger_keep_banner"] == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
156
- </label>
157
- </p>
158
- <p>
159
- <small style="padding-top: 20px">
160
- <i>(<?php _e("If cookies are not accepted the banner will continues to be shown minimized", "ginger"); ?>)</i>
161
- </small>
162
- </p>
163
- </fieldset>
164
- </td>
165
- </tr>
166
- <tr>
167
- <th scope="row" style="padding-left:20px;"><?php _e("Cookies Duration", "ginger"); ?></th>
168
- <td>
169
- <fieldset>
170
- <legend class="screen-reader-text">
171
- <span><?php _e("Select cookies duration", "ginger"); ?></span>
172
- </legend>
173
- <p>
174
- <label><?php _e("Select cookies duration", "ginger"); ?></label>
175
- <select name="ginger_cookie_duration">
176
- <option value=""><?php _e('Select', 'ginger')?></option>
177
- <option value="1" <?php if (is_array($options) && $options['ginger_cookie_duration']=='1'){echo 'selected';}?>><?php _e('1 Day', 'ginger')?></option>
178
- <option value="30" <?php if (is_array($options) && $options['ginger_cookie_duration']=='30'){echo 'selected';}?>><?php _e('1 Month', 'ginger')?></option>
179
- <option value="365" <?php if (is_array($options) && $options['ginger_cookie_duration']=='365'){echo 'selected';}?>><?php _e('1 Year', 'ginger')?></option>
180
- <option value="365000" <?php if (is_array($options) && $options['ginger_cookie_duration']=='365000'){echo 'selected';}?>><?php _e('For ever', 'ginger')?></option>
181
- </select>
182
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
- </fieldset>
185
- </td>
186
- </tr>
187
- <tr>
188
- <th scope="row" style="padding-left:20px;"><?php _e("Disable Ginger for logged users", "ginger"); ?></th>
189
- <td>
190
- <fieldset>
191
- <legend class="screen-reader-text">
192
- <span><?php _e("Disable Ginger for logged users", "ginger"); ?></span>
193
- </legend>
194
- <label>
195
- <input name="ginger_logged_users" type="radio" value="1" class="tog" <?php if(is_array($options) && isset($options["ginger_logged_users"]) && $options["ginger_logged_users"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
196
- </label>
197
- </p>
198
- <p>
199
- <label>
200
- <input name="ginger_logged_users" type="radio" value="0" class="tog" <?php if(is_array($options) && (!isset($options["ginger_logged_users"]) || $options["ginger_logged_users"] == "0")) echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
201
- </label>
202
- </p>
203
- </p>
 
 
204
 
205
- </fieldset>
206
- </td>
207
- </tr>
208
 
209
- <tr>
210
- <th class="escludi-pagine" scope="row" style="padding-left:20px;"><?php _e("Disable Ginger for those pages", "ginger"); ?></th>
211
- <td>
212
- <fieldset>
213
- <div data-repeater-list="pagine_escluse">
214
- <?php if (is_array($options) && !empty($options['pagine_escluse'])):?>
 
215
 
216
 
217
- <?php foreach ($options['pagine_escluse'] as $array_pagine):?>
218
 
219
  <?php $args = array(
220
- 'sort_order' => 'asc',
221
- 'sort_column' => 'post_title',
222
- 'hierarchical' => 1,
223
- 'exclude' => '',
224
- 'include' => '',
225
- 'meta_key' => '',
226
- 'meta_value' => '',
227
- 'authors' => '',
228
- 'child_of' => 0,
229
- 'parent' => -1,
230
- 'exclude_tree' => '',
231
- 'number' => '',
232
- 'offset' => 0,
233
- 'post_type' => 'page',
234
- 'post_status' => 'publish'
235
- );
236
- $pages = get_pages($args);
237
  ?>
238
  <div data-repeater-item>
239
  <select name="select-input" style="min-width:30%">
240
- <option value=""><?php _e( 'Select', 'ginger'); ?></option>
241
 
242
- <?php
243
- foreach ($pages as $page):
244
- ?>
245
- <option value="<?php echo $page->ID;?>" <?php if ($array_pagine['select-input']==$page->ID): echo "selected"; endif;?>><?php echo $page->post_title;?></option>
246
- <?php
247
- endforeach;
248
- ?>
249
  </select>
250
- <input data-repeater-delete type="button" value="<?php _e('Cancella', 'ginger'); ?>" class="button button-primary" style="background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
 
 
251
  </div>
252
- <?php endforeach;?>
253
-
254
- <?php else:?>
255
 
 
256
 
257
 
258
- <?php $args = array(
259
- 'sort_order' => 'asc',
260
- 'sort_column' => 'post_title',
261
- 'hierarchical' => 1,
262
- 'exclude' => '',
263
- 'include' => '',
264
- 'meta_key' => '',
265
- 'meta_value' => '',
266
- 'authors' => '',
267
- 'child_of' => 0,
268
- 'parent' => -1,
269
- 'exclude_tree' => '',
270
- 'number' => '',
271
- 'offset' => 0,
272
- 'post_type' => 'page',
273
- 'post_status' => 'publish'
274
- );
275
- $pages = get_pages($args);
276
- ?>
277
- <div data-repeater-item>
278
- <select name="select-input" style="min-width:30%">
279
- <option value=""><?php _e( 'Select', 'ginger'); ?></option>
280
 
281
- <?php
282
  foreach ($pages as $page):
283
- ?>
284
- <option value="<?php echo $page->ID;?>"><?php echo $page->post_title;?></option>
285
- <?php
286
- endforeach;
287
- ?>
288
- </select>
289
- <input data-repeater-delete type="button" value="<?php _e('Delete', 'ginger'); ?>" class="button button-primary" style="background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
290
- </div>
291
-
292
- <?php endif;?>
293
-
294
-
295
-
296
  </div>
297
- <input data-repeater-create type="button" value="<?php _e('+', 'ginger'); ?>" class="button button-primary" style="margin-top: 8px; background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
298
- <p>
299
- <small style="padding-top: 20px">
300
- <i>(<?php _e("Select pages in which Ginger is disabled", "ginger"); ?>)</i>
301
- </small>
302
- </p>
303
- </fieldset>
304
- </td>
305
- </tr>
306
- </tbody>
307
- </table>
308
 
 
309
 
310
 
311
- <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  jQuery(document).ready(function () {
313
- 'use strict';
314
  jQuery('.repeater').repeater({
315
-
316
  show: function () {
317
  jQuery(this).slideDown();
318
  },
319
  hide: function (deleteElement) {
320
- if(confirm('Are you sure you want to delete this element?')) {
321
  jQuery(this).slideUp(deleteElement);
322
  }
323
  }
324
  });
325
  });
326
- </script>
1
+ <table class="form-table striped">
2
+ <thead>
3
+ <tr>
4
+ <td colspan="2">
5
+ <h2><?php _e("Ginger is currently", "ginger"); ?>:
6
+ <b><?php if (is_array($options) && $options["enable_ginger"]) _e("enabled", "ginger"); else _e("disabled", "ginger"); ?></b>
7
+ </h2>
8
+ </td>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <tr>
13
+ <th scope="row" style="padding-left:20px;"><?php _e("Enable Ginger", "ginger"); ?></th>
14
+ <td>
15
+ <fieldset>
16
+ <legend class="screen-reader-text"><span><?php _e("Enable Ginger", "ginger"); ?></span></legend>
17
+ <p>
18
+ <label>
19
+ <input name="enable_ginger" type="radio" value="1"
20
+ class="tog"
21
+ <?php checked(ginger_check_value($options, 'enable_ginger'), 1); ?>><?php _e("Enabled", "ginger"); ?>
22
+ </label>
23
+ </p>
24
+ <p>
25
+ <label>
26
+ <input name="enable_ginger" type="radio" value="0"
27
+ class="tog" <?php checked(ginger_check_value($options, 'enable_ginger'), 0); ?>><?php _e("Disabled", "ginger"); ?>
28
+ </label>
29
+ </p>
30
+ </fieldset>
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <th scope="row" style="padding-left:20px;"><?php _e("Do you have a cache system?", "ginger"); ?></th>
35
+ <td>
36
+ <fieldset>
37
+ <legend class="screen-reader-text"><span><?php _e("Do you have a cache system?", "ginger"); ?></span>
38
+ </legend>
39
+ <p>
40
+ <label>
41
+ <input name="ginger_cache" type="radio" value="yes"
42
+ class="tog" <?php checked(ginger_check_value($options, 'ginger_cache'), 'yes'); ?>><?php _e("Yes", "ginger"); ?>
43
+ </label>
44
+ </p>
45
+ <p>
46
+ <label>
47
+ <input name="ginger_cache" type="radio" value="no"
48
+ class="tog"
49
+ <?php checked(ginger_check_value($options, 'ginger_cache'), 'no'); ?>
50
+ ><?php _e("No", "ginger"); ?>
51
+ </label>
52
+ </p>
53
+ <p>
54
+ <small style="padding-top: 20px">
55
+ <i>(<?php _e("If you have a caching system (W3TC, Varnish, WP Super Cash...) choose YES. Ginger will optimize websites performances", "ginger"); ?>
56
+ )</i>
57
+ </small>
58
+ </p>
59
+ </fieldset>
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <th scope="row" style="padding-left:20px;"><?php _e("Cookie Confirmation Type", "ginger"); ?></th>
64
+ <td>
65
+ <fieldset>
66
+ <legend class="screen-reader-text"><span><?php _e("Cookie Confirmation Type", "ginger"); ?></span>
67
+ </legend>
68
+ <p>
69
+ <label>
70
+ <input name="ginger_opt" type="radio" value="in"
71
+ class="tog"
72
+ <?php checked(ginger_check_value($options, 'ginger_opt'), 'in'); ?>
73
+ ><?php _e("Opt-In", "ginger"); ?>
74
+ </label>
75
+ <small>
76
+ (<?php _e("Cookies are disabled until banner is accepted", "ginger"); ?>)
77
+ </small>
78
+ </p>
79
+ <p>
80
+ <label>
81
+ <input name="ginger_opt" type="radio" value="out"
82
+ class="tog"
83
+ <?php checked(ginger_check_value($options, 'ginger_opt'), 'out'); ?>
84
+ ><?php _e("Opt-Out", "ginger"); ?>
85
+ </label>
86
+ <small>
87
+ (<?php _e("Cookies are disabled only if explicitly requested", "ginger"); ?>)
88
+ </small>
89
+ </p>
90
+ <p>
91
+ <small style="padding-top: 20px">
92
+ <i>(<?php _e("Choose OPT-IN if you're in Italy", "ginger"); ?>)</i>
93
+ </small>
94
+ </p>
95
+ </fieldset>
96
 
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <th scope="row" style="padding-left:20px;"><?php _e("Let scroll to confirm", "ginger"); ?></th>
101
+ <td>
102
+ <fieldset>
103
+ <legend class="screen-reader-text">
104
+ <span><?php _e("Let scroll to confirm", "ginger"); ?></span>
105
+ </legend>
106
+ <p>
107
+ <label>
108
+ <input name="ginger_scroll" type="radio" value="1"
109
+ class="tog"
110
+ <?php
111
+ checked(ginger_check_value($options, 'ginger_scroll'), '1'); ?>
112
+ ><?php _e("Scroll to accept cookie", "ginger"); ?>
113
+ </label>
114
+ </p>
115
+ <p>
116
+ <label>
117
+ <input name="ginger_scroll" type="radio" value="0"
118
+ class="tog"
119
+ <?php checked(ginger_check_value($options, 'ginger_scroll'), '0'); ?>
120
+ ><?php _e("Keep banner after scroll", "ginger"); ?>
121
+ </label>
122
+ </p>
123
+ </fieldset>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <th scope="row" style="padding-left:20px;"><?php _e("Click out of banner to accept cookie", "ginger"); ?></th>
128
+ <td>
129
+ <fieldset>
130
+ <legend class="screen-reader-text">
131
+ <span><?php _e("Click out of banner to accept cookie", "ginger"); ?></span>
132
+ </legend>
133
+ <p>
134
+ <label>
135
+ <input name="ginger_click_out" type="radio" value="1"
136
+ class="tog"
137
+ <?php checked(ginger_check_value($options, 'ginger_click_out'), '1'); ?>
138
+ ><?php _e("Yes", "ginger"); ?>
139
+ </label>
140
+ </p>
141
+ <p>
142
+ <label>
143
+ <input name="ginger_click_out" type="radio" value="0"
144
+ class="tog"
145
+ <?php checked(ginger_check_value($options, 'ginger_click_out'), '0'); ?>
146
+ ><?php _e("No", "ginger"); ?>
147
+ </label>
148
+ </p>
149
+ </fieldset>
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <th scope="row" style="padding-left:20px;"><?php _e("Force reload page", "ginger"); ?></th>
154
+ <td>
155
+ <fieldset>
156
+ <legend class="screen-reader-text">
157
+ <span><?php _e("Force reload page", "ginger"); ?></span>
158
+ </legend>
159
+ <p>
160
+ <label>
161
+ <input name="ginger_force_reload" type="radio" value="1"
162
+ class="tog"
163
+ <?php checked(ginger_check_value($options, 'ginger_force_reload'), '1'); ?>
164
+ ><?php _e("Yes", "ginger"); ?>
165
+ </label>
166
+ </p>
167
+ <p>
168
+ <label>
169
+ <input name="ginger_force_reload" type="radio" value="0"
170
+ class="tog"
171
+ <?php checked(ginger_check_value($options, 'ginger_force_reload'), '0'); ?>
172
+ ><?php _e("No", "ginger"); ?>
173
+ </label>
174
+ </p>
175
+ </fieldset>
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <th scope="row" style="padding-left:20px;"><?php _e("Stress Mode", "ginger"); ?></th>
180
+ <td>
181
+ <fieldset>
182
+ <legend class="screen-reader-text">
183
+ <span><?php _e("Keep banner until acceptance", "ginger"); ?></span>
184
+ </legend>
185
+ <p>
186
+ <label>
187
+ <input name="ginger_keep_banner" type="radio" value="1"
188
+ class="tog"
189
+ <?php checked(ginger_check_value($options, 'ginger_keep_banner'), '1'); ?>
190
+ ><?php _e("Yes", "ginger"); ?>
191
+ </label>
192
+ </p>
193
+ <p>
194
+ <label>
195
+ <input name="ginger_keep_banner" type="radio" value="0"
196
+ class="tog"
197
+ <?php checked(ginger_check_value($options, 'ginger_keep_banner'), '0'); ?>
198
+ ><?php _e("No", "ginger"); ?>
199
+ </label>
200
+ </p>
201
+ <p>
202
+ <small style="padding-top: 20px">
203
+ <i>(<?php _e("If cookies are not accepted the banner will continues to be shown minimized", "ginger"); ?>
204
+ )</i>
205
+ </small>
206
+ </p>
207
+ </fieldset>
208
+ </td>
209
+ </tr>
210
+ <tr>
211
+ <th scope="row" style="padding-left:20px;"><?php _e("Cookies Duration", "ginger"); ?></th>
212
+ <td>
213
+ <fieldset>
214
+ <legend class="screen-reader-text">
215
+ <span><?php _e("Select cookies duration", "ginger"); ?></span>
216
+ </legend>
217
+ <p>
218
+ <label><?php _e("Select cookies duration", "ginger"); ?></label>
219
+ <select name="ginger_cookie_duration">
220
+ <option value=""><?php _e('Select', 'ginger') ?></option>
221
+ <option value="1" <?php if (is_array($options) && $options['ginger_cookie_duration'] == '1') {
222
+ echo 'selected';
223
+ } ?>><?php _e('1 Day', 'ginger') ?></option>
224
+ <option value="30" <?php if (is_array($options) && $options['ginger_cookie_duration'] == '30') {
225
+ echo 'selected';
226
+ } ?>><?php _e('1 Month', 'ginger') ?></option>
227
+ <option value="365" <?php if (is_array($options) && $options['ginger_cookie_duration'] == '365') {
228
+ echo 'selected';
229
+ } ?>><?php _e('1 Year', 'ginger') ?></option>
230
+ <option value="365000" <?php if (is_array($options) && $options['ginger_cookie_duration'] == '365000') {
231
+ echo 'selected';
232
+ } ?>><?php _e('For ever', 'ginger') ?></option>
233
+ </select>
234
+ </p>
235
 
236
+ </fieldset>
237
+ </td>
238
+ </tr>
239
+ <tr>
240
+ <th scope="row" style="padding-left:20px;"><?php _e("Disable Ginger for logged users", "ginger"); ?></th>
241
+ <td>
242
+ <fieldset>
243
+ <legend class="screen-reader-text">
244
+ <span><?php _e("Disable Ginger for logged users", "ginger"); ?></span>
245
+ </legend>
246
+ <label>
247
+ <input name="ginger_logged_users" type="radio" value="1"
248
+ class="tog" <?php if (is_array($options) && isset($options["ginger_logged_users"]) && $options["ginger_logged_users"] == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
249
+ </label>
250
+ </p>
251
+ <p>
252
+ <label>
253
+ <input name="ginger_logged_users" type="radio" value="0"
254
+ class="tog" <?php if (is_array($options) && (!isset($options["ginger_logged_users"]) || $options["ginger_logged_users"] == "0")) echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
255
+ </label>
256
+ </p>
257
+ </p>
258
 
259
+ </fieldset>
260
+ </td>
261
+ </tr>
262
 
263
+ <tr>
264
+ <th class="escludi-pagine" scope="row"
265
+ style="padding-left:20px;"><?php _e("Disable Ginger for those pages", "ginger"); ?></th>
266
+ <td>
267
+ <fieldset>
268
+ <div data-repeater-list="pagine_escluse">
269
+ <?php if (is_array($options) && !empty($options['pagine_escluse'])): ?>
270
 
271
 
272
+ <?php foreach ($options['pagine_escluse'] as $array_pagine): ?>
273
 
274
  <?php $args = array(
275
+ 'sort_order' => 'asc',
276
+ 'sort_column' => 'post_title',
277
+ 'hierarchical' => 1,
278
+ 'exclude' => '',
279
+ 'include' => '',
280
+ 'meta_key' => '',
281
+ 'meta_value' => '',
282
+ 'authors' => '',
283
+ 'child_of' => 0,
284
+ 'parent' => -1,
285
+ 'exclude_tree' => '',
286
+ 'number' => '',
287
+ 'offset' => 0,
288
+ 'post_type' => 'page',
289
+ 'post_status' => 'publish'
290
+ );
291
+ $pages = get_pages($args);
292
  ?>
293
  <div data-repeater-item>
294
  <select name="select-input" style="min-width:30%">
295
+ <option value=""><?php _e('Select', 'ginger'); ?></option>
296
 
297
+ <?php
298
+ foreach ($pages as $page):
299
+ ?>
300
+ <option value="<?php echo $page->ID; ?>" <?php if ($array_pagine['select-input'] == $page->ID): echo "selected"; endif; ?>><?php echo $page->post_title; ?></option>
301
+ <?php
302
+ endforeach;
303
+ ?>
304
  </select>
305
+ <input data-repeater-delete type="button" value="<?php _e('Cancella', 'ginger'); ?>"
306
+ class="button button-primary"
307
+ style="background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
308
  </div>
309
+ <?php endforeach; ?>
 
 
310
 
311
+ <?php else: ?>
312
 
313
 
314
+ <?php $args = array(
315
+ 'sort_order' => 'asc',
316
+ 'sort_column' => 'post_title',
317
+ 'hierarchical' => 1,
318
+ 'exclude' => '',
319
+ 'include' => '',
320
+ 'meta_key' => '',
321
+ 'meta_value' => '',
322
+ 'authors' => '',
323
+ 'child_of' => 0,
324
+ 'parent' => -1,
325
+ 'exclude_tree' => '',
326
+ 'number' => '',
327
+ 'offset' => 0,
328
+ 'post_type' => 'page',
329
+ 'post_status' => 'publish'
330
+ );
331
+ $pages = get_pages($args);
332
+ ?>
333
+ <div data-repeater-item>
334
+ <select name="select-input" style="min-width:30%">
335
+ <option value=""><?php _e('Select', 'ginger'); ?></option>
336
 
337
+ <?php
338
  foreach ($pages as $page):
339
+ ?>
340
+ <option value="<?php echo $page->ID; ?>"><?php echo $page->post_title; ?></option>
341
+ <?php
342
+ endforeach;
343
+ ?>
344
+ </select>
345
+ <input data-repeater-delete type="button" value="<?php _e('Delete', 'ginger'); ?>"
346
+ class="button button-primary"
347
+ style="background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
 
 
 
 
348
  </div>
 
 
 
 
 
 
 
 
 
 
 
349
 
350
+ <?php endif; ?>
351
 
352
 
353
+ </div>
354
+ <input data-repeater-create type="button" value="<?php _e('+', 'ginger'); ?>"
355
+ class="button button-primary"
356
+ style="margin-top: 8px; background: #F1F1F1; border-color: #B3B3B3; box-shadow: 0 1px 0 #F1F1F1; color: #444; text-shadow: 0 0 0 !important "/>
357
+ <p>
358
+ <small style="padding-top: 20px">
359
+ <i>(<?php _e("Select pages in which Ginger is disabled", "ginger"); ?>)</i>
360
+ </small>
361
+ </p>
362
+ </fieldset>
363
+ </td>
364
+ </tr>
365
+ </tbody>
366
+ </table>
367
+ <script type="text/javascript">
368
  jQuery(document).ready(function () {
 
369
  jQuery('.repeater').repeater({
370
+
371
  show: function () {
372
  jQuery(this).slideDown();
373
  },
374
  hide: function (deleteElement) {
375
+ if (confirm('Are you sure you want to delete this element?')) {
376
  jQuery(this).slideUp(deleteElement);
377
  }
378
  }
379
  });
380
  });
381
+ </script>
admin/partial/ginger-cookie-policy.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3>
2
+ <?php _e("Ginger Policy", "ginger"); ?>
3
+ </h3>
4
+
5
+ <p>We are Manafactory SRL makers of the Ginger plugin and owners of the ginger website.
6
+ You can find more information about us, including our full address, on our company website.</p>
7
+
8
+
9
+ <h4><strong>What personal data we collect and why we collect it</strong></h4>
10
+
11
+ <p><strong>Our site (http://www.ginger-cookielaw.com/) uses the following cookies:</strong></p>
12
+ <p>Google Analytics cookies – these are set for monitoring and tracking visitors behavior on the site.
13
+ WordPress logged-in cookies – these are used by WordPress to authenticate logged-in visitors, password authentication and user verification.
14
+ WPML cookies – these are used by our WPML plugin to identify the preferred user’s language as our site is multilingual.
15
+ WooCommerce cookies – these are used by the WooCommerce plugin to track visitors and their purchased items in the cart.
16
+ W3 Total Cache cookies – these are used by W3 Total Cache plugin to monitor referrer and user identification for caching purposes.</p>
17
+
18
+ <p>In addition to Google Analytics, we are using the following statistics on our site for performance and monitoring:
19
+ WooCommerce statistics – statistics regarding our sales, conversion rates, refunds, etc.
20
+ Sometimes, to help our support debug a Ginger-related issue on your site, we might ask you to share a copy of your site with us. Since this is your site, you are the one responsible for its data and we strongly encourage you to remove any personal information from the database before sharing it with us using this form.
21
+ That being said, here are some important points about what happens with the site duplicates and data that is shared with our support:
22
+ When a debug or setting check is needed, we ask for access to the site or even a full copy of the site.
23
+ We use that access/duplicates strictly for debugging.
24
+ We do not share that data with anyone outside of the company.
25
+ Again, we strongly encourage you to remove any personal/sensitive information they might hold before sharing access/duplication if they are concerned about it.
26
+ We cannot be held responsible for any loss of private information from databases if that should occur. In other words, you should have a fully working backup of whatever site you share with us.
27
+ Data collected by the Ginger plugin and add-ons you use</p>
28
+
29
+ <h4><strong>Who we share your data with</strong></h4>
30
+
31
+ <p>We don’t share your data with third-parties in a way as to reveal any of your personal information like email, name, etc. However, some data is transferred and/or stored with third-party services we use, like cloud-based services and payment processors. This is done as a way to provide you with a better overall service and user experience.
32
+ Here are the services we use to make our own service better for you:
33
+ PayPal – we use Paypal as one of our payment processor. During checkout, a client will provide login information and credit card info. This information is processed directly within this gateway payment and we do not save it on our sites.
34
+ Amazon SES – we use this services to manage mailing campaigns to our clients. What is shared are client contact details (name and client email).
35
+ Who can see my personal information</p>
36
+
37
+ <p>If you don't give explicit consent, there is no personal information we have or can see about you.
38
+ If you give explicit consent your personal information can be accessed by:
39
+ Our System administrator
40
+ Our supporters when they need to (in order to provide support) get the information about the client accounts and access.
41
+ How long we retain your data</p>
42
+
43
+ <p>When you submit a support ticket or a comment, its metadata is retained until (if) you tell us to remove it. We use this data so that we can recognize you and approve your comments automatically instead of holding them for moderation.
44
+ If you register on our website, we also store the personal information you provide in your user profile. You can see, edit, or delete your personal information at any time (except changing your username). Website administrators can also see and edit that information.
45
+ How we protect your data and what data breach procedures we have in place</p>
46
+
47
+ <p>We protect customer data with the following site features:
48
+ Databases are sanitized (actual user personal details are removed) before deploying to development or testing environment.
49
+ In case of a data breach, System administrators will immediately go through affected users</p>
50
+
51
+ <h4><strong>What rights you have over your data</strong></h4>
52
+
53
+ <p>If you don't give it explicit consent, the only data it can collect is which theme and plugins your site is using, which terms and taxonomy do you use, which custom post type, how many posts and users. This information is used only for providing you with faster and better support. we DON'T get personal informations about your users
54
+ Ginger will prompt you and require explicit action, asking you if you want to share with us informations about your user profile (such email). If you decline, it will not collect this data</p>
55
+
56
+ <p>You can request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes. In short, we cannot erase data that is vital to you being our customer (i.e. basic account information like an email address).
57
+ For these requests, please use this form.</p>
admin/partial/ginger.share.data.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php add_thickbox(); ?>
3
+ <div id="ginger-share-data" style="display:none;">
4
+ <p>
5
+ Ginger is a free tool but we need some information to improve it!
6
+ </p>
7
+
8
+
9
+ <p>
10
+ <input type="checkbox" id="ginger_statistics_share" name="ginger_statistics_share" value="1">
11
+ I accept the processing of data for statistical purposes.
12
+ </p>
13
+ <ul>
14
+ <li>This data stored are:</li>
15
+ <li>IP address</li>
16
+ <li>number of posts</li>
17
+ <li>number of users</li>
18
+ <li>site language</li>
19
+ <li>Taxonomies</li>
20
+ </ul>
21
+ <p>
22
+ Ginger analyzes its data for statistical purposes and to identify trends, but in doing so adheres
23
+ strictly to stringent data-security standards. Our analysis of this data does not include any attempt to
24
+ link it to individuals.
25
+ </p>
26
+ <p>
27
+ <input type="checkbox" id="ginger_informations_share" name="ginger_informations_share" value="1">
28
+ I accept the processing of data for commercial information purposes and/or for sending advertising or direct
29
+ selling about Ginger plugin.
30
+ </p>
31
+ <p>
32
+ <button id="ginger_share_data" class="button button-primary"
33
+ data-email="<?php echo wp_get_current_user()->user_email; ?>">Save
34
+ </button>
35
+ </p>
36
+ </div>
37
+
38
+
39
+ <?php
40
+ $ginger_share_data = get_option('ginger_share_data');
41
+ $ginger_share_data_time = get_option('ginger_share_data_time');
42
+ ?>
43
+ <?php if (!$ginger_share_data || ($ginger_share_data == 'false' && (int)$ginger_share_data_time <= strtotime('-30 days'))): ?>
44
+ <script language="javascript">
45
+ jQuery(window).load(function () {
46
+ ginger_share_data();
47
+ tb_show("Please select", "#TB_inline?width=600&height=550&inlineId=ginger-share-data", null);
48
+ jQuery("#TB_closeWindowButton").click(function () {
49
+ const data_token = {
50
+ 'action': 'ginger_save_info',
51
+ ginger_share_data_time: new Date().getTime(),
52
+ ginger_share_data: false
53
+ };
54
+ jQuery.post(ajaxurl, data_token, function (response) {
55
+ console.log(response);
56
+ });
57
+ });
58
+ });
59
+ </script>
60
+ <?php endif; ?>
admin/partial/more.php DELETED
@@ -1,6 +0,0 @@
1
- <h3><?php _e("Need More?", "ginger"); ?></h3>
2
-
3
- <p><?php _e("If you need help on privacy policy, or other stuff not covered by Ginger, try Iubenda from this link:", "ginger"); ?></p>
4
- <p><h3><a href="http://iubenda.refr.cc/VGW2J8C">http://iubenda.refr.cc/VGW2J8C</a></h3></p>
5
-
6
- <p><?php _e("You will get a special discount as Ginger user!", "ginger"); ?></p>
 
 
 
 
 
 
admin/partial/policy.php CHANGED
@@ -11,7 +11,11 @@
11
  <tr>
12
  <th scope="row" style="padding-left:20px;" colspan="2">
13
  <label>
14
- <input name="choice" type="radio" value="page" onclick="javascript:select_privacy_page();" <?php if ($options != "") echo ' checked="checked" '; ?>> <?php _e("Select your privacy policy page", "ginger"); ?>
 
 
 
 
15
  </label>
16
  </th>
17
  </tr>
@@ -21,40 +25,39 @@
21
  <legend class="screen-reader-text">
22
  <span><?php _e("DialogText", "ginger"); ?></span>
23
  </legend>
24
- <?php
25
-
26
- $args = array(
27
- 'sort_order' => 'asc',
28
- 'sort_column' => 'post_title',
29
- 'hierarchical' => 1,
30
- 'exclude' => '',
31
- 'include' => '',
32
- 'meta_key' => '',
33
- 'meta_value' => '',
34
- 'authors' => '',
35
- 'child_of' => 0,
36
- 'parent' => -1,
37
- 'exclude_tree' => '',
38
- 'number' => '',
39
- 'offset' => 0,
40
- 'post_type' => 'page',
41
- 'post_status' => 'publish',
42
- 'suppress_filters' => false
43
- );
44
- $pages = get_pages($args);
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
 
48
-
49
- ?>
50
  <p>
51
  <label>
52
  <?php _e('Privacy Policy page', 'ginger'); ?>
53
  </label>
54
- <select name="ginger_privacy_page" id="privacy_page_select" <?php if ($options == "") echo ' disabled="true"'; ?>>
55
- <option value=""><?php _e('Select page', 'ginger'); ?></option>
 
56
  <?php foreach ($pages as $page) { ?>
57
- <option value="<?php echo $page->ID;?>" <?php if ($options == $page->ID) echo ' selected="selected" '; ?>><?php echo $page->post_title; ?></option>
58
  <?php } ?>
59
  </select>
60
  </p>
@@ -64,21 +67,24 @@
64
  <tr>
65
  <th scope="row" style="padding-left:20px;" colspan="2">
66
  <label>
67
- <input name="choice" type="radio" value="new_page" onclick="javascript:new_privacy_page();"><?php _e("or create your privacy policy page", "ginger"); ?>
 
 
68
  </label>
69
  </th>
70
  </tr>
71
  <tr>
72
  <td colspan="2">
73
  <fieldset>
74
- <div id="new_page_privacy" style="display: none">
75
  <p>
76
  <label>
77
  <?php _e("Title", "ginger"); ?><input name="privacy_page_title" id="privacy_page_title"
78
  type="text" value="Privacy Policy">
79
  </label>
80
  </p>
81
- <p id="p_exist_title" style="color: #ff0000; visibility: hidden"><?php _e('Attention ! There is already a page with this title', 'ginger');?></p>
 
82
  <p>
83
  <label>
84
  <fieldset>
@@ -96,7 +102,8 @@
96
  </p>
97
  <p>
98
  <small style="padding-top: 20px">
99
- <b>(<?php _e("If you create a new page this will be setted as Privacy Policy Page", "ginger"); ?>)</b>
 
100
  </small>
101
  </p>
102
  </div>
@@ -104,17 +111,20 @@
104
  </td>
105
  </tr>
106
  <tr>
107
- <th scope="row" style="padding-left:20px;"><?php _e("Disable Click-out and Scroll to accept cookies in Privacy Policy page", "ginger"); ?></th>
 
108
  <td>
109
  <fieldset>
110
  <p>
111
  <label>
112
- <input name="ginger_privacy_click_scroll" type="radio" value="1" class="tog" <?php if($options2 == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
 
113
  </label>
114
  </p>
115
  <p>
116
  <label>
117
- <input name="ginger_privacy_click_scroll" type="radio" value="0" class="tog" <?php if($options2 == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
 
118
  </label>
119
  </p>
120
  </fieldset>
@@ -129,17 +139,19 @@
129
  </legend>
130
  <p>
131
  <label>
132
- <input name="ginger_disable_logger" type="radio" value="1" class="tog" <?php if($options_disable_logger == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
 
133
  </label>
134
  </p>
135
  <p>
136
  <label>
137
- <input name="ginger_disable_logger" type="radio" value="0" class="tog" <?php if($options_disable_logger == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
 
138
  </label>
139
  </p>
140
  </fieldset>
141
  </td>
142
- </tr>
143
  </tbody>
144
  </table>
145
 
11
  <tr>
12
  <th scope="row" style="padding-left:20px;" colspan="2">
13
  <label>
14
+ <input name="choice" type="radio" value="page"
15
+ onclick="javascript:select_privacy_page();"
16
+ <?php checked( ginger_check_value($options, 'choice'), 'page'); ?>
17
+
18
+ > <?php _e("Select your privacy policy page", "ginger"); ?>
19
  </label>
20
  </th>
21
  </tr>
25
  <legend class="screen-reader-text">
26
  <span><?php _e("DialogText", "ginger"); ?></span>
27
  </legend>
28
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ $args = array(
31
+ 'sort_order' => 'asc',
32
+ 'sort_column' => 'post_title',
33
+ 'hierarchical' => 1,
34
+ 'exclude' => '',
35
+ 'include' => '',
36
+ 'meta_key' => '',
37
+ 'meta_value' => '',
38
+ 'authors' => '',
39
+ 'child_of' => 0,
40
+ 'parent' => -1,
41
+ 'exclude_tree' => '',
42
+ 'number' => '',
43
+ 'offset' => 0,
44
+ 'post_type' => 'page',
45
+ 'post_status' => 'publish',
46
+ 'suppress_filters' => false
47
+ );
48
+ $pages = get_pages($args);
49
 
50
 
51
+ ?>
 
52
  <p>
53
  <label>
54
  <?php _e('Privacy Policy page', 'ginger'); ?>
55
  </label>
56
+ <select name="ginger_privacy_page"
57
+ id="privacy_page_select" <?php disabled(ginger_check_value($options, 'choice'), 'new_page'); ?>>
58
+ <option value=""><?php _e('Select page', 'ginger'); ?></option>
59
  <?php foreach ($pages as $page) { ?>
60
+ <option value="<?php echo $page->ID; ?>" <?php selected(ginger_check_value($options, 'ginger_privacy_page'), $page->ID); ?>><?php echo $page->post_title; ?></option>
61
  <?php } ?>
62
  </select>
63
  </p>
67
  <tr>
68
  <th scope="row" style="padding-left:20px;" colspan="2">
69
  <label>
70
+ <input name="choice" type="radio" value="new_page"
71
+ <?php checked(ginger_check_value($options, 'choice'), 'new_page'); ?>
72
+ onclick="javascript:new_privacy_page();"><?php _e("or create your privacy policy page", "ginger"); ?>
73
  </label>
74
  </th>
75
  </tr>
76
  <tr>
77
  <td colspan="2">
78
  <fieldset>
79
+ <div id="new_page_privacy" <?php if(!isset($options['choice']) || $options['choice'] !== 'new_page') echo 'style="display: none"'; ?>>
80
  <p>
81
  <label>
82
  <?php _e("Title", "ginger"); ?><input name="privacy_page_title" id="privacy_page_title"
83
  type="text" value="Privacy Policy">
84
  </label>
85
  </p>
86
+ <p id="p_exist_title"
87
+ style="color: #ff0000; visibility: hidden"><?php _e('Attention ! There is already a page with this title', 'ginger'); ?></p>
88
  <p>
89
  <label>
90
  <fieldset>
102
  </p>
103
  <p>
104
  <small style="padding-top: 20px">
105
+ <b>(<?php _e("If you create a new page this will be setted as Privacy Policy Page", "ginger"); ?>
106
+ )</b>
107
  </small>
108
  </p>
109
  </div>
111
  </td>
112
  </tr>
113
  <tr>
114
+ <th scope="row"
115
+ style="padding-left:20px;"><?php _e("Disable Click-out and Scroll to accept cookies in Privacy Policy page", "ginger"); ?></th>
116
  <td>
117
  <fieldset>
118
  <p>
119
  <label>
120
+ <input name="ginger_privacy_click_scroll" type="radio" value="1"
121
+ class="tog" <?php if ($options2 == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
122
  </label>
123
  </p>
124
  <p>
125
  <label>
126
+ <input name="ginger_privacy_click_scroll" type="radio" value="0"
127
+ class="tog" <?php if ($options2 == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
128
  </label>
129
  </p>
130
  </fieldset>
139
  </legend>
140
  <p>
141
  <label>
142
+ <input name="ginger_disable_logger" type="radio" value="1"
143
+ class="tog" <?php if ($options_disable_logger == "1") echo ' checked="checked" '; ?>><?php _e("Yes", "ginger"); ?>
144
  </label>
145
  </p>
146
  <p>
147
  <label>
148
+ <input name="ginger_disable_logger" type="radio" value="0"
149
+ class="tog" <?php if ($options_disable_logger == "0") echo ' checked="checked" '; ?>><?php _e("No", "ginger"); ?>
150
  </label>
151
  </p>
152
  </fieldset>
153
  </td>
154
+ </tr>
155
  </tbody>
156
  </table>
157
 
admin/partial/shortcode.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 31/05/18
6
+ * Time: 11:36
7
+ */
8
+
9
+ ?>
10
+
11
+ <h3>
12
+ <?php _e("Ginger Shortcode", "ginger"); ?>
13
+ </h3>
14
+
15
+ <p>
16
+ <?php _e("In questa pagina sono visulizzati tutti gli shortcode disponibili", "ginger"); ?>
17
+ </p>
18
+
19
+ <p>
20
+ <strong>[ginger_reset_cookie class="your-button-class" text="Reset Cookie" redirect_url="Some url tu redirect"]</strong>
21
+ <button class="btn" data-clipboard-text='[ginger_reset_cookie class="" text="" redirect_url=""]'>
22
+ Copy to clipboard
23
+ </button>
24
+ </p>
common/ginger.share.data.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 06/06/18
6
+ * Time: 11:03
7
+ */
8
+
9
+
10
+
11
+ // create a scheduled event (if it does not exist already)
12
+ function ginger_share_data_activation() {
13
+
14
+ $httpHost = str_replace('www.', '', $_SERVER['HTTP_HOST']);
15
+
16
+ $rA = checkdnsrr($httpHost, "A");
17
+ $rCname = checkdnsrr($httpHost, "CNAME");
18
+
19
+ if (!wp_next_scheduled('ginger_send_data_hook') && ($rA || $rCname)) {
20
+ wp_schedule_event(time(), 'ginger_weekly', 'ginger_send_data_hook');
21
+ }
22
+ }
23
+ // and make sure it's called whenever WordPress loads
24
+ add_action('wp', 'ginger_share_data_activation');
25
+
26
+
27
+ function ginger_cron_schedules($schedules)
28
+ {
29
+ if (!isset($schedules["ginger_weekly"])) {
30
+ $schedules["ginger_weekly"] = array(
31
+ 'interval' => 60 * 60 * 24 * 7,
32
+ 'display' => __('Ginger weekly'));
33
+ }
34
+ if (!isset($schedules["ginger_minutes"])) {
35
+ $schedules["ginger_minutes"] = array(
36
+ 'interval' => 60,
37
+ 'display' => __('Ginger minutes'));
38
+ }
39
+ return $schedules;
40
+ }
41
+
42
+ add_filter('cron_schedules', 'ginger_cron_schedules');
43
+
44
+
45
+ function ginger_send_data()
46
+ {
47
+
48
+ $data_to_send = ginger_prepare_data();
49
+ $data_to_send = json_encode($data_to_send);
50
+ $x_auth = get_option('ginger_token');
51
+ if(!$x_auth){
52
+ $x_auth = ginger_create_site();
53
+ if($x_auth === false) return;
54
+ }
55
+
56
+ $url = 'http://ginger.manafactory.it/site/update';
57
+ $method = 'PUT';
58
+
59
+ if ($x_auth) {
60
+ $ch = curl_init($url);
61
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
62
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_to_send);
63
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
64
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
65
+ 'Content-Type: application/json',
66
+ 'Content-Length: ' . strlen($data_to_send),
67
+ 'x-auth: ' . $x_auth
68
+ ));
69
+ curl_exec($ch);
70
+ }
71
+ }
72
+ add_action('ginger_send_data_hook', 'ginger_send_data');
73
+
74
+ function ginger_prepare_data()
75
+ {
76
+ $data_to_send = [];
77
+ // Site name
78
+ $data_to_send['name'] = get_bloginfo('name');
79
+ // Site url
80
+ $data_to_send['url'] = get_bloginfo('url');
81
+ // Wp Version
82
+ $data_to_send['version'] = get_bloginfo('version');
83
+ // Language
84
+ $data_to_send['language'] = get_bloginfo('language');
85
+ // Site Description
86
+ $data_to_send['description'] = get_bloginfo('description', 'display');
87
+ // Users number
88
+ global $wp_roles;
89
+ $roles = $wp_roles->roles;
90
+ $count = 0;
91
+ foreach ($roles as $key => $role) {
92
+ $blog_users_query = ['role' => $key];
93
+ if (is_multisite()) {
94
+ $blog_users_query['blog_id'] = get_current_blog_id();
95
+ }
96
+ $blogusers = new WP_User_Query($blog_users_query);
97
+ // Array of WP_User objects.
98
+ $data_to_send['users_type'][$count]['name'] = $role['name'];
99
+ $data_to_send['users_type'][$count]['count'] = $blogusers->get_total();
100
+ $count++;
101
+ }
102
+ // Post type
103
+ $post_types = get_post_types('', 'objects');
104
+ $count = 0;
105
+ foreach ($post_types as $key => $post_type) {
106
+ if (
107
+ $post_type->name == 'revision'
108
+ || $post_type->name == 'nav_menu_item'
109
+ || $post_type->name == 'custom_css'
110
+ || $post_type->name == 'customize_changeset'
111
+ || $post_type->name == 'oembed_cache'
112
+ || $post_type->name == 'user_request'
113
+ ) continue;
114
+
115
+ $data_to_send['posts_type'][$count]['count'] = wp_count_posts($post_type->name)->publish;
116
+ $data_to_send['posts_type'][$count]['label'] = $post_type->label;
117
+ $data_to_send['posts_type'][$count]['name'] = $post_type->name;
118
+ $count++;
119
+ }
120
+ // Taxonomies
121
+ $count = 0;
122
+ $taxonomies = get_taxonomies('', 'objects');
123
+ foreach ($taxonomies as $taxonomy) {
124
+ if (
125
+ $taxonomy->name == 'post_tag'
126
+ || $taxonomy->name == 'nav_menu'
127
+ || $taxonomy->name == 'link_category'
128
+ || $taxonomy->name == 'post_format'
129
+ || $taxonomy->name == 'post_translations'
130
+ || $taxonomy->name == 'term_language'
131
+ || $taxonomy->name == 'term_translations'
132
+ ) continue;
133
+
134
+ $data_to_send['taxonomies'][$count]['count'] = wp_count_terms($taxonomy->name);
135
+ $data_to_send['taxonomies'][$count]['label'] = $taxonomy->label;
136
+ $data_to_send['taxonomies'][$count]['name'] = $taxonomy->name;
137
+
138
+ $terms = get_terms($taxonomy->name, array(
139
+ 'hide_empty' => true,
140
+ ));
141
+ foreach ($terms as $term) {
142
+ $data_to_send['taxonomies'][$count]['terms'][] = [
143
+ 'name' => $term->name,
144
+ 'count' => $term->count,
145
+ 'description' => $term->description
146
+ ];
147
+ }
148
+ $count++;
149
+ }
150
+
151
+ // Plugin
152
+ if ( ! function_exists( 'get_plugins' ) ) {
153
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
154
+ }
155
+
156
+ $all_plugins = get_plugins();
157
+ if($all_plugins){
158
+ foreach ($all_plugins as $plugin){
159
+ $data_to_send['plugins'][] = $plugin;
160
+ }
161
+ }
162
+
163
+ if($statisitc = get_option('ginger_statistic_share')){
164
+ if($statisitc == '1'){
165
+ $data_to_send['statistic'] = true;
166
+ }
167
+ }
168
+
169
+ if($statisitc = get_option('ginger_informations_share')){
170
+ if($statisitc == '1'){
171
+ $data_to_send['information'] = true;
172
+ }
173
+ }
174
+
175
+ return $data_to_send;
176
+
177
+ }
178
+
179
+
180
+
181
+ function ginger_create_site(){
182
+
183
+
184
+ $data_to_send = json_encode(['url' => get_bloginfo('url')]);
185
+ $url = 'http://ginger.manafactory.it/site/create';
186
+ $method = 'POST';
187
+
188
+ $ch = curl_init($url);
189
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
190
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_to_send);
191
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
192
+ curl_setopt($ch, CURLOPT_HEADER, 1);
193
+ curl_setopt($ch, CURLOPT_NOBODY, 0);
194
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
195
+ 'Content-Type: application/json',
196
+ 'Content-Length: ' . strlen($data_to_send),
197
+ ));
198
+ $result = curl_exec($ch);
199
+ list($headers, $content) = explode("\r\n\r\n",$result,2);
200
+ foreach (explode("\r\n",$headers) as $hdr){
201
+ $checkHeaderValue = explode(':', $hdr);
202
+ if($checkHeaderValue[0] === 'x-auth'){
203
+ update_option('ginger_site_created', 'true', false);
204
+ update_option('ginger_token', trim($checkHeaderValue[1]), false);
205
+ return trim($checkHeaderValue[1]);
206
+ }
207
+ }
208
+ return false;
209
+ }
front/css/cookies-enabler-dialog.css CHANGED
File without changes
front/ginger.shortcode.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 31/05/18
6
+ * Time: 12:24
7
+ */
8
+
9
+
10
+ // [ginger_reset_cookie class="your-button-class" text="Reset Cookie"]
11
+ function ginger_reset_cookie_func( $atts ) {
12
+ $a = shortcode_atts( array(
13
+ 'class' => '',
14
+ 'text' => 'Reset Cookie',
15
+ 'redirect_url' => ''
16
+ ), $atts );
17
+ $rest_cookie = '<button class="' . $a["class"] . '" onclick="delete_cookie(\'ginger-cookie\', \'' . $a['redirect_url'].'\')">' . $a['text'] .'</button>';
18
+ wp_enqueue_script('ginger-cookies-reset', plugin_dir_url(__FILE__) . "js/reset-cookie.js");
19
+
20
+ return $rest_cookie;
21
+ }
22
+ add_shortcode( 'ginger_reset_cookie', 'ginger_reset_cookie_func' );
front/gingerfront.core.php CHANGED
@@ -1,32 +1,34 @@
1
  <?php
2
  /* GINGER CORE */
3
- function ginger_get_text_iframe($option_ginger_bar){
 
4
 
5
- if($option_ginger_bar['ginger_Iframe_text']):
6
  $ginger_iframe_text = $option_ginger_bar['ginger_Iframe_text'];
7
  $ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
8
- $ginger_iframe_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_iframe_text );
9
  else:
10
  $ginger_iframe_text = 'This website uses cookies.';
11
  endif;
12
 
13
- $ginger_iframe_text = '<!--googleoff: index-->'.$ginger_iframe_text.'<!--googleon: index-->';
14
  $ginger_iframe_text = apply_filters("ginger_text_iframe", $ginger_iframe_text);
15
  return $ginger_iframe_text;
16
  }
17
 
18
- function ginger_get_text_banner($option_ginger_bar){
19
- if($option_ginger_bar['ginger_banner_text']):
 
20
  $ginger_text = $option_ginger_bar['ginger_banner_text'];
21
  $ginger_text = str_replace('</', '<\/', $ginger_text);
22
- $ginger_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_text );
23
  //Recupero privacy policy se presente
24
- if(strpos($ginger_text, '{{privacy_page}}') !== false):
25
  $privacy_policy = get_option('ginger_policy', true);
26
  $privacy_policy_page = get_post($privacy_policy);
27
- if($privacy_policy_page){
28
  $privacy_policy_text = ' <a href="' . get_permalink($privacy_policy_page->ID) . '">' . addslashes($privacy_policy_page->post_title) . '<\/a>';
29
- $ginger_text = str_replace('{{privacy_page}}', $privacy_policy_text, $ginger_text);
30
  }
31
  endif;
32
 
@@ -34,16 +36,17 @@ function ginger_get_text_banner($option_ginger_bar){
34
  $ginger_text = 'This website uses cookies.';
35
  endif;
36
 
37
- $ginger_text = '<!--googleoff: index-->'.$ginger_text.'<!--googleon: index-->';
38
  $ginger_text = apply_filters("ginger_text_banner", $ginger_text);
39
  return $ginger_text;
40
  }
41
 
42
- function ginger_get_label_accept_cookie($option_ginger_bar){
 
43
 
44
  //Recupero Label
45
- if($option_ginger_bar['accept_cookie_button_text']):
46
- $label_accept_cookie = $option_ginger_bar['accept_cookie_button_text'];
47
  else:
48
  $label_accept_cookie = __('Enable Cookies', 'ginger');
49
  endif;
@@ -53,14 +56,15 @@ function ginger_get_label_accept_cookie($option_ginger_bar){
53
  return $label_accept_cookie;
54
  }
55
 
56
- function ginger_get_label_disable_cookie($option_ginger_bar){
 
57
 
58
  //Recupero Label
59
- if(isset($option_ginger_bar['disable_cookie_button_text']) && $option_ginger_bar['disable_cookie_button_text']):
60
- $label_disable_cookie = $option_ginger_bar['disable_cookie_button_text'];
61
- else:
62
- $label_disable_cookie = __('Disable Cookies', 'ginger');
63
- endif;
64
 
65
  $label_disable_cookie = apply_filters("ginger_label_disable_cookie", $label_disable_cookie);
66
 
@@ -69,54 +73,54 @@ endif;
69
 
70
 
71
  //Ginger Start
72
- function ginger_run(){
73
- if(is_feed()) return;
 
74
  $option_ginger_general = get_option('ginger_general');
75
- if(isset($option_ginger_general['ginger_logged_users']) && $option_ginger_general['ginger_logged_users']=='1' && is_user_logged_in()) return;
76
- if((isset($option_ginger_general['pagine_escluse'])) && (!empty($option_ginger_general['pagine_escluse']))):
77
-
78
- $pagine=array();
79
 
 
80
 
81
 
82
  foreach ($option_ginger_general['pagine_escluse'] as $array_pagine):
83
 
84
 
85
  $pagine[] = $array_pagine['select-input'];
86
- // $pagine=array_push($pagine, $array_pagine['select-input']);
87
  endforeach;
88
- $id_current=get_the_id();
89
  if (in_array($id_current, $pagine)):
90
  return;
91
  endif;
92
 
93
  endif;
94
 
95
- if(!(isset($option_ginger_general['enable_ginger']) && $option_ginger_general['enable_ginger'] == 1)) return;
96
- if(isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'Y'):
97
- if(isset($option_ginger_general['ginger_cache']) && $option_ginger_general['ginger_cache'] == 'no') return;
98
  endif;
99
-
100
 
101
- if(isset($option_ginger_general['ginger_opt']) && $option_ginger_general['ginger_opt'] == 'in'):
102
 
 
103
  ob_start();
104
  add_action('shutdown', '__shutdown', 0);
105
  add_filter('final_output', 'ginger_parse_dom');
106
  endif;
107
  }
108
- add_action('wp', 'ginger_run');
109
 
 
110
 
111
 
112
- function __shutdown(){
 
113
  $final = '';
114
 
115
  // We'll need to get the number of ob levels we're in, so that we can iterate over each, collecting
116
  // that buffer's output into the final output.
117
  $levels = ob_get_level();
118
 
119
- for ($i = 0; $i < $levels; $i++){
120
  $final .= ob_get_clean();
121
  }
122
 
@@ -125,9 +129,8 @@ function __shutdown(){
125
  }
126
 
127
 
128
-
129
-
130
- function ginger_parse_dom($output){
131
 
132
  $ginger_script_tags = array(
133
  'platform.twitter.com/widgets.js',
@@ -144,7 +147,7 @@ function ginger_parse_dom($output){
144
  'disqus.com',
145
  );
146
  $ginger_script_tags = apply_filters('ginger_script_tags', $ginger_script_tags);
147
- $ginger_script_async_tags = array(
148
  'addthis.com',
149
  'sharethis.com'
150
  );
@@ -162,9 +165,9 @@ function ginger_parse_dom($output){
162
  $ginger_iframe_tags = apply_filters('ginger_add_iframe', $ginger_iframe_tags);
163
 
164
 
165
- if(strpos($output, '<html') === false):
166
  return $output;
167
- elseif(strpos($output, '<html') > 200 ):
168
  return $output;
169
  endif;
170
  libxml_use_internal_errors(true);
@@ -175,49 +178,49 @@ function ginger_parse_dom($output){
175
  $script_tags = $doc->getElementsByTagName('script');
176
  $async_array = array();
177
  $domElemsToRemove = array();
178
- foreach($script_tags as $script):
179
- $src_script = $script->getAttribute('src');
180
- if($src_script):
181
- if(strpos_arr($src_script, $ginger_script_tags) !== false ):
182
  $script->setAttribute("class", "ginger-script");
183
  $script->setAttribute("type", "text/plain");
184
  continue;
185
  endif;
186
- if(strpos_arr($src_script, $ginger_script_async_tags) !== false ):
187
  //return print_r($script->nodeValue);
188
  $async_array[] = $src_script;
189
  $domElemsToRemove[] = $script;
190
  continue;
191
  endif;
192
  endif;
193
- if($script->nodeValue):
194
  $key = strpos_arr($script->nodeValue, $ginger_script_tags);
195
- if($key !== false ):
196
- if($ginger_script_tags[$key] == 'www.google-analytics.com/analytics.js' || $ginger_script_tags[$key] == 'google-analytics.com/ga.js')
197
- if(strpos($script->nodeValue, 'anonymizeIp') !== false ):
198
  continue;
199
  endif;
200
  $script->setAttribute("class", "ginger-script");
201
  $script->setAttribute("type", "text/plain");
202
- if($ginger_script_tags[$key] == 'disqus.com/embed.js' || $ginger_script_tags[$key] == 'disqus.com'):
203
  $script->setAttribute("class", "ginger-script");
204
  $script->setAttribute("type", "text/plain");
205
  endif;
206
  endif;
207
  endif;
208
  endforeach;
209
- foreach( $domElemsToRemove as $domElement ){
210
  $domElement->parentNode->removeChild($domElement);
211
  }
212
  // get all the iframe tags
213
  $iframe_tags = $doc->getElementsByTagName('iframe');
214
- foreach($iframe_tags as $iframe):
215
- $src_iframe = $iframe->getAttribute('src');
216
- if($src_iframe):
217
- if(strpos_arr($src_iframe, $ginger_iframe_tags) !== false ):
218
  $iframe->removeAttribute('src');
219
  $iframe->setAttribute("data-ce-src", $src_iframe);
220
- if($iframe->hasAttribute('class')):
221
  $addclass = $iframe->getAttribute('class');
222
  else:
223
  $addclass = '';
@@ -226,7 +229,7 @@ function ginger_parse_dom($output){
226
  endif;
227
  endif;
228
  endforeach;
229
- if(!empty($async_array)):
230
  $text = json_encode($async_array);
231
  $text = 'var async_ginger_script = ' . $text . ';';
232
  $head = $doc->getElementsByTagName('head')->item(0);
@@ -240,10 +243,11 @@ function ginger_parse_dom($output){
240
  return $output;
241
  }
242
 
243
- function strpos_arr($haystack, $needle) {
244
- if(!is_array($needle)) $needle = array($needle);
245
- foreach($needle as $key => $what) {
246
- if(($pos = strpos($haystack, $what))!==false) return $key;
 
247
  }
248
  return false;
249
  }
1
  <?php
2
  /* GINGER CORE */
3
+ function ginger_get_text_iframe($option_ginger_bar)
4
+ {
5
 
6
+ if (isset($option_ginger_bar['ginger_Iframe_text']) && $option_ginger_bar['ginger_Iframe_text']):
7
  $ginger_iframe_text = $option_ginger_bar['ginger_Iframe_text'];
8
  $ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
9
+ $ginger_iframe_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_iframe_text);
10
  else:
11
  $ginger_iframe_text = 'This website uses cookies.';
12
  endif;
13
 
14
+ $ginger_iframe_text = '<!--googleoff: index-->' . $ginger_iframe_text . '<!--googleon: index-->';
15
  $ginger_iframe_text = apply_filters("ginger_text_iframe", $ginger_iframe_text);
16
  return $ginger_iframe_text;
17
  }
18
 
19
+ function ginger_get_text_banner($option_ginger_bar)
20
+ {
21
+ if (isset($option_ginger_bar['ginger_banner_text']) && $option_ginger_bar['ginger_banner_text']):
22
  $ginger_text = $option_ginger_bar['ginger_banner_text'];
23
  $ginger_text = str_replace('</', '<\/', $ginger_text);
24
+ $ginger_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_text);
25
  //Recupero privacy policy se presente
26
+ if (strpos($ginger_text, '{{privacy_page}}') !== false):
27
  $privacy_policy = get_option('ginger_policy', true);
28
  $privacy_policy_page = get_post($privacy_policy);
29
+ if ($privacy_policy_page) {
30
  $privacy_policy_text = ' <a href="' . get_permalink($privacy_policy_page->ID) . '">' . addslashes($privacy_policy_page->post_title) . '<\/a>';
31
+ $ginger_text = str_replace('{{privacy_page}}', $privacy_policy_text, $ginger_text);
32
  }
33
  endif;
34
 
36
  $ginger_text = 'This website uses cookies.';
37
  endif;
38
 
39
+ $ginger_text = '<!--googleoff: index-->' . $ginger_text . '<!--googleon: index-->';
40
  $ginger_text = apply_filters("ginger_text_banner", $ginger_text);
41
  return $ginger_text;
42
  }
43
 
44
+ function ginger_get_label_accept_cookie($option_ginger_bar)
45
+ {
46
 
47
  //Recupero Label
48
+ if ($option_ginger_bar['accept_cookie_button_text']):
49
+ $label_accept_cookie = $option_ginger_bar['accept_cookie_button_text'];
50
  else:
51
  $label_accept_cookie = __('Enable Cookies', 'ginger');
52
  endif;
56
  return $label_accept_cookie;
57
  }
58
 
59
+ function ginger_get_label_disable_cookie($option_ginger_bar)
60
+ {
61
 
62
  //Recupero Label
63
+ if (isset($option_ginger_bar['disable_cookie_button_text']) && $option_ginger_bar['disable_cookie_button_text']):
64
+ $label_disable_cookie = $option_ginger_bar['disable_cookie_button_text'];
65
+ else:
66
+ $label_disable_cookie = __('Disable Cookies', 'ginger');
67
+ endif;
68
 
69
  $label_disable_cookie = apply_filters("ginger_label_disable_cookie", $label_disable_cookie);
70
 
73
 
74
 
75
  //Ginger Start
76
+ function ginger_run()
77
+ {
78
+ if (is_feed()) return;
79
  $option_ginger_general = get_option('ginger_general');
80
+ if (isset($option_ginger_general['ginger_logged_users']) && $option_ginger_general['ginger_logged_users'] == '1' && is_user_logged_in()) return;
81
+ if ((isset($option_ginger_general['pagine_escluse'])) && (!empty($option_ginger_general['pagine_escluse']))):
 
 
82
 
83
+ $pagine = array();
84
 
85
 
86
  foreach ($option_ginger_general['pagine_escluse'] as $array_pagine):
87
 
88
 
89
  $pagine[] = $array_pagine['select-input'];
90
+ // $pagine=array_push($pagine, $array_pagine['select-input']);
91
  endforeach;
92
+ $id_current = get_the_id();
93
  if (in_array($id_current, $pagine)):
94
  return;
95
  endif;
96
 
97
  endif;
98
 
99
+ if (!(isset($option_ginger_general['enable_ginger']) && $option_ginger_general['enable_ginger'] == 1)) return;
100
+ if (isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'Y'):
101
+ if (isset($option_ginger_general['ginger_cache']) && $option_ginger_general['ginger_cache'] == 'no') return;
102
  endif;
 
103
 
 
104
 
105
+ if (isset($option_ginger_general['ginger_opt']) && $option_ginger_general['ginger_opt'] == 'in'):
106
  ob_start();
107
  add_action('shutdown', '__shutdown', 0);
108
  add_filter('final_output', 'ginger_parse_dom');
109
  endif;
110
  }
 
111
 
112
+ add_action('wp', 'ginger_run');
113
 
114
 
115
+ function __shutdown()
116
+ {
117
  $final = '';
118
 
119
  // We'll need to get the number of ob levels we're in, so that we can iterate over each, collecting
120
  // that buffer's output into the final output.
121
  $levels = ob_get_level();
122
 
123
+ for ($i = 0; $i < $levels; $i++) {
124
  $final .= ob_get_clean();
125
  }
126
 
129
  }
130
 
131
 
132
+ function ginger_parse_dom($output)
133
+ {
 
134
 
135
  $ginger_script_tags = array(
136
  'platform.twitter.com/widgets.js',
147
  'disqus.com',
148
  );
149
  $ginger_script_tags = apply_filters('ginger_script_tags', $ginger_script_tags);
150
+ $ginger_script_async_tags = array(
151
  'addthis.com',
152
  'sharethis.com'
153
  );
165
  $ginger_iframe_tags = apply_filters('ginger_add_iframe', $ginger_iframe_tags);
166
 
167
 
168
+ if (strpos($output, '<html') === false):
169
  return $output;
170
+ elseif (strpos($output, '<html') > 200):
171
  return $output;
172
  endif;
173
  libxml_use_internal_errors(true);
178
  $script_tags = $doc->getElementsByTagName('script');
179
  $async_array = array();
180
  $domElemsToRemove = array();
181
+ foreach ($script_tags as $script):
182
+ $src_script = $script->getAttribute('src');
183
+ if ($src_script):
184
+ if (strpos_arr($src_script, $ginger_script_tags) !== false):
185
  $script->setAttribute("class", "ginger-script");
186
  $script->setAttribute("type", "text/plain");
187
  continue;
188
  endif;
189
+ if (strpos_arr($src_script, $ginger_script_async_tags) !== false):
190
  //return print_r($script->nodeValue);
191
  $async_array[] = $src_script;
192
  $domElemsToRemove[] = $script;
193
  continue;
194
  endif;
195
  endif;
196
+ if ($script->nodeValue):
197
  $key = strpos_arr($script->nodeValue, $ginger_script_tags);
198
+ if ($key !== false):
199
+ if ($ginger_script_tags[$key] == 'www.google-analytics.com/analytics.js' || $ginger_script_tags[$key] == 'google-analytics.com/ga.js')
200
+ if (strpos($script->nodeValue, 'anonymizeIp') !== false):
201
  continue;
202
  endif;
203
  $script->setAttribute("class", "ginger-script");
204
  $script->setAttribute("type", "text/plain");
205
+ if ($ginger_script_tags[$key] == 'disqus.com/embed.js' || $ginger_script_tags[$key] == 'disqus.com'):
206
  $script->setAttribute("class", "ginger-script");
207
  $script->setAttribute("type", "text/plain");
208
  endif;
209
  endif;
210
  endif;
211
  endforeach;
212
+ foreach ($domElemsToRemove as $domElement) {
213
  $domElement->parentNode->removeChild($domElement);
214
  }
215
  // get all the iframe tags
216
  $iframe_tags = $doc->getElementsByTagName('iframe');
217
+ foreach ($iframe_tags as $iframe):
218
+ $src_iframe = $iframe->getAttribute('src');
219
+ if ($src_iframe):
220
+ if (strpos_arr($src_iframe, $ginger_iframe_tags) !== false):
221
  $iframe->removeAttribute('src');
222
  $iframe->setAttribute("data-ce-src", $src_iframe);
223
+ if ($iframe->hasAttribute('class')):
224
  $addclass = $iframe->getAttribute('class');
225
  else:
226
  $addclass = '';
229
  endif;
230
  endif;
231
  endforeach;
232
+ if (!empty($async_array)):
233
  $text = json_encode($async_array);
234
  $text = 'var async_ginger_script = ' . $text . ';';
235
  $head = $doc->getElementsByTagName('head')->item(0);
243
  return $output;
244
  }
245
 
246
+ function strpos_arr($haystack, $needle)
247
+ {
248
+ if (!is_array($needle)) $needle = array($needle);
249
+ foreach ($needle as $key => $what) {
250
+ if (($pos = strpos($haystack, $what)) !== false) return $key;
251
  }
252
  return false;
253
  }
front/gingerfront.utils.php CHANGED
@@ -9,49 +9,58 @@
9
  */
10
 
11
  // Registro style di base
12
- add_action( 'wp_enqueue_scripts', 'ginger_style_script' );
13
- function ginger_style_script() {
 
14
  $option_ginger_bar = get_option('ginger_banner');
15
- if(isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'N' || $option_ginger_bar['ginger_banner_type'] == 'dialog'):
16
- wp_register_style( 'ginger-style-dialog', plugin_dir_url( __FILE__ ) . 'css/cookies-enabler-dialog.css' );
17
- wp_enqueue_style( 'ginger-style-dialog' );
18
  else:
19
- wp_register_style( 'ginger-style', plugin_dir_url( __FILE__ ) . 'css/cookies-enabler.css' );
20
- wp_enqueue_style( 'ginger-style' );
21
  endif;
22
- wp_enqueue_script('ginger-cookies-enabler', plugin_dir_url( __FILE__ ) . "js/cookies-enabler.min.js" );
23
  }
24
 
25
  //Aggioungo i custom style
26
- add_action('wp_head', 'ginger_custom_style' );
27
- function ginger_custom_style(){
 
28
  $option_ginger_general = get_option('ginger_general');
29
  $option_ginger_bar = get_option('ginger_banner');
30
- if($option_ginger_general['enable_ginger'] != 1) return;
31
  //Recupero style custom
32
- if($option_ginger_bar['background_color'] || $option_ginger_bar['text_color'] || $option_ginger_bar['link_color'] || $option_ginger_bar['ginger_css'] || $option_ginger_bar['button_color'] || $option_ginger_bar['button_text_color']): ?>
33
  <style>
34
- .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?>{
35
- <?php if($option_ginger_bar['background_color']): ?> background-color: <?php echo $option_ginger_bar['background_color']; ?>;<?php endif; ?>
36
- <?php if($option_ginger_bar['text_color']): ?> color: <?php echo $option_ginger_bar['text_color']; ?>;<?php endif; ?>
 
37
  }
 
38
  <?php if($option_ginger_bar['button_color']): ?>
39
- a.ginger_btn.ginger-accept, a.ginger_btn.ginger-disable, .ginger_btn{
40
  background: <?php echo $option_ginger_bar['button_color']; ?> !important;
41
  }
42
- a.ginger_btn.ginger-accept:hover, a.ginger_btn.ginger-disable:hover, .ginger_btn{
 
43
  background: <?php echo $option_ginger_bar['button_color']; ?> !important;
44
  }
 
45
  <?php endif; ?>
46
  <?php if($option_ginger_bar['button_text_color']): ?>
47
  a.ginger_btn {
48
  color: <?php echo $option_ginger_bar['button_text_color']; ?> !important;
49
  }
 
50
  <?php endif; ?>
51
  <?php if($option_ginger_bar['link_color']): ?>
52
- .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?> a{
53
- <?php if($option_ginger_bar['link_color']): ?> color: <?php echo $option_ginger_bar['link_color']; ?>;<?php endif; ?>
 
54
  }
 
55
  <?php endif;?>
56
  <?php if($option_ginger_bar['ginger_css']): ?>
57
  <?php echo $option_ginger_bar['ginger_css']; ?>
@@ -65,55 +74,55 @@ function ginger_custom_style(){
65
  */
66
 
67
  add_action('wp_footer', 'ginger_script', 100);
68
- function ginger_script(){ ?>
 
69
  <?php
70
  //Recupero le informazioni necessarie per stampare il banner
71
  $option_ginger_general = get_option('ginger_general');
72
  $option_ginger_policy = get_option('ginger_policy_disable_ginger');
73
 
74
  $id_privacy_policy = get_option('ginger_policy');
75
- $id_current=get_the_id();
76
-
77
 
78
- if((isset($option_ginger_general['pagine_escluse'])) && (!empty($option_ginger_general['pagine_escluse']))):
79
 
80
- $pagine=array();
81
 
 
82
 
83
 
84
  foreach ($option_ginger_general['pagine_escluse'] as $array_pagine):
85
 
86
 
87
  $pagine[] = $array_pagine['select-input'];
88
- // $pagine=array_push($pagine, $array_pagine['select-input']);
89
  endforeach;
90
  if (in_array($id_current, $pagine)):
91
  return;
92
  endif;
93
 
94
  endif;
95
- if(isset($option_ginger_general['ginger_logged_users']) && $option_ginger_general['ginger_logged_users']=='1' && is_user_logged_in()) return;
96
  $option_ginger_bar = get_option('ginger_banner');
97
- if($option_ginger_general['enable_ginger'] != 1) return;
98
  //Verifoco la tipologia di accettazione dei cookie
99
- if($option_ginger_general['ginger_scroll'] == 1):
100
  $type_scroll = 'true';
101
  else:
102
  $type_scroll = 'false';
103
  endif;
104
  //Verifico se è abilitato il click sulla pagina
105
- if($option_ginger_general['ginger_click_out'] == 1):
106
  $click_outside = 'true';
107
  else:
108
  $click_outside = 'false';
109
  endif;
110
- if ($id_current==$id_privacy_policy && $option_ginger_policy == 1):
111
 
112
  $click_outside = 'false';
113
  $type_scroll = 'false';
114
  endif;
115
  //Verifico se è abilitato il forceReload
116
- if($option_ginger_general['ginger_force_reload'] == 1):
117
  $ginger_force_reload = 'true';
118
  else:
119
  $ginger_force_reload = 'false';
@@ -123,15 +132,15 @@ function ginger_script(){ ?>
123
  $ginger_text = ginger_get_text_banner($option_ginger_bar);
124
 
125
  //Definisco se è bar modal top o bottom
126
- if($option_ginger_bar['ginger_banner_position'] == 'top'):
127
  $banner_class = 'top';
128
  else:
129
  $banner_class = 'bottom';
130
  endif;
131
- if($option_ginger_bar['ginger_banner_type'] == 'dialog'):
132
  $banner_class .= ' dialog';
133
  endif;
134
- if($option_ginger_bar['theme_ginger'] == 'dark'):
135
  $banner_class .= ' dark';
136
  else:
137
  $banner_class .= ' light';
@@ -142,7 +151,7 @@ function ginger_script(){ ?>
142
  $label_accept_cookie = ginger_get_label_accept_cookie($option_ginger_bar);
143
  $label_disable_cookie = ginger_get_label_disable_cookie($option_ginger_bar);
144
 
145
- ?>
146
 
147
  <!-- Init the script -->
148
  <script>
@@ -158,41 +167,41 @@ function ginger_script(){ ?>
158
  document.getElementById('ginger-banner-html').innerHTML :
159
  '<div class="ginger_banner <?php echo $banner_class; ?> ginger_container ginger_container--open">'
160
  <?php if($option_ginger_bar['ginger_banner_type'] == 'dialog'): ?>
161
- +'<p class="ginger_message">'
162
- +'<?php echo $ginger_text; ?>'
163
- +'</p>'
164
- +'<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
165
- + '<?php echo $label_accept_cookie; ?>'
166
- +'<\/a>'
167
- <?php if($option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
168
- + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
169
- + '<?php echo $label_disable_cookie; ?>'
170
- + '<\/a>'
171
- <?php endif; ?>
172
  <?php else: ?>
173
- <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
174
- + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
175
- + '<?php echo $label_disable_cookie; ?>'
176
- + '<\/a>'
177
- <?php endif; ?>
178
- +'<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
179
- + '<?php echo $label_accept_cookie; ?>'
180
- +'<\/a>'
181
- +'<p class="ginger_message">'
182
- +'<?php echo $ginger_text; ?>'
183
- +'</p>'
184
  <?php endif; ?>
185
- +'<\/div>',
186
- <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out' && $option_ginger_general['ginger_keep_banner'] == 1): ?>
187
  forceEnable: true,
188
  forceBannerClass: 'ginger-banner bottom dialog force <?php echo $option_ginger_bar['theme_ginger']; ?> ginger_container',
189
  forceEnableText:
190
- '<p class="ginger_message">'
191
- +'<?php echo $ginger_text; ?>'
192
- +'</p>'
193
- +'<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
194
- + '<?php echo $label_accept_cookie; ?>'
195
- +'<\/a>',
196
  <?php endif; ?>
197
  <?php if($option_ginger_general['ginger_cookie_duration']): ?>
198
  cookieDuration: <?php echo $option_ginger_general['ginger_cookie_duration']; ?>,
@@ -207,9 +216,9 @@ function ginger_script(){ ?>
207
  iframesPlaceholderHTML:
208
  document.getElementById('ginger-iframePlaceholder-html') !== null ?
209
  document.getElementById('ginger-iframePlaceholder-html').innerHTML :
210
- '<p><?php echo $ginger_iframe_text; ?>'
211
- +'<a href="#" class="ginger_btn ginger-accept"><?php echo $label_accept_cookie; ?></a>'
212
- +'<\/p>'
213
  });
214
  </script>
215
  <!-- End Ginger Script -->
9
  */
10
 
11
  // Registro style di base
12
+ add_action('wp_enqueue_scripts', 'ginger_style_script');
13
+ function ginger_style_script()
14
+ {
15
  $option_ginger_bar = get_option('ginger_banner');
16
+ if (isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'N' || $option_ginger_bar['ginger_banner_type'] == 'dialog'):
17
+ wp_register_style('ginger-style-dialog', plugin_dir_url(__FILE__) . 'css/cookies-enabler-dialog.css');
18
+ wp_enqueue_style('ginger-style-dialog');
19
  else:
20
+ wp_register_style('ginger-style', plugin_dir_url(__FILE__) . 'css/cookies-enabler.css');
21
+ wp_enqueue_style('ginger-style');
22
  endif;
23
+ wp_enqueue_script('ginger-cookies-enabler', plugin_dir_url(__FILE__) . "js/cookies-enabler.min.js");
24
  }
25
 
26
  //Aggioungo i custom style
27
+ add_action('wp_head', 'ginger_custom_style');
28
+ function ginger_custom_style()
29
+ {
30
  $option_ginger_general = get_option('ginger_general');
31
  $option_ginger_bar = get_option('ginger_banner');
32
+ if ($option_ginger_general['enable_ginger'] != 1) return;
33
  //Recupero style custom
34
+ if ($option_ginger_bar['background_color'] || $option_ginger_bar['text_color'] || $option_ginger_bar['link_color'] || $option_ginger_bar['ginger_css'] || $option_ginger_bar['button_color'] || $option_ginger_bar['button_text_color']): ?>
35
  <style>
36
+ .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?> {
37
+ <?php if($option_ginger_bar['background_color']): ?> background-color: <?php echo $option_ginger_bar['background_color']; ?>;
38
+ <?php endif; ?><?php if($option_ginger_bar['text_color']): ?> color: <?php echo $option_ginger_bar['text_color']; ?>;
39
+ <?php endif; ?>
40
  }
41
+
42
  <?php if($option_ginger_bar['button_color']): ?>
43
+ a.ginger_btn.ginger-accept, a.ginger_btn.ginger-disable, .ginger_btn {
44
  background: <?php echo $option_ginger_bar['button_color']; ?> !important;
45
  }
46
+
47
+ a.ginger_btn.ginger-accept:hover, a.ginger_btn.ginger-disable:hover, .ginger_btn {
48
  background: <?php echo $option_ginger_bar['button_color']; ?> !important;
49
  }
50
+
51
  <?php endif; ?>
52
  <?php if($option_ginger_bar['button_text_color']): ?>
53
  a.ginger_btn {
54
  color: <?php echo $option_ginger_bar['button_text_color']; ?> !important;
55
  }
56
+
57
  <?php endif; ?>
58
  <?php if($option_ginger_bar['link_color']): ?>
59
+ .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?> a {
60
+ <?php if($option_ginger_bar['link_color']): ?> color: <?php echo $option_ginger_bar['link_color']; ?>;
61
+ <?php endif; ?>
62
  }
63
+
64
  <?php endif;?>
65
  <?php if($option_ginger_bar['ginger_css']): ?>
66
  <?php echo $option_ginger_bar['ginger_css']; ?>
74
  */
75
 
76
  add_action('wp_footer', 'ginger_script', 100);
77
+ function ginger_script()
78
+ { ?>
79
  <?php
80
  //Recupero le informazioni necessarie per stampare il banner
81
  $option_ginger_general = get_option('ginger_general');
82
  $option_ginger_policy = get_option('ginger_policy_disable_ginger');
83
 
84
  $id_privacy_policy = get_option('ginger_policy');
85
+ $id_current = get_the_id();
 
86
 
 
87
 
88
+ if ((isset($option_ginger_general['pagine_escluse'])) && (!empty($option_ginger_general['pagine_escluse']))):
89
 
90
+ $pagine = array();
91
 
92
 
93
  foreach ($option_ginger_general['pagine_escluse'] as $array_pagine):
94
 
95
 
96
  $pagine[] = $array_pagine['select-input'];
97
+ // $pagine=array_push($pagine, $array_pagine['select-input']);
98
  endforeach;
99
  if (in_array($id_current, $pagine)):
100
  return;
101
  endif;
102
 
103
  endif;
104
+ if (isset($option_ginger_general['ginger_logged_users']) && $option_ginger_general['ginger_logged_users'] == '1' && is_user_logged_in()) return;
105
  $option_ginger_bar = get_option('ginger_banner');
106
+ if ($option_ginger_general['enable_ginger'] != 1) return;
107
  //Verifoco la tipologia di accettazione dei cookie
108
+ if (isset($option_ginger_general['ginger_scroll']) && $option_ginger_general['ginger_scroll'] == 1):
109
  $type_scroll = 'true';
110
  else:
111
  $type_scroll = 'false';
112
  endif;
113
  //Verifico se è abilitato il click sulla pagina
114
+ if (isset($option_ginger_general['ginger_click_out']) && $option_ginger_general['ginger_click_out'] == 1):
115
  $click_outside = 'true';
116
  else:
117
  $click_outside = 'false';
118
  endif;
119
+ if ($id_current == $id_privacy_policy && $option_ginger_policy == 1):
120
 
121
  $click_outside = 'false';
122
  $type_scroll = 'false';
123
  endif;
124
  //Verifico se è abilitato il forceReload
125
+ if (isset($option_ginger_general['ginger_force_reload']) && $option_ginger_general['ginger_force_reload'] == 1):
126
  $ginger_force_reload = 'true';
127
  else:
128
  $ginger_force_reload = 'false';
132
  $ginger_text = ginger_get_text_banner($option_ginger_bar);
133
 
134
  //Definisco se è bar modal top o bottom
135
+ if ($option_ginger_bar['ginger_banner_position'] == 'top'):
136
  $banner_class = 'top';
137
  else:
138
  $banner_class = 'bottom';
139
  endif;
140
+ if ($option_ginger_bar['ginger_banner_type'] == 'dialog'):
141
  $banner_class .= ' dialog';
142
  endif;
143
+ if ($option_ginger_bar['theme_ginger'] == 'dark'):
144
  $banner_class .= ' dark';
145
  else:
146
  $banner_class .= ' light';
151
  $label_accept_cookie = ginger_get_label_accept_cookie($option_ginger_bar);
152
  $label_disable_cookie = ginger_get_label_disable_cookie($option_ginger_bar);
153
 
154
+ ?>
155
 
156
  <!-- Init the script -->
157
  <script>
167
  document.getElementById('ginger-banner-html').innerHTML :
168
  '<div class="ginger_banner <?php echo $banner_class; ?> ginger_container ginger_container--open">'
169
  <?php if($option_ginger_bar['ginger_banner_type'] == 'dialog'): ?>
170
+ + '<p class="ginger_message">'
171
+ + '<?php echo $ginger_text; ?>'
172
+ + '</p>'
173
+ + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
174
+ + '<?php echo $label_accept_cookie; ?>'
175
+ + '<\/a>'
176
+ <?php if($option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
177
+ + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
178
+ + '<?php echo $label_disable_cookie; ?>'
179
+ + '<\/a>'
180
+ <?php endif; ?>
181
  <?php else: ?>
182
+ <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
183
+ + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
184
+ + '<?php echo $label_disable_cookie; ?>'
185
+ + '<\/a>'
186
+ <?php endif; ?>
187
+ + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
188
+ + '<?php echo $label_accept_cookie; ?>'
189
+ + '<\/a>'
190
+ + '<p class="ginger_message">'
191
+ + '<?php echo $ginger_text; ?>'
192
+ + '</p>'
193
  <?php endif; ?>
194
+ + '<\/div>',
195
+ <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out' && $option_ginger_general['ginger_keep_banner'] == 1): ?>
196
  forceEnable: true,
197
  forceBannerClass: 'ginger-banner bottom dialog force <?php echo $option_ginger_bar['theme_ginger']; ?> ginger_container',
198
  forceEnableText:
199
+ '<p class="ginger_message">'
200
+ + '<?php echo $ginger_text; ?>'
201
+ + '</p>'
202
+ + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
203
+ + '<?php echo $label_accept_cookie; ?>'
204
+ + '<\/a>',
205
  <?php endif; ?>
206
  <?php if($option_ginger_general['ginger_cookie_duration']): ?>
207
  cookieDuration: <?php echo $option_ginger_general['ginger_cookie_duration']; ?>,
216
  iframesPlaceholderHTML:
217
  document.getElementById('ginger-iframePlaceholder-html') !== null ?
218
  document.getElementById('ginger-iframePlaceholder-html').innerHTML :
219
+ '<p><?php echo $ginger_iframe_text; ?>'
220
+ + '<a href="#" class="ginger_btn ginger-accept"><?php echo $label_accept_cookie; ?></a>'
221
+ + '<\/p>'
222
  });
223
  </script>
224
  <!-- End Ginger Script -->
front/js/cookies-enabler.min.js CHANGED
@@ -1 +1,180 @@
1
- function strpos(e,n,t){var s=(e+"").indexOf(n,t||0);return-1===s?!1:s}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,r=function(){s=null,t||e.apply(a,i)},o=t&&!s;clearTimeout(s),s=setTimeout(r,n),o&&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,r,o={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",forceBannerClass:"ginger-banner bottom dialog dark force",forceEnable:!1,forceEnableText:'<div class="ginger-button-wrapper"><div class="ginger-button"><a href="#" class="ginger-accept">Enable Cookie</a></div></div>',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:"",forceReload:!1},c=function(){Math.abs(window.pageYOffset-r)>a.scrollOffset&&"N"!=g.get()&&u()},l=function(){i={accept:document.getElementsByClassName(a.acceptClass),disable:document.getElementsByClassName(a.disableClass),banner:document.getElementsByClassName(a.bannerClass),bannerForce:document.getElementsByClassName(a.forceBannerClass),dismiss:document.getElementsByClassName(a.dismissClass)};var e,n=i.accept,s=n.length,o=i.disable,l=o.length,d=i.dismiss,p=d.length;for(a.eventScroll&&window.addEventListener("load",function(){r=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("N"!=g.get()&&u())}),e=0;s>e;e++)n[e].addEventListener("click",function(e){e.preventDefault(),u(e)});for(e=0;l>e;e++)o[e].addEventListener("click",function(e){e.preventDefault(),f(e)});for(e=0;p>e;e++)d[e].addEventListener("click",function(e){e.preventDefault(),m.dismiss()})},d=function(n){if(a=e({},o,n),"Y"==g.get())"function"==typeof a.onEnable&&a.onEnable(),y.get_async(),b.get(),p.get();else if("N"==g.get()){var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),0!=a.forceEnable&&m.forceAccept(),"function"==typeof a.onDisable&&a.onDisable(),p.hide(),l()}else{var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),m.create(),p.hide(),l()}},u=n(function(e){if("undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"Y"!=g.get()){y.get_async(),g.set(),b.get(),p.get(),p.removePlaceholders(),m.dismiss();var n=document.getElementById("disqus_thread");null!=n&&(n.style.display="block"),window.removeEventListener("scroll",c),"function"==typeof a.onEnable&&a.onEnable(),1==a.forceReload&&location.reload()}},250,!1),f=function(e){"undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"N"!=g.get()&&(g.set("N"),m.dismiss(),window.removeEventListener("scroll",c),"function"==typeof a.onDisable&&a.onDisable())},m=function(){function e(){var e='<div class="'+a.bannerClass+'">'+a.bannerHTML+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function n(){var e='<div class="'+a.forceBannerClass+'">'+a.forceEnableText+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function t(){i.bannerForce[0]&&(i.bannerForce[0].style.display="none"),i.banner[0]&&(i.banner[0].style.display="none"),"function"==typeof a.onDismiss&&a.onDismiss()}return{create:e,dismiss:t,forceAccept:n}}(),g=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=/";var i="undefined"!=typeof ginger_logger?ginger_logger:"N";"Y"==i&&gingerAjaxLogTime(s)}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}}(),p=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),r=i.length,o=document.createDocumentFragment();for(e=0;r>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,o.appendChild(t)}document.body.appendChild(o)}function n(){"undefined"!=typeof async_ginger_script}return{get:e,get_async:n}}(),y=function(){function e(){if("undefined"!=typeof async_ginger_script){var e,n=async_ginger_script;for(e=0;e<n.length;++e){var t=document.createElement("script");t.type="text/javascript",t.src=n[e],document.getElementsByTagName("head")[0].appendChild(t)}}}return{get_async:e}}();return{init:d,enableCookies:u,dismissBanner:m.dismiss}}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function strpos(e, n, t) {
2
+ var s = (e + "").indexOf(n, t || 0);
3
+ return -1 === s ? !1 : s
4
+ }
5
+
6
+ window.COOKIES_ENABLER = window.COOKIES_ENABLER || function () {
7
+ "use strict";
8
+
9
+ function e() {
10
+ var e, n;
11
+ for (e = 1; e < arguments.length; e++) for (n in arguments[e]) arguments[e].hasOwnProperty(n) && (arguments[0][n] = arguments[e][n]);
12
+ return arguments[0]
13
+ }
14
+
15
+ function n(e, n, t) {
16
+ var s;
17
+ return function () {
18
+ var a = this, i = arguments, r = function () {
19
+ s = null, t || e.apply(a, i)
20
+ }, o = t && !s;
21
+ clearTimeout(s), s = setTimeout(r, n), o && e.apply(a, i)
22
+ }
23
+ }
24
+
25
+ function t(e, n) {
26
+ do if (s(e, n)) return e; while (e = e.parentNode);
27
+ return null
28
+ }
29
+
30
+ function s(e, n) {
31
+ return (" " + e.className + " ").indexOf(" " + n + " ") > -1
32
+ }
33
+
34
+ var a, i, r, o = {
35
+ scriptClass: "ce-script",
36
+ iframeClass: "ce-iframe",
37
+ acceptClass: "ce-accept",
38
+ disableClass: "ce-disable",
39
+ dismissClass: "ce-dismiss",
40
+ bannerClass: "ce-banner",
41
+ 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>',
42
+ eventScroll: !1,
43
+ scrollOffset: 200,
44
+ clickOutside: !1,
45
+ cookieName: "ce-cookie",
46
+ cookieDuration: "365",
47
+ forceBannerClass: "ginger-banner bottom dialog dark force",
48
+ forceEnable: !1,
49
+ forceEnableText: '<div class="ginger-button-wrapper"><div class="ginger-button"><a href="#" class="ginger-accept">Enable Cookie</a></div></div>',
50
+ iframesPlaceholder: !0,
51
+ 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>',
52
+ iframesPlaceholderClass: "ce-iframe-placeholder",
53
+ onEnable: "",
54
+ onDismiss: "",
55
+ onDisable: "",
56
+ forceReload: !1
57
+ }, c = function () {
58
+ Math.abs(window.pageYOffset - r) > a.scrollOffset && "N" != g.get() && u()
59
+ }, l = function () {
60
+ i = {
61
+ accept: document.getElementsByClassName(a.acceptClass),
62
+ disable: document.getElementsByClassName(a.disableClass),
63
+ banner: document.getElementsByClassName(a.bannerClass),
64
+ bannerForce: document.getElementsByClassName(a.forceBannerClass),
65
+ dismiss: document.getElementsByClassName(a.dismissClass)
66
+ };
67
+ var e, n = i.accept, s = n.length, o = i.disable, l = o.length, d = i.dismiss, p = d.length;
68
+ for (a.eventScroll && window.addEventListener("load", function () {
69
+ r = window.pageYOffset, window.addEventListener("scroll", c)
70
+ }), a.clickOutside && document.addEventListener("click", function (e) {
71
+ var n = e.target;
72
+ return t(n, a.iframesPlaceholderClass) || t(n, a.disableClass) || t(n, a.bannerClass) || t(n, a.dismissClass) || t(n, a.disableClass) ? !1 : void("N" != g.get() && u())
73
+ }), e = 0; s > e; e++) n[e].addEventListener("click", function (e) {
74
+ e.preventDefault(), u(e)
75
+ });
76
+ for (e = 0; l > e; e++) o[e].addEventListener("click", function (e) {
77
+ e.preventDefault(), f(e)
78
+ });
79
+ for (e = 0; p > e; e++) d[e].addEventListener("click", function (e) {
80
+ e.preventDefault(), m.dismiss()
81
+ })
82
+ }, d = function (n) {
83
+ if (a = e({}, o, n), "Y" == g.get()) "function" == typeof a.onEnable && a.onEnable(), y.get_async(), b.get(), p.get(); else if ("N" == g.get()) {
84
+ var t = document.getElementById("disqus_thread");
85
+ null != t && (t.style.display = "none"), 0 != a.forceEnable && m.forceAccept(), "function" == typeof a.onDisable && a.onDisable(), p.hide(), l()
86
+ } else {
87
+ var t = document.getElementById("disqus_thread");
88
+ null != t && (t.style.display = "none"), m.create(), p.hide(), l()
89
+ }
90
+ }, u = n(function (e) {
91
+ if ("undefined" != typeof e && "click" === e.type && e.preventDefault(), "Y" != g.get()) {
92
+ y.get_async(), g.set(), b.get(), p.get(), p.removePlaceholders(), m.dismiss();
93
+ var n = document.getElementById("disqus_thread");
94
+ null != n && (n.style.display = "block"), window.removeEventListener("scroll", c), "function" == typeof a.onEnable && a.onEnable(), 1 == a.forceReload && location.reload()
95
+ }
96
+ }, 250, !1), f = function (e) {
97
+ "undefined" != typeof e && "click" === e.type && e.preventDefault(), "N" != g.get() && (g.set("N"), m.dismiss(), window.removeEventListener("scroll", c), "function" == typeof a.onDisable && a.onDisable())
98
+ }, m = function () {
99
+ function e() {
100
+ var e = '<div class="' + a.bannerClass + '">' + a.bannerHTML + "</div>";
101
+ document.body.insertAdjacentHTML("beforeend", e)
102
+ }
103
+
104
+ function n() {
105
+ var e = '<div class="' + a.forceBannerClass + '">' + a.forceEnableText + "</div>";
106
+ document.body.insertAdjacentHTML("beforeend", e)
107
+ }
108
+
109
+ function t() {
110
+ i.bannerForce[0] && (i.bannerForce[0].style.display = "none"), i.banner[0] && (i.banner[0].style.display = "none"), "function" == typeof a.onDismiss && a.onDismiss()
111
+ }
112
+
113
+ return {create: e, dismiss: t, forceAccept: n}
114
+ }(), g = function () {
115
+ function e(e) {
116
+ var n, t, s = "undefined" != typeof e ? e : "Y";
117
+ 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=/";
118
+ var i = "undefined" != typeof ginger_logger ? ginger_logger : "N";
119
+ "Y" == i && gingerAjaxLogTime(s)
120
+ }
121
+
122
+ function n() {
123
+ var e, n, t, s = document.cookie.split(";"), i = s.length;
124
+ 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)
125
+ }
126
+
127
+ return {set: e, get: n}
128
+ }(), p = function () {
129
+ function e(e) {
130
+ var n = document.createElement("div");
131
+ n.className = a.iframesPlaceholderClass, n.innerHTML = a.iframesPlaceholderHTML, e.parentNode.insertBefore(n, e)
132
+ }
133
+
134
+ function n() {
135
+ var e, n = document.getElementsByClassName(a.iframesPlaceholderClass), t = n.length;
136
+ for (e = t - 1; e >= 0; e--) n[e].remove()
137
+ }
138
+
139
+ function t() {
140
+ var n, t, s = document.getElementsByClassName(a.iframeClass), i = s.length;
141
+ for (t = 0; i > t; t++) n = s[t], n.style.display = "none", a.iframesPlaceholder && e(n)
142
+ }
143
+
144
+ function s() {
145
+ var e, n, t, s = document.getElementsByClassName(a.iframeClass), i = s.length;
146
+ for (t = 0; i > t; t++) n = s[t], e = n.attributes["data-ce-src"].value, n.src = e, n.style.display = "block"
147
+ }
148
+
149
+ return {hide: t, get: s, removePlaceholders: n}
150
+ }(), b = function () {
151
+ function e() {
152
+ var e, n, t, s, i = document.getElementsByClassName(a.scriptClass), r = i.length,
153
+ o = document.createDocumentFragment();
154
+ for (e = 0; r > 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 {
155
+ 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);
156
+ t.innerHTML = i[e].innerHTML, o.appendChild(t)
157
+ }
158
+ document.body.appendChild(o)
159
+ }
160
+
161
+ function n() {
162
+ "undefined" != typeof async_ginger_script
163
+ }
164
+
165
+ return {get: e, get_async: n}
166
+ }(), y = function () {
167
+ function e() {
168
+ if ("undefined" != typeof async_ginger_script) {
169
+ var e, n = async_ginger_script;
170
+ for (e = 0; e < n.length; ++e) {
171
+ var t = document.createElement("script");
172
+ t.type = "text/javascript", t.src = n[e], document.getElementsByTagName("head")[0].appendChild(t)
173
+ }
174
+ }
175
+ }
176
+
177
+ return {get_async: e}
178
+ }();
179
+ return {init: d, enableCookies: u, dismissBanner: m.dismiss}
180
+ }();
front/js/reset-cookie.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ function delete_cookie(name, url) {
2
+ document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
3
+ if(typeof url !== 'undefined'){
4
+ window.location.href = url;
5
+ }else{
6
+ location.reload();
7
+ }
8
+ }
9
+
10
+
11
+
ginger-eu-cookie-law.php CHANGED
@@ -2,35 +2,44 @@
2
  /*
3
  Plugin Name: Ginger - EU Cookie Law
4
  Plugin URI: http://www.ginger-cookielaw.com/
5
- Description: Make your website compliant with EU Cookie Policy! Now totally free and unlocked
6
- Version: 4.1.6
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
10
  Text Domain: ginger
11
  */
12
 
13
- if ( !defined('ABSPATH')) exit;
14
 
15
- add_action("admin_init","check_ginger_plus");
16
- function check_ginger_plus(){
 
 
 
17
  // check compatibility with old ginger plus
18
- if(is_plugin_active('ginger-plus/ginger-plus.php')){
19
- deactivate_plugins( 'ginger-plus/ginger-plus.php', true );
20
  }
21
  }
22
 
23
- load_plugin_textdomain( 'ginger', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
24
  require_once('addon/ginger.addon.utils.php');
25
 
26
- //Gestione Backend
27
- if(is_admin()){
 
 
28
  require_once("admin/ginger.utils.php");
29
  require_once("admin/ginger.pointer.php");
30
 
31
  }
32
- //Gestione Frontend
33
- if(!is_admin()){
34
  require_once("front/gingerfront.utils.php");
35
  require_once("front/gingerfront.core.php");
 
36
  }
 
 
 
2
  /*
3
  Plugin Name: Ginger - EU Cookie Law
4
  Plugin URI: http://www.ginger-cookielaw.com/
5
+ Description: Make your website compliant with EU Cookie Policy and GDPR! Now totally free and unlocked
6
+ Version: 4.1.7
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
10
  Text Domain: ginger
11
  */
12
 
13
+ if (!defined('ABSPATH')) exit;
14
 
15
+ require_once 'common/ginger.share.data.php';
16
+
17
+ add_action("admin_init", "check_ginger_plus");
18
+ function check_ginger_plus()
19
+ {
20
  // check compatibility with old ginger plus
21
+ if (is_plugin_active('ginger-plus/ginger-plus.php')) {
22
+ deactivate_plugins('ginger-plus/ginger-plus.php', true);
23
  }
24
  }
25
 
26
+ load_plugin_textdomain('ginger', false, dirname(plugin_basename(__FILE__)) . '/languages/');
27
  require_once('addon/ginger.addon.utils.php');
28
 
29
+ // Backend function
30
+ if (is_admin()) {
31
+ // Save option funciton
32
+ require_once("admin/inc/ginger.save.config.php");
33
  require_once("admin/ginger.utils.php");
34
  require_once("admin/ginger.pointer.php");
35
 
36
  }
37
+ //Frontend Function
38
+ if (!is_admin()) {
39
  require_once("front/gingerfront.utils.php");
40
  require_once("front/gingerfront.core.php");
41
+ require_once("front/ginger.shortcode.php");
42
  }
43
+
44
+
45
+
img/ok.png CHANGED
File without changes
img/xx.png CHANGED
File without changes
languages/ginger-it_IT.mo CHANGED
File without changes
languages/ginger-it_IT.po CHANGED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
  Contributors: manafactory, webgrafia, matteobarale
3
  Donate link: http://www.ginger-cookielaw.com/
4
- Tags: EU Cookie Law, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia, wpml, polylang
5
  Requires at least: 3.0.1
6
- Tested up to: 4.9.5
7
- Stable tag: 4.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -90,6 +90,11 @@ Yes, actually you we have 2 addons for multilanguages: wpml and polylang. Ask to
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
93
  = 4.1.6 =
94
  * option to enable / disable logger
95
 
1
  === Plugin Name ===
2
  Contributors: manafactory, webgrafia, matteobarale
3
  Donate link: http://www.ginger-cookielaw.com/
4
+ Tags: EU Cookie Law, GDPR, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia, wpml, polylang
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.9.6
7
+ Stable tag: 4.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
90
 
91
  == Changelog ==
92
 
93
+ = 4.1.7 =
94
+ * added reset cookie shortcode
95
+ * added role access to settings page
96
+ * notice bugfix
97
+
98
  = 4.1.6 =
99
  * option to enable / disable logger
100
 
uninstall.php CHANGED
File without changes