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 Description


Parameters Parameters

$content

(Optional) Topic and reply content

Default value: ''


Top ↑

Return Return

(string) Partially encoded content


Top ↑

Source Source

File: includes/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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.