/** * Test a URL for validity. * * @uses OpenGraphProtocol::is_valid_url if OpenGraphProtocol::VERIFY_URLS is true * @param string $url absolute URL addressable from the public web * @return bool true if URL is non-empty string. if VERIFY_URLS set then URL must also properly respond to a HTTP request. */ public static function is_valid_url($url) { if (is_string($url) && !empty($url)) { if (OpenGraphProtocol::VERIFY_URLS) { $url = OpenGraphProtocol::is_valid_url($url, array('text/html', 'application/xhtml+xml')); if (!empty($url)) { return true; } } else { return true; } } return false; }
/** * Set the secure URL for display in a HTTPS page * * @param string $url resource location */ public function setSecureURL($url) { if (is_string($url) && !empty($url)) { $url = trim($url); if (OpenGraphProtocol::VERIFY_URLS) { if (parse_url($url, PHP_URL_SCHEME) === 'https') { $url = OpenGraphProtocol::is_valid_url($url, array('text/html', 'application/xhtml+xml')); } else { $url = ''; } } if (!empty($url)) { $this->secure_url = $url; } } return $this; }