ACF_Updates::get_expiration()
This function safely gets the expiration value from a response.
Метод класса: ACF_Updates{}
Хуков нет.
Возвращает
int
.
Использование
$ACF_Updates = new ACF_Updates(); $ACF_Updates->get_expiration( $response, $min, $max );
- $response(разное)
- The response from the server.
По умолчанию: false - $min(int)
- The minimum expiration limit.
- $max(int)
- The maximum expiration limit.
Список изменений
С версии 5.6.9 | Введена. |
Код ACF_Updates::get_expiration() ACF Updates::get expiration ACF 6.0.4
public function get_expiration( $response = false, $min = 0, $max = 0 ) { $expiration = 0; // check possible error conditions. if ( is_wp_error( $response ) || is_string( $response ) ) { return 5 * MINUTE_IN_SECONDS; } // use the server requested expiration if present. if ( is_array( $response ) && isset( $response['expiration'] ) ) { $expiration = (int) $response['expiration']; } // use the minimum if neither check matches, or ensure the server expiration isn't lower than our minimum. if ( $expiration < $min ) { return $min; } // ensure the server expiration isn't higher than our max. if ( $expiration > $max ) { return $max; } return $expiration; }