|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-06-20 11:29 UTC] xdecock at gmail dot com
[2010-12-02 18:59 UTC] hiram_ at gmx dot net
[2011-06-18 11:10 UTC] hiram_ at gmx dot net
[2011-10-21 23:11 UTC] hiram_ at gmx dot net
[2011-11-21 23:33 UTC] hiram_ at gmx dot net
[2017-04-01 19:31 UTC] tpunt@php.net
-Status: Open
+Status: Wont fix
[2017-04-01 19:31 UTC] tpunt@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 23:00:01 2025 UTC |
Description: ------------ I want to replace newlines with <br /> while parsing BBcode and do some more special replacements. But since our youtube tag replacement includes some newlines, those are replaced by <br /> to. Is it possible to add an generic content handler? so for example for the string "hello [b]this[/b] is [i]bold[/i]" and the parser below that handler would get called with "hello ", " is " and "this" Reproduce code: --------------- <?php $string = "hello [b]this[/b] is [i]bold[/i]"; $BBCode = array( ''=> array( 'type' => BBCODE_TYPE_ROOT), 'generic'=> array( 'type' => BBCODE_TYPE_GENERIC, 'content_handling'=> 'contentHandler'), 'b'=> array( 'type' => BBCODE_TYPE_NOARG, 'open_tag'=> '<strong>', 'close_tag'=> '</strong>'), 'i'=> array( 'type' => BBCODE_TYPE_NOARG, 'child' => '!generic', 'open_tag'=> '<em>', 'close_tag'=> '</em>'), ); $BBHandler = bbcode_create($BBCode); bbcode_parse($BBHandler, $string); function contentHandler($content) { echo "'$content'\n"; } ?> Expected result: ---------------- 'hello ' 'this' ' is '