add_message( 'error', $msg ); } /** * Add notice * * @param String $type Notice type (error,update,update-nag) * @param String $msg Notification message */ protected function add_message( $type, $msg ) { if( ! isset( $_SESSION['adk_notices'] ) ) { $_SESSION['adk_notices'] = array(); } $_SESSION['adk_notices'][] = sprintf( '

%s

', $type, htmlentities( $msg ) ); } /** * Show print out admin notices */ public function show() { if( empty( $_SESSION['adk_notices'] ) ) { return; } foreach( $_SESSION['adk_notices'] as $mes ) { echo $mes; } unset( $_SESSION['adk_notices'] ); } } endif; ?>