Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+18 -3
View File
@@ -11,7 +11,7 @@
namespace IPS\Content\Search\Result;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -90,7 +90,8 @@ class _Content extends \IPS\Content\Search\Result
*/
public function html( $view = 'expanded', $asItem = FALSE, $canIgnoreComments=FALSE, $template=NULL )
{
return call_user_func( array( $this->indexData['index_class'], 'searchResult' ), $this->indexData, $this->authorData, $this->itemData, $this->containerData, $this->reputationData, $this->reviewRating, $this->iPostedIn, $view, $asItem, $canIgnoreComments, $template, $this->reactions );
$searchResultTemplate = array( $this->indexData['index_class'], 'searchResult' );
return $searchResultTemplate( $this->indexData, $this->authorData, $this->itemData, $this->containerData, $this->reputationData, $this->reviewRating, $this->iPostedIn, $view, $asItem, $canIgnoreComments, $template, $this->reactions );
}
/**
@@ -123,7 +124,21 @@ class _Content extends \IPS\Content\Search\Result
{
$class = $this->indexData['index_class'];
$object = $class::load( $this->indexData['index_object_id'] );
$document->addItem( $object instanceof \IPS\Content\Comment ? $object->item()->searchIndexTitle() : $object->searchIndexTitle(), $object->url(), $this->indexData['index_content'], \IPS\DateTime::ts( $this->indexData['index_date_created'] ) );
$enclosure = NULL;
if ( $images = $object->contentImages(1) )
{
$data = array_pop( $images );
$key = key( $data );
try
{
$enclosure = \IPS\File::get( $key, $data[ $key ] );
}
catch( \Exception $ex ) { }
}
$document->addItem( $object instanceof \IPS\Content\Comment ? $object->item()->searchIndexTitle() : $object->searchIndexTitle(), $object->url(), $this->indexData['index_content'], \IPS\DateTime::ts( $this->indexData['index_date_created'] ), NULL, $enclosure );
}
/* If the search result was orphaned, let us continue */
catch( \OutOfRangeException $e ){}
+3 -2
View File
@@ -11,7 +11,7 @@
namespace IPS\Content\Search\Result;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -58,7 +58,7 @@ class _Custom extends \IPS\Content\Search\Result
/**
* Merge in new data
*
* @param string $html New HTML to merge in as a list
* @param string $html New HTML to merge in as a list
* @param string|NULL $mergeData Data for merging
* @return void
*/
@@ -81,6 +81,7 @@ class _Custom extends \IPS\Content\Search\Result
/**
* HTML
*
* @param string $view The view to use (expanded or condensed)
* @return string
*/
public function html( $view = 'expanded' )
+7 -3
View File
@@ -11,7 +11,7 @@
namespace IPS\Content\Search;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -25,7 +25,7 @@ abstract class _Result
/**
* Pre-Display logic for search index content
*
* @param bool $createdDate If TRUE, uses $createdDate, otherwise uses $lastUpdatedDate
* @param string $content The search result content
* @return string
*/
public static function preDisplay( $content )
@@ -35,7 +35,11 @@ abstract class _Result
for this reason, but Emoji (because they're text) won't be. We can't swap the Emoji back out
with one of the alternative Emoji style images though because that re-introduces images, so we
just strip them out (making them behave like emoticons) */
if ( \IPS\Settings::i()->emoji_style == 'twemoji' or \IPS\Settings::i()->emoji_style == 'emojione' )
/* Trim content down to a sensible length for display */
$content = mb_substr( $content, 0, 600 );
if ( \IPS\Settings::i()->emoji_style == 'twemoji' )
{
return preg_replace( '/(?:' . \IPS\Text\Parser::EMOJI_REGEX . '|\x{200d})+/u', '', $content );
}
Whitespace-only changes.