Plugin Directory

Changeset 3454316


Ignore:
Timestamp:
02/05/2026 07:35:46 AM (2 weeks ago)
Author:
deepwork
Message:

Update to version 1.5.8 from GitHub

Location:
stacksuite-sales-manager-for-woocommerce
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stacksuite-sales-manager-for-woocommerce/tags/1.5.8/includes/class-aisales-admin-settings.php

    r3454306 r3454316  
    5353        add_action( 'admin_init', array( $this, 'handle_actions' ) );
    5454        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_toast_script' ), 20 );
     55        add_action( 'admin_init', array( $this, 'maybe_check_for_updates' ) );
    5556    }
    5657
     
    10031004        return isset( $labels[ $operation ] ) ? $labels[ $operation ] : $operation;
    10041005    }
     1006
     1007    /**
     1008     * Check for plugin updates on dashboard page load (every 6 hours)
     1009     *
     1010     * This triggers WordPress's plugin update check mechanism to ensure
     1011     * users see fresh update information when visiting the plugin dashboard.
     1012     */
     1013    public function maybe_check_for_updates() {
     1014        // Only run on our main dashboard page.
     1015        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     1016        if ( ! isset( $_GET['page'] ) || 'ai-sales-manager' !== $_GET['page'] ) {
     1017            return;
     1018        }
     1019
     1020        $last_check = get_option( 'aisales_last_update_check', 0 );
     1021        $interval   = 6 * HOUR_IN_SECONDS;
     1022
     1023        // Only check if more than 6 hours since last check.
     1024        if ( time() - $last_check < $interval ) {
     1025            return;
     1026        }
     1027
     1028        // Update last check time first to prevent multiple checks.
     1029        update_option( 'aisales_last_update_check', time(), false );
     1030
     1031        // Clear the update transient and trigger a fresh check.
     1032        delete_site_transient( 'update_plugins' );
     1033        wp_update_plugins();
     1034    }
    10051035}
  • stacksuite-sales-manager-for-woocommerce/tags/1.5.8/includes/class-aisales-batch-page.php

    r3453999 r3454316  
    113113            array(
    114114                'ajaxUrl'      => admin_url( 'admin-ajax.php' ),
    115                 'nonce'        => wp_create_nonce( 'aisales_batch_nonce' ),
     115                'nonce'        => wp_create_nonce( 'aisales_nonce' ),
    116116                'apiBaseUrl'   => apply_filters( 'aisales_api_url_client', AISALES_API_URL_CLIENT ),
    117117                'apiKey'       => $api_key,
  • stacksuite-sales-manager-for-woocommerce/tags/1.5.8/readme.txt

    r3454306 r3454316  
    55Tested up to: 6.9
    66Requires PHP: 8.0
    7 Stable tag: 1.5.7
     7Stable tag: 1.5.8
    88WC requires at least: 8.0
    99WC tested up to: 9.0
     
    114114
    115115== Changelog ==
     116
     117= 1.5.8 =
     118* Fixed: Batch page AJAX nonce mismatch causing 403 errors when applying changes
    116119
    117120= 1.5.7 =
  • stacksuite-sales-manager-for-woocommerce/tags/1.5.8/stacksuite-sales-manager-for-woocommerce.php

    r3454306 r3454316  
    44 * Plugin URI: https://github.com/stacksuite-dev/woo-ai-sales-manager
    55 * Description: AI-powered product catalog management for WooCommerce. Generate content, suggest tags/categories, and create/improve product images using Google Gemini.
    6  * Version: 1.5.7
     6 * Version: 1.5.8
    77 * Author: StackSuite
    88 * Author URI: https://stacksuite.dev
     
    2727
    2828// Plugin constants
    29 define( 'AISALES_VERSION', '1.5.7' );
     29define( 'AISALES_VERSION', '1.5.8' );
    3030define( 'AISALES_PLUGIN_FILE', __FILE__ );
    3131define( 'AISALES_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    147147        add_filter( 'plugin_action_links_' . AISALES_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
    148148        add_filter( 'admin_body_class', array( $this, 'add_plugin_body_class' ) );
     149        add_action( 'admin_notices', array( $this, 'maybe_show_update_notice' ) );
    149150
    150151        // Initialize components
     
    403404
    404405    /**
     406     * Show update notice on plugin pages if an update is available
     407     *
     408     * Reads from WordPress's existing update transient (no extra API calls).
     409     */
     410    public function maybe_show_update_notice() {
     411        // Only show on plugin pages.
     412        if ( ! self::is_plugin_page() ) {
     413            return;
     414        }
     415
     416        // Check WordPress's update transient.
     417        $update_plugins = get_site_transient( 'update_plugins' );
     418        if ( empty( $update_plugins->response ) ) {
     419            return;
     420        }
     421
     422        $plugin_file = AISALES_PLUGIN_BASENAME;
     423        if ( ! isset( $update_plugins->response[ $plugin_file ] ) ) {
     424            return;
     425        }
     426
     427        $update_info   = $update_plugins->response[ $plugin_file ];
     428        $new_version   = isset( $update_info->new_version ) ? $update_info->new_version : '';
     429        $update_url    = admin_url( 'plugins.php' );
     430        $changelog_url = isset( $update_info->url ) ? $update_info->url : 'https://wordpress.org/plugins/stacksuite-sales-manager-for-woocommerce/#developers';
     431
     432        if ( empty( $new_version ) ) {
     433            return;
     434        }
     435
     436        ?>
     437        <div class="notice notice-warning aisales-update-notice" style="display: flex; align-items: center; gap: 12px; padding: 12px 16px;">
     438            <span class="dashicons dashicons-update" style="font-size: 24px; width: 24px; height: 24px; color: #dba617;"></span>
     439            <div style="flex: 1;">
     440                <strong><?php esc_html_e( 'StackSuite Sales Manager Update Available', 'stacksuite-sales-manager-for-woocommerce' ); ?></strong>
     441                <p style="margin: 4px 0 0;">
     442                    <?php
     443                    printf(
     444                        /* translators: %1$s: current version, %2$s: new version */
     445                        esc_html__( 'Version %1$s is available. You are running %2$s.', 'stacksuite-sales-manager-for-woocommerce' ),
     446                        '<strong>' . esc_html( $new_version ) . '</strong>',
     447                        esc_html( AISALES_VERSION )
     448                    );
     449                    ?>
     450                </p>
     451            </div>
     452            <a href="<?php echo esc_url( $changelog_url ); ?>" class="button button-secondary" target="_blank" rel="noopener">
     453                <?php esc_html_e( 'View Changelog', 'stacksuite-sales-manager-for-woocommerce' ); ?>
     454            </a>
     455            <a href="<?php echo esc_url( $update_url ); ?>" class="button button-primary">
     456                <?php esc_html_e( 'Update Now', 'stacksuite-sales-manager-for-woocommerce' ); ?>
     457            </a>
     458        </div>
     459        <?php
     460    }
     461
     462    /**
    405463     * Get API client instance
    406464     *
  • stacksuite-sales-manager-for-woocommerce/trunk/includes/class-aisales-admin-settings.php

    r3454306 r3454316  
    5353        add_action( 'admin_init', array( $this, 'handle_actions' ) );
    5454        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_toast_script' ), 20 );
     55        add_action( 'admin_init', array( $this, 'maybe_check_for_updates' ) );
    5556    }
    5657
     
    10031004        return isset( $labels[ $operation ] ) ? $labels[ $operation ] : $operation;
    10041005    }
     1006
     1007    /**
     1008     * Check for plugin updates on dashboard page load (every 6 hours)
     1009     *
     1010     * This triggers WordPress's plugin update check mechanism to ensure
     1011     * users see fresh update information when visiting the plugin dashboard.
     1012     */
     1013    public function maybe_check_for_updates() {
     1014        // Only run on our main dashboard page.
     1015        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     1016        if ( ! isset( $_GET['page'] ) || 'ai-sales-manager' !== $_GET['page'] ) {
     1017            return;
     1018        }
     1019
     1020        $last_check = get_option( 'aisales_last_update_check', 0 );
     1021        $interval   = 6 * HOUR_IN_SECONDS;
     1022
     1023        // Only check if more than 6 hours since last check.
     1024        if ( time() - $last_check < $interval ) {
     1025            return;
     1026        }
     1027
     1028        // Update last check time first to prevent multiple checks.
     1029        update_option( 'aisales_last_update_check', time(), false );
     1030
     1031        // Clear the update transient and trigger a fresh check.
     1032        delete_site_transient( 'update_plugins' );
     1033        wp_update_plugins();
     1034    }
    10051035}
  • stacksuite-sales-manager-for-woocommerce/trunk/includes/class-aisales-batch-page.php

    r3453999 r3454316  
    113113            array(
    114114                'ajaxUrl'      => admin_url( 'admin-ajax.php' ),
    115                 'nonce'        => wp_create_nonce( 'aisales_batch_nonce' ),
     115                'nonce'        => wp_create_nonce( 'aisales_nonce' ),
    116116                'apiBaseUrl'   => apply_filters( 'aisales_api_url_client', AISALES_API_URL_CLIENT ),
    117117                'apiKey'       => $api_key,
  • stacksuite-sales-manager-for-woocommerce/trunk/readme.txt

    r3454306 r3454316  
    55Tested up to: 6.9
    66Requires PHP: 8.0
    7 Stable tag: 1.5.7
     7Stable tag: 1.5.8
    88WC requires at least: 8.0
    99WC tested up to: 9.0
     
    114114
    115115== Changelog ==
     116
     117= 1.5.8 =
     118* Fixed: Batch page AJAX nonce mismatch causing 403 errors when applying changes
    116119
    117120= 1.5.7 =
  • stacksuite-sales-manager-for-woocommerce/trunk/stacksuite-sales-manager-for-woocommerce.php

    r3454306 r3454316  
    44 * Plugin URI: https://github.com/stacksuite-dev/woo-ai-sales-manager
    55 * Description: AI-powered product catalog management for WooCommerce. Generate content, suggest tags/categories, and create/improve product images using Google Gemini.
    6  * Version: 1.5.7
     6 * Version: 1.5.8
    77 * Author: StackSuite
    88 * Author URI: https://stacksuite.dev
     
    2727
    2828// Plugin constants
    29 define( 'AISALES_VERSION', '1.5.7' );
     29define( 'AISALES_VERSION', '1.5.8' );
    3030define( 'AISALES_PLUGIN_FILE', __FILE__ );
    3131define( 'AISALES_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    147147        add_filter( 'plugin_action_links_' . AISALES_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
    148148        add_filter( 'admin_body_class', array( $this, 'add_plugin_body_class' ) );
     149        add_action( 'admin_notices', array( $this, 'maybe_show_update_notice' ) );
    149150
    150151        // Initialize components
     
    403404
    404405    /**
     406     * Show update notice on plugin pages if an update is available
     407     *
     408     * Reads from WordPress's existing update transient (no extra API calls).
     409     */
     410    public function maybe_show_update_notice() {
     411        // Only show on plugin pages.
     412        if ( ! self::is_plugin_page() ) {
     413            return;
     414        }
     415
     416        // Check WordPress's update transient.
     417        $update_plugins = get_site_transient( 'update_plugins' );
     418        if ( empty( $update_plugins->response ) ) {
     419            return;
     420        }
     421
     422        $plugin_file = AISALES_PLUGIN_BASENAME;
     423        if ( ! isset( $update_plugins->response[ $plugin_file ] ) ) {
     424            return;
     425        }
     426
     427        $update_info   = $update_plugins->response[ $plugin_file ];
     428        $new_version   = isset( $update_info->new_version ) ? $update_info->new_version : '';
     429        $update_url    = admin_url( 'plugins.php' );
     430        $changelog_url = isset( $update_info->url ) ? $update_info->url : 'https://wordpress.org/plugins/stacksuite-sales-manager-for-woocommerce/#developers';
     431
     432        if ( empty( $new_version ) ) {
     433            return;
     434        }
     435
     436        ?>
     437        <div class="notice notice-warning aisales-update-notice" style="display: flex; align-items: center; gap: 12px; padding: 12px 16px;">
     438            <span class="dashicons dashicons-update" style="font-size: 24px; width: 24px; height: 24px; color: #dba617;"></span>
     439            <div style="flex: 1;">
     440                <strong><?php esc_html_e( 'StackSuite Sales Manager Update Available', 'stacksuite-sales-manager-for-woocommerce' ); ?></strong>
     441                <p style="margin: 4px 0 0;">
     442                    <?php
     443                    printf(
     444                        /* translators: %1$s: current version, %2$s: new version */
     445                        esc_html__( 'Version %1$s is available. You are running %2$s.', 'stacksuite-sales-manager-for-woocommerce' ),
     446                        '<strong>' . esc_html( $new_version ) . '</strong>',
     447                        esc_html( AISALES_VERSION )
     448                    );
     449                    ?>
     450                </p>
     451            </div>
     452            <a href="<?php echo esc_url( $changelog_url ); ?>" class="button button-secondary" target="_blank" rel="noopener">
     453                <?php esc_html_e( 'View Changelog', 'stacksuite-sales-manager-for-woocommerce' ); ?>
     454            </a>
     455            <a href="<?php echo esc_url( $update_url ); ?>" class="button button-primary">
     456                <?php esc_html_e( 'Update Now', 'stacksuite-sales-manager-for-woocommerce' ); ?>
     457            </a>
     458        </div>
     459        <?php
     460    }
     461
     462    /**
    405463     * Get API client instance
    406464     *
Note: See TracChangeset for help on using the changeset viewer.