You are here

function _pathologic_content_url in Pathologic 7.2

Same name and namespace in other branches
  1. 7.3 tests/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 ./pathologic.test

File

./pathologic.test, line 246
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;
}