PHP Class HM\BackUpWordPress\Notices

Notices are messages along with an associated context, by default they are stored in the db and thus persist between page loads.
Datei anzeigen Open project: humanmade/backupwordpress Class Usage Examples

Public Methods

Method Description
clear_all_notices ( ) Clear all notices including persistent ones
get_instance ( ) : Notices Returns the *Singleton* instance of this class.
get_notices ( string $context = '' ) : array Fetch an array of notices messages
set_notices ( string $context, array $messages, boolean $persistent = true ) Set an array of notice messages for a specific context

Protected Methods

Method Description
__construct ( ) Protected constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.

Private Methods

Method Description
__clone ( ) Private clone method to prevent cloning of the instance of the *Singleton* instance.
__wakeup ( ) Private unserialize method to prevent unserializing of the *Singleton* instance.
get_all_notices ( ) : array Get both standard and persistent notices
get_persistent_notices ( ) : array Load the persistent notices from the database

Method Details

__construct() protected method

Protected constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.
protected __construct ( )

clear_all_notices() public method

Clear all notices including persistent ones
public clear_all_notices ( )

get_instance() public static method

Returns the *Singleton* instance of this class.
public static get_instance ( ) : Notices
return Notices The *Singleton* instance.

get_notices() public method

If you specify a context then you'll just get messages for that context otherwise you get multidimensional array of all contexts and their messages.
public get_notices ( string $context = '' ) : array
$context string The context that you'd like the messages for
return array The array of notice messages

set_notices() public method

Set an array of notice messages for a specific context
public set_notices ( string $context, array $messages, boolean $persistent = true )
$context string The context of the notice message
$messages array The array of messages
$persistent boolean Whether the notice should persist via the database. Defaults to true.