--- a/link-whisper/core/Wpil/Rest.php
+++ b/link-whisper/core/Wpil/Rest.php
@@ -77,7 +77,7 @@
if ( !empty($response['access_valid']) ) {
// and update the flag so we know it's live
- update_option('wpil_gsc_app_authorized', true);
+ update_option('wpil_gsc_app_authorized', true, false);
}
return 'ok';
@@ -116,16 +116,20 @@
$uid = (int)$request->get_param('uid');
$uemail = $request->get_param('uemail');
- if(!empty($token) && false !== strpos($token, 'ai-')){
+ if( !empty($token) &&
+ false !== strpos($token, 'ai-') && // if the code isn't corrupted
+ (bool) preg_match('/Aai-[0-9a-f]{64}z/i', $token) && // is a valid token
+ (bool) preg_match('/A[0-9a-f]{32}z/i', $user_id)) // has a valid id
+ {
// save the token to the options
update_option('wpil_ai_access_token', Wpil_Toolbox::encrypt($token));
// and the user id
update_option('wpil_ai_access_user_id', $user_id);
// and the user email
- update_option('wpil_ai_access_user_email', $uemail);
+ update_option('wpil_ai_access_user_email', sanitize_email($uemail));
// tag the user with the id
- update_user_meta($uid, 'wpil_ai_access_user_id', $user_id);
- update_user_meta($uid, 'wpil_ai_access_user_email', $uemail);
+// update_user_meta($uid, 'wpil_ai_access_user_id', $user_id);
+// update_user_meta($uid, 'wpil_ai_access_user_email', $uemail);
// and update the flag so we know it's live
update_option('wpil_ai_access_authorized', true);
}
--- a/link-whisper/core/Wpil/Settings.php
+++ b/link-whisper/core/Wpil/Settings.php
@@ -292,7 +292,7 @@
$renew = '';
if(!empty($sub)){
- $timestamp = (!empty(strtotime($sub->expiration))) ? strtotime($sub->expiration): time();
+ $timestamp = (!empty($sub->expiration) && !empty(strtotime($sub->expiration))) ? strtotime($sub->expiration): time();
$date_format = get_option('date_format', '');
if(!empty($date_format)){
$renew = date($date_format, $timestamp);
@@ -644,8 +644,8 @@
<div class="lw-credit-header-row">
<div class="lw-credit-title-with-balance">
<span class="lw-credit-label-inline">Available AI Credits:</span>
- <span class="lw-credit-number-inline"><?php echo number_format((!empty($credits) ? $credits: 0)); ?></span>
- <a href="<?php echo admin_url('admin.php?page=link_whisper_ai_subscription&refresh_credits=1') ?>" class="lw-refresh-icon" title="Refresh Balance">
+ <span class="lw-credit-number-inline"><?php echo number_format((!empty($credits) ? (int) $credits: 0)); ?></span>
+ <a href="<?php echo esc_url(admin_url('admin.php?page=link_whisper_ai_subscription&refresh_credits=1')); ?>" class="lw-refresh-icon" title="Refresh Balance">
<span class="dashicons dashicons-update"></span>
</a>
</div>
@@ -987,7 +987,7 @@
<button class="plan-button" data-type="custom" data-price-id="price_ondemand_free" data-download="ondemand_free">Buy Credits</button>
</div>
<!---->
- <?php $active = (!empty($sub)) && (int)$sub->product_id === 5246590; ?>
+ <?php $active = (!empty($sub) && isset($sub->product_id)) && (int)$sub->product_id === 5246590; ?>
<?php $recc = $recommended > 0 && $recommended < 1050; ?>
<div class="plan-card plan-1k <?php echo $active ? 'active': ''; ?> <?php echo ($recc) ? 'featured': '';?>">
<div class="tag active" style="<?php echo $active ? '': 'display:none'; ?>">Active</div>
@@ -1001,8 +1001,8 @@
<li><div class="main-text">Process up to 1000 posts <div style="float: none;display: inline-block;margin: 0;" class="wpil_help"><i class="dashicons dashicons-editor-help" style="font-size: 18px;"></i><div class="wpil-help-text" style="display: none;">Credits per post is estimated based on articles averaging 1,500 words.</div></div></div></li>
<li><div class="wpil-plan-spacer">.</div></li>
<?php if($active){ ?>
- <li><div class="current-credits" style="<?php echo $active ? '': 'display:none'; ?>"><?php echo 'Current Plan Credits: ' . $credits;?></div></li>
- <li><div class="plan-renew" style="<?php echo $active && !empty($renew) ? '': 'display:none'; ?>"><?php echo 'Plan Renews: ' . $renew;?></div></li>
+ <li><div class="current-credits" style="<?php echo $active ? '': 'display:none'; ?>"><?php echo esc_html('Current Plan Credits: ' . (int) $credits);?></div></li>
+ <li><div class="plan-renew" style="<?php echo $active && !empty($renew) ? '': 'display:none'; ?>"><?php echo esc_html('Plan Renews: ' . $renew);?></div></li>
<?php } else { ?>
<li><div class="wpil-plan-spacer">.</div></li>
<li><div class="wpil-plan-spacer">.</div></li>
@@ -1013,7 +1013,7 @@
<button class="plan-button <?php echo $active ? 'current': '';?>" data-type="recurring" data-price-id="price_1k_free" data-download="1k_free"><?php echo $active ? 'Cancel Plan': 'Choose Plan';?></button>
</div>
<!---->
- <?php $active = (!empty($sub)) && (int)$sub->product_id === 5246591; ?>
+ <?php $active = (!empty($sub) && isset($sub->product_id)) && (int)$sub->product_id === 5246591; ?>
<?php $recc = $recommended > 1050 && $recommended < 2050; ?>
<div class="plan-card plan-2k <?php echo $active ? 'active': ''; ?> <?php echo ($recc) ? 'featured': '';?>">
<div class="tag active" style="<?php echo $active ? '': 'display:none'; ?>">Active</div>
@@ -1027,8 +1027,8 @@
<li><div class="main-text">Process up to 2200 posts <div style="float: none;display: inline-block;margin: 0;" class="wpil_help"><i class="dashicons dashicons-editor-help" style="font-size: 18px;"></i><div class="wpil-help-text" style="display: none;">Credits per post is estimated based on articles averaging 1,500 words.</div></div></div></li>
<li><div class="wpil-plan-spacer">.</div></li>
<?php if($active){ ?>
- <li><div class="current-credits" style="<?php echo $active ? '': 'display:none'; ?>"><?php echo 'Current Plan Credits: ' . $credits;?></div></li>
- <li><div class="plan-renew" style="<?php echo $active && !empty($renew) ? '': 'display:none'; ?>"><?php echo 'Plan Renews: ' . $renew;?></div></li>
+ <li><div class="current-credits" style="<?php echo $active ? '': 'display:none'; ?>"><?php echo esc_html('Current Plan Credits: ' . (int) $credits);?></div></li>
+ <li><div class="plan-renew" style="<?php echo $active && !empty($renew) ? '': 'display:none'; ?>"><?php echo esc_html('Plan Renews: ' . $renew);?></div></li>
<?php } else { ?>
<li><div class="wpil-plan-spacer">.</div></li>
<li><div class="wpil-plan-spacer">.</div></li>
@@ -1222,7 +1222,7 @@
const res = await fetch(STRIPE.apiUrl + "/cancel-subscription", {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ ai_id: "<?php echo $ai_id;?>", subscription_id: "<?php echo ((!empty($sub)) && isset($sub->subscription_id)) ? $sub->subscription_id: null;?>" })
+ body: JSON.stringify({ ai_id: "<?php echo esc_attr($ai_id);?>", subscription_id: "<?php echo ((!empty($sub)) && isset($sub->subscription_id)) ? esc_attr($sub->subscription_id): '';?>" })
});
const data = await res.json();
if (data.success) {
@@ -2049,7 +2049,7 @@
if (popup.closed) {
clearInterval(interval);
// Call a function to check if auth was completed (or just reload)
- window.location.href = "<?php echo admin_url('admin.php?page=link_whisper_ai_subscription'); ?>";
+ window.location.href = "<?php echo esc_url(admin_url('admin.php?page=link_whisper_ai_subscription')); ?>";
}
}, 1000);
});*/
@@ -2062,7 +2062,7 @@
$renew = '';
if(!empty($sub)){
- $timestamp = (!empty(strtotime($sub->expiration))) ? strtotime($sub->expiration): time();
+ $timestamp = (!empty($sub->expiration) && !empty(strtotime($sub->expiration))) ? strtotime($sub->expiration): time();
$date_format = get_option('date_format', '');
if(!empty($date_format)){
$renew = date($date_format, $timestamp);
@@ -2074,7 +2074,7 @@
}
?>
<div id="credit-status-container">
- <div id="credit-status-display"><svg xmlns="http://www.w3.org/2000/svg" class="wpil-credit-icon" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 80c0 18-14.3 34.6-38.4 48c-29.1 16.1-72.5 27.5-122.3 30.9c-3.7-1.8-7.4-3.5-11.3-5C300.6 137.4 248.2 128 192 128c-8.3 0-16.4 .2-24.5 .6l-1.1-.6C142.3 114.6 128 98 128 80c0-44.2 86-80 192-80S512 35.8 512 80zM160.7 161.1c10.2-.7 20.7-1.1 31.3-1.1c62.2 0 117.4 12.3 152.5 31.4C369.3 204.9 384 221.7 384 240c0 4-.7 7.9-2.1 11.7c-4.6 13.2-17 25.3-35 35.5c0 0 0 0 0 0c-.1 .1-.3 .1-.4 .2c0 0 0 0 0 0s0 0 0 0c-.3 .2-.6 .3-.9 .5c-35 19.4-90.8 32-153.6 32c-59.6 0-112.9-11.3-148.2-29.1c-1.9-.9-3.7-1.9-5.5-2.9C14.3 274.6 0 258 0 240c0-34.8 53.4-64.5 128-75.4c10.5-1.5 21.4-2.7 32.7-3.5zM416 240c0-21.9-10.6-39.9-24.1-53.4c28.3-4.4 54.2-11.4 76.2-20.5c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 19.3-16.5 37.1-43.8 50.9c-14.6 7.4-32.4 13.7-52.4 18.5c.1-1.8 .2-3.5 .2-5.3zm-32 96c0 18-14.3 34.6-38.4 48c-1.8 1-3.6 1.9-5.5 2.9C304.9 404.7 251.6 416 192 416c-62.8 0-118.6-12.6-153.6-32C14.3 370.6 0 354 0 336l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 342.6 135.8 352 192 352s108.6-9.4 148.1-25.9c7.8-3.2 15.3-6.9 22.4-10.9c6.1-3.4 11.8-7.2 17.2-11.2c1.5-1.1 2.9-2.3 4.3-3.4l0 3.4 0 5.7 0 26.3zm32 0l0-32 0-25.9c19-4.2 36.5-9.5 52.1-16c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 10.5-5 21-14.9 30.9c-16.3 16.3-45 29.7-81.3 38.4c.1-1.7 .2-3.5 .2-5.3zM192 448c56.2 0 108.6-9.4 148.1-25.9c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 44.2-86 80-192 80S0 476.2 0 432l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 438.6 135.8 448 192 448z"/></svg> <?php echo $credits;?> AI Credits</div>
+ <div id="credit-status-display"><svg xmlns="http://www.w3.org/2000/svg" class="wpil-credit-icon" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 80c0 18-14.3 34.6-38.4 48c-29.1 16.1-72.5 27.5-122.3 30.9c-3.7-1.8-7.4-3.5-11.3-5C300.6 137.4 248.2 128 192 128c-8.3 0-16.4 .2-24.5 .6l-1.1-.6C142.3 114.6 128 98 128 80c0-44.2 86-80 192-80S512 35.8 512 80zM160.7 161.1c10.2-.7 20.7-1.1 31.3-1.1c62.2 0 117.4 12.3 152.5 31.4C369.3 204.9 384 221.7 384 240c0 4-.7 7.9-2.1 11.7c-4.6 13.2-17 25.3-35 35.5c0 0 0 0 0 0c-.1 .1-.3 .1-.4 .2c0 0 0 0 0 0s0 0 0 0c-.3 .2-.6 .3-.9 .5c-35 19.4-90.8 32-153.6 32c-59.6 0-112.9-11.3-148.2-29.1c-1.9-.9-3.7-1.9-5.5-2.9C14.3 274.6 0 258 0 240c0-34.8 53.4-64.5 128-75.4c10.5-1.5 21.4-2.7 32.7-3.5zM416 240c0-21.9-10.6-39.9-24.1-53.4c28.3-4.4 54.2-11.4 76.2-20.5c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 19.3-16.5 37.1-43.8 50.9c-14.6 7.4-32.4 13.7-52.4 18.5c.1-1.8 .2-3.5 .2-5.3zm-32 96c0 18-14.3 34.6-38.4 48c-1.8 1-3.6 1.9-5.5 2.9C304.9 404.7 251.6 416 192 416c-62.8 0-118.6-12.6-153.6-32C14.3 370.6 0 354 0 336l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 342.6 135.8 352 192 352s108.6-9.4 148.1-25.9c7.8-3.2 15.3-6.9 22.4-10.9c6.1-3.4 11.8-7.2 17.2-11.2c1.5-1.1 2.9-2.3 4.3-3.4l0 3.4 0 5.7 0 26.3zm32 0l0-32 0-25.9c19-4.2 36.5-9.5 52.1-16c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 10.5-5 21-14.9 30.9c-16.3 16.3-45 29.7-81.3 38.4c.1-1.7 .2-3.5 .2-5.3zM192 448c56.2 0 108.6-9.4 148.1-25.9c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 44.2-86 80-192 80S0 476.2 0 432l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 438.6 135.8 448 192 448z"/></svg> <?php echo (int) $credits;?> AI Credits</div>
</div>
<div id="credit-popup-overlay" class="hidden">
@@ -2096,7 +2096,7 @@
<?php if(!empty($sub)){ ?>
<div class="current-plan">
- <span class="bold-text">Your current plan is:</span> <?php echo esc_html($sub->title);?>
+ <span class="bold-text">Your current plan is:</span> <?php echo (isset($sub->title)) ? esc_html($sub->title) : '';?>
<div>
<span class="bold-text">It renews on:</span> <?php echo esc_html($renew);?>
</div>
@@ -2111,7 +2111,7 @@
</div>
<?php } ?>
<div class="credit-popup-actions">
- <a href="<?php echo admin_url('admin.php?page=link_whisper_ai_subscription'); ?>" class="credit-btn"><?php echo (!empty($sub)) ? esc_html__('Manage Plan', 'wpil'): esc_html__('Subscribe', 'wpil');?></a>
+ <a href="<?php echo esc_url(admin_url('admin.php?page=link_whisper_ai_subscription')); ?>" class="credit-btn"><?php echo (!empty($sub)) ? esc_html__('Manage Plan', 'wpil'): esc_html__('Subscribe', 'wpil');?></a>
</div>
</div>
</div>
--- a/link-whisper/link-whisper.php
+++ b/link-whisper/link-whisper.php
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: Link Whisper Free
- * Version: 0.9.0
+ * Version: 0.9.1
* Description: Quickly build smart internal links both to and from your content. Additionally, gain valuable insights with in-depth internal link reporting.
* Author: Link Whisper
* Author URI: https://linkwhisper.com
@@ -24,9 +24,9 @@
}
}
define( 'WPIL_STORE_URL', 'https://linkwhisper.com');
-define( 'WPIL_VERSION_NUMBER', '0.9.0');
-define( 'WPIL_PLUGIN_VERSION_NUMBER', '0.9.0');
-define( 'WPIL_PLUGIN_OLD_VERSION_NUMBER', '0.8.9');
+define( 'WPIL_VERSION_NUMBER', '0.9.1');
+define( 'WPIL_PLUGIN_VERSION_NUMBER', '0.9.1');
+define( 'WPIL_PLUGIN_OLD_VERSION_NUMBER', '0.9.0');
define( 'WP_INTERNAL_LINKING_PLUGIN_DIR', plugin_dir_path(__FILE__));
define( 'WP_INTERNAL_LINKING_PLUGIN_URL', plugin_dir_url(__FILE__));
define( 'WPIL_PLUGIN_NAME', plugin_basename( __FILE__ ));
--- a/link-whisper/templates/wpil_settings_v2.php
+++ b/link-whisper/templates/wpil_settings_v2.php
@@ -1489,7 +1489,7 @@
</td>
</tr>
<?php if(class_exists('ACF')){ ?>
- <tr>
+ <tr class="wpil-advanced-settings wpil-setting-row">
<td scope='row' class="wpil-setting-text"><?php esc_html_e('Disable Linking for Advanced Custom Fields', 'wpil'); ?></td>
<td>
<input type="hidden" name="wpil_disable_acf" value="0" />