← All changes
|
vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php
+19
-2
3.1.3
→
3.5.1
View file →
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | * @param Product $product Product data. |
| 37 | 37 | * |
| 38 | 38 | * @return bool Should load module? |
| 39 | 39 | */ |
| 40 | - public abstract function can_load( $product ); | |
| 40 | + abstract public function can_load( $product ); | |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Bootstrap the module. |
| 44 | 44 | * |
| @@ -43,9 +43,9 @@ | ||
| 43 | 43 | * Bootstrap the module. |
| 44 | 44 | * |
| 45 | 45 | * @param Product $product Product object. |
| 46 | 46 | */ |
| 47 | - public abstract function load( $product ); | |
| 47 | + abstract public function load( $product ); | |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Check if the product is from partner. |
| 51 | 51 | * |
| @@ -61,6 +61,23 @@ | ||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return array_key_exists( $product->get_slug(), Module_Factory::$slugs ); |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Wrapper for wp_remote_get on VIP environments. | |
| 69 | + * | |
| 70 | + * @param string $url Url to check. | |
| 71 | + * @param array $args Option params. | |
| 72 | + * | |
| 73 | + * @return array|\WP_Error | |
| 74 | + */ | |
| 75 | + public function safe_get( $url, $args = array() ) { | |
| 76 | + return function_exists( 'vip_safe_wp_remote_get' ) | |
| 77 | + ? vip_safe_wp_remote_get( $url ) | |
| 78 | + : wp_remote_get( //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, Already used. | |
| 79 | + $url, | |
| 80 | + $args | |
| 81 | + ); | |
| 65 | 82 | } |
| 66 | 83 | } |