Platinum SEO Pack - Version 2.0.6

Version Description

  • 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
Download this release

Release Info

Developer Rajesh Babu
Plugin Icon 128x128 Platinum SEO Pack
Version 2.0.6
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.6

Changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 2.0.5 =
2
  * 2020-02-21 - Introduces Patinum SEO Content analysis that does a basic analysis of your content for focus keywords that you need to enter in meta ketwords input field as comma separated items. Note that meta keywords can be turned off sitewide in SEO -> General settings, if you do not want to add a meta keywords tag for posts and /or pages. You can even control it at the post or page level by switching it On/Off, if the sitewide setting is ON. Sitewide setting is Off by default. But you can get content analysis findings in your analysis dashboard, even if it is switched off. Also fixed a few other minor bugs.
3
 
@@ -14,7 +17,7 @@
14
  * 2020-02-06 - Fixed an issue that does not pull description for existing users of the plugin, in respect of posts where they had filled them (description) in the older version of Platinum SEO Pack.
15
 
16
  = 2.0.0 =
17
- * 2020-02-01 - Techblissonline Platinum SEO Wordpress plugin has been completely rewriiten and offers several new features in adiition to fixing the bugs in the earlier version and improving Plugin Security.
18
 
19
  = 1.3.8 =
20
  * 2013-09-12 - Fixed a security issue (thanks to James Pearson)
1
+ = 2.0.6 =
2
+ * 2020-04-05 - Introduces a complete HTTP Redirections Manager. It also now has a 404 Manager that lets you track and fix any 404 Error. This 404 Manager is integrated with Redirections to resolve the 404 Error by Creating appropriate HTTP Redirection. Make sure to clear browser cache after updating the plugin.
3
+
4
  = 2.0.5 =
5
  * 2020-02-21 - Introduces Patinum SEO Content analysis that does a basic analysis of your content for focus keywords that you need to enter in meta ketwords input field as comma separated items. Note that meta keywords can be turned off sitewide in SEO -> General settings, if you do not want to add a meta keywords tag for posts and /or pages. You can even control it at the post or page level by switching it On/Off, if the sitewide setting is ON. Sitewide setting is Off by default. But you can get content analysis findings in your analysis dashboard, even if it is switched off. Also fixed a few other minor bugs.
6
 
17
  * 2020-02-06 - Fixed an issue that does not pull description for existing users of the plugin, in respect of posts where they had filled them (description) in the older version of Platinum SEO Pack.
18
 
19
  = 2.0.0 =
20
+ * 2020-02-01 - Techblissonline Platinum SEO WordPress plugin has been completely rewritten and it now offers several new features in addition to fixing the bugs in the earlier version and improving Plugin Security.
21
 
22
  = 1.3.8 =
23
  * 2013-09-12 - Fixed a security issue (thanks to James Pearson)
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.0.5
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
@@ -59,13 +59,19 @@ include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_settings.php' );
59
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_pre_settings.php' );
60
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_social_settings.php' );
61
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_tools_settings.php' );
62
-
63
 
64
  global $psp;
65
  $psp = PspMain::get_instance();
66
 
 
 
 
67
  register_activation_hook ( __FILE__, array ($psp, 'psp_activate' ) );
68
  register_deactivation_hook ( __FILE__, array ($psp, 'psp_deactivate' ) );
69
  add_action( 'upgrader_process_complete', array ($psp, 'psp_plugin_upgrade'),10, 2);
 
 
 
70
 
71
  ?>
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.0.6
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
59
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_pre_settings.php' );
60
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_social_settings.php' );
61
  include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_tools_settings.php' );
62
+ include_once( PSP_PLUGIN_HOME . PSPINC . '/settings/psp_redirect_404.php' );
63
 
64
  global $psp;
65
  $psp = PspMain::get_instance();
66
 
67
+ global $psp_db_version;
68
+ $psp_db_version = '2.0.6';
69
+
70
  register_activation_hook ( __FILE__, array ($psp, 'psp_activate' ) );
71
  register_deactivation_hook ( __FILE__, array ($psp, 'psp_deactivate' ) );
72
  add_action( 'upgrader_process_complete', array ($psp, 'psp_plugin_upgrade'),10, 2);
73
+ register_activation_hook ( __FILE__, array ($psp, 'psp_db_install' ) );
74
+ add_action( 'plugins_loaded', array ($psp, 'psp_db_install'),10, 2);
75
+ add_action( 'plugins_loaded', array ($psp, 'psp_loaded_filter'),10, 1);
76
 
77
  ?>
psp-include/generators/psp_home_others_seo_metas.php CHANGED
@@ -716,33 +716,53 @@ class PspHomeOthersSeoMetas {
716
 
717
  public function get_404_psp_title() {
718
 
719
- $title = "";
720
-
721
- if ( is_404() ) {
722
-
723
- $title_format = isset($this->psp_404_settings['title']) ? $this->psp_404_settings['title'] : "";
724
- if (empty($title_format)) {
725
- $title_format = "%title_404%";
726
- $title = str_replace('%title_404%', "404 Not Found", $title_format);
727
- } else {
728
- //get_option('aiosp_search_title_format');
729
- //$title = str_replace('%blog_title%', $this->psp_helper->internationalize(get_bloginfo('name')), $title_format);
730
- //$title = str_replace('%blog_description%', $this->psp_helper->internationalize(get_bloginfo('description')), $title);
731
- //$title = str_replace('%blog_title%', $this->sitename, $title_format);
732
- //$title = str_replace('%blog_description%', $this->sitedescription, $title);
733
- $title = str_replace('%title_404%', "404 Not Found", $title_format);
734
- $title = str_replace('%title%', "404 Not Found", $title);
735
- $title = str_replace('%seo_title%', "404 Not Found", $title);
736
- $title = str_replace('%site_name%', $this->sitename, $title);
737
- //$title = str_replace('%sep%', htmlentities($this->psp_sitewide_settungs['separator']), $title);
738
- $title = str_replace('%sep%', $this->psp_sitewide_settungs['separator'], $title);
739
- //$title = $this->paged_title($title);
740
- }
741
- }
742
- $title = trim($title);
743
- return $title;
744
-
745
- } // end get_404_psp_title
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
746
 
747
  public function get_date_archive_psp_title() {
748
 
716
 
717
  public function get_404_psp_title() {
718
 
719
+ $title = "";
720
+
721
+ global $wpdb;
722
+ $psp_404_log = $wpdb->prefix . "psp_404_log";
723
+ global $wp;
724
+ $id_404 = '';
725
+ $error_title = "404 Not Found";
726
+
727
+ $path_to_page = trim($wp->request); // /path/to/page
728
+
729
+ $sql_404 = $wpdb->prepare("SELECT id, source_uri, source_url, total_hits, referrer, status FROM $psp_404_log a WHERE a.source_uri = %s", $path_to_page );
730
+
731
+ if (!empty($path_to_page) && ($wpdb->get_var("show tables like '$psp_404_log'") == $psp_404_log)) {
732
+ $id_404 = $wpdb->get_row($sql_404, OBJECT);
733
+ }
734
+
735
+ if (!empty($id_404) && trim($id_404->status) == "410") {
736
+
737
+ $error_title = '410 Gone';
738
+ }
739
+
740
+
741
+ if ( is_404() ) {
742
+
743
+ $title_format = isset($this->psp_404_settings['title']) ? $this->psp_404_settings['title'] : "";
744
+ if (empty($title_format)) {
745
+ $title_format = "%title_404%";
746
+ $title = str_replace('%title_404%', $error_title, $title_format);
747
+ } else {
748
+ //get_option('aiosp_search_title_format');
749
+ //$title = str_replace('%blog_title%', $this->psp_helper->internationalize(get_bloginfo('name')), $title_format);
750
+ //$title = str_replace('%blog_description%', $this->psp_helper->internationalize(get_bloginfo('description')), $title);
751
+ //$title = str_replace('%blog_title%', $this->sitename, $title_format);
752
+ //$title = str_replace('%blog_description%', $this->sitedescription, $title);
753
+ $title = str_replace('%title_404%', $error_title, $title_format);
754
+ $title = str_replace('%title%', $error_title, $title);
755
+ $title = str_replace('%seo_title%', $error_title, $title);
756
+ $title = str_replace('%site_name%', $this->sitename, $title);
757
+ //$title = str_replace('%sep%', htmlentities($this->psp_sitewide_settungs['separator']), $title);
758
+ $title = str_replace('%sep%', $this->psp_sitewide_settungs['separator'], $title);
759
+ //$title = $this->paged_title($title);
760
+ }
761
+ }
762
+ $title = trim($title);
763
+ return $title;
764
+
765
+ } // end get_404_psp_title
766
 
767
  public function get_date_archive_psp_title() {
768
 
psp-include/settings/css/psp-settings.css CHANGED
@@ -27,6 +27,14 @@ body {
27
  appearance:none;
28
  }
29
 
 
 
 
 
 
 
 
 
30
  .psp-radio-separator{
31
  cursor:pointer;
32
  background-size:contain;
27
  appearance:none;
28
  }
29
 
30
+ .psp-d {
31
+ width:10%;height:10%;
32
+ }
33
+
34
+ .alternate {
35
+ background-color: #F2F2F2;
36
+ }
37
+
38
  .psp-radio-separator{
39
  cursor:pointer;
40
  background-size:contain;
psp-include/settings/js/psp-404.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ jQuery('#psp_action').on('change', function (){
3
+ $("#source-url-input").val('');
4
+ $( "#psp-edit-div" ).slideUp( "slow", function() {
5
+ $("#psp-edit-div").addClass('hidden');
6
+ $("#insertit").addClass('hidden');
7
+ $("#cancelit").addClass('hidden');
8
+ $("#source-tr").removeClass('hidden');
9
+ //$("#updateit").addClass('hidden');
10
+ //$("#psp-delete-div").removeClass('hidden');
11
+ });
12
+
13
+ if($(this).val() == 'addredirect') {
14
+
15
+ $( "#psp-edit-div" ).slideDown( "slow", function() {
16
+ $("#source-url-input").val('');
17
+ $("#source-tr").addClass('hidden');
18
+ $("#insertit").removeClass('hidden');
19
+ $("#cancelit").removeClass('hidden');
20
+ $("#psp-edit-div").removeClass('hidden');
21
+ });
22
+
23
+ }
24
+ if($(this).val() == 'edit') {
25
+ $("#psp-status-div").removeClass('hidden');
26
+ $("#updateit").removeClass('hidden');
27
+ } else {
28
+ $("#psp-status-div").addClass('hidden');
29
+ $("#updateit").addClass('hidden');
30
+ }
31
+
32
+ if($(this).val() == 'delete' || $(this).val() == 'deleteall') {
33
+ $("#psp-delete-div").removeClass('hidden');
34
+ } else {
35
+ $("#psp-delete-div").addClass('hidden');
36
+ }
37
+ });
38
+ $('#cancelit').on('click', function (){
39
+ $( "#psp-edit-div" ).slideUp( "slow", function() {
40
+ $("#psp-edit-div").addClass('hidden');
41
+ $("#insertit").addClass('hidden');
42
+ $("#cancelit").addClass('hidden');
43
+ //$("#updateit").addClass('hidden');
44
+ //$("#psp-delete-div").removeClass('hidden');
45
+ });
46
+ });
47
+ $('a.create').on('click', function (){
48
+ $('#id-input').val( $(this).attr('title'));
49
+ $('#source-url-input').val( $(this).siblings("div").text());
50
+ $( "#psp-edit-div" ).slideDown( "slow", function() { $("#source-tr").removeClass('hidden');
51
+ $("#insertit").removeClass('hidden');
52
+ $("#cancelit").removeClass('hidden');
53
+ $("#psp-edit-div").removeClass('hidden');
54
+ });
55
+ });
56
+ $('.moretr').on('click', function (){
57
+ $(this).toggle('slow');
58
+ });
59
+ $('a.more').on('click', function (){
60
+ $(this).closest("tr").next('tr').toggle('slow');
61
+ });
62
+ if($('#psp_filter').val() === '') {
63
+ $( "#pspsearchfield" ).addClass('hidden');
64
+ } else {
65
+ $( "#pspsearchfield" ).removeClass('hidden');
66
+ }
67
+ jQuery('#psp_filter').on('change', function (){
68
+ if($(this).val() === '') {
69
+ $( "#pspsearchfield" ).addClass('hidden');
70
+ } else {
71
+ $( "#pspsearchfield" ).removeClass('hidden');
72
+ }
73
+ });
74
+ });
psp-include/settings/js/psp-redirect.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+
3
+ jQuery('#psp_action').on('change', function (){
4
+
5
+ $( "#psp-edit-div" ).slideUp( "slow", function() {
6
+ $("#psp-edit-div").addClass('hidden');
7
+ $("#updateit").addClass('hidden');
8
+ $("#source-tr").addClass('hidden');
9
+ $("#insertit").addClass('hidden');
10
+ $("#log-div").addClass('hidden');
11
+ $("#cancelit").addClass('hidden');
12
+ });
13
+
14
+ if($(this).val() == 'edit' || $(this).val() == 'addnew') {
15
+ if($(this).val() == 'edit') {
16
+ $( "#psp-edit-div" ).slideDown( "slow", function() {
17
+ if( $( "#psp_redir_type" ).val() !== "") {
18
+ $("#log-div").removeClass('hidden');
19
+ }
20
+ $("#updateit").removeClass('hidden');
21
+ $("#psp-edit-div").removeClass('hidden');
22
+ $("#cancelit").removeClass('hidden');
23
+
24
+ });
25
+ }
26
+ if($(this).val() == 'addnew') {
27
+ $( "#psp-edit-div" ).slideDown( "slow", function() {
28
+ $("#source-tr").removeClass('hidden');
29
+ $("#insertit").removeClass('hidden');
30
+ $("#psp-edit-div").removeClass('hidden');
31
+ $("#cancelit").removeClass('hidden');
32
+ if( $( "#psp_redir_type" ).val() !== "") {
33
+ $("#log-div").removeClass('hidden');
34
+ }
35
+ });
36
+ }
37
+ }
38
+
39
+ if($(this).val() == 'delete' || $(this).val() == 'deleteall') {
40
+
41
+ $("#psp-delete-div").removeClass('hidden');
42
+
43
+ } else {
44
+
45
+ $("#psp-delete-div").addClass('hidden');
46
+
47
+ }
48
+ });
49
+ jQuery('#psp_redir_type').on('change', function (){
50
+
51
+ if($(this).val() !== '') {
52
+ $('select[id="psp_filter"]').find('option[value=""]').text("All");
53
+ } else {
54
+ $('select[id="psp_filter"]').find('option[value=""]').text("Redirected");
55
+ }
56
+
57
+ if($(this).val() !== $("#pspredirtype").val()) {
58
+ $( "#psp-edit-div" ).slideUp( "slow");
59
+ $("#psp_action").val('');
60
+ $("#psp_action").addClass('hidden');
61
+ $("#psp-delete-div").addClass('hidden');
62
+ } else {
63
+ $("#psp_action").removeClass('hidden');
64
+ if($("#psp_action").val() == 'delete' || $("#psp_action").val() == 'deleteall') {
65
+ $("#psp-delete-div").removeClass('hidden');
66
+ }
67
+ }
68
+
69
+ });
70
+ $('#cancelit').on('click', function (){
71
+ $( "#psp-edit-div" ).slideUp( "slow", function() {
72
+ $("#psp-edit-div").addClass('hidden');
73
+ $("#insertit").addClass('hidden');
74
+ $("#cancelit").addClass('hidden');
75
+ });
76
+ })
77
+ if($('#psp_filter').val() === '') {
78
+ $( "#pspsearchfield" ).addClass('hidden');
79
+ } else {
80
+ $( "#pspsearchfield" ).removeClass('hidden');
81
+ }
82
+ jQuery('#psp_filter').on('change', function (){
83
+ if($(this).val() === '') {
84
+ $( "#pspsearchfield" ).addClass('hidden');
85
+ } else {
86
+ $( "#pspsearchfield" ).removeClass('hidden');
87
+ }
88
+ });
89
+ if (jQuery('#ipaddress-hide').is(":not(:checked)")) {
90
+ $( "#ipaddress" ).addClass('hidden');
91
+ $( ".ipaddress" ).addClass('hidden');
92
+ }
93
+ if (jQuery('#referrer-hide').is(":not(:checked)")) {
94
+ $( "#referrer" ).addClass('hidden');
95
+ $( ".referrer" ).addClass('hidden');
96
+ }
97
+ if (jQuery('#useragent-hide').is(":not(:checked)")) {
98
+ $( "#useragent" ).addClass('hidden');
99
+ $( ".useragent" ).addClass('hidden');
100
+ }
101
+ jQuery('#ipaddress-hide').click(function(){
102
+ if($(this).is(":checked")){
103
+ $( "#ipaddress" ).removeClass('hidden');
104
+ $( ".ipaddress" ).removeClass('hidden');
105
+ }
106
+ else if($(this).is(":not(:checked)")){
107
+ $( "#ipaddress" ).addClass('hidden');
108
+ $( ".ipaddress" ).addClass('hidden');
109
+ }
110
+ });
111
+
112
+ jQuery('#useragent-hide').click(function(){
113
+ if($(this).is(":checked")){
114
+ $( "#useragent" ).removeClass('hidden');
115
+ $( ".useragent" ).removeClass('hidden');
116
+ }
117
+ else if($(this).is(":not(:checked)")){
118
+ $( "#useragent" ).addClass('hidden');
119
+ $( ".useragent" ).addClass('hidden');
120
+ }
121
+ });
122
+
123
+ jQuery('#referrer-hide').click(function(){
124
+ if($(this).is(":checked")){
125
+ $( "#referrer" ).removeClass('hidden');
126
+ $( ".referrer" ).removeClass('hidden');
127
+ }
128
+ else if($(this).is(":not(:checked)")){
129
+ $( "#referrer" ).addClass('hidden');
130
+ $( ".referrer" ).addClass('hidden');
131
+ }
132
+ });
133
+
134
+ });
psp-include/settings/psp_404_list_renderer.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Platinum SEO Pack
4
+ Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
5
+ Author: Rajesh - Techblissonline
6
+ Author URI: http://techblissonline.com/
7
+ */
8
+ ?>
9
+ <?php
10
+ wp_enqueue_script( 'psp-404', plugins_url( '/js/psp-404.js', __FILE__ ), array( 'jquery' ) );
11
+ ?>
12
+ <style>
13
+ .page-numbers {
14
+ display: inline-block;
15
+ padding: 5px 10px;
16
+ margin: 0 2px 0 0;
17
+ border: 1px solid #eee;
18
+ line-height: 1;
19
+ text-decoration: none;
20
+ border-radius: 2px;
21
+ font-weight: 600;
22
+ olor:#111;
23
+
24
+ }
25
+ .page-numbers.current,
26
+ a.page-numbers:hover {
27
+ background: grey; /* color:#f9f9f9;*/
28
+ color:#fff;
29
+ }
30
+ </style>
31
+
32
+ <div class="wrap">
33
+
34
+ <h2>Manage 404 Errors:</h2>
35
+ <a href="/wp-admin/admin.php?page=platinum-seo-social-pack-by-techblissonline&psptab=psp_permalink#psp_301_limit">404 Settings</a> | <a href="https://techblissonline.com/http-404-error/" target="_blank" rel="noopener">How to handle 404 Errors</a>
36
+ <form id="psp-search" action="" method="get">
37
+ <div class="tablenav top">
38
+ <div class="alignleft actions">
39
+
40
+ <input type="hidden" name="page" id="page" value="manager404">
41
+ <div id="pspredirmethod" class="alignleft">
42
+ <select id="psp_404_type" name="psp_404_type"><?php $dditems = array('' => 'All Errors', 'all_with_referrers' => 'Errors with referrers only','all_404' => 'All 404s', 'all_410' => 'All 410s', 'all_404_with_referrers' => 'All 404s with referrers', 'all_410_with_referrers' => 'All 410s with referrers');
43
+ foreach($dditems as $key => $val) {
44
+ $selected = (isset($_GET['psp_404_type']) && $_GET['psp_404_type']==$key) ? 'selected="selected"' : '';
45
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
46
+ } ?></select></div>
47
+ <div id="pspfilter" class="alignleft">
48
+ <select id="psp_filter" name="psp_filter"><?php $dditems = array('' => 'Logged', 'equals' => 'Equal to', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With');
49
+ foreach($dditems as $key => $val) {
50
+ $selected = (isset($_GET['psp_filter']) && $_GET['psp_filter']==$key) ? 'selected="selected"' : '';
51
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
52
+ } ?></select></div>
53
+ <div id="pspsearchfield" class="alignleft hidden">
54
+ <input type="search" name="post-search-input" id="post-search-input" value="<?php echo (isset($_GET['post-search-input']) ? esc_attr(sanitize_text_field($_GET['post-search-input'])) : ''); ?>">
55
+ </div>
56
+
57
+ <div id="searchitdiv" class="alignleft"><input type="submit" name="searchit" id="searchit" class="button-secondary search" value="Search"></div>
58
+
59
+ </div>
60
+
61
+ </div>
62
+ </form>
63
+ <br class="clear" />
64
+ <form id="psp-edit" action="" method="post">
65
+ <div id="psp-edit-div" class="hidden">
66
+ <table class="form-table">
67
+
68
+ <tr id="id-tr" class="form-field hidden">
69
+ <th style="width:20%;" scope="row" valign="top"><label for="id-input"><?php esc_html_e('Source ID: ', 'platinum-seo-pack'); ?></label></div></th>
70
+ <td><input type="hidden" id="id-input" name="id-input" value="" /></td>
71
+ </tr>
72
+
73
+ <tr id="source-tr" class="form-field">
74
+ <th style="width:20%;" scope="row" valign="top"><label for="source-url-input"><?php esc_html_e('Source URI: ', 'platinum-seo-pack'); ?></label></div></th>
75
+ <td><input type="text" id="source-url-input" name="source-url-input" value="" placeholder="<?php esc_html_e('Enter the source URI or URL ', 'platinum-seo-pack'); ?>" /></td>
76
+ </tr>
77
+
78
+ <tr class="form-field">
79
+ <th style="width:20%;" scope="row" valign="top"><label for="redirect-url-input"><?php esc_html_e('Redirect to: ', 'platinum-seo-pack'); ?></label></th>
80
+ <td><input type="text" id="redirect-url-input" name="redirect-url-input" value="" placeholder="<?php esc_html_e('Enter a valid Destination URL ', 'platinum-seo-pack'); ?>" /></td>
81
+ </tr>
82
+ <tr class="form-field">
83
+ <th style="width:20%;" scope="row" valign="top"><label for="redirect-url-input"><?php echo esc_html__('Redirection Method: ', 'platinum-seo-pack').'<br>'.'<a href="https://techblissonline.com/http-redirection-status-codes-301-302-307-308/" target="_blank" rel="noopener">'.esc_html__('What to Select?', 'platinum-seo-pack').'</a>'; ?></label></th>
84
+ <td>
85
+ <div class="alignleft"><select id="psp-redirect-code" name="psp-redirect-code">
86
+ <?php $dditems = array('' => 'Select a redirection method', '301' => '301 Moved Permanently', '302' => '302 Found', '302' => '302 Found', '303' => '303 See Other', '307' => '307 Temporary Redirect');
87
+
88
+ foreach($dditems as $key => $val) {
89
+ $selected = (isset($_POST['psp-redirect-code']) && $_POST['psp-redirect-code']==$key) ? 'selected="selected"' : '';
90
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
91
+ } ?>
92
+ </select></div>
93
+ <div id="insertit-div" class="alignleft"><input type="submit" value="<?php _e('Add New'); ?>" name="insertit" id="insertit" class="button-secondary update hidden" />
94
+ </div>
95
+ <div id="cancelit-div" class="alignleft"><input type="reset" value="<?php _e('Cancel'); ?>" name="cancelit" id="cancelit" class="button-secondary update hidden" />
96
+ </div>
97
+ </td>
98
+ </tr>
99
+ </table>
100
+ </div>
101
+ <?php
102
+ wp_nonce_field( 'do_psp_404_actions', 'psp_404_actions_nonce' );
103
+ ?>
104
+ <div class="tablenav">
105
+ <div class="alignleft">
106
+ <div id="psp-select-div" class="alignleft">
107
+ <select id="psp_action" name="psp_action">
108
+ <?php
109
+ $dditems = array('' => 'Bulk Actions', 'addredirect' => 'Add Redirection', 'edit' => 'update Status', 'delete' => 'Delete Permanently', 'deleteall' => 'Delete All');
110
+ foreach($dditems as $key => $val) {
111
+ //$selected = (isset($_POST['psp_action']) && $_POST['psp_action']==$key) ? 'selected="selected"' : '';
112
+ $selected = '';
113
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
114
+ } ?>
115
+ </select>
116
+ </div>
117
+ <div id="psp-delete-div" class="hidden alignleft">
118
+ <input type="submit" value="<?php _e('Delete'); ?>" id="deleteit" name="deleteit" class="button-secondary delete" />
119
+ </div>
120
+ <div id="psp-status-div" class="hidden alignleft">
121
+ <select id="psp_status" name="psp_status">
122
+ <?php
123
+ $dditems = array('' => 'Leave it as 404', '410' => 'Change status to 410');
124
+ foreach($dditems as $key => $val) {
125
+ //$selected = (isset($_POST['psp_action']) && $_POST['psp_action']==$key) ? 'selected="selected"' : '';
126
+ $selected = '';
127
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
128
+ } ?>
129
+ </select>
130
+ </div>
131
+ <div id="updateit" class="alignleft hidden"><input type="submit" value="<?php _e('Update'); ?>" name="updateit" class="button-secondary update hidden" />
132
+ </div>
133
+ </div>
134
+ <script type="text/javascript">
135
+ <!--
136
+ function checkAll(form) {
137
+ for (i = 0, n = form.elements.length; i < n; i++) {
138
+ if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
139
+ if(form.elements[i].checked == true)
140
+ form.elements[i].checked = false;
141
+ else
142
+ form.elements[i].checked = true;
143
+ }
144
+ }
145
+ }
146
+ //-->
147
+ </script>
148
+ <?php
149
+ if ( $page_links )
150
+ echo "<div class='tablenav-pages alignright'>$page_links</div>";
151
+ ?>
152
+ </div>
153
+ <table class="widefat">
154
+ <thead>
155
+ <tr>
156
+ <th scope="col" class=""><input onclick="checkAll(document.getElementById('psp-edit'));" type="checkbox"></th>
157
+ <th scope="col">ID</th>
158
+ <th scope="col">Request Path(Name)</th>
159
+ <th scope="col">Status</th>
160
+ <th scope="col">Referrer</th>
161
+ <th scope="col">Hits</th>
162
+ <th scope="col">IP Address</th>
163
+ <th scope="col">More</th>
164
+ </tr>
165
+ </thead>
166
+ <?php
167
+ if(count($bad_links) > 0) { ?>
168
+ <tbody>
169
+ <?php
170
+ $bgcolor = '';
171
+ //$class = 'alternate' == $class ? '' : 'alternate';
172
+ $class = 'alternate';
173
+ foreach($bad_links as $bad_link){
174
+
175
+ $post_psp_id = sanitize_key($bad_link->psp_id);
176
+ $class = 'alternate' == $class ? '' : 'alternate';
177
+ ?>
178
+ <tr class="<?php echo trim( esc_attr($class) . ' author-self status-publish'); ?>" valign="top">
179
+ <th scope="row" class=""><?php if ( current_user_can( 'edit_posts', $post_psp_id ) ) { ?><input type="checkbox" name="update[]" value="<?php echo esc_attr($post_psp_id); ?>" /><input type="hidden" id="<?php echo "psp-".esc_attr($post_psp_id); ?>" name="<?php echo "psp-".esc_attr($post_psp_id); ?>" value="<?php echo esc_attr($bad_link->psp_post_name); ?>" /><?php } ?></th>
180
+ <td><a href="<?php echo esc_url_raw($bad_link->psp_rel_url); ?>" target="_blank"><?php echo esc_attr($post_psp_id); ?></a></td>
181
+ <td><?php echo esc_attr($bad_link->psp_post_name); ?><div class="create-div"><div class="uri hidden"><?php echo esc_attr($bad_link->psp_post_name); ?></div><a href="#" title="<?php echo esc_attr($post_psp_id); ?>" class="create"><?php echo "Create Redirection"; ?></a></div></td>
182
+ <td><?php echo empty($bad_link->status) ? '404' : esc_html($bad_link->status); ?></td>
183
+ <td><?php echo !empty($bad_link->referrer) ? esc_html($bad_link->referrer) : ''; ?></td>
184
+ <td><?php echo !empty($bad_link->total_hits) ? esc_html($bad_link->total_hits) : ''; ?></td>
185
+ <td><?php echo !empty($bad_link->ipaddress) ? esc_html($bad_link->ipaddress) : ''; ?></td>
186
+ <td><a href="#.more" class="more button"><?php echo "..."; ?></a></td>
187
+ </tr><tr class="moretr hidden"><td colspan="7">
188
+ <div id="more-<?php echo esc_attr($bad_link->psp_id); ?>" class="alignleft">
189
+ <div class="alignleft"><b>Request URL: </b><?php echo !empty($bad_link->psp_rel_url) ? esc_html($bad_link->psp_rel_url) : ''; ?></div><br class="clear" />
190
+ <div class="alignleft"><b>IP address: </b><?php echo !empty($bad_link->ipaddress) ? esc_html($bad_link->ipaddress) : ''; ?></div><br class="clear" />
191
+ <div class="alignleft"><b>User Agent: </b><?php echo !empty($bad_link->user_agent) ? esc_html($bad_link->user_agent) : ''; ?></div><br class="clear" />
192
+ <div class="alignleft"><b>Created: </b><?php echo !empty($bad_link->created) ? esc_html($bad_link->created) : ''; ?></div><br class="clear" />
193
+ <div class="alignleft"><b>Last Logged: </b><?php echo !empty($bad_link->last_logged) ? esc_html($bad_link->last_logged) :''; ?></div>
194
+ <div id="cancelmore-div" class="alignright"><input type="reset" value="<?php _e('Cancel'); ?>" name="cancelmore" id="cancelmore" class="button-secondary update hidden" />
195
+ </div>
196
+ </div></td>
197
+ </tr>
198
+ <?php } ?>
199
+ </tbody>
200
+ <?php } ?>
201
+ </table>
202
+ </form>
203
+
204
+ <div class="tablenav top">
205
+
206
+ <?php
207
+ if ( $page_links )
208
+ echo "<div class='tablenav-pages'>$page_links</div>";
209
+ ?>
210
+
211
+ </div>
212
+
213
+ <br class="clear" />
214
+
215
+ </div>
psp-include/settings/psp_advanced_metabox_renderer.php CHANGED
@@ -55,7 +55,7 @@ Author URI: https://techblissonline.com/
55
  <tr class="form-field">
