Version Description
- Fix : Redirect to home page when WPMS Addon is not activated
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 3.7.6 |
Comparing to | |
See all releases |
Code changes from version 3.7.5 to 3.7.6
- languages/wp-meta-seo-en_US.mo +0 -0
- readme.txt +5 -2
- wp-meta-seo.php +135 -133
languages/wp-meta-seo-en_US.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: JoomUnited
|
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.8
|
6 |
-
Stable tag: 3.7.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -277,10 +277,13 @@ Yes WP Meta SEO is compatible with Gutenberg editor since 3.7 version.
|
|
277 |
|
278 |
== Changelog ==
|
279 |
|
|
|
|
|
|
|
280 |
= 3.7.5 =
|
281 |
* Fix : Warning returned on frontend
|
282 |
* Fix : Load Dashboard widget content using ajax method (large amount of data)
|
283 |
-
* Fix :
|
284 |
|
285 |
= 3.7.4 =
|
286 |
* Fix : Update alt meta for Elementor image in content
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.8
|
6 |
+
Stable tag: 3.7.6
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
277 |
|
278 |
== Changelog ==
|
279 |
|
280 |
+
= 3.7.6 =
|
281 |
+
* Fix : Redirect to home page when WPMS Addon is not activated
|
282 |
+
|
283 |
= 3.7.5 =
|
284 |
* Fix : Warning returned on frontend
|
285 |
* Fix : Load Dashboard widget content using ajax method (large amount of data)
|
286 |
+
* Fix : �PHP warning in redirect URL interface
|
287 |
|
288 |
= 3.7.4 =
|
289 |
* Fix : Update alt meta for Elementor image in content
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version: 3.7.
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
@@ -90,7 +90,7 @@ if (!defined('WPMSEO_VERSION')) {
|
|
90 |
/**
|
91 |
* Plugin version
|
92 |
*/
|
93 |
-
define('WPMSEO_VERSION', '3.7.
|
94 |
}
|
95 |
|
96 |
if (!defined('WPMS_CLIENTID')) {
|
@@ -637,53 +637,81 @@ function wpmsTemplateRedirect()
|
|
637 |
{
|
638 |
global $wpdb;
|
639 |
// redirect by rule
|
640 |
-
if (is_plugin_active(WPMSEO_ADDON_FILENAME)) {
|
641 |
-
$url = '';
|
642 |
-
if (isset($_SERVER['REQUEST_URI'])) {
|
643 |
-
$url = $_SERVER['REQUEST_URI'];
|
644 |
-
}
|
645 |
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
$target = '';
|
651 |
-
$status_redirect = 302;
|
652 |
-
foreach ($redirects as $link) {
|
653 |
-
$link->link_url = str_replace(' ', '%20', $link->link_url);
|
654 |
-
$matches = false;
|
655 |
-
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- remove warning if match the URL
|
656 |
-
if ((($link->link_url === $url || $link->link_url === rtrim($url, '/') || $link->link_url === urldecode($url))) || (@preg_match('@' . str_replace('@', '\\@', $link->link_url) . '@', $url, $matches) > 0) || (@preg_match('@' . str_replace('@', '\\@', $link->link_url) . '@', urldecode($url), $matches) > 0)) {
|
657 |
-
$target = $link->link_url_redirect;
|
658 |
-
if ($link->type === 'add_custom') {
|
659 |
-
$status_redirect = $link->meta_title;
|
660 |
-
}
|
661 |
|
662 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
}
|
|
|
|
|
664 |
}
|
|
|
665 |
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
array(
|
688 |
$url,
|
689 |
$esc_url,
|
@@ -691,106 +719,80 @@ function wpmsTemplateRedirect()
|
|
691 |
)
|
692 |
));
|
693 |
|
694 |
-
if (
|
695 |
-
|
696 |
-
$
|
697 |
-
'
|
698 |
-
|
699 |
-
'
|
700 |
-
'
|
701 |
-
'
|
702 |
-
'broken_internal' => 0,
|
703 |
-
'warning' => 0,
|
704 |
-
'dismissed' => 0
|
705 |
);
|
706 |
|
707 |
-
$
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
$
|
716 |
-
)
|
717 |
-
));
|
718 |
-
|
719 |
-
if (!empty($links_broken)) {
|
720 |
-
$value = array('hit' => (int) $links_broken->hit + 1);
|
721 |
-
$wpdb->update(
|
722 |
-
$wpdb->prefix . 'wpms_links',
|
723 |
-
$value,
|
724 |
-
array('id' => $links_broken->id),
|
725 |
-
array('%d'),
|
726 |
-
array('%d')
|
727 |
-
);
|
728 |
-
|
729 |
-
if (($url === $links_broken->link_url || esc_url($url) === $links_broken->link_url)
|
730 |
-
&& $links_broken->link_url_redirect !== '') {
|
731 |
-
if ($links_broken->type === 'add_custom') {
|
732 |
-
$status_redirect = $links_broken->meta_title;
|
733 |
-
} else {
|
734 |
-
$status_redirect = 302;
|
735 |
-
}
|
736 |
-
if (empty($status_redirect)) {
|
737 |
-
$status_redirect = 302;
|
738 |
-
}
|
739 |
-
wp_redirect($links_broken->link_url_redirect, $status_redirect);
|
740 |
-
exit();
|
741 |
}
|
|
|
|
|
742 |
}
|
743 |
}
|
744 |
}
|
|
|
745 |
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
}
|
780 |
}
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
}
|
792 |
-
|
793 |
-
|
794 |
}
|
795 |
}
|
796 |
}
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 3.7.6
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
90 |
/**
|
91 |
* Plugin version
|
92 |
*/
|
93 |
+
define('WPMSEO_VERSION', '3.7.6');
|
94 |
}
|
95 |
|
96 |
if (!defined('WPMS_CLIENTID')) {
|
637 |
{
|
638 |
global $wpdb;
|
639 |
// redirect by rule
|
|
|
|
|
|
|
|
|
|
|
640 |
|
641 |
+
$url = '';
|
642 |
+
if (isset($_SERVER['REQUEST_URI'])) {
|
643 |
+
$url = $_SERVER['REQUEST_URI'];
|
644 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
|
646 |
+
if (!is_home() && !is_front_page()) {
|
647 |
+
$redirects = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wpms_links WHERE (link_url = %s AND link_url != "/") OR type = "add_rule" OR type = "add_custom"', array(
|
648 |
+
$url
|
649 |
+
)));
|
650 |
+
$target = '';
|
651 |
+
$status_redirect = 302;
|
652 |
+
foreach ($redirects as $link) {
|
653 |
+
$link->link_url = str_replace(' ', '%20', $link->link_url);
|
654 |
+
$matches = false;
|
655 |
+
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- remove warning if match the URL
|
656 |
+
if ((($link->link_url === $url || $link->link_url === rtrim($url, '/') || $link->link_url === urldecode($url))) || (@preg_match('@' . str_replace('@', '\\@', $link->link_url) . '@', $url, $matches) > 0) || (@preg_match('@' . str_replace('@', '\\@', $link->link_url) . '@', urldecode($url), $matches) > 0)) {
|
657 |
+
$target = $link->link_url_redirect;
|
658 |
+
if ($link->type === 'add_custom') {
|
659 |
+
if (!is_plugin_active(WPMSEO_ADDON_FILENAME)) {
|
660 |
+
return;
|
661 |
+
}
|
662 |
+
$status_redirect = $link->meta_title;
|
663 |
}
|
664 |
+
|
665 |
+
break;
|
666 |
}
|
667 |
+
}
|
668 |
|
669 |
+
if ($target) {
|
670 |
+
if (empty($status_redirect)) {
|
671 |
+
$status_redirect = 302;
|
672 |
+
}
|
673 |
+
wp_redirect($target, $status_redirect);
|
674 |
+
exit();
|
675 |
+
} else {
|
676 |
+
if (is_404()) {
|
677 |
+
if (isset($_SERVER['REQUEST_URI'])) {
|
678 |
+
$url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
679 |
+
if (isset($_SERVER['HTTPS']) &&
|
680 |
+
($_SERVER['HTTPS'] === 'on' || (int) $_SERVER['HTTPS'] === 1) ||
|
681 |
+
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
682 |
+
$_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
683 |
+
$protocol = 'https://';
|
684 |
+
} else {
|
685 |
+
$protocol = 'http://';
|
686 |
+
}
|
687 |
+
$esc_url = str_replace(array('http://', 'https://'), $protocol, esc_url($url));
|
688 |
+
$check = $wpdb->get_results($wpdb->prepare(
|
689 |
+
'SELECT * FROM ' . $wpdb->prefix . 'wpms_links WHERE (link_url=%s OR link_url=%s OR link_url=%s)',
|
690 |
+
array(
|
691 |
+
$url,
|
692 |
+
$esc_url,
|
693 |
+
$_SERVER['REQUEST_URI']
|
694 |
+
)
|
695 |
+
));
|
696 |
+
|
697 |
+
if (count($check) === 0) {
|
698 |
+
// insert url
|
699 |
+
$insert = array(
|
700 |
+
'link_url' => ($url),
|
701 |
+
'status_code' => '404 Not Found',
|
702 |
+
'status_text' => '404 Not Found',
|
703 |
+
'type' => '404_automaticaly',
|
704 |
+
'broken_indexed' => 1,
|
705 |
+
'broken_internal' => 0,
|
706 |
+
'warning' => 0,
|
707 |
+
'dismissed' => 0
|
708 |
+
);
|
709 |
+
|
710 |
+
$wpdb->insert($wpdb->prefix . 'wpms_links', $insert);
|
711 |
+
} else {
|
712 |
+
// update url
|
713 |
+
$links_broken = $wpdb->get_row($wpdb->prepare(
|
714 |
+
'SELECT * FROM ' . $wpdb->prefix . 'wpms_links WHERE (link_url=%s OR link_url=%s OR link_url=%s) ',
|
715 |
array(
|
716 |
$url,
|
717 |
$esc_url,
|
719 |
)
|
720 |
));
|
721 |
|
722 |
+
if (!empty($links_broken)) {
|
723 |
+
$value = array('hit' => (int) $links_broken->hit + 1);
|
724 |
+
$wpdb->update(
|
725 |
+
$wpdb->prefix . 'wpms_links',
|
726 |
+
$value,
|
727 |
+
array('id' => $links_broken->id),
|
728 |
+
array('%d'),
|
729 |
+
array('%d')
|
|
|
|
|
|
|
730 |
);
|
731 |
|
732 |
+
if (($url === $links_broken->link_url || esc_url($url) === $links_broken->link_url)
|
733 |
+
&& $links_broken->link_url_redirect !== '') {
|
734 |
+
if (!empty($links_broken->meta_title)) {
|
735 |
+
$status_redirect = $links_broken->meta_title;
|
736 |
+
} else {
|
737 |
+
$status_redirect = 302;
|
738 |
+
}
|
739 |
+
if (empty($status_redirect)) {
|
740 |
+
$status_redirect = 302;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
}
|
742 |
+
wp_redirect($links_broken->link_url_redirect, $status_redirect);
|
743 |
+
exit();
|
744 |
}
|
745 |
}
|
746 |
}
|
747 |
+
}
|
748 |
|
749 |
+
$defaul_settings_404 = array(
|
750 |
+
'wpms_redirect_homepage' => 0,
|
751 |
+
'wpms_type_404' => 'none',
|
752 |
+
'wpms_page_redirected' => 'none'
|
753 |
+
);
|
754 |
+
$wpms_settings_404 = get_option('wpms_settings_404');
|
755 |
|
756 |
+
if (is_array($wpms_settings_404)) {
|
757 |
+
$defaul_settings_404 = array_merge($defaul_settings_404, $wpms_settings_404);
|
758 |
+
}
|
759 |
|
760 |
+
// redirect url by settings
|
761 |
+
if (isset($defaul_settings_404['wpms_redirect_homepage'])
|
762 |
+
&& (int) $defaul_settings_404['wpms_redirect_homepage'] === 1) {
|
763 |
+
wp_redirect(get_home_url());
|
764 |
+
exit();
|
765 |
+
} else {
|
766 |
+
if (isset($defaul_settings_404['wpms_type_404'])) {
|
767 |
+
switch ($defaul_settings_404['wpms_type_404']) {
|
768 |
+
case 'wp-meta-seo-page':
|
769 |
+
global $wpdb;
|
770 |
+
$wpms_page = $wpdb->get_row($wpdb->prepare(
|
771 |
+
'SELECT * FROM ' . $wpdb->prefix . 'posts WHERE post_title = %s AND post_excerpt = %s',
|
772 |
+
array(
|
773 |
+
'404 Error, content does not exist anymore',
|
774 |
+
'metaseo_404_page'
|
775 |
+
)
|
776 |
+
));
|
777 |
+
if (!empty($wpms_page)) {
|
778 |
+
$link_redirect = get_permalink($wpms_page->ID);
|
779 |
+
if ($link_redirect) {
|
780 |
+
wp_redirect($link_redirect);
|
781 |
+
exit();
|
|
|
782 |
}
|
783 |
+
}
|
784 |
+
break;
|
785 |
+
|
786 |
+
case 'custom_page':
|
787 |
+
if (isset($defaul_settings_404['wpms_page_redirected'])
|
788 |
+
&& $defaul_settings_404['wpms_page_redirected'] !== 'none') {
|
789 |
+
$link_redirect = get_permalink($defaul_settings_404['wpms_page_redirected']);
|
790 |
+
if ($link_redirect) {
|
791 |
+
wp_redirect($link_redirect);
|
792 |
+
exit();
|
793 |
}
|
794 |
+
}
|
795 |
+
break;
|
796 |
}
|
797 |
}
|
798 |
}
|