Log Log(
[string
$category = 'error']
)
|
|
Constructor.
Parameters:
|
string |
$category: |
sets default category |
void add(
string
$message, [string|array
$category = NULL], [boolean
$dump_this_add = false]
)
|
|
Add a message to the Log.
Parameters:
|
string |
$message: |
the message |
|
string|array |
$category: |
the category, default is to use the object's default category. Can also be an array of categories to add the same message to. |
|
boolean |
$dump_this_add: |
Dump (output) this directly? |
void add_messages(
array
$messages
)
|
|
Add an array of messages.
Parameters:
|
array |
$messages: |
Array of messages where the keys are the categories and hold an array of messages. |
void clear(
[string
$category = NULL]
)
|
|
Clears the Log (all or specified category).
Parameters:
|
string |
$category: |
category, use 'all' to unset all categories |
number count(
[string|array
$category = NULL]
)
|
|
Counts messages of a given category
Parameters:
|
string|array |
$category: |
the category, NULL=default, 'all' = all |
API Tags:
void disp(
[string
$before = '<div class="action_messages">'], [string
$after = '</div>']
)
|
|
TEMPLATE TAG
The purpose here is to have a tag which is simple yet flexible. the display function is WAAAY too bloated.
Parameters:
|
string |
$before: |
HTML to display before the log when there is something to display |
|
string |
$after: |
HTML to display after the log when there is something to display |
Information Tags:
boolean display(
[string|NULL
$head = NULL], [string|NULL
$foot = NULL], [boolean
$display = true], [mixed
$category = 'all'], [string
$cssclass = NULL], [string
$style = NULL], [mixed
$outerdivclass = 'log_container']
)
|
|
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').
You can also call this function static (without creating an object), like:
Please note: when called static, it will always display, because $display equals true.
Parameters:
|
string|NULL |
$head: |
Header/title, might be array ( category => msg ), 'container' is then top. NULL for object's default (Log::head. |
|
string|NULL |
$foot: |
Footer, might be array ( category => msg ), 'container' is then bottom. NULL for object's default (Log::foot. |
|
boolean |
$display: |
to display or return (default: display) |
|
mixed |
$category: |
the category of messages to use (category, 'all', list of categories (array) or NULL for $defaultcategory). |
|
string |
$cssclass: |
the CSS class of the messages div tag (default: 'log_'.$category) |
|
string |
$style: |
the style to use, 'ul', 'p', 'br' (default: 'br' for single message, 'ul' for more) |
|
mixed |
$outerdivclass: |
the outer div, may be false |
API Tags:
| Return: | false, if no messages; else true (and outputs if $display) |
Information Tags:
| Todo: | Make this simple! start by getting rid of the $category selection and the special cases for 'all'. If you don't want to display ALL messages, then you should not log them in the same Log ovject and you should instanciate separate logs instead. |
boolean display_cond(
[string
$head1 = ''], [string|NULL
$head_more = ''], [string
$foot1 = ''], [string|NULL
$foot_more = ''], [boolean
$display = true], [mixed
$category = 'all'], [string
$cssclass = NULL], [string
$style = NULL], [mixed
$outerdivclass = 'log_container']
)
|
|
Wrapper for Log::display(): use header/footer dependent on message count (one or more).
Parameters:
|
string |
$head1: |
header/title for one message (default: empty), might be array ( category => msg ), 'container' is then top |
|
string|NULL |
$head_more: |
header/title (if more than one message) - NULL means "use $head1" |
|
string |
$foot1: |
footer (if one message) (default: empty), might be array ( category => msg ), 'container' is then bottom |
|
string|NULL |
$foot_more: |
footer (if more than one message) - NULL means "use $foot1" |
|
boolean |
$display: |
to display or return (default: true) |
|
mixed |
$category: |
the category of messages to use (category, 'all', or list of categories (array); NULL for default category) |
|
string |
$cssclass: |
the CSS class of the messages div tag (default: 'log_'.$category) |
|
string |
$style: |
the style to use, 'ul', 'p', 'br' (default: 'br' for single message, 'ul' for more) |
|
mixed |
$outerdivclass: |
the outer div, may be false |
API Tags:
| Return: | false, if no messages; else true (and outputs if $display) |
void display_paragraphs(
[mixed
$category = 'all'], [mixed
$outerdivclass = 'panelinfo'], [mixed
$cssclass = NULL]
)
|
|
Wrapper to display messages as simple paragraphs.
Parameters:
|
mixed |
$category: |
the category of messages, see display(). NULL for default category. |
|
mixed |
$outerdivclass: |
the outer div, see display() |
|
mixed |
$cssclass: |
the css class for inner paragraphs |
array get_messages(
[string|array
$category = NULL], [boolean
$singleDimension = false]
)
|
|
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).
would return 'errors', 'notes' and the remaining messages, in that order.
Parameters:
|
string|array |
$category: |
the category, NULL=default, 'all' = all |
|
boolean |
$singleDimension: |
if true will use subarrays for each category |
API Tags:
| Return: | the messages, one or two dimensions (depends on second param) |
string get_string(
[string
$head = ''], [string
$foot = ''], [string
$category = NULL], [
$implodeBy = ', ']
)
|
|
Concatenates messages of a given category to a string
Parameters:
|
string |
$head: |
prefix of the string |
|
string |
$foot: |
suffic of the string |
|
string |
$category: |
the category |
|
|
$implodeBy: |
|
API Tags:
| Return: | the messages, imploded. Tags stripped. |