WP ULike - Version 4.2.1

Version Description

  • Fixed: An issue in database tables.
  • Fixed: An issue with user IP method.
Download this release

Release Info

Developer alimir
Plugin Icon 128x128 WP ULike
Version 4.2.1
Comparing to
See all releases

Code changes from version 4.2.0 to 4.2.1

admin/assets/js/plugins.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.2.0
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
1
+ /*! WP ULike - v4.2.1
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
assets/js/wp-ulike.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WP ULike - v4.2.0
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
1
+ /*! WP ULike - v4.2.1
2
  * https://wpulike.com
3
  * TechnoWich 2020;
4
  */
inc/general-functions.php CHANGED
@@ -1781,16 +1781,31 @@ if( ! function_exists( 'wp_ulike_get_user_ip' ) ){
1781
  */
1782
  function wp_ulike_get_user_ip(){
1783
  foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
1784
- if ( array_key_exists( $key, $_SERVER ) === true ){
1785
- foreach ( explode( ',', $_SERVER[$key] ) as $ip ){
1786
- if ( filter_var( $ip, FILTER_VALIDATE_IP ) !== false ){
 
 
 
1787
  return $ip;
1788
- } else {
1789
- return '127.0.0.1';
1790
  }
1791
  }
1792
  }
1793
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1794
  }
1795
  }
1796
 
@@ -1804,8 +1819,7 @@ if( ! function_exists( 'wp_ulike_generate_user_id' ) ){
1804
  * @return String
1805
  */
1806
  function wp_ulike_generate_user_id( $user_ip ) {
1807
-
1808
- if( filter_var( $user_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
1809
  return ip2long( $user_ip );
1810
  } else {
1811
  // Get non-anonymise IP address
1781
  */
1782
  function wp_ulike_get_user_ip(){
1783
  foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
1784
+ if ( array_key_exists( $key, $_SERVER ) === true ) {
1785
+ foreach ( explode(',', $_SERVER[$key]) as $ip ) {
1786
+ // trim for safety measures
1787
+ $ip = trim( $ip );
1788
+ // attempt to validate IP
1789
+ if ( wp_ulike_validate_ip( $ip ) ) {
1790
  return $ip;
 
 
1791
  }
1792
  }
1793
  }
1794
  }
1795
+
1796
+ return '127.0.0.1';
1797
+ }
1798
+ }
1799
+
1800
+ if( ! function_exists( 'wp_ulike_validate_ip' ) ){
1801
+ /**
1802
+ * Ensures an ip address is both a valid IP and does not fall within a private network range.
1803
+ *
1804
+ * @param string $ip
1805
+ * @return boolean
1806
+ */
1807
+ function wp_ulike_validate_ip( $ip ) {
1808
+ return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) === false ? false : true;
1809
  }
1810
  }
1811
 
1819
  * @return String
1820
  */
1821
  function wp_ulike_generate_user_id( $user_ip ) {
1822
+ if( wp_ulike_validate_ip( $user_ip ) ) {
 
1823
  return ip2long( $user_ip );
1824
  } else {
1825
  // Get non-anonymise IP address
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: wp ulike, like button, elementor, like, dislike, wordpress youlike plugin,
6
  Requires PHP: 5.4
7
  Requires at least: 3.5.0
8
  Tested up to: 5.4
9
- Stable tag: 4.2.0
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -186,6 +186,10 @@ define( 'WP_MEMORY_LIMIT', '256M' );
186
 
187
  == Changelog ==
188
 
 
 
 
 
189
  = 4.2.0 =
190
  * Added: New algorithms to make essential queries more faster and flexible. (New Metadata Table)
191
  * Added: 2 new templates. (Arrow Votings, Minimal Votings) [PRO]
6
  Requires PHP: 5.4
7
  Requires at least: 3.5.0
8
  Tested up to: 5.4
9
+ Stable tag: 4.2.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
186
 
187
  == Changelog ==
188
 
189
+ = 4.2.1 =
190
+ * Fixed: An issue in database tables.
191
+ * Fixed: An issue with user IP method.
192
+
193
  = 4.2.0 =
194
  * Added: New algorithms to make essential queries more faster and flexible. (New Metadata Table)
195
  * Added: 2 new templates. (Arrow Votings, Minimal Votings) [PRO]
wp-ulike.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
12
  * Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
13
- * Version: 4.2.0
14
  * Author: Ali Mirzaei
15
  * Author URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
16
  * Text Domain: wp-ulike
@@ -46,8 +46,8 @@ if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
46
 
47
  // Do not change these values
48
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
49
- define( 'WP_ULIKE_VERSION' , '4.2.0' );
50
- define( 'WP_ULIKE_DB_VERSION' , '2.0' );
51
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
52
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
53
 
@@ -400,7 +400,7 @@ if ( ! class_exists( 'WpUlikeInit' ) ) :
400
  `ip` varchar(100) NOT NULL,
401
  `user_id` varchar(100) NOT NULL,
402
  `status` varchar(30) NOT NULL,
403
- PRIMARY KEY (`id`)
404
  KEY `post_id` (`post_id`),
405
  KEY `date_time` (`date_time`),
406
  KEY `user_id` (`user_id`),
10
  * Plugin Name: WP ULike
11
  * Plugin URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
12
  * Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
13
+ * Version: 4.2.1
14
  * Author: Ali Mirzaei
15
  * Author URI: https://wpulike.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
16
  * Text Domain: wp-ulike
46
 
47
  // Do not change these values
48
  define( 'WP_ULIKE_PLUGIN_URI' , 'https://wpulike.com/' );
49
+ define( 'WP_ULIKE_VERSION' , '4.2.1' );
50
+ define( 'WP_ULIKE_DB_VERSION' , '2.1' );
51
  define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
52
  define( 'WP_ULIKE_NAME' , __( 'WP ULike', WP_ULIKE_SLUG ));
53
 
400
  `ip` varchar(100) NOT NULL,
401
  `user_id` varchar(100) NOT NULL,
402
  `status` varchar(30) NOT NULL,
403
+ PRIMARY KEY (`id`),
404
  KEY `post_id` (`post_id`),
405
  KEY `date_time` (`date_time`),
406
  KEY `user_id` (`user_id`),