add_action('admin_init', 'api_init_menu_items'); modules\api\core\Apiinit::the_da_vinci_code(API_MODULE_NAME); /** * Load the module helper */ $CI = & get_instance(); $CI->load->helper(API_MODULE_NAME . '/api'); /** * Register activation module hook */ register_activation_hook(API_MODULE_NAME, 'api_activation_hook'); function api_activation_hook() { require_once(__DIR__ . '/install.php'); } /** * Register language files, must be registered if the module is using languages */ register_language_files(API_MODULE_NAME, [API_MODULE_NAME]); /** * Init api module menu items in setup in admin_init hook * @return null */ function api_init_menu_items() { /** * If the logged in user is administrator, add custom menu in Setup */ if (is_admin()) { $CI = &get_instance(); $CI->app_menu->add_sidebar_menu_item('api-options', [ 'collapse' => true, 'name' => _l('api'), 'position' => 40, 'icon' => 'fa fa-cogs', ]); $CI->app_menu->add_sidebar_children_item('api-options', [ 'slug' => 'api-register-options', 'name' => _l('api_management'), 'href' => admin_url('api/api_management'), 'position' => 5, ]); $CI->app_menu->add_sidebar_children_item('api-options', [ 'slug' => 'api-guide-options', 'name' => _l('api_guide'), 'href' => 'https://perfexcrm.themesic.com/apiguide/', 'position' => 10, ]); $CI->app_menu->add_sidebar_children_item('api-options', [ 'slug' => 'api-sandbox-options', 'name' => _l('api_sandbox'), 'href' => site_url('api/playground'), 'position' => 15, ]); $CI->app_menu->add_sidebar_children_item('api-options', [ 'slug' => 'api-user-stats-options', 'name' => _l('user_statistics'), 'href' => admin_url('api/user_stats'), 'position' => 16, ]); $CI->app_menu->add_sidebar_children_item('api-options', [ 'slug' => 'api-reporting-options', 'name' => _l('api_reporting'), 'href' => admin_url('api/reporting'), 'position' => 17, ]); } } // License validation disabled for SaaS testing // hooks()->add_action('app_init', API_MODULE_NAME . '_actLib'); // function api_actLib() // { // $CI = &get_instance(); // $CI->load->library(API_MODULE_NAME . '/api_aeiou'); // $envato_res = $CI->api_aeiou->validatePurchase(API_MODULE_NAME); // if (!$envato_res) { // set_alert('danger', 'One of your modules failed its verification and got deactivated. Please reactivate or contact support.'); // } // } hooks()->add_action('pre_activate_module', API_MODULE_NAME . '_sidecheck'); function api_sidecheck($module_name) { if (API_MODULE_NAME == $module_name['system_name']) { modules\api\core\Apiinit::activate($module_name); } } hooks()->add_action('pre_deactivate_module', API_MODULE_NAME . '_deregister'); function api_deregister($module_name) { if (API_MODULE_NAME == $module_name['system_name']) { delete_option(API_MODULE_NAME . '_verification_id'); delete_option(API_MODULE_NAME . '_last_verification'); delete_option(API_MODULE_NAME . '_product_token'); delete_option(API_MODULE_NAME . '_heartbeat'); } } // Support notification function disabled for SaaS testing /* function api_supported_until() { if (get_option('extra_support_notice') == 0) { return; } else { $supported_until = get_option(API_MODULE_NAME.'_supported_until'); if (empty($supported_until)) { return; } $date_only = substr($supported_until, 0, 10); $supported_until_timestamp = strtotime($date_only); $current_date_timestamp = time(); if ($supported_until_timestamp < ($current_date_timestamp - (6 * 30 * 24 * 60 * 60))) { echo '


⚠️ The support period for one of your modules seems over.

We offer an alternative way to receive free support for potential issues,
simply by rating our product on . Click here to do that 👈


Your feedback help us continue developing and improving the product!



Thanks, do not show this again ✔️
'; } } } */ // Dismiss URL handling disabled for SaaS testing /* if (isset($_GET['dismiss']) && $_GET['dismiss'] === 'true') { update_option('extra_support_notice', 0); // Dismiss the notice // Redirect to clear the URL parameter and avoid it being triggered again header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } */ // Support notification disabled for SaaS testing // hooks()->add_action('app_admin_head', 'api_supported_until'); // Support extension hiding disabled for SaaS testing /* function api_hide_support_extension() { echo ""; } hooks()->add_action('app_admin_footer', 'api_hide_support_extension'); */