Automattic\WooCommerce\Internal\TransientFiles
TransientFilesEngine::handle_parse_request
Handle the "parse_request" action for the "wc/file/transient" endpoint.
If the request is not for "/wc/file/transient/<filename>" or "index.php?wc-transient-file-name=filename", it returns without doing anything. Otherwise, it will serve the contents of the file with the provided name if it exists, is public and has not expired; or will return a "Not found" status otherwise.
The file will be served with a content type header of "text/html".
Метод класса: TransientFilesEngine{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$TransientFilesEngine = new TransientFilesEngine(); $TransientFilesEngine->handle_parse_request();
Код TransientFilesEngine::handle_parse_request() TransientFilesEngine::handle parse request WC 10.5.1
public function handle_parse_request() {
global $wp;
// phpcs:ignore WordPress.Security
$query_arg = wp_unslash( $_GET['wc-transient-file-name'] ?? null );
if ( ! is_null( $query_arg ) ) {
$wp->query_vars['wc-transient-file-name'] = $query_arg;
}
if ( is_null( $wp->query_vars['wc-transient-file-name'] ?? null ) ) {
return;
}
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput
if ( 'GET' !== ( $_SERVER['REQUEST_METHOD'] ?? null ) ) {
status_header( 405 );
exit();
}
$this->serve_file_contents( $wp->query_vars['wc-transient-file-name'] );
}