Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 2.0.x
  • 5.x-1.x
  • 6.x-1.x
  • 6.x-2.x
  • 6.x-3.x
  • 7.x-1.x
  • 7.x-2.x
  • 7.x-3.x
  • 8.x-1.x
  • master
  • pathfilter_file_support
  • 2.0.0-alpha1
  • 2.0.0-alpha2
  • 2.0.0-alpha3
  • 5.x-1.1-beta1
  • 5.x-1.1-beta2
  • 5.x-1.1-beta3
  • 5.x-1.1-beta5
  • 5.x-1.1-beta6
  • 5.x-1.1-beta7
  • 6.x-1.0
  • 6.x-1.0-beta14
  • 6.x-1.0-beta15
  • 6.x-1.0-beta17
  • 6.x-1.0-beta18
  • 6.x-1.1-beta1
  • 6.x-1.1-beta10
  • 6.x-1.1-beta11
  • 6.x-1.1-beta12
  • 6.x-1.1-beta13
  • 6.x-1.1-beta14
  • 6.x-1.1-beta15
  • 6.x-1.1-beta16
  • 6.x-1.1-beta2
  • 6.x-1.1-beta4
  • 6.x-1.1-beta5
  • 6.x-1.1-beta6
  • 6.x-1.1-beta7
  • 6.x-1.1-beta8
  • 6.x-1.1-beta9
  • 6.x-1.2-beta6
  • 6.x-2.0-beta19
  • 6.x-2.0-beta20
  • 6.x-2.0-beta21
  • 6.x-2.0-beta22
  • 6.x-2.0-beta23
  • 6.x-3.0
  • 6.x-3.0-beta1
  • 6.x-3.1
  • 6.x-3.2
  • 6.x-3.3
  • 6.x-3.4
  • 7.x-1.0
  • 7.x-1.0-beta1
  • 7.x-1.0-beta2
  • 7.x-1.0-beta3
  • 7.x-1.0-beta4
  • 7.x-1.0-beta5
  • 7.x-1.1
  • 7.x-1.2
  • 7.x-1.3
  • 7.x-1.4
  • 7.x-2.0
  • 7.x-2.0-beta1
  • 7.x-2.0-beta2
  • 7.x-2.0-beta3
  • 7.x-2.0-beta4
  • 7.x-2.0-beta5
  • 7.x-2.1
  • 7.x-2.10
  • 7.x-2.11
  • 7.x-2.12
  • 7.x-2.2
  • 7.x-2.3
  • 7.x-2.4
  • 7.x-2.5
  • 7.x-2.6
  • 7.x-2.7
  • 7.x-2.8
  • 7.x-2.9
  • 7.x-3.0
  • 7.x-3.0-beta1
  • 7.x-3.0-beta2
  • 7.x-3.0.beta2
  • 7.x-3.1
  • 7.x-3.2
  • 7.x-3.x-beta2
  • 8.x-1.0-alpha1
  • 8.x-1.0-alpha2
  • 8.x-1.0-alpha3
  • 8.x-1.0-alpha4
91 results

Target

Select target project
  • project/pathologic
  • issue/pathologic-3216344
  • issue/pathologic-3126584
  • issue/pathologic-3020343
  • issue/pathologic-3289033
  • issue/pathologic-3315947
  • issue/pathologic-2789953
  • issue/pathologic-3343618
  • issue/pathologic-3353562
  • issue/pathologic-3362585
  • issue/pathologic-2692641
  • issue/pathologic-2418369
  • issue/pathologic-3405359
  • issue/pathologic-3405392
  • issue/pathologic-3388563
  • issue/pathologic-3408946
  • issue/pathologic-3419946
  • issue/pathologic-3417156
  • issue/pathologic-3354345
  • issue/pathologic-3444968
  • issue/pathologic-3433872
  • issue/pathologic-2718473
