--- a/thirstyaffiliates/Helpers/Plugin_Constants.php
+++ b/thirstyaffiliates/Helpers/Plugin_Constants.php
@@ -40,7 +40,7 @@
// Plugin configuration constants
const TOKEN = 'ta';
const INSTALLED_VERSION = 'ta_installed_version';
- const VERSION = '3.11.9';
+ const VERSION = '3.11.10';
const TEXT_DOMAIN = 'thirstyaffiliates';
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
const META_DATA_PREFIX = '_ta_';
--- a/thirstyaffiliates/Models/Affiliate_Links_CPT.php
+++ b/thirstyaffiliates/Models/Affiliate_Links_CPT.php
@@ -1352,25 +1352,47 @@
public function search_query( $search, $query ) {
if ( is_admin() && $query->is_search() && $query->get( 'post_type' ) === Plugin_Constants::AFFILIATE_LINKS_CPT ) {
global $wpdb;
- $escaped_term = '%' . $wpdb->esc_like( $query->get( 's' ) ) . '%';
- $search = $wpdb->prepare(
- "AND (
- (
+ $search_string = $query->get( 's' );
+ preg_match_all( '/".*?("|$)|((?<=[t ",+])|^)[^t ",+]+/', $search_string, $matches );
+ $search_terms = array_map( 'trim', array_filter($matches[0]) );
+ $search_terms = array_map( function( $term ) {
+ return trim($term, ""'nr " );
+
+ }, $search_terms);
+
+ $search = '';
+ $search_and = '';
+
+ foreach ($search_terms as $term){
+ if ( empty($term) ) {
+ continue;
+ }
+
+ $escaped_term = '%' . $wpdb->esc_like( $term ) . '%';
+
+ $search .= $wpdb->prepare(
+ "{$search_and}(
({$wpdb->posts}.post_title LIKE %s) OR
({$wpdb->posts}.post_excerpt LIKE %s) OR
({$wpdb->posts}.post_content LIKE %s) OR
({$wpdb->posts}.post_name LIKE %s) OR
(ta_pm_1.meta_value LIKE %s)
- )
- ) ",
- $escaped_term,
- $escaped_term,
- $escaped_term,
- $escaped_term,
- $escaped_term
- );
- }
+ )",
+ $escaped_term,
+ $escaped_term,
+ $escaped_term,
+ $escaped_term,
+ $escaped_term
+ );
+
+ $search_and = ' AND ';
+ }
+ if ( !empty($search) ) {
+ $search = " AND ({$search}) ";
+ }
+ }
+
return $search;
}
--- a/thirstyaffiliates/Models/Authenticator.php
+++ b/thirstyaffiliates/Models/Authenticator.php
@@ -141,12 +141,32 @@
* @return void
*/
public static function delete_connection_data() {
- if ( isset( $_GET['ta-clear-connection-data'] ) ) {
- // Admins only
- if ( current_user_can( 'manage_options' ) ) {
- self::clear_connection_data();
- }
+ if ( ! isset( $_GET['ta-clear-connection-data'] ) ) {
+ return;
}
+
+ // Admins only
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ // If nonce is present and valid, perform the action.
+ if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'ta-clear-connection-data' ) ) {
+ self::clear_connection_data();
+ wp_safe_redirect( admin_url() );
+ exit;
+ }
+
+ // Show confirmation page.
+ $nonce_url = wp_nonce_url( admin_url( '?ta-clear-connection-data=1' ), 'ta-clear-connection-data' );
+ wp_die(
+ '<h1>' . esc_html__( 'Clear Connection Data', 'thirstyaffiliates' ) . '</h1>' .
+ '<p>' . esc_html__( 'Are you sure you want to clear your ThirstyAffiliates connection data? This will remove your site UUID, account email, and secret token.', 'thirstyaffiliates' ) . '</p>' .
+ '<p><a class="button button-primary" href="' . esc_url( $nonce_url ) . '">' . esc_html__( 'Yes, Clear Connection Data', 'thirstyaffiliates' ) . '</a> ' .
+ '<a class="button" href="' . esc_url( admin_url() ) . '">' . esc_html__( 'Cancel', 'thirstyaffiliates' ) . '</a></p>',
+ esc_html__( 'Confirm Action', 'thirstyaffiliates' ),
+ array( 'back_link' => false )
+ );
}
/**
--- a/thirstyaffiliates/Models/Script_Loader.php
+++ b/thirstyaffiliates/Models/Script_Loader.php
@@ -375,8 +375,9 @@
if ( apply_filters( 'ta_enqueue_tajs_script' , ( get_option( 'ta_enable_link_fixer' , 'yes' ) === 'yes' || get_option( 'ta_enable_stats_reporting_module' , 'yes' ) === 'yes' ) ) ) {
- // load main frontend script that holds the link fixer and stat record JS code
- wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . 'app/ta.js' , array( 'jquery' ) , Plugin_Constants::VERSION , true );
+ // load main frontend script that holds the link fixer and stat record JS code
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ wp_enqueue_script( 'ta_main_js' , $this->_constants->JS_ROOT_URL() . "app/ta{$suffix}.js" , array( 'jquery' ) , Plugin_Constants::VERSION , true );
wp_localize_script( 'ta_main_js' , 'thirsty_global_vars' , array(
'home_url' => $this->_get_absolute_home_url( true ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
--- a/thirstyaffiliates/thirstyaffiliates.php
+++ b/thirstyaffiliates/thirstyaffiliates.php
@@ -3,7 +3,7 @@
* Plugin Name: ThirstyAffiliates
* Plugin URI: http://thirstyaffiliates.com/
* Description: ThirstyAffiliates is a revolution in affiliate link management. Collect, collate and store your affiliate links for use in your posts and pages.
- * Version: 3.11.9
+ * Version: 3.11.10
* Requires PHP: 7.4
* Author: Caseproof
* Author URI: https://caseproof.com/
--- a/thirstyaffiliates/vendor-prefixed/caseproof/growth-tools/src/Helper/AddonHelper.php
+++ b/thirstyaffiliates/vendor-prefixed/caseproof/growth-tools/src/Helper/AddonHelper.php
@@ -55,7 +55,9 @@
// Check for permissions.
if (! current_user_can('activate_plugins')) {
- wp_send_json_error();
+ wp_send_json_error(
+ esc_html__('Could not deactivate addon. Please check user permissions.', 'thirstyaffiliates')
+ );
}
if ('theme' === $addonType) {
@@ -91,7 +93,9 @@
// Check for permissions.
if (! current_user_can('install_plugins')) {
- wp_send_json_error();
+ wp_send_json_error(
+ esc_html__('Could not install addon. Please check user permissions.', 'thirstyaffiliates')
+ );
}
// Install the addon.