Documentation

ShowPosts
in package
implements ActionInterface Uses BackwardCompatibility

Rename here and in the exportStatic call at the end of the file.

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.

Properties

$subaction  : string
$subactions  : array<string|int, mixed>
$obj  : object
$backcompat  : array<string|int, mixed>

Methods

attachments()  : void
Show all the attachments belonging to this member.
call()  : void
Convenience method to load() and execute() an instance of this class.
execute()  : void
Dispatcher to whichever sub-action method is necessary.
exportStatic()  : void
Provides a way to export a class's public static properties and methods to global namespace.
list_getAttachments()  : array<string|int, mixed>
Get a list of attachments for a member. Callback for the list in showAttachments()
list_getNumAttachments()  : int
Gets the total number of attachments for a member
list_getNumUnwatched()  : int
Count the number of topics in the unwatched list
list_getUnwatched()  : array<string|int, mixed>
Gets information about unwatched (disregarded) topics. Callback for the list in show_unwatched
load()  : object
Static wrapper for constructor.
messages()  : void
Show all the posts by this member.
showAttachments()  : void
Backward compatibility wrapper for the attach sub-action.
showPosts()  : void
Backward compatibility wrapper.
showUnwatched()  : void
Backward compatibility wrapper for the unwatchedtopics sub-action.
topics()  : void
Show all the topics started by this member.
unwatched()  : void
Show all the unwatched topics for this member.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
deletePost()  : void
Deletes a message and then redirects back to the list.
loadPosts()  : void
setPageTitle()  : void
Constructor. Protected to force instantiation via self::load().

Properties

$subaction

public string $subaction = 'messages'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['messages' => 'messages', 'topics' => 'topics', 'unwatchedtopics' => 'unwatched', 'attach' => 'attachments']

Available sub-actions.

$obj

protected static object $obj

An instance of this class. This is used by the load() method to prevent mulitple instantiations.

$backcompat

private static array<string|int, mixed> $backcompat = ['func_names' => ['list_getUnwatched' => 'list_getUnwatched', 'list_getNumUnwatched' => 'list_getNumUnwatched', 'list_getAttachments' => 'list_getAttachments', 'list_getNumAttachments' => 'list_getNumAttachments', 'showPosts' => 'showPosts', 'showUnwatched' => 'showUnwatched', 'showAttachments' => 'showAttachments']]

BackwardCompatibility settings for this class.

Methods

attachments()

Show all the attachments belonging to this member.

public attachments() : void

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

exportStatic()

Provides a way to export a class's public static properties and methods to global namespace.

public static exportStatic() : void

To do so:

  1. Use this trait in the class.
  2. At the END of the class's file, call its exportStatic() method.

Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.

Regarding the $backcompat items:

A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].

$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.

$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.

Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.

list_getAttachments()

Get a list of attachments for a member. Callback for the list in showAttachments()

public static list_getAttachments(int $start, int $items_per_page, string $sort, array<string|int, mixed> $boards_allowed) : array<string|int, mixed>
Parameters
$start : int

Which item to start with (for pagination purposes)

$items_per_page : int

How many items to show on each page

$sort : string

A string indicating how to sort the results

$boards_allowed : array<string|int, mixed>

An array containing the IDs of the boards they can see

Return values
array<string|int, mixed>

An array of information about the attachments

list_getNumAttachments()

Gets the total number of attachments for a member

public static list_getNumAttachments(array<string|int, mixed> $boards_allowed) : int
Parameters
$boards_allowed : array<string|int, mixed>

An array of the IDs of the boards they can see

Return values
int

The number of attachments

list_getNumUnwatched()

Count the number of topics in the unwatched list

public static list_getNumUnwatched() : int
Return values
int

The number of unwatched topics

list_getUnwatched()

Gets information about unwatched (disregarded) topics. Callback for the list in show_unwatched

public static list_getUnwatched(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
$start : int

The item to start with (for pagination purposes)

$items_per_page : int

How many items to show on each page

$sort : string

A string indicating how to sort the results

Return values
array<string|int, mixed>

An array of information about the unwatched topics

load()

Static wrapper for constructor.

public static load() : object
Return values
object

An instance of this class.

messages()

Show all the posts by this member.

public messages() : void

showAttachments()

Backward compatibility wrapper for the attach sub-action.

public static showAttachments(int $memID) : void
Parameters
$memID : int

showPosts()

Backward compatibility wrapper.

public static showPosts(int $memID) : void
Parameters
$memID : int

showUnwatched()

Backward compatibility wrapper for the unwatchedtopics sub-action.

public static showUnwatched(int $memID) : void
Parameters
$memID : int

topics()

Show all the topics started by this member.

public topics() : void

unwatched()

Show all the unwatched topics for this member.

public unwatched() : void

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

deletePost()

Deletes a message and then redirects back to the list.

protected deletePost() : void

loadPosts()

protected loadPosts([mixed $is_topics = false ]) : void
Parameters
$is_topics : mixed = false

setPageTitle()

Constructor. Protected to force instantiation via self::load().

protected setPageTitle() : void

        
On this page

Search results