Merge branch 'MDL-30966-print-object_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE

This commit is contained in:
Eloy Lafuente (stronk7) 2012-01-09 00:33:31 +01:00
commit f35cacdc83

View file

@ -1957,19 +1957,26 @@ function count_login_failures($mode, $username, $lastlogin) {
/// GENERAL HELPFUL THINGS ///////////////////////////////////
/**
* Dump a given object's information in a PRE block.
* Dumps a given object's information for debugging purposes
*
* Mostly just used for debugging.
* When used in a CLI script, the object's information is written to the standard
* error output stream. When used in a web script, the object is dumped to a
* pre-formatted block with the "notifytiny" CSS class.
*
* @param mixed $object The data to be printed
* @return void OUtput is echo'd
* @return void output is echo'd
*/
function print_object($object) {
echo '<pre class="notifytiny">';
// we may need a lot of memory here
raise_memory_limit(MEMORY_EXTRA);
echo s(print_r($object, true));
echo '</pre>';
if (CLI_SCRIPT) {
fwrite(STDERR, print_r($object, true));
fwrite(STDERR, PHP_EOL);
} else {
echo html_writer::tag('pre', s(print_r($object, true)), array('class' => 'notifytiny'));
}
}
/**