MCPcopy Create free account
hub / github.com/EqualifyEverything/equalify / single_page_adder

Function single_page_adder

models/adders.php:24–45  ·  view source on GitHub ↗

* Single Page Adder */

($site_url)

Source from the content-addressed store, hash-verified

22 * Single Page Adder
23 */
24function 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

Callers 2

add_site.phpFile · 0.85
process_sitesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected