XmlHttp
in package
implements
ActionInterface
Uses
BackwardCompatibility
Handles XML-based interaction (mainly XMLhttp)
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
- The main handler and designator for AJAX stuff - jumpto, message icons and previews
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- GetJumpTo() : void
- Backward compatibility wrapper for the jumpto sub-action.
- jumpTo() : mixed
- Get a list of boards and categories used for the jumpto dropdown.
- ListMessageIcons() : void
- Backward compatibility wrapper for the messageicons sub-action.
- load() : object
- Static wrapper for constructor.
- messageIcons() : mixed
- Gets a list of available message icons and sends the info to the template for display
- newsletterpreview() : mixed
- Handles previewing newsletters
- newspreview() : mixed
- Handles previewing news items
- previews() : void|bool
- Handles retrieving previews of news items, newsletters, signatures and warnings.
- RetrievePreview() : void
- Backward compatibility wrapper for the previews sub-action.
- sig_preview() : mixed
- Handles previewing signatures
- warning_preview() : mixed
- Handles previewing user warnings
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
Properties
$subaction
public
string
$subaction
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['jumpto' => 'jumpTo', 'messageicons' => 'messageIcons', 'previews' => 'previews']
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' => 'XMLhttpMain', 'GetJumpTo' => 'GetJumpTo', 'ListMessageIcons' => 'ListMessageIcons', 'RetrievePreview' => 'RetrievePreview']]
BackwardCompatibility settings for this class.
Methods
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
execute()
The main handler and designator for AJAX stuff - jumpto, message icons and previews
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.
GetJumpTo()
Backward compatibility wrapper for the jumpto sub-action.
public
static GetJumpTo() : void
jumpTo()
Get a list of boards and categories used for the jumpto dropdown.
public
jumpTo() : mixed
ListMessageIcons()
Backward compatibility wrapper for the messageicons sub-action.
public
static ListMessageIcons() : void
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
messageIcons()
Gets a list of available message icons and sends the info to the template for display
public
messageIcons() : mixed
newsletterpreview()
Handles previewing newsletters
public
newsletterpreview() : mixed
newspreview()
Handles previewing news items
public
newspreview() : mixed
previews()
Handles retrieving previews of news items, newsletters, signatures and warnings.
public
previews() : void|bool
Calls the appropriate function based on $_POST['item']
Return values
void|bool —Returns false if $_POST['item'] isn't set or isn't valid
RetrievePreview()
Backward compatibility wrapper for the previews sub-action.
public
static RetrievePreview() : void
sig_preview()
Handles previewing signatures
public
sig_preview() : mixed
warning_preview()
Handles previewing user warnings
public
warning_preview() : mixed
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed