Version Description
2020-12-02 - Provided an option to disable published and modified time being added as open graph tags for article og type. Added a button to exit the setup wizard that is triggered on plugin activation.
Download this release
Release Info
Developer | Rajesh Babu |
Plugin | Platinum SEO Pack |
Version | 2.2.4 |
Comparing to | |
See all releases |
Code changes from version 2.2.3 to 2.2.4
- Changelog.txt +3 -1
- platinum-seo-pack.php +1 -1
- psp-include/generators/psp_social_metas.php +6 -1
- psp-include/settings/psp_social_settings.php +17 -0
- psp-include/utilities/psp_helper.php +1 -1
- psp-include/wizard/psp_wizard_startbtn_renderer.php +7 -1
- psp_main.php +7 -592
- readme.txt +8 -3
Changelog.txt
CHANGED
@@ -1,8 +1,10 @@
|
|
|
|
|
|
|
|
1 |
= 2.2.3 =
|
2 |
2020-11-21 - Fixed dashboard console menu disappearing from the WordPress Admin.
|
3 |
|
4 |
= 2.2.2 =
|
5 |
-
|
6 |
2020-11-21 - Fixed a bug that caused he featured image to be not set when using the classic editor plugin in WordPress. Fixed a bug that was logging an "Headers already Sent" error when updating a post.
|
7 |
|
8 |
= 2.2.1 =
|
1 |
+
= 2.2.4 =
|
2 |
+
2020-12-02 - Provided an option to disable published and modified time being added as open graph tags for article og type. Added a button to exit the setup wizard that is triggered on plugin activation.
|
3 |
+
|
4 |
= 2.2.3 =
|
5 |
2020-11-21 - Fixed dashboard console menu disappearing from the WordPress Admin.
|
6 |
|
7 |
= 2.2.2 =
|
|
|
8 |
2020-11-21 - Fixed a bug that caused he featured image to be not set when using the classic editor plugin in WordPress. Fixed a bug that was logging an "Headers already Sent" error when updating a post.
|
9 |
|
10 |
= 2.2.1 =
|
platinum-seo-pack.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Platinum SEO Pack
|
5 |
Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
|
6 |
Description: Complete SEO and Social optimization solution for your Wordpress blog/site. It is Simple, Uncomplicated and User friendly with several useful features.
|
7 |
-
Version: 2.2.
|
8 |
Author: Techblissonline.com (Rajesh)
|
9 |
Author URI: https://techblissonline.com/
|
10 |
Text Domain: platinum-seo-pack
|
4 |
Plugin Name: Platinum SEO Pack
|
5 |
Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
|
6 |
Description: Complete SEO and Social optimization solution for your Wordpress blog/site. It is Simple, Uncomplicated and User friendly with several useful features.
|
7 |
+
Version: 2.2.4
|
8 |
Author: Techblissonline.com (Rajesh)
|
9 |
Author URI: https://techblissonline.com/
|
10 |
Text Domain: platinum-seo-pack
|
psp-include/generators/psp_social_metas.php
CHANGED
@@ -895,7 +895,12 @@ class PspSocialMetas {
|
|
895 |
if (is_singular () && !is_front_page() && $this->fb_og_type == "article" ) {
|
896 |
//$this->og_tags();
|
897 |
//$this->og_category();
|
898 |
-
$
|
|
|
|
|
|
|
|
|
|
|
899 |
//if ($this->fbpage != '') {
|
900 |
// $this->openGraphMetaTagBuilder('publisher', $this->fbpage, false, 'article');
|
901 |
//}
|
895 |
if (is_singular () && !is_front_page() && $this->fb_og_type == "article" ) {
|
896 |
//$this->og_tags();
|
897 |
//$this->og_category();
|
898 |
+
$psp_settings_name = "psp_social_settings";
|
899 |
+
$psp_social_settings = get_option($psp_settings_name);
|
900 |
+
$psp_og_times_disabled = !empty($psp_social_settings['psp_og_times_disabled']) ? $psp_social_settings['psp_og_times_disabled'] : '';
|
901 |
+
if (!$psp_og_times_disabled ) {
|
902 |
+
$this->og_publish_date();
|
903 |
+
}
|
904 |
//if ($this->fbpage != '') {
|
905 |
// $this->openGraphMetaTagBuilder('publisher', $this->fbpage, false, 'article');
|
906 |
//}
|
psp-include/settings/psp_social_settings.php
CHANGED
@@ -230,6 +230,19 @@ class PspSocialSettings extends PspSettings {
|
|
230 |
|
231 |
add_settings_field( $psp_fb_defailt_img_field_id, $psp_fb_defailt_img_field_title, array( &$this, 'psp_add_field_text_url' ), $this->psp_social_settings_group, $section_id, $psp_fb_defailt_img_field);
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
//Twitter Section
|
234 |
$section_id = 'psp_twitter_section';
|
235 |
$section_title = esc_html__('Twitter Card Sitewide Settings', 'platinum-seo-pack');
|
@@ -380,6 +393,10 @@ class PspSocialSettings extends PspSettings {
|
|
380 |
if ( isset( $settings['fb_default_image'] ) ) {
|
381 |
$settings['fb_default_image'] = esc_url_raw( $settings['fb_default_image'], $psp_allowed_protocols );
|
382 |
}
|
|
|
|
|
|
|
|
|
383 |
|
384 |
if ( isset( $settings['psp_twitter_card_enabled'] ) ) {
|
385 |
$settings['psp_twitter_card_enabled'] = !is_null(filter_var($settings['psp_twitter_card_enabled'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['psp_twitter_card_enabled'] : '';
|
230 |
|
231 |
add_settings_field( $psp_fb_defailt_img_field_id, $psp_fb_defailt_img_field_title, array( &$this, 'psp_add_field_text_url' ), $this->psp_social_settings_group, $section_id, $psp_fb_defailt_img_field);
|
232 |
|
233 |
+
//disable Article plublished, modified, update times
|
234 |
+
$og_times_field = array (
|
235 |
+
'label_for' => 'psp_og_times_disabled',
|
236 |
+
'option_name' => $psp_settings_name.'[psp_og_times_disabled]',
|
237 |
+
'option_value' => isset($psp_settings['psp_og_times_disabled']) ? esc_attr($psp_settings['psp_og_times_disabled']) : '',
|
238 |
+
'checkbox_label' => esc_html__('Disable Published, Modified Dates for Articles', 'platinum-seo-pack')
|
239 |
+
);
|
240 |
+
|
241 |
+
$og_times_field_id = 'psp_og_times_disabled';
|
242 |
+
$og_times_field_title = esc_html__('Open Graph Published and Modified Dates: ', 'platinum-seo-pack');
|
243 |
+
|
244 |
+
add_settings_field( $og_times_field_id, $og_times_field_title, array( &$this, 'psp_add_field_checkbox' ), $this->psp_social_settings_group, $section_id, $og_times_field );
|
245 |
+
|
246 |
//Twitter Section
|
247 |
$section_id = 'psp_twitter_section';
|
248 |
$section_title = esc_html__('Twitter Card Sitewide Settings', 'platinum-seo-pack');
|
393 |
if ( isset( $settings['fb_default_image'] ) ) {
|
394 |
$settings['fb_default_image'] = esc_url_raw( $settings['fb_default_image'], $psp_allowed_protocols );
|
395 |
}
|
396 |
+
|
397 |
+
if ( isset( $settings['psp_og_times_disabled'] ) ) {
|
398 |
+
$settings['psp_og_times_disabled'] = !is_null(filter_var($settings['psp_og_times_disabled'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['psp_og_times_disabled'] : '';
|
399 |
+
}
|
400 |
|
401 |
if ( isset( $settings['psp_twitter_card_enabled'] ) ) {
|
402 |
$settings['psp_twitter_card_enabled'] = !is_null(filter_var($settings['psp_twitter_card_enabled'],FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE)) ? $settings['psp_twitter_card_enabled'] : '';
|
psp-include/utilities/psp_helper.php
CHANGED
@@ -19,7 +19,7 @@ class PspHelper {
|
|
19 |
* as description. Touch only if you know what you're doing
|
20 |
*/
|
21 |
private $min_description_length = 1;
|
22 |
-
private $version = "2.2.
|
23 |
|
24 |
public $sitename = "";
|
25 |
public $sitedescription = "";
|
19 |
* as description. Touch only if you know what you're doing
|
20 |
*/
|
21 |
private $min_description_length = 1;
|
22 |
+
private $version = "2.2.4";
|
23 |
|
24 |
public $sitename = "";
|
25 |
public $sitedescription = "";
|
psp-include/wizard/psp_wizard_startbtn_renderer.php
CHANGED
@@ -30,6 +30,11 @@ Author URI: http://techblissonline.com/
|
|
30 |
background: radial-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3) 35%, rgba(0, 0, 0, 0.7));
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
.content {
|
34 |
position: absolute;
|
35 |
width: 100%;
|
@@ -158,7 +163,8 @@ Author URI: http://techblissonline.com/
|
|
158 |
<h2 class="frame-3">
|
159 |
<div class="psp-bs">
|
160 |
<div class="psp-start-btn">
|
161 |
-
<a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=wizard&psptab=psp_importer_wizard" ?>" class="btn btn-lg btn-warning" role="button"> <?php esc_html_e('START PLATINUM SEO WIZARD', 'platinum-seo-pack') ?></a>
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
</h2>
|
30 |
background: radial-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3) 35%, rgba(0, 0, 0, 0.7));
|
31 |
}
|
32 |
|
33 |
+
.btn-purple {
|
34 |
+
background-color: purple !important;
|
35 |
+
color: white !important;
|
36 |
+
}
|
37 |
+
|
38 |
.content {
|
39 |
position: absolute;
|
40 |
width: 100%;
|
163 |
<h2 class="frame-3">
|
164 |
<div class="psp-bs">
|
165 |
<div class="psp-start-btn">
|
166 |
+
<a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=wizard&psptab=psp_importer_wizard" ?>" class="btn btn-lg btn-warning" role="button"> <?php esc_html_e('START PLATINUM SEO WIZARD', 'platinum-seo-pack') ?></a><br/ ><br/ >
|
167 |
+
<a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=platinum-seo-social-pack-by-techblissonline" ?>" class="btn btn-lg btn-purple" role="button"> <?php esc_html_e('No Thanks! Close this wizard and Go to Dashboard', 'platinum-seo-pack') ?></a>
|
168 |
</div>
|
169 |
</div>
|
170 |
</h2>
|
psp_main.php
CHANGED
@@ -273,14 +273,14 @@ class PspMain {
|
|
273 |
$user_id = get_current_user_id();
|
274 |
// Add the meta so that the notice is permanently dismissed.
|
275 |
//delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
|
276 |
-
update_user_meta( $user_id, 'psp_ignore_notice', "
|
277 |
};
|
278 |
};
|
279 |
}
|
280 |
|
281 |
public function platinum_seo_admin_notice__success() {
|
282 |
$user_id = get_current_user_id();
|
283 |
-
if ( "
|
284 |
global $pagenow;
|
285 |
$psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
|
286 |
if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
|
@@ -290,7 +290,7 @@ class PspMain {
|
|
290 |
'psp_ignore_notice' => '1',
|
291 |
'action' => 'psp_delete_adminnotice',
|
292 |
'nonce' => wp_create_nonce('psp_delete_adminnotice'),
|
293 |
-
] ) ) .'" style="float:right; display:block; border:none;">'.esc_html__( 'Dismiss permanently', 'platinum-seo-pack' ) .'</a>'.'<br>'. esc_html__( 'See What has Changed in this', 'platinum-seo-pack' ).'<a href="https://techblissonline.com/platinum-wordpress-seo-plugin/#what-is-new" target="_blank" rel="noopener"> '.esc_html__( ' Version ', 'platinum-seo-pack' ).'2.2.
|
294 |
</div>
|
295 |
<?php
|
296 |
}
|
@@ -1309,8 +1309,10 @@ class PspMain {
|
|
1309 |
$psp_settings = get_option("psp_sitewide_settings");
|
1310 |
|
1311 |
//if (empty($psp_settings)) {
|
1312 |
-
if ( !isset($psp_settings['separator']) || empty($psp_settings['separator']) )
|
1313 |
$psp_settings['separator'] = '–';
|
|
|
|
|
1314 |
if ( !isset($psp_settings['rewrite_titles']) || empty($psp_settings['rewrite_titles']) ) $psp_settings['rewrite_titles'] = 1;
|
1315 |
if ( !isset($psp_settings['paged_title_format']) || empty($psp_settings['paged_title_format']) ) $psp_settings['paged_title_format'] = "%sep% Page %page%";
|
1316 |
//if ( !isset($psp_settings['noindex_subpages']) || empty($psp_settings['noindex_subpages']) ) $psp_settings['noindex_subpages'] = 1;
|
@@ -1704,594 +1706,7 @@ class PspMain {
|
|
1704 |
|
1705 |
update_option( 'psp_db_version', $psp_db_version );
|
1706 |
|
1707 |
-
}
|
1708 |
-
//same as redirect_canonical in WordPress Core but redirect_guess_404_permalink() has been disabled
|
1709 |
-
//this function replaces redirect_canonical function in WordPress template_redirect hooks
|
1710 |
-
//this is done because redirect_guess_404_permalink() does not have any filters (as of WordPress 5.4) for plugin to hook into
|
1711 |
-
public function psp_redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
1712 |
-
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
|
1713 |
-
|
1714 |
-
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
|
1715 |
-
return;
|
1716 |
-
}
|
1717 |
-
|
1718 |
-
// If we're not in wp-admin and the post has been published and preview nonce
|
1719 |
-
// is non-existent or invalid then no need for preview in query.
|
1720 |
-
if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) {
|
1721 |
-
if ( ! isset( $_GET['preview_id'] )
|
1722 |
-
|| ! isset( $_GET['preview_nonce'] )
|
1723 |
-
|| ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) {
|
1724 |
-
$wp_query->is_preview = false;
|
1725 |
-
}
|
1726 |
-
}
|
1727 |
-
|
1728 |
-
if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) {
|
1729 |
-
return;
|
1730 |
-
}
|
1731 |
-
|
1732 |
-
if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
|
1733 |
-
// Build the URL in the address bar.
|
1734 |
-
$requested_url = is_ssl() ? 'https://' : 'http://';
|
1735 |
-
$requested_url .= $_SERVER['HTTP_HOST'];
|
1736 |
-
$requested_url .= $_SERVER['REQUEST_URI'];
|
1737 |
-
}
|
1738 |
-
|
1739 |
-
$original = @parse_url( $requested_url );
|
1740 |
-
if ( false === $original ) {
|
1741 |
-
return;
|
1742 |
-
}
|
1743 |
-
|
1744 |
-
$redirect = $original;
|
1745 |
-
$redirect_url = false;
|
1746 |
-
|
1747 |
-
// Notice fixing.
|
1748 |
-
if ( ! isset( $redirect['path'] ) ) {
|
1749 |
-
$redirect['path'] = '';
|
1750 |
-
}
|
1751 |
-
if ( ! isset( $redirect['query'] ) ) {
|
1752 |
-
$redirect['query'] = '';
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
/*
|
1756 |
-
* If the original URL ended with non-breaking spaces, they were almost
|
1757 |
-
* certainly inserted by accident. Let's remove them, so the reader doesn't
|
1758 |
-
* see a 404 error with no obvious cause.
|
1759 |
-
*/
|
1760 |
-
$redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] );
|
1761 |
-
|
1762 |
-
// It's not a preview, so remove it from URL.
|
1763 |
-
if ( get_query_var( 'preview' ) ) {
|
1764 |
-
$redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
$id = get_query_var( 'p' );
|
1768 |
-
|
1769 |
-
if ( is_feed() && $id ) {
|
1770 |
-
$redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) );
|
1771 |
-
if ( $redirect_url ) {
|
1772 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ), $redirect_url );
|
1773 |
-
$redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
|
1774 |
-
}
|
1775 |
-
}
|
1776 |
-
|
1777 |
-
if ( is_singular() && 1 > $wp_query->post_count && $id ) {
|
1778 |
-
|
1779 |
-
$vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id ) );
|
1780 |
-
|
1781 |
-
if ( ! empty( $vars[0] ) ) {
|
1782 |
-
$vars = $vars[0];
|
1783 |
-
if ( 'revision' == $vars->post_type && $vars->post_parent > 0 ) {
|
1784 |
-
$id = $vars->post_parent;
|
1785 |
-
}
|
1786 |
-
|
1787 |
-
$redirect_url = get_permalink( $id );
|
1788 |
-
if ( $redirect_url ) {
|
1789 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
|
1790 |
-
}
|
1791 |
-
}
|
1792 |
-
}
|
1793 |
-
|
1794 |
-
// These tests give us a WP-generated permalink.
|
1795 |
-
if ( is_404() ) {
|
1796 |
-
|
1797 |
-
// Redirect ?page_id, ?p=, ?attachment_id= to their respective URLs.
|
1798 |
-
$id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) );
|
1799 |
-
$redirect_post = $id ? get_post( $id ) : false;
|
1800 |
-
if ( $redirect_post ) {
|
1801 |
-
$post_type_obj = get_post_type_object( $redirect_post->post_type );
|
1802 |
-
if ( $post_type_obj->public && 'auto-draft' != $redirect_post->post_status ) {
|
1803 |
-
$redirect_url = get_permalink( $redirect_post );
|
1804 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
|
1805 |
-
}
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) {
|
1809 |
-
$year = get_query_var( 'year' );
|
1810 |
-
$month = get_query_var( 'monthnum' );
|
1811 |
-
$day = get_query_var( 'day' );
|
1812 |
-
$date = sprintf( '%04d-%02d-%02d', $year, $month, $day );
|
1813 |
-
if ( ! wp_checkdate( $month, $day, $year, $date ) ) {
|
1814 |
-
$redirect_url = get_month_link( $year, $month );
|
1815 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url );
|
1816 |
-
}
|
1817 |
-
} elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) {
|
1818 |
-
$redirect_url = get_year_link( get_query_var( 'year' ) );
|
1819 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url );
|
1820 |
-
}
|
1821 |
-
/***commenting guessing***
|
1822 |
-
if ( ! $redirect_url ) {
|
1823 |
-
$redirect_url = redirect_guess_404_permalink();
|
1824 |
-
if ( $redirect_url ) {
|
1825 |
-
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
|
1826 |
-
}
|
1827 |
-
}
|
1828 |
-
****/
|
1829 |
-
if ( get_query_var( 'page' ) && $wp_query->post &&
|
1830 |
-
false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) {
|
1831 |
-
$redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
|
1832 |
-
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
1833 |
-
$redirect_url = get_permalink( $wp_query->post->ID );
|
1834 |
-
}
|
1835 |
-
} elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) {
|
1836 |
-
// Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.
|
1837 |
-
if ( is_attachment() &&
|
1838 |
-
! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) &&
|
1839 |
-
! $redirect_url ) {
|
1840 |
-
if ( ! empty( $_GET['attachment_id'] ) ) {
|
1841 |
-
$redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) );
|
1842 |
-
if ( $redirect_url ) {
|
1843 |
-
$redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] );
|
1844 |
-
}
|
1845 |
-
} else {
|
1846 |
-
$redirect_url = get_attachment_link();
|
1847 |
-
}
|
1848 |
-
} elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) {
|
1849 |
-
$redirect_url = get_permalink( get_query_var( 'p' ) );
|
1850 |
-
if ( $redirect_url ) {
|
1851 |
-
$redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] );
|
1852 |
-
}
|
1853 |
-
} elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) {
|
1854 |
-
$redirect_url = get_permalink( $wp_query->get_queried_object_id() );
|
1855 |
-
if ( $redirect_url ) {
|
1856 |
-
$redirect['query'] = remove_query_arg( 'name', $redirect['query'] );
|
1857 |
-
}
|
1858 |
-
} elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) {
|
1859 |
-
$redirect_url = get_permalink( get_query_var( 'page_id' ) );
|
1860 |
-
if ( $redirect_url ) {
|
1861 |
-
$redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
|
1862 |
-
}
|
1863 |
-
} elseif ( is_page() && ! is_feed() && 'page' == get_option( 'show_on_front' ) && get_queried_object_id() == get_option( 'page_on_front' ) && ! $redirect_url ) {
|
1864 |
-
$redirect_url = home_url( '/' );
|
1865 |
-
} elseif ( is_home() && ! empty( $_GET['page_id'] ) && 'page' == get_option( 'show_on_front' ) && get_query_var( 'page_id' ) == get_option( 'page_for_posts' ) && ! $redirect_url ) {
|
1866 |
-
$redirect_url = get_permalink( get_option( 'page_for_posts' ) );
|
1867 |
-
if ( $redirect_url ) {
|
1868 |
-
$redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
|
1869 |
-
}
|
1870 |
-
} elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) {
|
1871 |
-
$m = get_query_var( 'm' );
|
1872 |
-
switch ( strlen( $m ) ) {
|
1873 |
-
case 4: // Yearly.
|
1874 |
-
$redirect_url = get_year_link( $m );
|
1875 |
-
break;
|
1876 |
-
case 6: // Monthly.
|
1877 |
-
$redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) );
|
1878 |
-
break;
|
1879 |
-
case 8: // Daily.
|
1880 |
-
$redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) );
|
1881 |
-
break;
|
1882 |
-
}
|
1883 |
-
if ( $redirect_url ) {
|
1884 |
-
$redirect['query'] = remove_query_arg( 'm', $redirect['query'] );
|
1885 |
-
}
|
1886 |
-
// Now moving on to non ?m=X year/month/day links.
|
1887 |
-
} elseif ( is_day() && get_query_var( 'year' ) && get_query_var( 'monthnum' ) && ! empty( $_GET['day'] ) ) {
|
1888 |
-
$redirect_url = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
|
1889 |
-
if ( $redirect_url ) {
|
1890 |
-
$redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] );
|
1891 |
-
}
|
1892 |
-
} elseif ( is_month() && get_query_var( 'year' ) && ! empty( $_GET['monthnum'] ) ) {
|
1893 |
-
$redirect_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
|
1894 |
-
if ( $redirect_url ) {
|
1895 |
-
$redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] );
|
1896 |
-
}
|
1897 |
-
} elseif ( is_year() && ! empty( $_GET['year'] ) ) {
|
1898 |
-
$redirect_url = get_year_link( get_query_var( 'year' ) );
|
1899 |
-
if ( $redirect_url ) {
|
1900 |
-
$redirect['query'] = remove_query_arg( 'year', $redirect['query'] );
|
1901 |
-
}
|
1902 |
-
} elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
|
1903 |
-
$author = get_userdata( get_query_var( 'author' ) );
|
1904 |
-
if ( ( false !== $author ) && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) {
|
1905 |
-
$redirect_url = get_author_posts_url( $author->ID, $author->user_nicename );
|
1906 |
-
if ( $redirect_url ) {
|
1907 |
-
$redirect['query'] = remove_query_arg( 'author', $redirect['query'] );
|
1908 |
-
}
|
1909 |
-
}
|
1910 |
-
} elseif ( is_category() || is_tag() || is_tax() ) { // Terms (tags/categories).
|
1911 |
-
|
1912 |
-
$term_count = 0;
|
1913 |
-
foreach ( $wp_query->tax_query->queried_terms as $tax_query ) {
|
1914 |
-
$term_count += count( $tax_query['terms'] );
|
1915 |
-
}
|
1916 |
-
|
1917 |
-
$obj = $wp_query->get_queried_object();
|
1918 |
-
if ( $term_count <= 1 && ! empty( $obj->term_id ) ) {
|
1919 |
-
$tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy );
|
1920 |
-
if ( $tax_url && ! is_wp_error( $tax_url ) ) {
|
1921 |
-
if ( ! empty( $redirect['query'] ) ) {
|
1922 |
-
// Strip taxonomy query vars off the URL.
|
1923 |
-
$qv_remove = array( 'term', 'taxonomy' );
|
1924 |
-
if ( is_category() ) {
|
1925 |
-
$qv_remove[] = 'category_name';
|
1926 |
-
$qv_remove[] = 'cat';
|
1927 |
-
} elseif ( is_tag() ) {
|
1928 |
-
$qv_remove[] = 'tag';
|
1929 |
-
$qv_remove[] = 'tag_id';
|
1930 |
-
} else {
|
1931 |
-
// Custom taxonomies will have a custom query var, remove those too.
|
1932 |
-
$tax_obj = get_taxonomy( $obj->taxonomy );
|
1933 |
-
if ( false !== $tax_obj->query_var ) {
|
1934 |
-
$qv_remove[] = $tax_obj->query_var;
|
1935 |
-
}
|
1936 |
-
}
|
1937 |
-
|
1938 |
-
$rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) );
|
1939 |
-
|
1940 |
-
// Check to see if all the query vars are coming from the rewrite, none are set via $_GET.
|
1941 |
-
if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) {
|
1942 |
-
// Remove all of the per-tax query vars.
|
1943 |
-
$redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] );
|
1944 |
-
|
1945 |
-
// Create the destination URL for this taxonomy.
|
1946 |
-
$tax_url = parse_url( $tax_url );
|
1947 |
-
if ( ! empty( $tax_url['query'] ) ) {
|
1948 |
-
// Taxonomy accessible via ?taxonomy=...&term=... or any custom query var.
|
1949 |
-
parse_str( $tax_url['query'], $query_vars );
|
1950 |
-
$redirect['query'] = add_query_arg( $query_vars, $redirect['query'] );
|
1951 |
-
} else {
|
1952 |
-
// Taxonomy is accessible via a "pretty URL".
|
1953 |
-
$redirect['path'] = $tax_url['path'];
|
1954 |
-
}
|
1955 |
-
} else {
|
1956 |
-
// Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite.
|
1957 |
-
foreach ( $qv_remove as $_qv ) {
|
1958 |
-
if ( isset( $rewrite_vars[ $_qv ] ) ) {
|
1959 |
-
$redirect['query'] = remove_query_arg( $_qv, $redirect['query'] );
|
1960 |
-
}
|
1961 |
-
}
|
1962 |
-
}
|
1963 |
-
}
|
1964 |
-
}
|
1965 |
-
}
|
1966 |
-
} elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) {
|
1967 |
-
$cat = get_query_var( 'category_name' );
|
1968 |
-
if ( $cat ) {
|
1969 |
-
$category = get_category_by_path( $cat );
|
1970 |
-
if ( ( ! $category || is_wp_error( $category ) ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) {
|
1971 |
-
$redirect_url = get_permalink( $wp_query->get_queried_object_id() );
|
1972 |
-
}
|
1973 |
-
}
|
1974 |
-
}
|
1975 |
-
|
1976 |
-
// Post paging.
|
1977 |
-
if ( is_singular() && get_query_var( 'page' ) ) {
|
1978 |
-
if ( ! $redirect_url ) {
|
1979 |
-
$redirect_url = get_permalink( get_queried_object_id() );
|
1980 |
-
}
|
1981 |
-
|
1982 |
-
$page = get_query_var( 'page' );
|
1983 |
-
if ( $page > 1 ) {
|
1984 |
-
if ( is_front_page() ) {
|
1985 |
-
$redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
|
1986 |
-
} else {
|
1987 |
-
$redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( $page, 'single_paged' );
|
1988 |
-
}
|
1989 |
-
}
|
1990 |
-
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
1991 |
-
}
|
1992 |
-
|
1993 |
-
// Paging and feeds.
|
1994 |
-
if ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) {
|
1995 |
-
while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) {
|
1996 |
-
// Strip off paging and feed.
|
1997 |
-
$redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing paging.
|
1998 |
-
$redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] ); // Strip off feed endings.
|
1999 |
-
$redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] ); // Strip off any existing comment paging.
|
2000 |
-
}
|
2001 |
-
|
2002 |
-
$addl_path = '';
|
2003 |
-
if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds ) ) {
|
2004 |
-
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
|
2005 |
-
if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
|
2006 |
-
$addl_path .= 'comments/';
|
2007 |
-
}
|
2008 |
-
if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var( 'feed' ) ) || 'rss' == get_query_var( 'feed' ) ) {
|
2009 |
-
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
|
2010 |
-
} else {
|
2011 |
-
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var( 'feed' ) || 'feed' == get_query_var( 'feed' ) ) ? '' : get_query_var( 'feed' ) ), 'feed' );
|
2012 |
-
}
|
2013 |
-
$redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
|
2014 |
-
} elseif ( is_feed() && 'old' == get_query_var( 'feed' ) ) {
|
2015 |
-
$old_feed_files = array(
|
2016 |
-
'wp-atom.php' => 'atom',
|
2017 |
-
'wp-commentsrss2.php' => 'comments_rss2',
|
2018 |
-
'wp-feed.php' => get_default_feed(),
|
2019 |
-
'wp-rdf.php' => 'rdf',
|
2020 |
-
'wp-rss.php' => 'rss2',
|
2021 |
-
'wp-rss2.php' => 'rss2',
|
2022 |
-
);
|
2023 |
-
if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
|
2024 |
-
$redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
|
2025 |
-
wp_redirect( $redirect_url, 301 );
|
2026 |
-
die();
|
2027 |
-
}
|
2028 |
-
}
|
2029 |
-
|
2030 |
-
if ( get_query_var( 'paged' ) > 0 ) {
|
2031 |
-
$paged = get_query_var( 'paged' );
|
2032 |
-
$redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
|
2033 |
-
if ( ! is_feed() ) {
|
2034 |
-
if ( $paged > 1 && ! is_single() ) {
|
2035 |
-
$addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' );
|
2036 |
-
} elseif ( ! is_single() ) {
|
2037 |
-
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
|
2038 |
-
}
|
2039 |
-
} elseif ( $paged > 1 ) {
|
2040 |
-
$redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
|
2041 |
-
}
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
if ( get_option( 'page_comments' ) && (
|
2045 |
-
( 'newest' == get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 0 ) ||
|
2046 |
-
( 'newest' != get_option( 'default_comments_page' ) && get_query_var( 'cpage' ) > 1 )
|
2047 |
-
) ) {
|
2048 |
-
$addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var( 'cpage' ), 'commentpaged' );
|
2049 |
-
$redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
|
2050 |
-
}
|
2051 |
-
|
2052 |
-
$redirect['path'] = user_trailingslashit( preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] ) ); // Strip off trailing /index.php/.
|
2053 |
-
if ( ! empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false ) {
|
2054 |
-
$redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/';
|
2055 |
-
}
|
2056 |
-
if ( ! empty( $addl_path ) ) {
|
2057 |
-
$redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path;
|
2058 |
-
}
|
2059 |
-
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
|
2060 |
-
}
|
2061 |
-
|
2062 |
-
if ( 'wp-register.php' == basename( $redirect['path'] ) ) {
|
2063 |
-
if ( is_multisite() ) {
|
2064 |
-
/** This filter is documented in wp-login.php */
|
2065 |
-
$redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
|
2066 |
-
} else {
|
2067 |
-
$redirect_url = wp_registration_url();
|
2068 |
-
}
|
2069 |
-
|
2070 |
-
wp_redirect( $redirect_url, 301 );
|
2071 |
-
die();
|
2072 |
-
}
|
2073 |
-
}
|
2074 |
-
|
2075 |
-
// Tack on any additional query vars.
|
2076 |
-
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
|
2077 |
-
if ( $redirect_url && ! empty( $redirect['query'] ) ) {
|
2078 |
-
parse_str( $redirect['query'], $_parsed_query );
|
2079 |
-
$redirect = @parse_url( $redirect_url );
|
2080 |
-
|
2081 |
-
if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
|
2082 |
-
parse_str( $redirect['query'], $_parsed_redirect_query );
|
2083 |
-
|
2084 |
-
if ( empty( $_parsed_redirect_query['name'] ) ) {
|
2085 |
-
unset( $_parsed_query['name'] );
|
2086 |
-
}
|
2087 |
-
}
|
2088 |
-
|
2089 |
-
$_parsed_query = array_combine(
|
2090 |
-
rawurlencode_deep( array_keys( $_parsed_query ) ),
|
2091 |
-
rawurlencode_deep( array_values( $_parsed_query ) )
|
2092 |
-
);
|
2093 |
-
$redirect_url = add_query_arg( $_parsed_query, $redirect_url );
|
2094 |
-
}
|
2095 |
-
|
2096 |
-
if ( $redirect_url ) {
|
2097 |
-
$redirect = @parse_url( $redirect_url );
|
2098 |
-
}
|
2099 |
-
|
2100 |
-
// www.example.com vs. example.com
|
2101 |
-
$user_home = @parse_url( home_url() );
|
2102 |
-
if ( ! empty( $user_home['host'] ) ) {
|
2103 |
-
$redirect['host'] = $user_home['host'];
|
2104 |
-
}
|
2105 |
-
if ( empty( $user_home['path'] ) ) {
|
2106 |
-
$user_home['path'] = '/';
|
2107 |
-
}
|
2108 |
-
|
2109 |
-
// Handle ports.
|
2110 |
-
if ( ! empty( $user_home['port'] ) ) {
|
2111 |
-
$redirect['port'] = $user_home['port'];
|
2112 |
-
} else {
|
2113 |
-
unset( $redirect['port'] );
|
2114 |
-
}
|
2115 |
-
|
2116 |
-
// Trailing /index.php.
|
2117 |
-
$redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] );
|
2118 |
-
|
2119 |
-
$punctuation_pattern = implode(
|
2120 |
-
'|',
|
2121 |
-
array_map(
|
2122 |
-
'preg_quote',
|
2123 |
-
array(
|
2124 |
-
' ',
|
2125 |
-
'%20', // Space.
|
2126 |
-
'!',
|
2127 |
-
'%21', // Exclamation mark.
|
2128 |
-
'"',
|
2129 |
-
'%22', // Double quote.
|
2130 |
-
"'",
|
2131 |
-
'%27', // Single quote.
|
2132 |
-
'(',
|
2133 |
-
'%28', // Opening bracket.
|
2134 |
-
')',
|
2135 |
-
'%29', // Closing bracket.
|
2136 |
-
',',
|
2137 |
-
'%2C', // Comma.
|
2138 |
-
'.',
|
2139 |
-
'%2E', // Period.
|
2140 |
-
';',
|
2141 |
-
'%3B', // Semicolon.
|
2142 |
-
'{',
|
2143 |
-
'%7B', // Opening curly bracket.
|
2144 |
-
'}',
|
2145 |
-
'%7D', // Closing curly bracket.
|
2146 |
-
'%E2%80%9C', // Opening curly quote.
|
2147 |
-
'%E2%80%9D', // Closing curly quote.
|
2148 |
-
)
|
2149 |
-
)
|
2150 |
-
);
|
2151 |
-
|
2152 |
-
// Remove trailing spaces and end punctuation from the path.
|
2153 |
-
$redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] );
|
2154 |
-
|
2155 |
-
if ( ! empty( $redirect['query'] ) ) {
|
2156 |
-
// Remove trailing spaces and end punctuation from certain terminating query string args.
|
2157 |
-
$redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
|
2158 |
-
|
2159 |
-
// Clean up empty query strings.
|
2160 |
-
$redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );
|
2161 |
-
|
2162 |
-
// Redirect obsolete feeds.
|
2163 |
-
$redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] );
|
2164 |
-
|
2165 |
-
// Remove redundant leading ampersands.
|
2166 |
-
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
|
2167 |
-
}
|
2168 |
-
|
2169 |
-
// Strip /index.php/ when we're not using PATHINFO permalinks.
|
2170 |
-
if ( ! $wp_rewrite->using_index_permalinks() ) {
|
2171 |
-
$redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
|
2172 |
-
}
|
2173 |
-
|
2174 |
-
// Trailing slashes.
|
2175 |
-
if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() && ! is_404() && ( ! is_front_page() || ( is_front_page() && ( get_query_var( 'paged' ) > 1 ) ) ) ) {
|
2176 |
-
$user_ts_type = '';
|
2177 |
-
if ( get_query_var( 'paged' ) > 0 ) {
|
2178 |
-
$user_ts_type = 'paged';
|
2179 |
-
} else {
|
2180 |
-
foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) {
|
2181 |
-
$func = 'is_' . $type;
|
2182 |
-
if ( call_user_func( $func ) ) {
|
2183 |
-
$user_ts_type = $type;
|
2184 |
-
break;
|
2185 |
-
}
|
2186 |
-
}
|
2187 |
-
}
|
2188 |
-
$redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type );
|
2189 |
-
} elseif ( is_front_page() ) {
|
2190 |
-
$redirect['path'] = trailingslashit( $redirect['path'] );
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
// Strip multiple slashes out of the URL.
|
2194 |
-
if ( strpos( $redirect['path'], '//' ) > -1 ) {
|
2195 |
-
$redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] );
|
2196 |
-
}
|
2197 |
-
|
2198 |
-
// Always trailing slash the Front Page URL.
|
2199 |
-
if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) {
|
2200 |
-
$redirect['path'] = trailingslashit( $redirect['path'] );
|
2201 |
-
}
|
2202 |
-
|
2203 |
-
// Ignore differences in host capitalization, as this can lead to infinite redirects.
|
2204 |
-
// Only redirect no-www <=> yes-www.
|
2205 |
-
if ( strtolower( $original['host'] ) == strtolower( $redirect['host'] ) ||
|
2206 |
-
( strtolower( $original['host'] ) != 'www.' . strtolower( $redirect['host'] ) && 'www.' . strtolower( $original['host'] ) != strtolower( $redirect['host'] ) ) ) {
|
2207 |
-
$redirect['host'] = $original['host'];
|
2208 |
-
}
|
2209 |
-
|
2210 |
-
$compare_original = array( $original['host'], $original['path'] );
|
2211 |
-
|
2212 |
-
if ( ! empty( $original['port'] ) ) {
|
2213 |
-
$compare_original[] = $original['port'];
|
2214 |
-
}
|
2215 |
-
|
2216 |
-
if ( ! empty( $original['query'] ) ) {
|
2217 |
-
$compare_original[] = $original['query'];
|
2218 |
-
}
|
2219 |
-
|
2220 |
-
$compare_redirect = array( $redirect['host'], $redirect['path'] );
|
2221 |
-
|
2222 |
-
if ( ! empty( $redirect['port'] ) ) {
|
2223 |
-
$compare_redirect[] = $redirect['port'];
|
2224 |
-
}
|
2225 |
-
|
2226 |
-
if ( ! empty( $redirect['query'] ) ) {
|
2227 |
-
$compare_redirect[] = $redirect['query'];
|
2228 |
-
}
|
2229 |
-
|
2230 |
-
if ( $compare_original !== $compare_redirect ) {
|
2231 |
-
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
|
2232 |
-
if ( ! empty( $redirect['port'] ) ) {
|
2233 |
-
$redirect_url .= ':' . $redirect['port'];
|
2234 |
-
}
|
2235 |
-
$redirect_url .= $redirect['path'];
|
2236 |
-
if ( ! empty( $redirect['query'] ) ) {
|
2237 |
-
$redirect_url .= '?' . $redirect['query'];
|
2238 |
-
}
|
2239 |
-
}
|
2240 |
-
|
2241 |
-
if ( ! $redirect_url || $redirect_url == $requested_url ) {
|
2242 |
-
return;
|
2243 |
-
}
|
2244 |
-
|
2245 |
-
// Hex encoded octets are case-insensitive.
|
2246 |
-
if ( false !== strpos( $requested_url, '%' ) ) {
|
2247 |
-
if ( ! function_exists( 'lowercase_octets' ) ) {
|
2248 |
-
/**
|
2249 |
-
* Converts the first hex-encoded octet match to lowercase.
|
2250 |
-
*
|
2251 |
-
* @since 3.1.0
|
2252 |
-
* @ignore
|
2253 |
-
*
|
2254 |
-
* @param array $matches Hex-encoded octet matches for the requested URL.
|
2255 |
-
* @return string Lowercased version of the first match.
|
2256 |
-
*/
|
2257 |
-
function lowercase_octets( $matches ) {
|
2258 |
-
return strtolower( $matches[0] );
|
2259 |
-
}
|
2260 |
-
}
|
2261 |
-
$requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url );
|
2262 |
-
}
|
2263 |
-
|
2264 |
-
/**
|
2265 |
-
* Filters the canonical redirect URL.
|
2266 |
-
*
|
2267 |
-
* Returning false to this filter will cancel the redirect.
|
2268 |
-
*
|
2269 |
-
* @since 2.3.0
|
2270 |
-
*
|
2271 |
-
* @param string $redirect_url The redirect URL.
|
2272 |
-
* @param string $requested_url The requested URL.
|
2273 |
-
*/
|
2274 |
-
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
|
2275 |
-
|
2276 |
-
// Yes, again -- in case the filter aborted the request.
|
2277 |
-
if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) == strip_fragment_from_url( $requested_url ) ) {
|
2278 |
-
return;
|
2279 |
-
}
|
2280 |
-
|
2281 |
-
if ( $do_redirect ) {
|
2282 |
-
// Protect against chained redirects.
|
2283 |
-
if ( ! redirect_canonical( $redirect_url, false ) ) {
|
2284 |
-
wp_redirect( $redirect_url, 301 );
|
2285 |
-
exit();
|
2286 |
-
} else {
|
2287 |
-
// Debug.
|
2288 |
-
// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
|
2289 |
-
return;
|
2290 |
-
}
|
2291 |
-
} else {
|
2292 |
-
return $redirect_url;
|
2293 |
-
}
|
2294 |
-
}
|
2295 |
|
2296 |
public function psp_loaded_filter() {
|
2297 |
add_filter('status_header', array($this->psp_redirect_instance, 'psp_log_404'), 10, 4);
|
273 |
$user_id = get_current_user_id();
|
274 |
// Add the meta so that the notice is permanently dismissed.
|
275 |
//delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
|
276 |
+
update_user_meta( $user_id, 'psp_ignore_notice', "v_224" );
|
277 |
};
|
278 |
};
|
279 |
}
|
280 |
|
281 |
public function platinum_seo_admin_notice__success() {
|
282 |
$user_id = get_current_user_id();
|
283 |
+
if ( "v_224" === trim(get_user_meta( $user_id, 'psp_ignore_notice', true ) )) return;
|
284 |
global $pagenow;
|
285 |
$psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
|
286 |
if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
|
290 |
'psp_ignore_notice' => '1',
|
291 |
'action' => 'psp_delete_adminnotice',
|
292 |
'nonce' => wp_create_nonce('psp_delete_adminnotice'),
|
293 |
+
] ) ) .'" style="float:right; display:block; border:none;">'.esc_html__( 'Dismiss permanently', 'platinum-seo-pack' ) .'</a>'.'<br>'. esc_html__( 'See What has Changed in this', 'platinum-seo-pack' ).'<a href="https://techblissonline.com/platinum-wordpress-seo-plugin/#what-is-new" target="_blank" rel="noopener"> '.esc_html__( ' Version ', 'platinum-seo-pack' ).'2.2.4'.esc_html__( ' and earlier Versions!', 'platinum-seo-pack' ) .'</a>'.'<br>'.esc_html__( 'Like this Plugin? Pls. give it a rating on WordPress', 'platinum-seo-pack' ).'<a href="https://wordpress.org/support/plugin/platinum-seo-pack/reviews/#new-post" target="_blank" rel="noopener">'.esc_html__(' here','platinum-seo-pack' ).'</a>'; ?></p></strong>
|
294 |
</div>
|
295 |
<?php
|
296 |
}
|
1309 |
$psp_settings = get_option("psp_sitewide_settings");
|
1310 |
|
1311 |
//if (empty($psp_settings)) {
|
1312 |
+
if ( !isset($psp_settings['separator']) || empty($psp_settings['separator']) ) {
|
1313 |
$psp_settings['separator'] = '–';
|
1314 |
+
//add_option('psp_do_activation_redirect', true);
|
1315 |
+
}
|
1316 |
if ( !isset($psp_settings['rewrite_titles']) || empty($psp_settings['rewrite_titles']) ) $psp_settings['rewrite_titles'] = 1;
|
1317 |
if ( !isset($psp_settings['paged_title_format']) || empty($psp_settings['paged_title_format']) ) $psp_settings['paged_title_format'] = "%sep% Page %page%";
|
1318 |
//if ( !isset($psp_settings['noindex_subpages']) || empty($psp_settings['noindex_subpages']) ) $psp_settings['noindex_subpages'] = 1;
|
1706 |
|
1707 |
update_option( 'psp_db_version', $psp_db_version );
|
1708 |
|
1709 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1710 |
|
1711 |
public function psp_loaded_filter() {
|
1712 |
add_filter('status_header', array($this->psp_redirect_instance, 'psp_log_404'), 10, 4);
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: seo, wordpress seo, plugin, google seo, platinum seo, schema, schema marku
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 5.5.3
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.2.
|
10 |
License: GPLv2 or later
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -48,7 +48,8 @@ Some features:
|
|
48 |
23) Set a preferred Taxonomy and Term for every POST.
|
49 |
24) Support for SiteMap. The plugin currently integrates the WordPress Sitemap files in version 5.5 with some enhancements to support images in sitemaps.
|
50 |
25) supports import of SEO Data from other plugins like Yoast (both new and old versions), RankMath and All in One SEO Pack.
|
51 |
-
26)
|
|
|
52 |
|
53 |
== Installation ==
|
54 |
|
@@ -72,11 +73,15 @@ Please read these **[FAQs](https://techblissonline.com/platinum-seo-pack-faq/)**
|
|
72 |
4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
|
73 |
|
74 |
== Changelog ==
|
75 |
-
|
|
|
76 |
|
77 |
= 2.2.3 =
|
78 |
2020-11-21 - Fixed dashboard console menu disappearing from the WordPress Admin.
|
79 |
|
|
|
|
|
|
|
80 |
= 2.2.1 =
|
81 |
* 2020-11-20 - Introduced a comprehensive Role Manager that can be used to control who (which role) can access which Platinum SEO Settings. Introduced a SetUp wizard to make it easy for users installing Platinum SEO WordPress Plugin to configure various settings. It also makes it easy for users migrating from other popular SEO plugin to platinum SEO, to setup the SEO configuration. Fixed a few bugs in sitemap settings. Made the 404 guessing workaround to be compatible with the latest changes in WordPress 5.5.0.
|
82 |
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 5.5.3
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.2.4
|
10 |
License: GPLv2 or later
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
48 |
23) Set a preferred Taxonomy and Term for every POST.
|
49 |
24) Support for SiteMap. The plugin currently integrates the WordPress Sitemap files in version 5.5 with some enhancements to support images in sitemaps.
|
50 |
25) supports import of SEO Data from other plugins like Yoast (both new and old versions), RankMath and All in One SEO Pack.
|
51 |
+
26) Role Manager that lets the admin configure which user role has access to which settings page or report in Platinum SEO.
|
52 |
+
27) An easy and user friendly setup wizard that lets new users of plugin to migrate/import SEO data from other plugins and also configure the essential sitewide settings. The setup wizard is also accesible via the menu Platinum SEO and social Pack -> Setup wizard.
|
53 |
|
54 |
== Installation ==
|
55 |
|
73 |
4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
|
74 |
|
75 |
== Changelog ==
|
76 |
+
= 2.2.4 =
|
77 |
+
2020-12-02 - Provided an option to disable published and modified time being added as open graph tags for article og type. Added a button to exit the setup wizard that is triggered on plugin activation.
|
78 |
|
79 |
= 2.2.3 =
|
80 |
2020-11-21 - Fixed dashboard console menu disappearing from the WordPress Admin.
|
81 |
|
82 |
+
= 2.2.2 =
|
83 |
+
2020-11-21 - Fixed a bug that caused he featured image to be not set when using the classic editor plugin in WordPress. Fixed a bug that was logging an "Headers already Sent" error when updating a post.
|
84 |
+
|
85 |
= 2.2.1 =
|
86 |
* 2020-11-20 - Introduced a comprehensive Role Manager that can be used to control who (which role) can access which Platinum SEO Settings. Introduced a SetUp wizard to make it easy for users installing Platinum SEO WordPress Plugin to configure various settings. It also makes it easy for users migrating from other popular SEO plugin to platinum SEO, to setup the SEO configuration. Fixed a few bugs in sitemap settings. Made the 404 guessing workaround to be compatible with the latest changes in WordPress 5.5.0.
|
87 |
|