Documentation

FeedController
in package

Controller for feed management operations.

This controller handles all feed routes with native implementations using module services and facades. The migration from the legacy FeedsController is complete.

Tags
since
3.0.0

Table of Contents

Properties

$feedFacade  : FeedFacade
Feed facade.
$flashService  : FlashMessageService
Flash message service.
$languageFacade  : LanguageFacade
Language facade.
$viewPath  : string
View base path.
$wizardSession  : FeedWizardSessionManager
Wizard session manager.

Methods

__construct()  : mixed
Constructor.
archiveOldTexts()  : array<string|int, mixed>
Archive old texts.
buildQueryFilter()  : array{clause: string, search: string, mode: string, regex: string}
Build query filter.
countFeedLinks()  : int
Count feed articles.
countFeeds()  : int
Count feeds.
createFeed()  : int
Create a new feed.
createTextFromFeed()  : int
Create text from feed article.
deleteArticles()  : int
Delete articles for feeds.
deleteFeed()  : void
Delete a feed.
deleteFeeds()  : array{feeds: int, articles: int}
Delete feeds.
detectAndParseFeed()  : array<string|int, mixed>|false
Detect and parse feed.
edit()  : void
Edit feeds page.
editFeed()  : void
Edit feed form.
extractTextFromArticle()  : array<string|int, mixed>|string|null
Extract text from article.
formatLastUpdate()  : string
Format last update time.
getFacade()  : FeedFacade
Get the FeedFacade instance.
getFeed()  : array<string|int, mixed>|null
Get a single feed by ID.
getFeedLinks()  : array<string|int, mixed>
Get feed articles with pagination.
getFeedLoadConfig()  : array<string|int, mixed>
Get feed load configuration.
getFeeds()  : array<string|int, mixed>
Get all feeds with optional language filter.
getFeedsNeedingAutoUpdate()  : array<string|int, mixed>
Get feeds needing auto-update.
getMarkedFeedLinks()  : array<string|int, mixed>
Get marked feed links for processing.
getNfOption()  : string|array<string|int, mixed>|null
Get feed option.
getSortColumn()  : string
Get sort column.
getSortOptions()  : array<string|int, mixed>
Get sort options.
index()  : void
Feeds index page.
loadFeed()  : array<string|int, mixed>
Load/refresh a feed.
loadFeedRoute()  : void
Load/refresh a single feed.
markLinkAsError()  : void
Mark article link as error.
multiLoad()  : void
Multi-load feeds interface.
newFeed()  : void
New feed form.
parseAutoUpdateInterval()  : int|null
Parse auto-update interval.
parseRssFeed()  : array<string|int, mixed>|false
Parse RSS feed.
render()  : void
Render a view.
renderFeedLoadInterface()  : void
Render feed load interface.
resetUnloadableArticles()  : int
Reset error articles.
setViewPath()  : void
Set custom view path.
spa()  : void
Feeds SPA page - modern Alpine.js single page application.
updateFeed()  : void
Update a feed.
validateRegexPattern()  : bool
Validate regex pattern.
createTextsFromFeed()  : array{archived: int, sentences: int, textitems: int}
Create texts from feed data without edit form.
displayFeedMessages()  : void
Display errors and messages for feed operations.
displayMessage()  : void
Display a message.
displaySessionMessages()  : void
Display session messages for feed loading.
formatMarkActionMessage()  : string
Format mark action result into a display message.
handleMarkAction()  : array{action: string, success: bool}|null
Handle delete/reset actions on feeds.
handleSaveFeed()  : void
Handle save new feed form submission.
handleUpdateFeed()  : void
Handle update feed form submission.
processMarkedItems()  : array{editText: int, message: string}
Process marked feed items and create texts from them.
renderFeedsIndex()  : void
Render the main feeds index page.
showEditForm()  : void
Show the edit feed form.
showList()  : void
Show the main feeds management list.
showMultiLoadForm()  : void
Show the multi-load feed form.
showNewForm()  : void
Show the new feed form.

