Functions | |
links_find_links ($text) |
|
Search a text string, potentially multiline, and return an array containing all of the URLs found in that string. The array is an integer-subscripted array with the subscript reflecting the order in which the links were found. Each element of the main array is an inner array per link. These are associative, with the keys being: "matched" => the actual text matched in the search, which is later to be replaced with a "goto" link. "url" => the normalized URL to which this link should go; it may not be identical to the URL in the text. "http://" is added to bare URLs that don't specify a protocol. "title" => a nominal title string for the link. For links that had an HTML tag around them, this is the text inside the tag. For bare links, this is the same as the url originally found in the text (the assumption being that this is what the author wanted to present). Some of the pregexps are adapted from the weblinks module, and others are adapted from examples on php.net. In all cases, they are complex and should be changed with great care and tested thoroughly, as small changes here could have large and unintended consequences! |