Ginger – EU Cookie Law - Version 4.0

Version Description

  • all feature unlocked
Download this release

Release Info

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

Code changes from version 3.1.5 to 4.0

Files changed (44) hide show
  1. addon/adsense/ginger.adsense.php +5 -0
  2. addon/adsense/index.php +4 -0
  3. addon/analytics/ginger.analytics.php +126 -0
  4. addon/analytics/gingeranalytics.js +33 -0
  5. addon/analytics/gingeranalytics.min.js +1 -0
  6. addon/analytics/index.php +3 -0
  7. addon/exporter/index.php +67 -0
  8. addon/ginger.addon.utils.php +26 -0
  9. addon/jscustom/ginger.jscustom.php +97 -0
  10. addon/jscustom/index.php +2 -0
  11. addon/jscustom/page/ginger-iframe.php +78 -0
  12. addon/jscustom/page/ginger-jscustom.php +87 -0
  13. addon/logger/ginger.logger.php +287 -0
  14. addon/logger/index.php +33 -0
  15. addon/polylang/ginger.polylang.php +353 -0
  16. addon/polylang/index.php +3 -0
  17. addon/wpml/ginger.wpml.php +339 -0
  18. addon/wpml/index.php +3 -0
  19. admin/ginger.pointer.php +1 -1
  20. admin/ginger.utils.php +1 -11
  21. admin/img/logo-head.png +0 -0
  22. admin/js/ginger.color.js +0 -0
  23. admin/js/ginger.js +0 -0
  24. admin/js/jquery.repeater-master/.gitignore +0 -0
  25. admin/js/jquery.repeater-master/.jshintrc +0 -0
  26. admin/js/jquery.repeater-master/jquery.repeater.js +0 -0
  27. admin/js/jquery.repeater-master/jquery.repeater.min.js +0 -0
  28. admin/js/jquery_lined_textarea/jquery-linedtextarea.css +0 -0
  29. admin/js/jquery_lined_textarea/jquery-linedtextarea.js +0 -0
  30. admin/partial/banner.php +0 -0
  31. admin/partial/bar.php +0 -0
  32. admin/partial/dialog.php +0 -0
  33. admin/partial/general.php +0 -0
  34. admin/partial/policy.php +0 -0
  35. front/css/cookies-enabler-dialog.css +0 -0
  36. front/gingerfront.core.php +0 -0
  37. front/gingerfront.utils.php +0 -0
  38. ginger-eu-cookie-law.php +11 -4
  39. img/ok.png +0 -0
  40. img/xx.png +0 -0
  41. languages/ginger-it_IT.mo +0 -0
  42. languages/ginger-it_IT.po +0 -0
  43. readme.txt +14 -13
  44. uninstall.php +0 -0
