array()); if (preg_match_all('#(?:

(?:)?(.*?)(?:)?

)|(?:(.*?)\s*(?:(.*?)\s*(?:(.*?)\s*)?)?)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { if (strlen($match[1])) { $phpinfo[$match[1]] = array(); } else if(isset($match[3])) { $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; } else { $phpinfo[end(array_keys($phpinfo))][] = $match[2]; } } } $returnvalue .= elgg_echo('diagnostics:report:php', array(print_r($phpinfo, true))); return $returnvalue; } /** * Get global variables. * * @return string */ function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params) { global $CONFIG; $output = str_replace($CONFIG->dbpass, '<>', print_r($GLOBALS, true)); $returnvalue .= elgg_echo('diagnostics:report:globals', array($output)); return $returnvalue; } elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_basic_hook", 0); // show basics first elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_plugins_hook", 2); // Now the plugins elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_sigs_hook", 1); // Now the signatures elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_globals_hook"); // Global variables elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_phpinfo_hook"); // PHP info