Mail
in package
implements
ActionInterface
Uses
BackwardCompatibility
Handles mail configuration, as well as reviewing the mail queue.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $obj : object
- $processedBirthdayEmails : array<string|int, mixed>
- $backcompat : array<string|int, mixed>
Methods
- browse() : void
- Display the mail queue.
- browseMailQueue() : void
- Backward compatibility wrapper for the browse sub-action.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- clear() : void
- This function clears the mail queue of all emails, and at the end redirects to browse.
- clearMailQueue() : void
- Backward compatibility wrapper for the clear 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.
- list_getMailQueue() : array<string|int, mixed>
- This function grabs the mail queue items from the database, according to the params given.
- list_getMailQueueSize() : int
- Returns the total count of items in the mail queue.
- load() : object
- Static wrapper for constructor.
- modifyMailSettings() : mixed
- Backward compatibility wrapper for the settings sub-action.
- settings() : void
- Allows to view and modify the mail settings.
- test() : void
- Test mail sending ability.
- testMailSend() : void
- Backward compatibility wrapper for the test sub-action.
- timeSince() : string
- Little utility function to calculate how long ago a time was.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- pauseMailQueueClear() : void
- Used for pausing the mail queue.
Properties
$subaction
public
string
$subaction
= 'browse'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['browse' => 'browse', 'clear' => 'clear', 'settings' => 'settings', 'test' => 'test']
Available sub-actions.
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$processedBirthdayEmails
protected
static array<string|int, mixed>
$processedBirthdayEmails
= []
Processed version of Lang::$txtBirthdayEmails. This is used internally by the settings() method.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['call' => 'ManageMail', 'list_getMailQueue' => 'list_getMailQueue', 'list_getMailQueueSize' => 'list_getMailQueueSize', 'timeSince' => 'timeSince', 'browseMailQueue' => 'BrowseMailQueue', 'clearMailQueue' => 'ClearMailQueue', 'modifyMailSettings' => 'ModifyMailSettings', 'testMailSend' => 'TestMailSend']]
BackwardCompatibility settings for this class.
Methods
browse()
Display the mail queue.
public
browse() : void
..
browseMailQueue()
Backward compatibility wrapper for the browse sub-action.
public
static browseMailQueue() : void
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
clear()
This function clears the mail queue of all emails, and at the end redirects to browse.
public
clear() : void
clearMailQueue()
Backward compatibility wrapper for the clear sub-action.
public
static clearMailQueue() : 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 news area.
list_getMailQueue()
This function grabs the mail queue items from the database, according to the params given.
public
static list_getMailQueue(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Callback for $listOptions['get_items'] in $this->browse()
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 with info about the mail queue items
list_getMailQueueSize()
Returns the total count of items in the mail queue.
public
static list_getMailQueueSize() : int
Callback for $listOptions['get_count'] in $this->browse
Return values
int —The total number of mail queue items
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
modifyMailSettings()
Backward compatibility wrapper for the settings sub-action.
public
static modifyMailSettings([mixed $return_config = false ]) : mixed
Parameters
- $return_config : mixed = false
settings()
Allows to view and modify the mail settings.
public
settings() : void
test()
Test mail sending ability.
public
test() : void
testMailSend()
Backward compatibility wrapper for the test sub-action.
public
static testMailSend() : void
timeSince()
Little utility function to calculate how long ago a time was.
public
static timeSince(int $time_diff) : string
Parameters
- $time_diff : int
-
The time difference, in seconds
Return values
string —A string indicating how many days, hours, minutes or seconds (depending on $time_diff)
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
pauseMailQueueClear()
Used for pausing the mail queue.
protected
pauseMailQueueClear() : void