6 Commits
5 changed files with 44 additions and 31 deletions

No files matched your search

+4
View File
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
## 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
View File
@@ -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 -19
View File
@@ -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.1
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' ) ) {
+1 -1
View File
@@ -34,7 +34,7 @@ abstract class Laps_Events {
/**
* Inherit with internal events compiling and return
*
* @return array()
* @return array
*/
abstract protected function get_events();
}
+17 -11
View File
@@ -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,13 +87,17 @@ 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 ] );
if ( 'callbacks' === $priority ) { // Fails on WP 4.7, see https://core.trac.wordpress.org/ticket/39007
return $input;
}
$event = wp_parse_args(
self::$events[ $filter ][ $priority ],
array(
@@ -118,7 +122,7 @@ class Laps {
*
* @return string
*/
static function query( $query ) {
public static function query( $query ) {
global $wpdb;
@@ -140,7 +144,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 +162,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 +172,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 +183,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 +207,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 +222,9 @@ class Laps {
)
);
if ( self::$stopwatch->isStarted( 'Toolbar' ) ) {
self::$stopwatch->stop( 'Toolbar' );
}
$events = self::$stopwatch->getSectionEvents( '__root__' );
$start = $timestart * 1000;