56
  <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[maxvideo]"><?php esc_html_e('Max Video Preview: ', 'platinum-seo-pack'); ?></label></th>
57
  <td><input style="width:15%;" type="number" min="-1" name="psp_seo_meta[maxvideo]" id="psp_seo_meta[maxvideo]" size="3" maxlength="3" value="<?php echo ( isset($psp_seo_meta['maxvideo']) ? ($psp_seo_meta['maxvideo'] == 'zero' ? 0 : esc_attr($psp_seo_meta['maxvideo'])) : ''); ?>" /><?php esc_html_e(' Seconds. [Optional]', 'platinum-seo-pack'); ?><br />
58
- <p class="description"><?php echo esc_html__('Set max video preview length directive to Google for this post/page.', 'platinum-seo-pack').' <a href="https://techblissonline.com/" target="_blank">'.esc_html__('Read more', 'platinum-seo-pack').'...</a>'; ?></p>
59
  </td>
60
  </tr>
61
  <tr class="form-field">
@@ -85,9 +85,9 @@ Author URI: https://techblissonline.com/
85
  </td>
86
  </tr>
87
  <tr class="form-field">
88
- <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[schema_string]"><?php esc_html_e('JSON_LD Schema String: ', 'platinum-seo-pack'); ?></label><br /><br /><i><a class="permalink" id="schemagenerator" href="https://techblissonline.com/tools/json-schema-generator/" target="_blank"><?php esc_html_e('Techblissonline Json Schema Generator Tool', 'platinum-seo-pack'); ?></a></i><br /><br /><i><a class="permalink" id="joinschemas" href="https://techblissonline.com/combine-json-schema/" target="_blank"><?php esc_html_e('How to combine several Json schema?', 'platinum-seo-pack'); ?></a></i></th>
89
  <td><div class='pspeditor'><textarea name="psp_seo_meta[schema_string]" id="psp_seo_meta[schema_string]" class="pspjsoneditor"><?php echo ( isset($psp_seo_meta['schema_string']) ? (esc_textarea(stripcslashes($psp_seo_meta['schema_string']))) : ' '); ?></textarea></div><br />
