Documentation

Posts
in package
implements ActionInterface Uses BackwardCompatibility

This class contains all the administration settings for topics and posts.

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.
censor()  : void
Shows an interface to set and test censored words.
draftConfigVars()  : array<string|int, mixed>
Gets configuration variables for the drafts sub-action.
drafts()  : mixed
Modify any setting related to drafts.
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.
load()  : object
Static wrapper for constructor.
modifyDraftSettings()  : void|array<string|int, mixed>
Backward compatibility wrapper for the drafts sub-action.
modifyPostSettings()  : void|array<string|int, mixed>
Backward compatibility wrapper for the posts sub-action.
modifyTopicSettings()  : void|array<string|int, mixed>
Backward compatibility wrapper for the topics sub-action.
postConfigVars()  : array<string|int, mixed>
Gets configuration variables for the posts sub-action.
posts()  : mixed
Modify any setting related to posts and posting.
topicConfigVars()  : array<string|int, mixed>
Gets configuration variables for the topics sub-action.
topics()  : mixed
Modify any setting related to topics.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().

Properties

$subaction

public string $subaction = 'posts'

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

$subactions

public static array<string|int, mixed> $subactions = ['posts' => 'posts', 'censor' => 'censor', 'topics' => 'topics', 'drafts' => 'drafts']

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' => 'ManagePostSettings', 'modifyPostSettings' => 'ModifyPostSettings', 'modifyTopicSettings' => 'ModifyTopicSettings', 'modifyDraftSettings' => 'ModifyDraftSettings']]

BackwardCompatibility settings for this class.

Methods

call()

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

public static call() : void

censor()

Shows an interface to set and test censored words.

public censor() : void

It uses the censor_vulgar, censor_proper, censorWholeWord, and censorIgnoreCase settings. Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=censor.

Tags
uses
template_edit_censored()

draftConfigVars()

Gets configuration variables for the drafts sub-action.

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

$config_vars for the sub-action.

drafts()

Modify any setting related to drafts.

public drafts([mixed $return_config = false ]) : mixed

Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=drafts

Parameters
$return_config : mixed = false

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.

load()

Static wrapper for constructor.

public static load() : object
Return values
object

An instance of this class.

modifyDraftSettings()

Backward compatibility wrapper for the drafts sub-action.

public static modifyDraftSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
$return_config : bool = false

Whether to return the config_vars array.

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

Returns nothing or returns the config_vars array.

modifyPostSettings()

Backward compatibility wrapper for the posts sub-action.

public static modifyPostSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
$return_config : bool = false

Whether to return the config_vars array.

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

Returns nothing or returns the config_vars array.

modifyTopicSettings()

Backward compatibility wrapper for the topics sub-action.

public static modifyTopicSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
$return_config : bool = false

Whether to return the config_vars array.

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

Returns nothing or returns the config_vars array.

postConfigVars()

Gets configuration variables for the posts sub-action.

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

$config_vars for the sub-action.

posts()

Modify any setting related to posts and posting.

public posts([mixed $return_config = false ]) : mixed

Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=posts.

Parameters
$return_config : mixed = false

topicConfigVars()

Gets configuration variables for the topics sub-action.

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

$config_vars for the sub-action.

topics()

Modify any setting related to topics.

public topics([mixed $return_config = false ]) : mixed

Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=topics.

Parameters
$return_config : mixed = false

__construct()

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

protected __construct() : mixed

        
On this page

Search results