ACF_Updates::get_plugin_info()publicACF 5.5.10

get_plugin_info

Returns update information for the given plugin id.

{} Это метод класса: ACF_Updates{}

Хуков нет.

Возвращает

Массив|WP_Error.

Использование

$ACF_Updates = new ACF_Updates();
$ACF_Updates->get_plugin_info( $id, $force_check );
$id(строка)
The plugin id such as 'pro'.
По умолчанию: ''
$force_check(true|false)
Bypasses cached result.
По умолчанию: false

Список изменений

С версии 5.5.10 Введена.

Код ACF_Updates::get_plugin_info() ACF 5.10.2

function get_plugin_info( $id = '', $force_check = false ) {

	// var
	$transient_name = 'acf_plugin_info_' . $id;

	// check cache but allow for $force_check override
	if ( ! $force_check ) {
		$transient = get_transient( $transient_name );
		if ( $transient !== false ) {
			return $transient;
		}
	}

	// connect
	$response = $this->request( 'v2/plugins/get-info?p=' . $id );

	// convert string (misc error) to WP_Error object
	if ( is_string( $response ) ) {
		$response = new WP_Error( 'server_error', esc_html( $response ) );
	}

	// allow json to include expiration but force minimum and max for safety
	$expiration = $this->get_expiration( $response, DAY_IN_SECONDS, MONTH_IN_SECONDS );

	// update transient
	set_transient( $transient_name, $response, $expiration );

	// return
	return $response;
}