=== Fetchub === Contributors: unioney Author link: https://unioney.com Plugin's link: https://fetchub.com Tags: AI, RSS, feed, aggregator, translator Requires at least: 6.0 Tested up to: 6.8 Stable tag: 1.2 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Fetch, translate, and publish RSS feeds automatically using AI-powered processing with a robust per-feed cron scheduling system. == Description == Fetchub is an advanced WordPress plugin that automates the aggregation, translation, and publication of RSS feeds. It fetches feed items, detects their language, and translates them into a target language using AI providers such as OpenAI, Gemini, Claude, and Grok. With features like AI-driven content ranking, customizable cron intervals per feed, and an intuitive admin interface, Fetchub streamlines content management. The plugin requires a valid token for full functionality, offering new users a 3-day trial to explore its capabilities, and costs only **$1 per month** thereafter. ### Key Features - **AI-Powered Translation:** Translate feed content using OpenAI, Gemini, Claude, or Grok with support for over 90 languages. - **Content Ranking:** AI evaluates and ranks feed items by importance using the `ai_rank_importance` function. - **Custom Cron Scheduling:** Set unique fetching intervals per feed (e.g., every X minutes) via WP-Cron. **1.2 adds dynamic registration of minute schedules** like `every_{N}_minutes` based on your feeds, and ensures a **weekly** schedule is always available. - **Cron Jobs Panel (NEW):** From the admin page, list only Fetchub’s cron events and **Run now**, **Delete**, or **Reschedule** per feed (nonce-protected). - **Manual Fetching:** Trigger instant feed updates via AJAX with buttons for individual or all feeds. **1.2 hardens “Instant fetch”** to prevent double-click races, queue a one-shot run, and ensure the recurring event exists. - **Stop All Feeds (Improved):** Halt all active feed requests to manage server resources. **1.2** adds a global pause flag, does **not** flip row enabled/disabled states, and sends a short-lived **kill-switch** for any job already running. - **Feed Configuration:** Define intervals, categories, maximum posts, AI models, temperature, custom prompts, target languages, and block words per feed. - **Smart Logic / Duplicate control:** Enable AI-driven ranking to prioritize high-value content and use **semantic duplicate detection** and guard rails to avoid republishing similar stories. - **Featured Image Support:** Automatically fetches and sets featured images from feeds or linked pages. - **Export/Import Settings:** Backup and restore settings as JSON files for easy migration. **After import, 1.2 automatically re-schedules all feeds** (no manual cleanup). - **Token System:** Requires activation with a valid token; includes a 3-day trial for new users. **Admin header shows “Token active” and precise Expires date/time** in your site timezone. - **Revoke Token:** Deactivate the token for use on another site. - **Secure Design:** Uses nonces for AJAX requests and adheres to WordPress coding standards. **1.2 adds a license gate** that blocks all Fetchub AJAX/cron when the token is invalid/expired. - **Logs UI (Improved):** Cleaner, collapsible list with proper timezone handling; works with legacy `time` strings and new GMT timestamps. - **Post Status Options:** Publish posts as "publish" or "draft" by default. - **Feed URL & Fetched URL Columns:** Displays both the source feed and the original fetched link in the WordPress posts list. ### Supported AI Models - **OpenAI:** - GPT-5 (gpt-5) - GPT-5 mini (gpt-5-mini) - GPT-5 nano (gpt-5-nano) - GPT-4.1 (gpt-4.1) - GPT-4.1 mini (gpt-4.1-mini) - GPT-4.1 nano (gpt-4.1-nano) - GPT-4o (gpt-4o) - GPT-4o mini (gpt-4o-mini) - o3 mini (o3-mini) - o1 (o1) - o1 mini (o1-mini) - GPT-3.5 turbo (gpt-3.5-turbo) - **Gemini:** - Gemini 2.5 Pro (gemini-2.5-pro) - Gemini 2.5 Flash (gemini-2.5-flash) - Gemini 2.5 Flash-Lite (gemini-2.5-flash-lite) - Gemini 2.0 Flash (gemini-2.0-flash) - Gemini 2.0 Flash Lite (gemini-2.0-flash-lite) - **Claude (newest → older):** - Claude Opus 4.1 (claude-opus-4-1-20250805) - Claude Opus 4 (claude-opus-4-20250514) - Claude Sonnet 4 (claude-sonnet-4-20250514) - Claude 3.7 Sonnet (claude-3-7-sonnet-20250219) - Claude 3.5 Haiku (claude-3-5-haiku-20241022) - **Grok:** - Grok 4 (grok-4) - Grok 3 (grok-3) - Grok 3 mini (grok-3-mini) #### Deprecated / Unsupported models These models are no longer available from supported providers and are removed from the default picker: - Claude 3.5 Sonnet (claude-3-5-sonnet-20241022) — Unsupported - Claude 3 Opus (claude-3-opus-20240229) — Unsupported - Claude 3 Sonnet (claude-3-sonnet-20240229) — Unsupported - Claude 3 Haiku (claude-3-haiku-20240307) — Unsupported - Gemini 1.5 Flash-8B (gemini-1.5-flash-8b) — Deprecated - Gemini 1.5 Flash (gemini-1.5-flash) — Deprecated - Gemini 1.5 Pro (gemini-1.5-pro) — Deprecated == Requirements == * WordPress 6.0 or higher – guarantees core polyfills such as `str_starts_with()` that Fetchub relies on. * PHP 7.4 or higher – required for arrow functions (`fn()`) and modern language features. – fully tested on PHP 8.0, 8.1, 8.2, 8.3 and 8.4. * Standard PHP extensions: **cURL**, **OpenSSL**, and **DOM/XML** (all enabled by default on mainstream hosts). * WP-Cron active (or a real system cron) so per-feed schedules can run. * 512 MB `memory_limit` or greater recommended when using multiple AI models. **Best practice for performance** For the smoothest AI processing and zero-maintenance cron execution, we recommend hosting your WordPress site on [ihost](https://ihost.eco) WordPress Cloud Hosting. See **FAQ 12** for an ihost-optimised `php.ini` template you can copy-and-paste. == Installation == 1. Upload the `fetchub` folder to the `/wp-content/plugins/` directory. 2. Activate the plugin through the **Plugins** menu in WordPress. 3. Navigate to **Fetchub** in your WordPress dashboard. 4. Activate the plugin with a valid token. New users can sign up for a 3-day trial at and enter their trial email and token. 5. Enter the API key(s) for your chosen AI provider(s) and configure feed settings (URLs, intervals, categories, etc.). 6. **Save settings once** to schedule the per-feed cron events for automatic fetching. == External services == This plugin contacts five external APIs. For legal clarity users are told what is sent, why, and where: * **OpenAI Chat Completions API** – Generates titles, summaries and translations. – Sends: prompt text and numeric parameters whenever a post is translated or summarised. – Endpoint https://api.openai.com/v1/chat/completions – Terms https://openai.com/policies/terms-of-use – Privacy https://openai.com/policies/privacy-policy * **Google Gemini Generative Language API** – Same purpose for Gemini models. – Sends: prompt text and numeric parameters. – Endpoint (base): https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent – Terms https://policies.google.com/terms – Privacy https://policies.google.com/privacy * **Anthropic Claude API** – Same purpose for Claude models. – Sends: prompt text and numeric parameters. – Endpoint https://api.anthropic.com/v1/messages – Terms https://www.anthropic.com/terms – Privacy https://www.anthropic.com/privacy * **xAI Grok API** – Same purpose for Grok models. – Sends: prompt text and numeric parameters. – Endpoint https://api.x.ai/v1/chat/completions – Terms https://x.ai/terms – Privacy https://x.ai/privacy * **Fetchub Licence Server** – Validates your e-mail/token and handles revocation. – Sends: e-mail address, licence token and site URL at activation or once every six hours. – Endpoint (base): https://fetchub.com/wp-json/fetchub/v1/verify (and /revoke) – Terms https://fetchub.com/terms – Privacy https://fetchub.com/privacy-policy/ == Frequently Asked Questions == ### 1. How does the custom cron scheduling work? Each feed can have a unique interval (in minutes). Fetchub **dynamically registers** those intervals (e.g., `every_7_minutes`) and schedules `fetchub_feed_cron` per feed. Saving settings **regenerates** the schedules. On plugin deactivation, related scheduled events are cleared to prevent duplication. ### 2. Which AI providers are supported? Fetchub integrates with OpenAI, Gemini, Claude, and Grok. Enable your preferred provider(s) and input API keys in the settings. ### 3. How does content ranking work? The `ai_rank_importance` function uses AI to score feed items from 0 to 10 based on interest and importance, allowing prioritization of high-value content when "Smart Logic" is enabled. ### 4. What happens if I don’t have an AI provider API key? You can still fetch and publish feeds without AI features (translation, ranking), though full functionality requires at least one active provider. ### 5. What is the best practice using with AI models or how much they cost? While using we were experienced with Gemini Flash 2.0 Lite monthly approx. $20 based on the used 49 feed rows without Couple Title! When we activate Couple Title $3/mo. ### 6. How do I activate the 3-day trial? Visit https://fetchub.com to sign up. You’ll receive an email and token; enter these in the Fetchub settings page to activate your trial. ### 7. How much cost this plugin monthly? We are the team which is making this plugin to have reach all people and the people who are journalists, editors, freelancers and who are starters. That is why we only ask $1 from all in month. Yes, correct: $1/month. We think that this is very symbolic and can be helpful to all. If you will use it as we mentioned above at 5., approx. $9/month. ### 8. What if a feed fetch fails? Check your feed URLs and server resources. Enable `WP_DEBUG` in `wp-config.php` to log errors for troubleshooting. ### 9. How do I migrate settings to another site? Use the "Export Settings" button to download a JSON file, then upload it via "Import Settings" on the new site to merge configurations. **After import, Fetchub automatically re-schedules all feeds.** ### 10. What were the Title and Content instructions when we tested Fetchub? We used it to translate into the X language and fetch news. For the Title we added: - Analyze the provided news content (in any language). Quickly understand the core subject and key findings. Then, generate a concise (under 10 words) and highly engaging news title in fluent, natural YOUR_LOCAL_LANGUAGE that would attract a wide readership. The title must use proper YOUR_LOCAL_LANGUAGE terminology and sound like a headline written by a professional YOUR_LOCAL_LANGUAGE news editor. Avoid direct, word-for-word translations that result in unnatural or incomprehensible phrasing. The title should reflect a substantive news story, not a brief announcement, and must not contain any British, English, or other foreign language words. Only the first word of the title and proper names must be capitalized; do not capitalize other words unnecessarily. Provide correct brand names, for example: iPhone, not IPhone, xAI, not Xai, iOS, not IOS, etc. Don't repeat titles or text that's already been used before; skip that and go for a new post. Do not use any formatted text in the title (such as bold, italic, or underline). For the Content we added: - Please generate a comprehensive news article directly in fluent and natural professional YOUR_LOCAL_LANGUAGE language, ensuring it is NOT based on bulletin news or short announcements. The article should be written in a professional journalistic style suitable for a reputable YOUR_LOCAL_LANGUAGE news website, using terminology and phrasing that a native YOUR_LOCAL_LANGUAGE speaker would expect from professional news reporting. Adhere strictly to the following guidelines: * Unique Introduction: The article content MUST BEGIN with clear, unique introductory sentences that are ENTIRELY DIFFERENT from any given title or excerpt. DO NOT repeat, closely rewrite, or slightly modify the title or excerpt in the first paragraph or anywhere else in the article. Start with ORIGINAL and UNIQUE sentences in *fluent and natural professional YOUR_LOCAL_LANGUAGE*, maintaining a professional journalistic tone that sounds authentic to a native speaker. * Second Paragraph Commencement: The second paragraph MUST START *exactly* with ONE of the following phrases (choose correctly by context): * "[NAME_OF_YOUR_MEDIA|https://name_of_your_media.com] informing that," These phrases MUST appear PRECISELY as written, without ANY modifications. * Total Length Constraint: The total length of the generated article MUST NEVER exceed a maximum of 390 words. **EVEN IF THE SOURCE TEXT IS LONGER, condense the information to fit within this limit while retaining key details and context. DO NOT CUT OFF THE ARTICLE ABRUPTLY.** * Complete Conclusion: NEVER cut off the text abruptly. ALWAYS finish the article with a clear and concise conclusion paragraph IN *fluent and natural professional YOUR_LOCAL_LANGUAGE*, consistent with journalistic standards and sounding authentic to a native speaker. **Ensure that even if the source material is extensive, the generated article has a proper concluding statement that summarizes or provides a final thought.** * Editor Attribution: ALWAYS include exactly ONE editor's name BELOW the conclusion paragraph based on the news category: * If the news belongs to the **Politics, World, or any other category not explicitly listed below**, use: Asad Freeman * If the news belongs to the **Technology**, **Sports**, **Finance**, **Economics**, **Business** category, use: Fred Alison * If the news belongs to the **Health** category, use: Sunny Springfield * If the news belongs to the **Science**, **Vehicles** category, use: Aileen August **THIS MUST ALWAYS BE PRESENT AFTER THE CONCLUSION.** * Metadata Exclusion: DO NOT include ANY unrelated metadata, dates, excerpts, headings, markdown formatting, or social media texts. ENSURE the generated content is a FULL NEWS ARTICLE in *fluent and natural professional YOUR_LOCAL_LANGUAGE*, written in a professional journalistic style that a native speaker would recognize as such, not a brief bulletin or announcement resulting from direct translation. * Language and Style: Use *fluent and natural PROFESSIONAL YOUR_LOCAL_LANGUAGE* language ONLY, with CORRECT grammar and spelling THROUGHOUT the ENTIRE article. Maintain a formal and objective journalistic style that reflects authentic YOUR_LOCAL_LANGUAGE news writing. * Uniqueness: The final article MUST ALWAYS BE UNIQUE, CLEARLY DIFFERENT from any provided title or excerpt, clean, complete, and ready for publication ON A NEWS WEBSITE IN *fluent and natural PROFESSIONAL YOUR_LOCAL_LANGUAGE*. The content should reflect a developed news story with professional journalistic quality, written in a way that sounds natural and authoritative to a native YOUR_LOCAL_LANGUAGE reader, not a direct or awkward translation. * Provide correct brand names, for example: iPhone, not IPhone, xAI, not Xai, iOS, not IOS, etc. * Provided names must be correctly used in YOUR_LOCAL_LANGUAGE. For example: Elon Musk is Ilon Mesk, Donald Trump is Donald Tremp in YOUR_LOCAL_LANGUAGE. If you want to add a suffix like -ın or -ın, simply attach it directly (e.g., Trempic, Mesken). However, untranslated company names still use the suffixes -ın, -dan as usual. * Do not add comments, markup, or extra characters. * Preserve meaning and clarity. * Output plain text only. Please do not forget to replace with YOUR_LOCAL_LANGUAGE your correct country's name. Please do not forget to replace with NAME_OF_YOUR_MEDIA|https://name_of_your_media.com your correct website name and domain. Please note that [NAME_OF_YOUR_MEDIA|https://name_of_your_media.com] will be added as a link on your frontend page like this: [https://name_of_your_media.com](NAME_OF_YOUR_MEDIA). ### 11. If I have an issue with this plugin, how do I contact you? You can easily contact us by visiting https://fetchub.com/contact and sending us all the details, screenshots, or videos you have on hand so we can try to fix any issue. ### 12. What PHP settings are recommended for best performance on ihost? We run happily on any modern host, but if you want “zero-tuning” speed and reliability we recommend [ihost WordPress Cloud Hosting](https://ihost.eco/wordpress-cloud). **Why ihost works so well with Fetchub** * **Web Optimisation:** One-click optimisation suite that minifies HTML, CSS, JS and compresses images automatically. * **Free and unlimited ihostCDN:** A fully featured global CDN (not a slimmed-down plan) for faster delivery everywhere. * **Website Acceleration Suite:** Server-side image resizing, compression, lazy loading, and code minification without extra plugins. * **Edge caching:** Static assets (images, JS, CSS) are cached at ihost’s edge locations worldwide for ultra-low latency. * **Optimised PHP:** Customised PHP-FPM and OPcache; multiple PHP versions (5.6 → 8.4) available for safe upgrade testing. * **Unlimited hosting:** No artificial limits on the number of WordPress sites—scale up as your server resources allow. #### ihost PHP directives (copy into “PHP Options → Additional directives”) ```ini asp_tags = 0 auto_append_file = auto_prepend_file = display_errors = 0 error_reporting = 22527 file_uploads = 1 max_execution_time = 300 max_file_uploads = 50 max_input_time = 300 max_input_vars = 10000 memory_limit = 1024M output_buffering = 0 post_max_size = 256M short_open_tag = 1 upload_max_filesize = 256M zlib.output_compression = 0 ``` ### 13. Change cache limits? ```php add_filter( 'fetchub_guid_cache_size', function () { return 2000; } ); add_filter( 'fetchub_summary_keep', function () { return 800; } ); ``` ### 14. What is the Cron Jobs Panel? It filters to **Fetchub-only** cron events and lets you **Run now**, **Delete**, or **Reschedule** per feed. Actions are nonce-protected; rescheduling sanitises input before use. ### 15. What does “Stop All” do now? It **unschedules all** Fetchub jobs without changing row enabled/disabled states, sets a **global pause** flag, and triggers a short-lived **kill-switch** for jobs already running. == Screenshots == 1. **Admin Settings Page** – Configure AI providers, API keys, and general settings. 2. **Feed Configuration Table** – Manage feeds with options for intervals, AI models, and advanced settings. 3. **Export / Import & Revoke Token Panel** – Backup settings, import JSON, or revoke your token in one place. 4. **Feed & Fetched URL Column** – See the original feed URL and fetched URL directly in the WordPress Posts list. 5. **Logs & Cron Panel (NEW)** – Filtered Fetchub cron jobs list (run now, delete, reschedule) plus improved logs view. == Functions == – Singleton instance of the main plugin class. – Handles plugin activation, including initial setup and scheduling. – Handles plugin deactivation, including clearing all scheduled cron jobs. – Registers plugin settings. – Enqueues admin scripts and styles. – Adds the main admin menu page. – Displays the plugin settings page HTML. – AJAX handler for manual instant feed fetching **(now with double-click lock and immediate one-shot queue)**. – AJAX handler to fetch and process all feeds instantly. – AJAX handler to stop all feeds and clear running jobs **(global pause + kill-switch)**. – **AJAX handler to update AI model options based on active providers.** – **NEW:** AJAX handlers for Cron Jobs Panel: list jobs, run now, delete schedules, and reschedule minutes (sanitised input). – WP-Cron hook for per-feed processing **(supports a forced one-time run even for disabled rows)**. – Processes a feed URL, parses items, and publishes posts. – Generates post title using AI from content. – Ranks feed items using AI. – Identifies content language for translation. – Translates text using the selected AI provider. – Processes hyperlink markers in translated text. – Unified API call method for all AI providers. – Checks if a post with the given GUID already exists. – Checks if an attachment with a matching file exists. – Sets the featured image for a post from a URL. – Scrapes the first image URL from a given link. – Checks if a given text contains any of the configured block words. – Removes trailing opinion phrases from content. – Removes leading duplicate title from content. – Simplifies text for slug-like comparison. – Cleans raw HTML/text content. – Checks if a GUID has been globally seen (cached). – Marks a GUID as globally seen and caches it. – Handles the import of settings from a JSON file **(auto re-schedule on success)**. – Handles the export of settings to a JSON file. – Handles token revocation submission. – Saves a one-sentence summary of a post for duplicate checks. – WP-Cron task to clean up old post summaries. – Adds the Feed URL column to the posts list. – Displays the Feed URL in the posts list column. – Adds the Fetched URL column to the posts list. – Displays the Fetched URL in the posts list column. – Adds Settings/Activate links on the Plugins page. – **Security:** Blocks all Fetchub AJAX/cron when licence is invalid/expired. – **UI:** Token header shows **Token active** and **Expires: {date time}** in site timezone; Logs UI has proper timezone handling and supports legacy/new timestamps. == Changelog == = 1.2 = * **New – Cron Jobs Panel:** Manage only Fetchub’s cron events from the admin: list jobs, **Run now**, **Delete**, and **Reschedule** per feed (nonce-protected). * **New – Dynamic minute schedules:** Automatically registers `every_{N}_minutes` schedules based on the intervals used by your feeds; also ensures a **weekly** schedule exists. * **Improved – Instant Fetch:** Prevents double-clicks, queues an immediate single run, and guarantees the recurring event exists for that feed. * **Improved – Stop All:** Unschedules everything without changing row states, sets a global pause flag, and signals a kill-switch for jobs already running. * **Improved – Logs UI & timekeeping:** Logs render with proper timezone handling and accept both legacy `time` strings and new GMT timestamps. * **Improved – Import:** After importing settings JSON, Fetchub automatically re-schedules all feeds. * **UI – Token header:** When activated, the admin header shows **Token active** and **Expires: {date time}** in site timezone. * **Security:** Hardened admin AJAX for rescheduling and license gate prevents any Fetchub AJAX/cron if the token is invalid/expired. * **Fix:** These models are no longer available from supported providers and are removed from the default picker: - Claude 3.5 Sonnet (claude-3-5-sonnet-20241022) — Unsupported - Claude 3 Opus (claude-3-opus-20240229) — Unsupported - Claude 3 Sonnet (claude-3-sonnet-20240229) — Unsupported - Claude 3 Haiku (claude-3-haiku-20240307) — Unsupported - Gemini 1.5 Flash-8B (gemini-1.5-flash-8b) — Deprecated - Gemini 1.5 Flash (gemini-1.5-flash) — Deprecated - Gemini 1.5 Pro (gemini-1.5-pro) — Deprecated = 1.1 = * **Fix:** Resolved issue causing cron jobs to duplicate on plugin deactivation and reactivation by implementing aggressive cleanup of all related scheduled events. * **New:** Weekly cron task (`fetchub_cleanup_summaries`) that trims `_fetchub_summary` post-meta to the 500 most-recent rows, preventing long-term table growth. * **New:** Duplicate-guard settings — threshold, look-back depth and a fast slug-overlap check before the LLM call. * **New:** Added "Fetched URL" column to the WordPress Posts list table, showing the original source URL of fetched items. * **Dev:** All summary-cleanup SQL now uses `prepare()` and inline PHPCS whitelisting; PHPCS reports come back clean. * **UI:** Added tooltips and inline help for duplicate guard and cleanup options. * **Fix:** AI-model dropdown instantly refreshes when providers are toggled. * **Fix:** Minor UI/UX tweaks and translation string improvements. * **Perf:** Leaner database queries and transient handling across the board. * **Fetchub Logs:** We log up to 1,000 feeds here. Please scroll down within the below of Fetchub page, Logs section to view all available entries. = 1.0 = * Initial release with full AI integration, cron scheduling, and token system. == Upgrade Notice == = 1.2 = Adds Cron Jobs panel, dynamic minute schedules, safer instant-fetch, improved Stop All, better logs timekeeping, and auto-reschedule after import. After updating, open **Fetchub → Settings**, review feed intervals, and (optionally) reschedule from the new Cron panel. = 1.1 = Fixes cron duplication on deactivation/reactivation. Adds “Duplicate guard”, “Cleanup” settings, and “Fetched URL” column in Posts list. Visit Fetchub settings to configure new features after updating. = 1.0 = Initial release with full AI integration, cron scheduling, and token system. == License == This plugin is released under the GNU General Public License v2 or later. See license.txt for full details.