ACF Content Analysis for Yoast SEO - Version 1.2.0

Version Description

  • Add support for alt and title tags in images.
  • Security improvements
  • Images returned as url will now be analysed as urls.
Download this release

Release Info

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

Code changes from version 1.1.1 to 1.2.0

readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === ACF-Content Analysis for Yoast SEO ===
2
- Contributors: viktorfroberg, marol87, pekz0r, angrycreative
3
  Tags: Angry Creative, Yoast SEO, Yoast, SEO, ACF, Advanced Custom Fields
4
  Requires at least: 4.0
5
- Tested up to: 4.4.1
6
- Stable tag: 1.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -12,7 +12,7 @@ Requires version 3.0 or later of Yoast SEO plugin.
12
 
13
  == Description ==
14
 
15
- This plugin ensures that Yoast SEO analysize all ACF content including FlexiContent and Repeaters.
16
  Requires version 3.0 or later of Yoast SEO plugin.
17
 
18
  = Filters =
@@ -36,6 +36,11 @@ add_filter('ysacf_exclude_fields', function(){
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
39
  = 1.1.1 =
40
  * Bugfix for undefined index
41
 
1
  === ACF-Content Analysis for Yoast SEO ===
2
+ Contributors: ViktorFroberg, marol87, pekz0r, angrycreative
3
  Tags: Angry Creative, Yoast SEO, Yoast, SEO, ACF, Advanced Custom Fields
4
  Requires at least: 4.0
5
+ Tested up to: 4.4.2
6
+ Stable tag: 1.2.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
12
 
13
  == Description ==
14
 
15
+ This plugin ensures that Yoast SEO analysize all ACF content including Flexible Content and Repeaters.
16
  Requires version 3.0 or later of Yoast SEO plugin.
17
 
18
  = Filters =
36
 
37
  == Changelog ==
38
 
39
+ = 1.2.0 =
40
+ * Add support for alt and title tags in images.
41
+ * Security improvements
42
+ * Images returned as url will now be analysed as urls.
43
+
44
  = 1.1.1 =
45
  * Bugfix for undefined index
46
 
yoast-seo-acf-content-analysis.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: ACF-Content Analysis for Yoast SEO
4
  Plugin URI: http://angrycreative.se
5
  Description: This plugin ensures that Yoast SEO analysize all ACF content including Flexible Content and Repeaters
6
- Version: 1.1.1
7
  Author: ViktorFroberg, marol87, pekz0r, angrycreative
8
  Author URI: http://angrycreative.se
9
  License: GPL
@@ -23,12 +23,12 @@ define('AC_SEO_ACF_ANALYSIS_PLUGIN_NAME', untrailingslashit(plugin_basename(__FI
23
  class AC_Yoast_SEO_ACF_Content_Analysis
24
  {
25
  /**
26
- * Plugin version, used for autoatic updates and for cache-busting of style and script file references.
27
  *
28
  * @since 0.1.0
29
  * @var string
30
  */
31
- const VERSION = '1.0';
32
  /**
33
  * Unique identifier for the plugin.
34
  * This value is used as the text domain when internationalizing strings of text. It should
@@ -82,7 +82,7 @@ class AC_Yoast_SEO_ACF_Content_Analysis
82
 
83
  $values = $this->get_values( $fields );
84
  $data = '';
85
-
86
  foreach($fields as $key =>$item) {
87
 
88
  if(in_array($key, $this->get_excluded_fields()) ){
@@ -90,17 +90,21 @@ class AC_Yoast_SEO_ACF_Content_Analysis
90
  } else {
91
  switch(gettype($item)) {
92
  case 'string':
93
- if (preg_match('/(\.jpg|\.png|\.bmp)$/', $item)) {
94
- $data = $data.' <img src="'.$item .'">';
95
- } else {
96
- $data = $data.' '.$item;
97
- }
98
-
99
  break;
 
100
  case 'array':
101
- if($key === 'sizes' && isset($item['sizes']['thumbnail'])) {
102
  // put all images in img tags for scoring.
103
- $data = $data.' <img src="'.$item['sizes']['thumbnail'];
 
 
 
 
 
 
 
 
104
  } else {
105
 
106
  $data = $data.' '.$this->get_field_data($item);
@@ -120,7 +124,9 @@ class AC_Yoast_SEO_ACF_Content_Analysis
120
  }
121
 
122
  function ajax_get_fields() {
123
- $pid = $_POST['postId'];
 
 
124
 
125
  $fields = get_fields( $pid );
126
 
@@ -138,7 +144,10 @@ class AC_Yoast_SEO_ACF_Content_Analysis
138
 
139
  // if this is a taxonomy, get the taxonomy id else get the post id
140
  if($this->pagenow === 'edit-tags.php' ) {
141
- $id = $_GET['taxonomy'] . '_' . $_GET['tag_ID'];
 
 
 
142
  wp_enqueue_script($this->plugin_slug, AC_SEO_ACF_ANALYSIS_PLUGIN_URL . 'yoast-seo-plugin.js', array('jquery', 'yoast-seo', 'wp-seo-term-scraper'), self::VERSION);
143
  } else {
144
  global $post;
3
  Plugin Name: ACF-Content Analysis for Yoast SEO
4
  Plugin URI: http://angrycreative.se
5
  Description: This plugin ensures that Yoast SEO analysize all ACF content including Flexible Content and Repeaters
6
+ Version: 1.2.0
7
  Author: ViktorFroberg, marol87, pekz0r, angrycreative
8
  Author URI: http://angrycreative.se
9
  License: GPL
23
  class AC_Yoast_SEO_ACF_Content_Analysis
24
  {
25
  /**
26
+ * Plugin version, used for automatic updates and for cache-busting of style and script file references.
27
  *
28
  * @since 0.1.0
29
  * @var string
30
  */
31
+ const VERSION = '1.2.0';
32
  /**
33
  * Unique identifier for the plugin.
34
  * This value is used as the text domain when internationalizing strings of text. It should
82
 
83
  $values = $this->get_values( $fields );
84
  $data = '';
85
+
86
  foreach($fields as $key =>$item) {
87
 
88
  if(in_array($key, $this->get_excluded_fields()) ){
90
  } else {
91
  switch(gettype($item)) {
92
  case 'string':
93
+ $data = $data.' '.$item;
 
 
 
 
 
94
  break;
95
+
96
  case 'array':
97
+ if(isset($item['sizes']['thumbnail'])) {
98
  // put all images in img tags for scoring.
99
+ $alt = '';
100
+ if(isset($item['alt'])) {
101
+ $alt = $item['alt'];
102
+ }
103
+ $title = '';
104
+ if(isset($item['title'])) {
105
+ $title = $item['title'];
106
+ }
107
+ $data = $data.' <img src="'.$item['sizes']['thumbnail'] . '" alt="' . $alt .'" title="' . $title . '"/>';
108
  } else {
109
 
110
  $data = $data.' '.$this->get_field_data($item);
124
  }
125
 
126
  function ajax_get_fields() {
127
+
128
+ $pid = filter_input(INPUT_POST, 'postId', FILTER_SANITIZE_STRING);
129
+
130
 
131
  $fields = get_fields( $pid );
132
 
144
 
145
  // if this is a taxonomy, get the taxonomy id else get the post id
146
  if($this->pagenow === 'edit-tags.php' ) {
147
+
148
+ $id = filter_input(INPUT_GET, 'taxonomy', FILTER_SANITIZE_STRING) . '_' . filter_input(INPUT_GET, 'tag_ID', FILTER_SANITIZE_NUMBER_INT);
149
+
150
+ //$id = esc_attr( trim( $_GET['taxonomy'] ) ) . '_' . intval( trim( $_GET['tag_ID'] ) );
151
  wp_enqueue_script($this->plugin_slug, AC_SEO_ACF_ANALYSIS_PLUGIN_URL . 'yoast-seo-plugin.js', array('jquery', 'yoast-seo', 'wp-seo-term-scraper'), self::VERSION);
152
  } else {
153
  global $post;
yoast-seo-plugin.js CHANGED
@@ -25,7 +25,6 @@ jQuery( document ).ready( function($) {
25
  .done(function(acf_fields) {
26
 
27
  $this.setFieldData(acf_fields);
28
-
29
 
30
  })
31
  .fail(function(data) {
25
  .done(function(acf_fields) {
26
 
27
  $this.setFieldData(acf_fields);
 
28
 
29
  })
30
  .fail(function(data) {