* Single Page Adder */
($site_url)
| 22 | * Single Page Adder |
| 23 | */ |
| 24 | function single_page_adder($site_url){ |
| 25 | |
| 26 | // Ensure protocol is set; if not, default to https. |
| 27 | $parsed_url = parse_url($site_url); |
| 28 | if (empty($parsed_url['scheme'])) { |
| 29 | $site_url = 'https://' . ltrim($site_url, '/'); |
| 30 | } |
| 31 | |
| 32 | $options = ['verify' => false]; |
| 33 | $client = new Client($options); |
| 34 | $response = $client->get($site_url); |
| 35 | |
| 36 | // This is primarily a check that the URL is |
| 37 | // accessible. If the site has any content, we return the |
| 38 | // site URL in an array. |
| 39 | if ($response->getBody()) { |
| 40 | return [$site_url]; |
| 41 | } else { |
| 42 | throw new Exception("$site_url returned no content"); |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * WordPress Pages Adder |
no outgoing calls
no test coverage detected