Created
December 3, 2013 05:57
-
-
Save ntwb/7764534 to your computer and use it in GitHub Desktop.
bbPress - Custom BBCode Table Replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: bbPress - Custom BBCode Table Replace | |
Plugin URI: https://gist.github.com/ntwb/7764534 | |
Description: bbPress - Custom BBCode Table Replace | |
Version: 0.1 | |
Author: Stephen Edgar - Netweb | |
Author URI: http://netweb.com.au | |
*/ | |
function ntwb_custom_bbcode_table_replace( $text ) { | |
$text = preg_replace( '/\[bbcode_table\]/i', htmlspecialchars_decode( '<table>' ), $text); | |
$text = preg_replace( '/\[\/bbcode_table\]/i', htmlspecialchars_decode( '</table>' ), $text); | |
$text = preg_replace( '/\[bbcode_table_tr\]/i', htmlspecialchars_decode( '<tr>' ), $text); | |
$text = preg_replace( '/\[\/bbcode_table_tr\]/i', htmlspecialchars_decode( '</tr>' ), $text); | |
$text = preg_replace( '/\[bbcode_table_td\]/i', htmlspecialchars_decode( '<td>' ), $text); | |
$text = preg_replace( '/\[\/bbcode_table_td\]/i', htmlspecialchars_decode( '</td>' ), $text); | |
return $text; | |
} | |
add_filter('bbp_get_reply_content', 'ntwb_custom_bbcode_table_replace'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment