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 Sprout Clients 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; }
<div class="activation_inputs clearfix"> <input type="text" name="<?php echo SC_Updates::LICENSE_KEY_OPTION; ?> " id="<?php echo SC_Updates::LICENSE_KEY_OPTION; ?> " value="<?php echo SC_Updates::license_key(); ?> " class="fat-input <?php echo 'license_' . SC_Updates::license_status(); ?> " size="40" class="text-input"> <?php if (SC_Updates::license_status() != false && SC_Updates::license_status() == 'valid') { ?> <button id="sc_activate_license" class="button button-large" disabled="disabled"><?php self::_e('Activate License'); ?> </button> <button id="sc_deactivate_license" class="button button-large"><?php self::_e('Deactivate License'); ?> </button> <?php } else { ?> <button id="sc_activate_license" class="button button-primary button-large"><?php self::_e('Activate License'); ?>
/** * Load the SC application * * @package Sprout_Clients * @return void */ function sprout_clients_load() { if (class_exists('Sprout_Client')) { sc_deactivate_plugin(); return; // already loaded, or a name collision } do_action('sprout_clients_preload'); ////////// // Load // ////////// /** * Master class */ require_once SC_PATH . '/Sprout_Clients.php'; // models require_once SC_PATH . '/models/_Model.php'; require_once SC_PATH . '/models/Client.php'; require_once SC_PATH . '/models/Message.php'; require_once SC_PATH . '/models/Record.php'; // controllers require_once SC_PATH . '/controllers/_Controller.php'; require_once SC_PATH . '/languages/Sprout_Clients_l10n.php'; if (!class_exists('Sprout_Invoices')) { require_once SC_PATH . '/controllers/admin/_Settings.php'; } require_once SC_PATH . '/controllers/admin/Settings.php'; // controllers -- clients require_once SC_PATH . '/controllers/clients/Clients.php'; require_once SC_PATH . '/controllers/clients/Clients_Users.php'; require_once SC_PATH . '/controllers/clients/Clients_Admin_Meta_Boxes.php'; require_once SC_PATH . '/controllers/clients/Clients_Admin_Table.php'; require_once SC_PATH . '/controllers/clients/Clients_AJAX.php'; // controllers -- history require_once SC_PATH . '/controllers/history/Client_History.php'; require_once SC_PATH . '/controllers/history/SI_History.php'; // controllers -- messages require_once SC_PATH . '/controllers/messages/Messages.php'; require_once SC_PATH . '/controllers/messages/Message_Triggers.php'; require_once SC_PATH . '/controllers/messages/Messages_Admin_Meta_Boxes.php'; require_once SC_PATH . '/controllers/messages/Messages_Admin_Settings.php'; require_once SC_PATH . '/controllers/messages/Messages_Admin_Table.php'; require_once SC_PATH . '/controllers/messages/Messages_Route.php'; require_once SC_PATH . '/controllers/messages/Messages_Shortcodes.php'; require_once SC_PATH . '/controllers/messages/Messages_Templates.php'; require_once SC_PATH . '/controllers/records/Internal_Records.php'; require_once SC_PATH . '/controllers/records/Records_Admin_Table.php'; require_once SC_PATH . '/controllers/updates/Updates.php'; // template-tags require_once SC_PATH . '/template-tags/sprout-clients.php'; require_once SC_PATH . '/template-tags/forms.php'; require_once SC_PATH . '/template-tags/ui.php'; require_once SC_PATH . '/template-tags/users.php'; require_once SC_PATH . '/template-tags/utility.php'; /** * Master Model */ SC_Post_Type::init(); /** * Client Model */ Sprout_Client::init(); /** * Messages Model */ SC_Message::init(); /** * Shared Models */ SC_Record::init(); /** * Master Controller */ SC_Controller::init(); /** * Records is shared with Sprout Invoices */ SC_Internal_Records::init(); /** * l10n */ SC_l10n::init(); /** * Settings */ if (!class_exists('Sprout_Invoices')) { SA_Settings_API::init(); } SC_Settings::init(); /** * Clients */ SC_Clients::init(); SC_Users::init(); SC_Clients_Admin_Meta_Boxes::init(); SC_Clients_Admin_Table::init(); SC_Clients_AJAX::init(); SC_Client_History::init(); SC_Invoices_History::init(); /** * Messaging */ /*/ SC_Messages::init(); SC_Messages_Meta::init(); SC_Messages_Admin_Settings::init(); SC_Messages_Route::init(); SC_Message_Shortcodes::init(); SC_Templates::init(); SC_Message_Triggers::init(); /**/ SC_Updates::init(); do_action('sprout_clients_loaded'); }