1 parent
17eaad7a92
commit
99646663d6
7 files changed
+40
-10
No files matched your search
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.2'
|
||||
php-version: '7.4'
|
||||
tools: phpunit:8,psalm:4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
+6
-1
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
- raised minimum required PHP version to 7.4 to align with WordPress 7.0+
|
||||
- added `Requires at least: 7.0` to plugin header
|
||||
- checked user permissions (`laps_can_see`) before enqueueing assets in `Asset_Manager`
|
||||
|
||||
## 3.3.7 - 2022-06-16
|
||||
|
||||
### Fixed
|
||||
@@ -225,4 +230,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
## 1.0 - 2013-04-22
|
||||
|
||||
### Added
|
||||
- Initial public release
|
||||
- Initial public release
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+2
-2
@@ -25,7 +25,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",
|
||||
@@ -55,7 +55,7 @@
|
||||
"composer/installers": true
|
||||
},
|
||||
"platform": {
|
||||
"php": "7.2.5"
|
||||
"php": "7.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,10 @@ Plugin Name: Laps
|
||||
Plugin URI: https://github.com/Rarst/laps
|
||||
Description: Light WordPress profiler.
|
||||
Author: Andrey “Rarst” Savchenko
|
||||
Version: 3.3.7
|
||||
Version: 3.3.7
|
||||
Author URI: https://www.rarst.net/
|
||||
Requires PHP: 7.1.3
|
||||
Requires at least: 7.0
|
||||
Requires PHP: 7.4
|
||||
Update URI: false
|
||||
License: MIT
|
||||
*/
|
||||
@@ -20,8 +21,8 @@ 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 );
|
||||
}
|
||||
|
||||
$laps = new \Rarst\Laps\Plugin();
|
||||
|
||||
@@ -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' );
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user