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.
Afficher le fichier Open project: humanmade/backupwordpress Class Usage Examples

Méthodes publiques

Méthode 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

Méthodes protégées

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

Private Methods

Méthode 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 méthode

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 méthode

Clear all notices including persistent ones
public clear_all_notices ( )

get_instance() public static méthode

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

get_notices() public méthode

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
Résultat array The array of notice messages

set_notices() public méthode

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.