Wed, April 14, 2021
 
https://devcodepro.comdevcodepro
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: 2479  / 5 years ago, thu, nov 10, 16, 04:21:59
More From » PHP
 

Comments

1
The correct code should be:

Code:
$find = '|[[\/\!]*?[^\[\]]*?]|si';
[#26] Saturday, December 28, 2019, 4:01:29
 
pport
commented 1 year ago
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
Ronald
Member since Sep 6, 2016
Total Code Snippets: 23
Total Comments: 1
Location: New Britain, Connecticut
Ronald snippets
5 years ago, tue, sep 6, 16, 10:11:38
comments: 0 / hits: 2328
PHP
5 years ago, tue, sep 6, 16, 10:18:23
comments: 0 / hits: 2235
PHP
5 years ago, tue, sep 6, 16, 10:42:24
comments: 0 / hits: 2527
PHP
5 years ago, fri, sep 16, 16, 1:10:12
comments: 0 / hits: 2801
PHP
5 years ago, fri, sep 16, 16, 1:12:32
comments: 0 / hits: 2021
CSS
5 years ago, fri, sep 16, 16, 1:27:33
comments: 0 / hits: 3003
PHP
5 years ago, sun, sep 25, 16, 2:52:42
comments: 1 / hits: 2375
4 years ago, mon, nov 21, 16, 10:48:23
comments: 2 / hits: 7778
PHP
4 years ago, sun, dec 25, 16, 2:44:24
comments: 0 / hits: 4601