Properties

Methods

archiveOldTexts()

Archive old texts.

public archiveOldTexts(string $tagName, int $maxTexts) : array<string|int, mixed>
Parameters
$tagName : string

Tag name

$maxTexts : int

Max texts to keep

Return values
array<string|int, mixed>

Archive stats

buildQueryFilter()

Build query filter.

public buildQueryFilter(string $query, string $queryMode, string $regexMode) : array{clause: string, search: string, mode: string, regex: string}
Parameters
$query : string

Search query

$queryMode : string

Query mode

$regexMode : string

Regex mode

Return values
array{clause: string, search: string, mode: string, regex: string}

Filter data

Count feed articles.

public countFeedLinks(string $feedIds[, string $search = '' ]) : int
Parameters
$feedIds : string

Comma-separated feed IDs

$search : string = ''

Search term (optional)

Return values
int

Article count

countFeeds()

Count feeds.

public countFeeds([int|null $langId = null ][, string|null $queryPattern = null ]) : int
Parameters
$langId : int|null = null

Language ID

$queryPattern : string|null = null

Query pattern

Return values
int

Feed count

createFeed()

Create a new feed.

public createFeed(array<string|int, mixed> $data) : int
Parameters
$data : array<string|int, mixed>

Feed data

Return values
int

New feed ID

createTextFromFeed()

Create text from feed article.

public createTextFromFeed(array<string|int, mixed> $textData, string $tagName) : int
Parameters
$textData : array<string|int, mixed>

Text data

$tagName : string

Tag name

Return values
int

New text ID

deleteArticles()

Delete articles for feeds.

public deleteArticles(string $feedIds) : int
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
int

Number deleted

deleteFeed()

Delete a feed.

public deleteFeed(int $id) : void

Route: DELETE /feeds/{id}

Parameters
$id : int

Feed ID from route parameter

deleteFeeds()

Delete feeds.

public deleteFeeds(string $feedIds) : array{feeds: int, articles: int}
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
array{feeds: int, articles: int}

detectAndParseFeed()

Detect and parse feed.

public detectAndParseFeed(string $sourceUri) : array<string|int, mixed>|false
Parameters
$sourceUri : string

Feed URL

Return values
array<string|int, mixed>|false

Feed data or false

edit()

Edit feeds page.

public edit(array<string, string> $params) : void

Routes based on request parameters:

  • new_feed=1: Show new feed form
  • edit_feed=1: Show edit form for feed
  • multi_load_feed=1: Show multi-load interface
  • load_feed=1 / check_autoupdate=1 / markaction=update: Load feeds
  • markaction=del/del_art/res_art: Handle bulk actions
  • save_feed=1: Create new feed
  • update_feed=1: Update existing feed
  • (default): Show feed management list
Parameters
$params : array<string, string>

Route parameters

editFeed()

Edit feed form.

public editFeed(int $id) : void

Route: GET/POST /feeds/{id}/edit

Parameters
$id : int

Feed ID from route parameter

extractTextFromArticle()

Extract text from article.

public extractTextFromArticle(array<string|int, mixed> $feedData, string $articleSection, string $filterTags[, string|null $charset = null ]) : array<string|int, mixed>|string|null
Parameters
$feedData : array<string|int, mixed>

Feed items

$articleSection : string

XPath selectors

$filterTags : string

Filter selectors

$charset : string|null = null

Override charset

Return values
array<string|int, mixed>|string|null

Extracted data

formatLastUpdate()

Format last update time.

public formatLastUpdate(int $diff) : string
Parameters
$diff : int

Time difference in seconds

Return values
string

Formatted string

getFeed()

Get a single feed by ID.

public getFeed(int $feedId) : array<string|int, mixed>|null
Parameters
$feedId : int

Feed ID

Return values
array<string|int, mixed>|null

Feed data or null

Get feed articles with pagination.

