Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function instance() {
- updater();
- }
- updater() {
- $license_status = edd_check_license($license_key);
- if($license_status == 'valid') {
- $edd_updater = new WPF_Plugin_Updater( etc );
- } else {
- global $pagenow;
- if ( 'plugins.php' === $pagenow )
- add_action("after_plugin_row_" . WPF_PLUGIN_PATH, 'display_license_warning', 10, 3);
- }
- }
- edd_check_license($license_key) {
- $status = get_transient( 'wpf_license_check' );
- if( false === $status ) {
- $api_params = array(
- 'edd_action'=> 'check_license',
- 'license' => $license_key,
- 'item_name' => urlencode( 'WP Fusion' ),
- 'url' => home_url()
- );
- $response = wp_remote_post( WPF_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
- if ( is_wp_error( $response ) )
- return false;
- $license_data = json_decode( wp_remote_retrieve_body( $response ) );
- $this->set('license_status', $license_data->license);
- set_transient( 'wpf_license_check', true, 60*60*24*3 );
- return $license_data->license;
- } else {
- return $this->get('license_status');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement