Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2bece68e5 | ||
|
|
f50faf6ba6 | ||
|
|
bca3f42ee5 | ||
|
|
68302633c0 | ||
|
|
67ad1370ef | ||
|
|
4b7ee062c8 | ||
|
|
2e7a948bfe | ||
|
|
68ae657962 | ||
|
|
3edaf2dbc9 | ||
|
|
fa155f00e7 | ||
|
|
82b3d1e4e3 |
No files matched your search
@@ -6,6 +6,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.4.3 - 2017-06-28
|
||||
|
||||
### Fixed
|
||||
- sanity check for invalid priority returned by core
|
||||
|
||||
## 1.4.2 - 2016-12-02
|
||||
|
||||
### Fixed
|
||||
- back to fully functional on WP 4.7 beta
|
||||
|
||||
## 1.4.1 - 2016-12-01
|
||||
|
||||
### Fixed
|
||||
- errors and crash on WP 4.7 beta (not fully functional yet)
|
||||
|
||||
## 1.4 - 2016-10-01
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013 Andrey Savchenko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,4 +1,6 @@
|
||||
# Laps — light WordPress profiler
|
||||
[](https://scrutinizer-ci.com/g/Rarst/laps/?branch=master)
|
||||
[](https://packagist.org/packages/rarst/laps)
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -4,29 +4,11 @@ Plugin Name: Laps
|
||||
Plugin URI: https://github.com/Rarst/laps
|
||||
Description: Light WordPress profiler.
|
||||
Author: Andrey "Rarst" Savchenko
|
||||
Version: 1.4
|
||||
Version: 1.4.2
|
||||
Author URI: http://www.rarst.net/
|
||||
Text Domain: laps
|
||||
Domain Path: /lang
|
||||
License: MIT
|
||||
|
||||
Copyright (c) 2013 Andrey "Rarst" Savchenko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies
|
||||
or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class Laps_Events {
|
||||
/**
|
||||
* Inherit with internal events compiling and return
|
||||
*
|
||||
* @return array()
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function get_events();
|
||||
}
|
||||
+22
-14
@@ -17,7 +17,7 @@ class Laps {
|
||||
/**
|
||||
* Start Stopwatch and timing plugin load immediately, then set up core events and needed hooks.
|
||||
*/
|
||||
static function on_load() {
|
||||
public static function on_load() {
|
||||
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
return;
|
||||
@@ -45,7 +45,7 @@ class Laps {
|
||||
*
|
||||
* @param array $stops
|
||||
*/
|
||||
static function add_events( $stops ) {
|
||||
public static function add_events( $stops ) {
|
||||
|
||||
self::$events = array_merge( self::$events, $stops );
|
||||
|
||||
@@ -65,7 +65,7 @@ class Laps {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static function pre_update_option_active_plugins( $plugins ) {
|
||||
public static function pre_update_option_active_plugins( $plugins ) {
|
||||
|
||||
$plugin = plugin_basename( dirname( __DIR__ ) . '/laps.php' );
|
||||
$key = array_search( $plugin, $plugins );
|
||||
@@ -87,15 +87,21 @@ class Laps {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
static function tick( $input = null ) {
|
||||
public static function tick( $input = null ) {
|
||||
|
||||
global $wp_filter;
|
||||
|
||||
$filter = current_filter();
|
||||
$priority = key( $wp_filter[ $filter ] );
|
||||
$filter_name = current_filter();
|
||||
$filter_instance = $wp_filter[ $filter_name ];
|
||||
$priority = $filter_instance instanceof \WP_Hook ? $filter_instance->current_priority() : key( $filter_instance );
|
||||
|
||||
// See https://core.trac.wordpress.org/ticket/41185 on broken priority, but more general sanity check.
|
||||
if ( empty( self::$events[ $filter_name ][ $priority ] ) ) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
$event = wp_parse_args(
|
||||
self::$events[ $filter ][ $priority ],
|
||||
self::$events[ $filter_name ][ $priority ],
|
||||
array(
|
||||
'action' => 'start',
|
||||
'category' => null,
|
||||
@@ -118,7 +124,7 @@ class Laps {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static function query( $query ) {
|
||||
public static function query( $query ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@@ -140,7 +146,7 @@ class Laps {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
static function pre_http_request( $false, $args, $url ) {
|
||||
public static function pre_http_request( $false, $args, $url ) {
|
||||
|
||||
self::$stopwatch->start( $url, 'http' );
|
||||
|
||||
@@ -158,7 +164,7 @@ class Laps {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
static function http_api_debug( $response, $type, $class, $args, $url ) {
|
||||
public static function http_api_debug( $response, $type, $class, $args, $url ) {
|
||||
|
||||
self::$stopwatch->stop( $url );
|
||||
|
||||
@@ -168,7 +174,7 @@ class Laps {
|
||||
/**
|
||||
* When theme is done possibly add vendor-specific events.
|
||||
*/
|
||||
static function after_setup_theme() {
|
||||
public static function after_setup_theme() {
|
||||
|
||||
foreach ( array( 'THA', 'Hybrid', 'Genesis', 'Thematic', 'Yoast' ) as $vendor ) {
|
||||
|
||||
@@ -179,14 +185,14 @@ class Laps {
|
||||
}
|
||||
}
|
||||
|
||||
static function init() {
|
||||
public static function init() {
|
||||
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
|
||||
add_action( 'admin_bar_menu', array( __CLASS__, 'admin_bar_menu' ), 100 );
|
||||
}
|
||||
|
||||
static function enqueue_scripts() {
|
||||
public static function enqueue_scripts() {
|
||||
|
||||
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
||||
wp_register_script( 'laps', plugins_url( "js/laps{$suffix}.js", __DIR__ ), array( 'jquery' ), '3.3.1', true );
|
||||
@@ -203,7 +209,7 @@ class Laps {
|
||||
*
|
||||
* @param \WP_Admin_Bar $wp_admin_bar
|
||||
*/
|
||||
static function admin_bar_menu( $wp_admin_bar ) {
|
||||
public static function admin_bar_menu( $wp_admin_bar ) {
|
||||
|
||||
if ( ! apply_filters( 'laps_can_see', current_user_can( 'manage_options' ) ) ) {
|
||||
return;
|
||||
@@ -218,7 +224,9 @@ class Laps {
|
||||
)
|
||||
);
|
||||
|
||||
if ( self::$stopwatch->isStarted( 'Toolbar' ) ) {
|
||||
self::$stopwatch->stop( 'Toolbar' );
|
||||
}
|
||||
|
||||
$events = self::$stopwatch->getSectionEvents( '__root__' );
|
||||
$start = $timestart * 1000;
|
||||
|
||||
Reference in new issue
Block a user