Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

A few basic fixes #13

Merged
merged 5 commits into from

3 participants

@pnomolos

Only display toolbar when content type is text/html and make sure files are served from the proper directory (within reason)

@pnomolos

I don't know how to skip that first fix that I already opened a pull request, so sorry about that :S

@tmaiaroto tmaiaroto merged commit 0309090 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
7 config/bootstrap/dispatcher.php
@@ -50,7 +50,12 @@
// Render the toolbar (unless it's an asset from the li3_perf library)
// Why? See li3_perf\extensions\util\Asset
- if(!isset($params['request']->params['asset_type'])) {
+ $content_type = isset($result->headers['Content-Type']) ? $result->headers['Content-Type'] : '';
+ $content_type = array_shift(explode(';', $result->headers['Content-Type'], 2));
+ if(
+ !isset($params['request']->params['asset_type']) &&
+ (!$content_type || $content_type == 'text/html')
+ ) {
$skip = false;
$li3_perf = Libraries::get('li3_perf');
if(isset($li3_perf['skip'])) {
View
6 extensions/util/Asset.php
@@ -32,7 +32,11 @@ public static function render($library=null, $asset_type=null, $asset=null, $opt
$headers = array($_SERVER['SERVER_PROTOCOL'].' 404 Not Found' => null, 'Content-Type' => null, 'Status' => '404 Not Found');
$body = '';
- $full_asset_path = LITHIUM_APP_PATH . '/libraries/' . $library . '/webroot/' . $asset_type . '/' . $asset;
+ if (strpos(__DIR__, LITHIUM_LIBRARY_PATH) !== FALSE) {
+ $full_asset_path = LITHIUM_LIBRARY_PATH . '/' . $library . '/webroot/' . $asset_type . '/' . $asset;
+ } else {
+ $full_asset_path = LITHIUM_APP_PATH . '/libraries/' . $library . '/webroot/' . $asset_type . '/' . $asset;
+ }
if(file_exists($full_asset_path)) {
// get the full content-type, default to text/plain
$finfo = new finfo(FILEINFO_MIME, null);
View
2  views/elements/toolbar.html.php
@@ -1,5 +1,5 @@
<div id="li3-perf-toolbar">
- <div id="li3-perf-toolbar-content-wrapper" style="background: url('85bg.png') repeat;">
+ <div id="li3-perf-toolbar-content-wrapper" style="background: url('/li3_perf/img/85bg.png') repeat;">
<?=$this->html->image('/li3_perf/img/clock.png', array('title' => 'execution time', 'alt' => 'execution time')) . ' ' . number_format($timers['complete_load'], 2) . 's'; ?>
Something went wrong with that request. Please try again.