Lines Matching full:url
38 … - A trailing entity-reference-like sequence (e.g. `©`, `&hl;`) is consumed by the URL regex
65 …// Angle brackets with white space are basically a simple way to write a URL without triggering au…
105 $url = substr($match, 1, -1);
106 $handler->addCall('externallink', [$url, $url], $pos);
110 * Emit a bare-URL autolink, optionally preceded by the GFM-extension trim step.
112 * In Markdown-preferred mode, peelGfmTail() removes characters the URL regex over-consumed
117 $url = $match;
121 $trailing = $this->peelGfmTail($url);
124 $title = $this->addProtocolPrefix($url);
126 $handler->addCall('externallink', [$url, $title], $pos);
133 * Peel GFM-extension trailing chars off a URL.
135 …* The URL regex deliberately over-consumes parentheses and entity references so this method can de…
136 …* what really belongs to the URL. It peels one of two things at a time, repeating until neither ap…
140 * - A trailing ) that has no matching ( earlier in the URL.
144 * @param string $url Mutated in place to the trimmed URL
147 protected function peelGfmTail(string &$url): string argument
151 if (preg_match('/' . HtmlEntity::PATTERN . '$/', $url, $m)) {
153 $url = substr($url, 0, -strlen($m[0]));
154 … } elseif (str_ends_with($url, ')') && substr_count($url, ')') > substr_count($url, '(')) {
156 $url = substr($url, 0, -1);
170 * @param string $url Mutated in place to include the protocol prefix when one was added
171 * @return string|null The visible label, or null to use the prefixed URL as its own label
173 protected function addProtocolPrefix(string &$url): ?string argument
176 if (str_starts_with($url, 'ftp') && !str_starts_with($url, 'ftp://')) {
177 $title = $url;
178 $url = 'ftp://' . $url;
180 if (str_starts_with($url, 'www')) {
181 $title = $url;
182 $url = 'http://' . $url;