Plugin Directory

Changeset 3443437


Ignore:
Timestamp:
01/20/2026 04:40:59 PM (2 months ago)
Author:
bhashkar19
Message:

Update to version 1.0.6: Fix undefined variable and add auto-connect logic

Location:
creation-genius/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • creation-genius/trunk/class-creation-genius.php

    r3441990 r3443437  
    126126        add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_assets'));
    127127        add_action('the_post', array($this, 'check_ai_generated_post'));
     128
     129        // Auto-connect if not connected
     130        if (!get_option('creation_genius_connected')) {
     131            $this->api_handler->auto_connect();
     132            // Schedule analysis after auto-connect
     133             if (!wp_next_scheduled('creation_genius_run_immediate_analysis')) {
     134                wp_schedule_single_event(time() + 60, 'creation_genius_run_immediate_analysis');
     135            }
     136        }
    128137    }
    129138
     
    206215        }
    207216
    208         // Schedule immediate analysis (async) to avoid activation timeout
    209         if (!wp_next_scheduled('creation_genius_run_immediate_analysis')) {
    210             wp_schedule_single_event(time(), 'creation_genius_run_immediate_analysis');
    211         }
     217        // Schedule immediate analysis (async) on activation
     218        wp_schedule_single_event(time(), 'creation_genius_run_immediate_analysis');
    212219
    213220        // Flush rewrite rules
  • creation-genius/trunk/creation-genius.php

    r3442012 r3443437  
    44 * Plugin URI: https://creationgenius.com
    55 * Description: Supercharge your WordPress with Creation Genius: The ultimate AI content engine for generating SEO-optimized blog posts, articles, and reviews in seconds.
    6  * Version: 1.0.5
     6 * Version: 1.0.6
    77 * Author: Creation Genius AI
    88 * Author URI: https://creationgenius.com/about-us/
     
    2222
    2323// Define plugin constants
    24 define('CREATION_GENIUS_VERSION', '1.0.5');
     24define('CREATION_GENIUS_VERSION', '1.0.6');
    2525define('CREATION_GENIUS_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2626define('CREATION_GENIUS_PLUGIN_URL', plugin_dir_url(__FILE__));
  • creation-genius/trunk/modules/api-handler.php

    r3441990 r3443437  
    2222    public function __construct() {
    2323        $this->database = new Creation_Genius_Database();
     24    }
     25
     26    /**
     27     * Auto connect to server
     28     */
     29    public function auto_connect() {
     30        if (get_option('creation_genius_connected')) {
     31            return array('success' => true, 'message' => 'Already connected.');
     32        }
     33
     34        $base_url = get_option('creation_genius_base_url', 'https://creationgenius.com/');
     35        $domain = home_url();
     36        $email = get_option('admin_email');
     37
     38        return $this->connect_server($base_url, $domain, $email);
    2439    }
    2540
     
    595610                );
    596611            } elseif ($response_code === 401) {
     612                // Attempt auto-reconnect
     613                $reconnect = $this->auto_connect();
     614                if ($reconnect['success']) {
     615                    // Retry the request one more time
     616                    // Update API key in current data
     617                    $data['api_key'] = get_option('creation_genius_api_key');
     618                    $args['body'] = wp_json_encode($data);
     619                    $retry_response = wp_remote_post($url, $args);
     620                   
     621                    if (!is_wp_error($retry_response) && wp_remote_retrieve_response_code($retry_response) === 200) {
     622                         $retry_body = wp_remote_retrieve_body($retry_response);
     623                         return json_decode($retry_body, true);
     624                    }
     625                }
     626
    597627                return array(
    598628                    'success' => false,
     
    736766
    737767        if (is_wp_error($basic_test)) {
     768             // Attempt auto-reconnect if basic test fails
     769             $reconnect = $this->auto_connect();
     770             if ($reconnect['success']) {
     771                  return $this->test_connection(); // Retry test after reconnect
     772             }
     773
    738774            //error_log('Creation Genius Basic URL Test Failed: ' . $basic_test->get_error_message());
    739775            return array(
  • creation-genius/trunk/readme.txt

    r3443119 r3443437  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1919### 🌟 Why Use Creation Genius?
    2020
    21 Most AI tools force you to copy-paste raw text and manually fix formatting. Creation Genius automates these operational tasks so you can focus on strategy.
     21Most AI tools force you to copy-paste raw text and manually fix formatting. Creation Genius automates operational tasks so you can focus on strategy.
    2222
    2323*   **Context-Aware Generation:** The engine reads your "About Us", "Content Guidelines", and existing posts to mimic your specific tone and style.
     
    103103== Changelog ==
    104104
     105= 1.0.6 =
     106*   **Fix:** Resolved "Undefined variable $plugin" fatal error in settings page.
     107*   **New:** Added auto-connect feature to simplify initial setup.
     108*   **New:** Added auto-reconnect logic to handle API connection drops smoothly.
     109*   **Improvement:** Site analysis now runs immediately upon activation for instant recommendations.
     110*   **Improvement:** Fixed HTML syntax errors in settings page dropdowns.
     111
    105112= 1.0.5 =
    106113*   **New:** Added Performance Analytics module.
  • creation-genius/trunk/views/settings.php

    r3441990 r3443437  
    1212// Get plugin instance
    1313$creation_genius_plugin = Creation_Genius::get_instance();
    14 $creation_genius_api_handler = $plugin->get_api_handler();
     14$creation_genius_api_handler = $creation_genius_plugin->get_api_handler();
    1515
    1616// Get current settings
     
    117117        $creation_genius_base_url = '';
    118118        $creation_genius_connection_date = '';
    119     }
    120 }
    121 
    122 if (isset($_POST['creation_genius_test_connection']) && check_admin_referer('creation_genius_test_connection')) {
    123     $creation_genius_response = $creation_genius_api_handler->test_connection();
    124 
    125     if ($creation_genius_response['success']) {
    126         echo '<div class="notice notice-success is-dismissible"><p>' . esc_html__('Connection test successful!', 'creation-genius') . '</p></div>';
    127     } else {
    128         echo '<div class="notice notice-error is-dismissible"><p>' . esc_html__('Connection test failed: ', 'creation-genius') . esc_html($creation_genius_response['message']) . '</p></div>';
    129     }
    130 }
    131 
    132 if (isset($_POST['creation_genius_disconnect']) && check_admin_referer('creation_genius_disconnect')) {
    133     $creation_genius_response = $creation_genius_api_handler->disconnect_server();
    134 
    135     if ($creation_genius_response['success']) {
    136         echo '<div class="notice notice-success is-dismissible"><p>' . esc_html($creation_genius_response['message']) . '</p></div>';
    137         $creation_genius_is_connected = false;
    138         $creation_genius_api_key = '';
    139         $creation_genius_base_url = '';
    140         $creation_genius_connection_date = '';
    141     } else {
    142         echo '<div class="notice notice-error is-dismissible"><p>' . esc_html($creation_genius_response['message']) . '</p></div>';
    143119    }
    144120}
     
    511487                                        Finance
    512488                                    </option>
    513                                     <option="education" <?php selected(get_option('creation_genius_industry', ''), 'education'); ?>>
     489                                    <option value="education" <?php selected(get_option('creation_genius_industry', ''), 'education'); ?>>
    514490                                        Education
    515491                                    </option>
    516                                     <option="retail" <?php selected(get_option('creation_genius_industry', ''), 'retail'); ?>>
     492                                    <option value="retail" <?php selected(get_option('creation_genius_industry', ''), 'retail'); ?>>
    517493                                        Retail
    518494                                    </option>
    519                                     <option="restaurant" <?php selected(get_option('creation_genius_industry', ''), 'restaurant'); ?>>
     495                                    <option value="restaurant" <?php selected(get_option('creation_genius_industry', ''), 'restaurant'); ?>>
    520496                                        Restaurant & Food
    521497                                    </option>
Note: See TracChangeset for help on using the changeset viewer.