ACF Content Analysis for Yoast SEO - Version 3.0

Version Description

Download this release

Release Info

Developer Yoast
Plugin Icon 128x128 ACF Content Analysis for Yoast SEO
Version 3.0
Comparing to
See all releases

Code changes from version 2.7 to 3.0

inc/ac-yoast-seo-acf-content-analysis.php CHANGED
@@ -250,8 +250,7 @@ class AC_Yoast_SEO_ACF_Content_Analysis {
250
  /**
251
  * Disable Pro fields for anything but ACF 5 pro.
252
  *
253
- * - It is not worth supporting the Pro Addons to v4, as Pro users can just switch to v5.
254
- * - ACF v5 FREE on the other hand does not support these fields either.
255
  */
256
  if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) {
257
 
250
  /**
251
  * Disable Pro fields for anything but ACF 5 pro.
252
  *
253
+ * - ACF v5 FREE does not support these fields.
 
254
  */
255
  if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) {
256
 
inc/assets.php CHANGED
@@ -23,7 +23,7 @@ class Yoast_ACF_Analysis_Assets {
23
  public function init() {
24
  $this->plugin_data = get_plugin_data( AC_SEO_ACF_ANALYSIS_PLUGIN_FILE );
25
 
26
- add_filter( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ], 11 );
27
  }
28
 
29
  /**
@@ -38,11 +38,14 @@ class Yoast_ACF_Analysis_Assets {
38
  $config = Yoast_ACF_Analysis_Facade::get_registry()->get( 'config' );
39
 
40
  // Post page enqueue.
41
- if ( wp_script_is( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit' ) ) {
 
 
 
42
  wp_enqueue_script(
43
  'yoast-acf-analysis-post',
44
  plugins_url( '/js/yoast-acf-analysis.js', AC_SEO_ACF_ANALYSIS_PLUGIN_FILE ),
45
- [ 'jquery', WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit', 'underscore' ],
46
  $this->plugin_data['Version'],
47
  true
48
  );
23
  public function init() {
24
  $this->plugin_data = get_plugin_data( AC_SEO_ACF_ANALYSIS_PLUGIN_FILE );
25
 
26
+ add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ], 11 );
27
  }
28
 
29
  /**
38
  $config = Yoast_ACF_Analysis_Facade::get_registry()->get( 'config' );
39
 
40
  // Post page enqueue.
41
+ if (
42
+ wp_script_is( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit' ) ||
43
+ wp_script_is( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit-classic' )
44
+ ) {
45
  wp_enqueue_script(
46
  'yoast-acf-analysis-post',
47
  plugins_url( '/js/yoast-acf-analysis.js', AC_SEO_ACF_ANALYSIS_PLUGIN_FILE ),
48
+ [ 'jquery', 'underscore' ],
49
  $this->plugin_data['Version'],
50
  true
51
  );
inc/dependencies/dependency-acf.php CHANGED
@@ -6,7 +6,7 @@
6
  */
7
 
8
  /**
9
- * Checks wether ACF is installed.
10
  */
11
  final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Dependency {
12
 
@@ -20,6 +20,10 @@ final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Depe
20
  return false;
21
  }
22
 
 
 
 
 
23
  return true;
24
  }
25
 
@@ -36,7 +40,7 @@ final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Depe
36
  public function message_plugin_not_activated() {
37
  $message = sprintf(
38
  /* translators: %1$s resolves to ACF Content Analysis for Yoast SEO, %2$s resolves to Advanced Custom Fields */
39
- __( '%1$s requires %2$s (free or pro) to be installed and activated.', 'acf-content-analysis-for-yoast-seo' ),
40
  'ACF Content Analysis for Yoast SEO',
41
  'Advanced Custom Fields'
42
  );
6
  */
7
 
8
  /**
9
+ * Checks whether ACF is installed.
10
  */
11
  final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Dependency {
12
 
20
  return false;
21
  }
22
 
23
+ if ( defined( 'ACF_VERSION' ) && version_compare( ACF_VERSION, '5.7.0', '<' ) ) {
24
+ return false;
25
+ }
26
+
27
  return true;
28
  }
29
 
