Version Description
- Custom js/iframe addon
- new addon page layout
- fix bug addon analytics
- minor fixes
Download this release
Release Info
Developer | manafactory |
Plugin | Ginger – EU Cookie Law |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.1
- addon/adsense/ginger.adsense.php +0 -1
- addon/adsense/index.php +12 -9
- addon/analytics/ginger.analytics.php +1 -0
- addon/analytics/gingeranalytics.js +0 -34
- addon/analytics/index.php +12 -8
- addon/ginger.addon.utils.php +57 -37
- addon/ginger.addoncheck.php +6 -3
- addon/jscustom/ginger.jscustom.php +97 -0
- addon/jscustom/index.php +91 -0
- addon/jscustom/page/ginger-iframe.php +78 -0
- addon/jscustom/page/ginger-jscustom.php +87 -0
- addon/wpml/ginger.wpml.php +98 -5
- addon/wpml/index.php +12 -99
- admin/ginger.admin.php +3 -3
- admin/ginger.utils.php +18 -25
- admin/partial/url.php +0 -99
- front/gingerfront.core.php +8 -6
- ginger-eu-cookie-law.php +1 -2
- readme.txt +13 -3
- uninstall.php +11 -0
addon/adsense/ginger.adsense.php
CHANGED
@@ -42,7 +42,6 @@ function ginger_adsense(){
|
|
42 |
$data = execute_request( $args );
|
43 |
if($data->success == 1): //Inizio Verifica ?>
|
44 |
<div class="wrap">
|
45 |
-
<?php $option = get_option('gingeradsense_option');?>
|
46 |
<h2>Ginger - Adsense Add On</h2>
|
47 |
<p><?php _e("No configuration required!", "ginger"); ?></p>
|
48 |
|
42 |
$data = execute_request( $args );
|
43 |
if($data->success == 1): //Inizio Verifica ?>
|
44 |
<div class="wrap">
|
|
|
45 |
<h2>Ginger - Adsense Add On</h2>
|
46 |
<p><?php _e("No configuration required!", "ginger"); ?></p>
|
47 |
|
addon/adsense/index.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
//Adsense
|
3 |
-
$
|
4 |
-
if($
|
5 |
require_once('ginger.adsense.php');
|
6 |
endif;
|
7 |
|
@@ -9,22 +9,25 @@ add_action("ginger_addon_activation_page", "ginger_adsense_activation_page");
|
|
9 |
|
10 |
function ginger_adsense_activation_page()
|
11 |
{
|
12 |
-
|
13 |
-
|
|
|
14 |
?>
|
|
|
|
|
15 |
<table class="form-table striped">
|
16 |
<thead>
|
17 |
<tr>
|
18 |
<td colspan="2">
|
|
|
19 |
<h3><?php _e("Google AdSense", "ginger"); ?>
|
20 |
<?php
|
21 |
-
$appname
|
22 |
-
ginger_app_price($appname);
|
23 |
?></h3>
|
24 |
<small><?php _e("This add-on blocks cookies and ads created by Google AdSense, until user's acceptation.", "ginger"); ?></small>
|
|
|
25 |
<p>
|
26 |
-
|
27 |
-
<b style="color:#F99A30"><?php _e("Get activation code here:", "ginger"); ?> <a href="http://www.ginger-cookielaw.com/prodotto/adsense/" target="_BLANK">http://www.ginger-cookielaw.com/prodotto/adsense/</a></b>
|
28 |
</p>
|
29 |
</td>
|
30 |
</tr>
|
@@ -39,7 +42,6 @@ function ginger_adsense_activation_page()
|
|
39 |
<label>
|
40 |
<?php _e("Active add-on", "ginger");?>:
|
41 |
</label>
|
42 |
-
<?php $option_ginger_analitics = get_option('gingeradsense');?>
|
43 |
<?php if ($option_ginger_analitics && $option_ginger_analitics['activated'] == 1): ?>
|
44 |
<img id="img_google_analytics"
|
45 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
@@ -79,6 +81,7 @@ function ginger_adsense_activation_page()
|
|
79 |
|
80 |
</tbody>
|
81 |
</table>
|
|
|
82 |
<?php
|
83 |
|
84 |
}
|
1 |
<?php
|
2 |
//Adsense
|
3 |
+
$option_adsense = get_option('gingeradsense');
|
4 |
+
if($option_adsense && $option_adsense['activated'] == 1):
|
5 |
require_once('ginger.adsense.php');
|
6 |
endif;
|
7 |
|
9 |
|
10 |
function ginger_adsense_activation_page()
|
11 |
{
|
12 |
+
$appname = "adsense";
|
13 |
+
$app_data = ginger_app_data($appname);
|
14 |
+
$option_ginger_analitics = get_option('gingeradsense');
|
15 |
?>
|
16 |
+
|
17 |
+
<div class="ginger-addon">
|
18 |
<table class="form-table striped">
|
19 |
<thead>
|
20 |
<tr>
|
21 |
<td colspan="2">
|
22 |
+
<img class="ginger-thumb" src="<?php echo $app_data["thumb"]; ?>" />
|
23 |
<h3><?php _e("Google AdSense", "ginger"); ?>
|
24 |
<?php
|
25 |
+
ginger_app_price($appname, $app_data);
|
|
|
26 |
?></h3>
|
27 |
<small><?php _e("This add-on blocks cookies and ads created by Google AdSense, until user's acceptation.", "ginger"); ?></small>
|
28 |
+
<br style="clear: both" />
|
29 |
<p>
|
30 |
+
<a href="http://www.ginger-cookielaw.com/prodotto/<?php echo $appname; ?>/" target="_BLANK" class="button button-primary" <?php if($option_ginger_analitics && $option_ginger_analitics['activated'] == 1){ echo "disabled='disabled' "; } ?>><?php _e("Get Activation Code", "ginger"); ?></a>
|
|
|
31 |
</p>
|
32 |
</td>
|
33 |
</tr>
|
42 |
<label>
|
43 |
<?php _e("Active add-on", "ginger");?>:
|
44 |
</label>
|
|
|
45 |
<?php if ($option_ginger_analitics && $option_ginger_analitics['activated'] == 1): ?>
|
46 |
<img id="img_google_analytics"
|
47 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
81 |
|
82 |
</tbody>
|
83 |
</table>
|
84 |
+
</div>
|
85 |
<?php
|
86 |
|
87 |
}
|
addon/analytics/ginger.analytics.php
CHANGED
@@ -155,4 +155,5 @@ function ginger_analytics_remover($array){
|
|
155 |
unset($array[$pos]);
|
156 |
return $array;
|
157 |
endif;
|
|
|
158 |
}
|
155 |
unset($array[$pos]);
|
156 |
return $array;
|
157 |
endif;
|
158 |
+
return $array;
|
159 |
}
|
addon/analytics/gingeranalytics.js
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Created by matteobarale on 09/07/15.
|
3 |
-
*/
|
4 |
-
window.onload = function() {
|
5 |
-
if (typeof(ginger_analytics_code) !== 'undefined') {
|
6 |
-
var code = ginger_analytics_code;
|
7 |
-
}else{
|
8 |
-
var code = 'UA-XXXX-Y';
|
9 |
-
}
|
10 |
-
console.log(getCookie('ginger-cookie'));
|
11 |
-
|
12 |
-
if(getCookie('ginger-cookie') == 'Y'){
|
13 |
-
var gacode = "ga('create', '" + code + "', 'auto'); ga('send', 'pageview');";
|
14 |
-
}else{
|
15 |
-
var gacode = "ga('create', '" + code + "', 'auto'); ga('set', 'anonymizeIP', true); ga('send', 'pageview');";
|
16 |
-
}
|
17 |
-
|
18 |
-
var scriptanalytics = document.createElement('script');
|
19 |
-
scriptanalytics.type = 'text/javascript';
|
20 |
-
scriptanalytics.innerHTML = gacode;
|
21 |
-
console.log(scriptanalytics);
|
22 |
-
document.getElementsByTagName('head')[0].appendChild(scriptanalytics);
|
23 |
-
}
|
24 |
-
|
25 |
-
function getCookie(cname) {
|
26 |
-
var name = cname + "=";
|
27 |
-
var ca = document.cookie.split(';');
|
28 |
-
for(var i=0; i<ca.length; i++) {
|
29 |
-
var c = ca[i];
|
30 |
-
while (c.charAt(0)==' ') c = c.substring(1);
|
31 |
-
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
|
32 |
-
}
|
33 |
-
return "";
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addon/analytics/index.php
CHANGED
@@ -9,22 +9,26 @@ add_action("ginger_addon_activation_page", "ginger_analytics_activation_page");
|
|
9 |
|
10 |
function ginger_analytics_activation_page()
|
11 |
{
|
12 |
-
|
13 |
-
|
|
|
14 |
?>
|
15 |
-
|
|
|
|
|
16 |
<thead>
|
17 |
<tr>
|
18 |
<td colspan="2">
|
|
|
|
|
19 |
<h3><?php _e("Google Analytics", "ginger"); ?>
|
20 |
<?php
|
21 |
-
$appname
|
22 |
-
ginger_app_price($appname);
|
23 |
?></h3>
|
24 |
<small><?php _e("Google Analytics Add-on will add analytics tracking code to your site, switching automatically between anonymized/not anonymized mode based on user cookies acceptance.", "ginger"); ?></small>
|
25 |
-
|
26 |
<p>
|
27 |
-
<
|
28 |
</p>
|
29 |
</td>
|
30 |
</tr>
|
@@ -40,7 +44,6 @@ function ginger_analytics_activation_page()
|
|
40 |
<label>
|
41 |
<?php _e("Active add-on", "ginger");?>:
|
42 |
</label>
|
43 |
-
<?php $option_ginger_analitics = get_option('gingeranalytics');?>
|
44 |
<?php if ($option_ginger_analitics && $option_ginger_analitics['activated'] == 1): ?>
|
45 |
<img id="img_google_analytics"
|
46 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
@@ -80,6 +83,7 @@ function ginger_analytics_activation_page()
|
|
80 |
|
81 |
</tbody>
|
82 |
</table>
|
|
|
83 |
<?php
|
84 |
|
85 |
}
|
9 |
|
10 |
function ginger_analytics_activation_page()
|
11 |
{
|
12 |
+
$appname = "google-analytics";
|
13 |
+
$app_data = ginger_app_data($appname);
|
14 |
+
$option_ginger_analitics = get_option('gingeranalytics');
|
15 |
?>
|
16 |
+
|
17 |
+
<div class="ginger-addon">
|
18 |
+
<table class="form-table striped">
|
19 |
<thead>
|
20 |
<tr>
|
21 |
<td colspan="2">
|
22 |
+
<img class="ginger-thumb" src="<?php echo $app_data["thumb"]; ?>" />
|
23 |
+
|
24 |
<h3><?php _e("Google Analytics", "ginger"); ?>
|
25 |
<?php
|
26 |
+
ginger_app_price($appname, $app_data);
|
|
|
27 |
?></h3>
|
28 |
<small><?php _e("Google Analytics Add-on will add analytics tracking code to your site, switching automatically between anonymized/not anonymized mode based on user cookies acceptance.", "ginger"); ?></small>
|
29 |
+
<br style="clear: both" />
|
30 |
<p>
|
31 |
+
<a href="http://www.ginger-cookielaw.com/prodotto/<?php echo $appname; ?>/" target="_BLANK" class="button button-primary" <?php if($option_ginger_analitics && $option_ginger_analitics['activated'] == 1){ echo "disabled='disabled' "; } ?>><?php _e("Get Activation Code", "ginger"); ?></a>
|
32 |
</p>
|
33 |
</td>
|
34 |
</tr>
|
44 |
<label>
|
45 |
<?php _e("Active add-on", "ginger");?>:
|
46 |
</label>
|
|
|
47 |
<?php if ($option_ginger_analitics && $option_ginger_analitics['activated'] == 1): ?>
|
48 |
<img id="img_google_analytics"
|
49 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
83 |
|
84 |
</tbody>
|
85 |
</table>
|
86 |
+
</div>
|
87 |
<?php
|
88 |
|
89 |
}
|
addon/ginger.addon.utils.php
CHANGED
@@ -5,8 +5,6 @@
|
|
5 |
*
|
6 |
*/
|
7 |
|
8 |
-
|
9 |
-
|
10 |
$addons = ginger_include_addons();
|
11 |
|
12 |
function ginger_include_addons(){
|
@@ -34,8 +32,13 @@ function ginger_include_addons(){
|
|
34 |
function execute_request( $args ) {
|
35 |
$target_url = create_url( $args );
|
36 |
$data = wp_remote_get( $target_url );
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
// Create an url based on
|
@@ -63,15 +66,6 @@ if ( file_exists( $wp_root . '/wp-load.php' ) ) {
|
|
63 |
|
64 |
if ( ! current_user_can( 'manage_options' ) ) die();
|
65 |
|
66 |
-
//$base_url = 'http://www.ginger-cookielaw.com/';
|
67 |
-
//$email = 'mb@matteobarale.com';
|
68 |
-
//$product_id = 'gingeranalytics';
|
69 |
-
//$licence_key = 'gingerba76a04b-18a0-47e6-89e2-c59848047c56';
|
70 |
-
//$instance = 'ginger.dev';
|
71 |
-
//print_r($_GET);
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
$request = ( isset( $_GET['request'] ) ) ? $_GET['request'] : '';
|
77 |
$activationemail = ( isset( $_GET['activationmail'] ) ) ? $_GET['activationmail'] : '';
|
@@ -79,22 +73,8 @@ $activationcode = ( isset( $_GET['activationcode'] ) ) ? $_GET['activationcode']
|
|
79 |
$product_id = ( isset( $_GET['product_id'] ) ) ? $_GET['product_id'] : '';
|
80 |
|
81 |
|
82 |
-
$links = array(
|
83 |
-
'invalid' => 'Invalid request',
|
84 |
-
'generate_key' => 'Generate key',
|
85 |
-
'check' => 'Check request',
|
86 |
-
'activation' => 'Activation request',
|
87 |
-
'activation_reset' => 'Application reset',
|
88 |
-
'deactivation' => 'Deactivation'
|
89 |
-
);
|
90 |
-
|
91 |
-
//foreach ( $links as $key => $value ) {
|
92 |
-
// echo '<a href="' . add_query_arg( 'request', $key ) . '">' . $value . '</a> | ';
|
93 |
-
//}
|
94 |
-
//echo '<br/><br/>';
|
95 |
-
|
96 |
-
//
|
97 |
// Valid activation request
|
|
|
98 |
if ( $request == 'activation' && $activationcode != '' && $activationemail != '' && $product_id != '' ) {
|
99 |
$args = array(
|
100 |
'request' => 'activation',
|
@@ -105,8 +85,7 @@ if ( $request == 'activation' && $activationcode != '' && $activationemail != ''
|
|
105 |
);
|
106 |
|
107 |
$data = execute_request( $args );
|
108 |
-
|
109 |
-
if($data->activated == 1):
|
110 |
$args = array(
|
111 |
'activated' => 1,
|
112 |
'email' => $activationemail,
|
@@ -115,7 +94,13 @@ if ( $request == 'activation' && $activationcode != '' && $activationemail != ''
|
|
115 |
'instance' => get_bloginfo('url'),
|
116 |
);
|
117 |
$array_activate = update_option($product_id, $args);
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
// Valid check request
|
@@ -129,9 +114,6 @@ if ( $request == 'check' ) {
|
|
129 |
);
|
130 |
|
131 |
$data = execute_request( $args );
|
132 |
-
//('<pre>');
|
133 |
-
//print_r(json_decode($data['body']));
|
134 |
-
//echo('</pre>');
|
135 |
|
136 |
}
|
137 |
|
@@ -145,7 +127,7 @@ if ( $request == 'activation_reset' ) {
|
|
145 |
'secret_key' => $secret_key,
|
146 |
);
|
147 |
|
148 |
-
|
149 |
$data = execute_request( $args );
|
150 |
//echo('<pre>');
|
151 |
//print_r(json_decode($data['body']));
|
@@ -164,15 +146,53 @@ if ( $request == 'deactivation' && $activationcode != '' && $activationemail !=
|
|
164 |
'product_id' => $product_id,
|
165 |
'instance' => get_bloginfo('url'),
|
166 |
);
|
167 |
-
|
168 |
-
echo '<b>Valid deactivation request:</b><br />';
|
169 |
execute_request( $args );
|
170 |
delete_option( $product_id );
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
<div class="wrap">
|
|
|
|
|
|
|
|
|
|
|
176 |
<h2><?php _e("Ginger Available Add-ons", "ginger"); ?></h2>
|
177 |
<hr>
|
178 |
<?php do_action("ginger_addon_activation_page"); ?>
|
5 |
*
|
6 |
*/
|
7 |
|
|
|
|
|
8 |
$addons = ginger_include_addons();
|
9 |
|
10 |
function ginger_include_addons(){
|
32 |
function execute_request( $args ) {
|
33 |
$target_url = create_url( $args );
|
34 |
$data = wp_remote_get( $target_url );
|
35 |
+
if ( is_wp_error( $data ) ) {
|
36 |
+
return $data;
|
37 |
+
}else{
|
38 |
+
$data = json_decode(strip_tags(wp_remote_retrieve_body( $data )));
|
39 |
+
return $data;
|
40 |
+
}
|
41 |
+
|
42 |
}
|
43 |
|
44 |
// Create an url based on
|
66 |
|
67 |
if ( ! current_user_can( 'manage_options' ) ) die();
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
$request = ( isset( $_GET['request'] ) ) ? $_GET['request'] : '';
|
71 |
$activationemail = ( isset( $_GET['activationmail'] ) ) ? $_GET['activationmail'] : '';
|
73 |
$product_id = ( isset( $_GET['product_id'] ) ) ? $_GET['product_id'] : '';
|
74 |
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
// Valid activation request
|
77 |
+
$notice = false;
|
78 |
if ( $request == 'activation' && $activationcode != '' && $activationemail != '' && $product_id != '' ) {
|
79 |
$args = array(
|
80 |
'request' => 'activation',
|
85 |
);
|
86 |
|
87 |
$data = execute_request( $args );
|
88 |
+
if($data->activated == 1){
|
|
|
89 |
$args = array(
|
90 |
'activated' => 1,
|
91 |
'email' => $activationemail,
|
94 |
'instance' => get_bloginfo('url'),
|
95 |
);
|
96 |
$array_activate = update_option($product_id, $args);
|
97 |
+
$notice = $data->message;
|
98 |
+
}else{
|
99 |
+
$notice = $data->error;
|
100 |
+
}
|
101 |
+
}else if($request == 'activation' && ($activationcode == '' || $activationemail == '' || $product_id == '' )){
|
102 |
+
|
103 |
+
$notice = __("Fill all required fields!", "ginger");
|
104 |
}
|
105 |
|
106 |
// Valid check request
|
114 |
);
|
115 |
|
116 |
$data = execute_request( $args );
|
|
|
|
|
|
|
117 |
|
118 |
}
|
119 |
|
127 |
'secret_key' => $secret_key,
|
128 |
);
|
129 |
|
130 |
+
$notice = __("Valid activation reset request", "ginger");
|
131 |
$data = execute_request( $args );
|
132 |
//echo('<pre>');
|
133 |
//print_r(json_decode($data['body']));
|
146 |
'product_id' => $product_id,
|
147 |
'instance' => get_bloginfo('url'),
|
148 |
);
|
149 |
+
$notice = __("Valid deactivation request", "ginger");
|
|
|
150 |
execute_request( $args );
|
151 |
delete_option( $product_id );
|
152 |
}
|
153 |
|
154 |
+
if($notice){
|
155 |
+
?>
|
156 |
+
<script type="text/javascript">
|
157 |
+
location.href='admin.php?page=<?php echo $_GET["page"]; ?>¬ice=<?php echo urlencode($notice); ?>';
|
158 |
+
</script>
|
159 |
+
<?php
|
160 |
+
}
|
161 |
+
|
162 |
+
if(isset($_GET["notice"]) && $_GET["notice"])$notice=$_GET["notice"];
|
163 |
?>
|
164 |
+
<style>
|
165 |
+
.ginger-addon{
|
166 |
+
width: 44%;
|
167 |
+
min-width: 420px;
|
168 |
+
float:left;
|
169 |
+
background-color:#FCDCAB;
|
170 |
+
margin: 0px 10px 10px 0px;
|
171 |
+
min-height:300px
|
172 |
+
}
|
173 |
+
.ginger-thumb{
|
174 |
+
width: 120px;
|
175 |
+
float:left;
|
176 |
+
margin-right: 20px;
|
177 |
+
margin-bottom: 10px;
|
178 |
+
}
|
179 |
+
.ginger-addon tbody tr{
|
180 |
+
background-color:#FBD69D !important;
|
181 |
+
}
|
182 |
|
183 |
+
.ginger-addon thead tr{
|
184 |
+
background-color:#FCDCAB !important;
|
185 |
+
}
|
186 |
+
.ginger-addon h3{
|
187 |
+
margin-top:0px
|
188 |
+
}
|
189 |
+
</style>
|
190 |
<div class="wrap">
|
191 |
+
<?php
|
192 |
+
if($notice){
|
193 |
+
echo '<div class="updated"><p>'.$notice.'</p></div>';
|
194 |
+
}
|
195 |
+
?>
|
196 |
<h2><?php _e("Ginger Available Add-ons", "ginger"); ?></h2>
|
197 |
<hr>
|
198 |
<?php do_action("ginger_addon_activation_page"); ?>
|
addon/ginger.addoncheck.php
CHANGED
@@ -8,7 +8,10 @@ add_action( 'ginger_check_hook', 'ginger_check_function' );
|
|
8 |
|
9 |
function ginger_check_function() {
|
10 |
$ginger_addon = array(
|
11 |
-
'gingeranalytics'
|
|
|
|
|
|
|
12 |
);
|
13 |
foreach($ginger_addon as $addon):
|
14 |
$addon_to_check = get_option($addon);
|
@@ -19,11 +22,11 @@ function ginger_check_function() {
|
|
19 |
'email' => $addon_to_check['email'],
|
20 |
'licence_key' => $addon_to_check['licence_key'],
|
21 |
'product_id' => $addon_to_check['product_id'],
|
22 |
-
'instance' =>
|
23 |
);
|
24 |
|
25 |
$data = execute_request( $args );
|
26 |
-
if(
|
27 |
$addon_to_check['activated'] = 0; update_option('gingeranalytics', $addon_to_check);
|
28 |
endif;
|
29 |
endif;
|
8 |
|
9 |
function ginger_check_function() {
|
10 |
$ginger_addon = array(
|
11 |
+
'gingeranalytics',
|
12 |
+
'gingeradsense',
|
13 |
+
'gingercustomurl',
|
14 |
+
'gingerwpml'
|
15 |
);
|
16 |
foreach($ginger_addon as $addon):
|
17 |
$addon_to_check = get_option($addon);
|
22 |
'email' => $addon_to_check['email'],
|
23 |
'licence_key' => $addon_to_check['licence_key'],
|
24 |
'product_id' => $addon_to_check['product_id'],
|
25 |
+
'instance' => $addon_to_check['instance']
|
26 |
);
|
27 |
|
28 |
$data = execute_request( $args );
|
29 |
+
if(!$data->success && !is_wp_error($data)):
|
30 |
$addon_to_check['activated'] = 0; update_option('gingeranalytics', $addon_to_check);
|
31 |
endif;
|
32 |
endif;
|
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,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//jscustom
|
3 |
+
$option_jscustom = get_option('gingercustomurl');
|
4 |
+
if($option_jscustom && $option_jscustom['activated'] == 1):
|
5 |
+
require_once('ginger.jscustom.php');
|
6 |
+
endif;
|
7 |
+
|
8 |
+
add_action("ginger_addon_activation_page", "ginger_jscustom_activation_page");
|
9 |
+
|
10 |
+
function ginger_jscustom_activation_page()
|
11 |
+
{
|
12 |
+
$appname = "jscustom";
|
13 |
+
$app_data = ginger_app_data($appname);
|
14 |
+
$option_ginger_jscustom = get_option('gingercustomurl');
|
15 |
+
?>
|
16 |
+
<div class="ginger-addon">
|
17 |
+
<table class="form-table striped">
|
18 |
+
<thead>
|
19 |
+
<tr>
|
20 |
+
<td colspan="2">
|
21 |
+
<img class="ginger-thumb" src="<?php echo $app_data["thumb"]; ?>" />
|
22 |
+
|
23 |
+
<h3><?php _e("Custom Javascript / Iframe Configurator", "ginger"); ?>
|
24 |
+
<?php
|
25 |
+
ginger_app_price($appname, $app_data);
|
26 |
+
?></h3>
|
27 |
+
<small><?php _e("This add-on let you add custom js and iframe url to extend Ginger power.", "ginger"); ?></small>
|
28 |
+
<br style="clear: both" />
|
29 |
+
<p>
|
30 |
+
<a href="http://www.ginger-cookielaw.com/prodotto/<?php echo $appname; ?>/" target="_BLANK" class="button button-primary" <?php if($option_ginger_jscustom && $option_ginger_jscustom['activated'] == 1){ echo "disabled='disabled' "; } ?>><?php _e("Get Activation Code", "ginger"); ?></a>
|
31 |
+
</p>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
</thead>
|
35 |
+
<tbody>
|
36 |
+
<tr>
|
37 |
+
|
38 |
+
<td>
|
39 |
+
<fieldset>
|
40 |
+
<legend class="screen-reader-text"><span><?php _e("Custom Javascript Configurator", "ginger"); ?></span></legend>
|
41 |
+
<p>
|
42 |
+
<label>
|
43 |
+
<?php _e("Active add-on", "ginger");?>:
|
44 |
+
</label>
|
45 |
+
|
46 |
+
<?php if ($option_ginger_jscustom && $option_ginger_jscustom['activated'] == 1): ?>
|
47 |
+
<img id="img_google_jscustom"
|
48 |
+
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
49 |
+
style="max-width: 20px; max-height: 20px; vertical-align: middle">
|
50 |
+
|
51 |
+
<form method="get" action="<?php echo admin_url('admin.php?page=ginger-add-on'); ?>">
|
52 |
+
<input type="hidden" name="page" value="ginger-add-on">
|
53 |
+
<input id="activationcode" type="text" name="activationcode"
|
54 |
+
value="<?php echo $option_ginger_jscustom['licence_key']; ?>" placeholder=""
|
55 |
+
size="30px">
|
56 |
+
<input id="activationmail" type="text" name="activationmail"
|
57 |
+
value="<?php echo $option_ginger_jscustom['email']; ?>" placeholder="" size="30px">
|
58 |
+
<input type="hidden" name="product_id" value="gingercustomurl">
|
59 |
+
<input type="hidden" name="request" value="deactivation">
|
60 |
+
<input type="submit" class="button" value="<?php _e('Deactivate', 'ginger') ?>">
|
61 |
+
</form>
|
62 |
+
<?php else: ?>
|
63 |
+
<img id="img_google_jscustom"
|
64 |
+
src="<?php echo plugins_url('/ginger/img/xx.png'); ?>"
|
65 |
+
style="max-width: 20px; max-height: 20px; vertical-align: middle">
|
66 |
+
<form method="get" action="<?php echo admin_url('admin.php?page=ginger-add-on'); ?>">
|
67 |
+
<input type="hidden" name="page" value="ginger-add-on">
|
68 |
+
<input id="activationcode" type="text" name="activationcode" value=""
|
69 |
+
placeholder="<?php _e('Insert here the add-on activation code.', 'ginger') ?>"
|
70 |
+
size="30px">
|
71 |
+
<input id="activationmail" type="text" name="activationmail" value=""
|
72 |
+
placeholder="<?php _e('Insert here your activation mail.', 'ginger') ?>" size="30px">
|
73 |
+
<input type="hidden" name="product_id" value="gingercustomurl">
|
74 |
+
<input type="hidden" name="request" value="activation">
|
75 |
+
<input type="submit" class="button" value="<?php _e('Activate', 'ginger') ?>">
|
76 |
+
</form>
|
77 |
+
<?php endif; ?>
|
78 |
+
</p>
|
79 |
+
</fieldset>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
|
83 |
+
</tbody>
|
84 |
+
</table>
|
85 |
+
</div>
|
86 |
+
<?php
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
|
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="../wp-content/plugins/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/wpml/ginger.wpml.php
CHANGED
@@ -177,23 +177,23 @@ function ginger_wpml_menu_page(){
|
|
177 |
<p>
|
178 |
<label><?php _e("Text", "ginger"); ?></label>
|
179 |
<input name="disable_cookie_button_text[<?php echo $langcode; ?>]" id="disable_cookie_button_text_<?php echo $langcode; ?>" type="text"
|
180 |
-
value="<?php if ($options['disable_cookie_button_text'][$langcode] != "") {
|
181 |
echo $options['disable_cookie_button_text'][$langcode];
|
182 |
} else {
|
183 |
echo _e('Disable Cookie', 'ginger');
|
184 |
-
} ?>" <?php if ($options['disable_cookie_button_status'][$langcode]
|
185 |
echo 'disabled=true';
|
186 |
} ?>>
|
187 |
<?php echo _e('Enable:', 'ginger') ?>
|
188 |
<input type="checkbox" id="disable_cookie_button_status_<?php echo $langcode; ?>" name="disable_cookie_button_status[<?php echo $langcode; ?>]"
|
189 |
-
value="1" <?php if ($options['disable_cookie_button_status'][$langcode] == "1") {
|
190 |
echo 'checked';
|
191 |
} ?>
|
192 |
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; ?>');">
|
193 |
|
194 |
|
195 |
<img id="img_disable_cookie_button_status_<?php echo $langcode; ?>"
|
196 |
-
src="<?php if ($options['disable_cookie_button_status'][$langcode] == "1") {
|
197 |
echo plugins_url("ginger/img/ok.png");
|
198 |
} else {
|
199 |
echo plugins_url("ginger/img/xx.png");
|
@@ -227,4 +227,97 @@ function ginger_wpml_menu_page(){
|
|
227 |
|
228 |
<?php
|
229 |
|
230 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
<p>
|
178 |
<label><?php _e("Text", "ginger"); ?></label>
|
179 |
<input name="disable_cookie_button_text[<?php echo $langcode; ?>]" id="disable_cookie_button_text_<?php echo $langcode; ?>" type="text"
|
180 |
+
value="<?php if (isset($options['disable_cookie_button_text'][$langcode]) && $options['disable_cookie_button_text'][$langcode] != "") {
|
181 |
echo $options['disable_cookie_button_text'][$langcode];
|
182 |
} else {
|
183 |
echo _e('Disable Cookie', 'ginger');
|
184 |
+
} ?>" <?php if (!(isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1")) {
|
185 |
echo 'disabled=true';
|
186 |
} ?>>
|
187 |
<?php echo _e('Enable:', 'ginger') ?>
|
188 |
<input type="checkbox" id="disable_cookie_button_status_<?php echo $langcode; ?>" name="disable_cookie_button_status[<?php echo $langcode; ?>]"
|
189 |
+
value="1" <?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
|
190 |
echo 'checked';
|
191 |
} ?>
|
192 |
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; ?>');">
|
193 |
|
194 |
|
195 |
<img id="img_disable_cookie_button_status_<?php echo $langcode; ?>"
|
196 |
+
src="<?php if (isset($options['disable_cookie_button_status'][$langcode]) && $options['disable_cookie_button_status'][$langcode] == "1") {
|
197 |
echo plugins_url("ginger/img/ok.png");
|
198 |
} else {
|
199 |
echo plugins_url("ginger/img/xx.png");
|
227 |
|
228 |
<?php
|
229 |
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
+
add_filter("ginger_text_iframe", "ginger_wpml_text_iframe");
|
234 |
+
function ginger_wpml_text_iframe($text){
|
235 |
+
$key = "ginger_wpml_options";
|
236 |
+
$options = get_option($key);
|
237 |
+
if($options == "") return $text;
|
238 |
+
if (!function_exists('icl_get_languages')) return $text;
|
239 |
+
|
240 |
+
global $sitepress;
|
241 |
+
$current_lang = $sitepress->get_current_language(); //save current language
|
242 |
+
|
243 |
+
if(trim(strip_tags($options['ginger_Iframe_text'][$current_lang]))):
|
244 |
+
$ginger_iframe_text = $options['ginger_Iframe_text'][$current_lang];
|
245 |
+
$ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
|
246 |
+
$ginger_iframe_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_iframe_text );
|
247 |
+
return $ginger_iframe_text;
|
248 |
+
endif;
|
249 |
+
|
250 |
+
return $text;
|
251 |
+
}
|
252 |
+
|
253 |
+
|
254 |
+
add_filter("ginger_text_banner", "ginger_wpml_text_banner");
|
255 |
+
function ginger_wpml_text_banner($text)
|
256 |
+
{
|
257 |
+
$key = "ginger_wpml_options";
|
258 |
+
$options = get_option($key);
|
259 |
+
if ($options == "") return $text;
|
260 |
+
if (!function_exists('icl_get_languages')) return $text;
|
261 |
+
|
262 |
+
global $sitepress;
|
263 |
+
$current_lang = $sitepress->get_current_language(); //save current language
|
264 |
+
|
265 |
+
if (trim(strip_tags($options['ginger_banner_text'][$current_lang])) != ""):
|
266 |
+
$ginger_text = $options['ginger_banner_text'][$current_lang];
|
267 |
+
$ginger_text = str_replace('</', '<\/', $ginger_text);
|
268 |
+
$ginger_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_text);
|
269 |
+
|
270 |
+
//Recupero privacy policy se presente
|
271 |
+
if (strpos($ginger_text, '{{privacy_page}}') !== false):
|
272 |
+
$privacy_policy = $options['ginger_privacy_page'][$current_lang];
|
273 |
+
if ($privacy_policy) {
|
274 |
+
|
275 |
+
$privacy_policy = get_post($privacy_policy);
|
276 |
+
$privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . addslashes($privacy_policy->post_title) . '<\/a>';
|
277 |
+
$ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
|
278 |
+
}
|
279 |
+
endif;
|
280 |
+
return $ginger_text;
|
281 |
+
endif;
|
282 |
+
|
283 |
+
return $text;
|
284 |
+
}
|
285 |
+
|
286 |
+
add_filter("ginger_label_accept_cookie", "ginger_wpml_label_accept_cookie");
|
287 |
+
function ginger_wpml_label_accept_cookie($text){
|
288 |
+
$key = "ginger_wpml_options";
|
289 |
+
$options = get_option($key);
|
290 |
+
if($options == "") return $text;
|
291 |
+
if (!function_exists('icl_get_languages')) return $text;
|
292 |
+
|
293 |
+
global $sitepress;
|
294 |
+
$current_lang = $sitepress->get_current_language();
|
295 |
+
|
296 |
+
if(trim($options['accept_cookie_button_text'][$current_lang])):
|
297 |
+
$label_accept_cookie = $options['accept_cookie_button_text'][$current_lang];
|
298 |
+
return $label_accept_cookie;
|
299 |
+
endif;
|
300 |
+
|
301 |
+
return $text;
|
302 |
+
}
|
303 |
+
|
304 |
+
add_filter("ginger_label_disable_cookie", "ginger_wpml_label_disable_cookie");
|
305 |
+
function ginger_wpml_label_disable_cookie($text){
|
306 |
+
$key = "ginger_wpml_options";
|
307 |
+
$options = get_option($key);
|
308 |
+
if($options == "") return $text;
|
309 |
+
if (!function_exists('icl_get_languages')) return $text;
|
310 |
+
|
311 |
+
global $sitepress;
|
312 |
+
$current_lang = $sitepress->get_current_language(); //save current language
|
313 |
+
if($options['disable_cookie_button_status'][$current_lang]):
|
314 |
+
if(trim($options['disable_cookie_button_text'][$current_lang])):
|
315 |
+
$label_disable_cookie = $options['disable_cookie_button_text'][$current_lang];
|
316 |
+
return $label_disable_cookie;
|
317 |
+
endif;
|
318 |
+
endif;
|
319 |
+
|
320 |
+
return $text;
|
321 |
+
}
|
322 |
+
|
323 |
+
|
addon/wpml/index.php
CHANGED
@@ -5,118 +5,29 @@ if($option_wpml && $option_wpml['activated'] == 1):
|
|
5 |
require_once('ginger.wpml.php');
|
6 |
endif;
|
7 |
|
8 |
-
add_filter("ginger_text_iframe", "ginger_wpml_text_iframe");
|
9 |
-
function ginger_wpml_text_iframe($text){
|
10 |
-
$key = "ginger_wpml_options";
|
11 |
-
$options = get_option($key);
|
12 |
-
if($options == "") return $text;
|
13 |
-
if (!function_exists('icl_get_languages')) return $text;
|
14 |
-
|
15 |
-
global $sitepress;
|
16 |
-
$current_lang = $sitepress->get_current_language(); //save current language
|
17 |
-
|
18 |
-
if(trim(strip_tags($options['ginger_Iframe_text'][$current_lang]))):
|
19 |
-
$ginger_iframe_text = $options['ginger_Iframe_text'][$current_lang];
|
20 |
-
$ginger_iframe_text = str_replace('</', '<\/', $ginger_iframe_text);
|
21 |
-
$ginger_iframe_text = str_replace( array("\n", "\r"), "<br \/>", $ginger_iframe_text );
|
22 |
-
return $ginger_iframe_text;
|
23 |
-
endif;
|
24 |
-
|
25 |
-
return $text;
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
add_filter("ginger_text_banner", "ginger_wpml_text_banner");
|
30 |
-
function ginger_wpml_text_banner($text)
|
31 |
-
{
|
32 |
-
$key = "ginger_wpml_options";
|
33 |
-
$options = get_option($key);
|
34 |
-
if ($options == "") return $text;
|
35 |
-
if (!function_exists('icl_get_languages')) return $text;
|
36 |
-
|
37 |
-
global $sitepress;
|
38 |
-
$current_lang = $sitepress->get_current_language(); //save current language
|
39 |
-
|
40 |
-
if (trim(strip_tags($options['ginger_banner_text'][$current_lang])) != ""):
|
41 |
-
$ginger_text = $options['ginger_banner_text'][$current_lang];
|
42 |
-
$ginger_text = str_replace('</', '<\/', $ginger_text);
|
43 |
-
$ginger_text = str_replace(array("\n", "\r"), "<br \/>", $ginger_text);
|
44 |
-
|
45 |
-
//Recupero privacy policy se presente
|
46 |
-
if (strpos($ginger_text, '{{privacy_page}}') !== false):
|
47 |
-
$privacy_policy = $options['ginger_privacy_page'][$current_lang];
|
48 |
-
if ($privacy_policy) {
|
49 |
-
|
50 |
-
$privacy_policy = get_post($privacy_policy);
|
51 |
-
$privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . $privacy_policy->post_title . '<\/a>';
|
52 |
-
$ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
|
53 |
-
}
|
54 |
-
endif;
|
55 |
-
return $ginger_text;
|
56 |
-
endif;
|
57 |
-
|
58 |
-
return $text;
|
59 |
-
}
|
60 |
-
|
61 |
-
add_filter("ginger_label_accept_cookie", "ginger_wpml_label_accept_cookie");
|
62 |
-
function ginger_wpml_label_accept_cookie($text){
|
63 |
-
$key = "ginger_wpml_options";
|
64 |
-
$options = get_option($key);
|
65 |
-
if($options == "") return $text;
|
66 |
-
if (!function_exists('icl_get_languages')) return $text;
|
67 |
-
|
68 |
-
global $sitepress;
|
69 |
-
$current_lang = $sitepress->get_current_language();
|
70 |
-
|
71 |
-
if(trim($options['accept_cookie_button_text'][$current_lang])):
|
72 |
-
$label_accept_cookie = $options['accept_cookie_button_text'][$current_lang];
|
73 |
-
return $label_accept_cookie;
|
74 |
-
endif;
|
75 |
-
|
76 |
-
return $text;
|
77 |
-
}
|
78 |
-
|
79 |
-
add_filter("ginger_label_disable_cookie", "ginger_wpml_label_disable_cookie");
|
80 |
-
function ginger_wpml_label_disable_cookie($text){
|
81 |
-
$key = "ginger_wpml_options";
|
82 |
-
$options = get_option($key);
|
83 |
-
if($options == "") return $text;
|
84 |
-
if (!function_exists('icl_get_languages')) return $text;
|
85 |
-
|
86 |
-
global $sitepress;
|
87 |
-
$current_lang = $sitepress->get_current_language(); //save current language
|
88 |
-
if($options['disable_cookie_button_status'][$current_lang]):
|
89 |
-
if(trim($options['disable_cookie_button_text'][$current_lang])):
|
90 |
-
$label_disable_cookie = $options['disable_cookie_button_text'][$current_lang];
|
91 |
-
return $label_disable_cookie;
|
92 |
-
endif;
|
93 |
-
endif;
|
94 |
-
|
95 |
-
return $text;
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
add_action("ginger_addon_activation_page", "ginger_wpml_activation_page");
|
104 |
|
105 |
function ginger_wpml_activation_page()
|
106 |
{
|
|
|
|
|
|
|
107 |
?>
|
|
|
108 |
<table class="form-table striped">
|
109 |
<thead>
|
110 |
<tr>
|
111 |
<td colspan="2">
|
|
|
|
|
112 |
<h3><?php _e("WPML", "ginger"); ?>
|
113 |
<?php
|
114 |
-
$appname
|
115 |
-
ginger_app_price($appname);
|
116 |
?></h3>
|
117 |
<small><?php _e("WPML add-on will adapt Ginger for WPML multilanguage websites .", "ginger"); ?></small>
|
|
|
118 |
<p>
|
119 |
-
<
|
120 |
</p>
|
121 |
|
122 |
</td>
|
@@ -132,7 +43,7 @@ function ginger_wpml_activation_page()
|
|
132 |
<label>
|
133 |
<?php _e("Active add-on", "ginger");?>:
|
134 |
</label>
|
135 |
-
|
136 |
<?php if ($option_ginger_wpml && $option_ginger_wpml['activated'] == 1): ?>
|
137 |
<img id="img_google_wpml"
|
138 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
@@ -172,6 +83,8 @@ function ginger_wpml_activation_page()
|
|
172 |
|
173 |
</tbody>
|
174 |
</table>
|
|
|
|
|
175 |
<?php
|
176 |
|
177 |
}
|
5 |
require_once('ginger.wpml.php');
|
6 |
endif;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
add_action("ginger_addon_activation_page", "ginger_wpml_activation_page");
|
9 |
|
10 |
function ginger_wpml_activation_page()
|
11 |
{
|
12 |
+
$appname = "wpml";
|
13 |
+
$app_data = ginger_app_data($appname);
|
14 |
+
$option_ginger_wpml = get_option('gingerwpml');
|
15 |
?>
|
16 |
+
<div class="ginger-addon">
|
17 |
<table class="form-table striped">
|
18 |
<thead>
|
19 |
<tr>
|
20 |
<td colspan="2">
|
21 |
+
<img class="ginger-thumb" src="<?php echo $app_data["thumb"]; ?>" />
|
22 |
+
|
23 |
<h3><?php _e("WPML", "ginger"); ?>
|
24 |
<?php
|
25 |
+
ginger_app_price($appname, $app_data);
|
|
|
26 |
?></h3>
|
27 |
<small><?php _e("WPML add-on will adapt Ginger for WPML multilanguage websites .", "ginger"); ?></small>
|
28 |
+
<br style="clear: both" />
|
29 |
<p>
|
30 |
+
<a href="http://www.ginger-cookielaw.com/prodotto/<?php echo $appname; ?>/" target="_BLANK" class="button button-primary" <?php if ($option_ginger_wpml && $option_ginger_wpml['activated'] == 1){ echo "disabled='disabled' "; } ?>><?php _e("Get Activation Code", "ginger"); ?></a>
|
31 |
</p>
|
32 |
|
33 |
</td>
|
43 |
<label>
|
44 |
<?php _e("Active add-on", "ginger");?>:
|
45 |
</label>
|
46 |
+
|
47 |
<?php if ($option_ginger_wpml && $option_ginger_wpml['activated'] == 1): ?>
|
48 |
<img id="img_google_wpml"
|
49 |
src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
|
83 |
|
84 |
</tbody>
|
85 |
</table>
|
86 |
+
|
87 |
+
</div>
|
88 |
<?php
|
89 |
|
90 |
}
|
admin/ginger.admin.php
CHANGED
@@ -71,9 +71,9 @@ $options = get_option($key);
|
|
71 |
<h2>Ginger - EU Cookie Law</h2>
|
72 |
<hr>
|
73 |
<h2 class="nav-tab-wrapper">
|
74 |
-
<a href="admin.php?page=ginger-setup" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && (($_GET["tab"] == "" ) || $_GET["tab"] == "general")) ? 'nav-tab-active' : ''; ?>"><?php _e("General Configuration", "ginger"); ?></a>
|
75 |
-
<a href="admin.php?page=ginger-setup&tab=banner" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ($_GET["tab"] == "banner" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Banner Setup", "ginger"); ?></a>
|
76 |
-
<a href="admin.php?page=ginger-setup&tab=policy" class="nav-tab <?php echo (($_GET["page"] == 'ginger-setup') && ($_GET["tab"] == "policy" )) ? 'nav-tab-active' : ''; ?>"><?php _e("Privacy Policy", "ginger"); ?></a>
|
77 |
<?php do_action("ginger_add_tab_menu"); ?>
|
78 |
</h2>
|
79 |
<form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?><?php if(isset($tab)) echo '&tab=' . $tab; ?>" <?php if (isset($tab) && $tab == 'url') echo 'class="repeater"';?>>
|
71 |
<h2>Ginger - EU Cookie Law</h2>
|
72 |
<hr>
|
73 |
<h2 class="nav-tab-wrapper">
|
74 |
+
<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>
|
75 |
+
<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>
|
76 |
+
<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>
|
77 |
<?php do_action("ginger_add_tab_menu"); ?>
|
78 |
</h2>
|
79 |
<form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?><?php if(isset($tab)) echo '&tab=' . $tab; ?>" <?php if (isset($tab) && $tab == 'url') echo 'class="repeater"';?>>
|
admin/ginger.utils.php
CHANGED
@@ -11,9 +11,7 @@
|
|
11 |
add_action( 'admin_menu', 'register_ginger_menu_page' );
|
12 |
function register_ginger_menu_page(){
|
13 |
add_menu_page( 'ginger', 'Ginger Cookie', 'manage_options', 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
|
14 |
-
|
15 |
do_action("ginger_add_menu");
|
16 |
-
//add_submenu_page( 'ginger-setup', "About", __("About EU Law", "ginger"), 'manage_options', 'ginger-about', 'ginger_about_menu_page');
|
17 |
}
|
18 |
|
19 |
function ginger_menu_page(){
|
@@ -46,21 +44,11 @@ function save_privacy_page($title,$content){
|
|
46 |
);
|
47 |
|
48 |
|
49 |
-
|
50 |
$id = wp_insert_post( $my_post );
|
51 |
return($id);
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
function is_ginger_multilang_active(){
|
56 |
-
$ginger_active="true";
|
57 |
-
if(is_plugin_active('sitepress-multilingual-cms/sitepress.php') and ($ginger_active)) {
|
58 |
-
$active=true;
|
59 |
-
}else{
|
60 |
-
$active=false;
|
61 |
-
}
|
62 |
-
return $active;
|
63 |
-
}
|
64 |
//Attivazione plugin abilito le impostazioni di base se non inserite.
|
65 |
function ginger_plugin_activate() {
|
66 |
$options = get_option('ginger_general');
|
@@ -68,8 +56,6 @@ function ginger_plugin_activate() {
|
|
68 |
$options = array('enable_ginger' => '0', 'ginger_cache' => 'yes', 'ginger_opt' => 'in', 'ginger_scroll' => '1', 'ginger_click_out' => '0' , 'ginger_force_reload' => '0' , 'ginger_keep_banner' => '0' );
|
69 |
update_option('ginger_general', $options);
|
70 |
|
71 |
-
// $options = array('ginger_banner_type' => 'bar', 'ginger_banner_position' => 'top', 'ginger_banner_text' => __("This website uses cookies. By continuing to use the site you are agreeing to its use of cookies.", "ginger"),'ginger_Iframe_text' =>__("This content has been disabled because you have not accepted cookies.", "ginger"), 'accept_cookie_button_text' => 'Accept', 'disable_cookie_button_text'=> 'Disable', 'disable_cookie_button_status' => '0','disable_cookie_button_checkbox' => '1', 'read_more_button_text' => 'Read More', 'read_more_button_status' => '1','theme_ginger' => 'light', 'background_color' =>'', 'text_color' =>'', 'button_color' =>'', 'link_color' =>'');
|
72 |
-
|
73 |
$options = array (
|
74 |
'ginger_banner_type' => 'bar',
|
75 |
'ginger_banner_position' => 'top',
|
@@ -88,23 +74,30 @@ function ginger_plugin_activate() {
|
|
88 |
}
|
89 |
}
|
90 |
|
91 |
-
function ginger_app_price($appname){
|
92 |
-
|
93 |
-
|
94 |
-
$
|
95 |
-
if($
|
96 |
-
$array = json_decode($response["body"], true);
|
97 |
-
$price = $array[$appname]["price"];
|
98 |
-
if($price == "0"){
|
99 |
echo '<small style="color: green">(';
|
100 |
_e("Free", "ginger");
|
101 |
echo ')</small>';
|
102 |
-
|
103 |
echo '<small style="color: green">(';
|
104 |
_e("price: ", "ginger");
|
105 |
echo $price;
|
106 |
echo '€)</small>';
|
107 |
-
|
|
|
|
|
|
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
}
|
11 |
add_action( 'admin_menu', 'register_ginger_menu_page' );
|
12 |
function register_ginger_menu_page(){
|
13 |
add_menu_page( 'ginger', 'Ginger Cookie', 'manage_options', 'ginger-setup', 'ginger_menu_page', plugins_url( 'ginger/img/ginger-color.png' ));
|
|
|
14 |
do_action("ginger_add_menu");
|
|
|
15 |
}
|
16 |
|
17 |
function ginger_menu_page(){
|
44 |
);
|
45 |
|
46 |
|
|
|
47 |
$id = wp_insert_post( $my_post );
|
48 |
return($id);
|
49 |
}
|
50 |
|
51 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
//Attivazione plugin abilito le impostazioni di base se non inserite.
|
53 |
function ginger_plugin_activate() {
|
54 |
$options = get_option('ginger_general');
|
56 |
$options = array('enable_ginger' => '0', 'ginger_cache' => 'yes', 'ginger_opt' => 'in', 'ginger_scroll' => '1', 'ginger_click_out' => '0' , 'ginger_force_reload' => '0' , 'ginger_keep_banner' => '0' );
|
57 |
update_option('ginger_general', $options);
|
58 |
|
|
|
|
|
59 |
$options = array (
|
60 |
'ginger_banner_type' => 'bar',
|
61 |
'ginger_banner_position' => 'top',
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
function ginger_app_price($appname, $appdata = false){
|
78 |
+
if(!$appdata)
|
79 |
+
$appdata = ginger_app_data($appname);
|
80 |
+
$price = $appdata["price"];
|
81 |
+
if($price == "0"){
|
|
|
|
|
|
|
82 |
echo '<small style="color: green">(';
|
83 |
_e("Free", "ginger");
|
84 |
echo ')</small>';
|
85 |
+
}else{
|
86 |
echo '<small style="color: green">(';
|
87 |
_e("price: ", "ginger");
|
88 |
echo $price;
|
89 |
echo '€)</small>';
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
|
95 |
+
function ginger_app_data($appname){
|
96 |
+
|
97 |
+
$url = "http://www.ginger-cookielaw.com/api/?pname=".$appname;
|
98 |
+
$response = wp_remote_get($url);
|
99 |
+
if($response) {
|
100 |
+
$array = json_decode($response["body"], true);
|
101 |
+
return $array[$appname];
|
102 |
}
|
103 |
}
|
admin/partial/url.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
?>
|
4 |
-
<table class="form-table striped">
|
5 |
-
<thead>
|
6 |
-
<tr>
|
7 |
-
<td colspan="2">
|
8 |
-
<h2><?php _e("Link", "ginger"); ?></h2>
|
9 |
-
</td>
|
10 |
-
</tr>
|
11 |
-
<tr>
|
12 |
-
<td>
|
13 |
-
<div data-repeater-list="group-a">
|
14 |
-
<?php
|
15 |
-
|
16 |
-
if ($options['group-a']) {
|
17 |
-
foreach ($options['group-a'] as $option) {
|
18 |
-
?>
|
19 |
-
<div data-repeater-item>
|
20 |
-
|
21 |
-
URL: <input type="text" name="ginger_url" value="<?php echo $option['ginger_url'];?>"/>
|
22 |
-
|
23 |
-
Enable: SI <input type="radio" name="ginger_url_enable" value="1" <?php if ($option['ginger_url_enable']==1){ echo 'checked';}?>/>
|
24 |
-
NO <input type="radio" name="ginger_url_enable" value="0" <?php if ($option['ginger_url_enable']==0){ echo 'checked';}?>/>
|
25 |
-
|
26 |
-
|
27 |
-
<input data-repeater-delete type="button" value="Delete" class="button button-primary"/>
|
28 |
-
</div>
|
29 |
-
<?php
|
30 |
-
}
|
31 |
-
}else{
|
32 |
-
?>
|
33 |
-
<div data-repeater-item>
|
34 |
-
|
35 |
-
<?php _e("URL", "ginger"); ?>: <input type="text" name="ginger_url" value=""/>
|
36 |
-
|
37 |
-
<?php _e("Enable", "ginger"); ?>: <?php _e("YES", "ginger"); ?> <input type="radio" name="ginger_url_enable" value="1" />
|
38 |
-
<?php _e("NO", "ginger"); ?> <input type="radio" name="ginger_url_enable" value="0" />
|
39 |
-
|
40 |
-
|
41 |
-
<input data-repeater-delete type="button" value="Delete" class="button button-primary"/>
|
42 |
-
</div>
|
43 |
-
<?php
|
44 |
-
|
45 |
-
}
|
46 |
-
?>
|
47 |
-
|
48 |
-
|
49 |
-
</div>
|
50 |
-
<p style="margin-top: 20px"><input data-repeater-create type="button" class="button button-primary" value="Add Url"/></p>
|
51 |
-
|
52 |
-
</td>
|
53 |
-
|
54 |
-
</tr>
|
55 |
-
</thead>
|
56 |
-
</table>
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<script src="../wp-content/plugins/ginger/admin/js/jquery.repeater-master/jquery.repeater.js"></script>
|
63 |
-
<script>
|
64 |
-
jQuery(document).ready(function () {
|
65 |
-
'use strict';
|
66 |
-
jQuery('.repeater').repeater({
|
67 |
-
defaultValues: {
|
68 |
-
//'textarea-input': 'foo',
|
69 |
-
'ginger_url': '',
|
70 |
-
//'select-input': 'B',
|
71 |
-
//'checkbox-input': ['A', 'B'],
|
72 |
-
'ginger_url_enable': '1'
|
73 |
-
},
|
74 |
-
show: function () {
|
75 |
-
jQuery(this).slideDown();
|
76 |
-
},
|
77 |
-
hide: function (deleteElement) {
|
78 |
-
if(confirm('Are you sure you want to delete this element?')) {
|
79 |
-
jQuery(this).slideUp(deleteElement);
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
});
|
85 |
-
});
|
86 |
-
</script>
|
87 |
-
<?php
|
88 |
-
|
89 |
-
|
90 |
-
?>
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
<?php
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
front/gingerfront.core.php
CHANGED
@@ -31,7 +31,7 @@ function ginger_get_text_banner($option_ginger_bar){
|
|
31 |
if(strpos($ginger_text, '{{privacy_page}}') !== false):
|
32 |
$privacy_policy = get_option('ginger_policy', true);
|
33 |
$privacy_policy = get_post($privacy_policy);
|
34 |
-
$privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . $privacy_policy->post_title . '<\/a>';
|
35 |
$ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
|
36 |
endif;
|
37 |
|
@@ -60,7 +60,7 @@ function ginger_get_label_accept_cookie($option_ginger_bar){
|
|
60 |
function ginger_get_label_disable_cookie($option_ginger_bar){
|
61 |
|
62 |
//Recupero Label
|
63 |
-
if($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');
|
@@ -76,11 +76,11 @@ endif;
|
|
76 |
function ginger_run(){
|
77 |
if(is_feed()) return;
|
78 |
$option_ginger_general = get_option('ginger_general');
|
79 |
-
if($option_ginger_general['enable_ginger']
|
80 |
if(isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'Y'):
|
81 |
-
if($option_ginger_general['ginger_cache'] == 'no') return;
|
82 |
endif;
|
83 |
-
if($option_ginger_general['ginger_opt'] == 'in'):
|
84 |
|
85 |
ob_start();
|
86 |
add_action('shutdown', '__shutdown', 0);
|
@@ -126,7 +126,7 @@ function ginger_parse_dom($output){
|
|
126 |
'disqus.com',
|
127 |
);
|
128 |
$ginger_script_tags = apply_filters('ginger_script_tags', $ginger_script_tags);
|
129 |
-
|
130 |
'addthis.com'
|
131 |
);
|
132 |
$ginger_script_async_tags = apply_filters('ginger_script_async_tags', $ginger_script_async_tags);
|
@@ -140,6 +140,8 @@ function ginger_parse_dom($output){
|
|
140 |
'disqus.com'
|
141 |
);
|
142 |
$ginger_iframe_tags = apply_filters('ginger_add_iframe', $ginger_iframe_tags);
|
|
|
|
|
143 |
if(strpos($output, '<html') === false):
|
144 |
return $output;
|
145 |
elseif(strpos($output, '<html') > 200 ):
|
31 |
if(strpos($ginger_text, '{{privacy_page}}') !== false):
|
32 |
$privacy_policy = get_option('ginger_policy', true);
|
33 |
$privacy_policy = get_post($privacy_policy);
|
34 |
+
$privacy_policy = ' <a href="' . get_permalink($privacy_policy->ID) . '">' . addslashes($privacy_policy->post_title) . '<\/a>';
|
35 |
$ginger_text = str_replace('{{privacy_page}}', $privacy_policy, $ginger_text);
|
36 |
endif;
|
37 |
|
60 |
function ginger_get_label_disable_cookie($option_ginger_bar){
|
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');
|
76 |
function ginger_run(){
|
77 |
if(is_feed()) return;
|
78 |
$option_ginger_general = get_option('ginger_general');
|
79 |
+
if(!(isset($option_ginger_general['enable_ginger']) && $option_ginger_general['enable_ginger'] == 1)) return;
|
80 |
if(isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'Y'):
|
81 |
+
if(isset($option_ginger_general['ginger_cache']) && $option_ginger_general['ginger_cache'] == 'no') return;
|
82 |
endif;
|
83 |
+
if(isset($option_ginger_general['ginger_opt']) && $option_ginger_general['ginger_opt'] == 'in'):
|
84 |
|
85 |
ob_start();
|
86 |
add_action('shutdown', '__shutdown', 0);
|
126 |
'disqus.com',
|
127 |
);
|
128 |
$ginger_script_tags = apply_filters('ginger_script_tags', $ginger_script_tags);
|
129 |
+
$ginger_script_async_tags = array(
|
130 |
'addthis.com'
|
131 |
);
|
132 |
$ginger_script_async_tags = apply_filters('ginger_script_async_tags', $ginger_script_async_tags);
|
140 |
'disqus.com'
|
141 |
);
|
142 |
$ginger_iframe_tags = apply_filters('ginger_add_iframe', $ginger_iframe_tags);
|
143 |
+
|
144 |
+
|
145 |
if(strpos($output, '<html') === false):
|
146 |
return $output;
|
147 |
elseif(strpos($output, '<html') > 200 ):
|
ginger-eu-cookie-law.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ginger - EU Cookie Law
|
4 |
Plugin URI: http://manafactory.it/
|
5 |
Description: Make your website compliant with EU Cookie Policy.
|
6 |
-
Version: 2.
|
7 |
Author: Manafactory
|
8 |
Author URI: http://manafactory.it/
|
9 |
License: GPLv2 or later
|
@@ -21,7 +21,6 @@ require_once('addon/ginger.addon.utils.php');
|
|
21 |
if(is_admin()){
|
22 |
require_once("admin/ginger.utils.php");
|
23 |
require_once("admin/ginger.pointer.php");
|
24 |
-
// require_once("admin/add-on/available_add_on.php");
|
25 |
|
26 |
}
|
27 |
//Gestione Frontend
|
3 |
Plugin Name: Ginger - EU Cookie Law
|
4 |
Plugin URI: http://manafactory.it/
|
5 |
Description: Make your website compliant with EU Cookie Policy.
|
6 |
+
Version: 2.1
|
7 |
Author: Manafactory
|
8 |
Author URI: http://manafactory.it/
|
9 |
License: GPLv2 or later
|
21 |
if(is_admin()){
|
22 |
require_once("admin/ginger.utils.php");
|
23 |
require_once("admin/ginger.pointer.php");
|
|
|
24 |
|
25 |
}
|
26 |
//Gestione Frontend
|
readme.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: manafactory, webgrafia, matteobarale
|
|
|
3 |
Tags: EU Cookie Law, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.2.2
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -16,7 +17,7 @@ The aim of Ginger is to be a **complete plug'n play solution** that make your we
|
|
16 |
* really **plug'n play**: simply activate, and enjoy
|
17 |
* complete **banner** configuration: style, position and colors
|
18 |
* **Opt-in** mode enabler: block cookies BEFORE user acceptance (fit for **Italy** regulation)
|
19 |
-
* Exclude Google Analytics cookie if not **
|
20 |
* Complatible with server **caching**
|
21 |
|
22 |
|
@@ -34,13 +35,15 @@ The aim of Ginger is to be a **complete plug'n play solution** that make your we
|
|
34 |
* ShareThis
|
35 |
* Adsense
|
36 |
* WPML
|
|
|
|
|
37 |
|
38 |
= Coming soon: =
|
39 |
* **Privacy Policy** Generator
|
40 |
-
* **Custom javascript** locker
|
41 |
* **Logger** addon
|
42 |
* **Multisite**
|
43 |
|
|
|
44 |
|
45 |
**Send us [suggestions or bug report](https://wordpress.org/support/plugin/ginger)!**
|
46 |
|
@@ -75,6 +78,13 @@ No, you can be safe from plugins conflict. It's been developed using Cookies Ena
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 2.0.2 =
|
79 |
* Fix analytics addon
|
80 |
|
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.2.2
|
7 |
+
Stable tag: 2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
17 |
* really **plug'n play**: simply activate, and enjoy
|
18 |
* complete **banner** configuration: style, position and colors
|
19 |
* **Opt-in** mode enabler: block cookies BEFORE user acceptance (fit for **Italy** regulation)
|
20 |
+
* Exclude Google Analytics cookie if not **anonymized**
|
21 |
* Complatible with server **caching**
|
22 |
|
23 |
|
35 |
* ShareThis
|
36 |
* Adsense
|
37 |
* WPML
|
38 |
+
* Custom Javascript url
|
39 |
+
* Custom Iframe url
|
40 |
|
41 |
= Coming soon: =
|
42 |
* **Privacy Policy** Generator
|
|
|
43 |
* **Logger** addon
|
44 |
* **Multisite**
|
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)!**
|
49 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
|
82 |
+
= 2.1 =
|
83 |
+
* Custom js/iframe addon
|
84 |
+
* new addon page layout
|
85 |
+
* fix bug addon analytics
|
86 |
+
* minor fixes
|
87 |
+
|
88 |
= 2.0.2 =
|
89 |
* Fix analytics addon
|
90 |
|
uninstall.php
CHANGED
@@ -10,3 +10,14 @@ if ( ! current_user_can( 'activate_plugins' ) )
|
|
10 |
delete_option('ginger_general');
|
11 |
delete_option('ginger_banner');
|
12 |
delete_option('ginger_policy');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
delete_option('ginger_general');
|
11 |
delete_option('ginger_banner');
|
12 |
delete_option('ginger_policy');
|
13 |
+
|
14 |
+
delete_option('gingerjscustom');
|
15 |
+
delete_option('ginger_jscustom_options');
|
16 |
+
|
17 |
+
delete_option('gingeradsense');
|
18 |
+
|
19 |
+
delete_option('gingerwpml');
|
20 |
+
delete_option('ginger_wpml_options');
|
21 |
+
|
22 |
+
delete_option('gingeranalytics');
|
23 |
+
delete_option('gingeranalytics_option');
|