Re: user-notes.php preview
| From: | Jakub Vrana | Date: | Mon, 05 Jan 2004 09:03:31 +0000 |
| Subject: | Re: user-notes.php preview | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969357931@lists.php.net to get a copy of this message | ||
Ken Tossell wrote:
> + $cleaned_note = clean_note(stripslashes($note));
> + $cleaned_note = preg_replace_callback(
> + '#<\?php(.*)\?>#',
> + create_function(
> + '$matches',
> + 'return
> highlight_php(\'<?php\'.$matches[1].\'?>\');'
> + )
> + );
One call of highlight_php should be enough as PHP tags are found by
this function - preg is useless. It will be also better to call
highlight_php inside clean_note - preview is displayed on more than
one place. You must call it in the place of htmlspecialchars - this
will not work as <? is changed to < - highlight_string do escape
for you. There is one more issue - there is no highlight_php function
in php-master-web, you must implement it or use highlight_string
instead.
Jakub Vrana