function announcements_feed_validate_url
Check whether a link is controlled by drupal.org.
Parameters
string $url: URL to check.
Return value
bool Return TRUE if the URL is controlled by drupal.org.
2 calls to announcements_feed_validate_url()
- AnnounceFeedTestValidateUrl::testValidateUrl in modules/
announcements_feed/ tests/ announce_feed_test.test - Test for validating the announcements_feed_validate_url function.
- announcements_feed_filter_announcements in modules/
announcements_feed/ announcements_feed.inc - Filter the announcements relevant to the Drupal version used with valid URL controlled by drupal.org.
File
-
modules/
announcements_feed/ announcements_feed.inc, line 222
Code
function announcements_feed_validate_url($url) {
if (empty($url)) {
return FALSE;
}
$host = parse_url($url, PHP_URL_HOST);
// First character can only be a letter or a digit.
// @see https://www.rfc-editor.org/rfc/rfc1123#page-13
return $host && preg_match('/^([a-zA-Z0-9][a-zA-Z0-9\\-_]*\\.)?drupal\\.org$/', $host);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.