90
- <p class="description"><?php echo esc_html__('Set JSON_LD Schema String (without the script tag) for this post/page. Use', 'platinum-seo-pack').' <a href="https://techblissonline.com/tools/schema-markup-generator/" target="_blank">'.esc_html__('Techblissonline Schema Generator Tool', 'platinum-seo-pack').'</a>'; ?></p>
91
  </td>
92
  </tr>
93
 
@@ -102,7 +102,7 @@ Author URI: https://techblissonline.com/
102
  </td>
103
  </tr>
104
  <tr class="form-field">
105
- <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[redirect_status_code]"><?php esc_html_e('Use: ', 'platinum-seo-pack'); ?></label></th>
106
  <td><select id="psp_seo_meta[redirect_status_code]" name="psp_seo_meta[redirect_status_code]"><?php $dditems = array('' => 'Select a redirection method', '301' => '301 Moved Permanently', '302' => '302 Found', '303' => '303 See Other', '307' => '307 Temporary Redirect');
107
  foreach($dditems as $key => $val) {
108
  $selected = (isset($psp_seo_meta['redirect_status_code']) && $psp_seo_meta['redirect_status_code']==$key) ? 'selected="selected"' : '';
55
  <tr class="form-field">
56
  <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[maxvideo]"><?php esc_html_e('Max Video Preview: ', 'platinum-seo-pack'); ?></label></th>
57
  <td><input style="width:15%;" type="number" min="-1" name="psp_seo_meta[maxvideo]" id="psp_seo_meta[maxvideo]" size="3" maxlength="3" value="<?php echo ( isset($psp_seo_meta['maxvideo']) ? ($psp_seo_meta['maxvideo'] == 'zero' ? 0 : esc_attr($psp_seo_meta['maxvideo'])) : ''); ?>" /><?php esc_html_e(' Seconds. [Optional]', 'platinum-seo-pack'); ?><br />
58
+ <p class="description"><?php echo esc_html__('Set max video preview length directive to Google for this post/page.', 'platinum-seo-pack').' <a href="https://techblissonline.com/" target="_blank" rel="noopener">'.esc_html__('Read more', 'platinum-seo-pack').'...</a>'; ?></p>
59
  </td>
60
  </tr>
61
  <tr class="form-field">
85
  </td>
86
  </tr>
87
  <tr class="form-field">
88
+ <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[schema_string]"><?php esc_html_e('JSON_LD Schema String: ', 'platinum-seo-pack'); ?></label><br /><br /><i><a class="permalink" id="schemagenerator" href="https://techblissonline.com/tools/json-schema-generator/" target="_blank" rel="noopener"><?php esc_html_e('Techblissonline Json Schema Generator Tool', 'platinum-seo-pack'); ?></a></i><br /><br /><i><a class="permalink" id="joinschemas" href="https://techblissonline.com/combine-json-schema/" target="_blank" rel="noopener"><?php esc_html_e('How to combine several Json schema?', 'platinum-seo-pack'); ?></a></i></th>
89
  <td><div class='pspeditor'><textarea name="psp_seo_meta[schema_string]" id="psp_seo_meta[schema_string]" class="pspjsoneditor"><?php echo ( isset($psp_seo_meta['schema_string']) ? (esc_textarea(stripcslashes($psp_seo_meta['schema_string']))) : ' '); ?></textarea></div><br />
90
+ <p class="description"><?php echo esc_html__('Set JSON_LD Schema String (without the script tag) for this post/page. Use', 'platinum-seo-pack').' <a href="https://techblissonline.com/tools/json-schema-generator/" target="_blank" rel="noopener">'.esc_html__('Techblissonline Schema Generator Tool', 'platinum-seo-pack').'</a>'; ?></p>
91
  </td>
92
  </tr>
93
 
102
  </td>
103
  </tr>
104
  <tr class="form-field">
105
+ <th style="width:20%;" scope="row" valign="top"><label for="psp_seo_meta[redirect_status_code]"><?php echo esc_html__('Use: ', 'platinum-seo-pack').'<br>'.'<a href="https://techblissonline.com/http-redirection-status-codes-301-302-307-308/" target="_blank" rel="noopener">'.esc_html__('What to Select?', 'platinum-seo-pack').'</a>'; ?></label></th>
106
  <td><select id="psp_seo_meta[redirect_status_code]" name="psp_seo_meta[redirect_status_code]"><?php $dditems = array('' => 'Select a redirection method', '301' => '301 Moved Permanently', '302' => '302 Found', '303' => '303 See Other', '307' => '307 Temporary Redirect');
107
  foreach($dditems as $key => $val) {
108
  $selected = (isset($psp_seo_meta['redirect_status_code']) && $psp_seo_meta['redirect_status_code']==$key) ? 'selected="selected"' : '';
psp-include/settings/psp_redirect_404.php ADDED
@@ -0,0 +1,1034 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Platinum SEO Pack
4
+ Plugin URI: https://techblissonline.com/platinum-wordpress-seo-plugin/
5
+ Author: Rajesh - Techblissonline
6
+ Author URI: http://techblissonline.com/
7
+ */
8
+ class PspRedirections {
9
+
10
+ private static $obj_handle = null;
11
+
12
+ protected $psp_helper;
13
+
14
+ public static function get_instance() {
15
+
16
+ if ( null == self::$obj_handle ) {
17
+ self::$obj_handle = new self;
18
+ }
19
+
20
+ return self::$obj_handle;
21
+
22
+ } // end get_instance;
23
+ //can be made private for singleton pattern
24
+ public function __construct() {
25
+
26
+ $psp_helper_instance = PspHelper::get_instance();
27
+ $this->psp_helper = $psp_helper_instance;
28
+
29
+ add_action('admin_menu', array(&$this, 'psp_redirect_admin_menu'));
30
+
31
+ add_filter('set-screen-option', array(&$this, 'psp_set_screen_option'), 10, 3);
32
+
33
+ }
34
+
35
+ public function psp_redirect_admin_menu() {
36
+
37
+ $psp_redir_page = add_management_page('Redirection Manager', 'Platinum SEO Redirections Manager', 'manage_options', 'redirectionmanager', array($this, 'redir_mgmtpage'));
38
+ $psp_redir_page_2 = 'platinum-seo-and-social-pack_page_redirectionmanager';
39
+ //error_log('redir '. $psp_redir_page);
40
+
41
+ add_action("load-$psp_redir_page", array($this, 'psp_screen_options'));
42
+ add_action("load-$psp_redir_page_2", array($this, 'psp_screen_options'));
43
+
44
+ $psp_404_page = add_management_page('404 Manager', 'Platinum SEO 404 Manager', 'manage_options', 'manager404', array($this, 'manage_404_page'));
45
+ $psp_404_page_2 = 'platinum-seo-and-social-pack_page_manager404';
46
+
47
+ add_action("load-$psp_404_page", array($this, 'psp_screen_options'));
48
+ add_action("load-$psp_404_page_2", array($this, 'psp_screen_options'));
49
+ add_filter("manage_".$psp_redir_page."_columns", array($this, 'psp_screen_column_options'));
50
+ add_filter("manage_".$psp_redir_page_2."_columns", array($this, 'psp_screen_column_options'));
51
+
52
+ }
53
+
54
+ public function psp_screen_options() {
55
+
56
+ $psp_404_page = "tools_page_manager404";
57
+ $psp_404_page_2 = 'platinum-seo-and-social-pack_page_manager404';
58
+ $psp_redir_page = "tools_page_redirectionmanager";
59
+ $psp_redir_page_2 = "platinum-seo-and-social-pack_page_redirectionmanager";
60
+
61
+ $screen = get_current_screen();
62
+
63
+ //error_log($screen->id);
64
+
65
+ // get out of here if we are not on our settings page
66
+ if(!is_object($screen) || ($screen->id != $psp_redir_page_2 && $screen->id != $psp_redir_page && $screen->id != $psp_404_page && $screen->id != $psp_404_page_2))
67
+ {
68
+ return;
69
+ }
70
+ if ($screen->id == $psp_redir_page_2 || $screen->id == $psp_redir_page) {
71
+ $redir_args = array(
72
+ 'label' => __('Rows per page'),
73
+ 'default' => 10,
74
+ 'option' => 'psp_redir_rows_per_page'
75
+ );
76
+ add_screen_option( 'per_page', $redir_args );
77
+ }
78
+
79
+ if ($screen->id == $psp_404_page || $screen->id == $psp_404_page_2) {
80
+ $filter_args = array(
81
+ 'label' => __('Rows per page'),
82
+ 'default' => 10,
83
+ 'option' => 'psp_filter_rows_per_page'
84
+ );
85
+ add_screen_option( 'per_page', $filter_args );
86
+ }
87
+ }
88
+
89
+ public function psp_screen_column_options() {
90
+
91
+ $psp_404_page = "tools_page_manager404";
92
+ $psp_404_page_2 = 'platinum-seo-and-social-pack_page_manager404';
93
+ $psp_redir_page = "tools_page_redirectionmanager";
94
+ $psp_redir_page_2 = "platinum-seo-and-social-pack_page_redirectionmanager";
95
+
96
+ $screen = get_current_screen();
97
+
98
+ //error_log($screen->id);
99
+
100
+ // get out of here if we are not on our settings page
101
+ if(!is_object($screen) || ($screen->id != $psp_redir_page_2 && $screen->id != $psp_redir_page && $screen->id != $psp_404_page && $screen->id != $psp_404_page_2))
102
+ {
103
+ return;
104
+ }
105
+
106
+ $psp_redir_type = isset($_GET['psp_redir_type']) ? sanitize_key($_GET['psp_redir_type']) : '';
107
+
108
+ if ($psp_redir_type != "psplogs") {
109
+ return;
110
+ }
111
+
112
+ if ($screen->id == $psp_redir_page_2 || $screen->id == $psp_redir_page) {
113
+ $columns = array('ipaddress' => 'IP Address', 'useragent' => 'User Agent','referrer' => 'Referrer');
114
+ return $columns;
115
+
116
+ }
117
+ }
118
+
119
+ public function psp_set_screen_option($status, $option, $value) {
120
+
121
+ //error_log('option '.$option.' '.$status.' '.$value);
122
+
123
+ if ( 'psp_redir_rows_per_page' == $option || 'psp_filter_rows_per_page' == $option) {
124
+ //error_log("psp rows ".$value);
125
+ return sanitize_key($value);
126
+ }
127
+ }
128
+
129
+ public function manage_404_page() {
130
+
131
+ global $wpdb;
132
+
133
+ $psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
134
+ $psp_404_log = $wpdb->prefix . "psp_404_log";
135
+
136
+ $posts_list = array();
137
+ $sql_posts = '';
138
+ $bad_links = array();
139
+ $sql_posts_1 = '';
140
+ $sql_posts_2 = '';
141
+ $psp_404_type = isset($_GET['psp_404_type']) ? sanitize_key($_GET['psp_404_type']) : '';
142
+
143
+ //handle single addnew
144
+ if ( isset($_POST['insertit']) && !empty($_POST['source-url-input']) && !empty($_POST['id-input']) )
145
+ {
146
+ if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
147
+
148
+ $psp_id = isset($_POST['id-input']) ? sanitize_key($_POST['id-input']) : '';
149
+ $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
150
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
151
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
152
+
153
+ if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
154
+ //Add new redirect
155
+ if (!empty($psp_source_url)) $pspinsert['source_url'] = $psp_source_url;
156
+ if (!empty($psp_redirect_to)) $pspinsert['dest_url'] = $psp_redirect_to;
157
+ if (!empty($psp_redirect_code)) $pspinsert['redir_code'] = $psp_redirect_code;
158
+
159
+ //insert into $psp_redirections_tbl
160
+ $wpdb->insert( $psp_redirections_tbl, $pspinsert );
161
+ //delete from $psp_404_log
162
+ $wpdb->delete( $psp_404_log, array( 'id' => $psp_id ) );
163
+ }
164
+
165
+ }
166
+
167
+ }
168
+
169
+ //handle bulk addnew
170
+ if ( isset($_POST['insertit']) && isset($_POST['update']) )
171
+ {
172
+
173
+ if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
174
+
175
+ foreach( (array) $_POST['update'] as $psp_id ) {
176
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
177
+ $psp_id = sanitize_key($psp_id);
178
+
179
+ //$psp_source_url = isset($_POST['source-url-input']) ? esc_url_raw(html_entity_decode($_POST['source-url-input'])) : '';
180
+ $psp_source_url = isset($_POST["psp-".$psp_id]) ? sanitize_text_field(html_entity_decode($_POST["psp-".$psp_id])) : '';
181
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
182
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
183
+
184
+ if ($psp_action == 'addredirect' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
185
+ //Add new redirect
186
+ if (!empty($psp_source_url)) $pspinsert['source_url'] = $psp_source_url;
187
+ if (!empty($psp_redirect_to)) $pspinsert['dest_url'] = $psp_redirect_to;
188
+ if (!empty($psp_redirect_code)) $pspinsert['redir_code'] = $psp_redirect_code;
189
+
190
+ //insert into $psp_redirections_tbl
191
+ $wpdb->insert( $psp_redirections_tbl, $pspinsert );
192
+ //delete from $psp_404_log
193
+ $wpdb->delete( $psp_404_log, array( 'id' => $psp_id ) );
194
+ }
195
+ }
196
+
197
+ }
198
+ }
199
+
200
+ // Handle bulk deletes
201
+ if ( isset($_POST['deleteit']) && isset($_POST['update']) ) {
202
+
203
+ if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
204
+
205
+ foreach( (array) $_POST['update'] as $psp_id ) {
206
+
207
+ $psp_id = sanitize_key($psp_id);
208
+
209
+ if ( !current_user_can('edit_posts', $psp_id) )
210
+ wp_die( __('You are not allowed to Delete.') );
211
+
212
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
213
+
214
+ //Delete SQL here
215
+
216
+ if($wpdb->get_var("show tables like '$psp_404_log'") == $psp_404_log && $psp_action == 'delete')
217
+ {
218
+ //delete from $psp_404_log
219
+ $wpdb->delete( $psp_404_log, array( 'id' => $psp_id ) );
220
+ }
221
+
222
+ }
223
+
224
+ }
225
+ }
226
+
227
+ // Handle delete all
228
+ if ( isset($_POST['deleteit']) && isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' ) ) {
229
+
230
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
231
+
232
+ if ($psp_action == 'deleteall') {
233
+
234
+ if ( !current_user_can('edit_posts') )
235
+ wp_die( __('You are not allowed to Truncate.') );
236
+
237
+ if($wpdb->get_var("show tables like '$psp_404_log'") == $psp_404_log)
238
+ {
239
+ //delete all from $psp_redirections_log
240
+ $deleteall = $wpdb->query("TRUNCATE TABLE $psp_404_log");
241
+ }
242
+
243
+ }
244
+
245
+ }
246
+
247
+ //Handle bulk update
248
+ if ( isset($_POST['updateit']) && isset($_POST['update']) ) {
249
+
250
+ if (isset( $_POST['psp_404_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_404_actions_nonce']), 'do_psp_404_actions' )) {
251
+
252
+ foreach( (array) $_POST['update'] as $psp_id ) {
253
+
254
+ $psp_id = sanitize_key($psp_id);
255
+
256
+ if ( !current_user_can('edit_posts', $psp_id) )
257
+ wp_die( __('You are not allowed to update.') );
258
+
259
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
260
+
261
+ //$psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
262
+ //$psp_source_url = isset($_POST['source-url-input']) ? esc_url_raw(html_entity_decode($_POST['source-url-input'])) : '';
263
+ //$psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
264
+ $psp_status = isset($_POST['psp_status']) ? sanitize_key($_POST['psp_status']) : '';
265
+
266
+ //update status to 410 instead of 404
267
+ if($wpdb->get_var("show tables like '$psp_404_log'") == $psp_404_log && $psp_action == 'edit') {
268
+ //update $psp_404_log
269
+ $pspupdate = array();
270
+ $pspupdate['status'] = $psp_status;
271
+ $pspupdate['total_hits'] = 1; //reinitialize for 410
272
+ $wpdb->update( $psp_404_log, $pspupdate, array( 'id' => $psp_id ) );
273
+ }
274
+ }
275
+
276
+ }
277
+ }
278
+
279
+ //Handle search
280
+ if ( !empty($_GET['psp_filter']) && !empty($_GET['post-search-input']) ) {
281
+
282
+ if (!empty($_GET['post-search-input'])) {
283
+
284
+ $psp_search = sanitize_title($_GET['post-search-input']);
285
+
286
+ if ($_GET['psp_filter'] == "contains") {
287
+
288
+ $psp_like = '%'.$wpdb->esc_like($psp_search).'%';
289
+ //$psp_like = '%'. $psp_search.'%';
290
+
291
+ }
292
+
293
+ if ($_GET['psp_filter'] == "starts-with") {
294
+
295
+ $psp_like = $wpdb->esc_like($psp_search).'%';
296
+ }
297
+
298
+ if ($_GET['psp_filter'] == "ends-with") {
299
+
300
+ $psp_like = '%'.$wpdb->esc_like($psp_search);
301
+
302
+ }
303
+
304
+ if ($_GET['psp_filter'] == "equals") {
305
+
306
+ $psp_like = "equals";
307
+ }
308
+
309
+ }
310
+
311
+ if (!empty($psp_like)) {
312
+ //$sql_posts = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_name AS psp_post_name, b.meta_value AS psp_redirect, c. meta_value AS psp_redirect_code FROM $tbl_posts a, $tbl_postmeta b, $tbl_postmeta c WHERE a.post_name LIKE %s AND a.ID = b.post_id AND a.ID = c.post_id AND (b.meta_key='_techblissonline_psp_redirect_to_url' or 1=1) AND (c.meta_key='_techblissonline_psp_redirect_status_code' or 1=1)", $psp_like );
313
+ if (empty($psp_404_type)) {
314
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.source_uri AS psp_post_name, a.source_url AS psp_rel_url, a.referrer as referrer, a.status as status, a.user_agent as user_agent, a.ipaddress as ipaddress, a.total_hits as total_hits, a.last_logged as last_logged, a.created as created FROM $psp_404_log a WHERE a.source_uri LIKE %s", $psp_like );
315
+ if ($psp_like == "equals") {
316
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.source_uri AS psp_post_name, a.source_url AS psp_rel_url, a.referrer as referrer, a.status as status, a.user_agent as user_agent, a.ipaddress as ipaddress, a.total_hits as total_hits, a.last_logged as last_logged, a.created as created FROM $psp_404_log a WHERE a.source_uri = %s", $psp_search );
317
+ }
318
+ } else {
319
+ if ($psp_404_type == "all_404") $psp_where = "status = '' and ";
320
+ if ($psp_404_type == "all_410") $psp_where = "status = '410' and ";
321
+ if ($psp_404_type == "all_404_with_referrers") $psp_where = "status = '' and referrer != '' and ";
322
+ if ($psp_404_type == "all_410_with_referrers") $psp_where = "status = '410' and referrer != '' and ";
323
+ if ($psp_404_type == "all_with_referrers") $psp_where = "referrer != '' and ";
324
+
325
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.source_uri AS psp_post_name, a.source_url AS psp_rel_url, a.referrer as referrer, a.status as status, a.user_agent as user_agent, a.ipaddress as ipaddress, a.total_hits as total_hits, a.last_logged as last_logged, a.created as created FROM $psp_404_log a WHERE $psp_where a.source_url LIKE %s", $psp_like );
326
+ if ($psp_like == "equals") {
327
+
328
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.source_uri AS psp_post_name, a.source_url AS psp_rel_url, a.referrer as referrer, a.status as status, a.user_agent as user_agent, a.ipaddress as ipaddress, a.total_hits as total_hits, a.last_logged as last_logged,a.created as created FROM $psp_404_log a WHERE $psp_where a.source_url = %s", $psp_search );
329
+
330
+ }
331
+
332
+ }
333
+ //error_log($sql_posts_2);
334
+ $posts_list = $wpdb->get_results($sql_posts_2, OBJECT);
335
+
336
+ }
337
+
338
+ } else if ( empty($_GET['psp_filter']) ) {
339
+
340
+ if ($psp_404_type == "") $psp_where = " ";
341
+ if ($psp_404_type == "all_404") $psp_where = "where status = '' ";
342
+ if ($psp_404_type == "all_410") $psp_where = "where status = '410' ";
343
+ if ($psp_404_type == "all_404_with_referrers") $psp_where = "where status = '' and referrer != '' ";
344
+ if ($psp_404_type == "all_410_with_referrers") $psp_where = "where status = '410' and referrer != '' ";
345
+ if ($psp_404_type == "all_with_referrers") $psp_where = "where referrer != '' ";
346
+
347
+ $sql_posts_1 = "SELECT a.ID AS psp_id, a.source_uri AS psp_post_name, a.source_url AS psp_rel_url, a.referrer as referrer, a.status as status, a.user_agent as user_agent, a.ipaddress as ipaddress, a.total_hits as total_hits, a.last_logged as last_logged, a.created as created FROM $psp_404_log a $psp_where";
348
+
349
+ $posts_list = $wpdb->get_results($sql_posts_1, OBJECT);
350
+ }
351
+
352
+ $total_no_posts = count($posts_list);
353
+ $max_posts_per_page = 10;
354
+ $user = get_current_user_id();
355
+ $screen = get_current_screen();
356
+ // retrieve the "per_page" option
357
+ $screen_option = $screen->get_option('per_page', 'option');
358
+ // retrieve the value of the option stored for the current user
359
+ //error_log('screen option '.$screen_option);
360
+ $max_posts_per_page = get_user_meta($user, $screen_option, true);
361
+
362
+ if ( empty ( $max_posts_per_page) || $max_posts_per_page < 1 ) {
363
+ // get the default value if none is set
364
+ $max_posts_per_page = $screen->get_option( 'per_page', 'default' );
365
+ }
366
+
367
+
368
+
369
+ $link_count = ceil($total_no_posts/$max_posts_per_page);
370
+ $page_no = isset( $_GET['paged'] ) ? sanitize_key( $_GET['paged'] ) : 1;
371
+
372
+ $limit_sql = ' LIMIT '.(($page_no - 1) * $max_posts_per_page).', '.$max_posts_per_page;
373
+ //if($sql_posts != '') $sql_posts .= $limit_sql;
374
+ if($sql_posts_1 != '') $sql_posts = $sql_posts_1 . $limit_sql;
375
+ if($sql_posts_2 != '') $sql_posts = $sql_posts_2 . $limit_sql;
376
+
377
+ if($sql_posts != '') $bad_links = $wpdb->get_results( $sql_posts );
378
+ //if($sql_posts_2 != '') $bad_links_2 = $wpdb->get_results( $sql_posts_2 );
379
+
380
+ $page_links = paginate_links( array(
381
+ 'base' => add_query_arg( 'paged', '%#%' ),
382
+ 'format' => '',
383
+ 'total' => ceil($total_no_posts/$max_posts_per_page),
384
+ 'current' => $page_no
385
+ ));
386
+
387
+ include_once( 'psp_404_list_renderer.php' );
388
+ }
389
+
390
+ public function redir_mgmtpage() {
391
+
392
+ global $wpdb;
393
+ //$psp_bad_links_table = $this->psp_bad_links_table;
394
+
395
+ $tbl_posts = $wpdb->prefix . "posts";
396
+ $tbl_postmeta = $wpdb->prefix . "postmeta";
397
+ $psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
398
+ $psp_redirections_log = $wpdb->prefix . "psp_redirections_log";
399
+
400
+ $posts_list = array();
401
+ $sql_posts = '';
402
+ $bad_links = array();
403
+ $sql_posts_1 = '';
404
+ $sql_posts_2 = '';
405
+ $psp_redir_type = isset($_GET['psp_redir_type']) ? sanitize_key($_GET['psp_redir_type']) : '';
406
+
407
+ //handle addnew
408
+ if ( isset($_POST['insertit']) && !empty($psp_redir_type) ) {
409
+
410
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
411
+
412
+ $psp_source_url = isset($_POST['source-url-input']) ? sanitize_text_field(html_entity_decode($_POST['source-url-input'])) : '';
413
+ $psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw(html_entity_decode($_POST['redirect-url-input'])) : '';
414
+ $psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
415
+ $psp_log = isset($_POST['psplog']) ? sanitize_key($_POST['psplog']) : '';
416
+
417
+ if (!empty($psp_redir_type) && isset( $_POST['psp_urls_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_urls_redirect_actions_nonce']), 'do_psp_urls_redirect_actions' )) {
418
+
419
+ if ($psp_action == 'addnew' && !empty($psp_source_url) && !empty($psp_redirect_to) && !empty($psp_redirect_code)) {
420
+ //Add new
421
+ if (!empty($psp_source_url)) $pspinsert['source_url'] = $psp_source_url;
422
+ if (!empty($psp_redirect_to)) $pspinsert['dest_url'] = $psp_redirect_to;
423
+ if (!empty($psp_redirect_code)) $pspinsert['redir_code'] = $psp_redirect_code;
424
+ if (!empty($psp_log)) $pspinsert['log_redirect'] = $psp_log;
425
+
426
+ $wpdb->insert( $psp_redirections_tbl, $pspinsert );
427
+ }
428
+ }
429
+ }
430
+
431
+ // Handle bulk deletes
432
+ if ( isset($_POST['deleteit']) && isset($_POST['update']) ) {
433
+
434
+ foreach( (array) $_POST['update'] as $psp_id ) {
435
+
436
+ $psp_id = sanitize_key($psp_id);
437
+ if ( !current_user_can('edit_posts', $psp_id) )
438
+ wp_die( __('You are not allowed to Delete.') );
439
+
440
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
441
+
442
+ //$psp_redirect_to = isset($_POST['redirect-url-input']) ? esc_url_raw($_POST['redirect-url-input']) : '';
443
+ //$psp_redirect_code = isset($_POST['psp-redirect-code']) ? sanitize_key($_POST['psp-redirect-code']) : '';
444
+
445
+ //Delete SQL here
446
+
447
+ if (empty($psp_redir_type) && isset( $_POST['psp_posts_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_posts_redirect_actions_nonce']), 'do_psp_posts_redirect_actions' )) {
448
+ if ($psp_action == 'delete' && !empty($psp_id) ) {
449
+ delete_post_meta( $psp_id, '_techblissonline_psp_redirect_to_url');
450
+ delete_post_meta( $psp_id, '_techblissonline_psp_redirect_status_code');
451
+ }
452
+ } else {
453
+
454
+ if ($psp_redir_type == "pspurls" && isset( $_POST['psp_urls_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_urls_redirect_actions_nonce']), 'do_psp_urls_redirect_actions' )) {
455
+
456
+ if($wpdb->get_var("show tables like '$psp_redirections_tbl'") == $psp_redirections_tbl && $psp_action == 'delete')
457
+ {
458
+ //delete from $psp_redirections_tbl
459
+ $wpdb->delete( $psp_redirections_tbl, array( 'id' => $psp_id ) );
460
+
461
+ }
462
+
463
+ } else if ($psp_redir_type == "psplogs" && isset( $_POST['psp_logs_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_logs_redirect_actions_nonce']), 'do_psp_logs_redirect_actions' )) {
464
+
465
+ if($wpdb->get_var("show tables like '$psp_redirections_log'") == $psp_redirections_log && $psp_action == 'delete')
466
+ {
467
+ //delete from $psp_redirections_log
468
+ $wpdb->delete( $psp_redirections_log, array( 'id' => $psp_id ) );
469
+ }
470
+
471
+ }
472
+ }
473
+
474
+ }
475
+ }
476
+
477
+ // Handle delete all
478
+ if ( isset($_POST['deleteit']) ) {
479
+
480
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
481
+
482
+ if ($psp_action == 'deleteall' && $psp_redir_type == "psplogs" && isset( $_POST['psp_logs_redirect_actions_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_logs_redirect_actions_nonce']), 'do_psp_logs_redirect_actions' )) {
483
+
484
+ if ( !current_user_can('edit_posts') )
485
+ wp_die( __('You are not allowed to Truncate.') );
486
+
487
+ if($wpdb->get_var("show tables like '$psp_redirections_log'") == $psp_redirections_log)
488
+ {
489
+ //delete all from $psp_redirections_log
490
+ $deleteall = $wpdb->query("TRUNCATE TABLE $psp_redirections_log");
491
+ }
492
+
493
+ }
494
+
495
+ }
496
+
497
+ //Handle bulk update
498
+ if ( isset($_POST['updateit']) && isset($_POST['update']) ) {
499
+
500
+ foreach( (array) $_POST['update'] as $psp_id ) {
501
+
502