Documentation

Warnings
in package
implements ActionInterface Uses BackwardCompatibility

Allows the moderator to view stuff related to warnings.

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

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_getWarningCount()  : int
Callback for SMF\ItemList().
list_getWarnings()  : array<string|int, mixed>
Callback for SMF\ItemList().
list_getWarningTemplateCount()  : int
Callback for SMF\ItemList().
list_getWarningTemplates()  : array<string|int, mixed>
Callback for SMF\ItemList().
load()  : object
Static wrapper for constructor.
log()  : void
Simply put, look at the warning log!
ModifyWarningTemplate()  : void
Backward compatibility wrapper for the templateedit sub-action.
templateEdit()  : void
Edit a warning template.
templates()  : void
Load all the warning templates.
ViewWarningLog()  : void
Backward compatibility wrapper for the log sub-action.
ViewWarningTemplates()  : void
Backward compatibility wrapper for the templates sub-action.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().

Properties

$subaction

public string $subaction = 'log'

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

$subactions

public static array<string|int, mixed> $subactions = ['log' => ['log', ['view_warning_any', 'moderate_forum']], 'templates' => ['templates', 'issue_warning'], 'templateedit' => ['templateEdit', 'issue_warning']]

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' => ['call' => 'ViewWarnings', 'list_getWarningCount' => 'list_getWarningCount', 'list_getWarnings' => 'list_getWarnings', 'list_getWarningTemplateCount' => 'list_getWarningTemplateCount', 'list_getWarningTemplates' => 'list_getWarningTemplates', 'ViewWarningLog' => 'ViewWarningLog', 'ViewWarningTemplates' => 'ViewWarningTemplates', 'ModifyWarningTemplate' => 'ModifyWarningTemplate']]

BackwardCompatibility settings for this class.

Methods

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_getWarningCount()

Callback for SMF\ItemList().

public static list_getWarningCount() : int
Return values
int

The total number of warnings that have been issued

list_getWarnings()

Callback for SMF\ItemList().

public static list_getWarnings(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

The number of items to show per page

$sort : string

A string indicating how to sort the results

Return values
array<string|int, mixed>

An array of data about warning log entries

list_getWarningTemplateCount()

Callback for SMF\ItemList().

public static list_getWarningTemplateCount() : int
Return values
int

The total number of warning templates

list_getWarningTemplates()

Callback for SMF\ItemList().

public static list_getWarningTemplates(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

The number of items to show per page

$sort : string

A string indicating how to sort the results

Return values
array<string|int, mixed>

An arrray of info about the available warning templates

load()

Static wrapper for constructor.

public static load() : object
Return values
object

An instance of this class.

log()

Simply put, look at the warning log!

public log() : void

ModifyWarningTemplate()

Backward compatibility wrapper for the templateedit sub-action.

public static ModifyWarningTemplate() : void

templateEdit()

Edit a warning template.

public templateEdit() : void

templates()

Load all the warning templates.

public templates() : void

ViewWarningLog()

Backward compatibility wrapper for the log sub-action.

public static ViewWarningLog() : void

ViewWarningTemplates()

Backward compatibility wrapper for the templates sub-action.

public static ViewWarningTemplates() : void

__construct()

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

protected __construct() : mixed

        
On this page

Search results