22 results
Select Git revision
  • 2.0.x
  • 2418369-internal-url-handling
  • 5.x-1.x
  • 6.x-1.x
  • 6.x-2.x
  • 6.x-3.x
  • 7.x-1.x
  • 7.x-2.x
  • 7.x-3.x
  • 8.x-1.x
  • master
  • pathfilter_file_support
  • 2.0.0-alpha1
  • 5.x-1.1-beta1
  • 5.x-1.1-beta2
  • 5.x-1.1-beta3
  • 5.x-1.1-beta5
  • 5.x-1.1-beta6
  • 5.x-1.1-beta7
  • 6.x-1.0
  • 6.x-1.0-beta14
  • 6.x-1.0-beta15
  • 6.x-1.0-beta17
  • 6.x-1.0-beta18
  • 6.x-1.1-beta1
  • 6.x-1.1-beta10
  • 6.x-1.1-beta11
  • 6.x-1.1-beta12
  • 6.x-1.1-beta13
  • 6.x-1.1-beta14
  • 6.x-1.1-beta15
  • 6.x-1.1-beta16
  • 6.x-1.1-beta2
  • 6.x-1.1-beta4
  • 6.x-1.1-beta5
  • 6.x-1.1-beta6
  • 6.x-1.1-beta7
  • 6.x-1.1-beta8
  • 6.x-1.1-beta9
  • 6.x-1.2-beta6
  • 6.x-2.0-beta19
  • 6.x-2.0-beta20
  • 6.x-2.0-beta21
  • 6.x-2.0-beta22
  • 6.x-2.0-beta23
  • 6.x-3.0
  • 6.x-3.0-beta1
  • 6.x-3.1
  • 6.x-3.2
  • 6.x-3.3
  • 6.x-3.4
  • 7.x-1.0
  • 7.x-1.0-beta1
  • 7.x-1.0-beta2
  • 7.x-1.0-beta3
  • 7.x-1.0-beta4
  • 7.x-1.0-beta5
  • 7.x-1.1
  • 7.x-1.2
  • 7.x-1.3
  • 7.x-1.4
  • 7.x-2.0
  • 7.x-2.0-beta1
  • 7.x-2.0-beta2
  • 7.x-2.0-beta3
  • 7.x-2.0-beta4
  • 7.x-2.0-beta5
  • 7.x-2.1
  • 7.x-2.10
  • 7.x-2.11
  • 7.x-2.12
  • 7.x-2.2
  • 7.x-2.3
  • 7.x-2.4
  • 7.x-2.5
  • 7.x-2.6
  • 7.x-2.7
  • 7.x-2.8
  • 7.x-2.9
  • 7.x-3.0
  • 7.x-3.0-beta1
  • 7.x-3.0-beta2
  • 7.x-3.0.beta2
  • 7.x-3.1
  • 7.x-3.2
  • 7.x-3.x-beta2
  • 8.x-1.0-alpha1
  • 8.x-1.0-alpha2
  • 8.x-1.0-alpha3
  • 8.x-1.0-alpha4
  • previous/2418369-internal-url-handling/2023-12-15
