[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/_core/model/ -> _log.class.php (sommaire)

This file implements the Log class, which logs notes and errors. It additionally provides the class Log_noop that implements the same (used) methods, but as no-operation functions. This is useful to create a more resource friendly object when you don't need it (think Debuglog).

Author: blueyed: Daniel HAHLER
Author: fplanque: Francois PLANQUE
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
Version: $Id: _log.class.php,v 1.2 2007/09/23 18:55:17 fplanque Exp $ }}}
Poids: 668 lignes (17 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 2 classes

Log:: (11 méthodes):
  Log()
  clear()
  add()
  add_messages()
  get_head_foot()
  display_paragraphs()
  disp()
  display()
  get_string()
  count()
  get_messages()

Log_noop:: (9 méthodes):
  add()
  add_messages()
  clear()
  count()
  disp()
  display()
  display_paragraphs()
  get_messages()
  get_string()


Classe: Log  - X-Ref

Log class. Logs notes and errors.

Messages can be logged into different categories (aka levels)
Examples: 'note', 'error'. Note: 'all' is reserved to display all categories together.
Messages can later be displayed grouped by category/level.

Log( $category = 'error' )   X-Ref
Constructor.

param: string sets default category

clear( $category = NULL )   X-Ref
Clears the Log (all or specified category).

param: string category, use 'all' to unset all categories

add( $message, $category = NULL )   X-Ref
Add a message to the Log.

param: string the message
param: string|array the category, default is to use the object's default category.
param: boolean Dump (output) this directly?

add_messages( $messages )   X-Ref
Add an array of messages.

param: array Array of messages where the keys are the categories and hold an array of messages.

get_head_foot( $headfoot, $category, $template = NULL )   X-Ref
Get head/foot for a specific category, designed for internal use of {@link display()}

param: mixed head or foot (array [ category => head/foot, category => 'string', 'template',
param: string the category (or container)
param: string template, where the head/foot gets used (%s)

display_paragraphs( $category = 'all', $outerdivclass = 'panelinfo', $cssclass = NULL )   X-Ref
Wrapper to display messages as simple paragraphs.

param: mixed the category of messages, see {@link display()}. NULL for default category.
param: mixed the outer div, see {@link display()}
param: mixed the css class for inner paragraphs

disp( $before = '<div class="action_messages">', $after = '</div>', $skip_if_preview = true )   X-Ref
TEMPLATE TAG

The purpose here is to have a tag which is simple yet flexible.
the display function is WAAAY too bloated.

param: string HTML to display before the log when there is something to display
param: string HTML to display after the log when there is something to display
param: boolean Skip if previewing?

display( $head = NULL, $foot = NULL, $display = true, $category = 'all', $cssclass = NULL, $style = NULL, $outerdivclass = 'log_container' )   X-Ref
Display messages of the Log object.

- You can either output/get the messages of a category (string),
all categories ('all') or category groups (array of strings) (defaults to 'all').
- Head/Foot will be displayed on top/bottom of the messages. You can pass
an array as head/foot with the category as key and this will be displayed
on top of the category's messages.
- You can choose from various styles for message groups ('ul', 'p', 'br')
and set a css class for it (by default 'log_'.$category gets used).
- You can suppress the outer div or set a css class for it (defaults to
'log_container').

param: string|NULL Header/title, might be array ( category => msg ),
param: string|NULL Footer, might be array ( category => msg ), 'container' is then bottom.
param: boolean to display or return (default: display)
param: mixed the category of messages to use (category, 'all', list of categories (array)
param: string the CSS class of the messages div tag (default: 'log_'.$category)
param: string the style to use, 'ul', 'p', 'br'
param: mixed the outer div, may be false
return: boolean false, if no messages; else true (and outputs if $display)

get_string( $head = '', $foot = '', $category = NULL, $implodeBy = ', ' )   X-Ref
Concatenates messages of a given category to a string

param: string prefix of the string
param: string suffic of the string
param: string the category
return: string the messages, imploded. Tags stripped.

count( $category = NULL )   X-Ref
Counts messages of a given category

param: string|array the category, NULL=default, 'all' = all
return: number of messages

get_messages( $category = NULL, $singleDimension = false )   X-Ref
Returns array of messages of a single category or group of categories.

If the category is an array, those categories will be used (where 'all' will
be translated with the not already processed categories).
<code>get_messages( array('error', 'note', 'all') )</code> would return
'errors', 'notes' and the remaining messages, in that order.

param: string|array the category, NULL=default, 'all' = all
param: boolean if true will use subarrays for each category
return: array the messages, one or two dimensions (depends on second param)

Classe: Log_noop  - X-Ref

This is a no-operation implementation of {@link Log}.

It just implements the used methods {@link get()} and {@link display()}.

add()   X-Ref
This is a no-operation method.


add_messages()   X-Ref
This is a no-operation method.


clear()   X-Ref
This is a no-operation method.


count()   X-Ref
This is a no-operation method.


disp()   X-Ref
This is a no-operation method.


display()   X-Ref
This is a no-operation method.


display_paragraphs()   X-Ref
This is a no-operation method.


get_messages()   X-Ref
This is a no-operation method.


get_string()   X-Ref
This is a no-operation method.




Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics