Skip to content

Commit 5260d95

Browse files
authored
Merge pull request wpengine#176 from wpengine/enqueue
Enqueue styles based on Plugin Version
2 parents 40a4c65 + 0bb86fa commit 5260d95

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

readme.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ PHP Compatibility Checker includes WP-CLI command support:
5656

5757
<version>
5858
PHP version to test.
59-
59+
6060
[--scan=<scan>]
6161
Whether to scan only active plugins and themes or all of them.
6262
default: active
@@ -118,6 +118,9 @@ To disclose security issues for this plugin please email [email protected]
118118

119119
## Changelog ##
120120

121+
### 1.4.5 ###
122+
- Use plugin version number to enqueue scripts and styles.
123+
121124
### 1.4.4 ###
122125
- PHP 5.2 Support & PHP 7.1 and 7.2 Lints.
123126
- Updated call to action sidebar depending on platform.

readme.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross, jcross
33
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
44
Requires at least: 3.5
55
Tested up to: 4.9
6-
Stable tag: 1.4.4
6+
Stable tag: 1.4.5
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -114,6 +114,9 @@ To disclose security issues for this plugin please email [email protected]
114114

115115
== Changelog ==
116116

117+
= 1.4.5 =
118+
- Use plugin version number to enqueue scripts and styles.
119+
117120
= 1.4.4 =
118121
- PHP 5.2 Support & PHP 7.1 and 7.2 Lints.
119122
- Updated call to action sidebar depending on platform.

wpengine-phpcompat.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin URI: https://wpengine.com
1111
* Description: Make sure your plugins and themes are compatible with newer PHP versions.
1212
* Author: WP Engine
13-
* Version: 1.4.4
13+
* Version: 1.4.5
1414
* Author URI: https://wpengine.com
1515
* Text Domain: php-compatibility-checker
1616
*/
@@ -313,13 +313,19 @@ public function admin_enqueue( $hook ) {
313313
return;
314314
}
315315

316+
// Grab the plugin version.
317+
$plugin_data = get_plugin_data( __FILE__, false, false );
318+
if ( isset( $plugin_data['Version'] ) ) {
319+
$version = $plugin_data['Version'];
320+
}
321+
316322
// Styles.
317-
wp_enqueue_style( 'wpephpcompat-style', plugins_url( '/src/css/style.css', __FILE__ ) );
323+
wp_enqueue_style( 'wpephpcompat-style', plugins_url( '/src/css/style.css', __FILE__ ), array(), $version );
318324

319325
// Scripts.
320-
wp_enqueue_script( 'wpephpcompat-handlebars', plugins_url( '/src/js/handlebars.js', __FILE__ ), array( 'jquery' ) );
321-
wp_enqueue_script( 'wpephpcompat-download', plugins_url( '/src/js/download.min.js', __FILE__ ) );
322-
wp_enqueue_script( 'wpephpcompat', plugins_url( '/src/js/run.js', __FILE__ ), array( 'jquery', 'wpephpcompat-handlebars', 'wpephpcompat-download' ) );
326+
wp_enqueue_script( 'wpephpcompat-handlebars', plugins_url( '/src/js/handlebars.js', __FILE__ ), array( 'jquery' ), $version );
327+
wp_enqueue_script( 'wpephpcompat-download', plugins_url( '/src/js/download.min.js', __FILE__ ), array(), $version );
328+
wp_enqueue_script( 'wpephpcompat', plugins_url( '/src/js/run.js', __FILE__ ), array( 'jquery', 'wpephpcompat-handlebars', 'wpephpcompat-download' ), $version );
323329

324330
/**
325331
* Strings for i18n.

0 commit comments

Comments
 (0)