You are here

protected function Markdown::encodeURLAttribute in Express 8

* 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. * *

Parameters

string $url: * @param string &$text Passed by reference * @return string URL

10 calls to Markdown::encodeURLAttribute()
Markdown::_doAnchors_inline_callback in vendor/michelf/php-markdown/Michelf/Markdown.php
* Callback method to parse inline anchors *
Markdown::_doAnchors_reference_callback in vendor/michelf/php-markdown/Michelf/Markdown.php
* Callback method to parse referenced anchors *
Markdown::_doAutoLinks_email_callback in vendor/michelf/php-markdown/Michelf/Markdown.php
* Parse email address callback *
Markdown::_doAutoLinks_url_callback in vendor/michelf/php-markdown/Michelf/Markdown.php
* Parse URL callback *
Markdown::_doImages_inline_callback in vendor/michelf/php-markdown/Michelf/Markdown.php
* Callback to parse inline image tags *

... See full list

File

vendor/michelf/php-markdown/Michelf/Markdown.php, line 1568

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function encodeURLAttribute($url, &$text = null) {
  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;
}