Adjusted structure for PDS skeleton.

This commit is contained in:
Andrey Savchenko committed 2018-02-23 15:32:18 +02:00
1 parent 4238509861
commit d92a778d10
17 files changed
+270 -418

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
[![Code Coverage](https://scrutinizer-ci.com/g/Rarst/laps/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Rarst/laps/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/rarst/laps/v/stable)](https://packagist.org/packages/rarst/laps)
[![Total Downloads](https://poser.pugx.org/rarst/laps/downloads)](https://packagist.org/packages/rarst/laps)
[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg)](https://github.com/php-pds/skeleton)
![Laps screenshot](http://i.imgur.com/zFokmkU.png)
+9 -9
View File
@@ -15,10 +15,10 @@ class RoboFile extends \Robo\Tasks {
public function watch() {
$this->taskWatch()
->monitor( [ 'css/variables.less', 'css/laps.less' ], function () {
->monitor( [ 'public/css/variables.less', 'public/css/laps.less' ], function () {
$this->makeCss();
} )
->monitor( 'js/source.js', function () {
->monitor( 'public/js/source.js', function () {
$this->makeJs();
} )
->run();
@@ -39,9 +39,9 @@ class RoboFile extends \Robo\Tasks {
*/
public function makeCss() {
$this->taskExec( 'lessc css/laps.less css/laps.css --source-map=css/laps.css.map' )->run();
$this->taskExec( 'lessc public/css/laps.less public/css/laps.css --source-map=public/css/laps.css.map' )->run();
$this->taskMinify( 'css/laps.css' )
$this->taskMinify( 'public/css/laps.css' )
->run();
}
@@ -52,12 +52,12 @@ class RoboFile extends \Robo\Tasks {
$this->taskConcat( [
'vendor/twbs/bootstrap/js/tooltip.js',
'js/source.js',
'public/js/source.js',
] )
->to( 'js/laps.js' )
->to( 'public/js/laps.js' )
->run();
$this->taskMinify( 'js/laps.js' )
$this->taskMinify( 'public/js/laps.js' )
->run();
}
@@ -65,11 +65,11 @@ class RoboFile extends \Robo\Tasks {
* Compiles plugin's mustache template
*/
public function makeMustache() {
$dir = __DIR__ . '/views/cache';
$dir = __DIR__ . '/src/mustache/cache';
$this->_cleanDir( $dir );
$mustache = new \Mustache_Engine(
array(
'loader' => new \Mustache_Loader_FilesystemLoader( __DIR__ . '/views' ),
'loader' => new \Mustache_Loader_FilesystemLoader( __DIR__ . '/src/mustache' ),
'cache' => $dir,
)
);
+2 -1
View File
@@ -32,6 +32,7 @@
},
"require-dev": {
"twbs/bootstrap": "~3.2",
"brain/monkey" : "^2.2"
"brain/monkey" : "^2.2",
"pds/skeleton": "^1.0"
}
}
Generated
+32 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "6e02995f57446a59552f7e5a84a75278",
"content-hash": "ae3ee3a571959800e23b0be51d700c2c",
"packages": [
{
"name": "composer/installers",
@@ -540,6 +540,37 @@
],
"time": "2017-10-06T16:20:43+00:00"
},
{
"name": "pds/skeleton",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-pds/skeleton.git",
"reference": "95e476e5d629eadacbd721c5a9553e537514a231"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-pds/skeleton/zipball/95e476e5d629eadacbd721c5a9553e537514a231",
"reference": "95e476e5d629eadacbd721c5a9553e537514a231",
"shasum": ""
},
"bin": [
"bin/pds-skeleton"
],
"type": "standard",
"autoload": {
"psr-4": {
"Pds\\Skeleton\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"CC-BY-SA-4.0"
],
"description": "Standard for PHP package skeletons.",
"homepage": "https://github.com/php-pds/skeleton",
"time": "2017-01-25T23:30:41+00:00"
},
{
"name": "twbs/bootstrap",
"version": "v3.3.7",
File renamed without changes.
File renamed without changes.
+83 -83
View File
@@ -1,83 +1,83 @@
@import (reference) "../vendor/twbs/bootstrap/less/variables.less";
@import (reference) "../vendor/twbs/bootstrap/less/mixins.less";
@import (reference) "../vendor/twbs/bootstrap/less/progress-bars.less";
@import (reference) "../vendor/twbs/bootstrap/less/scaffolding.less";
@import "variables.less";
#wpadminbar {
#wp-admin-bar-laps {
.ab-sub-wrapper {
min-width: 90%;
width: 90%;
position: fixed;
left: 5%;
}
.ab-submenu {
padding: 0;
}
}
#wp-admin-bar-laps_output {
padding: 0 10px;
&:hover {
background-color: transparent;
}
.ab-empty-item {
display: none;
}
}
.laps-timeline {
.progress;
margin: 6px 0;
position: relative;
.event {
.progress-bar;
position: absolute; // disable stacking at start
border-left: 1px solid @timeline-bg;
min-width: 2px;
}
.event-theme {
background-color: @event-theme-color;
}
.event-plugin {
background-color: @event-plugin-color;
}
.event-core {
background-color: @event-core-color;
}
.event-query-read {
background-color: @event-info-color;
}
.event-query-write {
background-color: @event-warning-color;
}
.event-http {
background-color: @event-warning-color;
}
.sr-only {
.sr-only;
}
}
@import "../vendor/twbs/bootstrap/less/tooltip.less";
.tooltip.in {
.opacity(1);
}
.tooltip-inner {
line-height: 20px;
text-align: left;
}
}
@import (reference) "../../vendor/twbs/bootstrap/less/variables.less";
@import (reference) "../../vendor/twbs/bootstrap/less/mixins.less";
@import (reference) "../../vendor/twbs/bootstrap/less/progress-bars.less";
@import (reference) "../../vendor/twbs/bootstrap/less/scaffolding.less";
@import "variables.less";
#wpadminbar {
#wp-admin-bar-laps {
.ab-sub-wrapper {
min-width: 90%;
width: 90%;
position: fixed;
left: 5%;
}
.ab-submenu {
padding: 0;
}
}
#wp-admin-bar-laps_output {
padding: 0 10px;
&:hover {
background-color: transparent;
}
.ab-empty-item {
display: none;
}
}
.laps-timeline {
.progress;
margin: 6px 0;
position: relative;
.event {
.progress-bar;
position: absolute; // disable stacking at start
border-left: 1px solid @timeline-bg;
min-width: 2px;
}
.event-theme {
background-color: @event-theme-color;
}
.event-plugin {
background-color: @event-plugin-color;
}
.event-core {
background-color: @event-core-color;
}
.event-query-read {
background-color: @event-info-color;
}
.event-query-write {
background-color: @event-warning-color;
}
.event-http {
background-color: @event-warning-color;
}
.sr-only {
.sr-only;
}
}
@import "../../vendor/twbs/bootstrap/less/tooltip.less";
.tooltip.in {
.opacity(1);
}
.tooltip-inner {
line-height: 20px;
text-align: left;
}
}
View File
File renamed without changes.
@@ -1,21 +1,21 @@
@font-size-small: 12px;
@line-height-computed: 20px;
// colors
@timeline-bg: #f5f5f5;
@event-theme-color: #5cb85c;
@event-plugin-color: #428bca;
@event-core-color: #f0ad4e;
@event-info-color: #5bc0de;
@event-warning-color: #d9534f;
@progress-bg: @timeline-bg;
@progress-bar-bg: @event-info-color;
// because admin bar is 99999
@zindex-tooltip: 100000;
@tooltip-max-width: 300px;
@tooltip-color: #ccc;
@tooltip-bg: #464646;
@tooltip-arrow-width: 5px;
@tooltip-arrow-color: @tooltip-bg;
@font-size-small: 12px;
@line-height-computed: 20px;
// colors
@timeline-bg: #f5f5f5;
@event-theme-color: #5cb85c;
@event-plugin-color: #428bca;
@event-core-color: #f0ad4e;
@event-info-color: #5bc0de;
@event-warning-color: #d9534f;
@progress-bg: @timeline-bg;
@progress-bar-bg: @event-info-color;
// because admin bar is 99999
@zindex-tooltip: 100000;
@tooltip-max-width: 300px;
@tooltip-color: #ccc;
@tooltip-bg: #464646;
@tooltip-arrow-width: 5px;
@tooltip-arrow-color: @tooltip-bg;
@border-radius-base: 4px;
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -22,8 +22,8 @@ class Asset_Manager {
public function enqueue_scripts() {
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_register_script( 'laps', plugins_url( "js/laps{$suffix}.js", dirname( __DIR__ ) ), [ 'jquery' ], '3.3.1', true );
wp_register_style( 'laps', plugins_url( "css/laps{$suffix}.css", dirname( __DIR__ ) ) );
wp_register_script( 'laps', plugins_url( "public/js/laps{$suffix}.js", dirname( __DIR__ ) ), [ 'jquery' ], '3.3.1', true );
wp_register_style( 'laps', plugins_url( "public/css/laps{$suffix}.css", dirname( __DIR__ ) ) );
if ( is_admin_bar_showing() ) {
wp_enqueue_script( 'laps' );
+2 -2
View File
@@ -28,8 +28,8 @@ class Plugin extends Container {
$laps['mustache'] = function () {
return new \Mustache_Engine( [
'loader' => new \Mustache_Loader_FilesystemLoader( dirname( __DIR__ ) . '/views' ),
'cache' => new Mustache_Cache_FrozenCache( dirname( __DIR__ ) . '/views/cache' ),
'loader' => new \Mustache_Loader_FilesystemLoader( dirname( __DIR__ ) . '/src/mustache' ),
'cache' => new Mustache_Cache_FrozenCache( dirname( __DIR__ ) . '/src/mustache/cache' ),
] );
};
@@ -0,0 +1,111 @@
<?php
class __Mustache_a04731de0bb9e043ecde3814b3a901bb extends Mustache_Template
{
private $lambdaHelper;
public function renderInternal(Mustache_Context $context, $indent = '')
{
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
$buffer = '';
// 'timelines' section
$value = $context->find('timelines');
$buffer .= $this->sectionAdac57c50f147efcda3ea1c17e7a6c61($context, $indent, $value);
return $buffer;
}
private function section9f1840fed1e29fb14453f0ea2bfe30ad(Mustache_Context $context, $indent, $value)
{
$buffer = '';
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="event event-{{category}}" data-toggle="tooltip" title="{{description}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{description}}</span>
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . ' <div class="event event-';
$value = $this->resolveValue($context->find('category'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" data-toggle="tooltip" title="';
$value = $this->resolveValue($context->find('description'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" style="width:';
$value = $this->resolveValue($context->find('width'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%; left:';
$value = $this->resolveValue($context->find('offset'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%;">
';
$buffer .= $indent . ' <span class="sr-only">';
$value = $this->resolveValue($context->find('description'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '</span>
';
$buffer .= $indent . ' </div>
';
$context->pop();
}
}
return $buffer;
}
private function sectionAdac57c50f147efcda3ea1c17e7a6c61(Mustache_Context $context, $indent, $value)
{
$buffer = '';
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="laps-timeline">
{{#.}}
<div class="event event-{{category}}" data-toggle="tooltip" title="{{description}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{description}}</span>
</div>
{{/.}}
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . ' <div class="laps-timeline">
';
// '.' section
$value = $context->last('.');
$buffer .= $this->section9f1840fed1e29fb14453f0ea2bfe30ad($context, $indent, $value);
$buffer .= $indent . ' </div>
';
$context->pop();
}
}
return $buffer;
}
}
@@ -1,9 +1,9 @@
{{#timelines}}
<div class="laps-timeline">
{{#.}}
<div class="event event-{{category}}" data-toggle="tooltip" title="{{description}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{description}}</span>
</div>
{{/.}}
</div>
{{#timelines}}
<div class="laps-timeline">
{{#.}}
<div class="event event-{{category}}" data-toggle="tooltip" title="{{description}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{description}}</span>
</div>
{{/.}}
</div>
{{/timelines}}
@@ -1,292 +0,0 @@
<?php
class __Mustache_797f2a84b9a5a7b601644494da75d61e extends Mustache_Template
{
private $lambdaHelper;
public function renderInternal(Mustache_Context $context, $indent = '')
{
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
$buffer = '';
$blocksContext = array();
$buffer .= $indent . '<div class="laps-timeline">
';
// 'events' section
$value = $context->find('events');
$buffer .= $this->section940385acb9865793d8943db356869c18($context, $indent, $value);
$buffer .= $indent . '</div>
';
$buffer .= $indent . '
';
// 'savequeries' section
$value = $context->find('savequeries');
$buffer .= $this->sectionB93c1beb6bc5c41326a972381b0dd94a($context, $indent, $value);
$buffer .= $indent . '
';
// 'savehttp' section
$value = $context->find('savehttp');
$buffer .= $this->section238f05e38d8d133266503e545e18de7e($context, $indent, $value);
return $buffer;
}
private function section940385acb9865793d8943db356869c18(Mustache_Context $context, $indent, $value)
{
$buffer = '';
$blocksContext = array();
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="event event-{{category}}" data-toggle="tooltip" title="{{name}} - {{duration}} ms - {{memory}} MB" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{name}} - {{duration}} ms - {{memory}} MB</span>
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . ' <div class="event event-';
$value = $this->resolveValue($context->find('category'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" data-toggle="tooltip" title="';
$value = $this->resolveValue($context->find('name'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' - ';
$value = $this->resolveValue($context->find('duration'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' ms - ';
$value = $this->resolveValue($context->find('memory'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' MB" style="width:';
$value = $this->resolveValue($context->find('width'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%; left:';
$value = $this->resolveValue($context->find('offset'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%;">
';
$buffer .= $indent . ' <span class="sr-only">';
$value = $this->resolveValue($context->find('name'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' - ';
$value = $this->resolveValue($context->find('duration'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' ms - ';
$value = $this->resolveValue($context->find('memory'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' MB</span>
';
$buffer .= $indent . ' </div>
';
$context->pop();
}
}
return $buffer;
}
private function section372053fedd826e7e297c29f607930cbc(Mustache_Context $context, $indent, $value)
{
$buffer = '';
$blocksContext = array();
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="event event-{{category}}" title="{{sql}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{sql}}</span>
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . ' <div class="event event-';
$value = $this->resolveValue($context->find('category'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" title="';
$value = $this->resolveValue($context->find('sql'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" style="width:';
$value = $this->resolveValue($context->find('width'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%; left:';
$value = $this->resolveValue($context->find('offset'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%;">
';
$buffer .= $indent . ' <span class="sr-only">';
$value = $this->resolveValue($context->find('sql'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '</span>
';
$buffer .= $indent . ' </div>
';
$context->pop();
}
}
return $buffer;
}
private function sectionB93c1beb6bc5c41326a972381b0dd94a(Mustache_Context $context, $indent, $value)
{
$buffer = '';
$blocksContext = array();
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="laps-timeline">
{{#queries}}
<div class="event event-{{category}}" title="{{sql}}" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{sql}}</span>
</div>
{{/queries}}
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . '<div class="laps-timeline">
';
// 'queries' section
$value = $context->find('queries');
$buffer .= $this->section372053fedd826e7e297c29f607930cbc($context, $indent, $value);
$buffer .= $indent . '</div>
';
$context->pop();
}
}
return $buffer;
}
private function section26362c0132f6d74333e6154005595603(Mustache_Context $context, $indent, $value)
{
$buffer = '';
$blocksContext = array();
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="event event-{{category}}" title="{{name}} - {{duration}} ms" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{name}} - {{duration}} ms</span>
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . ' <div class="event event-';
$value = $this->resolveValue($context->find('category'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '" title="';
$value = $this->resolveValue($context->find('name'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' - ';
$value = $this->resolveValue($context->find('duration'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' ms" style="width:';
$value = $this->resolveValue($context->find('width'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%; left:';
$value = $this->resolveValue($context->find('offset'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= '%;">
';
$buffer .= $indent . ' <span class="sr-only">';
$value = $this->resolveValue($context->find('name'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' - ';
$value = $this->resolveValue($context->find('duration'), $context);
$buffer .= htmlspecialchars($value, 2, 'UTF-8');
$buffer .= ' ms</span>
';
$buffer .= $indent . ' </div>
';
$context->pop();
}
}
return $buffer;
}
private function section238f05e38d8d133266503e545e18de7e(Mustache_Context $context, $indent, $value)
{
$buffer = '';
$blocksContext = array();
if (!is_string($value) && is_callable($value)) {
$source = '
<div class="laps-timeline">
{{#http}}
<div class="event event-{{category}}" title="{{name}} - {{duration}} ms" style="width:{{width}}%; left:{{offset}}%;">
<span class="sr-only">{{name}} - {{duration}} ms</span>
</div>
{{/http}}
</div>
';
$result = call_user_func($value, $source, $this->lambdaHelper);
if (strpos($result, '{{') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result)
->renderInternal($context);
}
} elseif (!empty($value)) {
$values = $this->isIterable($value) ? $value : array($value);
foreach ($values as $value) {
$context->push($value);
$buffer .= $indent . '<div class="laps-timeline">
';
// 'http' section
$value = $context->find('http');
$buffer .= $this->section26362c0132f6d74333e6154005595603($context, $indent, $value);
$buffer .= $indent . '</div>
';
$context->pop();
}
}
return $buffer;
}
}