Italy Cookie Choices (for EU Cookie Law) - Version 2.4.3

Version Description

Release Date: January 5th, 2016

Dev time: 10h

  • Fixed Ceceppa Multilingua string translations bug #152 and
Download this release

Release Info

Developer overclokk
Plugin Icon Italy Cookie Choices (for EU Cookie Law)
Version 2.4.3
Comparing to
See all releases

Code changes from version 2.4.2 to 2.4.3

includes/functions-italy-cookie-choices-lang.php CHANGED
@@ -2,19 +2,22 @@
2
  /**
3
  * By Mte90 - www.mte90.net
4
  * Functions for multilingual support
 
5
  * @link https://github.com/Mte90/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/includes/language.php
6
  * @link https://gist.github.com/Mte90/fe687ceed408ab743238
7
- */
8
-
9
- /**
10
- * Return the language 2 letters code
11
- *
12
- * @since 1.0.0
13
  *
14
- * @var string
15
  */
16
- if ( !function_exists( 'get_language' ) ){
17
 
 
 
 
 
 
 
 
 
 
18
  function get_language() {
19
 
20
  if ( defined( 'ICL_LANGUAGE_CODE' ) )
@@ -26,35 +29,32 @@ if ( !function_exists( 'get_language' ) ){
26
  elseif ( function_exists( 'pll_current_language' ) )
27
  return pll_current_language();
28
 
29
- else
30
- return get_locale();//return a 4 letters code
31
-
32
- }
33
 
 
34
  }
35
 
36
- /**
37
- * Add registration for string (contain hook)
38
- *
39
- * @since 1.0.0
40
- *
41
- * @var string
42
- */
43
- if ( !function_exists( 'register_string' ) ) {
44
-
 
 
45
  function register_string( $plugin_name_human_format, $string_name, $value ) {
46
 
 
 
47
  if ( function_exists( 'icl_register_string' ) )
48
  icl_register_string( $plugin_name_human_format, $string_name, $value );
49
 
50
- elseif ( has_filter( 'cml_my_translations' ) ) {
51
 
52
- add_filter( 'cml_my_translations', function ( $groups, $plugin_name_human_format ){
53
- $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
54
- CMLTranslations:add( $string_name, $value, $plugin_name_human_format );
55
- $groups[$plugin_name_human_format_replaced] = $plugin_name_human_format;
56
- return $groups;
57
- } );
58
 
59
  } elseif ( function_exists( 'pll_register_string' ) ) {
60
 
@@ -63,18 +63,40 @@ if ( !function_exists( 'register_string' ) ) {
63
 
64
  }
65
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  }
68
 
69
- /**
70
- * Unregister string, Polylang not have this feature
71
- *
72
- * @since 1.0.0
73
- *
74
- * @var string
75
- */
76
- if ( !function_exists( 'deregister_string' ) ) {
77
 
 
 
 
 
 
 
 
 
78
  function deregister_string( $plugin_name_human_format, $string_name ) {
79
 
80
  if ( function_exists( 'icl_unregister_string' ) )
@@ -83,36 +105,39 @@ if ( !function_exists( 'deregister_string' ) ) {
83
  elseif ( has_filter( 'cml_my_translations' ) ) {
84
 
85
  $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
86
- CMLTranslations::delete( $plugin_name_human_format_replaced );
87
 
88
  }
89
  }
90
-
91
  }
92
 
93
- /**
94
- * Get string
95
- *
96
- * @since 1.0.0
97
- *
98
- * @var string
99
- */
100
- if ( !function_exists( 'get_string' ) ) {
101
-
 
 
102
  function get_string( $plugin_name_human_format, $string_name, $value ) {
103
 
104
- if ( function_exists( 'icl_t' ) )
 
 
105
  return icl_t( $plugin_name_human_format, $string_name, $value );
106
 
107
- elseif ( has_filter( 'cml_my_translations' ) )
108
- return CMLTranslations::get( CMLLanguage::get_current_id(), $string_name, str_replace( ' ', '-', $plugin_name_human_format ) );
109
 
110
- elseif ( function_exists( 'pll__' ) )
111
  return pll__( $string_name );
112
 
113
- else
114
  return $value;
 
115
 
116
  }
117
-
118
- }
2
  /**
3
  * By Mte90 - www.mte90.net
4
  * Functions for multilingual support
5
+ *
6
  * @link https://github.com/Mte90/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/includes/language.php
7
  * @link https://gist.github.com/Mte90/fe687ceed408ab743238
 
 
 
 
 
 
8
  *
9
+ * @package Italy Cookie Choices
10
  */
 
11
 
12
+ if ( ! function_exists( 'get_language' ) ) {
13
+
14
+ /**
15
+ * Return the language 2-4 letters code
16
+ *
17
+ * @since 1.0.0
18
+ *
19
+ * @return string 4 letters cod of the locale
20
+ */
21
  function get_language() {
22
 
23
  if ( defined( 'ICL_LANGUAGE_CODE' ) )
29
  elseif ( function_exists( 'pll_current_language' ) )
30
  return pll_current_language();
31
 
32
+ else return get_locale(); // Return a 4 letters code.
 
 
 
33
 
34
+ }
35
  }
36
 
37
+ if ( ! function_exists( 'register_string' ) ) {
38
+
39
+ /**
40
+ * Add registration for multilanguage string (contain hook)
41
+ *
42
+ * @since 1.0.0
43
+ *
44
+ * @param string $plugin_name_human_format The Plugin name.
45
+ * @param string $string_name The name of the string.
46
+ * @param string $value The value.
47
+ */
48
  function register_string( $plugin_name_human_format, $string_name, $value ) {
49
 
50
+ CMLTranslations::add( $string_name, $value, str_replace( ' ', '-', $plugin_name_human_format ) );
51
+
52
  if ( function_exists( 'icl_register_string' ) )
53
  icl_register_string( $plugin_name_human_format, $string_name, $value );
54
 
55
+ elseif ( class_exists( 'CMLTranslations' ) ) {
56
 
57
+ CMLTranslations::add( $string_name, $value, str_replace( ' ', '-', $plugin_name_human_format ) );
 
 
 
 
 
58
 
59
  } elseif ( function_exists( 'pll_register_string' ) ) {
60
 
63
 
64
  }
65
  }
66
+ }
67
+
68
+ if ( class_exists( 'CMLTranslations' ) ) {
69
+
70
+ /**
71
+ * Add a groups for string translations in Ceceppa multilanguiage
72
+ * @param array $groups Array of groups string.
73
+ * @return array New array
74
+ */
75
+ function cml_icc_strings( $groups ) {
76
+
77
+ $plugin_name_human_format = 'Italy Cookie Choices';
78
+
79
+ $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
80
+
81
+ $groups[ $plugin_name_human_format_replaced ] = $plugin_name_human_format;
82
+
83
+ return $groups;
84
+
85
+ }
86
+ add_filter( 'cml_my_translations', 'cml_icc_strings' );
87
 
88
  }
89
 
90
+ if ( ! function_exists( 'deregister_string' ) ) {
 
 
 
 
 
 
 
91
 
92
+ /**
93
+ * Unregister multilanguage string, Polylang missing support of this feature
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @param string $plugin_name_human_format The Plugin name.
98
+ * @param string $string_name The name of the string.
99
+ */
100
  function deregister_string( $plugin_name_human_format, $string_name ) {
101
 
102
  if ( function_exists( 'icl_unregister_string' ) )
105
  elseif ( has_filter( 'cml_my_translations' ) ) {
106
 
107
  $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
108
+ CMLTranslations::delete( $plugin_name_human_format );
109
 
110
  }
111
  }
 
112
  }
113
 
114
+ if ( ! function_exists( 'get_string' ) ) {
115
+
116
+ /**
117
+ * Get multilanguage string
118
+ *
119
+ * @since 1.0.0
120
+ *
121
+ * @param string $plugin_name_human_format The Plugin name.
122
+ * @param string $string_name The name of the string.
123
+ * @param string $value The value.
124
+ */
125
  function get_string( $plugin_name_human_format, $string_name, $value ) {
126
 
127
+ $true = true;
128
+
129
+ if ( function_exists( 'icl_t' ) ) {
130
  return icl_t( $plugin_name_human_format, $string_name, $value );
131
 
132
+ } elseif ( has_filter( 'cml_my_translations' ) ) {
133
+ return CMLTranslations::get( CMLLanguage::get_current_id(), strtolower( $string_name ), str_replace( ' ', '-', $plugin_name_human_format, $true ) );
134
 
135
+ } elseif ( function_exists( 'pll__' ) ) {
136
  return pll__( $string_name );
137
 
138
+ } else {
139
  return $value;
140
+ }
141
 
142
  }
143
+ }
 
italy-cookie-choices.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Italy Cookie Choices (for EU Cookie Law)
4
  * Plugin URI: https://plus.google.com/u/0/communities/109254048492234113886
5
  * Description: Italy Cookie Choices allows you to easily comply with the european cookie law and block third part cookie in your page.
6
- * Version: 2.4.2
7
  * Author: Enea Overclokk, Andrea Pernici, Andrea Cardinale
8
  * Author URI: https://github.com/ItalyCookieChoices/italy-cookie-choices
9
  * Text Domain: italy-cookie-choices
3
  * Plugin Name: Italy Cookie Choices (for EU Cookie Law)
4
  * Plugin URI: https://plus.google.com/u/0/communities/109254048492234113886
5
  * Description: Italy Cookie Choices allows you to easily comply with the european cookie law and block third part cookie in your page.
6
+ * Version: 2.4.3
7
  * Author: Enea Overclokk, Andrea Pernici, Andrea Cardinale
8
  * Author URI: https://github.com/ItalyCookieChoices/italy-cookie-choices
9
  * Text Domain: italy-cookie-choices
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: compliance, cookie law, cookies, eu cookie law, eu law, eu privacy directive, privacy, privacy directive, notification, privacy law, cookie law banner, implied consent, third party script, third party cookie
5
  Requires at least: 3.5
6
  Tested up to: 4.5.0
7
- Stable tag: 2.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -115,6 +115,13 @@ if it doesn't work activate standard theme and try
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
 
118
  = 2.4.2 =
119
  Release Date: December 29th, 2015
120
 
4
  Tags: compliance, cookie law, cookies, eu cookie law, eu law, eu privacy directive, privacy, privacy directive, notification, privacy law, cookie law banner, implied consent, third party script, third party cookie
5
  Requires at least: 3.5
6
  Tested up to: 4.5.0
7
+ Stable tag: 2.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
115
 
116
  == Changelog ==
117
 
118
+ = 2.4.3 =
119
+ Release Date: January 5th, 2016
120
+
121
+ Dev time: 10h
122
+
123
+ * Fixed Ceceppa Multilingua string translations bug [#152](https://github.com/ItalyCookieChoices/italy-cookie-choices/issues/152) [and](https://github.com/ItalyCookieChoices/italy-cookie-choices/issues/124#issuecomment-122952940)
124
+
125
  = 2.4.2 =
126
  Release Date: December 29th, 2015
127
 
uninstall.php CHANGED
@@ -6,12 +6,12 @@
6
  * @author Enea Overclokk, Andrea Pernici, Andrea Cardinale
7
  * @license GPLv2 or later
8
  * @link https://github.com/ItalyCookieChoices/italy-cookie-choices
9
- *
10
  */
 
11
  /**
12
  * If uninstall not called from WordPress, then exit
13
  */
14
- if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
15
  exit;
16
  }
17
 
6
  * @author Enea Overclokk, Andrea Pernici, Andrea Cardinale
7
  * @license GPLv2 or later
8
  * @link https://github.com/ItalyCookieChoices/italy-cookie-choices
 
9
  */
10
+
11
  /**
12
  * If uninstall not called from WordPress, then exit
13
  */
14
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
15
  exit;
16
  }
17