You are here

function _pathologic_content_url in Pathologic 7.3

Same name and namespace in other branches
  1. 7.2 pathologic.test \_pathologic_content_url()

Wrapper around url() which does HTML entity decoding and encoding.

Since Pathologic works with paths in content, it needs to decode paths which have been HTML-encoded, and re-encode them when done. This is a wrapper around url() which does the same thing so that we can expect the results from it and from Pathologic to still match in our tests.

See also

url()

http://drupal.org/node/1672932

http://www.w3.org/TR/xhtml1/guidelines.html#C_12

1 call to _pathologic_content_url()
PathologicTestCase::testPathologic in tests/pathologic.test

File

tests/pathologic.test, line 245
Pathologic behavior testing.

Code

function _pathologic_content_url($path, $options) {

  // If we should pretend this is a path to a file, temporarily enable clean
  // URLs if necessary.
  // @see _pathologic_replace()
  // @see http://drupal.org/node/1672430
  if (!empty($options['is_file'])) {
    $options['orig_clean_url'] = !empty($GLOBALS['conf']['clean_url']);
    if (!$options['orig_clean_url']) {
      $GLOBALS['conf']['clean_url'] = TRUE;
    }
  }
  $url = check_plain(url(htmlspecialchars_decode($path), $options));
  if (!empty($options['is_file']) && !$options['orig_clean_url']) {
    $GLOBALS['conf']['clean_url'] = FALSE;
  }
  return $url;
}