public getFeedLinks(string $feedIds[, string $search = '' ][, string $orderBy = 'FlDate DESC' ][, int $offset = 0 ][, int $limit = 50 ]) : array<string|int, mixed>
Parameters
$feedIds : string

Comma-separated feed IDs

$search : string = ''

Search term (optional)

$orderBy : string = 'FlDate DESC'

ORDER BY clause

$offset : int = 0

Pagination offset

$limit : int = 50

Page size

Return values
array<string|int, mixed>

Array of articles

getFeedLoadConfig()

Get feed load configuration.

public getFeedLoadConfig(int $currentFeed, bool $checkAutoupdate) : array<string|int, mixed>
Parameters
$currentFeed : int

Feed ID

$checkAutoupdate : bool

Check auto-update

Return values
array<string|int, mixed>

Configuration

getFeeds()

Get all feeds with optional language filter.

public getFeeds([int|null $languageId = null ]) : array<string|int, mixed>
Parameters
$languageId : int|null = null

Language ID filter

Return values
array<string|int, mixed>

Array of feed data

getFeedsNeedingAutoUpdate()

Get feeds needing auto-update.

public getFeedsNeedingAutoUpdate() : array<string|int, mixed>
Return values
array<string|int, mixed>

Feeds array

Get marked feed links for processing.

public getMarkedFeedLinks(array<string|int, mixed>|string $markedItems) : array<string|int, mixed>
Parameters
$markedItems : array<string|int, mixed>|string

Marked item IDs

Return values
array<string|int, mixed>

Array of feed links with feed data

getNfOption()

Get feed option.

public getNfOption(string $optionsStr, string $option) : string|array<string|int, mixed>|null
Parameters
$optionsStr : string

Options string

$option : string

Option name

Return values
string|array<string|int, mixed>|null

Option value

getSortColumn()

Get sort column.

public getSortColumn(int $sortIndex[, string $prefix = 'Fl' ]) : string
Parameters
$sortIndex : int

Sort index

$prefix : string = 'Fl'

Column prefix

Return values
string

Sort column

getSortOptions()

Get sort options.

public getSortOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Sort options

index()

Feeds index page.

public index(array<string, string> $params) : void
Parameters
$params : array<string, string>

Route parameters

loadFeed()

Load/refresh a feed.

public loadFeed(int $feedId) : array<string|int, mixed>
Parameters
$feedId : int

Feed ID

Return values
array<string|int, mixed>

Load result

loadFeedRoute()

Load/refresh a single feed.

public loadFeedRoute(int $id) : void

Route: GET /feeds/{id}/load

Parameters
$id : int

Feed ID from route parameter

markLinkAsError()

Mark article link as error.

public markLinkAsError(string $link) : void
Parameters
$link : string

Article link

multiLoad()

Multi-load feeds interface.

public multiLoad(array<string, string> $params) : void

Route: GET /feeds/multi-load

Parameters
$params : array<string, string>

Route parameters

newFeed()

New feed form.

public newFeed(array<string, string> $params) : void

Route: GET/POST /feeds/new

Parameters
$params : array<string, string>

Route parameters

parseAutoUpdateInterval()

Parse auto-update interval.

public parseAutoUpdateInterval(string $autoupdate) : int|null
Parameters
$autoupdate : string

Interval string

Return values
int|null

Seconds or null

parseRssFeed()

Parse RSS feed.

public parseRssFeed(string $sourceUri, string $articleSection) : array<string|int, mixed>|false
Parameters
$sourceUri : string

Feed URL

$articleSection : string

Article section tag

Return values
array<string|int, mixed>|false

Parsed items or false

render()

Render a view.

public render(string $view[, array<string|int, mixed> $data = [] ]) : void
Parameters
$view : string

View name (without .php)

$data : array<string|int, mixed> = []

View data

renderFeedLoadInterface()

Render feed load interface.

public renderFeedLoadInterface(int $currentFeed, bool $checkAutoupdate, string $redirectUrl) : void
Parameters
$currentFeed : int

Feed ID

