From d80d2d6e2df3230cceeb377169daac93e3e5b494 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 15 Jun 2004 18:02:52 +0000
Subject: [PATCH] - Patch #8477 by Goba: fixes issues of newline handling in
 filters, unifying what newline should a filter expect, and fixes the missing
 title filter tip issue.

---
 modules/filter.module        |  6 ++++++
 modules/filter/filter.module |  6 ++++++
 modules/title.module         | 10 +++++-----
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/modules/filter.module b/modules/filter.module
index 0221d35e7977..f83f2eb144fc 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -149,6 +149,12 @@ function filter_list($force = 0) {
  */
 function check_output($text) {
   if (isset($text)) {
+
+    // Convert all Windows and Mac newlines to a single newline,
+    // so filters only need to deal with this one
+    $text = str_replace(array("\r\n", "\r"), "\n", $text);
+
+    // Get complete list of filters ordered properly
     $filters = filter_list();
 
     // Give filters the chance to escape HTML-like data such as code or formulas.
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 0221d35e7977..f83f2eb144fc 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -149,6 +149,12 @@ function filter_list($force = 0) {
  */
 function check_output($text) {
   if (isset($text)) {
+
+    // Convert all Windows and Mac newlines to a single newline,
+    // so filters only need to deal with this one
+    $text = str_replace(array("\r\n", "\r"), "\n", $text);
+
+    // Get complete list of filters ordered properly
     $filters = filter_list();
 
     // Give filters the chance to escape HTML-like data such as code or formulas.
diff --git a/modules/title.module b/modules/title.module
index 35907241a503..78b7177c4841 100644
--- a/modules/title.module
+++ b/modules/title.module
@@ -8,6 +8,10 @@ function title_help($section) {
   switch ($section) {
     case 'admin/system/modules#description':
       return t('Enables users to link to stories, articles or similar content by title.');
+    case 'filter#short-tip' :
+      return t('<a href=\"%title-help\">Link to content</a> on this site using <em>[title|text]</em>.', array("%title-help" => url('filter/tips', NULL, 'filter-title')));
+    case 'filter#long-tip' :
+      return '<p>' . t('You may quickly link to content on the site using this syntax: <em>[title|text]</em>. This will generate a link labeled "text" to the content with the title "title". If you omit "|text", the label becomes "title".') . '</p>';
   }
 }
 
@@ -63,7 +67,7 @@ function title_page($query) {
 /**
  * Implementation of hook_filter().
  */
-function title_filter($op, $text = '') {
+function title_filter($op, $text = '', $node = NULL) {
   switch ($op) {
     case 'name':
       return t('Title filter');
@@ -92,8 +96,4 @@ function _title_filter_settings() {
   return form_group(t('Title filter'), t('Wiki-like [node title|text] links are enabled. These shortcuts generate a link labeled "text" to the node with the title "node title". If you omit "|text", the label becomes "node title". You may use a substring of a node title if desired. When multiple matching titles are found, a list of matching nodes will be displayed. If no matching titles are found, a full-text search is returned.'));
 }
 
-function title_compose_tips() {
-  return array(t('You may quickly link to another node using this syntax: <em>[node title|text]</em>. This will generate a link labeled "text" to the node with the title "node title". If you omit "|text", the label becomes "node title".'));
-}
-
 ?>
-- 
GitLab