Skip to content

Commit cf1c103

Browse files
committed
Seperate assets and tweak interface
1 parent 147ba53 commit cf1c103

File tree

4 files changed

+44
-17
lines changed

4 files changed

+44
-17
lines changed

public/laravel-debugbar.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
div.phpdebugbar {
2+
font-size: 13px;
3+
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
4+
}
5+
6+
div.phpdebugbar-header {
7+
background: #efefef url(laravel-icon.png) no-repeat 4px 3px;
8+
}
9+
a.phpdebugbar-restore-btn {
10+
background: #efefef url(laravel-icon.png) no-repeat 5px 3px;
11+
width: 16px;
12+
}
13+
div.phpdebugbar-resize-handle{
14+
margin-top: -5px;
15+
background: none;
16+
}
17+
18+
div.phpdebugbar-header{
19+
border-top: 1px solid #ccc;
20+
}
21+
22+
div.phpdebugbar-header > div > * {
23+
padding: 5px 6px;
24+
font-size: 13px;
25+
}

public/laravel-icon.png

3.58 KB
Loading

src/Barryvdh/Debugbar/Console/PublishCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function __construct(AssetPublisher $assets)
5252
public function fire()
5353
{
5454

55-
$package = 'barryvdh/laravel-debugbar';
56-
if ( ! is_null($path = $this->getPath()))
55+
$package = 'maximebf/php-debugbar';
56+
if ( ! is_null($path = $this->getDebugBarPath()))
5757
{
5858
$this->assets->publish($package, $path);
5959
$this->info('Assets published for package: '.$package);
@@ -62,13 +62,19 @@ public function fire()
6262
{
6363
$this->error('Could not find path for: '.$package);
6464
}
65+
$this->assets->publish('barryvdh/laravel-debugbar', $this->getPackagePublicPath());
66+
$this->info('Assets published for package: barryvdh/laravel-debugbar');
6567

6668
}
6769

68-
protected function getPath(){
70+
protected function getDebugBarPath(){
6971
$reflector = new \ReflectionClass('DebugBar\DebugBar');
7072
return dirname($reflector->getFileName()) . DIRECTORY_SEPARATOR . 'Resources';
7173
}
7274

75+
protected function getPackagePublicPath(){
76+
return __DIR__.'/../../../../public';
77+
}
78+
7379

7480
}

src/Barryvdh/Debugbar/LaravelDebugBar.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function boot(){
255255
}
256256

257257
$renderer = $this->getJavascriptRenderer();
258-
$renderer->setBaseUrl($this->app['url']->asset('packages/barryvdh/laravel-debugbar'));
258+
$renderer->setBaseUrl($this->app['url']->asset('packages/maximebf/php-debugbar'));
259259
$renderer->setIncludeVendors($this->app['config']->get('laravel-debugbar::config.include_vendors', true));
260260

261261
$this->booted = true;
@@ -404,30 +404,26 @@ public function addMessage($message, $label = 'info')
404404
*/
405405
public function injectDebugbar(Response $response)
406406
{
407-
if (function_exists('mb_stripos')) {
408-
$posrFunction = 'mb_strripos';
409-
$substrFunction = 'mb_substr';
410-
} else {
411-
$posrFunction = 'strripos';
412-
$substrFunction = 'substr';
413-
}
414-
415407
$content = $response->getContent();
416-
$pos = $posrFunction($content, '</body>');
417-
408+
418409
$renderer = $this->getJavascriptRenderer();
419410
if($this->getStorage()){
420411
$openHandlerUrl = $this->app['url']->route('debugbar.openhandler');
421412
$renderer->setOpenHandlerUrl($openHandlerUrl);
422413
}
423414

415+
if(method_exists($renderer, 'addAssets')){
416+
$dir = 'packages/barryvdh/laravel-debugbar';
417+
$renderer->addAssets(array('laravel-debugbar.css'), array(), $this->app['path.public'].'/'.$dir, $this->app['url']->asset($dir));
418+
}
424419

425-
$debugbar = $renderer->renderHead() . $renderer->render();
420+
$renderedContent = $renderer->renderHead() . $renderer->render();
426421

422+
$pos = mb_strripos($content, '</body>');
427423
if (false !== $pos) {
428-
$content = $substrFunction($content, 0, $pos).$debugbar.$substrFunction($content, $pos);
424+
$content = mb_substr($content, 0, $pos) . $renderedContent . mb_substr($content, $pos);
429425
}else{
430-
$content = $content . $debugbar;
426+
$content = $content . $renderedContent;
431427
}
432428

433429
$response->setContent($content);

0 commit comments

Comments
 (0)