I need a script (or a method) to convert certain keywords in a BBCODE type text.
In example:
Keywords to find: TEST1-, TEST2-
BBCODE: [MYBBCODE]
This post:
Will change to:
I do accomplish the above in vB, with the following PHP (but I don't know how to convert it in a XF addon):
In example:
Keywords to find: TEST1-, TEST2-
BBCODE: [MYBBCODE]
This post:
TEXT TEST1-123 TEXT
TEXT TEST2-123 TEXT
Will change to:
---TEXT [MYBBCODE]TEST1-123[/MYBBCODE] TEXT
TEXT [MYBBCODE]TEST2-123[/MYBBCODE] TEXT
I do accomplish the above in vB, with the following PHP (but I don't know how to convert it in a XF addon):
Code:
$advanced_bbcode = array(
'/(?<=\s|^|\()TEST1-[0-9]+/',
'/(?<=\s|^|\()TEST2-[0-9]+/'
);
if ($this->post['pagetext']) {
$this->post['pagetext'] = preg_replace($advanced_bbcode, '[MYBBCODE]$0[/MYBBCODE]', $this->post['pagetext']);
}