primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,12 @@
@charset "UTF-8";
div.phpdebugbar-widgets-mails span.phpdebugbar-widgets-subject {
display: block;
}
div.phpdebugbar-widgets-mails li.phpdebugbar-widgets-list-item pre.phpdebugbar-widgets-headers {
border: 1px solid #ddd;
margin: 10px;
padding: 5px;
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
display: none;
}

View File

@ -0,0 +1,63 @@
(function($) {
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
/**
* Widget for the displaying mails data
*
* Options:
* - data
*/
var MailsWidget = PhpDebugBar.Widgets.MailsWidget = PhpDebugBar.Widget.extend({
className: csscls('mails'),
render: function() {
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, mail) {
$('<span />').addClass(csscls('subject')).text(mail.subject).appendTo(li);
$('<span />').addClass(csscls('to')).text(mail.to).appendTo(li);
if (mail.body || mail.html) {
var header = $('<span />').addClass(csscls('filename')).text('');
$('<a title="Mail Preview">View Mail</a>').on('click', function () {
var popup = window.open('about:blank', 'Mail Preview', 'width=650,height=440,scrollbars=yes');
var documentToWriteTo = popup.document;
var headers = !mail.headers ? '' : $('<pre style="border: 1px solid #ddd; padding: 5px;" />')
.append($('<code />').text(mail.headers));
var body = $('<pre style="border: 1px solid #ddd; padding: 5px;" />').text(mail.body)
var html = null;
if (mail.html) {
body = $('<details />').append($('<summary>Text version</summary>')).append(body);
html = $('<iframe width="100%" height="400px" sandbox="" referrerpolicy="no-referrer"/>').attr("srcdoc", mail.html)
}
documentToWriteTo.open();
documentToWriteTo.write(headers.prop('outerHTML') + body.prop('outerHTML') + (html ? html.prop('outerHTML') : ''));
documentToWriteTo.close();
}).addClass(csscls('editor-link')).appendTo(header);
header.appendTo(li);
}
if (mail.headers) {
var headers = $('<pre />').addClass(csscls('headers')).appendTo(li);
$('<code />').text(mail.headers).appendTo(headers);
li.click(function() {
if (headers.is(':visible')) {
headers.hide();
} else {
headers.show();
}
});
}
}});
this.$list.$el.appendTo(this.$el);
this.bindAttr('data', function(data) {
this.$list.set('data', data);
});
}
});
})(PhpDebugBar.$);

View File

@ -0,0 +1 @@
@charset "UTF-8";div.phpdebugbar-widgets-mails span.phpdebugbar-widgets-subject{display:block}div.phpdebugbar-widgets-mails li.phpdebugbar-widgets-list-item pre.phpdebugbar-widgets-headers{border:1px solid #ddd;margin:10px;padding:5px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;display:none}

Binary file not shown.

View File

@ -0,0 +1 @@
(function(e){var s=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),c=PhpDebugBar.Widgets.MailsWidget=PhpDebugBar.Widget.extend({className:s("mails"),render:function(){this.$list=new PhpDebugBar.Widgets.ListWidget({itemRenderer:function(d,t){if(e("<span />").addClass(s("subject")).text(t.subject).appendTo(d),e("<span />").addClass(s("to")).text(t.to).appendTo(d),t.body||t.html){var o=e("<span />").addClass(s("filename")).text("");e('<a title="Mail Preview">View Mail</a>').on("click",function(){var n=window.open("about:blank","Mail Preview","width=650,height=440,scrollbars=yes"),r=n.document,l=t.headers?e('<pre style="border: 1px solid #ddd; padding: 5px;" />').append(e("<code />").text(t.headers)):"",p=e('<pre style="border: 1px solid #ddd; padding: 5px;" />').text(t.body),i=null;t.html&&(p=e("<details />").append(e("<summary>Text version</summary>")).append(p),i=e('<iframe width="100%" height="400px" sandbox="" referrerpolicy="no-referrer"/>').attr("srcdoc",t.html)),r.open(),r.write(l.prop("outerHTML")+p.prop("outerHTML")+(i?i.prop("outerHTML"):"")),r.close()}).addClass(s("editor-link")).appendTo(o),o.appendTo(d)}if(t.headers){var a=e("<pre />").addClass(s("headers")).appendTo(d);e("<code />").text(t.headers).appendTo(a),d.click(function(){a.is(":visible")?a.hide():a.show()})}}}),this.$list.$el.appendTo(this.$el),this.bindAttr("data",function(d){this.$list.set("data",d)})}})})(PhpDebugBar.$);