addon/adsense/ginger.adsense.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ add_filter('ginger_script_async_tags', 'ginger_addsesneremover',10,3);
3
+ function ginger_addsesneremover($array){
4
+ return array_merge($array, array('adsbygoogle', 'googlesyndication'));
5
+ }
addon/adsense/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ //Adsense
3
+ require_once('ginger.adsense.php');
4
+
addon/analytics/ginger.analytics.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: matteobarale
5
+ * Date: 26/06/15
6
+ * Time: 12:02
7
+ */
8
+
9
+ add_action('ginger_add_menu', 'add_ginger_analytics');
10
+ function add_ginger_analytics(){
11
+ add_submenu_page( 'ginger-setup', "Ginger Analytics", __("Google Analytics", "ginger"), 'manage_options', 'ginger-analytics', 'ginger_analytics');
12
+ }
13
+
14
+ function ginger_analytics(){
15
+ if ( ! current_user_can( 'manage_options' ) ) die();
16
+
17
+
18
+ $option_analitycs = get_option('gingeranalytics');
19
+ ?>
20
+ <?php
21
+ if($_POST):
22
+ if(isset($_POST['enable_ginger_analytics']) && $_POST['enable_ginger_analytics'] == 1):
23
+ $content = file_get_contents(get_bloginfo('url') .'/?analytics=check');
24
+ $array_to_check = array(
25
+ 'www.google-analytics.com/analytics.js',
26
+ 'google-analytics.com/ga.js',
27
+ '_getTracker',
28
+ );
29
+
30
+ foreach($array_to_check as $check):
31
+ if(strpos( $content, $check) !== false):
32
+ $find = 'trovatocodice';
33
+ $_POST['enable_ginger_analytics'] = 0;
34
+ break;
35
+ endif;
36
+ endforeach;
37
+
38
+ endif;
39
+ $args = array(
40
+ 'enable_ginger_analytics' => $_POST['enable_ginger_analytics'],
41
+ 'ginger_analytics_code' => $_POST['ginger_analytics_code'],
42
+ 'anonymize_ginger_analytics' => $_POST['anonymize_ginger_analytics']
43
+ );
44
+ update_option('gingeranalytics_option', $args);
45
+ endif;
46
+ ?>
47
+ <div class="wrap">
48
+ <?php $option = get_option('gingeranalytics_option');?>
49
+ <h2>Ginger - Analytics Add On</h2>
50
+ <?php if(isset($find)): ?>
51
+ <h3><?php _e("Attenzione è stato trovato un codice analytics nella pagina", "ginger"); ?></h3>
52
+ <?php endif; ?>
53
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>">
54
+ <?php wp_nonce_field('save_ginger_analytics_options', 'ginger_analytics_options'); ?>
55
+ <table class="form-table striped">
56
+ <thead>
57
+ <tr>
58
+ <td colspan="2">
59
+ <h3><?php _e('Impostazioni Add on', 'ginger'); ?></h3>
60
+ </td>
61
+ </tr>
62
+ </thead>
63
+ <tr>
64
+ <th scope="row" style="padding-left:20px;"><?php _e("Enable Ginger Analytics", "ginger"); ?></th>
65
+ <td>
66
+ <fieldset>
67
+ <legend class="screen-reader-text"><span><?php _e("Enable Ginger Analytics", "ginger"); ?></span></legend>
68
+ <p>
69
+ <label>
70
+ <input name="enable_ginger_analytics" type="radio" value="1" class="tog" <?php if(isset($option['enable_ginger_analytics']) && $option['enable_ginger_analytics'] == 1 ): echo 'checked'; endif;?>>Abilitato
71
+ </label>
72
+ </p>
73
+ <p>
74
+ <label>
75
+ <input name="enable_ginger_analytics" type="radio" value="0" class="tog" <?php if(isset($option['enable_ginger_analytics']) && $option['enable_ginger_analytics'] == 0 ): echo 'checked'; endif;?>>Disabilitato
76
+ </label>
77
+ </p>
78
+ </fieldset>
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <th scope="row" style="padding-left:20px;"><?php _e("Codice Analytics (Ex: UA-XXXXXXX-X)", "ginger"); ?></th>
83
+ <td>
84
+ <fieldset>
85
+ <legend class="screen-reader-text"><span><?php _e("Codice Analytics (Ex: UA-XXXXXXX-X)", "ginger"); ?></span></legend>
86
+ <p>
87
+ <label>
88
+ <input name="ginger_analytics_code" type="text" value="<?php if(isset($option['ginger_analytics_code']) && $option['ginger_analytics_code'] != '' ): echo $option['ginger_analytics_code']; endif;?>" placeholder="<?php _e('Inserisci qui il tuo traking code', 'ginger'); ?>">
89
+ </label>
90
+ </p>
91
+ </fieldset>
92
+ </td>
93
+ </tr>
94
+ </table>
95
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
96
+ </form>
97
+ </div>
98
+
99
+ <?php }
100
+
101
+
102
+ add_action( 'wp_head', 'ginger_anyltics_script_anonymize');
103
+ function ginger_anyltics_script_anonymize(){ ?>
104
+ <?php $option = get_option('gingeranalytics_option');?>
105
+ <script>gingeranalytics('<?php if(isset($option['ginger_analytics_code']) && $option['ginger_analytics_code'] != '' ): echo $option['ginger_analytics_code']; endif;?>')</script>
106
+ <?php }
107
+
108
+ // Registro script per il controllo dello script Analytics
109
+ add_action( 'wp_enqueue_scripts', 'ginger_analytics_style_script' );
110
+ function ginger_analytics_style_script() {
111
+ wp_register_script( 'ginger-analytics_script', plugin_dir_url( __FILE__ ) . 'gingeranalytics.min.js' );
112
+ wp_enqueue_script( 'ginger-analytics_script' );
113
+ }
114
+
115
+ add_filter('ginger_script_tags', 'ginger_analytics_remover',10,3);
116
+ function ginger_analytics_remover($array){
117
+ $option = get_option('gingeranalytics_option');
118
+ if(isset($option['enable_ginger_analytics']) && $option['enable_ginger_analytics'] == 1 ):
119
+ $pos = array_search('www.google-analytics.com/analytics.js', $array);
120
+ unset($array[$pos]);
121
+ $pos = array_search('google-analytics.com/ga.js', $array);
122
+ unset($array[$pos]);
123
+ return $array;
124
+ endif;
125
+ return $array;
126
+ }
addon/analytics/gingeranalytics.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Created by matteobarale on 09/07/15.
3
+ */
4
+ function gingeranalytics(code) {
5
+ console.log(code);
6
+ console.log(getCookie('ginger-cookie'));
7
+
8
+ if(getCookie('ginger-cookie') == 'Y'){
9
+ var gacode = "ga('create', '" + code + "', 'auto'); ga('send', 'pageview');";
10
+ }else{
11
+ var gacode = "ga('create', '" + code + "', 'auto'); ga('set', 'anonymizeIP', true); ga('send', 'pageview');";
12
+ }
13
+
14
+ var scriptanalytics = document.createElement('script');
15
+ scriptanalytics.type = 'text/javascript';
16
+ scriptanalytics.innerHTML = '(function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){'
17
+ +'(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),'
18
+ +'m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)'
19
+ +'})(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\');' + gacode;
20
+ console.log(scriptanalytics);
21
+ document.getElementsByTagName('head')[0].appendChild(scriptanalytics);
22
+ }
23
+
24
+ function getCookie(cname) {
25
+ var name = cname + "=";
26
+ var ca = document.cookie.split(';');
27
+ for(var i=0; i<ca.length; i++) {
28
+ var c = ca[i];
29
+ while (c.charAt(0)==' ') c = c.substring(1);
30
+ if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
31
+ }
32
+ return "";
33
+ }
addon/analytics/gingeranalytics.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function gingeranalytics(e){if(console.log(e),console.log(getCookie("ginger-cookie")),"Y"==getCookie("ginger-cookie"))var t="ga('create', '"+e+"', 'auto'); ga('send', 'pageview');";else var t="ga('create', '"+e+"', 'auto'); ga('set', 'anonymizeIP', true); ga('send', 'pageview');";var n=document.createElement("script");n.type="text/javascript",n.innerHTML="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');"+t,console.log(n),document.getElementsByTagName("head")[0].appendChild(n)}function getCookie(e){for(var t=e+"=",n=document.cookie.split(";"),a=0;a<n.length;a++){for(var o=n[a];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}
addon/analytics/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ require_once('ginger.analytics.php');
addon/exporter/index.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Import/Export tool
4
+ */
5
+
6
+ add_action('ginger_add_menu', 'add_ginger_export', 100);
7
+ function add_ginger_export(){
8
+ add_submenu_page( 'ginger-setup', "Import Export", __("Import/Export", "ginger"), 'manage_options', 'ginger-export', 'ginger_export');
9
+ }
10
+
11
+
12
+ function ginger_export(){
13
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['save_ginger_export_options'], 'ginger_export_options')){
14
+ return;
15
+ }
16
+ if(isset($_POST["action"]) && $_POST["action"] == "import"){
17
+ if($newconf = @unserialize(stripslashes($_POST["data"]))) {
18
+ foreach($newconf as $key => $val){
19
+ update_option($key, $val);
20
+ }
21
+ echo '<div class="updated"><p>'.__( 'All done! Your configuration was saved!', 'ginger' ).'</p></div>';
22
+ }else{
23
+ echo '<div class="updated error"><p>'.__( 'Error! Copied text is wrong...', 'ginger' ).'</p></div>';
24
+ }
25
+ }
26
+ ?>
27
+ <div class="wrap">
28
+ <h2>Ginger - Import/Export</h2>
29
+ <h3><?php _e("Export", "ginger"); ?></h3>
30
+ <p><?php _e("You can export your configuration and import it on a Ginger Managed websites!", "ginger"); ?></p>
31
+ <p><?php _e("Simply copy & paste this code in Import Textarea:", "ginger"); ?></p>
32
+ <textarea style="width:100%;" rows="10" ><?php
33
+ $export = array();
34
+
35
+ $export["ginger_general"] = get_option('ginger_general');
36
+ $export["ginger_banner"] = get_option('ginger_banner');
37
+ // $ $export["ginger_policy"] = get_option('ginger_policy');
38
+ $export["gingerjscustom"] = get_option('gingerjscustom');
39
+ $export["ginger_jscustom"]= get_option('ginger_jscustom_options');
40
+ $export["gingeradsense"] = get_option('gingeradsense');
41
+ $export["gingerwpml"] = get_option('gingerwpml');
42
+ $export["ginger_wpml_options"] = get_option('ginger_wpml_options');
43
+ $export["gingerpolylang"] = get_option('gingerpolylang');
44
+ $export["ginger_polylang_options"] = get_option('ginger_polylang_options');
45
+ $export["gingeranalytics"] = get_option('gingeranalytics');
46
+ $export["gingeranalytics_option"] = get_option('gingeranalytics_option');
47
+ echo serialize($export);
48
+ ?></textarea>
49
+
50
+ <input type="hidden" name="action" value="export">
51
+
52
+ <br>
53
+ <hr>
54
+ <h3><?php _e("Import", "ginger"); ?></h3>
55
+
56
+ <p><?php _e("Upload here the export file to overwrite existing settings!", "ginger"); ?></p>
57
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>">
58
+ <?php wp_nonce_field('save_ginger_export_options', 'ginger_export_options'); ?>
59
+ <input type="hidden" name="action" value="import" >
60
+ <textarea name="data" style="width:100%;" rows="10" ></textarea>
61
+ <p> <small><b><?php _e("Attention: you must define manually a privacy policy page if you are using {{privacy_policy}} shortcode!", "ginger"); ?></b></small></p>
62
+
63
+ <input type="submit" value="<?php _e("Import Configuration", "ginger"); ?>" class="button" />
64
+ </form>
65
+ </div>
66
+ <?php
67
+ }
addon/ginger.addon.utils.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!function_exists("ginger_include_addons")) {
4
+ function ginger_include_addons()
5
+ {
6
+ // check native gallery types
7
+ $addons = array();
8
+ $addondir = plugin_dir_path(__FILE__);
9
+
10
+ $files = scandir($addondir);
11
+
12
+
13
+ foreach ($files as $file) {
14
+ if (is_dir($addondir . '/' . $file) && $file != "." && $file != "..") {
15
+ if (file_exists($addondir . '/' . $file . '/index.php')) {
16
+ require_once($addondir . '/' . $file . '/index.php');
17
+ $addons[] = $file;
18
+ }
19
+ }
20
+ }
21
+
22
+ return $addons;
23
+ }
24
+ }
25
+
26
+ $addons = ginger_include_addons();
addon/jscustom/ginger.jscustom.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ add_action('ginger_add_menu', 'add_ginger_jscustom');
5
+ function add_ginger_jscustom(){
6
+ add_submenu_page( 'ginger-setup', "Ginger JsCustom", __("Custom JS", "ginger"), 'manage_options', 'ginger-jscustom', 'ginger_jscustom_menu_page');
7
+ add_submenu_page( 'ginger-setup', "Ginger Iframe Custom", __("Custom Iframe", "ginger"), 'manage_options', 'ginger-iframe', 'ginger_iframe_menu_page');
8
+ }
9
+
10
+
11
+ function ginger_jscustom_menu_page(){
12
+
13
+
14
+ $key = "ginger_jscustom_options";
15
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_jscustom')){
16
+ return;
17
+ }
18
+
19
+ if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "saveurl"){
20
+ $params = $_POST["ginger_urls"];
21
+ update_option($key, $params);
22
+ echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
23
+ }
24
+
25
+ $options = get_option($key);
26
+ include("page/ginger-jscustom.php");
27
+
28
+ }
29
+
30
+
31
+ function ginger_iframe_menu_page(){
32
+
33
+ $key = "ginger_iframecustom_options";
34
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_jscustom')){
35
+ return;
36
+ }
37
+
38
+ if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "saveurl"){
39
+ $params = $_POST["ginger_urls"];
40
+ update_option($key, $params);
41
+ echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
42
+ }
43
+
44
+ $options = get_option($key);
45
+
46
+ include("page/ginger-iframe.php");
47
+
48
+
49
+ }
50
+
51
+
52
+ add_filter("ginger_script_tags", "ginger_jscustom_tags");
53
+ function ginger_jscustom_tags($array){
54
+ $key = "ginger_jscustom_options";
55
+ $options = get_option($key);
56
+ if($options == "") return $array;
57
+ // cicle over params to get sync
58
+ foreach ($options as $option) {
59
+ if(isset($option["ginger_url_enable"][0]) && $option["ginger_url_enable"][0]){
60
+ if(!isset($option["ginger_url_async"][0]) || !$option["ginger_url_async"][0]){
61
+ $array[]=$option["ginger_url"];
62
+ }
63
+ }
64
+ }
65
+ return $array;
66
+ }
67
+
68
+
69
+ add_filter("ginger_script_async_tags", "ginger_jscustom_async_tags");
70
+ function ginger_jscustom_async_tags($array){
71
+ $key = "ginger_jscustom_options";
72
+ $options = get_option($key);
73
+ if($options == "") return $array;
74
+ // cicle over params to get sync
75
+ foreach ($options as $option) {
76
+ if(isset($option["ginger_url_enable"][0]) && $option["ginger_url_enable"][0]){
77
+ if(isset($option["ginger_url_async"][0]) && $option["ginger_url_async"][0]){
78
+ $array[]=$option["ginger_url"];
79
+ }
80
+ }
81
+ }
82
+ return $array;
83
+ }
84
+
85
+ add_filter("ginger_add_iframe", "ginger_iframe_async_tags");
86
+ function ginger_iframe_async_tags($array){
87
+ $key = "ginger_iframecustom_options";
88
+ $options = get_option($key);
89
+ if($options == "") return $array;
90
+ // cicle over params to get sync
91
+ foreach ($options as $option) {
92
+ if($option["ginger_url_enable"][0]){
93
+ $array[]=$option["ginger_url"];
94
+ }
95
+ }
96
+ return $array;
97
+ }
addon/jscustom/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ require_once('ginger.jscustom.php');
addon/jscustom/page/ginger-iframe.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e("Custom Iframe Configuration", "ginger"); ?></h2>
3
+
4
+ <p><?php _e("Add here the iframe url that you want to block in relation to user's choice (if are not included in default ginger setup)", "ginger"); ?></p>
5
+ <hr>
6
+
7
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>" class="repeater" >
8
+ <?php wp_nonce_field('save_ginger_jscustom', 'ginger_options'); ?>
9
+
10
+ <div data-repeater-list="ginger_urls">
11
+ <?php
12
+
13
+ if (is_array($options)) {
14
+ foreach ($options as $option) {
15
+ ?>
16
+ <div data-repeater-item style="margin-top: 20px;">
17
+
18
+ <small><?php _e("URL", "ginger"); ?>:</small> <input type="text" name="ginger_url" id="ginger_url" value="<?php echo $option["ginger_url"]; ?>" size="40"/>
19
+
20
+ | <small><?php _e("Enable", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_enable" value="1" <?php if($option["ginger_url_enable"][0]) echo ' checked="checked"'; ?> >
21
+ | <input data-repeater-delete type="button" value="Delete" class="button button-primary small" />
22
+ </div>
23
+
24
+ <?php
25
+ }
26
+ }else{
27
+ ?>
28
+ <div data-repeater-item style="margin-top: 20px;">
29
+
30
+ <small><?php _e("URL", "ginger"); ?>:</small> <input type="text" name="ginger_url" id="ginger_url" value="" size="40"/>
31
+
32
+ | <small><?php _e("Enable", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_enable" value="1" checked="checked">
33
+ | <input data-repeater-delete type="button" value="Delete" class="button button-primary small" />
34
+ </div>
35
+ <?php
36
+
37
+ }
38
+ ?>
39
+
40
+
41
+ </div>
42
+ <p style="margin-top: 20px"><input data-repeater-create type="button" class="button button-secondary" value=" + Add Url + "/></p>
43
+ <input type="hidden" name="action" value="saveurl">
44
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
45
+
46
+
47
+ </form>
48
+
49
+
50
+
51
+ <script src="<?php echo plugins_url(); ?>/ginger/admin/js/jquery.repeater-master/jquery.repeater.js"></script>
52
+ <script>
53
+ jQuery(document).ready(function () {
54
+ 'use strict';
55
+ jQuery('.repeater').repeater({
56
+ defaultValues: {
57
+ //'textarea-input': 'foo',
58
+ 'ginger_url': '',
59
+ //'select-input': 'B',
60
+ //'checkbox-input': ['A', 'B'],
61
+ 'ginger_url_enable': '1'
62
+ },
63
+ show: function () {
64
+ jQuery(this).slideDown();
65
+ },
66
+ hide: function (deleteElement) {
67
+ if(confirm('Are you sure you want to delete this element?')) {
68
+ jQuery(this).slideUp(deleteElement);
69
+
70
+ }
71
+
72
+ }
73
+ });
74
+ });
75
+ </script>
76
+
77
+
78
+ </div>
addon/jscustom/page/ginger-jscustom.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Date: 22/07/15
4
+ * Time: 23.05
5
+ */
6
+ ?>
7
+
8
+ <div class="wrap">
9
+ <h2><?php _e("Custom Javascript Configuration", "ginger"); ?></h2>
10
+
11
+ <p><?php _e("Add here the javascript url that you want to block in relation to user's choice (if are not included in default ginger setup). <br>Mark <i>asynchronous</i> mode only if standard mode is not working properly!", "ginger"); ?></p>
12
+ <hr>
13
+
14
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>" class="repeater" >
15
+ <?php wp_nonce_field('save_ginger_jscustom', 'ginger_options'); ?>
16
+
17
+ <div data-repeater-list="ginger_urls">
18
+ <?php
19
+
20
+ if (is_array($options)) {
21
+ foreach ($options as $option) {
22
+ ?>
23
+ <div data-repeater-item style="margin-top: 20px;">
24
+
25
+ <small><?php _e("URL", "ginger"); ?>:</small> <input type="text" name="ginger_url" id="ginger_url" value="<?php echo $option["ginger_url"]; ?>" size="40"/>
26
+
27
+ | <small><?php _e("Enable", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_enable" value="1" <?php if(isset($option["ginger_url_enable"][0]) && $option["ginger_url_enable"][0]) echo ' checked="checked"'; ?> >
28
+ | <small><?php _e("Asynchronous mode", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_async" value="1" <?php if(isset($option["ginger_url_async"][0]) && $option["ginger_url_async"][0]) echo ' checked="checked"'; ?> >
29
+ | <input data-repeater-delete type="button" value="Delete" class="button button-primary small" />
30
+ </div>
31
+
32
+ <?php
33
+ }
34
+ }else{
35
+ ?>
36
+ <div data-repeater-item style="margin-top: 20px;">
37
+
38
+ <small><?php _e("URL", "ginger"); ?>:</small> <input type="text" name="ginger_url" id="ginger_url" value="" size="40"/>
39
+
40
+ | <small><?php _e("Enable", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_enable" value="1" checked="checked">
41
+ | <small><?php _e("Asynchronous mode", "ginger"); ?>:</small> <input type="checkbox" name="ginger_url_async" value="1" >
42
+ | <input data-repeater-delete type="button" value="Delete" class="button button-primary small" />
43
+ </div>
44
+ <?php
45
+
46
+ }
47
+ ?>
48
+
49
+
50
+ </div>
51
+ <p style="margin-top: 20px"><input data-repeater-create type="button" class="button button-secondary" value=" + Add Url + "/></p>
52
+ <input type="hidden" name="action" value="saveurl">
53
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
54
+
55
+
56
+ </form>
57
+
58
+
59
+
60
+ <script src="../wp-content/plugins/ginger/admin/js/jquery.repeater-master/jquery.repeater.js"></script>
61
+ <script>
62
+ jQuery(document).ready(function () {
63
+ 'use strict';
64
+ jQuery('.repeater').repeater({
65
+ defaultValues: {
66
+ //'textarea-input': 'foo',
67
+ 'ginger_url': '',
68
+ //'select-input': 'B',
69
+ //'checkbox-input': ['A', 'B'],
70
+ 'ginger_url_enable': '1'
71
+ },
72
+ show: function () {
73
+ jQuery(this).slideDown();
74
+ },
75
+ hide: function (deleteElement) {
76
+ if(confirm('Are you sure you want to delete this element?')) {
77
+ jQuery(this).slideUp(deleteElement);
78
+
79
+ }
80
+
81
+ }
82
+ });
83
+ });
84
+ </script>
85
+
86
+
87
+ </div>
addon/logger/ginger.logger.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action('ginger_add_menu', 'add_ginger_logger');
4
+ function add_ginger_logger(){
5
+ add_submenu_page( 'ginger-setup', "Ginger Logger", __("Activity Logger", "ginger"), 'manage_options', 'ginger-logger', 'ginger_logger');
6
+ }
7
+
8
+ function ginger_logger(){
9
+ global $wpdb;
10
+ if ( ! current_user_can( 'manage_options' ) ) die();
11
+
12
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_logger')){
13
+ return;
14
+ }
15
+
16
+ if(isset($_POST["action"]) && $_POST["action"] == "deleteall"){
17
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}logger_ginger WHERE 1" );
18
+ }
19
+
20
+ $option_logger = get_option('gingerlogger');
21
+ ?>
22
+ <div class="wrap">
23
+ <h2>Ginger - Logger Add On</h2>
24
+ <?php
25
+
26
+
27
+
28
+ $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
29
+ $limit = 20;
30
+ $offset = ( $pagenum - 1 ) * $limit;
31
+ $entries = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}logger_ginger WHERE 1 ORDER BY id DESC LIMIT $offset, $limit" );
32
+
33
+ echo '<div class="wrap">';
34
+
35
+ ?>
36
+ <table class="widefat">
37
+ <thead>
38
+ <tr>
39
+ <th scope="col" class="manage-column column-name" style="">Time</th>
40
+ <th scope="col" class="manage-column column-name" style="">IP</th>
41
+ <th scope="col" class="manage-column column-name" style="">url</th>
42
+ <th scope="col" class="manage-column column-name" style="">Cookie</th>
43
+ </tr>
44
+ </thead>
45
+
46
+ <tfoot>
47
+ <tr>
48
+ <th scope="col" class="manage-column column-name" style="">Time</th>
49
+ <th scope="col" class="manage-column column-name" style="">IP</th>
50
+ <th scope="col" class="manage-column column-name" style="">url</th>
51
+ <th scope="col" class="manage-column column-name" style="">Cookie</th>
52
+ </tr>
53
+ </tfoot>
54
+
55
+ <tbody>
56
+ <?php if( $entries ) { ?>
57
+
58
+ <?php
59
+ $count = 1;
60
+ $class = '';
61
+ foreach( $entries as $entry ) {
62
+ $class = ( $count % 2 == 0 ) ? ' class="alternate"' : '';
63
+ ?>
64
+
65
+ <tr<?php echo $class; ?>>
66
+ <td><?php echo $entry->time; ?></td>
67
+ <td><?php echo $entry->ipaddress; ?></td>
68
+ <td><?php echo $entry->url; ?></td>
69
+ <td><?php echo $entry->status; ?></td>
70
+ </tr>
71
+
72
+ <?php
73
+ $count++;
74
+ }
75
+ ?>
76
+
77
+ <?php } else { ?>
78
+ <tr>
79
+ <td colspan="2">No Logs yet</td>
80
+ </tr>
81
+ <?php } ?>
82
+ </tbody>
83
+ </table>
84
+
85
+ <?php
86
+ $total = $wpdb->get_var( "SELECT COUNT('id') FROM {$wpdb->prefix}logger_ginger" );
87
+ $num_of_pages = ceil( $total / $limit );
88
+ $page_links = paginate_links( array(
89
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
90
+ 'format' => '',
91
+ 'prev_text' => __( '&laquo;', 'aag' ),
92
+ 'next_text' => __( '&raquo;', 'aag' ),
93
+ 'total' => $num_of_pages,
94
+ 'current' => $pagenum
95
+ ) );
96
+
97
+ if ( $page_links ) {
98
+ echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
99
+ }
100
+
101
+ echo '</div>';
102
+ ?>
103
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>" >
104
+ <?php wp_nonce_field('save_ginger_logger', 'ginger_options'); ?>
105
+ <p><input type="submit" name="submit" value="<?php _e("Delete all logs", "ginger"); ?>" class="button button-primary delete-cookies"></p>
106
+ <input type="hidden" name="action" value="deleteall">
107
+ </form>
108
+ <script type="text/javascript">
109
+ jQuery(document).ready(function(){
110
+ jQuery(".delete-cookies").click(function() {
111
+ if (!confirm("<?php _e("Are you sure? This process cannot be undone.", "ginger"); ?>")){
112
+ return false;
113
+ }
114
+ });
115
+ });
116
+ </script>
117
+ </div>
118
+
119
+ <?php }
120
+
121
+ add_action("wp_head", "ginger_add_log_variable");
122
+ function ginger_add_log_variable(){
123
+ ?>
124
+ <script type="text/javascript">
125
+ var ginger_logger = "Y";
126
+ var ginger_logger_url = "<?php bloginfo("url"); ?>";
127
+ var current_url = "<?php echo (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>";
128
+
129
+ function gingerAjaxLogTime(status) {
130
+ var xmlHttp = new XMLHttpRequest();
131
+ var parameters = "ginger_action=time";
132
+ var url= ginger_logger_url + "?" + parameters;
133
+ xmlHttp.open("GET", url, true);
134
+
135
+ //Black magic paragraph
136
+ xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
137
+
138
+ xmlHttp.onreadystatechange = function() {
139
+ if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
140
+ var time = xmlHttp.responseText;
141
+ gingerAjaxLogger(time, status);
142
+ }
143
+ }
144
+
145
+ xmlHttp.send(parameters);
146
+ }
147
+
148
+ function gingerAjaxLogger(ginger_logtime, status) {
149
+ console.log(ginger_logtime);
150
+ var xmlHttp = new XMLHttpRequest();
151
+ var parameters = "ginger_action=log&time=" + ginger_logtime + "&url=" + current_url + "&status=" + status;
152
+ var url= ginger_logger_url + "?" + parameters;
153
+ console.log(url);
154
+ xmlHttp.open("GET", url, true);
155
+
156
+ //Black magic paragraph
157
+ xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
158
+
159
+ xmlHttp.send(parameters);
160
+ }
161
+
162
+ </script>
163
+ <?php
164
+ }
165
+
166
+
167
+
168
+ function ginger_do_log($url = "", $status = "Y"){
169
+ global $wpdb;
170
+ if($url == "")
171
+ $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
172
+ $table_name = $wpdb->prefix . 'logger_ginger';
173
+ $ipuser = ginger_get_ip_address();
174
+ $now = current_time( 'mysql' );
175
+ $wpdb->insert(
176
+ $table_name,
177
+ array(
178
+ 'time' => $now,
179
+ 'ipaddress' => $ipuser,
180
+ 'url' => $url,
181
+ 'status' => $status
182
+ ),
183
+ array(
184
+ '%s',
185
+ '%s',
186
+ '%s',
187
+ '%s'
188
+ )
189
+ );
190
+ }
191
+
192
+
193
+ function ginger_get_ip_address() {
194
+ // check for shared internet/ISP IP
195
+ if (!empty($_SERVER['HTTP_CLIENT_IP']) && ginger_validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
196
+ return $_SERVER['HTTP_CLIENT_IP'];
197
+ }
198
+
199
+ // check for IPs passing through proxies
200
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
201
+ // check if multiple ips exist in var
202
+ if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) {
203
+ $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
204
+ foreach ($iplist as $ip) {
205
+ if (ginger_validate_ip($ip))
206
+ return $ip;
207
+ }
208
+ } else {
209
+ if (ginger_validate_ip($_SERVER['HTTP_X_FORWARDED_FOR']))
210
+ return $_SERVER['HTTP_X_FORWARDED_FOR'];
211
+ }
212
+ }
213
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && ginger_validate_ip($_SERVER['HTTP_X_FORWARDED']))
214
+ return $_SERVER['HTTP_X_FORWARDED'];
215
+ if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && ginger_validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
216
+ return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
217
+ if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && ginger_validate_ip($_SERVER['HTTP_FORWARDED_FOR']))
218
+ return $_SERVER['HTTP_FORWARDED_FOR'];
219
+ if (!empty($_SERVER['HTTP_FORWARDED']) && ginger_validate_ip($_SERVER['HTTP_FORWARDED']))
220
+ return $_SERVER['HTTP_FORWARDED'];
221
+
222
+ // return unreliable ip since all else failed
223
+ return $_SERVER['REMOTE_ADDR'];
224
+ }
225
+
226
+ /**
227
+ * Ensures an ip address is both a valid IP and does not fall within
228
+ * a private network range.
229
+ */
230
+ function ginger_validate_ip($ip) {
231
+ if (strtolower($ip) === 'unknown')
232
+ return false;
233
+
234
+ // generate ipv4 network address
235
+ $ip = ip2long($ip);
236
+
237
+ // if the ip is set and not equivalent to 255.255.255.255
238
+ if ($ip !== false && $ip !== -1) {
239
+ // make sure to get unsigned long representation of ip
240
+ // due to discrepancies between 32 and 64 bit OSes and
241
+ // signed numbers (ints default to signed in PHP)
242
+ $ip = sprintf('%u', $ip);
243
+ // do private network range checking
244
+ if ($ip >= 0 && $ip <= 50331647) return false;
245
+ if ($ip >= 167772160 && $ip <= 184549375) return false;
246
+ if ($ip >= 2130706432 && $ip <= 2147483647) return false;
247
+ if ($ip >= 2851995648 && $ip <= 2852061183) return false;
248
+ if ($ip >= 2886729728 && $ip <= 2887778303) return false;
249
+ if ($ip >= 3221225984 && $ip <= 3221226239) return false;
250
+ if ($ip >= 3232235520 && $ip <= 3232301055) return false;
251
+ if ($ip >= 4294967040) return false;
252
+ }
253
+ return true;
254
+ }
255
+
256
+
257
+ // init to check date and save log
258
+ add_action("init", "ginger_activity_log");
259
+ function ginger_activity_log(){
260
+ if(!((isset($_GET["ginger_action"]) && $_GET["ginger_action"] == "time") || (isset($_GET["ginger_action"]) && $_GET["ginger_action"] == "log"))) {
261
+ return;
262
+ }
263
+ if($_GET["ginger_action"] == "time"){
264
+
265
+ header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
266
+ header("Pragma: no-cache"); // HTTP 1.0.
267
+ header("Expires: 0"); // Proxies.
268
+ echo time();
269
+ exit;
270
+ }
271
+ if($_GET["ginger_action"] == "log"){
272
+ if(!isset($_GET["url"]) || $_GET["url"] == "") exit;
273
+ if(!isset($_GET["time"]) || $_GET["time"] == "") exit;
274
+ if(!isset($_GET["status"]) || $_GET["status"] == "") exit;
275
+
276
+ if(($_GET["time"] + 10) < time()) exit;
277
+ header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
278
+ header("Pragma: no-cache"); // HTTP 1.0.
279
+ header("Expires: 0"); // Proxies.
280
+ // echo time();
281
+ if(function_exists("ginger_do_log")){
282
+ ginger_do_log($_GET["url"], $_GET["status"]);
283
+ }
284
+ exit;
285
+ }
286
+
287
+ }
addon/logger/index.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Logger
3
+ global $ginger_logger_db_version;
4
+ $ginger_logger_db_version = '4.0';
5
+
6
+ function ginger_logger_update_db_check() {
7
+ global $ginger_logger_db_version;
8
+ if ( get_site_option( 'ginger_logger_db_version' ) != $ginger_logger_db_version ) {
9
+ ginger_logger_create_table();
10
+ }
11
+ }
12
+ add_action( 'plugins_loaded', 'ginger_logger_update_db_check' );
13
+
14
+ function ginger_logger_create_table(){
15
+
16
+ global $wpdb;
17
+ $table_name = $wpdb->prefix . 'logger_ginger';
18
+ $charset_collate = $wpdb->get_charset_collate();
19
+ $sql = "CREATE TABLE $table_name (
20
+ id int(10) NOT NULL AUTO_INCREMENT,
21
+ time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
22
+ ipaddress varchar(45),
23
+ url text NOT NULL,
24
+ status varchar(1) DEFAULT 'Y' NOT NULL,
25
+ UNIQUE KEY id (id)
26
+ ) $charset_collate;";
27
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
28
+ dbDelta( $sql );
29
+
30
+ }
31
+
32
+ require_once('ginger.logger.php');
33
+
addon/polylang/ginger.polylang.php ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action("ginger_add_menu", "ginger_polylang_menu");
3
+
4
+ function ginger_polylang_menu(){
5
+
6
+ add_submenu_page( 'ginger-setup', "polylang", __("Polylang", "ginger"), 'manage_options', 'ginger-polylang', 'ginger_polylang_menu_page');
7
+
8
+
9
+ }
10
+
11
+ function ginger_polylang_menu_page(){
12
+ // global $sitepress;
13
+ global $polylang;
14
+ if(!function_exists("pll_current_language")){
15
+ echo '<div class="wrap"><h2>Polylang - Ginger setup</h2><hr><p>'.__("Polylang not found!", "ginger").'</p></div>';
16
+ return false;
17
+ }
18
+
19
+ // $current_lang = $sitepress->get_current_language(); //save current language
20
+ $current_lang = pll_current_language();
21
+
22
+ $key = "ginger_polylang_options";
23
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_polylang_options')){
24
+ return;
25
+ }
26
+
27
+ if(isset($_POST["submit"])){
28
+
29
+ $params = $_POST;
30
+ unset($params["submit"]);
31
+ unset($params["ginger_options"]);
32
+ unset($params["_wp_http_referer"]);
33
+
34
+
35
+ // print_r($params);
36
+ update_option($key, $params);
37
+
38
+ echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
39
+ }
40
+ $options = get_option($key);
41
+
42
+ // print_r($options);
43
+ ?>
44
+ <div class="wrap">
45
+ <h2>polylang - Ginger setup</h2>
46
+ <hr>
47
+
48
+ <?php
49
+ if (!function_exists('icl_get_languages')) {
50
+ echo "<h3>";
51
+ _e("polylang is disabled!", "ginger");
52
+ echo "</h3>";
53
+
54
+ _e("Enable here:", "ginger");
55
+ echo " <a href='".get_bloginfo("url")."/wp-admin/plugins.php'>"._("Plugins")."</a>";
56
+ }else{
57
+ ?>
58
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>">
59
+
60
+ <table class="form-table striped">
61
+ <thead>
62
+ <tr>
63
+ <td colspan="2">
64
+ <h2><?php _e("Banner Multilanguage Setup", "ginger"); ?></h2>
65
+ <?php _e("Overwrite default banner rules", "ginger"); ?>
66
+ </td>
67
+ </tr>
68
+ </thead>
69
+ <tbody>
70
+
71
+ <?php wp_nonce_field('save_ginger_polylang_options', 'ginger_options'); ?>
72
+ <?php
73
+ // $languages = icl_get_languages('skip_missing=0');
74
+ if (isset($polylang))
75
+ $languages = $polylang->model->get_languages_list() ;
76
+
77
+ //print_r($languages);
78
+ $c=0;
79
+ foreach ($languages as $language) {
80
+ $langcode=$language->slug;
81
+ $langval["native_name"] = $language->name;
82
+ $langval["slug"] = $language->slug;
83
+
84
+ ?>
85
+ <tr style="background-color:#F99A30; ">
86
+ <th scope="row" style="padding-left:20px;"></th>
87
+ <td>
88
+ <h2><?php echo $langval["native_name"]; ?></h2>
89
+ </td>
90
+ </tr>
91
+
92
+ <tr>
93
+ <th scope="row" style="padding-left:20px;"><?php _e("Banner Text", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
94
+ <td>
95
+ <fieldset>
96
+ <legend class="screen-reader-text"><span><?php _e("Banner Text", "ginger"); ?></span></legend>
97
+ <p><label><?php
98
+ if(!isset($options["ginger_banner_text"][$langcode]))
99
+ $options["ginger_banner_text"][$langcode] = "";
100
+ if (function_exists("wp_editor"))
101
+ wp_editor(stripslashes($options["ginger_banner_text"][$langcode]), "ginger_bar_text_".$langcode."", array('textarea_name' => "ginger_banner_text[".$langcode."]", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
102
+ else
103
+ echo '<textarea name = "ginger_banner_text['.$langcode.']" >' . $options["ginger_banner_text"][$langcode] . '</textarea>';
104
+ ?>
105
+ <br>
106
+ <small><?php _e('You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page defined in <a href="admin.php?page=ginger-setup&tab=policy">Privacy Policy Tab</a>', "ginger"); ?></small>
107
+ </label>
108
+ </p>
109
+ </fieldset>
110
+ </td>
111
+ </tr>
112
+
113
+ <tr>
114
+ <th scope="row" style="padding-left:20px;"><?php _e('Privacy Policy page', 'ginger'); ?> - <?php echo $langval["native_name"]; ?></th>
115
+ <td>
116
+ <fieldset>
117
+ <p><label>
118
+ <?php
119
+ // $sitepress->switch_lang($langcode);
120
+ $args = array(
121
+ 'sort_order' => 'asc',
122
+ 'sort_column' => 'post_title',
123
+ 'hierarchical' => 1,
124
+ 'number' => '',
125
+ 'offset' => 0,
126
+ 'post_type' => 'page',
127
+ 'post_status' => 'publish',
128
+ 'lang' => $langcode
129
+ );
130
+ // print_r($args);
131
+
132
+ $p = new WP_Query( $args );
133
+ if(!isset($options["ginger_privacy_page"][$langcode]))$options["ginger_privacy_page"][$langcode] = "";
134
+ ?>
135
+ <select name="ginger_privacy_page[<?php echo $langcode; ?>]" id="privacy_page_select_<?php echo $langcode; ?>" >
136
+ <option value=""><?php _e('Select page', 'ginger'); ?></option>
137
+ <?php
138
+ while ( $p->have_posts() ) :
139
+ $p->next_post();
140
+ ?>
141
+ <option value="<?php echo $p->post->ID; ?>" <?php if ($options["ginger_privacy_page"][$langcode] == $p->post->ID) echo ' selected="selected" '; ?>><?php echo $p->post->post_title; ?></option>
142
+ <?php
143
+ endwhile;
144
+ ?>
145
+ </select>
146
+ <?php
147
+ // $sitepress->switch_lang($current_lang); //restore previous language
148
+ ?>
149
+
150
+ </label></p>
151
+ </fieldset>
152
+ </td>
153
+ </tr>
154
+
155
+
156
+
157
+ <tr>
158
+ <th scope="row" style="padding-left:20px;"><?php _e("Iframe Text", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
159
+ <td>
160
+ <fieldset>
161
+ <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
162
+ <p><label><?php
163
+ if(!isset($options["ginger_Iframe_text"][$langcode]))
164
+ $options["ginger_Iframe_text"][$langcode] = "";
165
+ if (function_exists("wp_editor"))
166
+ wp_editor(stripslashes($options["ginger_Iframe_text"][$langcode]), "ginger_Iframe_text_".$langcode."", array('textarea_name' => "ginger_Iframe_text[".$langcode."]", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
167
+ else
168
+ echo '<textarea name = "ginger_Iframe_text['.$langcode.']" >' . $options["ginger_Iframe_text"][$langcode] . '</textarea>';
169
+
170
+ ?></label></p>
171
+ </fieldset>
172
+ </td>
173
+ </tr>
174
+
175
+ <tr>
176
+ <th scope="row" style="padding-left:20px;"><?php _e("Customize your banner buttons", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
177
+ <td>
178
+ <fieldset>
179
+ <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
180
+ <p>
181
+ <label><b><?php _e("Accept cookie Button", "ginger"); ?></b></label>
182
+ </p>
183
+
184
+ <p>
185
+ <label><?php _e("Text", "ginger"); ?></label>
186
+ <?php
187
+ if(!isset($options['accept_cookie_button_text'][$langcode]))$options['accept_cookie_button_text'][$langcode] = "";
188
+ ?>
189
+ <input name="accept_cookie_button_text[<?php echo $langcode; ?>]" id="accept_cookie_button_text_<?php echo $langcode; ?>" type="text"
190
+ value="<?php if ($options['accept_cookie_button_text'][$langcode] != "") {
191
+ echo $options['accept_cookie_button_text'][$langcode];
192
+ } else {
193
+ echo _e('Accept Cookie', 'ginger');
194
+ } ?>">
195
+ </p>
196
+
197
+ <p>
198
+ <label><b><?php _e("Disable cookie Button", "ginger"); ?></b></label>
199
+ </p>
200
+
201
+ <p>
202
+ <label><?php _e("Text", "ginger"); ?></label>
203
+ <input name="disable_cookie_button_text[<?php echo $langcode; ?>]" id="disable_cookie_button_text_<?php echo $langcode; ?>" type="text"
204
+ value="<?php if (isset($options['disable_cookie_button_text'][$langcode]) && $options['disable_cookie_button_text'][$langcode] != "") {
205
+ echo $options['disable_cookie_button_text'][$langcode];
206
+ } else {
207
+ echo _e('Disable Cookie', 'ginger');
208
+ } ?>" <?php if (!(isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1")) {
209
+ echo 'disabled=true';
210
+ } ?>>
211
+ <?php echo _e('Enable:', 'ginger') ?>&nbsp;
212
+ <input type="checkbox" id="disable_cookie_button_status_<?php echo $langcode; ?>" name="disable_cookie_button_status[<?php echo $langcode; ?>]"
213
+ value="1" <?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
214
+ echo 'checked';
215
+ } ?>
216
+ onclick="en_dis_able_text_banner_button('disable_cookie_button_status_<?php echo $langcode; ?>','disable_cookie_button_text_<?php echo $langcode; ?>','img_disable_cookie_button_status_<?php echo $langcode; ?>');">
217
+
218
+
219
+ <img id="img_disable_cookie_button_status_<?php echo $langcode; ?>"
220
+ src="<?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
221
+ echo plugins_url("ginger/img/ok.png");
222
+ } else {
223
+ echo plugins_url("ginger/img/xx.png");
224
+ } ?>" style="max-width: 20px; max-height: 20px; vertical-align: middle">
225
+
226
+
227
+ </p>
228
+ </fieldset>
229
+ </td>
230
+ </tr>
231
+
232
+
233
+
234
+
235
+ <?php
236
+
237
+ }
238
+ ?>
239
+ </tbody>
240
+ </table>
241
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
242
+ </form>
243
+ <?php
244
+
245
+ }// check polylang active
246
+ ?>
247
+
248
+
249
+
250
+ </div>
251
+
252
+ <?php
253
+
254
+ }
255
+
256
+
257
+ add_filter("ginger_text_iframe", "ginger_polylang_text_iframe");
258
+ function ginger_polylang_text_iframe($text){
259
+ $key = "ginger_polylang_options";
260
+ $options = get_option($key);
261
+ if($options == "") return $text;
262
+ if (!function_exists('icl_get_languages')) return $text;
263
+
264
+ /* global $sitepress;
265
+ $current_lang = $sitepress->get_current_language(); //save current language
266
+ */
267
+
268
+ $current_lang = pll_current_language();
269
+ if(trim(strip_tags($options['ginger_Iframe_text'][$current_lang]))):
270
+ $ginger_iframe_text = $options['ginger_Iframe_text'][$current_lang];
271
+ $ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
272
+ $ginger_iframe_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_iframe_text );
273
+ return $ginger_iframe_text;
274
+ endif;
275
+
276
+ return $text;
277
+ }
278
+
279
+
280
+ add_filter("ginger_text_banner", "ginger_polylang_text_banner");
281
+ function ginger_polylang_text_banner($text)
282
+ {
283
+ $key = "ginger_polylang_options";
284
+ $options = get_option($key);
285
+ if ($options == "") return $text;
286
+ if (!function_exists('icl_get_languages')) return $text;
287
+
288
+ // global $sitepress;
289
+ // $current_lang = $sitepress->get_current_language(); //save current language
290
+ $current_lang = pll_current_language();
291
+
292
+ if (trim(strip_tags($options['ginger_banner_text'][$current_lang])) != ""):
293
+ $ginger_text = $options['ginger_banner_text'][$current_lang];
294
+ $ginger_text = str_replace('</', '<\/', $ginger_text);
295
+ $ginger_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_text);
296
+
297
+ //Recupero privacy policy se presente
298
+ if (strpos($ginger_text, '{{privacy_page}}') !== false):
299
+ $privacy_policy = $options['ginger_privacy_page'][$current_lang];
300
+ if ($privacy_policy) {
301
+
302
+ $privacy_policy = get_post($privacy_policy);
303
+ $privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . addslashes($privacy_policy->post_title) . '<\/a>';
304
+ $ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
305
+ }
306
+ endif;
307
+ return $ginger_text;
308
+ endif;
309
+
310
+ return $text;
311
+ }
312
+
313
+ add_filter("ginger_label_accept_cookie", "ginger_polylang_label_accept_cookie");
314
+ function ginger_polylang_label_accept_cookie($text){
315
+ $key = "ginger_polylang_options";
316
+ $options = get_option($key);
317
+ if($options == "") return $text;
318
+ if (!function_exists('icl_get_languages')) return $text;
319
+
320
+ // global $sitepress;
321
+ // $current_lang = $sitepress->get_current_language();
322
+ $current_lang = pll_current_language();
323
+
324
+ if(trim($options['accept_cookie_button_text'][$current_lang])):
325
+ $label_accept_cookie = $options['accept_cookie_button_text'][$current_lang];
326
+ return $label_accept_cookie;
327
+ endif;
328
+
329
+ return $text;
330
+ }
331
+
332
+ add_filter("ginger_label_disable_cookie", "ginger_polylang_label_disable_cookie");
333
+ function ginger_polylang_label_disable_cookie($text){
334
+ $key = "ginger_polylang_options";
335
+ $options = get_option($key);
336
+ if($options == "") return $text;
337
+ if (!function_exists('icl_get_languages')) return $text;
338
+
339
+ // global $sitepress;
340
+ // $current_lang = $sitepress->get_current_language(); //save current language
341
+ $current_lang = pll_current_language();
342
+
343
+ if(isset($options['disable_cookie_button_status'][$current_lang])):
344
+ if(trim($options['disable_cookie_button_text'][$current_lang])):
345
+ $label_disable_cookie = $options['disable_cookie_button_text'][$current_lang];
346
+ return $label_disable_cookie;
347
+ endif;
348
+ endif;
349
+
350
+ return $text;
351
+ }
352
+
353
+
addon/polylang/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ //polylang
3
+ require_once('ginger.polylang.php');
addon/wpml/ginger.wpml.php ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action("ginger_add_menu", "ginger_wpml_menu");
3
+
4
+ function ginger_wpml_menu(){
5
+
6
+ add_submenu_page( 'ginger-setup', "WPML", __("WPML", "ginger"), 'manage_options', 'ginger-wpml', 'ginger_wpml_menu_page');
7
+
8
+
9
+ }
10
+
11
+ function ginger_wpml_menu_page(){
12
+ global $sitepress;
13
+ if($sitepress){
14
+ $current_lang = $sitepress->get_current_language(); //save current language
15
+ }else{
16
+ echo '<div class="wrap"><h2>WPML - Ginger setup</h2><hr><p>'.__("WPML not found!", "ginger").'</p></div>';
17
+ exit;
18
+ }
19
+
20
+ $key = "ginger_wpml_options";
21
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_wpml_options')){
22
+ return;
23
+ }
24
+
25
+ if(isset($_POST["submit"])){
26
+
27
+ $params = $_POST;
28
+ unset($params["submit"]);
29
+ unset($params["ginger_options"]);
30
+ unset($params["_wp_http_referer"]);
31
+
32
+
33
+ // print_r($params);
34
+ update_option($key, $params);
35
+
36
+ echo '<div class="updated"><p>'.__( 'Updated!', 'ginger' ).'</p></div>';
37
+ }
38
+ $options = get_option($key);
39
+
40
+ // print_r($options);
41
+ ?>
42
+ <div class="wrap">
43
+ <h2>WPML - Ginger setup</h2>
44
+ <hr>
45
+
46
+ <?php
47
+ if (!function_exists('icl_get_languages')) {
48
+ echo "<h3>";
49
+ _e("WPML is disabled!", "ginger");
50
+ echo "</h3>";
51
+
52
+ _e("Enable here:", "ginger");
53
+ echo " <a href='".get_bloginfo("url")."/wp-admin/plugins.php'>"._("Plugins")."</a>";
54
+ }else{
55
+ ?>
56
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>">
57
+
58
+ <table class="form-table striped">
59
+ <thead>
60
+ <tr>
61
+ <td colspan="2">
62
+ <h2><?php _e("Banner Multilanguage Setup", "ginger"); ?></h2>
63
+ <?php _e("Overwrite default banner rules", "ginger"); ?>
64
+ </td>
65
+ </tr>
66
+ </thead>
67
+ <tbody>
68
+
69
+ <?php wp_nonce_field('save_ginger_wpml_options', 'ginger_options'); ?>
70
+ <?php
71
+ $languages = icl_get_languages('skip_missing=0');
72
+ //print_r($languages);
73
+ $c=0;
74
+ foreach ($languages as $langcode=>$langval ) {
75
+ ?>
76
+ <tr style="background-color:#F99A30; ">
77
+ <th scope="row" style="padding-left:20px;"></th>
78
+ <td>
79
+ <h2><?php echo $langval["native_name"]; ?></h2>
80
+ </td>
81
+ </tr>
82
+
83
+ <tr>
84
+ <th scope="row" style="padding-left:20px;"><?php _e("Banner Text", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
85
+ <td>
86
+ <fieldset>
87
+ <legend class="screen-reader-text"><span><?php _e("Banner Text", "ginger"); ?></span></legend>
88
+ <p><label><?php
89
+ if (function_exists("wp_editor"))
90
+ wp_editor(stripslashes($options["ginger_banner_text"][$langcode]), "ginger_bar_text_".$langcode."", array('textarea_name' => "ginger_banner_text[".$langcode."]", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
91
+ else
92
+ echo '<textarea name = "ginger_banner_text['.$langcode.']" >' . $options["ginger_banner_text"][$langcode] . '</textarea>';
93
+ ?>
94
+ <br>
95
+ <small><?php _e('You can use syntax <code>{{privacy_page}}</code> to link Privacy Police Page defined in <a href="admin.php?page=ginger-setup&tab=policy">Privacy Policy Tab</a>', "ginger"); ?></small>
96
+ </label>
97
+ </p>
98
+ </fieldset>
99
+ </td>
100
+ </tr>
101
+
102
+ <tr>
103
+ <th scope="row" style="padding-left:20px;"><?php _e('Privacy Policy page', 'ginger'); ?> - <?php echo $langval["native_name"]; ?></th>
104
+ <td>
105
+ <fieldset>
106
+ <p><label>
107
+ <?php
108
+ $sitepress->switch_lang($langcode);
109
+ $args = array(
110
+ 'sort_order' => 'asc',
111
+ 'sort_column' => 'post_title',
112
+ 'hierarchical' => 1,
113
+ 'number' => '',
114
+ 'offset' => 0,
115
+ 'post_type' => 'page',
116
+ 'post_status' => 'publish',
117
+ );
118
+
119
+ $p = new WP_Query( $args );
120
+ ?>
121
+ <select name="ginger_privacy_page[<?php echo $langcode; ?>]" id="privacy_page_select_<?php echo $langcode; ?>" >
122
+ <option value=""><?php _e('Select page', 'ginger'); ?></option>
123
+ <?php
124
+ while ( $p->have_posts() ) :
125
+ $p->next_post();
126
+ ?>
127
+ <option value="<?php echo $p->post->ID; ?>" <?php if ($options["ginger_privacy_page"][$langcode] == $p->post->ID) echo ' selected="selected" '; ?>><?php echo $p->post->post_title; ?></option>
128
+ <?php
129
+ endwhile;
130
+ ?>
131
+ </select>
132
+ <?php
133
+ $sitepress->switch_lang($current_lang); //restore previous language
134
+ ?>
135
+
136
+ </label></p>
137
+ </fieldset>
138
+ </td>
139
+ </tr>
140
+
141
+
142
+
143
+ <tr>
144
+ <th scope="row" style="padding-left:20px;"><?php _e("Iframe Text", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
145
+ <td>
146
+ <fieldset>
147
+ <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
148
+ <p><label><?php
149
+ if (function_exists("wp_editor"))
150
+ wp_editor(stripslashes($options["ginger_Iframe_text"][$langcode]), "ginger_Iframe_text_".$langcode."", array('textarea_name' => "ginger_Iframe_text[".$langcode."]", 'media_buttons' => false, 'textarea_rows' => 3, 'teeny' => true));
151
+ else
152
+ echo '<textarea name = "ginger_Iframe_text['.$langcode.']" >' . $options["ginger_Iframe_text"][$langcode] . '</textarea>';
153
+
154
+ ?></label></p>
155
+ </fieldset>
156
+ </td>
157
+ </tr>
158
+
159
+ <tr>
160
+ <th scope="row" style="padding-left:20px;"><?php _e("Customize your banner buttons", "ginger"); ?> - <?php echo $langval["native_name"]; ?></th>
161
+ <td>
162
+ <fieldset>
163
+ <legend class="screen-reader-text"><span><?php _e("Iframe Text", "ginger"); ?></span></legend>
164
+ <p>
165
+ <label><b><?php _e("Accept cookie Button", "ginger"); ?></b></label>
166
+ </p>
167
+
168
+ <p>
169
+ <label><?php _e("Text", "ginger"); ?></label>
170
+ <input name="accept_cookie_button_text[<?php echo $langcode; ?>]" id="accept_cookie_button_text_<?php echo $langcode; ?>" type="text"
171
+ value="<?php if ($options['accept_cookie_button_text'][$langcode] != "") {
172
+ echo $options['accept_cookie_button_text'][$langcode];
173
+ } else {
174
+ echo _e('Accept Cookie', 'ginger');
175
+ } ?>">
176
+ </p>
177
+
178
+ <p>
179
+ <label><b><?php _e("Disable cookie Button", "ginger"); ?></b></label>
180
+ </p>
181
+
182
+ <p>
183
+ <label><?php _e("Text", "ginger"); ?></label>
184
+ <input name="disable_cookie_button_text[<?php echo $langcode; ?>]" id="disable_cookie_button_text_<?php echo $langcode; ?>" type="text"
185
+ value="<?php if (isset($options['disable_cookie_button_text'][$langcode]) && $options['disable_cookie_button_text'][$langcode] != "") {
186
+ echo $options['disable_cookie_button_text'][$langcode];
187
+ } else {
188
+ echo _e('Disable Cookie', 'ginger');
189
+ } ?>" <?php if (!(isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1")) {
190
+ echo 'disabled=true';
191
+ } ?>>
192
+ <?php echo _e('Enable:', 'ginger') ?>&nbsp;
193
+ <input type="checkbox" id="disable_cookie_button_status_<?php echo $langcode; ?>" name="disable_cookie_button_status[<?php echo $langcode; ?>]"
194
+ value="1" <?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
195
+ echo 'checked';
196
+ } ?>
197
+ onclick="en_dis_able_text_banner_button('disable_cookie_button_status_<?php echo $langcode; ?>','disable_cookie_button_text_<?php echo $langcode; ?>','img_disable_cookie_button_status_<?php echo $langcode; ?>');">
198
+
199
+
200
+ <img id="img_disable_cookie_button_status_<?php echo $langcode; ?>"
201
+ src="<?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
202
+ echo plugins_url("ginger/img/ok.png");
203
+ } else {
204
+ echo plugins_url("ginger/img/xx.png");
205
+ } ?>" style="max-width: 20px; max-height: 20px; vertical-align: middle">
206
+
207
+
208
+ </p>
209
+ </fieldset>
210
+ </td>
211
+ </tr>
212
+
213
+
214
+
215
+
216
+ <?php
217
+
218
+ }
219
+ ?>
220
+ </tbody>
221
+ </table>
222
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e("Save Changes", "ginger"); ?>"></p>
223
+ </form>
224
+ <?php
225
+
226
+ }// check wpml active
227
+ ?>
228
+
229
+
230
+
231
+ </div>
232
+
233
+ <?php
234
+
235
+ }
236
+
237
+
238
+ add_filter("ginger_text_iframe", "ginger_wpml_text_iframe");
239
+ function ginger_wpml_text_iframe($text){
240
+ $key = "ginger_wpml_options";
241
+ $options = get_option($key);
242
+ if($options == "") return $text;
243
+ if (!function_exists('icl_get_languages')) return $text;
244
+
245
+ global $sitepress;
246
+ if($sitepress)
247
+ $current_lang = $sitepress->get_current_language(); //save current language
248
+ else
249
+ return $text;
250
+
251
+ if(trim(strip_tags($options['ginger_Iframe_text'][$current_lang]))):
252
+ $ginger_iframe_text = $options['ginger_Iframe_text'][$current_lang];
253
+ $ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
254
+ $ginger_iframe_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_iframe_text );
255
+ return $ginger_iframe_text;
256
+ endif;
257
+
258
+ return $text;
259
+ }
260
+
261
+
262
+ add_filter("ginger_text_banner", "ginger_wpml_text_banner");
263
+ function ginger_wpml_text_banner($text)
264
+ {
265
+ $key = "ginger_wpml_options";
266
+ $options = get_option($key);
267
+ if ($options == "") return $text;
268
+ if (!function_exists('icl_get_languages')) return $text;
269
+
270
+ global $sitepress;
271
+ if($sitepress)
272
+ $current_lang = $sitepress->get_current_language(); //save current language
273
+ else
274
+ return $text;
275
+ if (trim(strip_tags($options['ginger_banner_text'][$current_lang])) != ""):
276
+ $ginger_text = $options['ginger_banner_text'][$current_lang];
277
+ $ginger_text = str_replace('</', '<\/', $ginger_text);
278
+ $ginger_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_text);
279
+
280
+ //Recupero privacy policy se presente
281
+ if (strpos($ginger_text, '{{privacy_page}}') !== false):
282
+ $privacy_policy = $options['ginger_privacy_page'][$current_lang];
283
+ if ($privacy_policy) {
284
+
285
+ $privacy_policy = get_post($privacy_policy);
286
+ $privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . addslashes($privacy_policy->post_title) . '<\/a>';
287
+ $ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
288
+ }
289
+ endif;
290
+ return $ginger_text;
291
+ endif;
292
+
293
+ return $text;
294
+ }
295
+
296
+ add_filter("ginger_label_accept_cookie", "ginger_wpml_label_accept_cookie");
297
+ function ginger_wpml_label_accept_cookie($text){
298
+ $key = "ginger_wpml_options";
299
+ $options = get_option($key);
300
+ if($options == "") return $text;
301
+ if (!function_exists('icl_get_languages')) return $text;
302
+
303
+ global $sitepress;
304
+ if($sitepress)
305
+ $current_lang = $sitepress->get_current_language();
306
+ else
307
+ return $text;
308
+
309
+ if(trim($options['accept_cookie_button_text'][$current_lang])):
310
+ $label_accept_cookie = $options['accept_cookie_button_text'][$current_lang];
311
+ return $label_accept_cookie;
312
+ endif;
313
+
314
+ return $text;
315
+ }
316
+
317
+ add_filter("ginger_label_disable_cookie", "ginger_wpml_label_disable_cookie");
318
+ function ginger_wpml_label_disable_cookie($text){
319
+ $key = "ginger_wpml_options";
320
+ $options = get_option($key);
321
+ if($options == "") return $text;
322
+ if (!function_exists('icl_get_languages')) return $text;
323
+
324
+ global $sitepress;
325
+ if($sitepress)
326
+ $current_lang = $sitepress->get_current_language(); //save current language
327
+ else
328
+ return $text;
329
+ if($options['disable_cookie_button_status'][$current_lang]):
330
+ if(trim($options['disable_cookie_button_text'][$current_lang])):
331
+ $label_disable_cookie = $options['disable_cookie_button_text'][$current_lang];
332
+ return $label_disable_cookie;
333
+ endif;
334
+ endif;
335
+
336
+ return $text;
337
+ }
338
+
339
+
addon/wpml/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ require_once('ginger.wpml.php');
admin/ginger.pointer.php CHANGED
@@ -3,7 +3,7 @@
3
  if (!class_exists("gingerSimpleNote")) {
4
  class gingerSimpleNote
5
  {
6
- function gingerSimpleNote() // Constructor
7
  {
8
  register_activation_hook(__FILE__, array($this, 'run_on_activate'));
9
  add_action('admin_enqueue_scripts', array($this, 'gingersimplenote_admin_scripts'));
3
  if (!class_exists("gingerSimpleNote")) {
4
  class gingerSimpleNote
5
  {
6
+ public function __construct() // Constructor
7
  {
8
  register_activation_hook(__FILE__, array($this, 'run_on_activate'));
9
  add_action('admin_enqueue_scripts', array($this, 'gingersimplenote_admin_scripts'));
admin/ginger.utils.php CHANGED
@@ -14,7 +14,6 @@ function register_ginger_menu_page(){
14
  $ginger_menu_hook = add_menu_page( 'ginger', 'Ginger Cookie', 'manage_options', 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
15
  do_action("ginger_add_menu");
16
 
17
- add_submenu_page( 'ginger-setup', "Premium", __("Premium", "ginger"), 'manage_options', 'ginger-about', 'ginger_about_menu_page');
18
 
19
  if ($ginger_menu_hook) {
20
  if(function_exists("get_current_screen"))
@@ -27,9 +26,7 @@ function register_ginger_menu_page(){
27
  function ginger_menu_page(){
28
  require_once(plugin_dir_path( __FILE__ )."/ginger.admin.php");
29
  }
30
- function ginger_about_menu_page(){
31
- require_once(plugin_dir_path( __FILE__ )."/ginger.about.php");
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 ) {
@@ -105,10 +102,3 @@ function save_privacy_page($title,$content){
105
  return($id);
106
  }
107
 
108
-
109
- function render_ginger_action_links($actions)
110
- {
111
- $url = "http://www.ginger-cookielaw.com/download/";
112
- $actions[] = '<a href="' . $url . '" style="color:#3db634;" target="_blank">' . _x( 'Get Tools Installer & Upgrade', 'ginger' ) . '</a>';
113
- return $actions;
114
- }
14
  $ginger_menu_hook = add_menu_page( 'ginger', 'Ginger Cookie', 'manage_options', 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
15
  do_action("ginger_add_menu");
16
 
 
17
 
18
  if ($ginger_menu_hook) {
19
  if(function_exists("get_current_screen"))
26
  function ginger_menu_page(){
27
  require_once(plugin_dir_path( __FILE__ )."/ginger.admin.php");
28
  }
29
+
 
 
30
  //Aggingo style e script per ginger backend
31
  add_action( 'admin_enqueue_scripts', 'ginger_add_admin_js' );
32
  function ginger_add_admin_js( $hook ) {
102
  return($id);
103
  }
104
 
 
 
 
 
 
 
 
admin/img/logo-head.png CHANGED
File without changes
admin/js/ginger.color.js CHANGED
File without changes
admin/js/ginger.js CHANGED
File without changes
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/banner.php CHANGED
File without changes
admin/partial/bar.php CHANGED
File without changes
admin/partial/dialog.php CHANGED
File without changes
admin/partial/general.php CHANGED
File without changes
admin/partial/policy.php CHANGED
File without changes
front/css/cookies-enabler-dialog.css CHANGED
File without changes
front/gingerfront.core.php CHANGED
File without changes
front/gingerfront.utils.php CHANGED
File without changes
ginger-eu-cookie-law.php CHANGED
@@ -2,8 +2,8 @@
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! For more features get <a href="http://www.ginger-cookielaw.com/download/">Ginger Plus - Tools Installer</a>
6
- Version: 3.1.5
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
@@ -12,7 +12,16 @@ Text Domain: ginger
12
 
13
  if ( !defined('ABSPATH')) exit;
14
 
 
 
 
 
 
 
 
 
15
  load_plugin_textdomain( 'ginger', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
16
 
17
  //Gestione Backend
18
  if(is_admin()){
@@ -25,5 +34,3 @@ if(!is_admin()){
25
  require_once("front/gingerfront.utils.php");
26
  require_once("front/gingerfront.core.php");
27
  }
28
-
29
- add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'render_ginger_action_links');
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.0
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
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()){
34
  require_once("front/gingerfront.utils.php");
35
  require_once("front/gingerfront.core.php");
36
  }
 
 
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
5
  Requires at least: 3.0.1
6
- Tested up to: 4.4
7
- Stable tag: 3.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,6 +12,9 @@ Ginger allows to show a configurable banner and blocks third party cookies compl
12
  == Description ==
13
 
14
  Ginger is a **complete plug'n play solution** that make your website compliant with EU Cookie law. Configure your banner and block cookies **before** or **after** users' choise.
 
 
 
15
 
16
  = Features: =
17
  * really **plug'n play**: simply activate, and enjoy
@@ -22,6 +25,8 @@ Ginger is a **complete plug'n play solution** that make your website compliant w
22
 
23
 
24
  = Natively Supports: =
 
 
25
  * twitter
26
  * facebook
27
  * linkedin
@@ -33,19 +38,11 @@ Ginger is a **complete plug'n play solution** that make your website compliant w
33
  * vimeo
34
  * Disqus
35
  * ShareThis
36
-
37
- = Activable Addons: =
38
  * Custom Javascript url & Custom Iframe url to extend native support
39
- * Adsense
40
- * Analytics
41
- * WPML
42
- * Polylang
43
  * Cookie Users' Acceptance Logger
44
 
45
- = Coming soon: =
46
- * **Privacy Policy** Generator
47
- * **Multisite** addon
48
-
49
  More information [here: ginger-cookielaw.com](http://www.ginger-cookielaw.com/)
50
 
51
  **Send us [suggestions or bug report](https://wordpress.org/support/plugin/ginger)!**
@@ -93,6 +90,10 @@ Yes, actually you we have 2 addons for multilanguages: wpml and polylang. Ask to
93
 
94
  == Changelog ==
95
 
 
 
 
 
96
  = 3.1.5 =
97
  * new option to disable ginger on loggedin
98
  * new option to exclude specific pages
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.7.3
7
+ Stable tag: 4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
  == Description ==
13
 
14
  Ginger is a **complete plug'n play solution** that make your website compliant with EU Cookie law. Configure your banner and block cookies **before** or **after** users' choise.
15
+ Now **totally free and all addon unlocked!**
16
+
17
+ Help me to keep this plugin mantained: https://github.com/webgrafia/ginger
18
 
19
  = Features: =
20
  * really **plug'n play**: simply activate, and enjoy
25
 
26
 
27
  = Natively Supports: =
28
+ * Adsense
29
+ * Analytics
30
  * twitter
31
  * facebook
32
  * linkedin
38
  * vimeo
39
  * Disqus
40
  * ShareThis
 
 
41
  * Custom Javascript url & Custom Iframe url to extend native support
42
+ * WPML support
43
+ * Polylang support
 
 
44
  * Cookie Users' Acceptance Logger
45
 
 
 
 
 
46
  More information [here: ginger-cookielaw.com](http://www.ginger-cookielaw.com/)
47
 
48
  **Send us [suggestions or bug report](https://wordpress.org/support/plugin/ginger)!**
90
 
91
  == Changelog ==
92
 
93
+
94
+ = 4.0 =
95
+ * all feature unlocked
96
+
97
  = 3.1.5 =
98
  * new option to disable ginger on loggedin
99
  * new option to exclude specific pages
uninstall.php CHANGED
File without changes