Updated for coding style
This commit is contained in:
1 parent
b7028e1f5a
commit
0ed37d4d92
2 files changed
+18
-9
No files matched your search
@@ -29,7 +29,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( file_exists( __DIR__ . '/vendor/autoload.php' ) )
|
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) )
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
Rarst\Laps\Laps::on_load();
|
Rarst\Laps\Laps::on_load();
|
||||||
+17
-8
@@ -90,10 +90,13 @@ class Laps {
|
|||||||
$filter = current_filter();
|
$filter = current_filter();
|
||||||
$priority = key( $wp_filter[$filter] );
|
$priority = key( $wp_filter[$filter] );
|
||||||
|
|
||||||
$event = wp_parse_args( self::$events[$filter][$priority], array(
|
$event = wp_parse_args(
|
||||||
|
self::$events[$filter][$priority],
|
||||||
|
array(
|
||||||
'action' => 'start',
|
'action' => 'start',
|
||||||
'category' => null,
|
'category' => null,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
self::$stopwatch->$event['action']( $event['event'], $event['category'] );
|
self::$stopwatch->$event['action']( $event['event'], $event['category'] );
|
||||||
|
|
||||||
@@ -183,9 +186,11 @@ class Laps {
|
|||||||
|
|
||||||
global $timestart, $wpdb;
|
global $timestart, $wpdb;
|
||||||
|
|
||||||
$mustache = new \Mustache_Engine( array(
|
$mustache = new \Mustache_Engine(
|
||||||
|
array(
|
||||||
'loader' => new \Mustache_Loader_FilesystemLoader( dirname( __DIR__ ) . '/views' ),
|
'loader' => new \Mustache_Loader_FilesystemLoader( dirname( __DIR__ ) . '/views' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$events = self::$stopwatch->getSectionEvents( '__root__' );
|
$events = self::$stopwatch->getSectionEvents( '__root__' );
|
||||||
$start = $timestart * 1000;
|
$start = $timestart * 1000;
|
||||||
@@ -262,15 +267,19 @@ class Laps {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_node( array(
|
$wp_admin_bar->add_node(
|
||||||
|
array(
|
||||||
'id' => 'laps',
|
'id' => 'laps',
|
||||||
'title' => sprintf( 'Lap: %ss', round( $total / 1000, 3 ) ),
|
'title' => sprintf( 'Lap: %ss', round( $total / 1000, 3 ) ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_node( array(
|
$wp_admin_bar->add_node(
|
||||||
|
array(
|
||||||
'id' => 'laps_output',
|
'id' => 'laps_output',
|
||||||
'parent' => 'laps',
|
'parent' => 'laps',
|
||||||
'meta' => array( 'html' => $html ),
|
'meta' => array( 'html' => $html ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user