_basePath = realpath($options['base_path']);
is_array($options['library']) || $options['library'] = array($options['library']);
$this->_library = array_merge($options['library'], array('Zend', 'ZFDebug'));
}
/**
* Gets identifier for this plugin
*
* @return string
*/
public function getIdentifier()
{
return $this->_identifier;
}
/**
* Returns the base64 encoded icon
*
* @return string
**/
public function getIconData()
{
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADPSURBVCjPdZFNCsIwEEZHPYdSz1DaHsMzuPM6RRcewSO4caPQ3sBDKCK02p+08DmZtGkKlQ+GhHm8MBmiFQUU2ng0B7khClTdQqdBiX1Ma1qMgbDlxh0XnJHiit2JNq5HgAo3KEx7BFAM/PMI0CDB2KNvh1gjHZBi8OR448GnAkeNDEDvKZDh2Xl4cBcwtcKXkZdYLJBYwCCFPDRpMEjNyKcDPC4RbXuPiWKkNABPOuNhItegz0pGFkD+y3p0s48DDB43dU7+eLWes3gdn5Y/LD9Y6skuWXcAAAAASUVORK5CYII=';
}
/**
* Gets menu tab for the Debugbar
*
* @return string
*/
public function getTab()
{
return count($this->_getIncludedFiles()) . ' Files';
}
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$included = $this->_getIncludedFiles();
$html = '
File Information
';
$html .= count($included).' Files Included'.$this->getLinebreak();
$size = 0;
foreach ($included as $file) {
$size += filesize($file);
}
$html .= 'Total Size: '. round($size/1024, 1).'K'.$this->getLinebreak();
$html .= 'Basepath: ' . $this->_basePath .$this->getLinebreak();
$libraryFiles = array();
foreach ($this->_library as $key => $value) {
if ('' != $value) {
$libraryFiles[$key] = '' . $value . ' Files
';
}
}
$html .= 'Application Files
';
foreach ($included as $file) {
$file = str_replace($this->_basePath, '', $file);
$filePaths = explode(DIRECTORY_SEPARATOR, $file);
$inUserLib = false;
foreach ($this->_library as $key => $library)
{
if('' != $library && in_array($library, $filePaths)) {
$libraryFiles[$key] .= $file . $this->getLinebreak();
$inUserLib = TRUE;
}
}
if (!$inUserLib) {
$html .= $file .$this->getLinebreak();
}
}
$html .= implode('', $libraryFiles);
return $html;
}
/**
* Gets included files
*
* @return array
*/
protected function _getIncludedFiles()
{
if (null !== $this->_includedFiles) {
return $this->_includedFiles;
}
$this->_includedFiles = get_included_files();
sort($this->_includedFiles);
return $this->_includedFiles;
}
}