Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,42 +11,48 @@
|
||||
namespace IPS\Content\Search\Result;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Content\Search\Result;
|
||||
use IPS\DateTime;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search Result not from Index
|
||||
*/
|
||||
class _Custom extends \IPS\Content\Search\Result
|
||||
class Custom extends Result
|
||||
{
|
||||
/**
|
||||
* @brief HTML
|
||||
*/
|
||||
protected $html;
|
||||
protected string $html;
|
||||
|
||||
/**
|
||||
* @brief Image
|
||||
*/
|
||||
protected $image;
|
||||
protected string|null $image;
|
||||
|
||||
/**
|
||||
* @brief Data used for merging multiple extra items
|
||||
*/
|
||||
protected $mergeData;
|
||||
protected array $mergeData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\DateTime $time The time for this result
|
||||
* @param DateTime $time The time for this result
|
||||
* @param string $html HTML to display
|
||||
* @param string|NULL $image HTML for image to display
|
||||
* @param string|NULL $mergeData Data for merging
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\DateTime $time, $html, $image = NULL, $mergeData = NULL )
|
||||
public function __construct( DateTime $time, string $html, string|null $image = NULL, string|null $mergeData = NULL )
|
||||
{
|
||||
$this->createdDate = $time;
|
||||
$this->lastUpdatedDate = $time;
|
||||
@@ -62,7 +68,7 @@ class _Custom extends \IPS\Content\Search\Result
|
||||
* @param string|NULL $mergeData Data for merging
|
||||
* @return void
|
||||
*/
|
||||
public function mergeInData( $html, $mergeData = NULL )
|
||||
public function mergeInData( string $html, string|null $mergeData = NULL ): void
|
||||
{
|
||||
$this->html = $html;
|
||||
$this->mergeData[] = $mergeData;
|
||||
@@ -73,7 +79,7 @@ class _Custom extends \IPS\Content\Search\Result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMergeData()
|
||||
public function getMergeData(): array
|
||||
{
|
||||
return $this->mergeData ?: array();
|
||||
}
|
||||
@@ -84,8 +90,8 @@ class _Custom extends \IPS\Content\Search\Result
|
||||
* @param string $view The view to use (expanded or condensed)
|
||||
* @return string
|
||||
*/
|
||||
public function html( $view = 'expanded' )
|
||||
public function html( string $view = 'expanded' ): string
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'streams', 'core' )->extraItem( $this->createdDate, $this->image, $this->html, $view );
|
||||
return Theme::i()->getTemplate( 'streams', 'core' )->extraItem( $this->createdDate, $this->image, $this->html, $view );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user