+
+
+ protected function encodeURLAttribute($url, &$text = null) {
+ #
+ # Encode text for a double-quoted HTML attribute containing a URL,
+ # applying the URL filter if set. Also generates the textual
+ # representation for the URL (removing mailto: or tel:) storing it in $text.
+ # This function is *not* suitable for attributes enclosed in single quotes.
+ #
+ if ($this->url_filter_func)
+ $url = call_user_func($this->url_filter_func, $url);
+
+ if (preg_match('{^mailto:}i', $url))
+ $url = $this->encodeEntityObfuscatedAttribute($url, $text, 7);
+ else if (preg_match('{^tel:}i', $url))
+ {
+ $url = $this->encodeAttribute($url);
+ $text = substr($url, 4);
+ }
+ else
+ {
+ $url = $this->encodeAttribute($url);
+ $text = $url;
+ }
+
+ return $url;
+ }