40
  public function message_plugin_not_activated() {
41
  $message = sprintf(
42
  /* translators: %1$s resolves to ACF Content Analysis for Yoast SEO, %2$s resolves to Advanced Custom Fields */
43
+ __( '%1$s requires %2$s (free or pro) 5.7 or higher to be installed and activated.', 'acf-content-analysis-for-yoast-seo' ),
44
  'ACF Content Analysis for Yoast SEO',
45
  'Advanced Custom Fields'
46
  );
js/src/app.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global YoastSEO, acf, _, jQuery, wp */
2
  var config = require( "./config/config.js" );
3
  var helper = require( "./helper.js" );
4
  var collect = require( "./collect/collect.js" );
@@ -15,58 +15,65 @@ var App = function() {
15
  };
16
 
17
  /**
18
- * ACF 4 Listener.
19
- *
20
- * @param {Array} fieldSelectors List of field selectors.
21
- * @param {string} wysiwygSelector Element selector for WYSIWYG fields.
22
- * @param {Array} fieldSelectorsWithoutWysiwyg List of fields.
23
  *
24
  * @returns {void}
25
  */
26
- App.prototype.acf4Listener = function( fieldSelectors, wysiwygSelector, fieldSelectorsWithoutWysiwyg ) {
27
  replaceVars.updateReplaceVars( collect );
28
 
29
- var fieldsWithoutWysiwyg = jQuery( "#post-body, #edittag" ).find( fieldSelectorsWithoutWysiwyg.join( "," ) );
30
- var fields = jQuery( "#post-body, #edittag" ).find( fieldSelectors.join( "," ) );
31
-
32
- fieldsWithoutWysiwyg.on( "change", this.maybeRefresh.bind( this ) );
33
- // Do not ignore Wysiwyg fields for the purpose of Replace Vars.
34
- fields.on( "change", replaceVars.updateReplaceVars.bind( this, collect ) );
35
-
36
- if ( YoastSEO.wp._tinyMCEHelper ) {
37
- jQuery( wysiwygSelector ).each( function() {
38
- YoastSEO.wp._tinyMCEHelper.addEventHandler( this.id, [ "input", "change", "cut", "paste" ],
39
- replaceVars.updateReplaceVars.bind( this, collect ) );
 
 
 
 
 
 
 
 
 
 
 
40
  } );
41
- }
42
-
43
- // Also refresh on media close as attachment data might have changed
44
- wp.media.frame.on( "close", this.maybeRefresh );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  };
46
 
47
- /**
48
- * ACF 5 Listener.
49
- *
50
- * @returns {void}
51
- */
52
- App.prototype.acf5Listener = function() {
53
- replaceVars.updateReplaceVars( collect );
54
-
55
- acf.add_action( "change remove append sortstop", this.maybeRefresh );
56
- acf.add_action( "change remove append sortstop", replaceVars.updateReplaceVars.bind( this, collect ) );
57
  };
58
 
59
  App.prototype.bindListeners = function() {
60
  if ( helper.acf_version >= 5 ) {
61
  jQuery( this.acf5Listener.bind( this ) );
62
- } else {
63
- var fieldSelectors = config.fieldSelectors.slice( 0 );
64
- var wysiwygSelector = "textarea[id^=wysiwyg-acf]";
65
-
66
- // Ignore Wysiwyg fields because they trigger a refresh in Yoast SEO itself
67
- var fieldSelectorsWithoutWysiwyg = _.without( fieldSelectors, wysiwygSelector );
68
-
69
- jQuery( document ).on( "acf/setup_fields", this.acf4Listener.bind( this, fieldSelectors, wysiwygSelector, fieldSelectorsWithoutWysiwyg ) );
70
  }
71
  };
72
 
@@ -77,7 +84,9 @@ App.prototype.maybeRefresh = function() {
77
 
78
  analysisTimeout = window.setTimeout( function() {
79
  if ( config.debug ) {
 
80
  console.log( "Recalculate..." + new Date() + "(Internal)" );
 
81
  }
82
 
83
  YoastSEO.app.pluginReloaded( config.pluginName );
1
+ /* global YoastSEO, acf, jQuery, */
2
  var config = require( "./config/config.js" );
3
  var helper = require( "./helper.js" );
4
  var collect = require( "./collect/collect.js" );
15
  };
16
 
17
  /**
18
+ * ACF 5 Listener.
 
 
 
 
19
  *
20
  * @returns {void}
21
  */
22
+ App.prototype.acf5Listener = function() {
23
  replaceVars.updateReplaceVars( collect );
24
 
25
+ var that = this;
26
+
27
+ // Use ACF Models introduced in ACF version 5.7.
28
+ /* eslint-disable no-unused-vars */
29
+ var acfModelInstance = new acf.Model( {
30
+ wait: "ready",
31
+ events: {
32
+ input: "onInput",
33
+ },
34
+ onInput: this.refreshAnalysisAndReplaceVars.bind( this ),
35
+ } );
36
+ /* eslint-enable no-unused-vars */
37
+
38
+ // The ACF Wysiwyg field needs to be handled after TinyMCE is initialized.
39
+ jQuery( document ).on( "tinymce-editor-init", function( event, editor ) {
40
+ /*
41
+ * TinyMCE supports the native `input` event but doesn't always fire it
42
+ * when pasting: added a specific `paste` event. Also, added TinyMCE specific
43
+ * events to support the undo and redo actions.
44
+ */
45
+ editor.on( "input paste undo redo", function() {
46
+ that.refreshAnalysisAndReplaceVars();
47
  } );
48
+ } );
49
+
50
+ /*
51
+ * ACF `append` global action: Triggered when new HTML is added to the page.
52
+ * For example, when adding a Repeater row or a Flexible content layout.
53
+ */
54
+ acf.addAction( "append", this.refreshAnalysisAndReplaceVars.bind( this ) );
55
+
56
+ /*
57
+ * ACF `remove` global action: Triggered when HTML is removed from the page.
58
+ * For example, when removing a Repeater row or a Flexible content layout.
59
+ */
60
+ acf.addAction( "remove", this.refreshAnalysisAndReplaceVars.bind( this ) );
61
+
62
+ /*
63
+ * ACF `sortstop` global action: Triggered when a field is reordered.
64
+ * For example, when reordering Repeater rows or Flexible content layouts.
65
+ */
66
+ acf.addAction( "sortstop", this.refreshAnalysisAndReplaceVars.bind( this ) );
67
  };
68
 
69
+ App.prototype.refreshAnalysisAndReplaceVars = function() {
70
+ this.maybeRefresh();
71
+ replaceVars.updateReplaceVars.bind( this, collect );
 
 
 
 
 
 
 
72
  };
73
 
74
  App.prototype.bindListeners = function() {
75
  if ( helper.acf_version >= 5 ) {
76
  jQuery( this.acf5Listener.bind( this ) );
 
 
 
 
 
 
 
 
77
  }
78
  };
79
 
84
 
85
  analysisTimeout = window.setTimeout( function() {
86
  if ( config.debug ) {
87
+ /* eslint-disable no-console */
88
  console.log( "Recalculate..." + new Date() + "(Internal)" );
89
+ /* eslint-enable no-console */
90
  }
91
 
92
  YoastSEO.app.pluginReloaded( config.pluginName );
js/src/collect/collect-v4.js DELETED
@@ -1,22 +0,0 @@
1
- /* global jQuery */
2
-
3
- var config = require( "./../config/config.js" );
4
- var fieldSelectors = config.fieldSelectors;
5
-
6
- var field_data = [];
7
-
8
- var fields = jQuery( "#post-body, #edittag" ).find( fieldSelectors.join( "," ) );
9
-
10
- fields.each( function() {
11
- var $el = jQuery( this ).parents( ".field" ).last();
12
-
13
- field_data.push( {
14
- $el: $el,
15
- key: $el.data( "field_key" ),
16
- name: $el.data( "field_name" ),
17
- type: $el.data( "field_type" ),
18
- post_meta_key: $el.data( "field_name" ),
19
- } );
20
- } );
21
-
22
- module.exports = field_data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/src/collect/collect.js CHANGED
@@ -57,7 +57,6 @@ Collect.prototype.getData = function() {
57
  if ( helper.acf_version >= 5 ) {
58
  return require( "./collect-v5.js" )();
59
  }
60
- return require( "./collect-v4.js" );
61
  };
62
 
63
  Collect.prototype.filterBlacklistType = function( field_data ) {
57
  if ( helper.acf_version >= 5 ) {
58
  return require( "./collect-v5.js" )();
59
  }
 
60
  };
61
 
62
  Collect.prototype.filterBlacklistType = function( field_data ) {
js/yoast-acf-analysis.js CHANGED
@@ -1,5 +1,5 @@
1
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
- /* global YoastSEO, acf, _, jQuery, wp */
3
  var config = require( "./config/config.js" );
4
  var helper = require( "./helper.js" );
5
  var collect = require( "./collect/collect.js" );
@@ -16,58 +16,65 @@ var App = function() {
16
  };
17
 
18
  /**
19
- * ACF 4 Listener.
20
- *
21
- * @param {Array} fieldSelectors List of field selectors.
22
- * @param {string} wysiwygSelector Element selector for WYSIWYG fields.
23
- * @param {Array} fieldSelectorsWithoutWysiwyg List of fields.
24
  *
25
  * @returns {void}
26
  */
27
- App.prototype.acf4Listener = function( fieldSelectors, wysiwygSelector, fieldSelectorsWithoutWysiwyg ) {
28
  replaceVars.updateReplaceVars( collect );
29
 
30
- var fieldsWithoutWysiwyg = jQuery( "#post-body, #edittag" ).find( fieldSelectorsWithoutWysiwyg.join( "," ) );
31
- var fields = jQuery( "#post-body, #edittag" ).find( fieldSelectors.join( "," ) );
32
-
33
- fieldsWithoutWysiwyg.on( "change", this.maybeRefresh.bind( this ) );
34
- // Do not ignore Wysiwyg fields for the purpose of Replace Vars.
35
- fields.on( "change", replaceVars.updateReplaceVars.bind( this, collect ) );
36
 
37
- if ( YoastSEO.wp._tinyMCEHelper ) {
38
- jQuery( wysiwygSelector ).each( function() {
39
- YoastSEO.wp._tinyMCEHelper.addEventHandler( this.id, [ "input", "change", "cut", "paste" ],
40
- replaceVars.updateReplaceVars.bind( this, collect ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  } );
42
- }
43
 
44
- // Also refresh on media close as attachment data might have changed
45
- wp.media.frame.on( "close", this.maybeRefresh );
46
- };
 
 
47
 
48
- /**
49
- * ACF 5 Listener.
50
- *
51
- * @returns {void}
52
- */
53
- App.prototype.acf5Listener = function() {
54
- replaceVars.updateReplaceVars( collect );
55
 
56
- acf.add_action( "change remove append sortstop", this.maybeRefresh );
57
- acf.add_action( "change remove append sortstop", replaceVars.updateReplaceVars.bind( this, collect ) );
 
 
 
 
 
 
 
 
58
  };
59
 
60
  App.prototype.bindListeners = function() {
61
  if ( helper.acf_version >= 5 ) {
62
  jQuery( this.acf5Listener.bind( this ) );
63
- } else {
64
- var fieldSelectors = config.fieldSelectors.slice( 0 );
65
- var wysiwygSelector = "textarea[id^=wysiwyg-acf]";
66
-
67
- // Ignore Wysiwyg fields because they trigger a refresh in Yoast SEO itself
68
- var fieldSelectorsWithoutWysiwyg = _.without( fieldSelectors, wysiwygSelector );
69
-
70
- jQuery( document ).on( "acf/setup_fields", this.acf4Listener.bind( this, fieldSelectors, wysiwygSelector, fieldSelectorsWithoutWysiwyg ) );
71
  }
72
  };
73
 
@@ -78,7 +85,9 @@ App.prototype.maybeRefresh = function() {
78
 
79
  analysisTimeout = window.setTimeout( function() {
80
  if ( config.debug ) {
 
81
  console.log( "Recalculate..." + new Date() + "(Internal)" );
 
82
  }
83
 
84
  YoastSEO.app.pluginReloaded( config.pluginName );
@@ -87,7 +96,7 @@ App.prototype.maybeRefresh = function() {
87
 
88
  module.exports = App;
89
 
90
- },{"./collect/collect.js":6,"./config/config.js":7,"./helper.js":8,"./replacevars.js":10}],2:[function(require,module,exports){
91
  /* global _ */
92
  var cache = require( "./cache.js" );
93
 
@@ -190,30 +199,6 @@ Cache.prototype.clear = function( store ) {
190
  module.exports = new Cache();
191
 
192
  },{}],4:[function(require,module,exports){
193
- /* global jQuery */
194
-
195
- var config = require( "./../config/config.js" );
196
- var fieldSelectors = config.fieldSelectors;
197
-
198
- var field_data = [];
199
-
200
- var fields = jQuery( "#post-body, #edittag" ).find( fieldSelectors.join( "," ) );
201
-
202
- fields.each( function() {
203
- var $el = jQuery( this ).parents( ".field" ).last();
204
-
205
- field_data.push( {
206
- $el: $el,
207
- key: $el.data( "field_key" ),
208
- name: $el.data( "field_name" ),
209
- type: $el.data( "field_type" ),
210
- post_meta_key: $el.data( "field_name" ),
211
- } );
212
- } );
213
-
214
- module.exports = field_data;
215
-
216
- },{"./../config/config.js":7}],5:[function(require,module,exports){
217
  /* global _, acf, jQuery, wp */
218
  module.exports = function() {
219
  var outerFieldsName = [
@@ -302,7 +287,7 @@ module.exports = function() {
302
  return fields;
303
  };
304
 
305
- },{}],6:[function(require,module,exports){
306
  /* global _ */
307
 
308
  var config = require( "./../config/config.js" );
@@ -362,7 +347,6 @@ Collect.prototype.getData = function() {
362
  if ( helper.acf_version >= 5 ) {
363
  return require( "./collect-v5.js" )();
364
  }
365
- return require( "./collect-v4.js" );
366
  };
367
 
368
  Collect.prototype.filterBlacklistType = function( field_data ) {
@@ -399,18 +383,18 @@ Collect.prototype.sort = function( field_data ) {
399
 
400
  module.exports = new Collect();
401
 
402
- },{"./../config/config.js":7,"./../helper.js":8,"./../scraper-store.js":11,"./collect-v4.js":4,"./collect-v5.js":5}],7:[function(require,module,exports){
403
  /* globals YoastACFAnalysisConfig */
404
  module.exports = YoastACFAnalysisConfig;
405
 
406
- },{}],8:[function(require,module,exports){
407
  var config = require( "./config/config.js" );
408
 
409
  module.exports = {
410
  acf_version: parseFloat( config.acfVersion, 10 ),
411
  };
412
 
413
- },{"./config/config.js":7}],9:[function(require,module,exports){
414
  /* global jQuery, YoastSEO, wp, YoastACFAnalysis: true */
415
  /* exported YoastACFAnalysis */
416
 
@@ -422,7 +406,7 @@ wp.domReady( function() {
422
  }
423
  } );
424
 
425
- },{"./app.js":1}],10:[function(require,module,exports){
426
  /* global _, jQuery, YoastSEO, YoastReplaceVarPlugin */
427
 
428
  var config = require( "./config/config.js" );
@@ -479,7 +463,7 @@ module.exports = {
479
  updateReplaceVars: updateReplaceVars,
480
  };
481
 
482
- },{"./config/config.js":7}],11:[function(require,module,exports){
483
  var config = require( "./config/config.js" );
484
 
485
  var scraperObjects = {
@@ -577,7 +561,7 @@ module.exports = {
577
  getScraper: getScraper,
578
  };
579
 
580
- },{"./config/config.js":7,"./scraper/scraper.block_preview.js":12,"./scraper/scraper.email.js":13,"./scraper/scraper.gallery.js":14,"./scraper/scraper.image.js":15,"./scraper/scraper.link.js":16,"./scraper/scraper.taxonomy.js":17,"./scraper/scraper.text.js":18,"./scraper/scraper.textarea.js":19,"./scraper/scraper.url.js":20,"./scraper/scraper.wysiwyg.js":21}],12:[function(require,module,exports){
581
  /* global _ */
582
 
583
  var Scraper = function() {};
@@ -598,7 +582,7 @@ Scraper.prototype.scrape = function( fields ) {
598
 
599
  module.exports = Scraper;
600
 
601
- },{}],13:[function(require,module,exports){
602
  /* global _ */
603
 
604
  var Scraper = function() {};
@@ -619,7 +603,7 @@ Scraper.prototype.scrape = function( fields ) {
619
 
620
  module.exports = Scraper;
621
 
622
- },{}],14:[function(require,module,exports){
623
  /* global _, jQuery */
624
 
625
  var attachmentCache = require( "./../cache/cache.attachments.js" );
@@ -661,7 +645,7 @@ Scraper.prototype.scrape = function( fields ) {
661
 
662
  module.exports = Scraper;
663
 
664
- },{"./../cache/cache.attachments.js":2}],15:[function(require,module,exports){
665
  /* global _ */
666
 
667
  var attachmentCache = require( "./../cache/cache.attachments.js" );
@@ -699,7 +683,7 @@ Scraper.prototype.scrape = function( fields ) {
699
 
700
  module.exports = Scraper;
701
 
702
- },{"./../cache/cache.attachments.js":2}],16:[function(require,module,exports){
703
  /* global _ */
704
  require( "./../scraper-store.js" );
705
 
@@ -734,7 +718,7 @@ Scraper.prototype.scrape = function( fields ) {
734
 
735
  module.exports = Scraper;
736
 
737
- },{"./../scraper-store.js":11}],17:[function(require,module,exports){
738
  /* global _, acf */
739
 
740
  var Scraper = function() {};
@@ -790,7 +774,7 @@ Scraper.prototype.scrape = function( fields ) {
790
 
791
  module.exports = Scraper;
792
 
793
- },{}],18:[function(require,module,exports){
794
  /* global _ */
795
 
796
  var config = require( "./../config/config.js" );
@@ -845,7 +829,7 @@ Scraper.prototype.isHeadline = function( field ) {
845
 
846
  module.exports = Scraper;
847
 
848
- },{"./../config/config.js":7}],19:[function(require,module,exports){
849
  /* global _ */
850
 
851
  var Scraper = function() {};
@@ -866,7 +850,7 @@ Scraper.prototype.scrape = function( fields ) {
866
 
867
  module.exports = Scraper;
868
 
869
- },{}],20:[function(require,module,exports){
870
  /* global _ */
871
 
872
  var Scraper = function() {};
@@ -889,7 +873,7 @@ Scraper.prototype.scrape = function( fields ) {
889
 
890
  module.exports = Scraper;
891
 
892
- },{}],21:[function(require,module,exports){
893
  /* global tinyMCE, _ */
894
 
895
  var Scraper = function() {};
@@ -948,4 +932,4 @@ Scraper.prototype.scrape = function( fields ) {
948
 
949
  module.exports = Scraper;
950
 
951
- },{}]},{},[9]);
1
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
+ /* global YoastSEO, acf, jQuery, */
3
  var config = require( "./config/config.js" );
4
  var helper = require( "./helper.js" );
5
  var collect = require( "./collect/collect.js" );
16
  };
17
 
18
  /**
19
+ * ACF 5 Listener.
 
 
 
 
20
  *
21
  * @returns {void}
22
  */
23
+ App.prototype.acf5Listener = function() {
24
  replaceVars.updateReplaceVars( collect );
25
 
26
+ var that = this;
 
 
 
 
 
27
 
28
+ // Use ACF Models introduced in ACF version 5.7.
29
+ /* eslint-disable no-unused-vars */
30
+ var acfModelInstance = new acf.Model( {
31
+ wait: "ready",
32
+ events: {
33
+ input: "onInput",
34
+ },
35
+ onInput: this.refreshAnalysisAndReplaceVars.bind( this ),
36
+ } );
37
+ /* eslint-enable no-unused-vars */
38
+
39
+ // The ACF Wysiwyg field needs to be handled after TinyMCE is initialized.
40
+ jQuery( document ).on( "tinymce-editor-init", function( event, editor ) {
41
+ /*
42
+ * TinyMCE supports the native `input` event but doesn't always fire it
43
+ * when pasting: added a specific `paste` event. Also, added TinyMCE specific
44
+ * events to support the undo and redo actions.
45
+ */
46
+ editor.on( "input paste undo redo", function() {
47
+ that.refreshAnalysisAndReplaceVars();
48
  } );
49
+ } );
50
 
51
+ /*
52
+ * ACF `append` global action: Triggered when new HTML is added to the page.
53
+ * For example, when adding a Repeater row or a Flexible content layout.
54
+ */
55
+ acf.addAction( "append", this.refreshAnalysisAndReplaceVars.bind( this ) );
56
 
57
+ /*
58
+ * ACF `remove` global action: Triggered when HTML is removed from the page.
59
+ * For example, when removing a Repeater row or a Flexible content layout.
60
+ */
61
+ acf.addAction( "remove", this.refreshAnalysisAndReplaceVars.bind( this ) );
 
 
62
 
63
+ /*
64
+ * ACF `sortstop` global action: Triggered when a field is reordered.
65
+ * For example, when reordering Repeater rows or Flexible content layouts.
66
+ */
67
+ acf.addAction( "sortstop", this.refreshAnalysisAndReplaceVars.bind( this ) );
68
+ };
69
+
70
+ App.prototype.refreshAnalysisAndReplaceVars = function() {
71
+ this.maybeRefresh();
72
+ replaceVars.updateReplaceVars.bind( this, collect );
73
  };
74
 
75
  App.prototype.bindListeners = function() {
76
  if ( helper.acf_version >= 5 ) {
77
  jQuery( this.acf5Listener.bind( this ) );
 
 
 
 
 
 
 
 
78
  }
79
  };
80
 
85
 
86
  analysisTimeout = window.setTimeout( function() {
87
  if ( config.debug ) {
88
+ /* eslint-disable no-console */
89
  console.log( "Recalculate..." + new Date() + "(Internal)" );
90
+ /* eslint-enable no-console */
91
  }
92
 
93
  YoastSEO.app.pluginReloaded( config.pluginName );
96
 
97
  module.exports = App;
98
 
99
+ },{"./collect/collect.js":5,"./config/config.js":6,"./helper.js":7,"./replacevars.js":9}],2:[function(require,module,exports){
100
  /* global _ */
101
  var cache = require( "./cache.js" );
102
 
199
  module.exports = new Cache();
200
 
201
  },{}],4:[function(require,module,exports){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /* global _, acf, jQuery, wp */
203
  module.exports = function() {
204
  var outerFieldsName = [
287
  return fields;
288
  };
289
 
290
+ },{}],5:[function(require,module,exports){
291
  /* global _ */
292
 
293
  var config = require( "./../config/config.js" );
347
  if ( helper.acf_version >= 5 ) {
348
  return require( "./collect-v5.js" )();
349
  }
 
350
  };
351
 
352
  Collect.prototype.filterBlacklistType = function( field_data ) {
383
 
384
  module.exports = new Collect();
385
 
386
+ },{"./../config/config.js":6,"./../helper.js":7,"./../scraper-store.js":10,"./collect-v5.js":4}],6:[function(require,module,exports){
387
  /* globals YoastACFAnalysisConfig */
388
  module.exports = YoastACFAnalysisConfig;
389
 
390
+ },{}],7:[function(require,module,exports){
391
  var config = require( "./config/config.js" );
392
 
393
  module.exports = {
394
  acf_version: parseFloat( config.acfVersion, 10 ),
395
  };
396
 
397
+ },{"./config/config.js":6}],8:[function(require,module,exports){
398
  /* global jQuery, YoastSEO, wp, YoastACFAnalysis: true */
399
  /* exported YoastACFAnalysis */
400
 
406
  }
407
  } );
408
 
409
+ },{"./app.js":1}],9:[function(require,module,exports){
410
  /* global _, jQuery, YoastSEO, YoastReplaceVarPlugin */
411
 
412
  var config = require( "./config/config.js" );
463
  updateReplaceVars: updateReplaceVars,
464
  };
465
 
466
+ },{"./config/config.js":6}],10:[function(require,module,exports){
467
  var config = require( "./config/config.js" );
468
 
469
  var scraperObjects = {
561
  getScraper: getScraper,
562
  };
563
 
564
+ },{"./config/config.js":6,"./scraper/scraper.block_preview.js":11,"./scraper/scraper.email.js":12,"./scraper/scraper.gallery.js":13,"./scraper/scraper.image.js":14,"./scraper/scraper.link.js":15,"./scraper/scraper.taxonomy.js":16,"./scraper/scraper.text.js":17,"./scraper/scraper.textarea.js":18,"./scraper/scraper.url.js":19,"./scraper/scraper.wysiwyg.js":20}],11:[function(require,module,exports){
565
  /* global _ */
566
 
567
  var Scraper = function() {};
582
 
583
  module.exports = Scraper;
584
 
585
+ },{}],12:[function(require,module,exports){
586
  /* global _ */
587
 
588
  var Scraper = function() {};
603
 
604
  module.exports = Scraper;
605
 
606
+ },{}],13:[function(require,module,exports){
607
  /* global _, jQuery */
608
 
609
  var attachmentCache = require( "./../cache/cache.attachments.js" );
645
 
646
  module.exports = Scraper;
647
 
648
+ },{"./../cache/cache.attachments.js":2}],14:[function(require,module,exports){
649
  /* global _ */
650
 
651
  var attachmentCache = require( "./../cache/cache.attachments.js" );
683
 
684
  module.exports = Scraper;
685
 
686
+ },{"./../cache/cache.attachments.js":2}],15:[function(require,module,exports){
687
  /* global _ */
688
  require( "./../scraper-store.js" );
689
 
718
 
719
  module.exports = Scraper;
720
 
721
+ },{"./../scraper-store.js":10}],16:[function(require,module,exports){
722
  /* global _, acf */
723
 
724
  var Scraper = function() {};
774
 
775
  module.exports = Scraper;
776
 
777
+ },{}],17:[function(require,module,exports){
778
  /* global _ */
779
 
780
  var config = require( "./../config/config.js" );
829
 
830
  module.exports = Scraper;
831
 
832
+ },{"./../config/config.js":6}],18:[function(require,module,exports){
833
  /* global _ */
834
 
835
  var Scraper = function() {};
850
 
851
  module.exports = Scraper;
852
 
853
+ },{}],19:[function(require,module,exports){
854
  /* global _ */
855
 
856
  var Scraper = function() {};
873
 
874
  module.exports = Scraper;
875
 
876
+ },{}],20:[function(require,module,exports){
877
  /* global tinyMCE, _ */
878
 
879
  var Scraper = function() {};
932
 
933
  module.exports = Scraper;
934
 
935
+ },{}]},{},[8]);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 5.2
5
  Tested up to: 5.5
6
  License: GPLv3
7
  License URI: http://www.gnu.org/licenses/gpl.html
8
- Stable tag: 2.7
9
  Requires PHP: 5.6.20
10
 
11
  WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
@@ -55,6 +55,19 @@ Previously called Yoast ACF Analysis.
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  = 2.7.0 =
59
 
60
  Released September 1st, 2020
5
  Tested up to: 5.5
6
  License: GPLv3
7
  License URI: http://www.gnu.org/licenses/gpl.html
8
+ Stable tag: 3.0
9
  Requires PHP: 5.6.20
10
 
11
  WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
55
 
56
  == Changelog ==
57
 
58
+ = 3.0.0 =
59
+
60
+ Released September 29th, 2020
61
+
62
+ Bugfixes:
63
+
64
+ * Fixes a bug where the content of ACF fields wouldn't be included in the SEO and readability analysis when using the Classic Editor plugin.
65
+ * Fixes a bug where changes to the content of ACF fields wouldn't trigger a live refresh of the SEO and readability analysis.
66
+
67
+ Other:
68
+
69
+ * No longer supports ACF versions below 5.7.
70
+
71
  = 2.7.0 =
72
 
73
  Released September 1st, 2020
tests/js/system/tests/acf4/relational.js DELETED
@@ -1,58 +0,0 @@
1
- var assert = require('assert');
2
- var logContains = require('../../helpers/logContains');
3
-
4
- module.exports = {
5
- tags: ['acf4', 'relational'],
6
-
7
- before: function (browser) {
8
- var page = browser.page.WordPressHelper();
9
- page.newPost();
10
- },
11
-
12
- beforeEach: function (browser) {
13
- },
14
-
15
- 'Taxonomy Checkbox Field' : function (browser) {
16
-
17
- var selector = '.acf-taxonomy-field .acf-checkbox-list li:first-child ';
18
-
19
- browser.waitForElementVisible( selector, 1000 );
20
-
21
- browser.pause( 3000 );
22
-
23
- browser.click( selector + 'input' );
24
-
25
- browser.getText( selector + 'label', function(result) {
26
-
27
- browser.pause( 3000 );
28
-
29
- logContains( browser, 'li>' + result.value, this.assert.ok );
30
-
31
- });
32
-
33
- },
34
-
35
- 'Taxonomy Multi Select Field' : function (browser) {
36
-
37
- var selector = '.acf-taxonomy-field select ';
38
-
39
- browser.waitForElementVisible( selector, 1000 );
40
-
41
- browser.pause( 3000 );
42
-
43
- browser.click( selector + 'option:first-child' );
44
-
45
- browser.getText( selector + 'option:checked', function(result) {
46
-
47
- this.pause( 3000 );
48
-
49
- logContains( browser, 'li>' + result.value, this.assert.ok );
50
-
51
- });
52
-
53
- },
54
-
55
- after : function(browser) {
56
- browser.end();
57
- }
58
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/php/unit/assets-test.php CHANGED
@@ -67,6 +67,6 @@ class Assets_Test extends TestCase {
67
  $testee = new Yoast_ACF_Analysis_Assets();
68
  $testee->init();
69
 
70
- $this->assertTrue( \has_filter( 'admin_enqueue_scripts', [ $testee, 'enqueue_scripts' ] ) );
71
  }
72
  }
67
  $testee = new Yoast_ACF_Analysis_Assets();
68
  $testee->init();
69
 
70
+ $this->assertTrue( \has_action( 'admin_enqueue_scripts', [ $testee, 'enqueue_scripts' ] ) );
71
  }
72
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit39bd3b2754fd891472148a5e48601316::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitb16e92a98626f65823b0d33fe06ec4cf::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -60,7 +60,7 @@ class ClassLoader
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
- return call_user_func_array('array_merge', $this->prefixesPsr0);
64
  }
65
 
66
  return array();
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
64
  }
65
 
66
  return array();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit39bd3b2754fd891472148a5e48601316
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit39bd3b2754fd891472148a5e48601316
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit39bd3b2754fd891472148a5e48601316', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit39bd3b2754fd891472148a5e48601316', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit39bd3b2754fd891472148a5e48601316::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitb16e92a98626f65823b0d33fe06ec4cf
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitb16e92a98626f65823b0d33fe06ec4cf', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb16e92a98626f65823b0d33fe06ec4cf', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitb16e92a98626f65823b0d33fe06ec4cf::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit39bd3b2754fd891472148a5e48601316
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
@@ -126,9 +126,9 @@ class ComposerStaticInit39bd3b2754fd891472148a5e48601316
126
  public static function getInitializer(ClassLoader $loader)
127
  {
128
  return \Closure::bind(function () use ($loader) {
129
- $loader->prefixLengthsPsr4 = ComposerStaticInit39bd3b2754fd891472148a5e48601316::$prefixLengthsPsr4;
130
- $loader->prefixDirsPsr4 = ComposerStaticInit39bd3b2754fd891472148a5e48601316::$prefixDirsPsr4;
131
- $loader->classMap = ComposerStaticInit39bd3b2754fd891472148a5e48601316::$classMap;
132
 
133
  }, null, ClassLoader::class);
134
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitb16e92a98626f65823b0d33fe06ec4cf
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
126
  public static function getInitializer(ClassLoader $loader)
127
  {
128
  return \Closure::bind(function () use ($loader) {
129
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb16e92a98626f65823b0d33fe06ec4cf::$prefixLengthsPsr4;
130
+ $loader->prefixDirsPsr4 = ComposerStaticInitb16e92a98626f65823b0d33fe06ec4cf::$prefixDirsPsr4;
131
+ $loader->classMap = ComposerStaticInitb16e92a98626f65823b0d33fe06ec4cf::$classMap;
132
 
133
  }, null, ClassLoader::class);
134
  }
yoast-acf-analysis.php CHANGED
@@ -7,8 +7,8 @@
7
  * @wordpress-plugin
8
  * Plugin Name: ACF Content Analysis for Yoast SEO
9
  * Plugin URI: https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
10
- * Description: Ensure that Yoast SEO analyzes all Advanced Custom Fields 4 and 5 content including Flexible Content and Repeaters.
11
- * Version: 2.7
12
  * Author: Thomas Kräftner, ViktorFroberg, marol87, pekz0r, angrycreative, Team Yoast
13
  * Author URI: http://angrycreative.se
14
  * License: GPL v3
7
  * @wordpress-plugin
8
  * Plugin Name: ACF Content Analysis for Yoast SEO
9
  * Plugin URI: https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
10
+ * Description: Ensure that Yoast SEO analyzes all Advanced Custom Fields 5.7+ content including Flexible Content and Repeaters.
11
+ * Version: 3.0
12
  * Author: Thomas Kräftner, ViktorFroberg, marol87, pekz0r, angrycreative, Team Yoast
13
  * Author URI: http://angrycreative.se
14
  * License: GPL v3