Version 5.0.0 beta 9

This commit is contained in:
Neo committed 2025-12-19 17:47:00 -08:00
1 parent 214f649f1d
commit 56979f8ee8
202 files changed
+4403 -1123

No files matched your search

+90 -1
View File
@@ -1051,6 +1051,9 @@ class Parser
$return[] = 'ipsEmbedded_og__' . $k;
}
/* Tables */
$return[] = "ipsRichText__table-wrapper";
/* Custom */
foreach( Application::enabledApplications() as $app )
{
@@ -1280,6 +1283,90 @@ class Parser
/* Note what $parent is */
$originalParent = $parent;
/* Acronym? */
if ( array_key_exists( $section, $this->caseSensitiveAcronyms ) and !in_array( $this->caseSensitiveAcronyms[ $section ], $this->openAbbrTags ) )
{
switch( $this->caseSensitiveAcronyms[ $section ]['a_type'] )
{
case 'acronym':
$parent = $parent->appendChild( new DOMElement( 'abbr' ) );
$parent->setAttribute( 'title', $this->caseSensitiveAcronyms[ $section ]['a_long'] );
break;
case 'link':
$replace = ( $parent->tagName != 'a' );
$parentNode = $parent;
while( ( $parentNode = $parentNode->parentNode ) !== NULL )
{
if( $parentNode instanceof DOMElement AND $parentNode->tagName == 'a' )
{
$replace = FALSE;
break;
}
}
if( $replace )
{
$parent = $parent->appendChild( new DOMElement( 'a' ) );
$parent->setAttribute( 'href', $this->caseSensitiveAcronyms[ $section ]['a_long'] );
try
{
$rels = $this->_getRelAttributes( Url::createFromString( $this->caseSensitiveAcronyms[ $section ]['a_long'] ) );
}
catch(Url\Exception $e )
{
$rels = array();
}
/* Add rels */
$parent->setAttribute( 'rel', implode( ' ', $rels ) );
}
break;
}
}
elseif ( array_key_exists( mb_strtolower( $section ), $this->caseInsensitiveAcronyms ) and !in_array( $this->caseInsensitiveAcronyms[ mb_strtolower( $section ) ], $this->openAbbrTags ) )
{
switch( $this->caseInsensitiveAcronyms[ mb_strtolower( $section ) ]['a_type'] )
{
case 'acronym':
$parent = $parent->appendChild( new DOMElement( 'abbr' ) );
$parent->setAttribute( 'title', $this->caseInsensitiveAcronyms[ mb_strtolower( $section ) ]['a_long'] );
break;
case 'link':
$replace = ( $parent->tagName != 'a' );
$parentNode = $parent;
while( ( $parentNode = $parentNode->parentNode ) !== NULL )
{
if( $parentNode instanceof DOMElement AND $parentNode->tagName == 'a' )
{
$replace = FALSE;
break;
}
}
if( $replace )
{
$parent = $parent->appendChild( new DOMElement( 'a' ) );
$parent->setAttribute( 'href', $this->caseInsensitiveAcronyms[ mb_strtolower( $section ) ]['a_long'] );
try
{
$rels = $this->_getRelAttributes( Url::createFromString( $this->caseInsensitiveAcronyms[ mb_strtolower( $section ) ]['a_long'] ) );
}
catch(Url\Exception $e )
{
$rels = array();
}
/* Add rels */
$parent->setAttribute( 'rel', implode( ' ', $rels ) );
}
break;
}
}
/* Emoji? */
if ( ( !$originalParent->getAttribute('class') or !in_array( 'ipsEmoji', explode( ' ', $originalParent->getAttribute('class') ) ) ) and preg_match( '/' . static::getEmojiRegex() . '/u', $section ) )
{
@@ -1641,7 +1728,8 @@ class Parser
}
}
$element->setAttribute( 'sandbox', 'allow-scripts' );
$element->setAttribute( 'sandbox', 'allow-scripts allow-same-origin' );
$element->setAttribute( 'allowfullscreen', '' );
// the width and height need to be set in the style attribute
$style = "";
foreach ( [ 'width', 'height' ] as $attr )
@@ -2322,6 +2410,7 @@ class Parser
'tiktok.com' => array( 'https://www.tiktok.com/oembed', static::EMBED_VIDEO ),
'm.tiktok.com' => array( 'https://www.tiktok.com/oembed', static::EMBED_VIDEO ),
'vm.tiktok.com' => array( 'https://www.tiktok.com/oembed', static::EMBED_VIDEO ),
'bsky.app' => [ 'https://embed.bsky.app/oembed', static::EMBED_TWEET ]
);
/* Can we support Facebook and Instagram oembeds? */