Recent
in package
implements
ActionInterface, Routable
uses
ActionSuffixRouter, ActionTrait
Finds and retrieves information about recently posted messages.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
- Routable
- Classes implementing this interface can build routes from URL query parameters and parse routes back into URL query parameters.
Constants
Properties
- $action_url : string
- $cat_name : string
- $messages : array<string|int, mixed>
- $obj : static
- $permission_boards : array<string|int, mixed>
- $query_parameters : array<string|int, mixed>
- $query_this_board : string
- $total_posts : int
Methods
- buildRoute() : array<string|int, mixed>
- Builds a routing path based on URL query parameters.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- canBeLogged() : bool
- Determines whether this action can be logged in the online log.
- canShowDebuggingInfo() : bool
- Determines whether debugging info should be shown.
- canShowInMaintenanceMode() : bool
- Determines whether this action allows access in maintenance mode.
- execute() : void
- Find the ten most recent posts.
- getLastPost() : array<string|int, mixed>
- Get the latest post made on the forum.
- getOutputType() : OutputTypeInterface
- Gets the output type for this action.
- isAgreementAction() : bool
- Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
- isRestrictedGuestAccessAllowed() : bool
- Determines whether this action allows access if guest access is restricted.
- isSimpleAction() : bool
- Determines whether this is a simple action.
- load() : static
- Static wrapper for constructor.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- buildQuickButtons() : void
- Last but not least, the quickbuttons.
- doPermissions() : void
- Figure our what the current user can do with each message.
- getBoards() : void
- Figures out what boards we want to get messages from.
- getCatName() : void
- Gets the category name, if applicable.
- getMessages() : void
- Populates Utils::$context['posts'] with formatted messages.
- getMsgIds() : void
- Populates $this->messages with the IDs of some recent messages.
- setPaginationAndLinks() : void
- Constructs page index, sets the linktree, next/prev/up links, etc.
Constants
PAGES
public
mixed
PAGES
= 10
PER_PAGE
public
mixed
PER_PAGE
= 10
Properties
$action_url
protected
string
$action_url
Base URL for this action.
$cat_name
protected
string
$cat_name
Name of the category we are in, if applicable.
$messages
protected
array<string|int, mixed>
$messages
= []
IDs of some recent messages.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
$permission_boards
protected
array<string|int, mixed>
$permission_boards
= ['own' => [], 'any' => []]
Boards that we need to check for some own/any permissions.
$query_parameters
protected
array<string|int, mixed>
$query_parameters
= []
Parameters for the main query.
$query_this_board
protected
string
$query_this_board
SQL statement indicating the boards to look in.
$total_posts
protected
int
$total_posts
= 0
How many recent messages we found.
Methods
buildRoute()
Builds a routing path based on URL query parameters.
public
static buildRoute(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
URL query parameters.
Return values
array<string|int, mixed> —Contains two elements: ['route' => [], 'params' => []]. The 'route' element contains the routing path. The 'params' element contains any $params that weren't incorporated into the route.
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
canBeLogged()
Determines whether this action can be logged in the online log.
public
canBeLogged() : bool
Return values
boolcanShowDebuggingInfo()
Determines whether debugging info should be shown.
public
canShowDebuggingInfo() : bool
Return values
boolcanShowInMaintenanceMode()
Determines whether this action allows access in maintenance mode.
public
canShowInMaintenanceMode() : bool
Return values
bool —True if access is allowed, false otherwise.
execute()
Find the ten most recent posts.
public
execute() : void
getLastPost()
Get the latest post made on the forum.
public
static getLastPost() : array<string|int, mixed>
Respects approved, recycled, and board permissions. Not used by SMF itself, but kept around in case mods need it.
Return values
array<string|int, mixed> —An array of information about the last post that you can see
getOutputType()
Gets the output type for this action.
public
getOutputType() : OutputTypeInterface
Return values
OutputTypeInterfaceisAgreementAction()
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
public
isAgreementAction() : bool
Return values
boolisRestrictedGuestAccessAllowed()
Determines whether this action allows access if guest access is restricted.
public
isRestrictedGuestAccessAllowed() : bool
Return values
bool —True if access is allowed, false otherwise.
isSimpleAction()
Determines whether this is a simple action.
public
isSimpleAction() : bool
Return values
boolload()
Static wrapper for constructor.
public
static load() : static
Return values
static —An instance of this class.
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
buildQuickButtons()
Last but not least, the quickbuttons.
protected
buildQuickButtons() : void
doPermissions()
Figure our what the current user can do with each message.
protected
doPermissions() : void
getBoards()
Figures out what boards we want to get messages from.
protected
getBoards() : void
Sets $this->query_this_board and $this->query_parameters.
Tags
getCatName()
Gets the category name, if applicable.
protected
getCatName() : void
getMessages()
Populates Utils::$context['posts'] with formatted messages.
protected
getMessages() : void
getMsgIds()
Populates $this->messages with the IDs of some recent messages.
protected
getMsgIds() : void
setPaginationAndLinks()
Constructs page index, sets the linktree, next/prev/up links, etc.
protected
setPaginationAndLinks() : void