Changeset 3400142
- Timestamp:
- 11/21/2025 02:47:14 AM (4 months ago)
- Location:
- writetext-ai
- Files:
-
- 258 added
- 8 edited
-
tags/3.5.10 (added)
-
tags/3.5.10/CHANGELOG.md (added)
-
tags/3.5.10/assets (added)
-
tags/3.5.10/assets/css (added)
-
tags/3.5.10/assets/css/admin-category.css (added)
-
tags/3.5.10/assets/css/admin-common.css (added)
-
tags/3.5.10/assets/css/admin-installation.css (added)
-
tags/3.5.10/assets/css/admin-installed.css (added)
-
tags/3.5.10/assets/css/admin.css (added)
-
tags/3.5.10/assets/css/tooltipster.bundle.min.css (added)
-
tags/3.5.10/assets/images (added)
-
tags/3.5.10/assets/images/active_check.png (added)
-
tags/3.5.10/assets/images/active_check_black.svg (added)
-
tags/3.5.10/assets/images/arrow-dotted-up-blue.png (added)
-
tags/3.5.10/assets/images/arrow-dotted-up-gray.png (added)
-
tags/3.5.10/assets/images/banner-img-box.png (added)
-
tags/3.5.10/assets/images/banner-img-lock.png (added)
-
tags/3.5.10/assets/images/banner-img-popper.png (added)
-
tags/3.5.10/assets/images/btn-closePopup.svg (added)
-
tags/3.5.10/assets/images/bulk-check-ico.png (added)
-
tags/3.5.10/assets/images/button_next.png (added)
-
tags/3.5.10/assets/images/calendar-icon.png (added)
-
tags/3.5.10/assets/images/calendar.png (added)
-
tags/3.5.10/assets/images/check_setup.png (added)
-
tags/3.5.10/assets/images/close-icon-black.svg (added)
-
tags/3.5.10/assets/images/close-icon-blue.svg (added)
-
tags/3.5.10/assets/images/close-icon.svg (added)
-
tags/3.5.10/assets/images/close-key-word.png (added)
-
tags/3.5.10/assets/images/eva_diagonal-arrow-right-up-outline.svg (added)
-
tags/3.5.10/assets/images/ic-arrow-head-blue.png (added)
-
tags/3.5.10/assets/images/ic-arrow-head-gray.png (added)
-
tags/3.5.10/assets/images/ic-button-arrow-down.png (added)
-
tags/3.5.10/assets/images/ic-check-white.png (added)
-
tags/3.5.10/assets/images/ic-check.png (added)
-
tags/3.5.10/assets/images/ic-close-grayish.png (added)
-
tags/3.5.10/assets/images/ic-close.png (added)
-
tags/3.5.10/assets/images/ic-dotted-line-blue.png (added)
-
tags/3.5.10/assets/images/ic-dotted-line-gray.png (added)
-
tags/3.5.10/assets/images/ic-down-arrow-red.png (added)
-
tags/3.5.10/assets/images/ic-down-arrow-white.svg (added)
-
tags/3.5.10/assets/images/ic-down-arrow.svg (added)
-
tags/3.5.10/assets/images/ic-failed-notice.png (added)
-
tags/3.5.10/assets/images/ic-filter-triangle-white.png (added)
-
tags/3.5.10/assets/images/ic-filter-triangle.png (added)
-
tags/3.5.10/assets/images/ic-lock-locked.png (added)
-
tags/3.5.10/assets/images/ic-lock-unlocked.png (added)
-
tags/3.5.10/assets/images/ic-pencil-white.png (added)
-
tags/3.5.10/assets/images/ic-pencil.png (added)
-
tags/3.5.10/assets/images/ic-restore.png (added)
-
tags/3.5.10/assets/images/ic-star-blue.svg (added)
-
tags/3.5.10/assets/images/ic-star-white.svg (added)
-
tags/3.5.10/assets/images/ic-straight-line-blue.png (added)
-
tags/3.5.10/assets/images/ic-trash-white.png (added)
-
tags/3.5.10/assets/images/ic-trash.png (added)
-
tags/3.5.10/assets/images/ic-up-arrow-green.png (added)
-
tags/3.5.10/assets/images/ic-wt-platform-menu-active.svg (added)
-
tags/3.5.10/assets/images/ic-wt-platform-menu.svg (added)
-
tags/3.5.10/assets/images/ic_add.svg (added)
-
tags/3.5.10/assets/images/ic_arrow_down_pop.svg (added)
-
tags/3.5.10/assets/images/ic_arrow_tl_default.svg (added)
-
tags/3.5.10/assets/images/ic_arrow_tl_hover.svg (added)
-
tags/3.5.10/assets/images/ic_baseline-plus.png (added)
-
tags/3.5.10/assets/images/ic_caret_down.png (added)
-
tags/3.5.10/assets/images/ic_check_blue.svg (added)
-
tags/3.5.10/assets/images/ic_check_purple.png (added)
-
tags/3.5.10/assets/images/ic_chev_down.png (added)
-
tags/3.5.10/assets/images/ic_circle_check_blue.svg (added)
-
tags/3.5.10/assets/images/ic_country.svg (added)
-
tags/3.5.10/assets/images/ic_country_selected.svg (added)
-
tags/3.5.10/assets/images/ic_dropdown.svg (added)
-
tags/3.5.10/assets/images/ic_dropdown_blue.svg (added)
-
tags/3.5.10/assets/images/ic_fact_check.svg (added)
-
tags/3.5.10/assets/images/ic_kw-arrow.png (added)
-
tags/3.5.10/assets/images/ic_outline-close.png (added)
-
tags/3.5.10/assets/images/ic_outline-close.svg (added)
-
tags/3.5.10/assets/images/ic_outline-filter-list.svg (added)
-
tags/3.5.10/assets/images/ic_popup_ongoing.svg (added)
-
tags/3.5.10/assets/images/ic_premium.svg (added)
-
tags/3.5.10/assets/images/ic_premium_blue.svg (added)
-
tags/3.5.10/assets/images/ic_rewrite.svg (added)
-
tags/3.5.10/assets/images/ic_round-close.svg (added)
-
tags/3.5.10/assets/images/ic_substract.svg (added)
-
tags/3.5.10/assets/images/ic_thumb.png (added)
-
tags/3.5.10/assets/images/ic_thumbs_down.svg (added)
-
tags/3.5.10/assets/images/ic_thumbs_down_fill.svg (added)
-
tags/3.5.10/assets/images/ic_thumbs_up.svg (added)
-
tags/3.5.10/assets/images/ic_thumbs_up_fill.svg (added)
-
tags/3.5.10/assets/images/ic_transfer.svg (added)
-
tags/3.5.10/assets/images/ic_writetext_menu_wp.svg (added)
-
tags/3.5.10/assets/images/ic_writetext_platform_menu.svg (added)
-
tags/3.5.10/assets/images/icon-park-solid_check-one.svg (added)
-
tags/3.5.10/assets/images/iconamoon_trash.png (added)
-
tags/3.5.10/assets/images/iconamoon_trash_blur.png (added)
-
tags/3.5.10/assets/images/loader.gif (added)
-
tags/3.5.10/assets/images/loader_cursor.gif (added)
-
tags/3.5.10/assets/images/loader_writetext.gif (added)
-
tags/3.5.10/assets/images/logo_writetext.svg (added)
-
tags/3.5.10/assets/images/lucide_wand.svg (added)
-
tags/3.5.10/assets/images/material-symbols_history.svg (added)
-
tags/3.5.10/assets/images/mdi_external-link.svg (added)
-
tags/3.5.10/assets/images/new-version-banner.png (added)
-
tags/3.5.10/assets/images/ph_list-magnifying-glass-bold.svg (added)
-
tags/3.5.10/assets/images/ph_star-fill.svg (added)
-
tags/3.5.10/assets/images/product-research.png (added)
-
tags/3.5.10/assets/images/ranked-serp-icon.png (added)
-
tags/3.5.10/assets/images/refresh.svg (added)
-
tags/3.5.10/assets/images/serp-link-ico.png (added)
-
tags/3.5.10/assets/images/solid_ranking-star.svg (added)
-
tags/3.5.10/assets/images/sort-ico-1.png (added)
-
tags/3.5.10/assets/images/sort-ico-2.png (added)
-
tags/3.5.10/assets/images/sort-ico-active.png (added)
-
tags/3.5.10/assets/images/spinner-1s-20px-bgwhite.gif (added)
-
tags/3.5.10/assets/images/spinner-1s-20px.gif (added)
-
tags/3.5.10/assets/images/toggle-arrow.png (added)
-
tags/3.5.10/assets/images/tooltip-arrow.svg (added)
-
tags/3.5.10/assets/images/tooltip-icon.png (added)
-
tags/3.5.10/assets/images/v2-banner-stars.svg (added)
-
tags/3.5.10/assets/images/v2-banner.png (added)
-
tags/3.5.10/assets/images/warning-icon.png (added)
-
tags/3.5.10/assets/images/warning-icon.svg (added)
-
tags/3.5.10/assets/images/woocommerce-placeholder-150x150.png (added)
-
tags/3.5.10/assets/images/writetext_logo.png (added)
-
tags/3.5.10/assets/images/xbutton.svg (added)
-
tags/3.5.10/assets/js (added)
-
tags/3.5.10/assets/js/admin-category.js (added)
-
tags/3.5.10/assets/js/admin-common-functions.js (added)
-
tags/3.5.10/assets/js/admin-common.js (added)
-
tags/3.5.10/assets/js/admin-feedback.js (added)
-
tags/3.5.10/assets/js/admin-filter.js (added)
-
tags/3.5.10/assets/js/admin-installation.js (added)
-
tags/3.5.10/assets/js/admin-installed.js (added)
-
tags/3.5.10/assets/js/admin-keywords.js (added)
-
tags/3.5.10/assets/js/admin-setting.js (added)
-
tags/3.5.10/assets/js/admin-streaming.js (added)
-
tags/3.5.10/assets/js/signalr.min.js (added)
-
tags/3.5.10/assets/js/sortable.min.js (added)
-
tags/3.5.10/assets/js/tooltipster.bundle.min.js (added)
-
tags/3.5.10/assets/lib (added)
-
tags/3.5.10/assets/lib/images (added)
-
tags/3.5.10/assets/lib/images/ui-bg_flat_0_888888_40x100.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_flat_0_aaaaaa_40x100.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_flat_75_ffffff_40x100.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_25_e1f0f5_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_55_444444_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_65_ffffff_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_75_dadada_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
tags/3.5.10/assets/lib/images/ui-bg_inset-soft_95_fef1ec_1x100.png (added)
-
tags/3.5.10/assets/lib/images/ui-icons_222222_256x240.png (added)
-
tags/3.5.10/assets/lib/images/ui-icons_309bbf_256x240.png (added)
-
tags/3.5.10/assets/lib/images/ui-icons_454545_256x240.png (added)
-
tags/3.5.10/assets/lib/images/ui-icons_bf3030_256x240.png (added)
-
tags/3.5.10/assets/lib/images/ui-icons_ffffff_256x240.png (added)
-
tags/3.5.10/assets/lib/jquery-ui.css (added)
-
tags/3.5.10/assets/lib/selectize.bootstrap3.min.css (added)
-
tags/3.5.10/assets/lib/selectize.default.css (added)
-
tags/3.5.10/assets/lib/selectize.min.js (added)
-
tags/3.5.10/gnu.org_licenses_gpl-3.0.txt (added)
-
tags/3.5.10/includes (added)
-
tags/3.5.10/includes/class-wtai-api-services.php (added)
-
tags/3.5.10/includes/class-wtai-auto-transfer.php (added)
-
tags/3.5.10/includes/class-wtai-bulk-transfer.php (added)
-
tags/3.5.10/includes/class-wtai-cron.php (added)
-
tags/3.5.10/includes/class-wtai-global-settings.php (added)
-
tags/3.5.10/includes/class-wtai-init.php (added)
-
tags/3.5.10/includes/class-wtai-installation.php (added)
-
tags/3.5.10/includes/class-wtai-product-category-list-table.php (added)
-
tags/3.5.10/includes/class-wtai-product-category.php (added)
-
tags/3.5.10/includes/class-wtai-product-dashboard.php (added)
-
tags/3.5.10/includes/class-wtai-product-keyword.php (added)
-
tags/3.5.10/includes/class-wtai-product-list-table.php (added)
-
tags/3.5.10/includes/class-wtai-product-single.php (added)
-
tags/3.5.10/includes/class-wtai-rest.php (added)
-
tags/3.5.10/includes/class-wtai-transfer.php (added)
-
tags/3.5.10/includes/functions.php (added)
-
tags/3.5.10/languages (added)
-
tags/3.5.10/languages/writetext-ai.pot (added)
-
tags/3.5.10/readme.txt (added)
-
tags/3.5.10/templates (added)
-
tags/3.5.10/templates/admin (added)
-
tags/3.5.10/templates/admin/bulk-full-automation-modal.php (added)
-
tags/3.5.10/templates/admin/bulk-generate-modal.php (added)
-
tags/3.5.10/templates/admin/bulk-keyword-analysis-modal.php (added)
-
tags/3.5.10/templates/admin/bulk-modal-guide.php (added)
-
tags/3.5.10/templates/admin/category.php (added)
-
tags/3.5.10/templates/admin/dashboard-category.php (added)
-
tags/3.5.10/templates/admin/dashboard.php (added)
-
tags/3.5.10/templates/admin/first-visit-notice.php (added)
-
tags/3.5.10/templates/admin/footer-mobile.php (added)
-
tags/3.5.10/templates/admin/footer.php (added)
-
tags/3.5.10/templates/admin/freemium-badge.php (added)
-
tags/3.5.10/templates/admin/freemium-popup.php (added)
-
tags/3.5.10/templates/admin/generate-feedback.php (added)
-
tags/3.5.10/templates/admin/grid-filter.php (added)
-
tags/3.5.10/templates/admin/install.php (added)
-
tags/3.5.10/templates/admin/intent-tooltip.php (added)
-
tags/3.5.10/templates/admin/keyword-cannibalization-splash.php (added)
-
tags/3.5.10/templates/admin/metabox (added)
-
tags/3.5.10/templates/admin/metabox/ads.php (added)
-
tags/3.5.10/templates/admin/metabox/bulk-trigger-actions.php (added)
-
tags/3.5.10/templates/admin/metabox/bulk-trigger-rewrite-fields.php (added)
-
tags/3.5.10/templates/admin/metabox/category-filter.php (added)
-
tags/3.5.10/templates/admin/metabox/category-image.php (added)
-
tags/3.5.10/templates/admin/metabox/category-product-list-dropdown.php (added)
-
tags/3.5.10/templates/admin/metabox/category-representative-products.php (added)
-
tags/3.5.10/templates/admin/metabox/filter.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-locale.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-optimization-settings.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-cbp-content-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-cbp-footer-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-cbp-header-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-custom-content-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-custom-footer-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-custom-header-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-ranking-keyword-header-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-ranking-keywords-content-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/cluster-ranking-keywords-footer-part.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/clusters-swappable.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/clusters.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/delete-confirmation.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/error-message.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/keyword-more-data.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/keyword-pool-more-data-single.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/keyword-pool-more-data.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/loader.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/pool.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/trigger-action-options.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword-pipeline/trigger-action.php (added)
-
tags/3.5.10/templates/admin/metabox/keyword.php (added)
-
tags/3.5.10/templates/admin/metabox/keywords-serp.php (added)
-
tags/3.5.10/templates/admin/metabox/popin-history.php (added)
-
tags/3.5.10/templates/admin/metabox/popin-keyword.php (added)
-
tags/3.5.10/templates/admin/metabox/premium-modal.php (added)
-
tags/3.5.10/templates/admin/metabox/premium.php (added)
-
tags/3.5.10/templates/admin/metabox/restart-ko-popup.php (added)
-
tags/3.5.10/templates/admin/metabox/search-intent-notice.php (added)
-
tags/3.5.10/templates/admin/metabox/time-transfer-settings.php (added)
-
tags/3.5.10/templates/admin/post.php (added)
-
tags/3.5.10/templates/admin/settings.php (added)
-
tags/3.5.10/templates/admin/single-edit-progress-bar.php (added)
-
tags/3.5.10/templates/admin/submit-review.php (added)
-
tags/3.5.10/templates/admin/translation-ongoing.php (added)
-
tags/3.5.10/templates/admin/v2-banners (added)
-
tags/3.5.10/templates/admin/v2-banners/bulk-modal-guide.php (added)
-
tags/3.5.10/templates/admin/v2-banners/enterprise-unlocked.php (added)
-
tags/3.5.10/templates/admin/v2-banners/free-to-freemium.php (added)
-
tags/3.5.10/templates/admin/v2-banners/free-to-premium.php (added)
-
tags/3.5.10/templates/admin/v2-banners/free-trial-no-credits.php (added)
-
tags/3.5.10/templates/admin/v2-banners/free-trial-no-pro-access.php (added)
-
tags/3.5.10/templates/admin/v2-banners/free-trial-pro-access.php (added)
-
tags/3.5.10/templates/admin/v2-banners/professional-unlocked.php (added)
-
tags/3.5.10/templates/admin/v2-banners/starter-unlocked.php (added)
-
tags/3.5.10/templates/admin/v2-banners/welcome-v2.php (added)
-
tags/3.5.10/writetext-ai.php (added)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/assets/js/admin-common.js (modified) (1 diff)
-
trunk/includes/class-wtai-product-dashboard.php (modified) (1 diff)
-
trunk/includes/class-wtai-rest.php (modified) (4 diffs)
-
trunk/includes/functions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/templates/admin/install.php (modified) (1 diff)
-
trunk/writetext-ai.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
writetext-ai/trunk/CHANGELOG.md
r3391599 r3400142 9 9 The format is based on [Keep a Changelog](http://keepachangelog.com/) 10 10 and this project adheres to [Semantic Versioning](http://semver.org/). 11 12 ## [3.5.10] - 2025-11-21 13 14 ### Changed 15 16 – Update the rest endpoint rate limit expiration date and time checking. 11 17 12 18 ## [3.5.9] - 2025-11-07 -
writetext-ai/trunk/assets/js/admin-common.js
r3391655 r3400142 10 10 ); 11 11 12 console.log('WriteText.ai - Version: [3.5. 9] - 2025-11-07 - 3');12 console.log('WriteText.ai - Version: [3.5.10] - 2025-11-21 - 1'); 13 13 14 14 jQuery( document ).ready( function( $ ){ -
writetext-ai/trunk/includes/class-wtai-product-dashboard.php
r3391599 r3400142 8396 8396 if ( $set_welcome_banner ) { 8397 8397 $current_version = wtai_get_version( true ); 8398 // Remove the last character from the current version. 8399 $current_version = substr( $current_version, 0, -2 ); 8398 8399 $current_version_array = explode( '.', $current_version ); 8400 $current_version = $current_version_array[0] . '.' . $current_version_array[1]; 8401 8400 8402 $current_version_slug = str_replace( '.', '_', $current_version ); 8401 8403 -
writetext-ai/trunk/includes/class-wtai-rest.php
r3391655 r3400142 218 218 $do_logging = $this->is_logging_enabled(); 219 219 220 // Check rate limit. 221 $rate_limit_check = $this->check_rate_limit(); 222 if ( is_wp_error( $rate_limit_check ) ) { 223 return $rate_limit_check; 224 } 225 220 226 // Get Authorization header. 221 227 $auth_header = $request->get_header( 'Authorization' ); … … 326 332 if ( ! is_ssl() && ! wtai_is_development_environment() ) { 327 333 return new WP_Error( 'wtai_https_required', 'HTTPS required for API access.', array( 'status' => 403 ) ); 328 }329 330 // Check rate limit.331 $rate_limit_check = $this->check_rate_limit( $consumer_key );332 if ( is_wp_error( $rate_limit_check ) ) {333 return $rate_limit_check;334 334 } 335 335 … … 431 431 /** 432 432 * Check rate limit 433 * 434 * @param string $consumer_key Consumer key. 435 */ 436 private function check_rate_limit( $consumer_key ) { 433 */ 434 private function check_rate_limit() { 437 435 $rate_limit_per_hour = apply_filters( 'wtai_rest_api_rate_limit_per_hour', 10000 ); // 10000 requests per hour by default. 438 436 439 $transient_key = 'wtai_rest_api_rate_limit_' . md5( $consumer_key ); 440 $requests = intval( get_transient( $transient_key ) ); 441 442 if ( $requests > $rate_limit_per_hour ) { 443 return new WP_Error( 'wtai_rate_limit_exceeded', 'Rate limit exceeded.', array( 'status' => 429 ) ); 444 } 445 446 set_transient( $transient_key, $requests + 1, HOUR_IN_SECONDS ); 437 // Validate the rate limit value - ensure it's a positive integer. 438 $rate_limit_per_hour = absint( $rate_limit_per_hour ); 439 if ( $rate_limit_per_hour <= 0 ) { 440 // Fallback to default if filter returns invalid value. 441 $rate_limit_per_hour = 10000; 442 } 443 444 // Get client IP address. 445 $client_ip = $this->get_client_ip(); 446 447 $transient_key = 'wtai_rest_api_rate_limit_' . md5( $client_ip ); 448 449 // Calculate fixed expiration for current hour (prevents sliding window issue). 450 $current_time = time(); 451 $current_hour = floor( $current_time / 3600 ); // Which hour are we in? 452 $expiration_time = ( $current_hour + 1 ) * 3600; // Expires at start of next hour. 453 $time_until_expiration = $expiration_time - $current_time; 454 455 // Get current count. 456 $requests = get_transient( $transient_key ); 457 458 // Check if we're in a new time bucket (transient expired or different bucket). 459 $transient_timeout_key = '_transient_timeout_' . $transient_key; 460 $existing_expiration = get_option( $transient_timeout_key, 0 ); 461 $existing_expiration = intval( $existing_expiration ); 462 463 // If expired or in a new bucket, reset counter and clear old transient. 464 if ( false === $requests || $existing_expiration < $current_time || $existing_expiration > $expiration_time ) { 465 // Clear the expired transient value and timeout. 466 if ( false !== $requests || $existing_expiration > 0 ) { 467 delete_transient( $transient_key ); 468 } 469 $requests = 0; 470 } else { 471 $requests = intval( $requests ); 472 } 473 474 // Debug logging. 475 if ( $this->is_logging_enabled() ) { 476 $this->log( 477 'Rate limit check - Key: ' . substr( $consumer_key, -7 ) . ', Requests: ' . $requests . ', Limit: ' . $rate_limit_per_hour . ', Expires in: ' . round( $time_until_expiration / 60, 1 ) . ' minutes', 478 $this->log_file 479 ); 480 } 481 482 if ( $requests >= $rate_limit_per_hour ) { 483 return new WP_Error( 484 'wtai_rate_limit_exceeded', 485 'Rate limit exceeded. Rate limit per hour is set to ' . $rate_limit_per_hour . ' requests.', 486 array( 'status' => 429 ) 487 ); 488 } 489 490 // Create a unique request identifier to prevent double counting. 491 // Use URI + method + consumer key + current second (less precise but more compatible). 492 $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended 493 $request_method = isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended 494 $request_id = md5( $client_ip . $request_uri . $request_method . $current_time ); 495 496 // Use static variable to track if we've already incremented for this request. 497 static $incremented_requests = array(); 498 499 // Only increment once per unique request (within the same second). 500 if ( ! isset( $incremented_requests[ $request_id ] ) ) { 501 set_transient( $transient_key, $requests + 1, $time_until_expiration ); 502 $incremented_requests[ $request_id ] = true; 503 504 // Clean up old entries to prevent memory buildup (keep last 1000). 505 if ( count( $incremented_requests ) > 1000 ) { 506 $incremented_requests = array_slice( $incremented_requests, -500, null, true ); 507 } 508 } 447 509 448 510 return true; … … 1682 1744 return $is_valid_page; 1683 1745 } 1746 1747 /** 1748 * Get client IP address. 1749 */ 1750 private function get_client_ip() { 1751 $ip = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : ''; 1752 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 1753 $ip = isset( $_SERVER['HTTP_CLIENT_IP'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ) ) : ''; 1754 } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 1755 $ip = isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) : ''; 1756 } 1757 $ips = explode( ',', $ip ); 1758 1759 return $ips[0]; 1760 } 1684 1761 } 1685 1762 -
writetext-ai/trunk/includes/functions.php
r3391599 r3400142 8994 8994 } 8995 8995 8996 // Remove the last character from the current version.8997 $current_version = substr( $current_version, 0, -2 );8996 $current_version_array = explode( '.', $current_version ); 8997 $current_version = $current_version_array[0] . '.' . $current_version_array[1]; 8998 8998 8999 8999 $current_version_slug = str_replace( '.', '_', $current_version ); -
writetext-ai/trunk/readme.txt
r3393313 r3400142 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8.3 6 Stable tag: 3.5. 96 Stable tag: 3.5.10 7 7 Requires PHP: 7.4 8 8 License: GPLv3 or later … … 198 198 199 199 == Changelog == 200 201 = 3.5.10 2025-11-21 = 202 203 * Update – Update the rest endpoint rate limit expiration date and time checking. 200 204 201 205 = 3.5.9 2025-11-07 = … … 489 493 == Upgrade Notice == 490 494 491 = 3.5. 9=495 = 3.5.10 = 492 496 493 497 Please upgrade, to ensure all plugin features works as expected. -
writetext-ai/trunk/templates/admin/install.php
r3391599 r3400142 34 34 35 35 $current_version = wtai_get_version( true ); 36 // Remove the last character from the current version. 37 $current_version = substr( $current_version, 0, -2 ); 36 37 $current_version_array = explode( '.', $current_version ); 38 $current_version = $current_version_array[0] . '.' . $current_version_array[1]; 39 38 40 $current_version_slug = str_replace( '.', '_', $current_version ); 39 41 -
writetext-ai/trunk/writetext-ai.php
r3391599 r3400142 4 4 * Plugin URI: https://writetext.ai/woocommerce 5 5 * Description: Let AI automatically generate product descriptions and other content from your product data. 6 * Version: 3.5. 96 * Version: 3.5.10 7 7 * Author: 1902 Software 8 8 * Author URI: https://writetext.ai/ … … 52 52 53 53 if ( ! defined( 'WTAI_VERSION' ) ) { 54 define( 'WTAI_VERSION', '3.5. 9' );54 define( 'WTAI_VERSION', '3.5.10' ); 55 55 } 56 56 … … 360 360 // Reset succeeding plugin flags. 361 361 $current_version = wtai_get_version( true ); 362 // Remove the last character from the current version. 363 $current_version = substr( $current_version, 0, -2 ); 362 363 $current_version_array = explode( '.', $current_version ); 364 $current_version = $current_version_array[0] . '.' . $current_version_array[1]; 365 364 366 $current_version_slug = str_replace( '.', '_', $current_version ); 365 367
Note: See TracChangeset
for help on using the changeset viewer.