bbp_code_trick_reverse( string $content = '' )
When editing a topic or reply, reverse the code trick so the textarea contains the correct editable content.
Description
Parameters
- $content
-
(Optional) Topic and reply content
Default value: ''
Return
(string) Partially encodedd content
Source
File: bp-forums/common/formatting.php
function bbp_code_trick_reverse( $content = '' ) { // Setup variables $openers = array( '<p>', '<br />' ); $content = preg_replace_callback( "!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", 'bbp_decode_callback', $content ); // Do the do $content = str_replace( $openers, '', $content ); $content = str_replace( '</p>', "\n", $content ); $content = str_replace( '<coded_br />', '<br />', $content ); $content = str_replace( '<coded_p>', '<p>', $content ); $content = str_replace( '</coded_p>', '</p>', $content ); return $content; }
Changelog
Version | Description |
---|---|
bbPress (r4641) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.