19 Commits
Author SHA1 Message Date
sandros fad92f739c Fix Hook_Formatter::format to accept WP_Hook object as argument
Tests / tests (push) Successful in 5s
Release / upload-asset (push) Successful in 4s
2026-09-27 23:12:44 +02:00
sandros a30722c751 Add Hungarian language support and update author and repository metadata
Tests / tests (push) Successful in 5s
Release / upload-asset (push) Successful in 4s
2026-09-27 23:08:51 +02:00
sandros 7a0aa56433 Bump version to 3.4.1
Tests / tests (push) Successful in 6s
Release / upload-asset (push) Successful in 5s
2026-09-27 22:50:59 +02:00
sandros 6864095646 Adjust requirements to WordPress 6.2+ / ClassicPress 2.x
Tests / tests (push) Successful in 7s
Release / upload-asset (push) Successful in 4s
2026-09-27 22:49:26 +02:00
sandros 35572de44c Update README: add Hungarian section, remove obsolete badges, add English at bottom
Release / upload-asset (push) Successful in 30s
Tests / tests (push) Successful in 7s
2026-09-26 23:16:48 +02:00
sandros 916cad2d8d Use native git checkout and streamline tests in Gitea workflows
Tests / tests (push) Successful in 6s
Release / upload-asset (push) Successful in 4s
2026-09-26 23:13:08 +02:00
sandros 2bdb8c67da Use composer:2 container in Gitea workflows
Tests / tests (push) Failing after 13s
Release / upload-asset (push) Failing after 1s
2026-09-26 23:10:38 +02:00
sandros d035dbe215 Released version 3.4.0
Tests / tests (push) Failing after 8s
Release / upload-asset (push) Failing after 5s
2026-09-26 22:59:55 +02:00
sandros d70baec3ec Add Gitea release asset workflow
Tests / tests (push) Failing after 6s
2026-09-26 22:58:43 +02:00
sandros a993080fe6 Add Gitea Actions test workflow
Tests / tests (push) Failing after 25s
2026-09-26 22:55:17 +02:00
sandros 36dbd2aaf0 repo switch 2026-09-26 22:49:30 +02:00
sandros 99646663d6 Wordpress 7+
Tests / tests (push) Canceled after 0s
2026-09-26 22:32:01 +02:00
Andrey Savchenko 17eaad7a92 Fixed deprecated set-output. 2022-12-28 15:07:02 +02:00
Andrey Savchenko 08a24caf8c Bumped Ubuntu version in actions.
18.04 is deprecated, 20.04 has PHP 7.4+ pre-installed which is higher than current 7.2 but probably next bump.
2022-12-28 14:59:38 +02:00
Andrey Savchenko 5b31f29ffd Added GitHub token to setup-php step.
Fixes GitHub API rate limit errors.
2022-12-28 14:54:58 +02:00
Andrey Savchenko add15ab277 Refreshed Psalm annotations. 2022-12-28 14:46:50 +02:00
Dave Gaeddert 03d1720e84 Update SAVEQUERIES docs link (#60) 2022-12-21 21:30:59 +02:00
Andrey Savchenko 103525ac92 Fixed Psalm 5 crash on PHP 7.2 (#61) 2022-12-21 21:30:41 +02:00
Andrey Savchenko d4127c7a91 Fixed creating GitHub release with the file 2022-06-16 11:26:38 +03:00
29 changed files with 585 additions and 973 deletions

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
name: Release
on:
release:
types: [ published ]
push:
tags:
- '*'
permissions:
contents: write
jobs:
upload-asset:
runs-on: ubuntu-latest
container:
image: composer:2
steps:
- name: Checkout
run: |
git init .
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@$(echo "${{ github.server_url }}" | sed -E 's|https?://||')/${{ github.repository }}.git"
git fetch --depth 1 origin "${{ github.ref }}"
git checkout FETCH_HEAD
- name: Build release zip
run: |
mkdir -p release/laps
git archive HEAD | tar -x -C release/laps
cd release/laps
composer config platform.php 7.4
composer remove composer/installers --no-update
composer update --no-dev --optimize-autoloader
cd ..
zip -q -r laps.zip laps
rm -rf laps
- name: Upload zip to Gitea Release
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_URL: ${{ github.api_url }}
SERVER_URL: ${{ github.server_url }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
if [ -z "$API_URL" ]; then
API_URL="${SERVER_URL}/api/v1"
fi
echo "Target API: $API_URL/repos/$REPO"
RELEASE_JSON=$(curl -s -H "Authorization: token $GITEA_TOKEN" "$API_URL/repos/$REPO/releases/tags/$TAG")
RELEASE_ID=$(echo "$RELEASE_JSON" | php -r '$d = json_decode(file_get_contents("php://stdin")); echo $d->id ?? "";')
if [ -z "$RELEASE_ID" ]; then
echo "Creating release for tag $TAG..."
CREATE_RES=$(curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Release $TAG\"}" \
"$API_URL/repos/$REPO/releases")
RELEASE_ID=$(echo "$CREATE_RES" | php -r '$d = json_decode(file_get_contents("php://stdin")); echo $d->id ?? "";')
fi
echo "Uploading laps.zip to release ID $RELEASE_ID..."
curl -s -f -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@release/laps.zip" \
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=laps.zip"
+27
View File
@@ -0,0 +1,27 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
runs-on: ubuntu-latest
container:
image: composer:2
steps:
- name: Checkout
run: |
git init .
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@$(echo "${{ github.server_url }}" | sed -E 's|https?://||')/${{ github.repository }}.git"
git fetch --depth 1 origin "${{ github.ref }}"
git checkout FETCH_HEAD
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHPUnit
run: vendor/bin/phpunit
-43
View File
@@ -1,43 +0,0 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
tools: phpunit:8,psalm
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer install --no-interaction
- name: Psalm
run: psalm --output-format=github
if: always()
- name: PHPUnit
run: phpunit --coverage-text
if: always()
+2 -1
View File
@@ -1,2 +1,3 @@
/vendor
/release
/release
.phpunit.result.cache
+18 -1
View File
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
## 3.4.1 - 2026-09-27
### Added
- Hungarian language support (hu_HU) with .pot, .po, and .mo files
### Changed
- credited sandros & Rarst as authors and updated repository homepage
- adjusted requirements to `Requires at least: 6.2` to support ClassicPress 2.x and WordPress 6.2+
- updated documentation with Hungarian translation
## 3.4.0 - 2026-09-26
### Changed
- raised minimum required PHP version to 7.4
- checked user permissions (`laps_can_see`) before enqueueing assets in `Asset_Manager`
- added Gitea Actions workflows for tests and automated releases
## 3.3.7 - 2022-06-16
### Fixed
@@ -225,4 +242,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## 1.0 - 2013-04-22
### Added
- Initial public release
- Initial public release
+42 -32
View File
@@ -1,52 +1,62 @@
![Laps v3 toolbar screenshot](https://i.imgur.com/NtgAxhp.png)
# Laps — light WordPress profiler
# Laps — könnyűsúlyú WordPress profilozó
_Make a site, make it fast._
> *Készíts egy weboldalt, és tedd gyorssá.*
[![Tests Status](https://github.com/rarst/laps/actions/workflows/tests.yml/badge.svg)](https://github.com/Rarst/laps/actions/workflows/tests.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/rarst/laps.svg)](https://packagist.org/packages/rarst/laps)
[![Latest Stable Version](https://img.shields.io/packagist/v/rarst/laps.svg?label=version)](https://packagist.org/packages/rarst/laps)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/rarst/laps.svg)](https://packagist.org/packages/rarst/laps)
[![Download Laps](https://img.shields.io/badge/download-laps.zip-blue)](https://github.com/Rarst/laps/releases/latest/download/laps.zip)
A Laps egy gyors és könnyű WordPress bővítmény, amely valós idejű betöltési és teljesítményadatokat jelenít meg közvetlenül az admin eszköztáron (toolbar).
Laps is a plugin that **shows performance information** about WordPress page load.
## Főbb funkciók
It provides a visual summary in toolbar that is quick and easy to inspect.
### Oldalprofilozás
A Laps automatikusan méri és megjeleníti a kulcsfontosságú eseményeket:
- PHP, WordPress mag, bővítmények és sablonok betöltési ideje, fő ciklus (loop), oldalsávok (sidebars)
- Adatbázis-lekérdezések és hívási láncok részletes listázása (ha a `SAVEQUERIES` konstans értéke `true`)
- Külső hálózati kérések (HTTP API hívások más oldalakra)
## Page profiling
Laps automatically tracks many events, such as:
- PHP, core, plugins, and themes load, main posts loop, sidebars
- database queries (with [`SAVEQUERIES` defined constant set to true](https://wordpress.org/support/article/editing-wp-config-php/#save-queries-for-analysis))
- network requests to other sites
## API profiling
For Ajax and REST API — Laps outputs performance information by Server Timing API, for use with clients such as Chrome Dev Tools.
### API mérés (Ajax & REST API)
Ajax és REST API kérések esetén a Laps a **Server Timing API** segítségével küldi el a mérési adatokat, amelyek közvetlenül megtekinthetők a böngésző fejlesztői eszköztárában (pl. Chrome DevTools Network fülön).
![Laps v3 dev tools screenshot](https://i.imgur.com/hkl1Qk9.png)
### API authentication
### Jogosultságok
A teljesítményadatok és a kapcsolódó stílusok/scriptek alapértelmezetten csak a megfelelő adminisztrátori jogosultsággal rendelkező felhasználóknak jelennek meg. A megjelenítés testreszabható a `laps_can_see` szűrővel (filter).
API requests need to be authenticated as admin for performance data to be sent. For Ajax requests cookies are sufficient. REST API requests also [need nonce passed](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication).
## Telepítés
`laps_can_see` check can be filtered to relax required permissions on the plugin’s side.
1. Töltsd le a legfrissebb `laps.zip` archívumot a **Releases** oldalról.
2. A WordPress admin felületén válaszd a **Bővítmények → Új hozzáadása → Bővítmény feltöltése** menüpontot.
3. Töltsd fel a `laps.zip` fájlt, majd aktiváld.
## Installation
## Követelmények
- **WordPress / ClassicPress:** WordPress 6.2+ vagy ClassicPress 2.0+ (pl. 2.7.3)
- **PHP:** 7.4 vagy újabb
| [Composer](https://getcomposer.org/) (recommended) | Release archive |
| -------------------------------------------------- | -------- |
| `composer require rarst/laps` | [![Download Laps](https://img.shields.io/badge/download-laps.zip-blue?style=for-the-badge)](https://github.com/Rarst/laps/releases/latest/download/laps.zip)|
---
## Tests
## English
Tests require [Brain Monkey](https://github.com/Brain-WP/BrainMonkey) (included in dependencies) and PHPUnit 8 (not included).
# Laps — Light WordPress Profiler
```bash
phpunit
```
> *Make a site, make it fast.*
Laps is a lightweight plugin that displays real-time page load and performance information directly in the admin toolbar.
### Features
- **Page profiling:** Automatically tracks PHP baseline, core initialization, plugin and theme load times, the main query loop, and sidebars.
- **Database queries:** Detailed query logs and execution times (when `SAVEQUERIES` is defined and set to `true`).
- **HTTP requests:** Tracks external network requests made via the WordPress HTTP API.
- **API profiling:** Emits Server Timing API headers for Ajax and REST API requests, inspectable directly in browser DevTools.
- **Access control:** Metrics and frontend/admin assets are only exposed to users with administrative capabilities (customizable via the `laps_can_see` filter).
### Installation
1. Download the latest `laps.zip` from the **Releases** page.
2. In the WordPress Admin, go to **Plugins → Add New → Upload Plugin**.
3. Upload `laps.zip` and activate.
### Requirements
- **WordPress / ClassicPress:** WordPress 6.2+ or ClassicPress 2.0+ (e.g. 2.7.3)
- **PHP:** 7.4 or higher
## License
MIT
+2 -2
View File
@@ -82,7 +82,7 @@ class RoboFile extends \Robo\Tasks {
*
* @param string $php PHP version to target.
*/
public function makeArchive( $php = '7.2.5' ): void {
public function makeArchive( $php = '7.4' ): void {
$composer = json_decode( file_get_contents( __DIR__ . '/composer.json' ) );
$package = $composer->name;
@@ -169,7 +169,7 @@ class RoboFile extends \Robo\Tasks {
$zipFile = __DIR__ . '/release/laps.zip';
$this->makeArchive();
$this->_exec("gh release upload $version $zipFile");
$this->_exec("gh release create $version $zipFile");
$this->_remove( $zipFile );
}
+10 -5
View File
@@ -3,16 +3,20 @@
"description": "Light WordPress profiler.",
"keywords" : ["wordpress", "performance"],
"type" : "wordpress-plugin",
"homepage" : "https://github.com/Rarst/laps",
"homepage" : "https://git.sandros.hu/sandros/laps",
"license" : "MIT",
"authors" : [
{
"name" : "sandros",
"homepage": "https://git.sandros.hu/sandros"
},
{
"name" : "Andrey Savchenko",
"homepage": "https://www.Rarst.net/"
}
],
"support" : {
"issues": "https://github.com/Rarst/laps/issues"
"issues": "https://git.sandros.hu/sandros/laps/issues"
},
"autoload" : {
"psr-4": {
@@ -25,7 +29,7 @@
}
},
"require" : {
"php" : "^7.2.5 || ^8",
"php" : "^7.4 || ^8",
"composer/installers": "^1.6 || ^2",
"symfony/stopwatch" : "^4.2.1",
"mustache/mustache" : "^2.14.1",
@@ -34,7 +38,8 @@
"require-dev": {
"twbs/bootstrap": "^3.4",
"brain/monkey" : "^2.2",
"pds/skeleton": "^1.0"
"pds/skeleton": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.5"
},
"extra" : {
"light-ignore-plugin": {
@@ -55,7 +60,7 @@
"composer/installers": true
},
"platform": {
"php": "7.2.5"
"php": "7.4"
}
}
}
Generated
-860
View File
@@ -1,860 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1bf4582190f9dfcabf70f1a29f7f15e8",
"packages": [
{
"name": "composer/installers",
"version": "v2.1.1",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "af93ba6e52236418f07a278033eba6959ee5b983"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/af93ba6e52236418f07a278033eba6959ee5b983",
"reference": "af93ba6e52236418f07a278033eba6959ee5b983",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": "^7.2 || ^8.0"
},
"require-dev": {
"composer/composer": "1.6.* || ^2.0",
"composer/semver": "^1 || ^3",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"symfony/phpunit-bridge": "^5.3",
"symfony/process": "^5"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-main": "2.x-dev"
},
"plugin-modifies-install-path": true
},
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"MantisBT",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Starbug",
"Thelia",
"Whmcs",
"WolfCMS",
"agl",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"known",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"miaoxing",
"modulework",
"modx",
"moodle",
"osclass",
"pantheon",
"phpbb",
"piwik",
"ppi",
"processwire",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"sylius",
"tastyigniter",
"wordpress",
"yawik",
"zend",
"zikula"
],
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v2.1.1"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2022-04-13T09:13:00+00:00"
},
{
"name": "mustache/mustache",
"version": "v2.14.1",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/mustache.php.git",
"reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/579ffa5c96e1d292c060b3dd62811ff01ad8c24e",
"reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e",
"shasum": ""
},
"require": {
"php": ">=5.2.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~1.11",
"phpunit/phpunit": "~3.7|~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Mustache": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "A Mustache implementation in PHP.",
"homepage": "https://github.com/bobthecow/mustache.php",
"keywords": [
"mustache",
"templating"
],
"support": {
"issues": "https://github.com/bobthecow/mustache.php/issues",
"source": "https://github.com/bobthecow/mustache.php/tree/v2.14.1"
},
"time": "2022-01-21T06:08:36+00:00"
},
{
"name": "pimple/pimple",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.1 || ^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Pimple": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Pimple, a simple Dependency Injection Container",
"homepage": "https://pimple.symfony.com",
"keywords": [
"container",
"dependency injection"
],
"support": {
"source": "https://github.com/silexphp/Pimple/tree/v3.5.0"
},
"time": "2021-10-28T11:13:42+00:00"
},
{
"name": "psr/container",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
"shasum": ""
},
"require": {
"php": ">=7.2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2021-03-05T17:36:06+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-02T09:53:40+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.1",
"symfony/deprecation-contracts": "^2.1|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
},
"suggest": {
"symfony/service-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Service\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-03-13T20:07:29+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v4.4.38",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "7f4f5a8122f7530d688cc9edf2f8c9261552fa2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/7f4f5a8122f7530d688cc9edf2f8c9261552fa2d",
"reference": "7f4f5a8122f7530d688cc9edf2f8c9261552fa2d",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/service-contracts": "^1.0|^2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a way to profile code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/stopwatch/tree/v4.4.38"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-02-18T15:34:20+00:00"
}
],
"packages-dev": [
{
"name": "antecedent/patchwork",
"version": "2.1.21",
"source": {
"type": "git",
"url": "https://github.com/antecedent/patchwork.git",
"reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antecedent/patchwork/zipball/25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d",
"reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": ">=4"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ignas Rudaitis",
"email": "ignas.rudaitis@gmail.com"
}
],
"description": "Method redefinition (monkey-patching) functionality for PHP.",
"homepage": "http://patchwork2.org/",
"keywords": [
"aop",
"aspect",
"interception",
"monkeypatching",
"redefinition",
"runkit",
"testing"
],
"support": {
"issues": "https://github.com/antecedent/patchwork/issues",
"source": "https://github.com/antecedent/patchwork/tree/2.1.21"
},
"time": "2022-02-07T07:28:34+00:00"
},
{
"name": "brain/monkey",
"version": "2.6.1",
"source": {
"type": "git",
"url": "https://github.com/Brain-WP/BrainMonkey.git",
"reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a31c84515bb0d49be9310f52ef1733980ea8ffbb",
"reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb",
"shasum": ""
},
"require": {
"antecedent/patchwork": "^2.1.17",
"mockery/mockery": "^1.3.5 || ^1.4.4",
"php": ">=5.6.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/php-compatibility": "^9.3.0",
"phpunit/phpunit": "^5.7.26 || ^6.0 || ^7.0 || >=8.0 <8.5.12 || ^8.5.14 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-version/1": "1.x-dev",
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"files": [
"inc/api.php"
],
"psr-4": {
"Brain\\Monkey\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Giuseppe Mazzapica",
"email": "giuseppe.mazzapica@gmail.com",
"homepage": "https://gmazzap.me",
"role": "Developer"
}
],
"description": "Mocking utility for PHP functions and WordPress plugin API",
"keywords": [
"Monkey Patching",
"interception",
"mock",
"mock functions",
"mockery",
"patchwork",
"redefinition",
"runkit",
"test",
"testing"
],
"support": {
"issues": "https://github.com/Brain-WP/BrainMonkey/issues",
"source": "https://github.com/Brain-WP/BrainMonkey"
},
"time": "2021-11-11T15:53:55+00:00"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/hamcrest/hamcrest-php.git",
"reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3",
"reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3",
"shasum": ""
},
"require": {
"php": "^5.3|^7.0|^8.0"
},
"replace": {
"cordoval/hamcrest-php": "*",
"davedevelopment/hamcrest-php": "*",
"kodova/hamcrest-php": "*"
},
"require-dev": {
"phpunit/php-file-iterator": "^1.4 || ^2.0",
"phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"classmap": [
"hamcrest"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "This is the PHP port of Hamcrest Matchers",
"keywords": [
"test"
],
"support": {
"issues": "https://github.com/hamcrest/hamcrest-php/issues",
"source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1"
},
"time": "2020-07-09T08:09:16+00:00"
},
{
"name": "mockery/mockery",
"version": "1.3.5",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
"reference": "472fa8ca4e55483d55ee1e73c963718c4393791d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d",
"reference": "472fa8ca4e55483d55ee1e73c963718c4393791d",
"shasum": ""
},
"require": {
"hamcrest/hamcrest-php": "^2.0.1",
"lib-pcre": ">=7.0",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Pádraic Brady",
"email": "padraic.brady@gmail.com",
"homepage": "http://blog.astrumfutura.com"
},
{
"name": "Dave Marshall",
"email": "dave.marshall@atstsolutions.co.uk",
"homepage": "http://davedevelopment.co.uk"
}
],
"description": "Mockery is a simple yet flexible PHP mock object framework",
"homepage": "https://github.com/mockery/mockery",
"keywords": [
"BDD",
"TDD",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"test",
"test double",
"testing"
],
"support": {
"issues": "https://github.com/mockery/mockery/issues",
"source": "https://github.com/mockery/mockery/tree/1.3.5"
},
"time": "2021-09-13T15:33:03+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",
"support": {
"issues": "https://github.com/php-pds/skeleton/issues",
"source": "https://github.com/php-pds/skeleton/tree/1.x"
},
"time": "2017-01-25T23:30:41+00:00"
},
{
"name": "twbs/bootstrap",
"version": "v3.4.1",
"source": {
"type": "git",
"url": "https://github.com/twbs/bootstrap.git",
"reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"shasum": ""
},
"replace": {
"twitter/bootstrap": "self.version"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jacob Thornton",
"email": "jacobthornton@gmail.com"
},
{
"name": "Mark Otto",
"email": "markdotto@gmail.com"
}
],
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"homepage": "https://getbootstrap.com/",
"keywords": [
"JS",
"css",
"framework",
"front-end",
"less",
"mobile-first",
"responsive",
"web"
],
"support": {
"issues": "https://github.com/twbs/bootstrap/issues",
"source": "https://github.com/twbs/bootstrap/tree/v3.4.1"
},
"time": "2019-02-13T15:55:38+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.2.5 || ^8"
},
"platform-dev": [],
"platform-overrides": {
"php": "7.2.5"
},
"plugin-api-version": "2.3.0"
}
Binary file not shown.
+150
View File
@@ -0,0 +1,150 @@
# Hungarian translation for Laps.
# Copyright (C) 2026 sandros & Rarst
# This file is distributed under the MIT license.
#
msgid ""
msgstr ""
"Project-Id-Version: Laps 3.4.1\n"
"Report-Msgid-Bugs-To: https://git.sandros.hu/sandros/laps/issues\n"
"POT-Creation-Date: 2026-09-27 23:05+0200\n"
"PO-Revision-Date: 2026-09-27 23:06+0200\n"
"Last-Translator: sandros <me@sandros.hu>\n"
"Language-Team: Hungarian <hu_HU@li.org>\n"
"Language: hu_HU\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Description of the plugin
#: laps.php:5
msgid "Light WordPress profiler."
msgstr "Könnyűsúlyú WordPress profilozó."
#. translators: %s: page load time in seconds
#: src/Manager/Toolbar_Manager.php:51
msgid "Lap: %ss"
msgstr "Kör: %ss"
#. translators: %s: PHP version
#: src/Record/Collector/Core_Load_Collector.php:40
msgid "PHP Load – %s"
msgstr "PHP betöltés – %s"
#: src/Record/Collector/Core_Load_Collector.php:48
msgid "OPcache"
msgstr "OPcache"
#: src/Record/Collector/Core_Load_Collector.php:51
msgid "Core Load"
msgstr "WordPress mag betöltése"
#: src/Record/Collector/Core_Load_Collector.php:51
msgid "Core & MU Plugins Load"
msgstr "WordPress mag és MU bővítmények betöltése"
#: src/Record/Collector/Hook_Collector.php:46
msgid "Network & MU Plugins Load"
msgstr "Hálózati és MU bővítmények betöltése"
#: src/Event/Core_Events.php:16
msgid "Plugins Load"
msgstr "Bővítmények betöltése"
#: src/Event/Core_Events.php:17
msgid "Plugins Loaded Hook"
msgstr "Plugins Loaded hook"
#: src/Event/Core_Events.php:18
msgid "Themes Load"
msgstr "Sablonok betöltése"
#: src/Event/Core_Events.php:19
msgid "Init Hook"
msgstr "Init hook"
#: src/Event/Core_Events.php:20
msgid "WP Loaded Hook"
msgstr "WP Loaded hook"
#: src/Event/Core_Events.php:21
msgid "Query Setup"
msgstr "Lekérdezés előkészítése"
#: src/Event/Core_Events.php:22
msgid "Template Loader"
msgstr "Sablon betöltő"
#: src/Event/Core_Events.php:23
msgid "Admin Init Hook"
msgstr "Admin Init hook"
#: src/Event/Core_Events.php:24
msgid "Admin Menu"
msgstr "Admin menü"
#: src/Event/Core_Events.php:25
msgid "Admin Print Scripts"
msgstr "Admin scriptek betöltése"
#: src/Event/Core_Events.php:26
msgid "Head Hook"
msgstr "Fejléc hook (wp_head)"
#: src/Event/Core_Events.php:27
msgid "Main Loop"
msgstr "Fő ciklus (loop)"
#: src/Event/Core_Events.php:28
msgid "Sidebar"
msgstr "Oldalsáv (sidebar)"
#: src/Event/Core_Events.php:29
msgid "Toolbar"
msgstr "Eszköztár (toolbar)"
#: src/Event/Core_Events.php:30
msgid "Footer Hook"
msgstr "Lábléc hook (wp_footer)"
#. translators: 1: file path, 2: line number
#: src/Formatter/Hook_Formatter.php:94
msgid "closure from %1$s:%2$d"
msgstr "closure innen: %1$s:%2$d"
#. translators: 1: file path, 2: line number
#: src/Formatter/Hook_Formatter.php:107
msgid "anonymous class from %1$s:%2$d"
msgstr "névtelen osztály innen: %1$s:%2$d"
#: src/Event/Extension_Events.php:28
msgid "Beaver Builder Post Content"
msgstr "Beaver Builder bejegyzéstartalom"
#: src/Event/Extension_Events.php:33
msgid "Beaver Builder Module"
msgstr "Beaver Builder modul"
#: src/Event/Extension_Events.php:40
msgid "Beaver Builder Top Bar"
msgstr "Beaver Builder felső sáv"
#: src/Event/Extension_Events.php:41
msgid "Beaver Builder Header"
msgstr "Beaver Builder fejléc"
#: src/Event/Extension_Events.php:42
msgid "Beaver Builder Page Content"
msgstr "Beaver Builder oldaltartalom"
#: src/Event/Extension_Events.php:43
msgid "Beaver Builder Post"
msgstr "Beaver Builder bejegyzés"
#: src/Event/Extension_Events.php:44
msgid "Beaver Builder Footer Widgets"
msgstr "Beaver Builder lábléc widgetek"
#: src/Event/Extension_Events.php:45
msgid "Beaver Builder Footer"
msgstr "Beaver Builder lábléc"
+148
View File
@@ -0,0 +1,148 @@
# Copyright (C) 2026 sandros & Rarst
# This file is distributed under the MIT license.
msgid ""
msgstr ""
"Project-Id-Version: Laps 3.4.1\n"
"Report-Msgid-Bugs-To: https://git.sandros.hu/sandros/laps/issues\n"
"POT-Creation-Date: 2026-09-27 23:05+0200\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2026-YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Description of the plugin
#: laps.php:5
msgid "Light WordPress profiler."
msgstr ""
#. translators: %s: page load time in seconds
#: src/Manager/Toolbar_Manager.php:51
msgid "Lap: %ss"
msgstr ""
#. translators: %s: PHP version
#: src/Record/Collector/Core_Load_Collector.php:40
msgid "PHP Load – %s"
msgstr ""
#: src/Record/Collector/Core_Load_Collector.php:48
msgid "OPcache"
msgstr ""
#: src/Record/Collector/Core_Load_Collector.php:51
msgid "Core Load"
msgstr ""
#: src/Record/Collector/Core_Load_Collector.php:51
msgid "Core & MU Plugins Load"
msgstr ""
#: src/Record/Collector/Hook_Collector.php:46
msgid "Network & MU Plugins Load"
msgstr ""
#: src/Event/Core_Events.php:16
msgid "Plugins Load"
msgstr ""
#: src/Event/Core_Events.php:17
msgid "Plugins Loaded Hook"
msgstr ""
#: src/Event/Core_Events.php:18
msgid "Themes Load"
msgstr ""
#: src/Event/Core_Events.php:19
msgid "Init Hook"
msgstr ""
#: src/Event/Core_Events.php:20
msgid "WP Loaded Hook"
msgstr ""
#: src/Event/Core_Events.php:21
msgid "Query Setup"
msgstr ""
#: src/Event/Core_Events.php:22
msgid "Template Loader"
msgstr ""
#: src/Event/Core_Events.php:23
msgid "Admin Init Hook"
msgstr ""
#: src/Event/Core_Events.php:24
msgid "Admin Menu"
msgstr ""
#: src/Event/Core_Events.php:25
msgid "Admin Print Scripts"
msgstr ""
#: src/Event/Core_Events.php:26
msgid "Head Hook"
msgstr ""
#: src/Event/Core_Events.php:27
msgid "Main Loop"
msgstr ""
#: src/Event/Core_Events.php:28
msgid "Sidebar"
msgstr ""
#: src/Event/Core_Events.php:29
msgid "Toolbar"
msgstr ""
#: src/Event/Core_Events.php:30
msgid "Footer Hook"
msgstr ""
#. translators: 1: file path, 2: line number
#: src/Formatter/Hook_Formatter.php:94
msgid "closure from %1$s:%2$d"
msgstr ""
#. translators: 1: file path, 2: line number
#: src/Formatter/Hook_Formatter.php:107
msgid "anonymous class from %1$s:%2$d"
msgstr ""
#: src/Event/Extension_Events.php:28
msgid "Beaver Builder Post Content"
msgstr ""
#: src/Event/Extension_Events.php:33
msgid "Beaver Builder Module"
msgstr ""
#: src/Event/Extension_Events.php:40
msgid "Beaver Builder Top Bar"
msgstr ""
#: src/Event/Extension_Events.php:41
msgid "Beaver Builder Header"
msgstr ""
#: src/Event/Extension_Events.php:42
msgid "Beaver Builder Page Content"
msgstr ""
#: src/Event/Extension_Events.php:43
msgid "Beaver Builder Post"
msgstr ""
#: src/Event/Extension_Events.php:44
msgid "Beaver Builder Footer Widgets"
msgstr ""
#: src/Event/Extension_Events.php:45
msgid "Beaver Builder Footer"
msgstr ""
+14 -7
View File
@@ -2,13 +2,16 @@
/*
Plugin Name: Laps
Plugin URI: https://github.com/Rarst/laps
Plugin URI: https://git.sandros.hu/sandros/laps
Description: Light WordPress profiler.
Author: Andrey “Rarst” Savchenko
Version: 3.3.7
Author URI: https://www.rarst.net/
Requires PHP: 7.1.3
Author: sandros & Rarst
Author URI: https://git.sandros.hu/sandros/laps
Version: 3.4.1
Requires at least: 6.2
Requires PHP: 7.4
Update URI: false
Text Domain: laps
Domain Path: /languages
License: MIT
*/
@@ -20,10 +23,14 @@ if ( ! class_exists( '\Rarst\Laps\Plugin' ) ) {
trigger_error( 'Laps not fully installed! Please install with Composer or download full release archive.', E_USER_ERROR );
}
if ( PHP_VERSION_ID < 70103 ) {
trigger_error( 'Laps requires PHP version >=7.1.3.', E_USER_ERROR );
if ( PHP_VERSION_ID < 70400 ) {
trigger_error( 'Laps requires PHP version >=7.4.', E_USER_ERROR );
}
add_action( 'plugins_loaded', function (): void {
load_plugin_textdomain( 'laps', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
} );
$laps = new \Rarst\Laps\Plugin();
$laps->run();
+33 -7
View File
@@ -3,6 +3,8 @@ declare( strict_types=1 );
namespace Rarst\Laps\Formatter;
use WP_Hook;
/**
* Formatter to process callbacks from a hook instance.
*/
@@ -31,8 +33,8 @@ class Hook_Formatter {
* @psalm-type Priority = array-key
* @psalm-type Hooks = array<Priority, array<Hook>>
*
* @param \WP_Hook|array $hook Hook instance.
* @psalm-param \WP_Hook|Hooks $hook
* @param WP_Hook|array $hook Hook instance or callbacks array.
* @psalm-param WP_Hook|Hooks $hook
*
* @return array
*/
@@ -40,7 +42,7 @@ class Hook_Formatter {
$callbacks = [];
if ( $hook instanceof \WP_Hook ) {
if ( $hook instanceof WP_Hook ) {
/** @psalm-var Hooks $hook->callbacks */
$hook = $hook->callbacks;
}
@@ -51,9 +53,24 @@ class Hook_Formatter {
ksort( $hook );
/**
* Empty priorities produce empty arrays in PHP 7.2 and unpack operator doesn't accept empty array in 7.3.
*
* @see https://wiki.php.net/rfc/compact-empty-array-de-optimization
* @see https://bugs.php.net/bug.php?id=76045
*/
$hook = array_filter( $hook );
if ( empty( $hook ) ) {
return $callbacks;
}
/** @psalm-suppress InvalidArgument */
$functions = array_merge( ...$hook );
/** @psalm-var Hook[] $functions */
foreach ( $functions as $function ) {
/** @psalm-var Hook $function */
$callback = $this->get_callback_name( $function['function'], $function['accepted_args'] );
if ( false !== strpos( $callback, 'Hook_Collector' ) ) {
@@ -102,14 +119,24 @@ class Hook_Formatter {
if ( $object instanceof \Closure ) {
$class = new \ReflectionFunction( $object );
return 'closure from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine();
return sprintf(
/* translators: 1: file path, 2: line number */
__( 'closure from %1$s:%2$d', 'laps' ),
$this->shorten_path( (string) $class->getFileName() ),
(int) $class->getStartLine()
);
}
$class = new \ReflectionClass( $object );
$name = $class->getName();
if ( 0 === strpos( $name, 'class@anonymous' ) ) {
return 'anonymous class from ' . $this->shorten_path( $class->getFileName() ) . ':' . $class->getStartLine();
return sprintf(
/* translators: 1: file path, 2: line number */
__( 'anonymous class from %1$s:%2$d', 'laps' ),
$this->shorten_path( (string) $class->getFileName() ),
(int) $class->getStartLine()
);
}
return $name;
@@ -123,7 +150,7 @@ class Hook_Formatter {
protected function shorten_path( string $path ): string {
$path = wp_normalize_path( $path );
$path = str_replace( $this->truncate_paths, '', $path );
if ( ':' === $path[1] ) {
if ( isset( $path[1] ) && ':' === $path[1] ) {
$path = substr( $path, 2 );
}
$path = ltrim( $path, '/' );
@@ -131,4 +158,3 @@ class Hook_Formatter {
return $path;
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ class Asset_Manager {
wp_register_script( 'laps', plugins_url( "public/js/laps{$suffix}.js", dirname( __DIR__ ) ), [ 'jquery' ], '3.4.0', true );
wp_register_style( 'laps', plugins_url( "public/css/laps{$suffix}.css", dirname( __DIR__ ) ) );
if ( is_admin_bar_showing() ) {
if ( is_admin_bar_showing() && apply_filters( 'laps_can_see', current_user_can( 'manage_options' ) ) ) {
wp_enqueue_script( 'laps' );
wp_enqueue_style( 'laps' );
}
+2 -1
View File
@@ -47,7 +47,8 @@ class Toolbar_Manager {
$wp_admin_bar->add_node( [
'id' => 'laps',
'title' => sprintf( 'Lap: %ss', round( microtime( true ) - $timestart, 3 ) ),
/* translators: %s: page load time in seconds */
'title' => sprintf( __( 'Lap: %ss', 'laps' ), round( microtime( true ) - $timestart, 3 ) ),
] );
$wp_admin_bar->add_node( [
-2
View File
@@ -11,8 +11,6 @@ class Mustache_Cache_FrozenCache extends \Mustache_Cache_FilesystemCache {
/**
* Cache and load a compiled Mustache_Template class.
*
* @psalm-suppress InvalidScalarArgument
*
* @param string $key Key.
* @param string $value Value.
*
+6 -3
View File
@@ -27,6 +27,8 @@ class Core_Load_Collector implements Record_Collector_Interface {
/**
* @return Record_Interface[]
*
* @psalm-suppress PossiblyUndefinedArrayOffset
*/
public function get_records(): array {
@@ -34,7 +36,8 @@ class Core_Load_Collector implements Record_Collector_Interface {
$request_time = filter_var( $_SERVER['REQUEST_TIME_FLOAT'], FILTER_VALIDATE_FLOAT );
$php = 'PHP Load – ' . PHP_VERSION;
/* translators: %s: PHP version */
$php = sprintf( __( 'PHP Load – %s', 'laps' ), PHP_VERSION );
if ( $this->opcache_api_available() ) {
/**
@@ -42,10 +45,10 @@ class Core_Load_Collector implements Record_Collector_Interface {
* @see https://github.com/php/php-src/issues/8799
*/
$zend_status = @opcache_get_status();
$php .= empty( $zend_status['opcache_enabled'] ) ? '' : ' – OPcache';
$php .= empty( $zend_status['opcache_enabled'] ) ? '' : ' – ' . __( 'OPcache', 'laps' );
}
$load = $this->network_activated ? 'Core Load' : 'Core & MU Plugins Load';
$load = $this->network_activated ? __( 'Core Load', 'laps' ) : __( 'Core & MU Plugins Load', 'laps' );
/**
* @var float $request_time
-1
View File
@@ -103,7 +103,6 @@ class Hook_Collector extends Stopwatch_Collector {
* @param int $start_priority Start hook priority (defaults to -1).
* @param int $stop_priority Stop hook priority (defaults to max int).
*
* @psalm-suppress MissingClosureReturnType
* @psalm-suppress MissingClosureParamType
*/
private function add_event(
+2 -2
View File
@@ -44,7 +44,7 @@ class Http_Collector extends Stopwatch_Collector {
*
* @return false|array|\WP_Error
*
* @psalm-suppress RedundantConditionGivenDocblockType
* @psalm-suppress RedundantCondition
* @noinspection PhpUnusedParameterInspection
*/
public function pre_http_request( $false, $args, $url ) {
@@ -68,7 +68,7 @@ class Http_Collector extends Stopwatch_Collector {
*
* @return array|\WP_Error
*
* @psalm-suppress RedundantConditionGivenDocblockType
* @psalm-suppress RedundantCondition
* @noinspection PhpUnusedParameterInspection
*/
public function http_api_debug( $response, $type, $class, $args, $url ) {
+1
View File
@@ -65,6 +65,7 @@ class Sql_Collector implements Record_Collector_Interface {
/** @var array $wpdb->queries */
/** @psalm-var array<int, QueryData> $wpdb->queries */
/** @psalm-suppress PossiblyInvalidArgument */
$records = array_filter( array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries ) );
return $records;
@@ -61,6 +61,7 @@ class Stopwatch_Collector implements Record_Collector_Interface {
}
}
/** @psalm-suppress PossiblyInvalidArgument */
return array_map( [ $this, 'transform' ], array_keys( $events ), $events );
}
@@ -10,6 +10,8 @@ use Rarst\Laps\Record\Record_Interface;
*
* @template-extends \ArrayIterator<array-key,Record_Interface>
* @template-implements \RecursiveIterator<array-key,Record_Interface>
*
* @psalm-suppress TooManyTemplateParams
*/
class Recursive_Record_Iterator extends \ArrayIterator implements \RecursiveIterator {
+2 -2
View File
@@ -11,7 +11,7 @@ use Rarst\Laps\Record\Record_Interface;
*
* @template-implements \Iterator<array>
*
* @psalm-suppress PropertyNotSetInConstructor
* @psalm-suppress PropertyNotSetInConstructor, TooManyTemplateParams
*/
class Timeline_Iterator implements \Iterator {
@@ -30,7 +30,7 @@ class Timeline_Iterator implements \Iterator {
/**
* @param Recursive_Record_Iterator $iterator Record iterator.
*
* @psalm-suppress PossiblyFalsePropertyAssignmentValue
* @psalm-suppress PossiblyFalsePropertyAssignmentValue, PossiblyUndefinedArrayOffset
*/
public function __construct( Recursive_Record_Iterator $iterator ) {
+2 -1
View File
@@ -52,8 +52,9 @@ class Record implements Record_Interface {
if ( empty( $this->description ) ) {
$duration = round( $this->get_duration() * 1000 );
$name = __( $this->name, 'laps' );
return "{$this->name} – {$duration}&nbsp;ms";
return "{$name} – {$duration}&nbsp;ms";
}
return $this->description;
+2 -1
View File
@@ -45,8 +45,9 @@ class Stopwatch_Record implements Record_Interface {
$duration = round( $this->stopwatch_event->getDuration() );
$memory = round( $this->stopwatch_event->getMemory() / 1024 / 1024, 2 );
$description = '' !== $this->description ? "<hr />{$this->description}" : '';
$name = __( $this->name, 'laps' );
return "{$this->name} – {$duration} ms – {$memory} MB{$description}";
return "{$name} – {$duration} ms – {$memory} MB{$description}";
}
/**
+22 -1
View File
@@ -58,5 +58,26 @@ class HookTest extends LapsTestCase {
$this->assertEquals( [], $formatter->format( [] ) );
}
}
/**
* @depends test__construct
*/
public function testFormatWpHook( Hook_Formatter $formatter ) {
if ( ! class_exists( 'WP_Hook' ) ) {
eval( 'class WP_Hook { public $callbacks = []; }' );
}
$wp_hook = new \WP_Hook();
$wp_hook->callbacks = [
10 => [
[ 'function' => 'trim', 'accepted_args' => 1 ],
],
];
$result = $formatter->format( $wp_hook );
$this->assertIsArray( $result );
$this->assertEquals( [ 'trim' ], $result );
}
}
+1
View File
@@ -13,6 +13,7 @@ class LapsTestCase extends TestCase {
protected function setUp():void {
parent::setUp();
Monkey\setUp();
Monkey\Functions\stubTranslationFunctions();
}
protected function tearDown(): void {
+24
View File
@@ -36,9 +36,33 @@ class AssetTest extends LapsTestCase {
Functions\expect( 'wp_register_style' )->once();
Functions\expect( 'plugins_url' )->zeroOrMoreTimes();
Functions\expect( 'is_admin_bar_showing' )->once()->andReturn( true );
Functions\expect( 'current_user_can' )
->once()
->with( 'manage_options' )
->andReturn( true );
Functions\expect( 'wp_enqueue_script' )->once();
Functions\expect( 'wp_enqueue_style' )->once();
$manager->enqueue_scripts();
}
/**
* @covers ::enqueue_scripts
* @depends test__construct
*/
public function testEnqueue_scripts_hidden( Asset_Manager $manager ) {
Functions\expect( 'wp_register_script' )->once();
Functions\expect( 'wp_register_style' )->once();
Functions\expect( 'plugins_url' )->zeroOrMoreTimes();
Functions\expect( 'is_admin_bar_showing' )->once()->andReturn( true );
Functions\expect( 'current_user_can' )
->once()
->with( 'manage_options' )
->andReturn( false );
Functions\expect( 'wp_enqueue_script' )->never();
Functions\expect( 'wp_enqueue_style' )->never();
$manager->enqueue_scripts();
}
}