$checkAutoupdate : bool

Check auto-update

$redirectUrl : string

Redirect URL

resetUnloadableArticles()

Reset error articles.

public resetUnloadableArticles(string $feedIds) : int
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
int

Number reset

setViewPath()

Set custom view path.

public setViewPath(string $path) : void
Parameters
$path : string

View path

spa()

Feeds SPA page - modern Alpine.js single page application.

public spa(array<string, string> $params) : void

This method provides a reactive feed management interface with:

  • Feed list with filtering, sorting, and pagination
  • Article browsing with import functionality
  • Create/edit feed forms
  • Bulk actions
Parameters
$params : array<string, string>

Route parameters

Tags
psalm-suppress

UnresolvableInclude View path is constructed at runtime

updateFeed()

Update a feed.

public updateFeed(int $feedId, array<string|int, mixed> $data) : void
Parameters
$feedId : int

Feed ID

$data : array<string|int, mixed>

Feed data

validateRegexPattern()

Validate regex pattern.

public validateRegexPattern(string $pattern) : bool
Parameters
$pattern : string

Pattern

Return values
bool

True if valid

createTextsFromFeed()

Create texts from feed data without edit form.

private createTextsFromFeed(array<int|string, array<string, mixed>> $texts, array<string, mixed> $row, string $tagName, int $maxTexts) : array{archived: int, sentences: int, textitems: int}
Parameters
$texts : array<int|string, array<string, mixed>>

Parsed text data

$row : array<string, mixed>

Feed data

$tagName : string

Tag name

$maxTexts : int

Maximum texts to keep

Return values
array{archived: int, sentences: int, textitems: int}

displayFeedMessages()

Display errors and messages for feed operations.

private displayFeedMessages(string $message) : void
Parameters
$message : string

Message to display

displayMessage()

Display a message.

private displayMessage(string $message) : void
Parameters
$message : string

Message to display

displaySessionMessages()

Display session messages for feed loading.

private displaySessionMessages() : void

formatMarkActionMessage()

Format mark action result into a display message.

private formatMarkActionMessage(array{action: string, success: bool}|null $result) : string
Parameters
$result : array{action: string, success: bool}|null

Action result

Return values
string

Formatted message for display

handleMarkAction()

Handle delete/reset actions on feeds.

private handleMarkAction(string $currentFeed) : array{action: string, success: bool}|null
Parameters
$currentFeed : string

Current selected feed(s)

Return values
array{action: string, success: bool}|null

Result data or null if no action

handleSaveFeed()

Handle save new feed form submission.

private handleSaveFeed() : void

handleUpdateFeed()

Handle update feed form submission.

private handleUpdateFeed() : void

processMarkedItems()

Process marked feed items and create texts from them.

private processMarkedItems() : array{editText: int, message: string}
Return values
array{editText: int, message: string}

renderFeedsIndex()

Render the main feeds index page.

private renderFeedsIndex(int $currentLang, int $currentFeed) : void
Parameters
$currentLang : int

Current language filter

$currentFeed : int

Current feed filter

showEditForm()

Show the edit feed form.

private showEditForm(int $feedId) : void
Parameters
$feedId : int

Feed ID to edit

showList()

Show the main feeds management list.

private showList(int $currentLang, string $currentQuery, int $currentPage, int $currentSort, string|null $queryPattern) : void
Parameters
$currentLang : int

Current language filter

$currentQuery : string

Current search query

$currentPage : int

Current page number

$currentSort : int

Current sort index

$queryPattern : string|null

LIKE pattern for name filter (null if no filter)

showMultiLoadForm()

Show the multi-load feed form.

private showMultiLoadForm(int $currentLang) : void
Parameters
$currentLang : int

Current language filter

showNewForm()

Show the new feed form.

private showNewForm(int $currentLang) : void
Parameters
$currentLang : int

Current language ID to pre-select

Tags
psalm-suppress

UnresolvableInclude View path is constructed at runtime


        
On this page

Search results