true ) ); } } } /** Remove Lite's scheduled cache task on deactivation. */ function affiai_lite_deactivate_cron() { wp_clear_scheduled_hook( 'affiai_cron_clean' ); if ( class_exists( 'Affiai_Refresh_Claim' ) ) { Affiai_Refresh_Claim::deactivate(); } // Completed evidence remains historical; only an unfinished visit is cancelled. $scope = get_option( 'affiai_first_success_attempt_v1', array() ); if ( is_array( $scope ) && ! isset( $scope['result'] ) ) { global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name = %s AND option_value = %s", 'affiai_first_success_attempt_v1', maybe_serialize( $scope ) ) ); wp_cache_delete( 'affiai_first_success_attempt_v1', 'options' ); } } register_deactivation_hook( __FILE__, 'affiai_lite_deactivate_cron' ); /** * This code includes the necessary files for the plugin to function properly. * * The included files are: * - afx-save.php: contains the functions for Dashboard table. * - afx-config.php: contains the functions for initializing the plugin settings. * - afx-shortcode.php: contains the functions for creating the plugin shortcode. * * @package AFFI PLUGIN * @subpackage Includes */ require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'afx-save.php'; require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'afx-config.php'; require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'afx-shortcode.php'; require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'affiai-health.php'; require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'affiai-first-success.php'; /** * * The class contains constants, properties, and methods for the plugin. * * @package AFFI PLUGIN */ class AffiAI { const API_URL = 'https://affi-ai.com'; const AFF_URL = 'https://www.affi.ai'; const AFF_CNTRY = array( 'AU' => 'com.au', 'BR' => 'com.br', 'BE' => 'com.be', 'CA' => 'ca', 'CA_FR' => 'ca_fr', 'FR' => 'fr', 'DE' => 'de', 'IN' => 'in', 'IT' => 'it', 'JP' => 'co.jp', 'MX' => 'com.mx', 'ES' => 'es', 'UK' => 'co.uk', 'US' => 'com', 'AE' => 'ae', 'SA' => 'sa', 'TR' => 'com.tr', 'NL' => 'nl', 'SE' => 'se', 'SG' => 'sg', 'PL' => 'pl', 'EG' => 'eg' ); public static $count_afx = 0; public static $call_amp = 0; public static $count_widg_afx = 0; protected static $attrib; protected static $merchants; protected static $templates; protected static $time_cache; protected static $user_right; protected static $used_products = array(); protected static $content_cache = array(); protected static $ean = array(); // SAME AS $pid use AffiAI_Config, AffiAI_Shortcode; } require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'afx-link.php'; require_once AFFIAI_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'afx-img.php'; // ADD IMG if ( function_exists( 'has_blocks' ) && function_exists( 'register_block_type_from_metadata' ) ) { require_once AFFIAI_PLUGIN_DIR . 'admin/afx-gt.php'; } $BE = 0; if ( isset($_GET['page']) && $_GET['page'] == AFFIAI_PLUGIN_NAME ) { $BE = 1; } if ( is_admin() || $BE ) { require_once AFFIAI_PLUGIN_DIR . 'admin/afx-ce.php'; function affiai_check_ce_plugin() { new AFFIAI_Classic_Editor(); } add_action( 'admin_init', 'affiai_check_ce_plugin' ); } AffiAI::init(); /** * Redirects to a custom page when a page is trashed in WordPress admin panel. * * @return void */ function affiai_wpse_trashed_redirect() { $screen = get_current_screen(); if('edit-page' == $screen->id){ if( isset($_GET['trashed']) && intval($_GET['trashed']) > 0 ) { $redirect = add_query_arg(array('page'=>'custom_page_oder', 'trashed' => false, 'ids' => false )); wp_safe_redirect($redirect); exit(); } } } add_action('load-edit.php','affiai_wpse_trashed_redirect');