/** * Load the SI application * (function called at the bottom of this page) * * @package EDD_Segment * @return void */ function edd_segment_load() { if (class_exists('EDD_Segment')) { edd_segment_deactivate_plugin(); return; // already loaded, or a name collision } do_action('edd_segment_preload'); ////////// // Load // ////////// // Master class require_once EDD_SEGMENT_PATH . '/Segment.php'; // controllers require_once EDD_SEGMENT_PATH . '/controllers/_Controller.php'; EDD_Segment_Controller::init(); if (!class_exists('SA_Settings_API')) { require_once EDD_SEGMENT_PATH . '/controllers/_Settings.php'; SA_Settings_API::init(); } require_once EDD_SEGMENT_PATH . '/controllers/Settings.php'; EDD_Segment_Settings::init(); require_once EDD_SEGMENT_PATH . '/controllers/Identity.php'; EDD_Segment_Identity::init(); require_once EDD_SEGMENT_PATH . '/controllers/integrations/Segment_API.php'; EDD_Segment_Tracker::init(); require_once EDD_SEGMENT_PATH . '/controllers/integrations/CustomerIO_API.php'; EDD_CustomerIO_Tracker::init(); if (file_exists(EDD_SEGMENT_PATH . '/controllers/add-ons/AJAX_Callbacks.php')) { require_once EDD_SEGMENT_PATH . '/controllers/add-ons/AJAX_Callbacks.php'; EDD_Segment_AJAX_Callbacks::init(); } if (file_exists(EDD_SEGMENT_PATH . '/controllers/add-ons/Freemius_Webhook.php')) { require_once EDD_SEGMENT_PATH . '/controllers/add-ons/Freemius_Webhook.php'; EDD_Segment_Freemius_Webhook::init(); } require_once EDD_SEGMENT_PATH . '/controllers/add-ons/EDD_Hooks.php'; EDD_Segment_Hooks::init(); require_once EDD_SEGMENT_PATH . '/controllers/Updates.php'; EDD_Segment_Updates::init(); require_once EDD_SEGMENT_PATH . '/template-tags/edd-segment.php'; do_action('edd_segment_loaded'); }
public static function maybe_activate_license() { if (!isset($_REQUEST['security'])) { self::ajax_fail('Forget something?'); } $nonce = $_REQUEST['security']; if (!wp_verify_nonce($nonce, self::NONCE)) { self::ajax_fail('Not going to fall for it!'); } if (!current_user_can('activate_plugins')) { return; } if (!isset($_REQUEST['license'])) { self::ajax_fail('No license key submitted'); } update_option(self::LICENSE_KEY_OPTION, $_REQUEST['license']); self::$license_key = $_REQUEST['license']; $activated = self::activate_license(); $message = $activated ? self::__('Thank you for supporting the future of EDD Segment and Sprout Apps.') : self::__('License is not active.'); $response = array('activated' => $activated, 'response' => $message, 'error' => !$activated); header('Content-type: application/json'); echo json_encode($response); exit; }