cvs diff: Diffing .
cvs diff: Diffing ahah_example
cvs diff: Diffing batch_example
cvs diff: Diffing block_example
cvs diff: Diffing element_example
cvs diff: Diffing email_example
cvs diff: Diffing filter_example
cvs diff: Diffing node_access_example
cvs diff: Diffing node_example
cvs diff: Diffing nodeapi_example
cvs diff: Diffing page_example
cvs diff: Diffing scaffolding_example
cvs diff: Diffing scaffolding_example/images
cvs diff: Diffing trigger_example
cvs diff: Diffing xmlrpc_example
? .project
Index: filter_example/filter_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/examples/filter_example/filter_example.module,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 filter_example.module
--- filter_example/filter_example.module	14 Oct 2009 23:46:46 -0000	1.1.2.1
+++ filter_example/filter_example.module	9 Feb 2010 18:21:07 -0000
@@ -113,7 +112,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,18 +126,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 unicode characters U+F8FF and U+F8FE (Private use
-        // characters) to replace < and > here. These characters are reserved
-        // by the Unicode standard for internal use in software.
-        // These characters are represented by the byte sequences \xEF\xA3\xBF and
-        // \xEF\xA3\xBE.
+        // 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 ?/>!', "\xEF\xA3\xBFtime /\xEF\xA3\xBE", $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("\xEF\xA3\xBFtime /\xEF\xA3\xBE", '<em>'. format_date(time()) .'</em>', $text);
+          return str_replace('[filter-example-time]', '<em>' . format_date(time()) . '</em>', $text);
       }
       break;
   }