Binary file not shown.

View File

@ -0,0 +1,162 @@
@charset "UTF-8";
div.phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-status {
color: #555;
background: #fafafa;
border-bottom: 1px solid #ddd;
padding: 6px;
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
font-weight: bold;
}
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-error {
color: red;
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id {
float: right;
color: #888;
margin-left: 8px;
}
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-database, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-duration, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-row-count, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-copy-clipboard, div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-stmt-id {
color: #555;
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before, div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before, div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before {
margin-right: 4px;
font-family: PhpDebugbarFontAwesome;
font-size: 12px;
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard-check:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:before {
content: "";
}
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link {
color: #888;
}
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-editor-link:hover {
color: #aaa;
}
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params {
border-collapse: collapse;
border: 1px solid #ddd;
width: 70%;
margin: 10px;
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
display: none;
}
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params td {
text-align: center;
border: 1px solid #ddd;
}
div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params .phpdebugbar-widgets-name {
width: 20%;
font-weight: bold;
}
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-error {
font-weight: bold;
display: block;
}
code.phpdebugbar-widgets-sql {
white-space: pre-wrap;
overflow-wrap: break-word;
word-wrap: break-word;
}
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate {
background-color: #edeff0;
}
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate:hover {
background-color: #ffc;
}
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar {
z-index: 1;
width: calc(100% - 30px);
margin-bottom: 5px;
display: none;
position: fixed;
bottom: 0;
}
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter {
float: right;
color: #fff;
background: #7cacd5;
border-radius: 4px;
margin: 0 2px;
padding: 2px 4px;
font-size: 12px;
text-decoration: none;
}
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter.phpdebugbar-widgets-excluded {
color: #888;
background: #eee;
}
div.phpdebugbar-widgets-sqlqueries a.phpdebugbar-widgets-duplicates {
font-weight: bold;
text-decoration: underline;
}
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item div.phpdebugbar-widgets-bg-measure {
pointer-events: none;
width: 100%;
height: 100%;
position: absolute;
top: 0;
overflow: hidden;
}
div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-bg-measure div.phpdebugbar-widgets-value {
opacity: .2;
background: red;
height: 100%;
position: absolute;
}
div.phpdebugbar-widgets-sqlqueries td.phpdebugbar-widgets-value li.phpdebugbar-widgets-table-list-item {
text-align: left;
padding-left: 6px;
}
div.phpdebugbar-widgets-sqlqueries .phpdebugbar-text-muted {
color: #888;
}

View File

@ -0,0 +1,240 @@
(function($) {
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
/**
* Widget for the displaying sql queries
*
* Options:
* - data
*/
var SQLQueriesWidget = PhpDebugBar.Widgets.SQLQueriesWidget = PhpDebugBar.Widget.extend({
className: csscls('sqlqueries'),
onFilterClick: function(el) {
$(el).toggleClass(csscls('excluded'));
this.$list.$el.find("li[connection=" + $(el).attr("rel") + "]").toggle();
},
onCopyToClipboard: function (el) {
var code = $(el).parent('li').find('code').get(0);
var copy = function () {
try {
document.execCommand('copy');
$(el).addClass(csscls('copy-clipboard-check'));
setTimeout(function(){
$(el).removeClass(csscls('copy-clipboard-check'));
}, 2000)
} catch (err) {
console.log('Oops, unable to copy');
}
};
var select = function (node) {
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(node);
range.select();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNodeContents(node);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
copy();
window.getSelection().removeAllRanges();
};
select(code);
},
renderList: function (caption, icon, data) {
var $ul = $('<ul />').addClass(csscls('table-list')), $parts;
var $li = $('<li />').addClass(csscls('table-list-item'));
var $span = $('<span />').addClass('phpdebugbar-text-muted');
for (var key in data) {
var value = typeof data[key] === 'function' ? data[key].name + ' {}' : data[key];
$li.clone().append(typeof value === 'object' && value !== null
? [$span.clone().text(value.index || key).append('.'), '&nbsp;']
.concat(value.namespace ? [value.namespace + '::'] : [])
.concat([value.name || value.file])
.concat(value.line ? [$span.clone().text(':' + value.line)] : [])
: [$span.clone().text(key + ':'), '&nbsp;', value]
).appendTo($ul);
}
caption += icon ? ' <i class="phpdebugbar-fa phpdebugbar-fa-' + icon + ' phpdebugbar-text-muted"></i>' : '';
return $('<tr />').append(
$('<td />').addClass(csscls('name')).html(caption),
$('<td />').addClass(csscls('value')).append($ul)
);
},
render: function() {
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el);
this.$toolbar = $('<div />').addClass(csscls('toolbar')).appendTo(this.$el);
var filters = [], self = this;
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, stmt) {
if (stmt.type === 'transaction') {
$('<strong />').addClass(csscls('sql')).addClass(csscls('name')).text(stmt.sql).appendTo(li);
} else {
$('<code />').addClass(csscls('sql')).html(PhpDebugBar.Widgets.highlight(stmt.sql, 'sql')).appendTo(li);
}
if (stmt.width_percent) {
$('<div />').addClass(csscls('bg-measure')).append(
$('<div />').addClass(csscls('value')).css({
left: stmt.start_percent + '%',
width: Math.max(stmt.width_percent, 0.01) + '%',
})
).appendTo(li);
}
if (stmt.duration_str) {
$('<span title="Duration" />').addClass(csscls('duration')).text(stmt.duration_str).appendTo(li);
}
if (stmt.memory_str) {
$('<span title="Memory usage" />').addClass(csscls('memory')).text(stmt.memory_str).appendTo(li);
}
if (typeof(stmt.row_count) != 'undefined') {
$('<span title="Row count" />').addClass(csscls('row-count')).text(stmt.row_count).appendTo(li);
}
if (typeof(stmt.stmt_id) != 'undefined' && stmt.stmt_id) {
$('<span title="Prepared statement ID" />').addClass(csscls('stmt-id')).text(stmt.stmt_id).appendTo(li);
}
if (stmt.connection) {
$('<span title="Connection" />').addClass(csscls('database')).text(stmt.connection).appendTo(li);
li.attr("connection",stmt.connection);
if ( $.inArray(stmt.connection, filters) == -1 ) {
filters.push(stmt.connection);
$('<a />')
.addClass(csscls('filter'))
.text(stmt.connection)
.attr('rel', stmt.connection)
.on('click', function() { self.onFilterClick(this); })
.appendTo(self.$toolbar);
if (filters.length>1) {
self.$toolbar.show();
self.$list.$el.css("margin-bottom","20px");
}
}
}
if (typeof(stmt.is_success) != 'undefined' && !stmt.is_success) {
li.addClass(csscls('error'));
li.append($('<span />').addClass(csscls('error')).text("[" + stmt.error_code + "] " + stmt.error_message));
}
if ((!stmt.type || stmt.type === 'query')) {
$('<span title="Copy to clipboard" />')
.addClass(csscls('copy-clipboard'))
.css('cursor', 'pointer')
.html("&#8203;")
.on('click', function (event) {
self.onCopyToClipboard(this);
event.stopPropagation();
})
.appendTo(li);
}
if (typeof(stmt.xdebug_link) !== 'undefined' && stmt.xdebug_link) {
var header = $('<span title="Filename" />').addClass(csscls('filename')).text(stmt.xdebug_link.filename + ( stmt.xdebug_link.line ? "#" + stmt.xdebug_link.line : ''));
$('<a href="' + stmt.xdebug_link.url + '"></a>').on('click', function () {
event.stopPropagation();
if (stmt.xdebug_link.ajax) {
fetch(stmt.xdebug_link.url);
event.preventDefault();
}
}).addClass(csscls('editor-link')).appendTo(header);
header.appendTo(li);
}
var table = $('<table></table>').addClass(csscls('params'));
if (stmt.params && !$.isEmptyObject(stmt.params)) {
self.renderList('Params', 'thumb-tack', stmt.params).appendTo(table);
}
if (stmt.bindings && !$.isEmptyObject(stmt.bindings)) {
self.renderList('Bindings', 'thumb-tack', stmt.bindings).appendTo(table);
}
if (stmt.hints && !$.isEmptyObject(stmt.hints)) {
self.renderList('Hints', 'question-circle', stmt.hints).appendTo(table);
}
if (stmt.backtrace && !$.isEmptyObject(stmt.backtrace)) {
self.renderList('Backtrace', 'list-ul', stmt.backtrace).appendTo(table);
}
if (table.find('tr').length) {
table.appendTo(li);
li.css('cursor', 'pointer').click(function() {
if (window.getSelection().type == "Range") {
return''
}
if (table.is(':visible')) {
table.hide();
} else {
table.show();
}
});
}
}});
this.$list.$el.appendTo(this.$el);
this.bindAttr('data', function(data) {
// the PDO collector maybe is empty
if (data.length <= 0 || !data.statements) {
return false;
}
filters = [];
this.$toolbar.hide().find(csscls('.filter')).remove();
this.$list.set('data', data.statements);
this.$status.empty();
// Search for duplicate statements.
for (var sql = {}, duplicate = 0, i = 0; i < data.statements.length; i++) {
if (data.statements[i].type && data.statements[i].type !== 'query') {
continue;
}
var stmt = data.statements[i].sql;
if (data.statements[i].params && !$.isEmptyObject(data.statements[i].params)) {
stmt += JSON.stringify(data.statements[i].params);
}
if (data.statements[i].bindings && !$.isEmptyObject(data.statements[i].bindings)) {
stmt += JSON.stringify(data.statements[i].bindings);
}
if (data.statements[i].connection) {
stmt += '@' + data.statements[i].connection;
}
sql[stmt] = sql[stmt] || { keys: [] };
sql[stmt].keys.push(i);
}
// Add classes to all duplicate SQL statements.
for (var stmt in sql) {
if (sql[stmt].keys.length > 1) {
duplicate += sql[stmt].keys.length;
for (var i = 0; i < sql[stmt].keys.length; i++) {
this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i])
.addClass(csscls('sql-duplicate'));
}
}
}
var t = $('<span />').text(data.nb_statements + " statements were executed").appendTo(this.$status);
if (data.nb_failed_statements) {
t.append(", " + data.nb_failed_statements + " of which failed");
}
if (duplicate) {
t.append(", " + duplicate + " of which were duplicates");
t.append(", " + (data.nb_statements - duplicate) + " unique. ");
// add toggler for displaying only duplicated queries
var duplicatedText = 'Show only duplicated';
$('<a />').addClass(csscls('duplicates')).click(function () {
$(this).toggleClass('shown-duplicated')
.text($(this).hasClass('shown-duplicated') ? 'Show All' : duplicatedText);
$('.' + self.className + ' .' + csscls('list-item'))
.not('.' + csscls('sql-duplicate')).toggle();
}).text(duplicatedText).appendTo(t);
}
if (data.accumulated_duration_str) {
this.$status.append($('<span title="Accumulated duration" />').addClass(csscls('duration')).text(data.accumulated_duration_str));
}
if (data.memory_usage_str) {
this.$status.append($('<span title="Memory usage" />').addClass(csscls('memory')).text(data.memory_usage_str));
}
});
}
});
})(PhpDebugBar.$);

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,69 @@
@charset "UTF-8";
div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status {
color: #555;
background: #fafafa;
border-bottom: 1px solid #ddd;
padding: 6px;
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
font-weight: bold;
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count, div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type {
float: right;
color: #888;
margin-left: 8px;
}
div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-render-time, div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory, div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-param-count, div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status a.phpdebugbar-widgets-editor-link, div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-type {
color: #555;
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before, div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before, div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before, div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before {
margin-right: 4px;
font-family: PhpDebugbarFontAwesome;
font-size: 12px;
}
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:hover {
color: #aaa;
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before {
content: "";
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before {
content: "";
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before {
content: "";
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before {
content: "";
}
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before {
content: "";
margin-left: 4px;
}
div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params {
border-collapse: collapse;
border: 1px solid #ddd;
width: 70%;
margin: 10px;
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
display: none;
}
div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params td {
border: 1px solid #ddd;
padding: 0 5px;
}
div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params .phpdebugbar-widgets-name {
width: 20%;
font-weight: bold;
}

View File

@ -0,0 +1,103 @@
(function($) {
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
/**
* Widget for the displaying templates data
*
* Options:
* - data
*/
var TemplatesWidget = PhpDebugBar.Widgets.TemplatesWidget = PhpDebugBar.Widget.extend({
className: csscls('templates'),
render: function() {
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el);
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, tpl) {
$('<span />').addClass(csscls('name')).text(tpl.name).appendTo(li);
if (typeof tpl.xdebug_link !== 'undefined' && tpl.xdebug_link !== null) {
var header = $('<span />').addClass(csscls('filename')).text(tpl.xdebug_link.filename + ( tpl.xdebug_link.line ? "#" + tpl.xdebug_link.line : ''));
if (tpl.xdebug_link) {
if (tpl.xdebug_link.ajax) {
$('<a title="' + tpl.xdebug_link.url + '"></a>').on('click', function () {
fetch(tpl.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);
}
}
header.appendTo(li);
}
if (tpl.render_time_str) {
$('<span title="Render time" />').addClass(csscls('render-time')).text(tpl.render_time_str).appendTo(li);
}
if (tpl.memory_str) {
$('<span title="Memory usage" />').addClass(csscls('memory')).text(tpl.memory_str).appendTo(li);
}
if (typeof(tpl.param_count) != 'undefined') {
$('<span title="Parameter count" />').addClass(csscls('param-count')).text(tpl.param_count).appendTo(li);
}
if (typeof(tpl.type) != 'undefined' && tpl.type) {
$('<span title="Type" />').addClass(csscls('type')).text(tpl.type).appendTo(li);
}
if (typeof(tpl.editorLink) != 'undefined' && tpl.editorLink) {
$('<a href="'+ tpl.editorLink +'" />').on('click', function (event) {
event.stopPropagation();
}).addClass(csscls('editor-link')).text('file').appendTo(li);
}
if (tpl.params && !$.isEmptyObject(tpl.params)) {
var table = $('<table><tr><th colspan="2">Params</th></tr></table>').addClass(csscls('params')).appendTo(li);
for (var key in tpl.params) {
if (typeof tpl.params[key] !== 'function') {
table.append('<tr><td class="' + csscls('name') + '">' + key + '</td><td class="' + csscls('value') +
'"><pre><code>' + tpl.params[key] + '</code></pre></td></tr>');
}
}
li.css('cursor', 'pointer').click(function() {
if (window.getSelection().type == "Range") {
return''
}
if (table.is(':visible')) {
table.hide();
} else {
table.show();
}
});
}
}});
this.$list.$el.appendTo(this.$el);
this.$callgraph = $('<div />').addClass(csscls('callgraph')).appendTo(this.$el);
this.bindAttr('data', function(data) {
this.$list.set('data', data.templates);
this.$status.empty();
this.$callgraph.empty();
var sentence = data.sentence || "templates were rendered";
$('<span />').text(data.nb_templates + " " + sentence).appendTo(this.$status);
if (data.accumulated_render_time_str) {
this.$status.append($('<span title="Accumulated render time" />').addClass(csscls('render-time')).text(data.accumulated_render_time_str));
}
if (data.memory_usage_str) {
this.$status.append($('<span title="Memory usage" />').addClass(csscls('memory')).text(data.memory_usage_str));
}
if (data.nb_blocks > 0) {
$('<div />').text(data.nb_blocks + " blocks were rendered").appendTo(this.$status);
}
if (data.nb_macros > 0) {
$('<div />').text(data.nb_macros + " macros were rendered").appendTo(this.$status);
}
if (typeof data.callgraph !== 'undefined') {
this.$callgraph.html(data.callgraph);
}
});
}
});
})(PhpDebugBar.$);

View File

@ -0,0 +1 @@
@charset "UTF-8";div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status{color:#555;background:#fafafa;border-bottom:1px solid #ddd;padding:6px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-weight:700}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count,div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type{float:right;color:#888;margin-left:8px}div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-render-time,div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory,div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-param-count,div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status a.phpdebugbar-widgets-editor-link,div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-type{color:#555}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before,div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before,div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before,div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before{margin-right:4px;font-family:PhpDebugbarFontAwesome;font-size:12px}div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:hover{color:#aaa}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before{content:""}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before{content:""}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before{content:""}div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before{content:""}div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before{content:"";margin-left:4px}div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params{border-collapse:collapse;border:1px solid #ddd;width:70%;margin:10px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;display:none}div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params td{border:1px solid #ddd;padding:0 5px}div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params .phpdebugbar-widgets-name{width:20%;font-weight:700}

Binary file not shown.

View File

@ -0,0 +1 @@
(function(t){var a=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-"),p=PhpDebugBar.Widgets.TemplatesWidget=PhpDebugBar.Widget.extend({className:a("templates"),render:function(){this.$status=t("<div />").addClass(a("status")).appendTo(this.$el),this.$list=new PhpDebugBar.Widgets.ListWidget({itemRenderer:function(s,e){if(t("<span />").addClass(a("name")).text(e.name).appendTo(s),typeof e.xdebug_link<"u"&&e.xdebug_link!==null){var i=t("<span />").addClass(a("filename")).text(e.xdebug_link.filename+(e.xdebug_link.line?"#"+e.xdebug_link.line:""));e.xdebug_link&&(e.xdebug_link.ajax?t('<a title="'+e.xdebug_link.url+'"></a>').on("click",function(){fetch(e.xdebug_link.url)}).addClass(a("editor-link")).appendTo(i):t('<a href="'+e.xdebug_link.url+'"></a>').addClass(a("editor-link")).appendTo(i)),i.appendTo(s)}if(e.render_time_str&&t('<span title="Render time" />').addClass(a("render-time")).text(e.render_time_str).appendTo(s),e.memory_str&&t('<span title="Memory usage" />').addClass(a("memory")).text(e.memory_str).appendTo(s),typeof e.param_count<"u"&&t('<span title="Parameter count" />').addClass(a("param-count")).text(e.param_count).appendTo(s),typeof e.type<"u"&&e.type&&t('<span title="Type" />').addClass(a("type")).text(e.type).appendTo(s),typeof e.editorLink<"u"&&e.editorLink&&t('<a href="'+e.editorLink+'" />').on("click",function(r){r.stopPropagation()}).addClass(a("editor-link")).text("file").appendTo(s),e.params&&!t.isEmptyObject(e.params)){var n=t('<table><tr><th colspan="2">Params</th></tr></table>').addClass(a("params")).appendTo(s);for(var d in e.params)typeof e.params[d]!="function"&&n.append('<tr><td class="'+a("name")+'">'+d+'</td><td class="'+a("value")+'"><pre><code>'+e.params[d]+"</code></pre></td></tr>");s.css("cursor","pointer").click(function(){if(window.getSelection().type=="Range")return"";n.is(":visible")?n.hide():n.show()})}}}),this.$list.$el.appendTo(this.$el),this.$callgraph=t("<div />").addClass(a("callgraph")).appendTo(this.$el),this.bindAttr("data",function(s){this.$list.set("data",s.templates),this.$status.empty(),this.$callgraph.empty();var e=s.sentence||"templates were rendered";t("<span />").text(s.nb_templates+" "+e).appendTo(this.$status),s.accumulated_render_time_str&&this.$status.append(t('<span title="Accumulated render time" />').addClass(a("render-time")).text(s.accumulated_render_time_str)),s.memory_usage_str&&this.$status.append(t('<span title="Memory usage" />').addClass(a("memory")).text(s.memory_usage_str)),s.nb_blocks>0&&t("<div />").text(s.nb_blocks+" blocks were rendered").appendTo(this.$status),s.nb_macros>0&&t("<div />").text(s.nb_macros+" macros were rendered").appendTo(this.$status),typeof s.callgraph<"u"&&this.$callgraph.html(s.callgraph)})}})})(PhpDebugBar.$);

Binary file not shown.