91 results
Show changes
Commits on Source (9)
......@@ -6,7 +6,7 @@ http://drupal.org/project/pathologic
By Garrett Albright
http://drupal.org/user/191212
Email: albright (at) anre [dot] net
Email: albright (at) abweb [dot] us
AIM: AlbrightGuy - ICQ: 150670553 - IRC: Albright
Installation & Configuration
......
name = Pathologic
description = Helps avoid broken links and incorrect paths in content.
package = "Input filters"
dependencies[] = filter
core = 6.x
php = 4.4
; Information added by drupal.org packaging script on 2009-07-21
version = "6.x-2.x-dev"
core = "6.x"
;dependencies[] = filter
core = 7.x
files[] = pathologic.module
files[] = pathologic.test
; Information added by drupal.org packaging script on 2010-05-09
version = "7.x-1.x-dev"
core = "7.x"
project = "pathologic"
datestamp = "1248179343"
datestamp = "1273363897"
<?php
// $Id$
/**
* @file
* Standard .install file for Pathologic.
*/
/**
* Implementation of hook_enable().
*/
function pathologic_enable() {
drupal_set_message(t('The Pathologic module has been enabled; however, the Pathologic input filter must be added to the <a href="!ifs">input formats</a> in use on this site before it will have any effect. For more information, including complete installation and configuration instructions, please see <a href="http://drupal.org/node/257026">Pathologic&rsquo;s documentation</a>.', array('!ifs' => url('admin/settings/filters'))));
}
/**
* Implementation of hook_uninstall().
*/
function pathologic_uninstall() {
// Iterate through the site's variables and delete ones created by Pathologic.
global $conf;
foreach (array_keys($conf) as $key) {
if (strpos($key, 'filter_pathologic_') === 0) {
variable_del($key);
}
}
}
\ No newline at end of file
<?php
// $Id$
/**
* @file
......@@ -11,185 +10,134 @@
*/
/**
* Implementation of hook_filter().
* Implements hook_filter_info().
*/
function pathologic_filter($op, $delta = 0, $format = -1, $text = '') {
if ($op === 'process' && $text !== '') {
if (variable_get('filter_pathologic_href_' . $format, TRUE)) {
// Do transformation on href paths.
// Make relative.
$text = preg_replace_callback(_pathologic_abs_regex('href', $format), '_pathologic_abs_to_rel', $text);
// Transform attributes.
// The "internal:" bit in the regex makes life easier for those migrating
// from the Path Filter module.
$text = preg_replace_callback('|href="(internal:)?([^/#][^:"#\?]+)([\?]([^#]+))?(#([^:"]*))?"|', '_pathologic_do_href', $text);
}
if (variable_get('filter_pathologic_src_' . $format, TRUE)) {
// Do transformation on src paths.
// Make relative.
$text = preg_replace_callback(_pathologic_abs_regex('src', $format), '_pathologic_abs_to_rel', $text);
// Transform attributes.
// The "internal:" bit in the regex makes life easier for those migrating
// from the Path Filter module.
$text = preg_replace_callback('|src="(internal:)?([^/][^:"\?]+)([\?]([^#]+))?"|', '_pathologic_do_src', $text);
}
return $text;
}
elseif ($op === 'list') {
return array(t('Pathologic'));
}
elseif ($op === 'description') {
return t('Corrects paths in links and images in your Drupal content in situations which would otherwise cause them to &ldquo;break.&rdquo;');
}
elseif ($op === 'settings') {
return array('filter_pathologic' => array(
'#type' => 'fieldset',
'#title' => t('Pathologic'),
'#collapsible' => TRUE,
'filter_pathologic_href_' . $format => array(
'#type' => 'checkbox',
'#title' => t('Transform values of <em>href</em> attributes'),
'#default_value' => intval(variable_get('filter_pathologic_href_' . $format, 1)),
'#description' => t('<em>href</em> attributes are used in link tags.'),
),
'filter_pathologic_src_' . $format => array(
'#type' => 'checkbox',
'#title' => t('Transform values of <em>src</em> attributes'),
'#default_value' => intval(variable_get('filter_pathologic_src_' . $format, 1)),
'#description' => t('<em>src</em> attributes are used in image tags and tags for other types of embedded media.'),
),
'filter_pathologic_abs_paths_' . $format => array(
'#type' => 'textarea',
'#title' => t('Additional paths to be considered local'),
'#default_value' => variable_get('filter_pathologic_abs_paths_' . $format, ''),
'#description' => t('Enter URIs of other Drupal installations which should be considered local in addition to the one for this particular Drupal installation (which is %path). If in doubt, enter the path to the Drupal installation&rsquo;s front page. Enter one path per line.', array('%path' => _pathologic_url('<front>'))),
),
function pathologic_filter_info() {
return array(
'pathologic' => array(
'title' => t('Correct URLs with Pathologic'),
'process callback' => '_pathologic',
'settings callback' => '_pathologic_settings',
'default settings' => array(
'local_paths' => '',
'absolute' => TRUE,
),
);
}
return $text;
/* 'tips callback' => '_pathologic_tips', */
'weight' => 65535,
)
);
}
/**
* Return the hard part of the regular expression to be used when making paths
* relative.
*
* @param $attr
* The attribute holding paths we're looking for. Should be 'href' or 'src'.
* @param $format
* The ID of the input format being used.
* @return string
* Part of a regular expression to be used to find paths to act upon.
* Settings callback for Pathologic.
*/
function _pathologic_abs_regex($attr, $format) {
static $pathstr = FALSE;
function _pathologic_settings($form, &$form_state, $filter, $format, $defaults) {
return array(
'reminder' => array(
'#type' => 'item',
'#title' => t('In most cases, Pathologic should be the <em>last</em> filter in the &ldquo;Filter processing order&rdquo; list.'),
'#weight' => 0,
),
'local_paths' => array(
'#type' => 'textarea',
'#title' => t('Also considered local'),
'#default_value' => isset($filter->settings['local_paths']) ? $filter->settings['local_paths'] : $defaults['local_paths'],
'#description' => t('Enter the beginning of paths which should also be considered local for this server. Please read <a href="!docs">Pathologic&rsquo;s documentation</a> for more information about this feature. If the site is using a WYSIWYG content editor such as CKEditor or TinyMCE, you will probably need to enter a single slash (<code>/</code>) in this field.', array('!docs' => 'http://drupal.org/node/257026')),
'#weight' => 10,
),
'absolute' => array(
'#type' => 'checkbox',
'#title' => t('Output full absolute URLs'),
'#default_value' => isset($filter->settings['absolute']) ? $filter->settings['absolute'] : TRUE,
'#description' => t('If checked, Pathologic will output full absolute URLs, with a protocol and server fragment (such as <code>http://example.com/foo/bar</code>); this is useful if you want images and links to not break for those reading the content in a feed reader or through some other form of aggregation. However, in cases where the site is being served via both HTTP and HTTPS, it may be necessary to uncheck this box so that protocol and server fragments are omitted in the paths Pathologic creates (such as <code>/foo/bar</code>) to avoid issues where the browser complains about pages containing both secure and insecure content.'),
'#weight' => 20,
),
);
}
if ($pathstr === FALSE) {
$paths_field = trim(variable_get('filter_pathologic_abs_paths_' . $format, ''));
if ($paths_field !== '') {
// Get rid of spirious white space on each line.
$paths = array_map('trim', explode("\n", $paths_field));
/**
* Pathologic filter callback.
*/
function _pathologic($text, $filter) {
$statics = &drupal_static(__FUNCTION__, array());
if (!isset($statics[$filter->format])) {
// Parse the list of the paths also considered local.
$paths_text = trim($filter->settings['local_paths']);
if ($paths_text === '') {
$paths = array();
}
else {
$paths = array();
$paths = array_map('trim', explode("\n", $paths_text));
}
$paths[] = _pathologic_url('<front>');
// It's possible the user entered the path for the current site in the box,
// especially if the DB contents are shared between two different servers
// (likely if it's a testing/production server thing). This won't screw up
// the regex, but it will unnecessarily complicate it, so let's remove
// duplicates from the array.
$paths = array_unique($paths);
// We need to account for the fact that http://example.com/foo,
// http://example.com/?q=foo and http://example.com/index.php?q=foo are all
// valid.
$pathstr = ')="(' . implode('/?(index.php)?(\?q=)?|', $paths) . '/?(index.php)?(\?q=)?)([^"]*)"`';
// $pathstr now looks like:
// )="(http://example.com//?(index.php)?(\?q=)?|http://example.org//?(index.php)?(\?q=)?)([^"]*)";
}
return '`(' . $attr . $pathstr;
// Returned value looks like:
// (href)="(http://example.com//?(index.php)?(\?q=)?|http://example.org//?(index.php)?(\?q=)?)([^"]*)"
// We want to match the attribute so that the callback
// _pathologic_abs_to_rel() below can return a value with the attribute
// without special trickery or creating duplicate functions.
}
// Add "this" path
$paths[] = url('<front>', array('absolute' => TRUE));
// Remove duplicates, since it's possible "this" path was already in the list;
// also do escaping
$paths = array_map('_pathologic_escape', array_unique($paths));
/**
* Aid in turning an absolute path on the local server to a relative one.
*
* preg_replace_callback() callback function.
*/
function _pathologic_abs_to_rel($matches) {
// The attribute will be the first match (after 0), and the path will be the
// last.
$path = array_pop($matches);
if ($path === '') {
// It looks like this was meant to be a link to the front page.
return $matches[1] . '="<front>"';
}
return $matches[1] . '="' . $path . '"';
}
// We need to account for the fact that
// http://example.com/foo
// http://example.com/?q=foo
// http://example.com/index.php?q=foo
// …are all valid.
/**
* Properly format an HREF element.
*
* Here's where the magic happens. preg_replace_callback() callback function.
*/
function _pathologic_do_href($matches) {
return 'href="' . _pathologic_url($matches[2], isset($matches[4]) ? $matches[4] : NULL, isset($matches[6]) ? $matches[6] : NULL) . '"';
$statics[$filter->format] = array(
// The pattern is gonna look like:
// ~(href|src|HREF|SRC)="
// (internal:|https?://example\.com|https?://example\.org)?
// (
// /(#.*)?|
// (?!(#|/|mailto:|[a-z]+:/))
// ((index\.php)?(\?q=)?)
// ([^"]*)
// )"~
'pattern' => '~(href|src|HREF|SRC)="(internal:|' . implode('|', $paths) . ')?(/(#.*)?|(?!(#|/|mailto:|[a-z]+:/))((index\.php)?(\?q=)?)([^"]*))"~',
// create_funtion() lets us do lambdas in a really crappy but pre-PHP 5.3-
// compatible way. We're using it here so we can pass the value of
// $filter->settings['absolute'] to the replacement function. We could
// just put the whole replacement function here, but that would just be
// silly.
'callback' => create_function('$matches', 'return _pathologic_replace($matches, ' . $filter->settings['absolute'] . ');'),
);
}
return preg_replace_callback($statics[$filter->format]['pattern'], $statics[$filter->format]['callback'], $text);
}
/**
* Return a formatted SRC attribute.
*
* You might think SRC attributes will always be disk files instead of Drupal
* paths, but that's not always the case - paths to files processed by
* Imagecache point to non-existant files the first time, at which time they go
* through the standard menu router to be caught and handled by Imagecache.
* preg_replace_callback() callback function.
* Replace the attributes. preg_replace_callback() callback.
*/
function _pathologic_do_src($matches) {
if (file_exists($matches[2])) {
global $base_url;
return "src=\"{$base_url}/{$matches[2]}\"";
function _pathologic_replace($matches, $absolute) {
// Build the full URL, then take it apart
$parts = parse_url('http://example.com/' . urldecode($matches[3]));
if ($parts['path'] === '/' | $parts['path'] === '//') {
// '//' will be the case if the original path was just a slash
$parts['path'] = '<front>';
}
else {
// Trim initial slash off path.
$parts['path'] = drupal_substr($parts['path'], 1);
}
return 'src="' . _pathologic_url($matches[2], isset($matches[4]) ? $matches[4] : NULL) . '"';
// Need to parse the query parts
if (isset($parts['query'])) {
parse_str($parts['query'], $qparts);
if (isset($qparts['q'])) {
$parts['path'] = $qparts['q'];
unset($qparts['q']);
}
}
else {
$qparts = array();
}
return $matches[1] . '="' . url($parts['path'], array('query' => $qparts, 'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL, 'absolute' => $absolute)) . '"';
}
/**
* Run the path parts through url() to puild a correct URL if the path looks
* like it links to a local Drupal path.
*
* Otherwise, it's a link to a file or something -- try to return it in one
* piece.
*
* @param $path
* The path to check.
* @param $query
* The query fragment of the path, if any (comes after ?).
* @param $fragment
* The anchor fragment of the path, if any (comes after #).
* @return string
* The corrected path, if necessary. Else, the reconstructed path.
* Escape paths to convert. preg_replace_callback() callback.
*/
function _pathologic_url($path, $query = NULL, $fragment = NULL) {
// We're unescaping HTML entities like &amp; in the hope of avoiding double-
// encoding. See: http://drupal.org/node/665900
$path = html_entity_decode($path, ENT_COMPAT, 'UTF-8');
// Does this look like an internal URL?
if ($path !== '<front>' && !menu_get_item($path) && !drupal_lookup_path('source', $path)) {
// It's not.
global $base_url;
$return = $base_url . '/' . $path;
if ($query !== NULL && $query !== '') {
$return .= '?' . $query;
}
if ($fragment !== NULL && $fragment !== '') {
$return .= '#' . $fragment;
}
return $return;
}
return url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));
function _pathologic_escape($path) {
// Quote special characters, but "convert" asterisks.
// Apparently the special characters in the preg_replace below need to be
// double-escaped…?
return preg_replace(array('/(?<!\\\)\\\\\*/', '/^https?/'), array('[^/]*', 'https?'), preg_quote($path, '~'));
}
\ No newline at end of file
<?php
/**
* @file
* Tests that Pathologic ain't broke.
*/
class PathologicTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Pathologic path filtering',
'description' => 'Test Pathologic&rsquo;s path translation and conversion.',
'group' => 'Filter',
);
}
function setUp() {
parent::setUp('pathologic');
$this->admin_user = $this->drupalCreateUser(array('administer filters'));
$this->drupalLogin($this->admin_user);
// Create a text format
$format = array(
'name' => 'Pathologic test',
'filters[pathologic][status]' => TRUE,
'filters[pathologic][settings][local_paths]' => "http://example.com/\nhttps://*.example.net/\nhttp://example.org/*/bar/",
'filters[pathologic][settings][absolute]' => TRUE,
);
// This will be format 4 (the testing system seems to create three by
// default…? Why?)
$this->drupalPost('admin/config/content/formats/add', $format, t('Save configuration'));
// Create another format with absolute paths off
$format['name'] = 'Pathologic test - absolute off';
$format['filters[pathologic][settings][absolute]'] = FALSE;
// This will be format 5
$this->drupalPost('admin/config/content/formats/add', $format, t('Save configuration'));
}
function testPaths() {
// This seems to be necessary to get it to notice the new formats
drupal_static_reset('filter_formats');
// Build some paths to check against
$paths = array(
'/' => url('<front>', array('absolute' => TRUE)),
'/#foo' => url('<front>', array('fragment' => 'foo', 'absolute' => TRUE)),
'admin' => url('admin', array('absolute' => TRUE)),
'foo' => url('foo', array('absolute' => TRUE)),
'foo/bar' => url('foo/bar', array('absolute' => TRUE)),
'foo/bar?baz=qux' => url('foo/bar', array('query' => array('baz' => 'qux'), 'absolute' => TRUE)),
'foo/bar#baz' => url('foo/bar', array('fragment' => 'baz', 'absolute' => TRUE)),
'foo/bar?baz=qux#quux' => url('foo/bar', array('query' => array('baz' => 'qux'), 'fragment' => 'quux', 'absolute' => TRUE)),
'quuux' => url('quuux', array('absolute' => FALSE)),
'föö bár%20%E3%83%90%E3%83%83%E3%82%BA' => url('föö bár バッズ', array('absolute' => TRUE)),
);
// Links and images
$this->assertEqual(check_markup('<a href="foo"><img src="foo/bar"></a>', 4), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo/bar'] . '"></a>', t('Links and images'));
// With query string
$this->assertEqual(check_markup('<a href="foo/bar?baz=qux">', 4), '<a href="' . $paths['foo/bar?baz=qux'] . '">', t('With query string'));
// With fragment (but not only fragment)
$this->assertEqual(check_markup('<a href="foo/bar#baz"></a><a href="#baz"></a>', 4), '<a href="' . $paths['foo/bar#baz'] . '"></a><a href="#baz"></a>', t('With fragment, but not only fragment'));
// With query stirng and fragment
$this->assertEqual(check_markup('<a href="foo/bar?baz=qux#quux">', 4), '<a href="' . $paths['foo/bar?baz=qux#quux'] . '">', t('With query string and fragment'));
// Dirty URLs
$this->assertEqual(check_markup('<a href="?q=foo"><img src="index.php?q=foo/bar"></a>', 4), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo/bar'] . '"></a>', t('Dirty URLs'));
// Path Filter compatibility
$this->assertEqual(check_markup('<a href="internal:foo"><img src="internal:foo/bar?baz=qux"></a>', 4), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo/bar?baz=qux'] . '"></a>', t('Path Filter back compatibility'));
// Also considered local
$this->assertEqual(check_markup('<a href="http://example.com/foo"><img src="http://example.com/index.php?q=foo/bar&baz=qux"></a>', 4), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo/bar?baz=qux'] . '"></a>', t('Also considered local'));
// Asterisks in domain names - [#758118]
$this->assertEqual(check_markup('<a href="http://foo.example.net/foo"><img src="http://example.org/qux/bar/foo"></a>', 4), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo'] . '"></a>', t('Asterisk in domain'));
// Non-absolute - Note we're using format 5 here
$this->assertEqual(check_markup('<a href="?q=quuux"><img src="quuux"></a>', 5), '<a href="' . $paths['quuux'] . '"><img src="' . $paths['quuux'] . '"></a>', t('Non-absolute path output'));
// Upper-case HREF and SRC params - [#760876]
$this->assertEqual(check_markup('<A HREF="foo"><IMG SRC="foo/bar"></A>', 4), '<A HREF="' . $paths['foo'] . '"><IMG SRC="' . $paths['foo/bar'] . '"></A>', t('Old-skool upper-case attribute names'));
// Paths with just slashes - [#817722] sort of
$this->assertEqual(check_markup('<a href="/"></a><a href="/#foo"></a>', 4), '<a href="' . $paths['/'] . '"></a><a href="' . $paths['/#foo'] . '"></a>', t('Linking to front page with href="/"'));
// Spaces, funky characters, already encoded - [#826558]
$this->assertEqual(check_markup('<img src="föö bár%20%E3%83%90%E3%83%83%E3%82%BA" />', 4), '<img src="' . $paths['föö bár%20%E3%83%90%E3%83%83%E3%82%BA'] . '" />', t('Character encoding'));
}
}