コード例 #1
0
?>
</h4>
						<?php 
self::_e('An active license for Sprout Clients provides support and updates. By activating your license, you can get automatic plugin updates from the WordPress dashboard. Updates provide you with the latest bug fixes and the new features each major release brings.');
?>
</p>
				</div>
				<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');
    ?>
コード例 #2
0
 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;
 }