user-notes.php preview

From: Date: Mon, 05 Jan 2004 03:09:53 +0000
Subject: user-notes.php preview
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969357926@lists.php.net to get a copy of this message
It'd be nice to have a full preview of the note you're editing. I've included a patch against php-master-web/manage/user-notes#1.34 to do this, by highlight_php()ing <?php...?>. I'm pretty sure it works. ;-) Ken ------- Index: user-notes.php =================================================================== RCS file: /repository/php-master-web/manage/user-notes.php,v retrieving revision 1.34 diff -u -r1.34 user-notes.php --- user-notes.php 15 Nov 2003 19:45:47 -0000 1.34 +++ user-notes.php 5 Jan 2004 03:06:45 -0000 @@ -260,10 +260,19 @@ $note = isset($note) ? $note : addslashes($row['note']); if ($action == "preview") { - echo "<p class=\"notepreview\">",clean_note(stripslashes($note)), + $cleaned_note = clean_note(stripslashes($note)); + $cleaned_note = preg_replace_callback( + '#<\?php(.*)\?>#', + create_function( + '$matches', + 'return highlight_php(\'<?php\'.$matches[1].\'?>\');' + ) + ); + echo "<p class=\"notepreview\">",$cleaned_note, "<br /><span class=\"author\">",date("d-M-Y h:i",$row['ts'])," ", clean($email),"</span></p>"; } + unset($cleaned_note); ?> <form method="post" action="<?php echo $PHP_SELF;?>"> <input type="hidden" name="id" value="<?php echo $id;?>" />

« previous php.doc (#969357926) next »