Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function auv_check_for_updates( $transient ){
- if ( empty( $transient->checked ) ) {
- return $transient;
- }
- //Get the current version available
- $url = 'http://websupporter.net/current-version.txt';
- $response = wp_remote_get( $url );
- $version = (float) $response['body'];
- //Get information about the installed version
- if( ! function_exists( 'get_plugin_data' ) )
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
- $plugin_data = get_plugin_data( __FILE__, false, false );
- //If update is needed
- if( version_compare( $version, $plugin_data['Version'], '>' ) ){
- //add our information
- $update_info = array(
- 'plugin' => plugin_basename( __FILE__ ),
- 'slug' => plugin_basename( __FILE__ ),
- 'new_version' => $version,
- 'url' => 'http://websupporter.net/',
- 'package' => 'http://websupporter.net/current-version.zip',
- );
- $transient->response[ plugin_basename( __FILE__ ) ] = (object) $update_info;
- }
- return $transient;
- }
- add_action( 'pre_set_site_transient_update_plugins', 'auv_check_for_updates' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement