Changeset 3787313
- Timestamp:
- 11/06/2026 06:43:40 AM (2 days ago)
- Location:
- autocontent
- Files:
-
- 4 edited
- 7 copied
-
tags/1.39 (copied) (copied from autocontent/trunk )
-
tags/1.39/autocontent-intro.php (copied) (copied from autocontent/trunk/autocontent-intro.php )
-
tags/1.39/autocontent.php (copied) (copied from autocontent/trunk/autocontent.php ) (7 diffs)
-
tags/1.39/readme.txt (copied) (copied from autocontent/trunk/readme.txt ) (2 diffs)
-
tags/1.39/script.js (copied) (copied from autocontent/trunk/script.js ) (6 diffs)
-
tags/1.39/setup-wizard.php (copied) (copied from autocontent/trunk/setup-wizard.php )
-
tags/1.39/styles.css (copied) (copied from autocontent/trunk/styles.css ) (1 diff)
-
trunk/autocontent.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/script.js (modified) (6 diffs)
-
trunk/styles.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
autocontent/tags/1.39/autocontent.php
r3787274 r3787313 5 5 * Plugin URI: https://autocontent.com/about/ 6 6 * Description: The simplest solution for automating content creation on WordPress. 7 * Version: 1.3 87 * Version: 1.39 8 8 * Requires at least: 6.5 9 9 * Requires PHP: 8.2 … … 592 592 if ($frequency === 'monthly') { 593 593 echo '<span id="current-plan-text" style="vertical-align: sub; padding">Free (Monthly Blog Posts)</span>'; 594 echo '<button id="upgrade_button" type="button" class="button button-secondary"> Upgrade</button>';594 echo '<button id="upgrade_button" type="button" class="button button-secondary">' . esc_html__('Upgrade to Premium', 'autocontent') . ' <span aria-hidden="true">→</span></button>'; 595 595 } elseif ($frequency === 'daily') { 596 596 echo esc_html('Autocontent Premium (Daily Blog Posts)'); … … 1127 1127 if (empty($keywords) || empty($subject)) { 1128 1128 autocontent_log_error_message('Keywords and subject are required. Cannot make API call'); 1129 return ;1129 return new WP_Error('autocontent_settings', __('Add a subject and at least one keyword, then click Save Changes before generating a post.', 'autocontent')); 1130 1130 } 1131 1131 // Prepare the POST data … … 1162 1162 if (is_wp_error($response)) { 1163 1163 autocontent_log_error_message('API request error: ' . $response->get_error_message()); 1164 return ;1164 return new WP_Error('autocontent_unreachable', __('Could not reach the Autocontent service. Please try again in a few minutes.', 'autocontent')); 1165 1165 } 1166 1166 … … 1222 1222 } 1223 1223 } else { 1224 // Handle errors 1224 // Handle errors: turn the API's answer into a message the user can act on. 1225 1225 autocontent_log_error_message('API request error: ' . $body); 1226 return new WP_Error('autocontent_api', autocontent_api_error_message($data)); 1226 1227 } 1227 1228 … … 1388 1389 1389 1390 // Function to hand generating post manually 1391 /** 1392 * Human-readable message for a failed generate request. 1393 */ 1394 function autocontent_api_error_message($data) { 1395 $error = is_array($data) && !empty($data['error']) ? (string) $data['error'] : ''; 1396 if (strpos($error, 'doesUserHaveEnoughCredits') !== false) { 1397 return __('You are out of WriteNow credits. Your scheduled posts will continue as normal.', 'autocontent'); 1398 } 1399 if (strpos($error, 'subscriptionInactive') !== false) { 1400 return __('Your Autocontent Premium subscription has ended. Renew at autocontent.com to keep your daily posts and WriteNow credits.', 'autocontent'); 1401 } 1402 if (strpos($error, 'isValidActivationKey') !== false || strpos($error, 'isValidWebsiteOrigin') !== false) { 1403 return __('Your activation key could not be verified for this site. Re-enter your key under Upgrade, then try again.', 'autocontent'); 1404 } 1405 if ($error !== '' && strpos($error, 'Unauthorized') === false) { 1406 return $error; 1407 } 1408 return __('Post generation failed. No credit was used. Please try again in a few minutes.', 'autocontent'); 1409 } 1410 1390 1411 function autocontent_generate_post_now_callback() { 1391 1412 autocontent_log_error_message('AJAX call: autocontent_generate_post_now_callback'); … … 1402 1423 $post_id = autocontent($callType); 1403 1424 // Check if the post was created successfully and get the post URL 1404 if (!is_wp_error($post_id)) { 1425 if (is_wp_error($post_id)) { 1426 autocontent_log_error_message('Error generating post: ' . $post_id->get_error_message()); 1427 wp_send_json_error(array('message' => $post_id->get_error_message())); 1428 } elseif (empty($post_id)) { 1429 autocontent_log_error_message('Error generating post: no post created.'); 1430 wp_send_json_error(array('message' => __('Post generation failed. Please try again in a few minutes.', 'autocontent'))); 1431 } else { 1405 1432 $post_url = get_permalink($post_id); 1433 autocontent_log_error_message("Post generated successfully. Post ID: $post_id, Post URL: $post_url"); 1406 1434 wp_send_json_success(array('post_url' => $post_url)); 1407 autocontent_log_error_message("Post generated successfully. Post ID: $post_id, Post URL: $post_url");1408 } else {1409 autocontent_log_error_message('Error generating post.');1410 wp_send_json_error('Error generating post');1411 1412 1435 } 1413 1436 } -
autocontent/tags/1.39/readme.txt
r3787274 r3787313 4 4 Requires at least: 6.5 5 5 Tested up to: 7.1 6 Stable tag: 1.3 86 Stable tag: 1.39 7 7 Requires PHP: 8.2 8 8 License: GPLv2 or later … … 71 71 == Changelog == 72 72 73 = 1.39 = 74 * New "Upgrade to Premium" button on the Settings page. 75 * Generate Blog Post Now now explains why a post could not be created (for example missing keywords, no credits left, or a temporary service problem) instead of always reporting insufficient credits. 76 * Clear message when an Autocontent Premium subscription has ended, with a reminder to renew. 77 73 78 = 1.38 = 74 79 * Redesigned upgrade window: Monthly/Yearly toggle (save 25% yearly), clearer pricing and features, and a "Get Premium" button. -
autocontent/tags/1.39/script.js
r3787274 r3787313 177 177 .catch(error => { 178 178 console.error("Error verifying activation key:", error); 179 showMessageInUpgradeModal("Failed to verify activation key. Please try again.", false); 179 showMessageInUpgradeModal(error && error.message === 'Subscription inactive' 180 ? "Your Autocontent Premium subscription has ended. Renew at autocontent.com to reactivate this key." 181 : "Failed to verify activation key. Please try again.", false); 180 182 verifyButton.innerHTML = "Verify"; 181 183 verifyButton.disabled = false; … … 306 308 }); 307 309 } else { 310 if (data && data.status === 'Subscription inactive') { 311 showMessage('Your Autocontent Premium subscription has ended. Renew at autocontent.com to reactivate this key.', false); 312 throw new Error('Subscription inactive'); 313 } 308 314 showMessage('Invalid Key', false); 309 315 // showMessage('Activation Key is Invalid ✕', false); … … 320 326 .catch(error => { 321 327 console.error('Error:', error); 328 if (error && error.message === 'Subscription inactive') { 329 throw error; // keep the subscription message already shown 330 } 322 331 showMessage('Invalid Key', false); 323 332 throw new Error('Invalid Activation Key'); … … 417 426 document.getElementById('processingContainer').style.display = 'none'; 418 427 419 if (data.success ) {428 if (data.success && data.data && data.data.post_url) { 420 429 showModal(data.data.post_url); // Show success modal with the post URL 421 430 } else { 422 showModal(false ); // Show failed modal since post generationfailed431 showModal(false, data && data.data && data.data.message); // Show the reason it failed 423 432 } 424 433 }) … … 430 439 } 431 440 432 function showModal(postUrl ) {441 function showModal(postUrl, errorMessage) { 433 442 434 443 // Create the modal HTML … … 439 448 if (!postUrl) { 440 449 // If postUrl is false, show "Failed to Post" 441 modalHtml += '<p>Failed to generate post: Insufficient WriteNow credits</p>'; 450 var reason = document.createElement('span'); 451 reason.textContent = errorMessage || 'Post generation failed. Please try again in a few minutes.'; 452 modalHtml += '<p>Failed to generate post: ' + reason.innerHTML + '</p>'; 442 453 } else { 443 454 // If postUrl is valid, show success message with the link -
autocontent/tags/1.39/styles.css
r3787274 r3787313 795 795 #upgradeModal .ac-upgrade__cta:hover { transform: none; } 796 796 } 797 798 /* Upgrade button on the Settings page (1.38) */ 799 #upgrade_button.button { 800 display: inline-flex; 801 align-items: center; 802 gap: 6px; 803 margin-left: 12px; 804 padding: 0 18px; 805 min-height: 36px; 806 border: 0; 807 border-radius: 999px; 808 background: linear-gradient(135deg, #4f97ff 0%, #3d89fb 55%, #2a6fd6 100%); 809 box-shadow: 0 4px 12px rgba(61, 137, 251, 0.35); 810 color: #fff; 811 font-size: 13px; 812 font-weight: 700; 813 line-height: 36px; 814 letter-spacing: 0.01em; 815 vertical-align: middle; 816 cursor: pointer; 817 transition: transform 0.15s, box-shadow 0.15s, filter 0.15s; 818 } 819 #upgrade_button.button:hover, 820 #upgrade_button.button:focus-visible { 821 color: #fff; 822 filter: brightness(1.05); 823 box-shadow: 0 6px 16px rgba(61, 137, 251, 0.45); 824 transform: translateY(-1px); 825 outline: none; 826 } 827 #upgrade_button.button:focus-visible { box-shadow: 0 0 0 3px rgba(61, 137, 251, 0.35), 0 6px 16px rgba(61, 137, 251, 0.45); } 828 #upgrade_button.button span { transition: transform 0.15s; } 829 #upgrade_button.button:hover span { transform: translateX(2px); } 830 @media (prefers-reduced-motion: reduce) { 831 #upgrade_button.button, #upgrade_button.button span { transition: none; transform: none; } 832 } -
autocontent/trunk/autocontent.php
r3787274 r3787313 5 5 * Plugin URI: https://autocontent.com/about/ 6 6 * Description: The simplest solution for automating content creation on WordPress. 7 * Version: 1.3 87 * Version: 1.39 8 8 * Requires at least: 6.5 9 9 * Requires PHP: 8.2 … … 592 592 if ($frequency === 'monthly') { 593 593 echo '<span id="current-plan-text" style="vertical-align: sub; padding">Free (Monthly Blog Posts)</span>'; 594 echo '<button id="upgrade_button" type="button" class="button button-secondary"> Upgrade</button>';594 echo '<button id="upgrade_button" type="button" class="button button-secondary">' . esc_html__('Upgrade to Premium', 'autocontent') . ' <span aria-hidden="true">→</span></button>'; 595 595 } elseif ($frequency === 'daily') { 596 596 echo esc_html('Autocontent Premium (Daily Blog Posts)'); … … 1127 1127 if (empty($keywords) || empty($subject)) { 1128 1128 autocontent_log_error_message('Keywords and subject are required. Cannot make API call'); 1129 return ;1129 return new WP_Error('autocontent_settings', __('Add a subject and at least one keyword, then click Save Changes before generating a post.', 'autocontent')); 1130 1130 } 1131 1131 // Prepare the POST data … … 1162 1162 if (is_wp_error($response)) { 1163 1163 autocontent_log_error_message('API request error: ' . $response->get_error_message()); 1164 return ;1164 return new WP_Error('autocontent_unreachable', __('Could not reach the Autocontent service. Please try again in a few minutes.', 'autocontent')); 1165 1165 } 1166 1166 … … 1222 1222 } 1223 1223 } else { 1224 // Handle errors 1224 // Handle errors: turn the API's answer into a message the user can act on. 1225 1225 autocontent_log_error_message('API request error: ' . $body); 1226 return new WP_Error('autocontent_api', autocontent_api_error_message($data)); 1226 1227 } 1227 1228 … … 1388 1389 1389 1390 // Function to hand generating post manually 1391 /** 1392 * Human-readable message for a failed generate request. 1393 */ 1394 function autocontent_api_error_message($data) { 1395 $error = is_array($data) && !empty($data['error']) ? (string) $data['error'] : ''; 1396 if (strpos($error, 'doesUserHaveEnoughCredits') !== false) { 1397 return __('You are out of WriteNow credits. Your scheduled posts will continue as normal.', 'autocontent'); 1398 } 1399 if (strpos($error, 'subscriptionInactive') !== false) { 1400 return __('Your Autocontent Premium subscription has ended. Renew at autocontent.com to keep your daily posts and WriteNow credits.', 'autocontent'); 1401 } 1402 if (strpos($error, 'isValidActivationKey') !== false || strpos($error, 'isValidWebsiteOrigin') !== false) { 1403 return __('Your activation key could not be verified for this site. Re-enter your key under Upgrade, then try again.', 'autocontent'); 1404 } 1405 if ($error !== '' && strpos($error, 'Unauthorized') === false) { 1406 return $error; 1407 } 1408 return __('Post generation failed. No credit was used. Please try again in a few minutes.', 'autocontent'); 1409 } 1410 1390 1411 function autocontent_generate_post_now_callback() { 1391 1412 autocontent_log_error_message('AJAX call: autocontent_generate_post_now_callback'); … … 1402 1423 $post_id = autocontent($callType); 1403 1424 // Check if the post was created successfully and get the post URL 1404 if (!is_wp_error($post_id)) { 1425 if (is_wp_error($post_id)) { 1426 autocontent_log_error_message('Error generating post: ' . $post_id->get_error_message()); 1427 wp_send_json_error(array('message' => $post_id->get_error_message())); 1428 } elseif (empty($post_id)) { 1429 autocontent_log_error_message('Error generating post: no post created.'); 1430 wp_send_json_error(array('message' => __('Post generation failed. Please try again in a few minutes.', 'autocontent'))); 1431 } else { 1405 1432 $post_url = get_permalink($post_id); 1433 autocontent_log_error_message("Post generated successfully. Post ID: $post_id, Post URL: $post_url"); 1406 1434 wp_send_json_success(array('post_url' => $post_url)); 1407 autocontent_log_error_message("Post generated successfully. Post ID: $post_id, Post URL: $post_url");1408 } else {1409 autocontent_log_error_message('Error generating post.');1410 wp_send_json_error('Error generating post');1411 1412 1435 } 1413 1436 } -
autocontent/trunk/readme.txt
r3787274 r3787313 4 4 Requires at least: 6.5 5 5 Tested up to: 7.1 6 Stable tag: 1.3 86 Stable tag: 1.39 7 7 Requires PHP: 8.2 8 8 License: GPLv2 or later … … 71 71 == Changelog == 72 72 73 = 1.39 = 74 * New "Upgrade to Premium" button on the Settings page. 75 * Generate Blog Post Now now explains why a post could not be created (for example missing keywords, no credits left, or a temporary service problem) instead of always reporting insufficient credits. 76 * Clear message when an Autocontent Premium subscription has ended, with a reminder to renew. 77 73 78 = 1.38 = 74 79 * Redesigned upgrade window: Monthly/Yearly toggle (save 25% yearly), clearer pricing and features, and a "Get Premium" button. -
autocontent/trunk/script.js
r3787274 r3787313 177 177 .catch(error => { 178 178 console.error("Error verifying activation key:", error); 179 showMessageInUpgradeModal("Failed to verify activation key. Please try again.", false); 179 showMessageInUpgradeModal(error && error.message === 'Subscription inactive' 180 ? "Your Autocontent Premium subscription has ended. Renew at autocontent.com to reactivate this key." 181 : "Failed to verify activation key. Please try again.", false); 180 182 verifyButton.innerHTML = "Verify"; 181 183 verifyButton.disabled = false; … … 306 308 }); 307 309 } else { 310 if (data && data.status === 'Subscription inactive') { 311 showMessage('Your Autocontent Premium subscription has ended. Renew at autocontent.com to reactivate this key.', false); 312 throw new Error('Subscription inactive'); 313 } 308 314 showMessage('Invalid Key', false); 309 315 // showMessage('Activation Key is Invalid ✕', false); … … 320 326 .catch(error => { 321 327 console.error('Error:', error); 328 if (error && error.message === 'Subscription inactive') { 329 throw error; // keep the subscription message already shown 330 } 322 331 showMessage('Invalid Key', false); 323 332 throw new Error('Invalid Activation Key'); … … 417 426 document.getElementById('processingContainer').style.display = 'none'; 418 427 419 if (data.success ) {428 if (data.success && data.data && data.data.post_url) { 420 429 showModal(data.data.post_url); // Show success modal with the post URL 421 430 } else { 422 showModal(false ); // Show failed modal since post generationfailed431 showModal(false, data && data.data && data.data.message); // Show the reason it failed 423 432 } 424 433 }) … … 430 439 } 431 440 432 function showModal(postUrl ) {441 function showModal(postUrl, errorMessage) { 433 442 434 443 // Create the modal HTML … … 439 448 if (!postUrl) { 440 449 // If postUrl is false, show "Failed to Post" 441 modalHtml += '<p>Failed to generate post: Insufficient WriteNow credits</p>'; 450 var reason = document.createElement('span'); 451 reason.textContent = errorMessage || 'Post generation failed. Please try again in a few minutes.'; 452 modalHtml += '<p>Failed to generate post: ' + reason.innerHTML + '</p>'; 442 453 } else { 443 454 // If postUrl is valid, show success message with the link -
autocontent/trunk/styles.css
r3787274 r3787313 795 795 #upgradeModal .ac-upgrade__cta:hover { transform: none; } 796 796 } 797 798 /* Upgrade button on the Settings page (1.38) */ 799 #upgrade_button.button { 800 display: inline-flex; 801 align-items: center; 802 gap: 6px; 803 margin-left: 12px; 804 padding: 0 18px; 805 min-height: 36px; 806 border: 0; 807 border-radius: 999px; 808 background: linear-gradient(135deg, #4f97ff 0%, #3d89fb 55%, #2a6fd6 100%); 809 box-shadow: 0 4px 12px rgba(61, 137, 251, 0.35); 810 color: #fff; 811 font-size: 13px; 812 font-weight: 700; 813 line-height: 36px; 814 letter-spacing: 0.01em; 815 vertical-align: middle; 816 cursor: pointer; 817 transition: transform 0.15s, box-shadow 0.15s, filter 0.15s; 818 } 819 #upgrade_button.button:hover, 820 #upgrade_button.button:focus-visible { 821 color: #fff; 822 filter: brightness(1.05); 823 box-shadow: 0 6px 16px rgba(61, 137, 251, 0.45); 824 transform: translateY(-1px); 825 outline: none; 826 } 827 #upgrade_button.button:focus-visible { box-shadow: 0 0 0 3px rgba(61, 137, 251, 0.35), 0 6px 16px rgba(61, 137, 251, 0.45); } 828 #upgrade_button.button span { transition: transform 0.15s; } 829 #upgrade_button.button:hover span { transform: translateX(2px); } 830 @media (prefers-reduced-motion: reduce) { 831 #upgrade_button.button, #upgrade_button.button span { transition: none; transform: none; } 832 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)