Skip to content

Commit

Permalink
Merge pull request #114 from itthinx/tested-4.16.0-6.0
Browse files Browse the repository at this point in the history
Tested 4.16.0 6.0
  • Loading branch information
itthinx authored Aug 4, 2022
2 parents dd2f4a7 + 2b1f831 commit 4f1af2a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
4 changes: 2 additions & 2 deletions affiliates.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Plugin Name: Affiliates
* Plugin URI: http://www.itthinx.com/plugins/affiliates
* Description: The Affiliates plugin provides the right tools to maintain a partner referral program.
* Version: 4.15.0
* Version: 4.16.0
* Author: itthinx
* Author URI: http://www.itthinx.com
* Donate-Link: http://www.itthinx.com
Expand All @@ -35,7 +35,7 @@
}

if ( !defined( 'AFFILIATES_CORE_VERSION' ) ) {
define( 'AFFILIATES_CORE_VERSION', '4.15.0' );
define( 'AFFILIATES_CORE_VERSION', '4.16.0' );
define( 'AFFILIATES_PLUGIN_NAME', 'affiliates' );
define( 'AFFILIATES_FILE', __FILE__ );
define( 'AFFILIATES_PLUGIN_BASENAME', plugin_basename( AFFILIATES_FILE ) );
Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
== Affiliates - Changelog ==

= 4.16.0 =
* WordPress 6.0 compatible.
* WordPress 6.1 compatible (last tested with 6.1-alpha-53814).
* WordPress 6.1 compatibility, fixed multiple instances of LIKE queries causing database errors.
* PHP 8.x compatibility, avoided several instances of deprecation warnings due to inconsistent function signature across PHP versions on third parameter of preg_split expecting int instead of null.
* Removed mention of deprecated Affiliates PayPal integration in readme.txt.
* Fixed various issues with the registration widget: a PHP warning caused by a missing array key, a superfluous parameter in the form rendering call and a database error when searching for the terms page by title with PHP 8.x.

= 4.15.0 =
* WordPress 6.0 compatible.
* Code cleanup, fixed trailing whitespace.
Expand Down
12 changes: 6 additions & 6 deletions lib/core/affiliates-admin-affiliates.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,16 @@ function affiliates_admin_affiliates() {
$filter_params[] = $affiliate_id;
}
if ( $affiliate_name ) {
$filters[] = " $affiliates_table.name LIKE '%%%s%%' ";
$filter_params[] = $affiliate_name;
$filters[] = " $affiliates_table.name LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $affiliate_name ) . '%';
}
if ( $affiliate_email ) {
$filters[] = " $affiliates_table.email LIKE '%%%s%%' ";
$filter_params[] = $affiliate_email;
$filters[] = " $affiliates_table.email LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $affiliate_email ) . '%';
}
if ( $affiliate_user_login ) {
$filters[] = " $wpdb->users.user_login LIKE '%%%s%%' ";
$filter_params[] = $affiliate_user_login;
$filters[] = " $wpdb->users.user_login LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $affiliate_user_login ) . '%';
}
$statuses = array( '' ); // need at least one entry for the IN clause
if ( $show_active ) {
Expand Down
18 changes: 9 additions & 9 deletions lib/core/affiliates-admin-hits-uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function affiliates_admin_hits_uri() {

// Source URI
if ( $src_uri ) {
$strings = preg_split( '/\s+(AND|OR)\s+/', $src_uri, null, PREG_SPLIT_DELIM_CAPTURE );
$strings = preg_split( '/\s+(AND|OR)\s+/', $src_uri, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( is_array( $strings ) && count( $strings ) > 0 ) {
$filters .= ' AND ( ';
foreach ( $strings as $string ) {
Expand All @@ -345,8 +345,8 @@ function affiliates_admin_hits_uri() {
$filters .= " $string ";
break;
default :
$filters .= " su.uri LIKE '%%%s%%' ";
$filter_params[] = $wpdb->esc_like( $string );
$filters .= " su.uri LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $string ) . '%';
}
}
$filters .= ' ) ';
Expand All @@ -355,7 +355,7 @@ function affiliates_admin_hits_uri() {

// Desintation URI
if ( $dest_uri ) {
$strings = preg_split( '/\s+(AND|OR)\s+/', $dest_uri, null, PREG_SPLIT_DELIM_CAPTURE );
$strings = preg_split( '/\s+(AND|OR)\s+/', $dest_uri, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( is_array( $strings ) && count( $strings ) > 0 ) {
$filters .= ' AND ( ';
foreach ( $strings as $string ) {
Expand All @@ -365,8 +365,8 @@ function affiliates_admin_hits_uri() {
$filters .= " $string ";
break;
default :
$filters .= " du.uri LIKE '%%%s%%' ";
$filter_params[] = $wpdb->esc_like( $string );
$filters .= " du.uri LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $string ) . '%';
}
}
$filters .= ' ) ';
Expand All @@ -375,7 +375,7 @@ function affiliates_admin_hits_uri() {

// User Agent
if ( $user_agent ) {
$strings = preg_split( '/\s+(AND|OR)\s+/', $user_agent, null, PREG_SPLIT_DELIM_CAPTURE );
$strings = preg_split( '/\s+(AND|OR)\s+/', $user_agent, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( is_array( $strings ) && count( $strings ) > 0 ) {
$filters .= ' AND ( ';
foreach ( $strings as $string ) {
Expand All @@ -385,8 +385,8 @@ function affiliates_admin_hits_uri() {
$filters .= " $string ";
break;
default :
$filters .= " ua.user_agent LIKE '%%%s%%' ";
$filter_params[] = $wpdb->esc_like( $string );
$filters .= " ua.user_agent LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $string ) . '%';
}
}
$filters .= ' ) ';
Expand Down
10 changes: 5 additions & 5 deletions lib/core/affiliates-admin-referrals.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ function affiliates_admin_referrals() {
}
if ( $search ) {
if ( $search_description ) {
$filters .= " AND ( r.data LIKE '%%%s%%' OR r.description LIKE '%%%s%%' ) ";
$filter_params[] = $search;
$filter_params[] = $search;
$filters .= " AND ( r.data LIKE %s OR r.description LIKE %s ) ";
$filter_params[] = '%' . $wpdb->esc_like( $search ) . '%';
$filter_params[] = '%' . $wpdb->esc_like( $search ) . '%';
} else {
$filters .= " AND r.data LIKE '%%%s%%' ";
$filter_params[] = $search;
$filters .= " AND r.data LIKE %s ";
$filter_params[] = '%' . $wpdb->esc_like( $search ) . '%';
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/core/class-affiliates-registration-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function widget( $args, $instance ) {

extract( $args );
$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : '';
$widget_id = $args['widget_id'];
$widget_id = !empty( $args['widget_id'] ) ? $args['widget_id'] : '';
echo $before_widget;
if ( !empty( $title ) ) {
echo $before_title . $title . $after_title;
Expand All @@ -63,7 +63,7 @@ function widget( $args, $instance ) {
if ( isset( $instance['terms_post_id'] ) ) {
$options['terms_post_id'] = $instance['terms_post_id'];
}
echo Affiliates_Registration::render_form( $options, $widget_id );
echo Affiliates_Registration::render_form( $options );
echo $after_widget;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/core/class-affiliates-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ public static function get_post_by_title( $title, $output = OBJECT, $post_type =
$post = null;
if ( $post_type == null ) {
$query = $wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE post_title LIKE '%%%s%%'",
$title
"SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s",
'%' . $wpdb->esc_like( $title ) . '%'
);
} else {
$query = $wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE post_title LIKE '%%%s%%' AND post_type= %s",
$title,
"SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_type= %s",
'%' . $wpdb->esc_like( $title ) . '%',
$post_type
);
}
Expand Down
3 changes: 1 addition & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: affiliate, affiliates, affiliate marketing, referral, growth marketing, ad
Requires at least: 5.6.0
Tested up to: 6.0
Requires PHP: 5.6.0
Stable tag: 4.15.0
Stable tag: 4.16.0
License: GPLv3

The Affiliates system provides the most powerful growth-oriented tools to run a successful Affiliate Marketing Program.
Expand Down Expand Up @@ -68,7 +68,6 @@ E-Commerce and Events

- [Affiliates WooCommerce](https://www.itthinx.com/plugins/affiliates-woocommerce/) : Our advanced integration for [WooCommerce](https://wordpress.org/plugins/woocommerce/) includes automated status synchronization, recurring referrals and product rates.
- [Affiliates Events Manager](https://www.itthinx.com/plugins/affiliates-events-manager/) The integration records referrals and essential booking data for referred bookings. It allows to grant commissions on bookings with [Events Manager](https://wordpress.org/plugins/events-manager/).
- [Affiliates PayPal](https://www.itthinx.com/plugins/affiliates-pro-paypal/) : Integrates with PayPal and allows to grant commissions on purchases made with Payment Buttons.

Social Sharing Platforms ... make it even easier for affiliates to share their links

Expand Down

0 comments on commit 4f1af2a

Please sign in to comment.