wp/lib/blobcommon.php
protected static function get_release_info(string $key, $template) {
		// PHP 5.6.0 compatibility has been dropped, so nobody can
		// update until they update PHP.
		if (\version_compare(\PHP_VERSION, '7.2.0') < 0) {
			return false;
		}

		// Already pulled it?
		if (isset(static::$_release[$key])) {
			return static::$_release[$key];
		}

		// WordPress hides relevant functionality in this file.
		require_once \ABSPATH . 'wp-admin/includes/plugin.php';

		$uri = \get_file_data(
			\BLOBCOMMON_INDEX,
			array('json'=>$key),
			'plugin'
		);
		$uri = $uri['json'];
		r_sanitize::url($uri);
		if (! $uri) {
			static::$_release[$key] = false;
			return static::$_release[$key];
		}

		// Cache this to the transient table for a little bit.
		$transient_key = 'blob-common_remote_' . \md5($uri . $key);
		if (false !== (static::$_release[$key] = \get_transient($transient_key))) {
			return static::$_release[$key];
		}

		// Read the file.
		$response = \wp_remote_get($uri);
		if (200 !== \wp_remote_retrieve_response_code($response)) {
			static::$_release[$key] = false;
			return static::$_release[$key];
		}

		// Decode the JSON.
		static::$_release[$key] = data::json_decode_array(
			\wp_remote_retrieve_body($response),
			$template
		);

		// Add the URI we discovered, just in case.
		static::$_release[$key]['json_uri'] = $uri;

		// Cache it for a while.
		\set_transient($transient_key, static::$_release[$key], \HOUR_IN_SECONDS);

		// And we're done.
		return static::$_release[$key];
	}
protected static function get_release_info(string $key, $template) {
		// PHP 5.6.0 compatibility has been dropped, so nobody can
		// update until they update PHP.
		if (\version_compare(\PHP_VERSION, '7.2.0') < 0) {
			return false;
		}

		// Already pulled it?
		if (isset(static::$_release[$key])) {
			return static::$_release[$key];
		}

		// WordPress hides relevant functionality in this file.
		require_once \ABSPATH . 'wp-admin/includes/plugin.php';

		$uri = \get_file_data(
			\BLOBCOMMON_INDEX,
			array('json'=>$key),
			'plugin'
		);
		$uri = $uri['json'];
		r_sanitize::url($uri);
		if (! $uri) {
			static::$_release[$key] = false;
			return static::$_release[$key];
		}

		// Cache this to the transient table for a little bit.
		$transient_key = 'blob-common_remote_' . \md5($uri . $key);
		if (false !== (static::$_release[$key] = \get_transient($transient_key))) {
			return static::$_release[$key];
		}

		// Read the file.
		$response = \wp_remote_get($uri);
		if (200 !== \wp_remote_retrieve_response_code($response)) {
			static::$_release[$key] = false;
			return static::$_release[$key];
		}

		// Decode the JSON.
		static::$_release[$key] = data::json_decode_array(
			\wp_remote_retrieve_body($response),
			$template
		);

		// Add the URI we discovered, just in case.
		static::$_release[$key]['json_uri'] = $uri;

		// Cache it for a while.
		\set_transient($transient_key, static::$_release[$key], \HOUR_IN_SECONDS);

		// And we're done.
		return static::$_release[$key];
	}
protected static function get_release_info ( string $ key , $ template ) { // PHP 5.6.0 compatibility has been dropped, so nobody can // update until they update PHP. if ( \ version_compare ( \ PHP_VERSION , '7.2.0' ) < 0 ) { return false ; } // Already pulled it? if ( isset ( static :: $ _release [ $ key ] ) ) { return static :: $ _release [ $ key ] ; } // WordPress hides relevant functionality in this file. require_once \ ABSPATH . 'wp-admin/includes/plugin.php' ; $ uri = \ get_file_data ( \ BLOBCOMMON_INDEX , array ( 'json' => $ key ) , 'plugin' ) ; $ uri = $ uri [ 'json' ] ; r_sanitize :: url ( $ uri ) ; if ( ! $ uri ) { static :: $ _release [ $ key ] = false ; return static :: $ _release [ $ key ] ; } // Cache this to the transient table for a little bit. $ transient_key = 'blob-common_remote_' . \ md5 ( $ uri . $ key ) ; if ( false !== ( static :: $ _release [ $ key ] = \ get_transient ( $ transient_key ) ) ) { return static :: $ _release [ $ key ] ; } // Read the file. $ response = \ wp_remote_get ( $ uri ) ; if ( 200 !== \ wp_remote_retrieve_response_code ( $ response ) ) { static :: $ _release [ $ key ] = false ; return static :: $ _release [ $ key ] ; } // Decode the JSON. static :: $ _release [ $ key ] = data :: json_decode_array ( \ wp_remote_retrieve_body ( $ response ) , $ template ) ; // Add the URI we discovered, just in case. static :: $ _release [ $ key ] [ 'json_uri' ] = $ uri ; // Cache it for a while. \ set_transient ( $ transient_key , static :: $ _release [ $ key ] , \ HOUR_IN_SECONDS ) ; // And we're done. return static :: $ _release [ $ key ] ; }
Parse Release File

Both the plugin and library have JSON files containing release
information. These files tell WordPress whether or not an update
is available, and where to find it.

@param string $key Header key containing JSON URI.
@param array $template Data template.
@return array Info.
Parse Release File