getClientID());
// settings from config.xml
$dumpConfig = & JComponentHelper::getParams( 'com_dump' );
$w = $dumpConfig->get( 'popupwidth', 500 );
$h = $dumpConfig->get( 'popupheight', 500 );
// build the url
$url = JURI::base(true).'/index.php?option=com_dump&view=tree&tmpl=component';
/* @TODO remove this and implement this in a later version using JRoute
// only add Itemid in Site
if ( $mainframe->isSite() ) {
$url .= '&Itemid=' . DumpHelper::getComponentItemid( 'com_dump' );
}
*/
// create the javascript
// We can't use $document, because it's already rendered
$nl = "\n";
$script = $nl. '' .$nl.
'' .$nl.
'';
// add the code to the header (thanks jenscski)
// JResponse::appendBody( $script );
$body = JResponse::getBody();
$body = str_replace('', $script.'', $body);
JResponse::setBody($body);
}
/* @TODO remove this and implement this in a later version using JRoute
function getComponentItemid( $option ) {
jimport('joomla.application.menu');
$menu = & JMenu::getInstance();
$components = & $menu->getItems( 'type', 'component' );
$attribs['option'] = '';
foreach( $components as $component ) {
$str = str_replace( 'index.php?', '', $component->link );
parse_str( $str, $attribs );
if( $attribs['option'] == $option ){
return $component->id;
}
}
// if no Itemid is found (because there's no menuitem for $option), return current
return $GLOBALS['Itemid'];
}
*/
function getSourceFunction(&$trace)
{
$function = '';
for ($i=1, $n=count($trace); $i<$n; $i++)
{
$func = $trace[$i]['function'];
if ($func!='include' && $func!='include_once' && $func!='require' && $func!='require_once')
{
if (@$trace[$i]['type'] && @$trace[$i]['class'])
$function = $trace[$i]['class'].'
'.$trace[$i]['type'].' '.$func.'()';
else
$function = $func;
}
if ($function) break;
}
return "Function: $function
";
}
function getSourcePath(&$trace)
{
$path = 'File: '.str_replace(JPATH_BASE.DS, '', $trace[0]['file'])
. '
'
. 'Line: '.$trace[0]['line']
. '
';
return $path;
}
function & getMaxDepth() {
static $maxdepth = null;
if ( !$maxdepth ) {
$dumpConfig = & JComponentHelper::getParams( 'com_dump' );
$maxdepth = intval( $dumpConfig->get( 'maxdepth', 5 ) );
if( $maxdepth > 20 ) $maxdepth=20;
if( $maxdepth < 1 ) $maxdepth=1;
}
return $maxdepth;
}
}