AdvancedMathCaptcha.php
3 years ago
AeliaCurrencySwitcher.php
3 years ago
BeaverBuilder.php
4 years ago
CF_Helper.php
3 years ago
Cloudflare.php
2 years ago
CommonHelpers.php
3 years ago
CookieNotice.php
4 years ago
DownloadManager.php
4 years ago
Elementor.php
3 years ago
Ezoic.php
4 years ago
FusionBuilder.php
4 years ago
GeoTargetingWP.php
2 years ago
GravityForms.php
2 years ago
JetPackNP.php
3 years ago
NginxHelper.php
2 years ago
RC.php
3 years ago
RankMathNP.php
3 years ago
ShortPixel.php
4 years ago
SquirrlySEO.php
3 years ago
TheEventsCalendar.php
3 years ago
ThriveTheme.php
4 years ago
WCML.php
3 years ago
WPBakeryNP.php
3 years ago
WPCacheHelper.php
3 years ago
WPForms.php
3 years ago
WPRocket.php
4 years ago
Woocommerce.php
4 years ago
WoocommerceCacheHandler.php
4 years ago
YoastSEO.php
3 years ago
CommonHelpers.php
19 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Plugin; |
| 4 | use \NitroPack\HttpClient\HttpClient; |
| 5 | |
| 6 | trait CommonHelpers { |
| 7 | public static function validateURL($url, $content_type = false) { |
| 8 | $httpClient = new HttpClient($url); |
| 9 | $httpClient->fetch(); |
| 10 | if ($httpClient->getStatusCode() == 200 ) |
| 11 | return $content_type ? self::validateContentType( $httpClient->getHeaders(), $content_type ) : true; |
| 12 | |
| 13 | return false; |
| 14 | } |
| 15 | public static function validateContentType($headers, $content_type) { |
| 16 | return strpos($headers['content-type'], $content_type) !== false; |
| 17 | } |
| 18 | } |
| 19 |