cvs diff: Diffing .
cvs diff: Diffing database
cvs diff: Diffing examples
cvs diff: Diffing hooks
cvs diff: Diffing topics
? .buildpath
? .project
Index: examples/filter_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/docs/developer/examples/filter_example.module,v
retrieving revision 1.8
diff -u -p -r1.8 filter_example.module
--- examples/filter_example.module	29 Jan 2007 16:19:57 -0000	1.8
+++ examples/filter_example.module	9 Feb 2010 18:29:16 -0000
@@ -113,7 +113,9 @@ function filter_example_filter($op, $del
 
         // Since this filter will return a different result on each page load, we
         // need to return TRUE for "no cache" to ensure that the filter is run
-        // every time the text is requested.
+        // every time the text is requested. Setting this to TRUE will force
+        // every filter in associated input formats to be run on every access,
+        // so only disable caching if absolutely required.
         case 'no cache':
           return TRUE;
 
@@ -125,15 +127,17 @@ function filter_example_filter($op, $del
         // is to use the "prepare" operation to escape the special characters, and
         // to later replace our escaped version in the "process" step.
         //
-        // We'll use the bytes 0xFE and 0xFF to replace < and > here. These bytes
-        // are not valid in UTF-8 data and thus unlikely to cause problems.
+        // We'll use [filter-example-time] as a replacement for the time tag.
+        // Note that in a more complicated filter a closing tag may also be
+        // required. For more information, see "Temporary placeholders and
+        // delimiters" at http://drupal.org/node/209715.
         case 'prepare':
-          return preg_replace('!<time ?/>!', '\xFEtime /\xFF', $text);
+          return preg_replace('!<time ?/>!', '[filter-example-time]', $text);
 
         // Now, in the "process" step, we'll search for our escaped time tags and
         // to the real filtering.
         case 'process':
-          return str_replace('\xFEtime /\xFF', '<em>'. format_date(time()) .'</em>', $text);
+          return str_replace('[filter-example-time]', '<em>' . format_date(time()) . '</em>', $text);
       }
       break;
   }
