| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function ensureHttps($image) |
||
| 14 | { |
||
| 15 | if (! $image) { |
||
| 16 | return; |
||
| 17 | } |
||
| 18 | |||
| 19 | $parsed = parse_url($image); |
||
| 20 | |||
| 21 | if ($parsed['scheme'] == 'https' || |
||
| 22 | $parsed['scheme'] == 'ssl' || |
||
| 23 | preg_match('/192\.168|localhost|images\.weserv\.nl/', $parsed['host'])) { |
||
| 24 | return $image; |
||
| 25 | } |
||
| 26 | |||
| 27 | return 'https://images.weserv.nl/?url=' . str_replace('http://', '', $image); |
||
| 28 | } |
||
| 29 | } |
||
| 30 |