diff --git a/app/config/app.php b/app/config/app.php index b41ca1463e..f58e14fcd3 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -2,193 +2,196 @@ return array( - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ - 'debug' => false, + 'debug' => false, - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ - 'url' => 'http://localhost', + 'url' => 'http://localhost', - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ - 'timezone' => 'UTC', + 'timezone' => 'UTC', - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ - 'locale' => 'en', + 'locale' => 'en', - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ - 'fallback_locale' => 'en', + 'fallback_locale' => 'en', - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ - 'key' => 'D93oqmVsIARg23FC3cbsHuBGk0uXQc3r', + 'key' => 'D93oqmVsIARg23FC3cbsHuBGk0uXQc3r', - 'cipher' => MCRYPT_RIJNDAEL_128, + 'cipher' => MCRYPT_RIJNDAEL_128, - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ - 'providers' => array( + 'providers' => array( - 'Illuminate\Foundation\Providers\ArtisanServiceProvider', - 'Illuminate\Auth\AuthServiceProvider', - 'Illuminate\Cache\CacheServiceProvider', - 'Illuminate\Session\CommandsServiceProvider', - 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', - 'Illuminate\Routing\ControllerServiceProvider', - 'Illuminate\Cookie\CookieServiceProvider', - 'Illuminate\Database\DatabaseServiceProvider', - 'Illuminate\Encryption\EncryptionServiceProvider', - 'Illuminate\Filesystem\FilesystemServiceProvider', - 'Illuminate\Hashing\HashServiceProvider', - 'Illuminate\Html\HtmlServiceProvider', - 'Illuminate\Log\LogServiceProvider', - 'Illuminate\Mail\MailServiceProvider', - 'Illuminate\Database\MigrationServiceProvider', - 'Illuminate\Pagination\PaginationServiceProvider', - 'Illuminate\Queue\QueueServiceProvider', - 'Illuminate\Redis\RedisServiceProvider', - 'Illuminate\Remote\RemoteServiceProvider', - 'Illuminate\Auth\Reminders\ReminderServiceProvider', - 'Illuminate\Database\SeedServiceProvider', - 'Illuminate\Session\SessionServiceProvider', - 'Illuminate\Translation\TranslationServiceProvider', - 'Illuminate\Validation\ValidationServiceProvider', - 'Illuminate\View\ViewServiceProvider', - 'Illuminate\Workbench\WorkbenchServiceProvider', + 'Illuminate\Foundation\Providers\ArtisanServiceProvider', + 'Illuminate\Auth\AuthServiceProvider', + 'Illuminate\Cache\CacheServiceProvider', + 'Illuminate\Session\CommandsServiceProvider', + 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', + 'Illuminate\Routing\ControllerServiceProvider', + 'Illuminate\Cookie\CookieServiceProvider', + 'Illuminate\Database\DatabaseServiceProvider', + 'Illuminate\Encryption\EncryptionServiceProvider', + 'Illuminate\Filesystem\FilesystemServiceProvider', + 'Illuminate\Hashing\HashServiceProvider', + 'Illuminate\Html\HtmlServiceProvider', + 'Illuminate\Log\LogServiceProvider', + 'Illuminate\Mail\MailServiceProvider', + 'Illuminate\Database\MigrationServiceProvider', + 'Illuminate\Pagination\PaginationServiceProvider', + 'Illuminate\Queue\QueueServiceProvider', + 'Illuminate\Redis\RedisServiceProvider', + 'Illuminate\Remote\RemoteServiceProvider', + 'Illuminate\Auth\Reminders\ReminderServiceProvider', + 'Illuminate\Database\SeedServiceProvider', + 'Illuminate\Session\SessionServiceProvider', + 'Illuminate\Translation\TranslationServiceProvider', + 'Illuminate\Validation\ValidationServiceProvider', + 'Illuminate\View\ViewServiceProvider', + 'Illuminate\Workbench\WorkbenchServiceProvider', + 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', + 'Barryvdh\Debugbar\ServiceProvider', - ), - /* - |-------------------------------------------------------------------------- - | Service Provider Manifest - |-------------------------------------------------------------------------- - | - | The service provider manifest is used by Laravel to lazy load service - | providers which are not needed for each request, as well to keep a - | list of all of the services. Here, you may set its storage spot. - | - */ + ), - 'manifest' => storage_path().'/meta', + /* + |-------------------------------------------------------------------------- + | Service Provider Manifest + |-------------------------------------------------------------------------- + | + | The service provider manifest is used by Laravel to lazy load service + | providers which are not needed for each request, as well to keep a + | list of all of the services. Here, you may set its storage spot. + | + */ - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ + 'manifest' => storage_path() . '/meta', - 'aliases' => array( + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ - 'App' => 'Illuminate\Support\Facades\App', - 'Artisan' => 'Illuminate\Support\Facades\Artisan', - 'Auth' => 'Illuminate\Support\Facades\Auth', - 'Blade' => 'Illuminate\Support\Facades\Blade', - 'Cache' => 'Illuminate\Support\Facades\Cache', - 'ClassLoader' => 'Illuminate\Support\ClassLoader', - 'Config' => 'Illuminate\Support\Facades\Config', - 'Controller' => 'Illuminate\Routing\Controller', - 'Cookie' => 'Illuminate\Support\Facades\Cookie', - 'Crypt' => 'Illuminate\Support\Facades\Crypt', - 'DB' => 'Illuminate\Support\Facades\DB', - 'Eloquent' => 'Illuminate\Database\Eloquent\Model', - 'Event' => 'Illuminate\Support\Facades\Event', - 'File' => 'Illuminate\Support\Facades\File', - 'Form' => 'Illuminate\Support\Facades\Form', - 'Hash' => 'Illuminate\Support\Facades\Hash', - 'HTML' => 'Illuminate\Support\Facades\HTML', - 'Input' => 'Illuminate\Support\Facades\Input', - 'Lang' => 'Illuminate\Support\Facades\Lang', - 'Log' => 'Illuminate\Support\Facades\Log', - 'Mail' => 'Illuminate\Support\Facades\Mail', - 'Paginator' => 'Illuminate\Support\Facades\Paginator', - 'Password' => 'Illuminate\Support\Facades\Password', - 'Queue' => 'Illuminate\Support\Facades\Queue', - 'Redirect' => 'Illuminate\Support\Facades\Redirect', - 'Redis' => 'Illuminate\Support\Facades\Redis', - 'Request' => 'Illuminate\Support\Facades\Request', - 'Response' => 'Illuminate\Support\Facades\Response', - 'Route' => 'Illuminate\Support\Facades\Route', - 'Schema' => 'Illuminate\Support\Facades\Schema', - 'Seeder' => 'Illuminate\Database\Seeder', - 'Session' => 'Illuminate\Support\Facades\Session', - 'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait', - 'SSH' => 'Illuminate\Support\Facades\SSH', - 'Str' => 'Illuminate\Support\Str', - 'URL' => 'Illuminate\Support\Facades\URL', - 'Validator' => 'Illuminate\Support\Facades\Validator', - 'View' => 'Illuminate\Support\Facades\View', + 'aliases' => array( - ), + 'App' => 'Illuminate\Support\Facades\App', + 'Artisan' => 'Illuminate\Support\Facades\Artisan', + 'Auth' => 'Illuminate\Support\Facades\Auth', + 'Blade' => 'Illuminate\Support\Facades\Blade', + 'Cache' => 'Illuminate\Support\Facades\Cache', + 'ClassLoader' => 'Illuminate\Support\ClassLoader', + 'Config' => 'Illuminate\Support\Facades\Config', + 'Controller' => 'Illuminate\Routing\Controller', + 'Cookie' => 'Illuminate\Support\Facades\Cookie', + 'Crypt' => 'Illuminate\Support\Facades\Crypt', + 'DB' => 'Illuminate\Support\Facades\DB', + 'Eloquent' => 'Illuminate\Database\Eloquent\Model', + 'Event' => 'Illuminate\Support\Facades\Event', + 'File' => 'Illuminate\Support\Facades\File', + 'Form' => 'Illuminate\Support\Facades\Form', + 'Hash' => 'Illuminate\Support\Facades\Hash', + 'HTML' => 'Illuminate\Support\Facades\HTML', + 'Input' => 'Illuminate\Support\Facades\Input', + 'Lang' => 'Illuminate\Support\Facades\Lang', + 'Log' => 'Illuminate\Support\Facades\Log', + 'Mail' => 'Illuminate\Support\Facades\Mail', + 'Paginator' => 'Illuminate\Support\Facades\Paginator', + 'Password' => 'Illuminate\Support\Facades\Password', + 'Queue' => 'Illuminate\Support\Facades\Queue', + 'Redirect' => 'Illuminate\Support\Facades\Redirect', + 'Redis' => 'Illuminate\Support\Facades\Redis', + 'Request' => 'Illuminate\Support\Facades\Request', + 'Response' => 'Illuminate\Support\Facades\Response', + 'Route' => 'Illuminate\Support\Facades\Route', + 'Schema' => 'Illuminate\Support\Facades\Schema', + 'Seeder' => 'Illuminate\Database\Seeder', + 'Session' => 'Illuminate\Support\Facades\Session', + 'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait', + 'SSH' => 'Illuminate\Support\Facades\SSH', + 'Str' => 'Illuminate\Support\Str', + 'URL' => 'Illuminate\Support\Facades\URL', + 'Validator' => 'Illuminate\Support\Facades\Validator', + 'View' => 'Illuminate\Support\Facades\View', + + ), ); diff --git a/app/config/packages/barryvdh/laravel-debugbar/config.php b/app/config/packages/barryvdh/laravel-debugbar/config.php new file mode 100644 index 0000000000..6dc07e2867 --- /dev/null +++ b/app/config/packages/barryvdh/laravel-debugbar/config.php @@ -0,0 +1,146 @@ + Config::get('app.debug'), + + /* + |-------------------------------------------------------------------------- + | Storage settings + |-------------------------------------------------------------------------- + | + | DebugBar stores data for session/ajax requests in a directory. + | You can disable this, so the debugbar stores data in headers/session, + | but this can cause problems with large data collectors. + | + */ + 'storage' => array( + 'enabled' => true, + 'path' => storage_path() . '/debugbar', + ), + + /* + |-------------------------------------------------------------------------- + | Vendors + |-------------------------------------------------------------------------- + | + | Vendor files are included by default, but can be set to false. + | This can also be set to 'js' or 'css', to only include javascript or css vendor files. + | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) + | and for js: jquery and and highlight.js + | So if you want syntax highlighting, set it to true. + | jQuery is set to not conflict with existing jQuery scripts. + | + */ + + 'include_vendors' => true, + + /* + |-------------------------------------------------------------------------- + | Capture Ajax Requests + |-------------------------------------------------------------------------- + | + | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), + | you can use this option to disable sending the data through the headers. + | + */ + + 'capture_ajax' => true, + + /* + |-------------------------------------------------------------------------- + | Capture Console Commands + |-------------------------------------------------------------------------- + | + | The Debugbar can listen to Artisan commands. You can view them with the browse button in the Debugbar. + | + */ + + 'capture_console' => false, + + /* + |-------------------------------------------------------------------------- + | DataCollectors + |-------------------------------------------------------------------------- + | + | Enable/disable DataCollectors + | + */ + + 'collectors' => array( + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired + 'default_request' => false, // Regular or special Symfony request logger + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'auth' => false, // Display Laravel authentication status + ), + + /* + |-------------------------------------------------------------------------- + | Extra options + |-------------------------------------------------------------------------- + | + | Configure some DataCollectors + | + */ + + 'options' => array( + 'auth' => array( + 'show_name' => false, // Also show the users name/email in the debugbar + ), + 'db' => array( + 'with_params' => true, // Render SQL with the parameters substituted + 'timeline' => false, // Add the queries to the timeline + ), + 'mail' => array( + 'full_log' => false + ), + 'views' => array( + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + ), + 'route' => array( + 'label' => true // show complete route on bar + ), + 'logs' => array( + 'file' => null + ), + ), + + /* + |-------------------------------------------------------------------------- + | Inject Debugbar in Response + |-------------------------------------------------------------------------- + | + | Usually, the debugbar is added just before
, by listening to the + | Response after the App is done. If you disable this, you have to add them + | in your template yourself. See http://phpdebugbar.com/docs/rendering.html + | + */ + + 'inject' => true, + +); diff --git a/bootstrap/start.php b/bootstrap/start.php index 84559be3a4..bcbb22687b 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -24,11 +24,11 @@ $app = new Illuminate\Foundation\Application; | */ -$env = $app->detectEnvironment(array( +$env = $app->detectEnvironment(function() { + // Default to production if LARAVEL_ENV is not set + return getenv('LARAVEL_ENV') ?: 'production'; + }); - 'local' => array('homestead'), - -)); /* |-------------------------------------------------------------------------- diff --git a/public/packages/barryvdh/laravel-debugbar/laravel-debugbar.css b/public/packages/barryvdh/laravel-debugbar/laravel-debugbar.css new file mode 100644 index 0000000000..2dd6c8bc0a --- /dev/null +++ b/public/packages/barryvdh/laravel-debugbar/laravel-debugbar.css @@ -0,0 +1,65 @@ +div.phpdebugbar { + font-size: 13px; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; +} + +div.phpdebugbar-header { + background: #efefef url(laravel-icon.png) no-repeat 4px 3px; + background-size: 20px; + line-height: 17px; +} +a.phpdebugbar-restore-btn { + background: #efefef url(laravel-icon.png) no-repeat 5px 3px; + background-size: 20px; + width: 16px; + border-right-color: #ccc; +} + +div.phpdebugbar-header > div > * { + font-size: 13px; +} + +div.phpdebugbar-header .phpdebugbar-tab { + padding: 5px 6px; +} + +div.phpdebugbar .phpdebugbar-header select{ + padding: 1px 0; +} + +dl.phpdebugbar-widgets-kvlist dt{ + width: 200px; +} + +dl.phpdebugbar-widgets-kvlist dd { + margin-left: 210px; +} + +ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-value { + height: 20px; + top: 0; + background-color: #f4645f; +} + +ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-label { + top: 2px; +} + +div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter { + background-color: #f4645f; +} + +a.phpdebugbar-tab.phpdebugbar-active { + background: #f4645f; + color: #fff; +} + +a.phpdebugbar-tab.phpdebugbar-active span.phpdebugbar-badge { + background-color: white; + color: #f4645f; +} + +a.phpdebugbar-tab span.phpdebugbar-badge { + background: #f4645f; + color: #fff; +} diff --git a/public/packages/barryvdh/laravel-debugbar/laravel-icon.png b/public/packages/barryvdh/laravel-debugbar/laravel-icon.png new file mode 100644 index 0000000000..2ec0353a66 Binary files /dev/null and b/public/packages/barryvdh/laravel-debugbar/laravel-icon.png differ diff --git a/public/packages/maximebf/php-debugbar/debugbar.css b/public/packages/maximebf/php-debugbar/debugbar.css new file mode 100644 index 0000000000..1da6937db3 --- /dev/null +++ b/public/packages/maximebf/php-debugbar/debugbar.css @@ -0,0 +1,225 @@ +div.phpdebugbar { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + border-top: 0; + font-family: arial, sans-serif; + background: #fff; + z-index: 10000; + font-size: 14px; + color: #000; + text-align: left; +} + +div.phpdebugbar-closed { + width: auto; +} + +div.phpdebugbar * { + + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +a.phpdebugbar-restore-btn { + float: left; + padding: 5px 8px; + font-size: 14px; + color: #555; + text-decoration: none; + border-right: 1px solid #ddd; +} + +div.phpdebugbar-resize-handle { + display: none; + height: 4px; + margin-top: -4px; + width: 100%; + background: none; + border-bottom: 1px solid #ccc; + cursor: n-resize; +} + +div.phpdebugbar-closed, div.phpdebugbar-minimized{ + border-top: 1px solid #ccc; +} + +/* -------------------------------------- */ + +div.phpdebugbar-header { + background: #efefef url(php-icon.png) no-repeat 5px 4px; + padding-left: 29px; + min-height: 26px; + line-height: 16px; +} +div.phpdebugbar-header:before, div.phpdebugbar-header:after { + display: table; + line-height: 0; + content: ""; +} +div.phpdebugbar-header:after { + clear: both; +} +div.phpdebugbar-header-left { + float: left; +} +div.phpdebugbar-header-right { + float: right; +} +div.phpdebugbar-header > div > * { + padding: 5px 8px; + font-size: 14px; + color: #555; + text-decoration: none; +} +div.phpdebugbar-header-left > * { + float: left; +} +div.phpdebugbar-header-right > * { + float: right; +} +div.phpdebugbar-header-right > select { + padding: 0; +} + +/* -------------------------------------- */ + +span.phpdebugbar-indicator, +a.phpdebugbar-indicator, +a.phpdebugbar-close-btn { + border-right: 1px solid #ddd; +} + +a.phpdebugbar-tab.phpdebugbar-active { + background: #ccc; + color: #444; + background-image: linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); + background-image: -o-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); + background-image: -moz-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); + background-image: -webkit-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); + background-image: -ms-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.41, rgb(173,173,173)), color-stop(0.71, rgb(209,209,209))); +} + a.phpdebugbar-tab span.phpdebugbar-badge { + display: none; + margin-left: 5px; + font-size: 11px; + line-height: 14px; + padding: 0px 6px; + background: #ccc; + border-radius: 4px; + color: #555; + font-weight: normal; + text-shadow: none; + vertical-align: middle; + } + a.phpdebugbar-tab i { + display: none; + vertical-align: middle; + } + a.phpdebugbar-tab span.phpdebugbar-badge.phpdebugbar-important { + background: #ed6868; + color: white; + } + +a.phpdebugbar-close-btn { + background: url(icons.png) no-repeat 10px 7px; + width: 16px; + height: 16px; +} + +a.phpdebugbar-open-btn { + background: url(icons.png) no-repeat -14px 8px; + width: 16px; + height: 16px; +} + +a.phpdebugbar-restore-btn { + background: #efefef url(php-icon.png) no-repeat 5px 4px; + width: 16px; + height: 16px; +} + +.phpdebugbar-indicator { + position: relative; + cursor: pointer; +} + .phpdebugbar-indicator span.phpdebugbar-text { + margin-left: 5px; + } + .phpdebugbar-indicator span.phpdebugbar-tooltip { + display: none; + position: absolute; + top: -30px; + background: #efefef; + opacity: .7; + border: 1px solid #ccc; + color: #555; + font-size: 11px; + padding: 2px 3px; + z-index: 1000; + text-align: center; + width: 200%; + right: 0; + } + .phpdebugbar-indicator:hover span.phpdebugbar-tooltip:not(.phpdebugbar-disabled) { + display: block; + } + +select.phpdebugbar-datasets-switcher { + float: right; + display: none; + margin: 2px 0 0 7px; + max-width: 200px; + max-height: 23px; + padding: 0; +} + +/* -------------------------------------- */ + +div.phpdebugbar-body { + border-top: 1px solid #ccc; + display: none; + position: relative; + height: 300px; +} + +/* -------------------------------------- */ + +div.phpdebugbar-panel { + display: none; + height: 100%; + overflow: auto; + width: 100%; +} +div.phpdebugbar-panel.phpdebugbar-active { + display: block; +} + +/* -------------------------------------- */ + +div.phpdebugbar-mini-design a.phpdebugbar-tab { + position: relative; + border-right: 1px solid #ddd; +} + div.phpdebugbar-mini-design a.phpdebugbar-tab span.phpdebugbar-text { + display: none; + } + div.phpdebugbar-mini-design a.phpdebugbar-tab:hover span.phpdebugbar-text { + display: block; + position: absolute; + top: -30px; + background: #efefef; + opacity: .7; + border: 1px solid #ccc; + color: #555; + font-size: 11px; + padding: 2px 3px; + z-index: 1000; + text-align: center; + right: 0; + } + div.phpdebugbar-mini-design a.phpdebugbar-tab i { + display:inline-block; + } diff --git a/public/packages/maximebf/php-debugbar/debugbar.js b/public/packages/maximebf/php-debugbar/debugbar.js new file mode 100644 index 0000000000..23cf5ce4cd --- /dev/null +++ b/public/packages/maximebf/php-debugbar/debugbar.js @@ -0,0 +1,1080 @@ +if (typeof(PhpDebugBar) == 'undefined') { + // namespace + var PhpDebugBar = {}; + PhpDebugBar.$ = jQuery; +} + +(function($) { + + if (typeof(localStorage) == 'undefined') { + // provide mock localStorage object for dumb browsers + localStorage = { + setItem: function(key, value) {}, + getItem: function(key) { return null; } + }; + } + + if (typeof(PhpDebugBar.utils) == 'undefined') { + PhpDebugBar.utils = {}; + } + + /** + * Returns the value from an object property. + * Using dots in the key, it is possible to retrieve nested property values + * + * @param {Object} dict + * @param {String} key + * @param {Object} default_value + * @return {Object} + */ + var getDictValue = PhpDebugBar.utils.getDictValue = function(dict, key, default_value) { + var d = dict, parts = key.split('.'); + for (var i = 0; i < parts.length; i++) { + if (!d[parts[i]]) { + return default_value; + } + d = d[parts[i]]; + } + return d; + } + + /** + * Counts the number of properties in an object + * + * @param {Object} obj + * @return {Integer} + */ + var getObjectSize = PhpDebugBar.utils.getObjectSize = function(obj) { + if (Object.keys) { + return Object.keys(obj).length; + } + var count = 0; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + count++; + } + } + return count; + } + + /** + * Returns a prefixed css class name + * + * @param {String} cls + * @return {String} + */ + PhpDebugBar.utils.csscls = function(cls, prefix) { + if (cls.indexOf(' ') > -1) { + var clss = cls.split(' '), out = []; + for (var i = 0, c = clss.length; i < c; i++) { + out.push(PhpDebugBar.utils.csscls(clss[i], prefix)); + } + return out.join(' '); + } + if (cls.indexOf('.') === 0) { + return '.' + prefix + cls.substr(1); + } + return prefix + cls; + }; + + /** + * Creates a partial function of csscls where the second + * argument is already defined + * + * @param {string} prefix + * @return {Function} + */ + PhpDebugBar.utils.makecsscls = function(prefix) { + var f = function(cls) { + return PhpDebugBar.utils.csscls(cls, prefix); + }; + return f; + } + + var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-'); + + + // ------------------------------------------------------------------ + + /** + * Base class for all elements with a visual component + * + * @param {Object} options + * @constructor + */ + var Widget = PhpDebugBar.Widget = function(options) { + this._attributes = $.extend({}, this.defaults); + this._boundAttributes = {}; + this.$el = $('<' + this.tagName + ' />'); + if (this.className) { + this.$el.addClass(this.className); + } + this.initialize.apply(this, [options || {}]); + this.render.apply(this); + }; + + $.extend(Widget.prototype, { + + tagName: 'div', + + className: null, + + defaults: {}, + + /** + * Called after the constructor + * + * @param {Object} options + */ + initialize: function(options) { + this.set(options); + }, + + /** + * Called after the constructor to render the element + */ + render: function() {}, + + /** + * Sets the value of an attribute + * + * @param {String} attr Can also be an object to set multiple attributes at once + * @param {Object} value + */ + set: function(attr, value) { + if (typeof(attr) != 'string') { + for (var k in attr) { + this.set(k, attr[k]); + } + return; + } + + this._attributes[attr] = value; + if (typeof(this._boundAttributes[attr]) !== 'undefined') { + for (var i = 0, c = this._boundAttributes[attr].length; i < c; i++) { + this._boundAttributes[attr][i].apply(this, [value]); + } + } + }, + + /** + * Checks if an attribute exists and is not null + * + * @param {String} attr + * @return {[type]} [description] + */ + has: function(attr) { + return typeof(this._attributes[attr]) !== 'undefined' && this._attributes[attr] !== null; + }, + + /** + * Returns the value of an attribute + * + * @param {String} attr + * @return {Object} + */ + get: function(attr) { + return this._attributes[attr]; + }, + + /** + * Registers a callback function that will be called whenever the value of the attribute changes + * + * If cb is a jQuery element, text() will be used to fill the element + * + * @param {String} attr + * @param {Function} cb + */ + bindAttr: function(attr, cb) { + if ($.isArray(attr)) { + for (var i = 0, c = attr.length; i < c; i++) { + this.bindAttr(attr[i], cb); + } + return; + } + + if (typeof(this._boundAttributes[attr]) == 'undefined') { + this._boundAttributes[attr] = []; + } + if (typeof(cb) == 'object') { + var el = cb; + cb = function(value) { el.text(value || ''); }; + } + this._boundAttributes[attr].push(cb); + if (this.has(attr)) { + cb.apply(this, [this._attributes[attr]]); + } + } + + }); + + + /** + * Creates a subclass + * + * Code from Backbone.js + * + * @param {Array} props Prototype properties + * @return {Function} + */ + Widget.extend = function(props) { + var parent = this; + + var child = function() { return parent.apply(this, arguments); }; + $.extend(child, parent); + + var Surrogate = function(){ this.constructor = child; }; + Surrogate.prototype = parent.prototype; + child.prototype = new Surrogate; + $.extend(child.prototype, props); + + child.__super__ = parent.prototype; + + return child; + }; + + // ------------------------------------------------------------------ + + /** + * Tab + * + * A tab is composed of a tab label which is always visible and + * a tab panel which is visible only when the tab is active. + * + * The panel must contain a widget. A widget is an object which has + * an element property containing something appendable to a jQuery object. + * + * Options: + * - title + * - badge + * - widget + * - data: forward data to widget data + */ + var Tab = Widget.extend({ + + className: csscls('panel'), + + render: function() { + this.$tab = $('').addClass(csscls('tab')); + + this.$icon = $('').appendTo(this.$tab); + this.bindAttr('icon', function(icon) { + if (icon) { + this.$icon.attr('class', 'fa fa-' + icon); + } else { + this.$icon.attr('class', ''); + } + }); + + this.bindAttr('title', $('').addClass(csscls('text')).appendTo(this.$tab)); + + this.$badge = $('').addClass(csscls('badge')).appendTo(this.$tab); + this.bindAttr('badge', function(value) { + if (value !== null) { + this.$badge.text(value); + this.$badge.show(); + } else { + this.$badge.hide(); + } + }); + + this.bindAttr('widget', function(widget) { + this.$el.empty().append(widget.$el); + }); + + this.bindAttr('data', function(data) { + if (this.has('widget')) { + this.get('widget').set('data', data); + } + }) + } + + }); + + // ------------------------------------------------------------------ + + /** + * Indicator + * + * An indicator is a text and an icon to display single value information + * right inside the always visible part of the debug bar + * + * Options: + * - icon + * - title + * - tooltip + * - data: alias of title + */ + var Indicator = Widget.extend({ + + tagName: 'span', + + className: csscls('indicator'), + + render: function() { + this.$icon = $('').appendTo(this.$el); + this.bindAttr('icon', function(icon) { + if (icon) { + this.$icon.attr('class', 'fa fa-' + icon); + } else { + this.$icon.attr('class', ''); + } + }); + + this.bindAttr(['title', 'data'], $('').addClass(csscls('text')).appendTo(this.$el)); + + this.$tooltip = $('').addClass(csscls('tooltip disabled')).appendTo(this.$el); + this.bindAttr('tooltip', function(tooltip) { + if (tooltip) { + this.$tooltip.text(tooltip).removeClass(csscls('disabled')); + } else { + this.$tooltip.addClass(csscls('disabled')); + } + }); + } + + }); + + // ------------------------------------------------------------------ + + /** + * Dataset title formater + * + * Formats the title of a dataset for the select box + */ + var DatasetTitleFormater = PhpDebugBar.DatasetTitleFormater = function(debugbar) { + this.debugbar = debugbar; + }; + + $.extend(DatasetTitleFormater.prototype, { + + /** + * Formats the title of a dataset + * + * @this {DatasetTitleFormater} + * @param {String} id + * @param {Object} data + * @param {String} suffix + * @return {String} + */ + format: function(id, data, suffix) { + if (suffix) { + suffix = ' ' + suffix; + } else { + suffix = ''; + } + + var nb = getObjectSize(this.debugbar.datasets) + 1; + + if (typeof(data['__meta']) === 'undefined') { + return "#" + nb + suffix; + } + + var filename = data['__meta']['uri'].substr(data['__meta']['uri'].lastIndexOf('/') + 1); + var label = "#" + nb + " " + filename + suffix + ' (' + data['__meta']['datetime'].split(' ')[1] + ')'; + return label; + } + + }); + + // ------------------------------------------------------------------ + + + /** + * DebugBar + * + * Creates a bar that appends itself to the body of your page + * and sticks to the bottom. + * + * The bar can be customized by adding tabs and indicators. + * A data map is used to fill those controls with data provided + * from datasets. + */ + var DebugBar = PhpDebugBar.DebugBar = Widget.extend({ + + className: "phpdebugbar " + csscls('minimized'), + + options: { + bodyPaddingBottom: true + }, + + initialize: function() { + this.controls = {}; + this.dataMap = {}; + this.datasets = {}; + this.firstTabName = null; + this.activePanelName = null; + this.datesetTitleFormater = new DatasetTitleFormater(this); + this.registerResizeHandler(); + }, + + /** + * Register resize event, for resize debugbar with reponsive css. + * + * @this {DebugBar} + */ + registerResizeHandler: function() { + var f = this.resize.bind(this); + this.respCSSSize = 0; + $(window).resize(f); + setTimeout(f, 20); + }, + + /** + * Resizes the debugbar to fit the current browser window + */ + resize: function() { + var contentSize = this.respCSSSize; + if (this.respCSSSize == 0) { + this.$header.find("> div > *:visible").each(function () { + contentSize += $(this).outerWidth(); + }); + } + + var currentSize = this.$header.width(); + var cssClass = "phpdebugbar-mini-design"; + var bool = this.$header.hasClass(cssClass); + + if (currentSize <= contentSize && !bool) { + this.respCSSSize = contentSize; + this.$header.addClass(cssClass); + } else if (contentSize < currentSize && bool) { + this.respCSSSize = 0; + this.$header.removeClass(cssClass); + } + }, + + /** + * Initialiazes the UI + * + * @this {DebugBar} + */ + render: function() { + var self = this; + this.$el.appendTo('body'); + this.$resizehdle = $('').addClass(csscls('resize-handle')).appendTo(this.$el); + this.$header = $('').addClass(csscls('header')).appendTo(this.$el); + this.$headerLeft = $('').addClass(csscls('header-left')).appendTo(this.$header); + this.$headerRight = $('').addClass(csscls('header-right')).appendTo(this.$header); + var $body = this.$body = $('').addClass(csscls('body')).appendTo(this.$el); + this.recomputeBottomOffset(); + + // dragging of resize handle + var dragging = false; + this.$resizehdle.on('mousedown', function(e) { + var orig_h = $body.height(), pos_y = e.pageY; + dragging = true; + + $body.parents().on('mousemove', function(e) { + if (dragging) { + var h = orig_h + (pos_y - e.pageY); + $body.css('height', h); + localStorage.setItem('phpdebugbar-height', h); + self.recomputeBottomOffset(); + } + }).on('mouseup', function() { + dragging = false; + }); + + e.preventDefault(); + }); + + // minimize button + this.$closebtn = $('').addClass(csscls('close-btn')).appendTo(this.$headerRight); + this.$closebtn.click(function() { + self.close(); + }); + + // minimize button + this.$restorebtn = $('').addClass(csscls('restore-btn')).hide().appendTo(this.$el); + this.$restorebtn.click(function() { + self.restore(); + }); + + // open button + this.$openbtn = $('').addClass(csscls('open-btn')).appendTo(this.$headerRight).hide(); + this.$openbtn.click(function() { + self.openHandler.show(function(id, dataset) { + self.addDataSet(dataset, id, "(opened)"); + self.showTab(); + }); + }); + + // select box for data sets + this.$datasets = $('').addClass(csscls('datasets-switcher')).appendTo(this.$headerRight); + this.$datasets.change(function() { + self.dataChangeHandler(self.datasets[this.value]); + self.showTab(); + }); + }, + + /** + * Restores the state of the DebugBar using localStorage + * This is not called by default in the constructor and + * needs to be called by subclasses in their init() method + * + * @this {DebugBar} + */ + restoreState: function() { + // bar height + var height = localStorage.getItem('phpdebugbar-height'); + if (height) { + this.$body.css('height', height); + } else { + localStorage.setItem('phpdebugbar-height', this.$body.height()); + } + + // bar visibility + var open = localStorage.getItem('phpdebugbar-open'); + if (open && open == '0') { + this.close(); + } else { + var visible = localStorage.getItem('phpdebugbar-visible'); + if (visible && visible == '1') { + var tab = localStorage.getItem('phpdebugbar-tab'); + if (this.isTab(tab)) { + this.showTab(tab); + } + } + } + }, + + /** + * Creates and adds a new tab + * + * @this {DebugBar} + * @param {String} name Internal name + * @param {Object} widget A widget object with an element property + * @param {String} title The text in the tab, if not specified, name will be used + * @return {Tab} + */ + createTab: function(name, widget, title) { + var tab = new Tab({ + title: title || (name.replace(/[_\-]/g, ' ').charAt(0).toUpperCase() + name.slice(1)), + widget: widget + }); + return this.addTab(name, tab); + }, + + /** + * Adds a new tab + * + * @this {DebugBar} + * @param {String} name Internal name + * @param {Tab} tab Tab object + * @return {Tab} + */ + addTab: function(name, tab) { + if (this.isControl(name)) { + throw new Error(name + ' already exists'); + } + + var self = this; + tab.$tab.appendTo(this.$headerLeft).click(function() { + if (!self.isMinimized() && self.activePanelName == name) { + self.minimize(); + } else { + self.showTab(name); + } + }); + tab.$el.appendTo(this.$body); + + this.controls[name] = tab; + if (this.firstTabName == null) { + this.firstTabName = name; + } + return tab; + }, + + /** + * Creates and adds an indicator + * + * @this {DebugBar} + * @param {String} name Internal name + * @param {String} icon + * @param {String} tooltip + * @param {String} position "right" or "left", default is "right" + * @return {Indicator} + */ + createIndicator: function(name, icon, tooltip, position) { + var indicator = new Indicator({ + icon: icon, + tooltip: tooltip + }); + return this.addIndicator(name, indicator, position); + }, + + /** + * Adds an indicator + * + * @this {DebugBar} + * @param {String} name Internal name + * @param {Indicator} indicator Indicator object + * @return {Indicator} + */ + addIndicator: function(name, indicator, position) { + if (this.isControl(name)) { + throw new Error(name + ' already exists'); + } + + if (position == 'left') { + indicator.$el.insertBefore(this.$headerLeft.children().first()); + } else { + indicator.$el.appendTo(this.$headerRight); + } + + this.controls[name] = indicator; + return indicator; + }, + + /** + * Returns a control + * + * @param {String} name + * @return {Object} + */ + getControl: function(name) { + if (this.isControl(name)) { + return this.controls[name]; + } + }, + + /** + * Checks if there's a control under the specified name + * + * @this {DebugBar} + * @param {String} name + * @return {Boolean} + */ + isControl: function(name) { + return typeof(this.controls[name]) != 'undefined'; + }, + + /** + * Checks if a tab with the specified name exists + * + * @this {DebugBar} + * @param {String} name + * @return {Boolean} + */ + isTab: function(name) { + return this.isControl(name) && this.controls[name] instanceof Tab; + }, + + /** + * Checks if an indicator with the specified name exists + * + * @this {DebugBar} + * @param {String} name + * @return {Boolean} + */ + isIndicator: function(name) { + return this.isControl(name) && this.controls[name] instanceof Indicator; + }, + + /** + * Removes all tabs and indicators from the debug bar and hides it + * + * @this {DebugBar} + */ + reset: function() { + this.minimize(); + var self = this; + $.each(this.controls, function(name, control) { + if (self.isTab(name)) { + control.$tab.remove(); + } + control.$el.remove(); + }); + this.controls = {}; + }, + + /** + * Open the debug bar and display the specified tab + * + * @this {DebugBar} + * @param {String} name If not specified, display the first tab + */ + showTab: function(name) { + if (!name) { + if (this.activePanelName) { + name = this.activePanelName; + } else { + name = this.firstTabName; + } + } + + if (!this.isTab(name)) { + throw new Error("Unknown tab '" + name + "'"); + } + + this.$resizehdle.show(); + this.$body.show(); + this.recomputeBottomOffset(); + + $(this.$header).find('> div > .' + csscls('active')).removeClass(csscls('active')); + $(this.$body).find('> .' + csscls('active')).removeClass(csscls('active')); + + this.controls[name].$tab.addClass(csscls('active')); + this.controls[name].$el.addClass(csscls('active')); + this.activePanelName = name; + + this.$el.removeClass(csscls('minimized')); + localStorage.setItem('phpdebugbar-visible', '1'); + localStorage.setItem('phpdebugbar-tab', name); + this.resize(); + }, + + /** + * Hide panels and minimize the debug bar + * + * @this {DebugBar} + */ + minimize: function() { + this.$header.find('> div > .' + csscls('active')).removeClass(csscls('active')); + this.$body.hide(); + this.$resizehdle.hide(); + this.recomputeBottomOffset(); + localStorage.setItem('phpdebugbar-visible', '0'); + this.$el.addClass(csscls('minimized')); + this.resize(); + }, + + /** + * Checks if the panel is minimized + * + * @return {Boolean} + */ + isMinimized: function() { + return this.$el.hasClass(csscls('minimized')); + }, + + /** + * Close the debug bar + * + * @this {DebugBar} + */ + close: function() { + this.$resizehdle.hide(); + this.$header.hide(); + this.$body.hide(); + this.$restorebtn.show(); + localStorage.setItem('phpdebugbar-open', '0'); + this.$el.addClass(csscls('closed')); + this.recomputeBottomOffset(); + }, + + /** + * Restore the debug bar + * + * @this {DebugBar} + */ + restore: function() { + this.$resizehdle.show(); + this.$header.show(); + this.$restorebtn.hide(); + localStorage.setItem('phpdebugbar-open', '1'); + var tab = localStorage.getItem('phpdebugbar-tab'); + if (this.isTab(tab)) { + this.showTab(tab); + } + this.$el.removeClass(csscls('closed')); + this.resize(); + }, + + /** + * Recomputes the padding-bottom css property of the body so + * that the debug bar never hides any content + */ + recomputeBottomOffset: function() { + if (this.options.bodyPaddingBottom) { + $('body').css('padding-bottom', this.$el.height()); + } + }, + + /** + * Sets the data map used by dataChangeHandler to populate + * indicators and widgets + * + * A data map is an object where properties are control names. + * The value of each property should be an array where the first + * item is the name of a property from the data object (nested properties + * can be specified) and the second item the default value. + * + * Example: + * {"memory": ["memory.peak_usage_str", "0B"]} + * + * @this {DebugBar} + * @param {Object} map + */ + setDataMap: function(map) { + this.dataMap = map; + }, + + /** + * Same as setDataMap() but appends to the existing map + * rather than replacing it + * + * @this {DebugBar} + * @param {Object} map + */ + addDataMap: function(map) { + $.extend(this.dataMap, map); + }, + + /** + * Resets datasets and add one set of data + * + * For this method to be usefull, you need to specify + * a dataMap using setDataMap() + * + * @this {DebugBar} + * @param {Object} data + * @return {String} Dataset's id + */ + setData: function(data) { + this.datasets = {}; + return this.addDataSet(data); + }, + + /** + * Adds a dataset + * + * If more than one dataset are added, the dataset selector + * will be displayed. + * + * For this method to be usefull, you need to specify + * a dataMap using setDataMap() + * + * @this {DebugBar} + * @param {Object} data + * @param {String} id The name of this set, optional + * @param {String} suffix + * @return {String} Dataset's id + */ + addDataSet: function(data, id, suffix) { + var label = this.datesetTitleFormater.format(id, data, suffix); + id = id || (getObjectSize(this.datasets) + 1); + this.datasets[id] = data; + + this.$datasets.append($('')); + if (this.$datasets.children().length > 1) { + this.$datasets.show(); + } + + this.showDataSet(id); + return id; + }, + + /** + * Loads a dataset using the open handler + * + * @param {String} id + */ + loadDataSet: function(id, suffix, callback) { + if (!this.openHandler) { + throw new Error('loadDataSet() needs an open handler'); + } + var self = this; + this.openHandler.load(id, function(data) { + self.addDataSet(data, id, suffix); + callback && callback(data); + }); + }, + + /** + * Returns the data from a dataset + * + * @this {DebugBar} + * @param {String} id + * @return {Object} + */ + getDataSet: function(id) { + return this.datasets[id]; + }, + + /** + * Switch the currently displayed dataset + * + * @this {DebugBar} + * @param {String} id + */ + showDataSet: function(id) { + this.dataChangeHandler(this.datasets[id]); + this.$datasets.val(id); + }, + + /** + * Called when the current dataset is modified. + * + * @this {DebugBar} + * @param {Object} data + */ + dataChangeHandler: function(data) { + var self = this; + $.each(this.dataMap, function(key, def) { + var d = getDictValue(data, def[0], def[1]); + if (key.indexOf(':') != -1) { + key = key.split(':'); + self.getControl(key[0]).set(key[1], d); + } else { + self.getControl(key).set('data', d); + } + }); + }, + + /** + * Sets the handler to open past dataset + * + * @this {DebugBar} + * @param {object} handler + */ + setOpenHandler: function(handler) { + this.openHandler = handler; + if (handler !== null) { + this.$openbtn.show(); + } else { + this.$openbtn.hide(); + } + }, + + /** + * Returns the handler to open past dataset + * + * @this {DebugBar} + * @return {object} + */ + getOpenHandler: function() { + return this.openHandler; + } + + }); + + DebugBar.Tab = Tab; + DebugBar.Indicator = Indicator; + + // ------------------------------------------------------------------ + + /** + * AjaxHandler + * + * Extract data from headers of an XMLHttpRequest and adds a new dataset + */ + var AjaxHandler = PhpDebugBar.AjaxHandler = function(debugbar, headerName) { + this.debugbar = debugbar; + this.headerName = headerName || 'phpdebugbar'; + }; + + $.extend(AjaxHandler.prototype, { + + /** + * Handles an XMLHttpRequest + * + * @this {AjaxHandler} + * @param {XMLHttpRequest} xhr + * @return {Bool} + */ + handle: function(xhr) { + if (!this.loadFromId(xhr)) { + return this.loadFromData(xhr); + } + return true; + }, + + /** + * Checks if the HEADER-id exists and loads the dataset using the open handler + * + * @param {XMLHttpRequest} xhr + * @return {Bool} + */ + loadFromId: function(xhr) { + var id = this.extractIdFromHeaders(xhr); + if (id && this.debugbar.openHandler) { + this.debugbar.loadDataSet(id, "(ajax)"); + return true; + } + return false; + }, + + /** + * Extracts the id from the HEADER-id + * + * @param {XMLHttpRequest} xhr + * @return {String} + */ + extractIdFromHeaders: function(xhr) { + return xhr.getResponseHeader(this.headerName + '-id'); + }, + + /** + * Checks if the HEADER exists and loads the dataset + * + * @param {XMLHttpRequest} xhr + * @return {Bool} + */ + loadFromData: function(xhr) { + var raw = this.extractDataFromHeaders(xhr); + if (!raw) { + return false; + } + + var data = this.parseHeaders(raw); + if (data.error) { + throw new Error('Error loading debugbar data: ' + data.error); + } else if(data.data) { + this.debugbar.addDataSet(data.data, data.id, "(ajax)"); + } + return true; + }, + + /** + * Extract the data as a string from headers of an XMLHttpRequest + * + * @this {AjaxHandler} + * @param {XMLHttpRequest} xhr + * @return {string} + */ + extractDataFromHeaders: function(xhr) { + var data = xhr.getResponseHeader(this.headerName); + if (!data) { + return; + } + for (var i = 1;; i++) { + var header = xhr.getResponseHeader(this.headerName + '-' + i); + if (!header) { + break; + } + data += header; + } + return decodeURIComponent(data); + }, + + /** + * Parses the string data into an object + * + * @this {AjaxHandler} + * @param {string} data + * @return {string} + */ + parseHeaders: function(data) { + return JSON.parse(data); + }, + + /** + * Attaches an event listener to jQuery.ajaxComplete() + * + * @this {AjaxHandler} + * @param {jQuery} jq Optional + */ + bindToJquery: function(jq) { + var self = this; + jq(document).ajaxComplete(function(e, xhr, settings) { + if (!settings.ignoreDebugBarAjaxHandler) { + self.handle(xhr); + } + }); + } + + }); + +})(PhpDebugBar.$); diff --git a/public/packages/maximebf/php-debugbar/icons.png b/public/packages/maximebf/php-debugbar/icons.png new file mode 100644 index 0000000000..5dc6d9c8ca Binary files /dev/null and b/public/packages/maximebf/php-debugbar/icons.png differ diff --git a/public/packages/maximebf/php-debugbar/openhandler.css b/public/packages/maximebf/php-debugbar/openhandler.css new file mode 100644 index 0000000000..77c6fadadf --- /dev/null +++ b/public/packages/maximebf/php-debugbar/openhandler.css @@ -0,0 +1,60 @@ +div.phpdebugbar-openhandler-overlay { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: #000; + opacity: .3; + z-index: 20000; +} + +div.phpdebugbar-openhandler { + position: fixed; + margin: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 70%; + height: 70%; + background: #fff; + border: 2px solid #888; + overflow: auto; + z-index: 20001; + font-family: arial; + font-size: 14px; + padding-bottom: 10px; +} + div.phpdebugbar-openhandler .phpdebugbar-openhandler-header { + background: #efefef url(php-icon.png) no-repeat 5px 4px; + padding-left: 29px; + min-height: 26px; + line-height: 25px; + color: #555; + margin-bottom: 10px; + } + div.phpdebugbar-openhandler .phpdebugbar-openhandler-header a { + font-size: 14px; + color: #555; + text-decoration: none; + float: right; + padding: 5px 8px; + } + div.phpdebugbar-openhandler table { + width: 100%; + font-size: 14px; + } + div.phpdebugbar-openhandler table td { + padding: 6px 3px; + text-align: center; + border-bottom: 1px solid #ddd; + } + div.phpdebugbar-openhandler .phpdebugbar-openhandler-actions { + text-align: center; + padding: 7px 0; + } + div.phpdebugbar-openhandler .phpdebugbar-openhandler-actions a { + margin: 0 10px; + color: #555; + } diff --git a/public/packages/maximebf/php-debugbar/openhandler.js b/public/packages/maximebf/php-debugbar/openhandler.js new file mode 100644 index 0000000000..52eff30c53 --- /dev/null +++ b/public/packages/maximebf/php-debugbar/openhandler.js @@ -0,0 +1,191 @@ +if (typeof(PhpDebugBar) == 'undefined') { + // namespace + var PhpDebugBar = {}; + PhpDebugBar.$ = jQuery; +} + +(function($) { + + var csscls = function(cls) { + return PhpDebugBar.utils.csscls(cls, 'phpdebugbar-openhandler-'); + }; + + PhpDebugBar.OpenHandler = PhpDebugBar.Widget.extend({ + + className: 'phpdebugbar-openhandler', + + defaults: { + items_per_page: 20 + }, + + render: function() { + var self = this; + + this.$el.appendTo('body').hide(); + this.$closebtn = $(''); + this.$table = $(''); + $('Load | Method | URL | Date | IP |
---|