ACF
Updater::get_plugin_info
Returns update information for the given plugin id.
Метод класса: Updater{}
Хуков нет.
Возвращает
Массив|WP_Error.
Использование
$Updater = new Updater(); $Updater->get_plugin_info( $id, $force_check );
- $id(строка)
- The plugin id such as
'pro'.
По умолчанию:'' - $force_check(true|false)
- Bypasses cached result.
По умолчанию:false
Список изменений
| С версии 5.5.10 | Введена. |
Код Updater::get_plugin_info() Updater::get plugin info ACF 6.4.2
public function get_plugin_info( $id = '', $force_check = false ) {
$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;
}
}
$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 );
// update transient.
set_transient( $transient_name, $response, $expiration );
return $response;
}