Registration
in package
implements
ActionInterface
Uses
BackwardCompatibility
This class helps the administrator setting registration settings and policy as well as allow the administrator to register new members themselves.
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
- adminRegister() : void
- Backward compatibility wrapper for the register sub-action.
- agreement() : void
- Allows the administrator to edit the registration agreement and to choose whether it should be shown or not.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- editAgreement() : void
- Backward compatibility wrapper for the agreement sub-action.
- editPrivacyPolicy() : void
- Backward compatibility wrapper for the policy 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.
- getConfigVars() : array<string|int, mixed>
- Gets the configuration variables for this admin area.
- load() : object
- Static wrapper for constructor.
- modifyRegistrationSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the settings sub-action.
- privacyPolicy() : void
- Allows the administrator to edit the privacy policy and to choose whether it should be shown or not.
- register() : void
- This method allows the admin to register a new member by hand.
- reservedNames() : void
- Set the names under which users are not allowed to register.
- setReserved() : void
- Backward compatibility wrapper for the reservednames sub-action.
- settings() : void
- This function handles registration settings and provides a few pretty stats too while it's at it.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
Properties
$subaction
public
string
$subaction
= 'register'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['register' => ['register', 'moderate_forum'], 'agreement' => ['agreement', 'admin_forum'], 'policy' => ['privacyPolicy', 'admin_forum'], 'reservednames' => ['reservedNames', 'admin_forum'], 'settings' => ['settings', 'admin_forum']]
Available sub-actions.
Format: 'sa' => array('method', 'required_permission')
$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' => 'RegCenter', 'adminRegister' => 'AdminRegister', 'editAgreement' => 'EditAgreement', 'editPrivacyPolicy' => 'EditPrivacyPolicy', 'setReserved' => 'SetReserved', 'modifyRegistrationSettings' => 'ModifyRegistrationSettings']]
BackwardCompatibility settings for this class.
Methods
adminRegister()
Backward compatibility wrapper for the register sub-action.
public
static adminRegister() : void
agreement()
Allows the administrator to edit the registration agreement and to choose whether it should be shown or not.
public
agreement() : void
It saves the agreement to the agreement.txt file. Accessed by ?action=admin;area=regcenter;sa=agreement. Requires the admin_forum permission.
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
editAgreement()
Backward compatibility wrapper for the agreement sub-action.
public
static editAgreement() : void
editPrivacyPolicy()
Backward compatibility wrapper for the policy sub-action.
public
static editPrivacyPolicy() : 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.
getConfigVars()
Gets the configuration variables for this admin area.
public
static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the registration area.
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
modifyRegistrationSettings()
Backward compatibility wrapper for the settings sub-action.
public
static modifyRegistrationSettings([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.
privacyPolicy()
Allows the administrator to edit the privacy policy and to choose whether it should be shown or not.
public
privacyPolicy() : void
It saves the privacy policy to the database. Accessed by ?action=admin;area=regcenter;sa=policy. Requires the admin_forum permission.
register()
This method allows the admin to register a new member by hand.
public
register() : void
It also allows assigning a primary group to the member being registered. Accessed by ?action=admin;area=regcenter;sa=register Requires the moderate_forum permission.
reservedNames()
Set the names under which users are not allowed to register.
public
reservedNames() : void
Accessed by ?action=admin;area=regcenter;sa=reservednames. Requires the admin_forum permission.
setReserved()
Backward compatibility wrapper for the reservednames sub-action.
public
static setReserved() : void
settings()
This function handles registration settings and provides a few pretty stats too while it's at it.
public
settings() : void
General registration settings and Coppa compliance settings. Accessed by ?action=admin;area=regcenter;sa=settings. Requires the admin_forum permission.
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed