kk Star Ratings - Version 4.1.3

Version Description

Download this release

Release Info

Developer bhittani
Plugin Icon 128x128 kk Star Ratings
Version 4.1.3
Comparing to
See all releases

Code changes from version 4.1.2 to 4.1.3

Files changed (5) hide show
  1. index.php +1 -1
  2. languages/kk-star-ratings.pot +2 -2
  3. readme.txt +5 -5
  4. src/activate.php +37 -27
  5. src/post.php +1 -1
index.php CHANGED
@@ -10,7 +10,7 @@
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
- * Version: 4.1.2
14
  * License: GPLv2 or later
15
  */
16
 
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
+ * Version: 4.1.3
14
  * License: GPLv2 or later
15
  */
16
 
languages/kk-star-ratings.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: kk Star Ratings 4.1.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2019-11-05T12:56:52+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.3.0\n"
15
  "X-Domain: kk-star-ratings\n"
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: kk Star Ratings 4.1.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2019-12-25T05:10:43+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.3.0\n"
15
  "X-Domain: kk-star-ratings\n"
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited
5
  Requires at least: 4.5
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.4
8
- Stable tag: 4.1.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -94,16 +94,16 @@ The source of this plugin is located at [Github](https://github.com/kamalkhan/kk
94
 
95
  = 4.x =
96
 
97
- - [View Changelog](CHANGELOG.md)
98
 
99
  = 3.x =
100
- [Archived](.github/CHANGELOG-v3.md)
101
 
102
  = 2.x =
103
- [Archived](.github/CHANGELOG-v2.md)
104
 
105
  = 1.x =
106
- [Archived](.github/CHANGELOG-v1.md)
107
 
108
  == Upgrade Notice ==
109
 
5
  Requires at least: 4.5
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.4
8
+ Stable tag: 4.1.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
94
 
95
  = 4.x =
96
 
97
+ - [View Changelog](https://github.com/kamalkhan/kk-star-ratings/blob/master/CHANGELOG.md)
98
 
99
  = 3.x =
100
+ [Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v3.md)
101
 
102
  = 2.x =
103
+ [Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v2.md)
104
 
105
  = 1.x =
106
+ [Archived](https://github.com/kamalkhan/kk-star-ratings/blob/master/.github/CHANGELOG-v1.md)
107
 
108
  == Upgrade Notice ==
109
 
src/activate.php CHANGED
@@ -16,21 +16,48 @@ if (! defined('ABSPATH')) {
16
  die();
17
  }
18
 
19
- register_activation_hook(config('file'), __NAMESPACE__.'\activate');
20
- function activate()
21
  {
22
- do_plugin_action('activate', config('version'), get_option(prefix('ver')));
 
 
 
 
 
 
 
 
 
23
 
24
- update_option(prefix('ver'), config('version'));
25
  }
26
 
27
- add_plugin_action('activate', __NAMESPACE__.'\upgrade_options', 9, 2);
28
- function upgrade_options($version, $previous)
 
 
 
 
 
 
 
 
29
  {
30
- if ($previous && version_compare($previous, '3.0.0', '>')) {
31
- return;
 
 
 
 
 
 
32
  }
 
33
 
 
 
 
34
  $options = [
35
  'strategies' => get_option(prefix('strategies'), array_filter([
36
  'guests',
@@ -52,13 +79,9 @@ function upgrade_options($version, $previous)
52
  }
53
  }
54
 
55
- add_plugin_action('activate', __NAMESPACE__.'\upgrade_post_ratings', 9, 2);
56
- function upgrade_post_ratings($version, $previous)
57
  {
58
- if ($previous && version_compare($previous, '3.0.0', '>')) {
59
- return;
60
- }
61
-
62
  global $wpdb;
63
 
64
  // Truncate IP addresses.
@@ -89,16 +112,3 @@ function upgrade_post_ratings($version, $previous)
89
  );
90
  }
91
  }
92
-
93
- add_plugin_action('activate', __NAMESPACE__.'\sync_options', 9, 2);
94
- function sync_options($version, $previous)
95
- {
96
- foreach (config('options') as $key => $value) {
97
- $storedValue = get_option(prefix($key));
98
-
99
- $value = (! $storedValue && ! is_bool($value))
100
- ? $value : $storedValue;
101
-
102
- update_option(prefix($key), $value);
103
- }
104
- }
16
  die();
17
  }
18
 
19
+ register_activation_hook(config('file'), __NAMESPACE__.'\activation');
20
+ function activation()
21
  {
22
+ $version = config('version');
23
+ $previous = get_option(prefix('ver'));
24
+
25
+ if (! $previous) {
26
+ do_plugin_action('install', $version);
27
+ } elseif (version_compare($previous, '3.0.0', '>')) {
28
+ do_plugin_action('activate', $version, $previous);
29
+ } else {
30
+ do_plugin_action('upgrade', $version, $previous);
31
+ }
32
 
33
+ update_option(prefix('ver'), $version);
34
  }
35
 
36
+ add_plugin_action('install', __NAMESPACE__.'\save_options', 9);
37
+ function save_options($version)
38
+ {
39
+ foreach (config('options') as $key => $value) {
40
+ update_option(prefix($key), $value);
41
+ }
42
+ }
43
+
44
+ add_plugin_action('activate', __NAMESPACE__.'\sync_options', 9, 2);
45
+ function sync_options($version, $previous)
46
  {
47
+ foreach (config('options') as $k => $v) {
48
+ $value = get_option(prefix($k));
49
+
50
+ if (! $value && ! is_bool($v)) {
51
+ $value = $v;
52
+ }
53
+
54
+ update_option(prefix($k), $value);
55
  }
56
+ }
57
 
58
+ add_plugin_action('upgrade', __NAMESPACE__.'\upgrade_options', 9, 2);
59
+ function upgrade_options($version, $previous)
60
+ {
61
  $options = [
62
  'strategies' => get_option(prefix('strategies'), array_filter([
63
  'guests',
79
  }
80
  }
81
 
82
+ add_plugin_action('upgrade', __NAMESPACE__.'\upgrade_posts', 9, 2);
83
+ function upgrade_posts($version, $previous)
84
  {
 
 
 
 
85
  global $wpdb;
86
 
87
  // Truncate IP addresses.
112
  );
113
  }
114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
src/post.php CHANGED
@@ -184,7 +184,7 @@ function vote_post($score, $best, $id, $slug)
184
 
185
  $ip = md5($_SERVER['REMOTE_ADDR']);
186
 
187
- update_post_meta($id, meta_prefix('ref'), $ip, $ip);
188
  }
189
 
190
  add_action('wp_head', __NAMESPACE__.'\structured_data');
184
 
185
  $ip = md5($_SERVER['REMOTE_ADDR']);
186
 
187
+ add_post_meta($id, meta_prefix('ref'), $ip);
188
  }
189
 
190
  add_action('wp_head', __NAMESPACE__.'\structured_data');