You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-64Lines changed: 56 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -1,72 +1,63 @@
1
+
# chillerlan/php-bbcode
2
+
3
+
A recursive regexp [BBCode](http://en.wikipedia.org/wiki/BBCode) parser for PHP 7+ using [preg_replace_callback()](http://php.net/preg_replace_callback),
4
+
based on an example by [MrNiceGuy](http://www.developers-guide.net/forums/member/69,mrniceguy) on
In order to create your own modules, you'll first need an empty base module which contains
126
117
all basic settings and methods for each module. To do so, you'll need to extend
127
118
`\chillerlan\bbcode\Modules\BaseModuleAbstract` . There's really not much to do, the only and most
@@ -148,7 +139,7 @@ class MyAwesomeBaseModule extends BaseModuleAbstract{
148
139
}
149
140
```
150
141
151
-
####Encoder module
142
+
### Encoder module
152
143
Now that we have our base module, we're able to create the encoder module, where the actual transform happens.
153
144
Each encoder module extends a base module depending on output type (`MyAwesomeBaseModule` here)
154
145
and implements `\chillerlan\bbcode\Modules\ModuleInterface`. The property `$tags` and the method `__transform()` are mandatory.
@@ -194,7 +185,7 @@ class MyAwesomeModule extends Simpletext implements ModuleInterface{
194
185
}
195
186
```
196
187
197
-
####Parser extension
188
+
### Parser extension
198
189
The parser features an extension which allows you to alter the bbcode during the parsing process,
199
190
namely before and after the main parser unit runs. If you want to create your own parser extension,
200
191
just implement `\chillerlan\bbcode\ParserExtensionInterface`, set it in the parser options and you're done.
@@ -226,15 +217,16 @@ class MyAwesomeParserExtension implements ParserExtensionInterface{
226
217
227
218
}
228
219
```
229
-
#### Language
230
-
231
-
### Notes
220
+
### Language
221
+
-@todo
222
+
223
+
## Notes
232
224
The parser may cause some high CPU load, depending on the input. You should never consider to use it somewhere
233
225
in your output subsystem - not even with strong caching. Encode on input - you'll want a preview anyway. ;)
234
226
235
227
You may also run into several bugs. In fact, the BBCoder is essentially a tool to squeeze out any PCRE related bug in PHP known to man (and perhaps unknown). Have fun! ;)
236
-
[It is highly recommended to use these php.ini settings](https://github.com/codemasher/php-bbcode/blob/master/travis-php.ini), especially to disable the PCRE JIT in PHP7 which is a troublemaker.
228
+
[It is highly recommended to use these php.ini settings](https://github.com/chillerlan/php-bbcode/blob/master/travis-php.ini), especially to disable the PCRE JIT in PHP7 which is a troublemaker.
237
229
In case you happen to run into a PCRE related bug, i ask you to open an issue over here along with the bbcode which caused the error and further information.
238
230
239
-
###Disclaimer!
231
+
## Disclaimer!
240
232
I don't take responsibility for molten CPUs, smashed keyboards, broken HTML etc.. Use at your own risk!
0 commit comments