Version 5.0.6

This commit is contained in:
Neo committed 2025-12-19 18:55:49 -08:00
1 parent a3a4a9ccbd
commit b89858b2ff
1214 files changed
+92828 -14859

No files matched your search

+16 -16
View File
@@ -59,7 +59,7 @@ class ConverterParser extends Parser
/**
* @brief If parsing BBCode, the supported BBCode tags
*/
protected ?array $bbcode = NULL;
public ?array $bbcodes = NULL;
/**
* Constructor
@@ -89,7 +89,7 @@ class ConverterParser extends Parser
/* Get available BBCodes */
if ( $bbcode )
{
$this->bbcode = static::bbcodeTags( $this->member, $this->area );
$this->bbcodes = static::bbcodeTags( $this->member, $this->area );
}
/* Get attachments */
@@ -173,11 +173,11 @@ class ConverterParser extends Parser
if( $enabled )
{
$this->bbcode = static::bbcodeTags( $this->member, $this->area );
$this->bbcodes = static::bbcodeTags( $this->member, $this->area );
}
else
{
$this->bbcode = NULL;
$this->bbcodes = NULL;
}
}
}
@@ -234,10 +234,10 @@ class ConverterParser extends Parser
/* This fix resolves an issue using <br> mode where BBCode tags are wrapped in P tags like so: <p>[tag]</p><p>Content</p><p>[/tag]</p> tags.
The fix just removes the </p><p> tags inside block BBCode tags, so our example ends up parsing like so: <p>[tag]<br><br>Content<br><br>[/tag]</p>
We will want to find a more elegant fix for this at some point */
if ( $this->bbcode !== NULL and ! Settings::i()->editor_paragraph_padding )
if ( $this->bbcodes !== NULL and ! Settings::i()->editor_paragraph_padding )
{
$blockTags = array();
foreach( $this->bbcode as $tag => $data )
foreach( $this->bbcodes as $tag => $data )
{
if ( ! empty( $data['block'] ) )
{
@@ -288,7 +288,7 @@ class ConverterParser extends Parser
$document = $parser->parseValueIntoDocument( $value );
/* [page] tags need to be handled specially */
if ( $this->bbcode !== NULL and $this->containsPageTags )
if ( $this->bbcodes !== NULL and $this->containsPageTags )
{
$body = DOMParser::getDocumentBody( $document );
@@ -443,10 +443,10 @@ class ConverterParser extends Parser
}
/* If we are parsing BBCode, we will look for opening (e.g. "[foo=bar]") and closing (e.g. "[/foo]") tags */
if ( $this->bbcode !== NULL and count( $this->bbcode ) )
if ( $this->bbcodes !== NULL and count( $this->bbcodes ) )
{
/* First, if we have any single-tag BBCodes (e.g. "[img=URL]") expressed as normal BBCodes (e.g. "[img]URL[/img]") - fix that */
foreach ( $this->bbcode as $tag => $bbcode )
foreach ( $this->bbcodes as $tag => $bbcode )
{
if ( isset( $bbcode['single'] ) and $bbcode['single'] )
{
@@ -462,7 +462,7 @@ class ConverterParser extends Parser
}
/* And add our regex to the breakpoints */
$breakPoints[] = '(\[\/?(?:' . implode( '|', array_map( function ( $value ) { return preg_quote( $value, '/' ); }, array_keys( $this->bbcode ) ) ) . ')(?:[=\s].+?)?\])';
$breakPoints[] = '(\[\/?(?:' . implode( '|', array_map( function ( $value ) { return preg_quote( $value, '/' ); }, array_keys( $this->bbcodes ) ) ) . ')(?:[=\s].+?)?\])';
}
/* If we have any acronyms, they also need to be breakpoints */
@@ -522,10 +522,10 @@ class ConverterParser extends Parser
/* Start of BBCode tag? */
if (
$this->bbcode !== NULL and $this->bbcodeParse and // BBCode is enabled
$this->bbcodes !== NULL and $this->bbcodeParse and // BBCode is enabled
preg_match( '/^\[([a-z\*]+?)(?:([=\s])(.+?))?\]$/i', $section, $matches ) and // It looks like a BBCode tag
array_key_exists( mb_strtolower( $matches[1] ), $this->bbcode ) and // The tag is in the list
( !isset( $this->bbcode[ mb_strtolower( $matches[1] ) ]['allowOption'] ) or $this->bbcode[ mb_strtolower( $matches[1] ) ]['allowOption'] === TRUE or !isset( $matches[3] ) or !$matches[3] ) // If options aren't allowed for this tag, there isn't one
array_key_exists( mb_strtolower( $matches[1] ), $this->bbcodes ) and // The tag is in the list
( !isset( $this->bbcodes[ mb_strtolower( $matches[1] ) ]['allowOption'] ) or $this->bbcodes[ mb_strtolower( $matches[1] ) ]['allowOption'] === TRUE or !isset( $matches[3] ) or !$matches[3] ) // If options aren't allowed for this tag, there isn't one
)
{
/* What was the option? */
@@ -689,7 +689,7 @@ class ConverterParser extends Parser
protected function _openBBCode( string $tag, ?string $option, DOMNode &$parent, int $sectionId, int $sectionCount ) : void
{
/* Get definition */
$bbcode = $this->bbcode[ $tag ];
$bbcode = $this->bbcodes[ $tag ];
/* Get the document */
$document = $parent->ownerDocument ?: $parent;
@@ -744,7 +744,7 @@ class ConverterParser extends Parser
if ( $bbcodeElement instanceof DOMElement )
{
if ( $lastOpenedBlockId and list( $id, $tagName ) = explode( '-', $lastOpenedBlockId ) and isset( $this->bbcode[ $tagName ]['noChildren'] ) and $this->bbcode[ $tagName ]['noChildren'] )
if ( $lastOpenedBlockId and list( $id, $tagName ) = explode( '-', $lastOpenedBlockId ) and isset( $this->bbcodes[ $tagName ]['noChildren'] ) and $this->bbcodes[ $tagName ]['noChildren'] )
{
$parent->appendChild( $bbcodeElement );
}
@@ -815,7 +815,7 @@ class ConverterParser extends Parser
protected function _closeBBCode( string $tag, DOMNode &$parent, int $sectionId, int $sectionCount ) : void
{
/* Get definition */
$bbcode = $this->bbcode[ $tag ];
$bbcode = $this->bbcodes[ $tag ];
/* Block level? */
if ( isset( $bbcode['block'] ) and $bbcode['block'] )