Version Description
- FIX DomDocument issue if "Automatically set the image Alt text from target keywords option" is enabled
Download this release
Release Info
Developer | rainbowgeek |
Plugin | SEOPress |
Version | 4.1.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.1.5.1
- inc/functions/options-advanced.php +18 -28
- readme.txt +3 -1
- seopress.php +2 -2
inc/functions/options-advanced.php
CHANGED
@@ -225,39 +225,29 @@ if (seopress_advanced_advanced_image_auto_alt_target_kw_option() !='') {
|
|
225 |
add_filter( 'wp_get_attachment_image_attributes', 'seopress_auto_img_alt_thumb_target_kw', 10, 2 );
|
226 |
|
227 |
function seopress_auto_img_alt_target_kw($content) {
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
$dom = new domDocument;
|
233 |
-
$internalErrors = libxml_use_internal_errors(true);
|
234 |
-
|
235 |
-
if (function_exists('mb_convert_encoding')) {
|
236 |
-
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED); //Remove doctype, HTML/Body tags
|
237 |
-
} else {
|
238 |
-
$dom->loadHTML('<?xml encoding="utf-8" ?>'.$content, LIBXML_HTML_NOIMPLIED); //Remove doctype, HTML/Body tags
|
239 |
-
}
|
240 |
|
241 |
-
|
|
|
242 |
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
if ((isset($images) && !empty ($images) && $images->length>=1)) {
|
250 |
-
foreach($images as $img) {
|
251 |
-
if ($img->getAttribute('alt') =='') {
|
252 |
-
if (get_post_meta(get_the_ID(), '_seopress_analysis_target_kw', true) !='') {
|
253 |
-
$img = $img->setAttribute('alt', htmlspecialchars(esc_html(get_post_meta(get_the_ID(), '_seopress_analysis_target_kw', true))));
|
254 |
-
}
|
255 |
-
}
|
256 |
-
}
|
257 |
}
|
258 |
-
|
259 |
|
260 |
-
|
261 |
}
|
262 |
add_filter('the_content', 'seopress_auto_img_alt_target_kw', 20, 1);
|
263 |
}
|
225 |
add_filter( 'wp_get_attachment_image_attributes', 'seopress_auto_img_alt_thumb_target_kw', 10, 2 );
|
226 |
|
227 |
function seopress_auto_img_alt_target_kw($content) {
|
228 |
+
if ($content =='') {
|
229 |
+
return $content;
|
230 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
$regex = '#<img[^>]* alt=(?:\"|\')(?<alt>([^"]*))(?:\"|\')[^>]*>#mU';
|
233 |
+
preg_match_all($regex, $content, $matches);
|
234 |
|
235 |
+
$matchesAlt = $matches['alt'];
|
236 |
+
|
237 |
+
if (empty($matchesAlt)) {
|
238 |
+
return $content;
|
239 |
+
}
|
240 |
+
|
241 |
+
foreach ($matchesAlt as $key => $alt) {
|
242 |
+
if (!empty($alt)) {
|
243 |
+
continue;
|
244 |
}
|
245 |
+
if (get_post_meta(get_the_ID(), '_seopress_analysis_target_kw', true) !='') {
|
246 |
+
$alt = htmlspecialchars(esc_html(get_post_meta(get_the_ID(), '_seopress_analysis_target_kw', true)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
+
}
|
249 |
|
250 |
+
return $content;
|
251 |
}
|
252 |
add_filter('the_content', 'seopress_auto_img_alt_target_kw', 20, 1);
|
253 |
}
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: SEO, XML sitemap, meta title, open graph, content analysis, knowledge grap
|
|
6 |
Requires at least: 4.7+
|
7 |
Tested up to: 5.5
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 4.1.5
|
10 |
License: GPLv2 or later
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -310,6 +310,8 @@ You're theme is probably using a deprecated function to handle the title. <a hre
|
|
310 |
8. Installation Wizard
|
311 |
|
312 |
== Changelog ==
|
|
|
|
|
313 |
= 4.1.5 =
|
314 |
* NEW Google Place ID field for Local Business Widget (SEO, PRO, Local Business) to display POI when clicking on the map link (PRO)
|
315 |
* INFO Exclude posts and terms from XML sitemaps if custom canonical URL set from SEO metabox
|
6 |
Requires at least: 4.7+
|
7 |
Tested up to: 5.5
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 4.1.5.1
|
10 |
License: GPLv2 or later
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
310 |
8. Installation Wizard
|
311 |
|
312 |
== Changelog ==
|
313 |
+
= 4.1.5.1 =
|
314 |
+
* FIX DomDocument issue if "Automatically set the image Alt text from target keywords option" is enabled
|
315 |
= 4.1.5 =
|
316 |
* NEW Google Place ID field for Local Business Widget (SEO, PRO, Local Business) to display POI when clicking on the map link (PRO)
|
317 |
* INFO Exclude posts and terms from XML sitemaps if custom canonical URL set from SEO metabox
|
seopress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: SEOPress
|
4 |
Plugin URI: https://www.seopress.org/
|
5 |
Description: One of the best SEO plugins for WordPress.
|
6 |
-
Version: 4.1.5
|
7 |
Author: SEOPress
|
8 |
Author URI: https://www.seopress.org/
|
9 |
License: GPLv2
|
@@ -55,7 +55,7 @@ register_deactivation_hook(__FILE__, 'seopress_deactivation');
|
|
55 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
56 |
//Define
|
57 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
-
define( 'SEOPRESS_VERSION', '4.1.5' );
|
59 |
define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
|
60 |
|
61 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
3 |
Plugin Name: SEOPress
|
4 |
Plugin URI: https://www.seopress.org/
|
5 |
Description: One of the best SEO plugins for WordPress.
|
6 |
+
Version: 4.1.5.1
|
7 |
Author: SEOPress
|
8 |
Author URI: https://www.seopress.org/
|
9 |
License: GPLv2
|
55 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
56 |
//Define
|
57 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
+
define( 'SEOPRESS_VERSION', '4.1.5.1' );
|
59 |
define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
|
60 |
|
61 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|