Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,23 +12,28 @@
namespace IPS\blog\extensions\core\RssImport;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Content;
use IPS\Content\Search\Index;
use IPS\core\Rss\Import;
use IPS\Extensions\RssImportAbstract;
use IPS\Helpers\Form;
use IPS\Member;
use IPS\Node\Model;
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;
}
/**
* @brief RSS Import extension: RssImport
*/
class _RssImport
class RssImport extends RssImportAbstract
{
/**
* @brief RSSImport Class
*/
public $classes = array();
public $fileStorage = 'blog_Blogs';
public string $fileStorage = 'blog_Blogs';
/**
* Constructor
@@ -45,7 +50,7 @@ class _RssImport
*
* @return array
*/
public function availableOptions()
public function availableOptions(): array
{
/* We don't want to set up Blog feeds in the ACP */
return array();
@@ -54,10 +59,9 @@ class _RssImport
/**
* Show in the Admin CP?
*
* @param Object $class The class to check
* @return boolean
*/
public function showInAdminCp( $class ): bool
public function showInAdminCp(): bool
{
return false;
}
@@ -65,26 +69,26 @@ class _RssImport
/**
* Node selector options
*
* @param \IPS\core\Rss\Import|null $rss Existing RSS object if editing|NULL if not
* @param Import|null $rss Existing RSS object if editing|null if not
* @return array
*/
public function nodeSelectorOptions( $rss )
public function nodeSelectorOptions( ?Import $rss ): array
{
return array( 'class' => 'IPS\blog\Blog', 'permissionCheck' => 'view' );
}
/**
* @param \IPS\core\Rss\Import $rss RSS object
* @param array $article RSS feed article importing
* @param \IPS\Node\Model $container Container object
* @param string $content Post content with read more link if set
* @return \IPS\Content
* @param Import $rss RSS object
* @param array $article RSS feed article importing
* @param Model $container Container object
* @param string $content Post content with read more link if set
* @return Content
*/
public function create( \IPS\core\Rss\Import $rss, $article, \IPS\Node\Model $container, $content )
public function create( Import $rss, array $article, Model $container, string $content ): Content
{
$settings = $rss->settings;
$class = $rss->_class;
$member = \IPS\Member::load( $rss->member );
$member = Member::load( $rss->member );
$entry = $class::createItem( $member, NULL, $article['date'], $container );
$entry->name = $article['title'];
$entry->content = $content;
@@ -92,7 +96,7 @@ class _RssImport
$entry->save();
/* Add to search index */
\IPS\Content\Search\Index::i()->index( $entry );
Index::i()->index( $entry );
/* Send notifications */
$entry->sendNotifications();
@@ -105,11 +109,11 @@ class _RssImport
/**
* Addition Form elements
*
* @param \IPS\Helpers\Form $form The form
* @param \IPS\core\Rss\Import|null $rss Existing RSS object if editing|NULL if not
* @param Form $form The form
* @param Import|null $rss Existing RSS object if editing|null if not
* @return void
*/
public function form( &$form, $rss=NULL )
public function form( Form $form, ?Import $rss=NULL ): void
{
/* Blogs has it's own front end controller */
}
@@ -117,11 +121,11 @@ class _RssImport
/**
* Process additional fields unique to this extension
*
* @param array $values Values from form
* @param \IPS\core\Rss\Import $rss Existing RSS object
* @param array $values Values from form
* @param Import $rss Existing RSS object
* @return array
*/
public function saveForm( &$values, $rss )
public function saveForm( array &$values, Import $rss ): array
{
/* Blogs has it's own front end controller */
return array( $values );