You are here

function follow_build_url_regex in Follow 5

Same name and namespace in other branches
  1. 7.2 follow.inc \follow_build_url_regex()
  2. 7 follow.module \follow_build_url_regex()

Build a regex to validate the url based on a known service url.

File

./follow.module, line 475
Allows users to add links to their social network profiles.

Code

function follow_build_url_regex($network_info) {
  if (!empty($network_info['domain'])) {

    // An external link.
    return '@^https?://([a-z0-9\\-_.]+\\.|)' . str_replace('.', '\\.', $network_info['domain']) . '/@i';
  }

  // An internal link should not have ':'.
  return '@^[^:]+$@';
}