Thu, January 23, 2020, 00:34:06
 
Home · Latest · Trends  /  PHP
5

Smarty Remove BBCode

Smarty Remove BBCode From String
//libs/plugins/modifier.removebb.php

<?php
/**
 * Smarty plugin
 *
 * @package Smarty
 * @subpackage plugins
 */
/**
 * smarty_modifier_removebb()
 * 
 * @param mixed $string
 * @return
 */
function smarty_modifier_removebb($string) {
 $find = '|[[/!]*?[^[]]*?]|si';
 $replace = '';
 return preg_replace($find,$replace,$string);
}
?>

// Usage:

{$m.foo|removebb}


rated 5 times [  5] [ 0]  / comments: 1 / hits: 1618  / 3 years ago, thu, nov 10, 2016, 16:21:59
More From » PHP
 

Comments

1
The correct code should be:
Code:
$find = '|[[\/\!]*?[^\[\]]*?]|si';
[#26] Saturday, December 28, 2019, 16:01:29
 
pport
commented 4 weeks ago
pport
Username
 
Your Comment
 
Share
Snippets
Using bind variables with ADODB
3 years ago, tue, sep 6, 2016
This module provides HTML and CLI interfaces for viewing key performance indicators of your database.
3 years ago, tue, sep 6, 2016
How to check if mail function is enabled on your server
3 years ago, tue, sep 6, 2016
Compare dates in smarty template file
3 years ago, fri, sep 16, 2016
Change default chrome input style CSS
3 years ago, fri, sep 16, 2016
Get domain name without Tld with PHP
3 years ago, fri, sep 16, 2016
Validating international phone numbers with jquery
3 years ago, sun, sep 25, 2016
How to detect if uploaded file is image or not with php
3 years ago, mon, nov 21, 2016
How to check CKEditor 4 textarea not empty
3 years ago, sun, dec 25, 2016
Posted
Ronald

Ronald

Member since Sep 6, 2016
Total Code Snippets: 20
Total Comments: 1
Location: n/a
Following
User not following anyone yet.