Skip to content

Commit

Permalink
Depend prefix on Asset Manager existence
Browse files Browse the repository at this point in the history
  • Loading branch information
moorscode committed Jun 16, 2016
1 parent 51724bd commit 1e68639
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions yoast-acf-analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,31 @@ public function wordpress_seo_requirements_not_met() {
* Enqueue JavaScript file to feed data to Yoast Content Analyses.
*/
public function enqueue_scripts() {
if ( wp_script_is( 'yoast-seo-post-scraper', 'enqueued' ) ) {

// If the Asset Manager exists then we need to use a different prefix.
$script_prefix = ( class_exists( 'WPSEO_Admin_Asset_Manager' ) ? 'yoast-seo' : 'wp-seo' );

if ( wp_script_is( $script_prefix . '-post-scraper', 'enqueued' ) ) {
// Post page enqueue.
wp_enqueue_script(
'yoast-acf-analysis-post',
$script_prefix . '-analysis-post',
plugins_url( '/js/yoast-acf-analysis.js', YOAST_ACF_ANALYSIS_FILE ),
array(
'jquery',
'yoast-seo-post-scraper',
$script_prefix . '-post-scraper',
),
self::VERSION
);
}

if ( wp_script_is( 'yoast-seo-term-scraper', 'enqueued' ) ) {
if ( wp_script_is( $script_prefix . '-term-scraper', 'enqueued' ) ) {
// Term page enqueue.
wp_enqueue_script(
'yoast-acf-analysis-term',
$script_prefix . '-analysis-term',
plugins_url( '/js/yoast-acf-analysis.js', YOAST_ACF_ANALYSIS_FILE ),
array(
'jquery',
'yoast-seo-term-scraper',
$script_prefix . '-term-scraper',
),
self::VERSION
);
Expand Down

0 comments on commit 1e68639

Please sign in to comment.