Features
in package
implements
ActionInterface
Uses
BackwardCompatibility
Class to manage various core features.
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
- alerts() : mixed
- Handles modifying the alerts settings.
- basic() : void
- Config array for changing the basic forum settings
- basicConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the basic sub-action.
- bbc() : void
- Set a few Bulletin Board Code settings.
- bbcConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the bbc sub-action.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- editCustomProfiles() : void
- Backward compatibility wrapper for the profileedit sub-action.
- 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.
- layout() : void
- Allows modifying the global layout settings in the forum.
- layoutConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the layout sub-action.
- likes() : void
- Handles modifying the likes settings.
- likesConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the likes sub-action.
- list_getProfileFields() : array<string|int, mixed>
- Callback for SMF\ItemList().
- list_getProfileFieldSize() : int
- Callback for SMF\ItemList().
- load() : object
- Static wrapper for constructor.
- mentions() : void
- Handles modifying the mentions settings.
- mentionsConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the mentions sub-action.
- modifyAlertsSettings() : void
- Backward compatibility wrapper for the alerts sub-action.
- modifyBasicSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the basic sub-action.
- modifyBBCSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the bbc sub-action.
- modifyLayoutSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the layout sub-action.
- modifyLikesSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the likes sub-action.
- modifyMentionsSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the mentions sub-action.
- modifySignatureSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the sig sub-action.
- profile() : void
- Show all the custom profile fields available to the user.
- profileEdit() : mixed
- Edit some profile fields?
- showCustomProfiles() : void
- Backward compatibility wrapper for the profile sub-action.
- sigConfigVars() : array<string|int, mixed>
- Gets the configuration variables for the sig sub-action.
- signature() : void
- Handles signature settings.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- custFieldsMaxOrder() : int
- Returns the maximum field_order value for the custom fields
- pauseSignatureApplySettings() : void
- Just pause the signature applying thing.
Properties
$subaction
public
string
$subaction
= 'basic'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['basic' => 'basic', 'bbc' => 'bbc', 'layout' => 'layout', 'sig' => 'signature', 'profile' => 'profile', 'profileedit' => 'profileEdit', 'likes' => 'likes', 'mentions' => 'mentions', 'alerts' => 'alerts']
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' => 'ModifyFeatureSettings', 'list_getProfileFields' => 'list_getProfileFields', 'list_getProfileFieldSize' => 'list_getProfileFieldSize', 'modifyBasicSettings' => 'ModifyBasicSettings', 'modifyBBCSettings' => 'ModifyBBCSettings', 'modifyLayoutSettings' => 'ModifyLayoutSettings', 'modifySignatureSettings' => 'ModifySignatureSettings', 'showCustomProfiles' => 'ShowCustomProfiles', 'editCustomProfiles' => 'EditCustomProfiles', 'modifyLikesSettings' => 'ModifyLikesSettings', 'modifyMentionsSettings' => 'ModifyMentionsSettings', 'modifyAlertsSettings' => 'ModifyAlertsSettings']]
BackwardCompatibility settings for this class.
Methods
alerts()
Handles modifying the alerts settings.
public
alerts() : mixed
basic()
Config array for changing the basic forum settings
public
basic() : void
Accessed via ?action=admin;area=featuresettings;sa=basic
basicConfigVars()
Gets the configuration variables for the basic sub-action.
public
static basicConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the basic sub-action.
bbc()
Set a few Bulletin Board Code settings.
public
bbc() : void
It loads a list of Bulletin Board Code tags to allow disabling tags.
Requires the admin_forum permission. Accessed via ?action=admin;area=featuresettings;sa=bbc.
Tags
bbcConfigVars()
Gets the configuration variables for the bbc sub-action.
public
static bbcConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the bbc sub-action.
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
editCustomProfiles()
Backward compatibility wrapper for the profileedit sub-action.
public
static editCustomProfiles() : 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:
- Use this trait in the class.
- 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.
layout()
Allows modifying the global layout settings in the forum.
public
layout() : void
Accessed via ?action=admin;area=featuresettings;sa=layout
layoutConfigVars()
Gets the configuration variables for the layout sub-action.
public
static layoutConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the layout sub-action.
likes()
Handles modifying the likes settings.
public
likes() : void
Accessed from ?action=admin;area=featuresettings;sa=likes
likesConfigVars()
Gets the configuration variables for the likes sub-action.
public
static likesConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the likes sub-action.
list_getProfileFields()
Callback for SMF\ItemList().
public
static list_getProfileFields(int $start, int $items_per_page, string $sort, bool $standardFields) : array<string|int, mixed>
Parameters
- $start : int
-
The item to start with (used for pagination purposes)
- $items_per_page : int
-
The number of items to display per page
- $sort : string
-
A string indicating how to sort the results
- $standardFields : bool
-
Whether or not to include standard fields as well
Return values
array<string|int, mixed> —An array of info about the various profile fields
list_getProfileFieldSize()
Callback for SMF\ItemList().
public
static list_getProfileFieldSize() : int
Return values
int —The total number of custom profile fields
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
mentions()
Handles modifying the mentions settings.
public
mentions() : void
Accessed via ?action=admin;area=featuresettings;sa=mentions
mentionsConfigVars()
Gets the configuration variables for the mentions sub-action.
public
static mentionsConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the mentions sub-action.
modifyAlertsSettings()
Backward compatibility wrapper for the alerts sub-action.
public
static modifyAlertsSettings() : void
modifyBasicSettings()
Backward compatibility wrapper for the basic sub-action.
public
static modifyBasicSettings([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.
modifyBBCSettings()
Backward compatibility wrapper for the bbc sub-action.
public
static modifyBBCSettings([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.
modifyLayoutSettings()
Backward compatibility wrapper for the layout sub-action.
public
static modifyLayoutSettings([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.
modifyLikesSettings()
Backward compatibility wrapper for the likes sub-action.
public
static modifyLikesSettings([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.
modifyMentionsSettings()
Backward compatibility wrapper for the mentions sub-action.
public
static modifyMentionsSettings([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.
modifySignatureSettings()
Backward compatibility wrapper for the sig sub-action.
public
static modifySignatureSettings([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.
profile()
Show all the custom profile fields available to the user.
public
profile() : void
profileEdit()
Edit some profile fields?
public
profileEdit() : mixed
showCustomProfiles()
Backward compatibility wrapper for the profile sub-action.
public
static showCustomProfiles() : void
sigConfigVars()
Gets the configuration variables for the sig sub-action.
public
static sigConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the sig sub-action.
signature()
Handles signature settings.
public
signature() : void
Optionally allows the admin to impose those settings on existing members.
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
custFieldsMaxOrder()
Returns the maximum field_order value for the custom fields
protected
custFieldsMaxOrder() : int
Return values
int —The maximum value of field_order from the custom_fields table
pauseSignatureApplySettings()
Just pause the signature applying thing.
protected
pauseSignatureApplySettings() : void