<?php
namespace Elementor\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Http extends \WP_Http {
/**
* Pass multiple urls to implements a fallback machine when one of the urls
* is sending an error or not exists anymore.
*
* @param array $urls
* @param array $args
*
* @return array|\WP_Error|null
*/
public function request_with_fallback( array $urls, $args = [] ) {
$response = null;
foreach ( $urls as $url ) {
$response = $this->request( $url, $args );
if ( $this->is_successful_response( $response ) ) {
return $response;
}
}
return $response;
}
/**
* @param $response
*
* @return bool
*/
private function is_successful_response( $response ) {
if ( is_wp_error( $response ) ) {
return false;
}
$response_code = (int) wp_remote_retrieve_response_code( $response );
if ( in_array( $response_code, [ 0, 404, 500 ], true ) ) {
return false;
}
return true;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| api/ | 2026-11-25 08:10 | 3.25 KB | 76129f60960:kunden | dxwrx-rx-r | |
| document/ | 2026-11-25 08:10 | 16 KB | 76129f60960:kunden | dxwrx-rx-r | |
| import-export/ | 2026-11-25 08:10 | 100.8 KB | 76129f60960:kunden | dxwrx-rx-r | |
| promotions/ | 2026-11-25 08:10 | 2.56 KB | 76129f60960:kunden | dxwrx-rx-r | |
| svg/ | 2026-11-25 08:10 | 18.12 KB | 76129f60960:kunden | dxwrx-rx-r | |
| ab-test.php | 2026-11-25 08:10 | 2.45 KB | 76129f60960:kunden | -xw-x--x-- | |
| assets-config-provider.php | 2026-11-25 08:10 | 1.49 KB | 76129f60960:kunden | -xw-x--x-- | |
| assets-translation-loader.php | 2026-11-25 08:10 | 2.51 KB | 76129f60960:kunden | -xw-x--x-- | |
| collection.php | 2026-11-25 08:10 | 10.13 KB | 76129f60960:kunden | -xw-x--x-- | |
| exceptions.php | 2026-11-25 08:10 | 709 B | 76129f60960:kunden | -xw-x--x-- | |
| force-locale.php | 2026-11-25 08:10 | 3.55 KB | 76129f60960:kunden | -xw-x--x-- | |
| hints.php | 2026-11-25 08:10 | 16.43 KB | 76129f60960:kunden | -xw-x--x-- | |
| http.php | 2026-11-25 08:10 | 981 B | 76129f60960:kunden | -xw-x--x-- | |
| plugins-manager.php | 2026-11-25 08:10 | 2.84 KB | 76129f60960:kunden | -xw-x--x-- | |
| static-collection.php | 2026-11-25 08:10 | 1.09 KB | 76129f60960:kunden | -xw-x--x-- | |
| str.php | 2026-11-25 08:10 | 1001 B | 76129f60960:kunden | -xw-x--x-- | |
| template-library-element-iterator.php | 2026-11-25 08:10 | 766 B | 76129f60960:kunden | -xw-x--x-- | |
| template-library-import-export-utils.php | 2026-11-25 08:10 | 7.2 KB | 76129f60960:kunden | -xw-x--x-- | |
| template-library-snapshot-processor.php | 2026-11-25 08:10 | 6.76 KB | 76129f60960:kunden | -xw-x--x-- | |
| version.php | 2026-11-25 08:10 | 3.78 KB | 76129f60960:kunden | -xw-x--x-- | |