← All changes
|
includes/integration/openai/plugin-upgrader/utils.php
+51
-51
8.5.6
→
8.3.8
View file →
| @@ -1,52 +1,52 @@ | ||
| 1 | -<?php | |
| 2 | -if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| 3 | -function qcld_openaiaddon_activate_au() | |
| 4 | -{ | |
| 5 | - $plugin_slug = openaiaddon_LICENSING_PLUGIN_SLUG; | |
| 6 | - $get_plugin_data = get_openaiaddon_licensing_plugin_data(); | |
| 7 | - | |
| 8 | - $plugin_current_version = $get_plugin_data['Version']; | |
| 9 | - $plugin_remote_path = openaiaddon_LICENSING_PLUGIN_NAME; | |
| 10 | - $license_key = get_openaiaddon_licensing_key(); | |
| 11 | - $buy_from = get_openaiaddon_licensing_buy_from(); | |
| 12 | - | |
| 13 | - if( $buy_from == 'quantumcloud' ){ | |
| 14 | - $upgrader_instance = new qcld_openaiaddon_AutoUpdate ( $plugin_current_version, $plugin_remote_path, $plugin_slug, '', $license_key ); | |
| 15 | - } | |
| 16 | -} | |
| 17 | -add_action( 'init', 'qcld_openaiaddon_activate_au' ); | |
| 18 | - | |
| 19 | - | |
| 20 | -function qcld_openaiaddon_upgrade_completed( $upgrader_object, $options ) { | |
| 21 | - // The path to our plugin's main file | |
| 22 | - $plugin_slug = openaiaddon_LICENSING_PLUGIN_SLUG; | |
| 23 | - // If an update has taken place and the updated type is plugins and the plugins element exists | |
| 24 | - if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { | |
| 25 | - // Iterate through the plugins being updated and check if ours is there | |
| 26 | - foreach( $options['plugins'] as $plugin ) { | |
| 27 | - if( $plugin == $plugin_slug ) { | |
| 28 | - deleteqc_openaiaddon_update_transient(); | |
| 29 | - deleteqc_openaiaddon_renew_transient(); | |
| 30 | - } | |
| 31 | - } | |
| 32 | - } | |
| 33 | - update_option( 'qcld_openai_relevant_post', ['post','page'] ); | |
| 34 | -} | |
| 35 | -add_action( 'upgrader_process_complete', 'qcld_openaiaddon_upgrade_completed', 10, 2 ); | |
| 36 | - | |
| 37 | -add_action('admin_enqueue_scripts', 'qcld_openaiaddon_licensing_scripts'); | |
| 38 | - | |
| 39 | -function qcld_openaiaddon_licensing_scripts(){ | |
| 40 | - wp_enqueue_style('qcld_openaiaddon_licensing_style', plugin_dir_url( __FILE__ ).'/assets/css/style.css'); | |
| 41 | - | |
| 42 | - //start new-update-for-codecanyon | |
| 43 | - wp_enqueue_script('qcld_openaiaddon_licensing_script', plugin_dir_url( __FILE__ ).'/assets/js/script.js', array('jquery'), false, true ); | |
| 44 | - | |
| 45 | - wp_localize_script( 'qcld_openaiaddon_licensing_script', 'wplivechat_licensing_admin_ajax', array( | |
| 46 | - | |
| 47 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 48 | - 'nonce' => wp_create_nonce( "wplivechat_licensing_admin_nonce" ) | |
| 49 | - ) | |
| 50 | - ); | |
| 51 | - //end new-update-for-codecanyon | |
| 1 | +<?php | |
| 2 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| 3 | +function qcld_openaiaddon_activate_au() | |
| 4 | +{ | |
| 5 | + $plugin_slug = openaiaddon_LICENSING_PLUGIN_SLUG; | |
| 6 | + $get_plugin_data = get_openaiaddon_licensing_plugin_data(); | |
| 7 | + | |
| 8 | + $plugin_current_version = $get_plugin_data['Version']; | |
| 9 | + $plugin_remote_path = openaiaddon_LICENSING_PLUGIN_NAME; | |
| 10 | + $license_key = get_openaiaddon_licensing_key(); | |
| 11 | + $buy_from = get_openaiaddon_licensing_buy_from(); | |
| 12 | + | |
| 13 | + if( $buy_from == 'quantumcloud' ){ | |
| 14 | + $upgrader_instance = new qcld_openaiaddon_AutoUpdate ( $plugin_current_version, $plugin_remote_path, $plugin_slug, '', $license_key ); | |
| 15 | + } | |
| 16 | +} | |
| 17 | +add_action( 'init', 'qcld_openaiaddon_activate_au' ); | |
| 18 | + | |
| 19 | + | |
| 20 | +function qcld_openaiaddon_upgrade_completed( $upgrader_object, $options ) { | |
| 21 | + // The path to our plugin's main file | |
| 22 | + $plugin_slug = openaiaddon_LICENSING_PLUGIN_SLUG; | |
| 23 | + // If an update has taken place and the updated type is plugins and the plugins element exists | |
| 24 | + if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { | |
| 25 | + // Iterate through the plugins being updated and check if ours is there | |
| 26 | + foreach( $options['plugins'] as $plugin ) { | |
| 27 | + if( $plugin == $plugin_slug ) { | |
| 28 | + deleteqc_openaiaddon_update_transient(); | |
| 29 | + deleteqc_openaiaddon_renew_transient(); | |
| 30 | + } | |
| 31 | + } | |
| 32 | + } | |
| 33 | + update_option( 'qcld_openai_relevant_post', ['post','page'] ); | |
| 34 | +} | |
| 35 | +add_action( 'upgrader_process_complete', 'qcld_openaiaddon_upgrade_completed', 10, 2 ); | |
| 36 | + | |
| 37 | +add_action('admin_enqueue_scripts', 'qcld_openaiaddon_licensing_scripts'); | |
| 38 | + | |
| 39 | +function qcld_openaiaddon_licensing_scripts(){ | |
| 40 | + wp_enqueue_style('qcld_openaiaddon_licensing_style', plugin_dir_url( __FILE__ ).'/assets/css/style.css'); | |
| 41 | + | |
| 42 | + //start new-update-for-codecanyon | |
| 43 | + wp_enqueue_script('qcld_openaiaddon_licensing_script', plugin_dir_url( __FILE__ ).'/assets/js/script.js', array('jquery'), false, true ); | |
| 44 | + | |
| 45 | + wp_localize_script( 'qcld_openaiaddon_licensing_script', 'wplivechat_licensing_admin_ajax', array( | |
| 46 | + | |
| 47 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 48 | + 'nonce' => wp_create_nonce( "wplivechat_licensing_admin_nonce" ) | |
| 49 | + ) | |
| 50 | + ); | |
| 51 | + //end new-update-for-codecanyon | |
| 52 | 52 | } |