summaryrefslogtreecommitdiff
path: root/modules/filter/filter.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/filter/filter.module')
-rw-r--r--modules/filter/filter.module134
1 files changed, 67 insertions, 67 deletions
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 61ea76d5e..98bbba41b 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -20,22 +20,22 @@ define('FILTER_FORMAT_DEFAULT', 0);
function filter_help($path, $arg) {
switch ($path) {
case 'admin/help#filter':
- $output = '<p>'. t("The filter module allows administrators to configure text input formats for use on your site. An input format defines the HTML tags, codes, and other input allowed in both content and comments, and is a key feature in guarding against potentially damaging input from malicious users. Two input formats included by default are <em>Filtered HTML</em> (which allows only an administrator-approved subset of HTML tags) and <em>Full HTML</em> (which allows the full set of HTML tags). Additional input formats may be created by an administrator.") .'</p>';
- $output .= '<p>'. t('Each input format uses filters to manipulate text, and most input formats apply several different filters to text in a specific order. Each filter is designed for a specific purpose, and generally either adds, removes or transforms elements within user-entered text before it is displayed. A filter does not change the actual content of a post, but instead, modifies it temporarily before it is displayed. A filter may remove unapproved HTML tags, for instance, while another automatically adds HTML to make links referenced in text clickable.') .'</p>';
- $output .= '<p>'. t('Users with access to more than one input format can use the <em>Input format</em> fieldset to choose between available input formats when creating or editing multi-line content. Administrators determine the input formats available to each user role, select a default input format, and control the order of formats listed in the <em>Input format</em> fieldset.') .'</p>';
- $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@filter">Filter module</a>.', array('@filter' => 'http://drupal.org/handbook/modules/filter/')) .'</p>';
+ $output = '<p>' . t("The filter module allows administrators to configure text input formats for use on your site. An input format defines the HTML tags, codes, and other input allowed in both content and comments, and is a key feature in guarding against potentially damaging input from malicious users. Two input formats included by default are <em>Filtered HTML</em> (which allows only an administrator-approved subset of HTML tags) and <em>Full HTML</em> (which allows the full set of HTML tags). Additional input formats may be created by an administrator.") . '</p>';
+ $output .= '<p>' . t('Each input format uses filters to manipulate text, and most input formats apply several different filters to text in a specific order. Each filter is designed for a specific purpose, and generally either adds, removes or transforms elements within user-entered text before it is displayed. A filter does not change the actual content of a post, but instead, modifies it temporarily before it is displayed. A filter may remove unapproved HTML tags, for instance, while another automatically adds HTML to make links referenced in text clickable.') . '</p>';
+ $output .= '<p>' . t('Users with access to more than one input format can use the <em>Input format</em> fieldset to choose between available input formats when creating or editing multi-line content. Administrators determine the input formats available to each user role, select a default input format, and control the order of formats listed in the <em>Input format</em> fieldset.') . '</p>';
+ $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@filter">Filter module</a>.', array('@filter' => 'http://drupal.org/handbook/modules/filter/')) . '</p>';
return $output;
case 'admin/settings/filters':
- $output = '<p>'. t('Use the list below to review the input formats available to each user role, to select a default input format, and to control the order of formats listed in the <em>Input format</em> fieldset. (The <em>Input format</em> fieldset is displayed below textareas when users with access to more than one input format create multi-line content.) The input format selected as <em>Default</em> is available to all users and, unless another format is selected, is applied to all content. All input formats are available to users in roles with the "administer filters" permission.') .'</p>';
- $output .= '<p>'. t('Since input formats, if available, are presented in the same order as the list below, it may be helpful to arrange the formats in descending order of your preference for their use. To change the order of an input format, grab a drag-and-drop handle under the <em>Name</em> column and drag to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save changes</em> button at the bottom of the page.') .'</p>';
+ $output = '<p>' . t('Use the list below to review the input formats available to each user role, to select a default input format, and to control the order of formats listed in the <em>Input format</em> fieldset. (The <em>Input format</em> fieldset is displayed below textareas when users with access to more than one input format create multi-line content.) The input format selected as <em>Default</em> is available to all users and, unless another format is selected, is applied to all content. All input formats are available to users in roles with the "administer filters" permission.') . '</p>';
+ $output .= '<p>' . t('Since input formats, if available, are presented in the same order as the list below, it may be helpful to arrange the formats in descending order of your preference for their use. To change the order of an input format, grab a drag-and-drop handle under the <em>Name</em> column and drag to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save changes</em> button at the bottom of the page.') . '</p>';
return $output;
case 'admin/settings/filters/%':
- return '<p>'. t('Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format. If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.', array('@rearrange' => url('admin/settings/filters/'. $arg[3] .'/order'))) .'</p>';
+ return '<p>' . t('Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format. If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.', array('@rearrange' => url('admin/settings/filters/' . $arg[3] . '/order'))) . '</p>';
case 'admin/settings/filters/%/configure':
- return '<p>'. t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">view tab</a> first.', array('@url' => url('admin/settings/filters/'. $arg[3]))) .'</p>';
+ return '<p>' . t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">view tab</a> first.', array('@url' => url('admin/settings/filters/' . $arg[3]))) . '</p>';
case 'admin/settings/filters/%/order':
- $output = '<p>'. t('Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted to a clickable link. When this happens, rearrange the order of the filters.') .'</p>';
- $output .= '<p>'. t("Filters are executed from top-to-bottom. To change the order of the filters, modify the values in the <em>Weight</em> column or grab a drag-and-drop handle under the <em>Name</em> column and drag filters to new locations in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.") .'</p>';
+ $output = '<p>' . t('Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted to a clickable link. When this happens, rearrange the order of the filters.') . '</p>';
+ $output .= '<p>' . t("Filters are executed from top-to-bottom. To change the order of the filters, modify the values in the <em>Weight</em> column or grab a drag-and-drop handle under the <em>Name</em> column and drag filters to new locations in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.") . '</p>';
return $output;
}
}
@@ -176,49 +176,49 @@ function filter_filter_tips($delta, $format, $long = FALSE) {
case 0:
return t('Allowed HTML tags: @tags', array('@tags' => $allowed_html));
case 1:
- $output = '<p>'. t('Allowed HTML tags: @tags', array('@tags' => $allowed_html)) .'</p>';
+ $output = '<p>' . t('Allowed HTML tags: @tags', array('@tags' => $allowed_html)) . '</p>';
if (!variable_get("filter_html_help_$format", 1)) {
return $output;
}
- $output .= '<p>'. t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') .'</p>';
- $output .= '<p>'. t('For more information see W3C\'s <a href="@html-specifications">HTML Specifications</a> or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) .'</p>';
+ $output .= '<p>' . t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '</p>';
+ $output .= '<p>' . t('For more information see W3C\'s <a href="@html-specifications">HTML Specifications</a> or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '</p>';
$tips = array(
- 'a' => array( t('Anchors are used to make links to other pages.'), '<a href="'. $base_url .'">'. variable_get('site_name', 'Drupal') .'</a>'),
+ 'a' => array( t('Anchors are used to make links to other pages.'), '<a href="' . $base_url . '">' . variable_get('site_name', 'Drupal') . '</a>'),
'br' => array( t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with <br />line break')),
- 'p' => array( t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '<p>'. t('Paragraph one.') .'</p> <p>'. t('Paragraph two.') .'</p>'),
- 'strong' => array( t('Strong'), '<strong>'. t('Strong') .'</strong>'),
- 'em' => array( t('Emphasized'), '<em>'. t('Emphasized') .'</em>'),
- 'cite' => array( t('Cited'), '<cite>'. t('Cited') .'</cite>'),
- 'code' => array( t('Coded text used to show programming source code'), '<code>'. t('Coded') .'</code>'),
- 'b' => array( t('Bolded'), '<b>'. t('Bolded') .'</b>'),
- 'u' => array( t('Underlined'), '<u>'. t('Underlined') .'</u>'),
- 'i' => array( t('Italicized'), '<i>'. t('Italicized') .'</i>'),
+ 'p' => array( t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '<p>' . t('Paragraph one.') . '</p> <p>' . t('Paragraph two.') . '</p>'),
+ 'strong' => array( t('Strong'), '<strong>' . t('Strong') . '</strong>'),
+ 'em' => array( t('Emphasized'), '<em>' . t('Emphasized') . '</em>'),
+ 'cite' => array( t('Cited'), '<cite>' . t('Cited') . '</cite>'),
+ 'code' => array( t('Coded text used to show programming source code'), '<code>' . t('Coded') . '</code>'),
+ 'b' => array( t('Bolded'), '<b>' . t('Bolded') . '</b>'),
+ 'u' => array( t('Underlined'), '<u>' . t('Underlined') . '</u>'),
+ 'i' => array( t('Italicized'), '<i>' . t('Italicized') . '</i>'),
'sup' => array( t('Superscripted'), t('<sup>Super</sup>scripted')),
'sub' => array( t('Subscripted'), t('<sub>Sub</sub>scripted')),
- 'pre' => array( t('Preformatted'), '<pre>'. t('Preformatted') .'</pre>'),
+ 'pre' => array( t('Preformatted'), '<pre>' . t('Preformatted') . '</pre>'),
'abbr' => array( t('Abbreviation'), t('<abbr title="Abbreviation">Abbrev.</abbr>')),
'acronym' => array( t('Acronym'), t('<acronym title="Three-Letter Acronym">TLA</acronym>')),
- 'blockquote' => array( t('Block quoted'), '<blockquote>'. t('Block quoted') .'</blockquote>'),
- 'q' => array( t('Quoted inline'), '<q>'. t('Quoted inline') .'</q>'),
+ 'blockquote' => array( t('Block quoted'), '<blockquote>' . t('Block quoted') . '</blockquote>'),
+ 'q' => array( t('Quoted inline'), '<q>' . t('Quoted inline') . '</q>'),
// Assumes and describes tr, td, th.
- 'table' => array( t('Table'), '<table> <tr><th>'. t('Table header') .'</th></tr> <tr><td>'. t('Table cell') .'</td></tr> </table>'),
+ 'table' => array( t('Table'), '<table> <tr><th>' . t('Table header') . '</th></tr> <tr><td>' . t('Table cell') . '</td></tr> </table>'),
'tr' => NULL, 'td' => NULL, 'th' => NULL,
- 'del' => array( t('Deleted'), '<del>'. t('Deleted') .'</del>'),
- 'ins' => array( t('Inserted'), '<ins>'. t('Inserted') .'</ins>'),
+ 'del' => array( t('Deleted'), '<del>' . t('Deleted') . '</del>'),
+ 'ins' => array( t('Inserted'), '<ins>' . t('Inserted') . '</ins>'),
// Assumes and describes li.
- 'ol' => array( t('Ordered list - use the &lt;li&gt; to begin each list item'), '<ol> <li>'. t('First item') .'</li> <li>'. t('Second item') .'</li> </ol>'),
- 'ul' => array( t('Unordered list - use the &lt;li&gt; to begin each list item'), '<ul> <li>'. t('First item') .'</li> <li>'. t('Second item') .'</li> </ul>'),
+ 'ol' => array( t('Ordered list - use the &lt;li&gt; to begin each list item'), '<ol> <li>' . t('First item') . '</li> <li>' . t('Second item') . '</li> </ol>'),
+ 'ul' => array( t('Unordered list - use the &lt;li&gt; to begin each list item'), '<ul> <li>' . t('First item') . '</li> <li>' . t('Second item') . '</li> </ul>'),
'li' => NULL,
// Assumes and describes dt and dd.
- 'dl' => array( t('Definition lists are similar to other HTML lists. &lt;dl&gt; begins the definition list, &lt;dt&gt; begins the definition term and &lt;dd&gt; begins the definition description.'), '<dl> <dt>'. t('First term') .'</dt> <dd>'. t('First definition') .'</dd> <dt>'. t('Second term') .'</dt> <dd>'. t('Second definition') .'</dd> </dl>'),
+ 'dl' => array( t('Definition lists are similar to other HTML lists. &lt;dl&gt; begins the definition list, &lt;dt&gt; begins the definition term and &lt;dd&gt; begins the definition description.'), '<dl> <dt>' . t('First term') . '</dt> <dd>' . t('First definition') . '</dd> <dt>' . t('Second term') . '</dt> <dd>' . t('Second definition') . '</dd> </dl>'),
'dt' => NULL, 'dd' => NULL,
- 'h1' => array( t('Header'), '<h1>'. t('Title') .'</h1>'),
- 'h2' => array( t('Header'), '<h2>'. t('Subtitle') .'</h2>'),
- 'h3' => array( t('Header'), '<h3>'. t('Subtitle three') .'</h3>'),
- 'h4' => array( t('Header'), '<h4>'. t('Subtitle four') .'</h4>'),
- 'h5' => array( t('Header'), '<h5>'. t('Subtitle five') .'</h5>'),
- 'h6' => array( t('Header'), '<h6>'. t('Subtitle six') .'</h6>')
+ 'h1' => array( t('Header'), '<h1>' . t('Title') . '</h1>'),
+ 'h2' => array( t('Header'), '<h2>' . t('Subtitle') . '</h2>'),
+ 'h3' => array( t('Header'), '<h3>' . t('Subtitle three') . '</h3>'),
+ 'h4' => array( t('Header'), '<h4>' . t('Subtitle four') . '</h4>'),
+ 'h5' => array( t('Header'), '<h5>' . t('Subtitle five') . '</h5>'),
+ 'h6' => array( t('Header'), '<h6>' . t('Subtitle six') . '</h6>')
);
$header = array(t('Tag Description'), t('You Type'), t('You Get'));
preg_match_all('/<([a-z0-9]+)[^a-z0-9]/i', $allowed_html, $out);
@@ -227,7 +227,7 @@ function filter_filter_tips($delta, $format, $long = FALSE) {
if ($tips[$tag]) {
$rows[] = array(
array('data' => $tips[$tag][0], 'class' => 'description'),
- array('data' => '<code>'. check_plain($tips[$tag][1]) .'</code>', 'class' => 'type'),
+ array('data' => '<code>' . check_plain($tips[$tag][1]) . '</code>', 'class' => 'type'),
array('data' => $tips[$tag][1], 'class' => 'get')
);
}
@@ -240,8 +240,8 @@ function filter_filter_tips($delta, $format, $long = FALSE) {
}
$output .= theme('table', $header, $rows);
- $output .= '<p>'. t('Most unusual characters can be directly entered without any problems.') .'</p>';
- $output .= '<p>'. t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href="@html-entities">entities</a> page. Some of the available characters include:', array('@html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) .'</p>';
+ $output .= '<p>' . t('Most unusual characters can be directly entered without any problems.') . '</p>';
+ $output .= '<p>' . t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href="@html-entities">entities</a> page. Some of the available characters include:', array('@html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '</p>';
$entities = array(
array( t('Ampersand'), '&amp;'),
@@ -254,7 +254,7 @@ function filter_filter_tips($delta, $format, $long = FALSE) {
foreach ($entities as $entity) {
$rows[] = array(
array('data' => $entity[0], 'class' => 'description'),
- array('data' => '<code>'. check_plain($entity[1]) .'</code>', 'class' => 'type'),
+ array('data' => '<code>' . check_plain($entity[1]) . '</code>', 'class' => 'type'),
array('data' => $entity[1], 'class' => 'get')
);
}
@@ -307,11 +307,11 @@ function filter_formats($index = NULL) {
$where[] = "roles LIKE '%%,%d,%%'";
$args[] = $rid;
}
- $query .= ' WHERE '. implode(' OR ', $where) .' OR format = %d';
+ $query .= ' WHERE ' . implode(' OR ', $where) . ' OR format = %d';
$args[] = variable_get('filter_default_format', 1);
}
- $result = db_query($query .' ORDER by weight', $args);
+ $result = db_query($query . ' ORDER by weight', $args);
while ($format = db_fetch_object($result)) {
$formats[$format->format] = $format;
}
@@ -332,7 +332,7 @@ function filter_list_all() {
$list = module_invoke($module, 'filter', 'list');
if (isset($list) && is_array($list)) {
foreach ($list as $delta => $name) {
- $filters[$module .'/'. $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
+ $filters[$module . '/' . $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
}
}
}
@@ -380,7 +380,7 @@ function filter_list_format($format) {
$list = module_invoke($filter->module, 'filter', 'list');
if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
$filter->name = $list[$filter->delta];
- $filters[$format][$filter->module .'/'. $filter->delta] = $filter;
+ $filters[$format][$filter->module . '/' . $filter->delta] = $filter;
}
}
}
@@ -424,7 +424,7 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
$format = filter_resolve_format($format);
// Check for a cached version of this piece of text.
- $cache_id = $format .':'. md5($text);
+ $cache_id = $format . ':' . md5($text);
if ($cached = cache_get($cache_id, 'cache_filter')) {
return $cached->data;
}
@@ -502,7 +502,7 @@ function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents =
'#return_value' => $format->format,
'#parents' => $parents,
'#description' => theme('filter_tips', _filter_tips($format->format, FALSE)),
- '#id' => form_clean_id('edit-'. implode('-', $parents_for_id)),
+ '#id' => form_clean_id('edit-' . implode('-', $parents_for_id)),
);
}
}
@@ -583,7 +583,7 @@ function _filter_tips($format, $long = FALSE) {
* @ingroup themeable
*/
function theme_filter_tips_more_info() {
- return '<p>'. l(t('More information about formatting options'), 'filter/tips') .'</p>';
+ return '<p>' . l(t('More information about formatting options'), 'filter/tips') . '</p>';
}
/**
@@ -708,10 +708,10 @@ function _filter_url_settings($format) {
'#title' => t('URL filter'),
'#collapsible' => TRUE,
);
- $form['filter_urlfilter']['filter_url_length_'. $format] = array(
+ $form['filter_urlfilter']['filter_url_length_' . $format] = array(
'#type' => 'textfield',
'#title' => t('Maximum link text length'),
- '#default_value' => variable_get('filter_url_length_'. $format, 72),
+ '#default_value' => variable_get('filter_url_length_' . $format, 72),
'#maxlength' => 4,
'#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'),
);
@@ -724,9 +724,9 @@ function _filter_url_settings($format) {
*/
function _filter_url($text, $format) {
// Pass length to regexp callback
- _filter_url_trim(NULL, variable_get('filter_url_length_'. $format, 72));
+ _filter_url_trim(NULL, variable_get('filter_url_length_' . $format, 72));
- $text = ' '. $text .' ';
+ $text = ' ' . $text . ' ';
// Match absolute URLs.
$text = preg_replace_callback("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])((http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", '_filter_url_parse_full_links', $text);
@@ -779,7 +779,7 @@ function _filter_htmlcorrector($text) {
if (in_array($tagname, $stack)) {
// Close other tags lingering first.
do {
- $output .= '</'. $stack[0] .'>';
+ $output .= '</' . $stack[0] . '>';
} while (array_shift($stack) != $tagname);
}
// Otherwise, discard it.
@@ -789,7 +789,7 @@ function _filter_htmlcorrector($text) {
else {
// See if we have an identical 'no nesting' tag already open and close it if found.
if (count($stack) && ($stack[0] == $tagname) && isset($no_nesting[$stack[0]])) {
- $output .= '</'. array_shift($stack) .'>';
+ $output .= '</' . array_shift($stack) . '>';
}
// Push non-single-use tags onto the stack
if (!isset($single_use[$tagname])) {
@@ -797,9 +797,9 @@ function _filter_htmlcorrector($text) {
}
// Add trailing slash to single-use tags as per X(HT)ML.
else {
- $value = rtrim($value, ' /') .' /';
+ $value = rtrim($value, ' /') . ' /';
}
- $output .= '<'. $value .'>';
+ $output .= '<' . $value . '>';
}
}
else {
@@ -810,7 +810,7 @@ function _filter_htmlcorrector($text) {
}
// Close remaining tags.
while (count($stack) > 0) {
- $output .= '</'. array_shift($stack) .'>';
+ $output .= '</' . array_shift($stack) . '>';
}
return $output;
}
@@ -822,7 +822,7 @@ function _filter_url_parse_full_links($match) {
$match[2] = decode_entities($match[2]);
$caption = check_plain(_filter_url_trim($match[2]));
$match[2] = check_url($match[2]);
- return $match[1] .'<a href="'. $match[2] .'" title="'. $match[2] .'">'. $caption .'</a>'. $match[5];
+ return $match[1] . '<a href="' . $match[2] . '" title="' . $match[2] . '">' . $caption . '</a>' . $match[5];
}
/**
@@ -832,7 +832,7 @@ function _filter_url_parse_partial_links($match) {
$match[2] = decode_entities($match[2]);
$caption = check_plain(_filter_url_trim($match[2]));
$match[2] = check_plain($match[2]);
- return $match[1] .'<a href="http://'. $match[2] .'" title="'. $match[2] .'">'. $caption .'</a>'. $match[3];
+ return $match[1] . '<a href="http://' . $match[2] . '" title="' . $match[2] . '">' . $caption . '</a>' . $match[3];
}
/**
@@ -846,7 +846,7 @@ function _filter_url_trim($text, $length = NULL) {
// Use +3 for '...' string length.
if (strlen($text) > $_length + 3) {
- $text = substr($text, 0, $_length) .'...';
+ $text = substr($text, 0, $_length) . '...';
}
return $text;
@@ -888,20 +888,20 @@ function _filter_autop($text) {
}
}
else if (!$ignore) {
- $chunk = preg_replace('|\n*$|', '', $chunk) ."\n\n"; // just to make things a little easier, pad the end
+ $chunk = preg_replace('|\n*$|', '', $chunk) . "\n\n"; // just to make things a little easier, pad the end
$chunk = preg_replace('|<br />\s*<br />|', "\n\n", $chunk);
- $chunk = preg_replace('!(<'. $block .'[^>]*>)!', "\n$1", $chunk); // Space things out a little
- $chunk = preg_replace('!(</'. $block .'>)!', "$1\n\n", $chunk); // Space things out a little
+ $chunk = preg_replace('!(<' . $block . '[^>]*>)!', "\n$1", $chunk); // Space things out a little
+ $chunk = preg_replace('!(</' . $block . '>)!', "$1\n\n", $chunk); // Space things out a little
$chunk = preg_replace("/\n\n+/", "\n\n", $chunk); // take care of duplicates
$chunk = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $chunk); // make paragraphs, including one at the end
$chunk = preg_replace('|<p>\s*</p>\n|', '', $chunk); // under certain strange conditions it could create a P of entirely whitespace
$chunk = preg_replace("|<p>(<li.+?)</p>|", "$1", $chunk); // problem with nested lists
$chunk = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $chunk);
$chunk = str_replace('</blockquote></p>', '</p></blockquote>', $chunk);
- $chunk = preg_replace('!<p>\s*(</?'. $block .'[^>]*>)!', "$1", $chunk);
- $chunk = preg_replace('!(</?'. $block .'[^>]*>)\s*</p>!', "$1", $chunk);
+ $chunk = preg_replace('!<p>\s*(</?' . $block . '[^>]*>)!', "$1", $chunk);
+ $chunk = preg_replace('!(</?' . $block . '[^>]*>)\s*</p>!', "$1", $chunk);
$chunk = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $chunk); // make line breaks
- $chunk = preg_replace('!(</?'. $block .'[^>]*>)\s*<br />!', "$1", $chunk);
+ $chunk = preg_replace('!(</?' . $block . '[^>]*>)\s*<br />!', "$1", $chunk);
$chunk = preg_replace('!<br />(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $chunk);
$chunk = preg_replace('/&([^#])(?![A-Za-z0-9]{1,8};)/', '&amp;$1', $chunk);
}
@@ -1036,7 +1036,7 @@ function _filter_xss_split($m, $store = FALSE) {
// Clean up attributes
$attr2 = implode(' ', _filter_xss_attributes($attrlist));
$attr2 = preg_replace('/[<>]/', '', $attr2);
- $attr2 = strlen($attr2) ? ' '. $attr2 : '';
+ $attr2 = strlen($attr2) ? ' ' . $attr2 : '';
return "<$elem$attr2$xhtml_slash>";
}