Plugin Directory

Changeset 3376694


Ignore:
Timestamp:
10/11/2025 02:19:01 PM (6 months ago)
Author:
ashleysmith1
Message:

Update to version 5.2.17

Location:
maio-the-new-ai-geo-seo-tool/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • maio-the-new-ai-geo-seo-tool/trunk/js/maio_analytics.js

    r3325473 r3376694  
    6565                        if (meterElement.length) meterElement.text(count);
    6666                    });
    67                 } else {
    68                     console.error('Unexpected response:', response);
    6967                }
    7068            },
  • maio-the-new-ai-geo-seo-tool/trunk/maio-ai-scanner.php

    r3372753 r3376694  
    88if (!defined('ABSPATH')) {
    99    exit;
     10}
     11
     12/**
     13 * Get API URL based on environment
     14 * Automatically detects local Docker development vs production
     15 */
     16function maio_get_api_url() {
     17    // Check if explicitly set via environment variable (Docker)
     18    $env_api_url = getenv('MAIO_API_URL');
     19    if ($env_api_url !== false && !empty($env_api_url)) {
     20        return $env_api_url . '/api/v1/internal/scan/url';
     21    }
     22   
     23    // Check if WordPress constant is defined (manual override)
     24    if (defined('MAIO_API_URL')) {
     25        return MAIO_API_URL . '/api/v1/internal/scan/url';
     26    }
     27   
     28    // Check if running in Docker (look for docker hostname)
     29    if (gethostname() && strpos(gethostname(), 'maio-wordpress') !== false) {
     30        return 'http://maio-api:5000/api/v1/internal/scan/url';
     31    }
     32   
     33    // Check if local development (localhost or .local domain)
     34    $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     35    if (strpos($host, 'localhost') !== false ||
     36        strpos($host, '127.0.0.1') !== false ||
     37        strpos($host, '.local') !== false) {
     38        return 'http://localhost:5000/api/v1/internal/scan/url';
     39    }
     40   
     41    // Default to production
     42    return 'https://api.maioai.com/api/v1/internal/scan/url';
    1043}
    1144
     
    5285    wp_enqueue_style('maio-scanner-dashboard', plugins_url('css/maio-scanner-dashboard.css', __FILE__), array(), MAIO_VERSION);
    5386   
     87    // Determine API URL (local development vs production)
     88    $api_url = maio_get_api_url();
     89   
    5490    // Localize script with AJAX URL and nonce
    5591    wp_localize_script('maio-ai-scanner', 'maioAIScanner', array(
     
    5793        'nonce' => wp_create_nonce('maio_ai_scanner_nonce'),
    5894        'siteUrl' => get_home_url(), // WordPress site URL (homepage)
    59         'apiUrl' => 'https://api.maioai.com/api/v1/internal/scan/url', // Use same API as main plugin
     95        'apiUrl' => $api_url, // Automatically detects local or production
    6096        'installToken' => 'dummy_plugin_token', // Use same dummy token as main plugin - will be handled by reverse proxy
    6197        'strings' => array(
     
    98134   
    99135   
     136    // Get API URL (automatically detects local or production)
     137    $api_url = maio_get_api_url();
     138   
    100139    // Call the AI Scanner API
    101     $response = wp_remote_post('https://api.maioai.com/api/v1/internal/scan/url', array(
     140    $response = wp_remote_post($api_url, array(
    102141        'headers' => array(
    103142            'X-Install-Token' => 'dummy_plugin_token', // Use same dummy token as main plugin
     
    9681007   
    9691008    if ($result) {
    970         wp_send_json_success('FAQ Schema added successfully');
     1009        wp_send_json_success([
     1010            'message' => 'FAQ Schema added successfully',
     1011            'cache_cleared' => true,
     1012            'wait_before_rescan' => 2 // Suggest waiting 2 seconds before rescanning
     1013        ]);
    9711014    } else {
    9721015        wp_send_json_error('Failed to add FAQ Schema');
     
    23892432    // Add FAQ schema to the homepage
    23902433    update_option('maio_faq_schema_enabled', true);
     2434   
     2435    // Clear WordPress object cache for this option
     2436    if (function_exists('wp_cache_delete')) {
     2437        wp_cache_delete('maio_faq_schema_enabled', 'options');
     2438    }
     2439   
     2440    // Force cache flush
     2441    if (function_exists('wp_cache_flush')) {
     2442        wp_cache_flush();
     2443    }
     2444   
    23912445    return true;
    23922446}
     
    23952449    // Remove FAQ schema from the homepage
    23962450    update_option('maio_faq_schema_enabled', false);
     2451   
     2452    // Clear WordPress object cache for this option
     2453    if (function_exists('wp_cache_delete')) {
     2454        wp_cache_delete('maio_faq_schema_enabled', 'options');
     2455    }
     2456   
     2457    // Force cache flush
     2458    if (function_exists('wp_cache_flush')) {
     2459        wp_cache_flush();
     2460    }
     2461   
    23972462    return true;
    23982463}
     
    49435008    if (is_admin()) return; // Only output schema on the front-end
    49445009   
     5010    // Force fresh option read (bypass cache)
     5011    if (function_exists('wp_cache_delete')) {
     5012        wp_cache_delete('maio_faq_schema_enabled', 'options');
     5013    }
    49455014    $faq_enabled = get_option('maio_faq_schema_enabled', false);
    49465015   
  • maio-the-new-ai-geo-seo-tool/trunk/maio-main.php

    r3372753 r3376694  
    44 * Plugin URI: https://maioai.com
    55 * Description: This plugin helps optimize your Website for AI-powered discovery tools such as ChatGPT, Perplexity, Claude, Google Gemini, Google AI Overviews, Meta Llama and many more. It combines the best of traditional SEO and emerging AIO strategies to ensure your brand is accurately and favorably represented in AI-generated content.
    6  * Version: 5.1.39
     6 * Version: 5.2.17
    77 * Requires at least: 5.0
    88 * Requires PHP: 7.2
     
    1616
    1717// Define plugin constants
    18 define('MAIO_VERSION', '5.1.39');
     18define('MAIO_VERSION', '5.2.17');
    1919define('MAIO_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('MAIO_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    2323require_once MAIO_PLUGIN_DIR . 'maio_analytics.php';
    2424require_once MAIO_PLUGIN_DIR . 'maio-ai-scanner.php';
     25require_once MAIO_PLUGIN_DIR . 'maio-analytics-api.php'; // REST API endpoints for dashboard
     26require_once MAIO_PLUGIN_DIR . 'maio-llm-referral-tracking.php'; // LLM referral tracking
    2527
    2628// Add cache-busting headers
     
    18131815    // Validate and sanitize inputs
    18141816    $llm_id = sanitize_text_field(wp_unslash($llm_id));
    1815     $page_url = esc_url_raw(wp_unslash($page_url));
     1817    // DO NOT use esc_url_raw() - it destroys international characters!
     1818    // Store URLs with their international characters intact (percent-encoded if needed)
     1819    $page_url = wp_unslash($page_url);
    18161820    $status = sanitize_text_field(wp_unslash($status));
    18171821    $response_data = sanitize_text_field(wp_unslash($response_data));
     
    22472251static $maio_crawler_detected = false;
    22482252
    2249 // Early detection before any caching
    2250 add_action('init', function() {
     2253// Early detection before any caching (using 'wp' hook for proper $wp->request parsing)
     2254add_action('wp', function() {
    22512255    // Prevent double logging for admin-ajax requests
    22522256    // PHP 8.1+ compatibility: ensure REQUEST_URI is not null
     
    22622266    $llm_info = maio_identify_llm($user_agent);
    22632267    if ($llm_info) {
    2264         $host = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : '';
    2265         $uri  = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '';
    2266         $page_url = (is_ssl() ? 'https://' : 'http://') . $host . $uri;
     2268        // Get the current URL preserving international characters
     2269        // Use global $wp which has the parsed request
     2270        global $wp;
     2271        $current_url = home_url($wp->request);
     2272       
     2273        // Add query string if present
     2274        if (!empty($_SERVER['QUERY_STRING'])) {
     2275            $current_url .= '?' . wp_unslash($_SERVER['QUERY_STRING']);
     2276        }
     2277       
     2278        // Add trailing slash if original REQUEST_URI had it
     2279        if (!empty($_SERVER['REQUEST_URI']) && substr($_SERVER['REQUEST_URI'], -1) === '/') {
     2280            $current_url = trailingslashit($current_url);
     2281        }
     2282       
     2283        $page_url = $current_url;
    22672284        $response_data = json_encode([
    22682285            'user_agent' => $user_agent,
     
    22932310    $ip = isset($_SERVER['REMOTE_ADDR']) ? sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) : '';
    22942311    $referer = isset($_SERVER['HTTP_REFERER']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_REFERER'])) : '';
    2295     $page_url = isset($_POST['page_url']) ? sanitize_text_field(wp_unslash($_POST['page_url'])) : (isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '');
     2312    // DO NOT use sanitize_text_field() on REQUEST_URI or page_url - it destroys international characters!
     2313    $page_url = isset($_POST['page_url']) ? wp_unslash($_POST['page_url']) : (isset($_SERVER['REQUEST_URI']) ? wp_unslash($_SERVER['REQUEST_URI']) : '');
    22962314
    22972315    $ua = strtolower($user_agent);
  • maio-the-new-ai-geo-seo-tool/trunk/readme.txt

    r3372753 r3376694  
    44Requires at least: 5.0
    55Tested up to: 6.8.2
    6 Stable tag: 5.1.39
     6Stable tag: 5.2.17
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838
    3939== Changelog ==
     40
     41= 5.2.17 =
     42* Added infrastructure for future MAIO smart web dashboard analytics
    4043
    4144= 5.1.39 =
  • maio-the-new-ai-geo-seo-tool/trunk/scanner-pages/maio-trust-markers.php

    r3368559 r3376694  
    308308                },
    309309                error: function(xhr, status, error) {
    310                     console.error('AJAX Error:', error);
    311310                    alert('Error: Failed to apply improvement. Please try again.');
    312311                    $button.prop('disabled', false).text($button.data('original-text') || 'Try Again');
Note: See TracChangeset for help on using the changeset viewer.