PluginProbe
SEO Redirection Plugin – 301 Redirect Manager / 8.4
SEO Redirection Plugin – 301 Redirect Manager v8.4
9.19 trunk 4.17 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.1 9.10 9.11 9.12 All 39 releases
seo-redirection / options / option_page_404.php

option_page_404.php in SEO Redirection Plugin – 301 Redirect Manager 8.4, at options/option_page_404.php

162 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 global $wpdb, $table_prefix, $util;
4
5 $table_name = $table_prefix . 'WP_SEO_404_links';
6
7 if ($util->post('redirect_to') != '') {
8 global $util;
9
10 $util->update_post_option('p404_status');
11 $util->update_option('p404_redirect_to', $util->make_relative_url($util->post('redirect_to')));
12 $util->success_option_msg('Options Saved!');
13
14 if ($util->there_is_cache() != '')
15 $util->info_option_msg("You have a cache plugin installed <b>'" . $util->there_is_cache() . "'</b>, you have to clear cache after any changes to get the changes reflected immediately! ");
16 }
17
18 if ($util->get('do_404_del') != '') {
19 if ($util->get('do_404_del') == 1) {
20 $wpdb->query("delete from $table_name where ctime <= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)");
21 } else if ($util->get('do_404_del') == 2) {
22 $wpdb->query("delete from $table_name where ctime <= DATE_SUB(CURDATE(), INTERVAL 3 MONTH)");
23 } else if ($util->get('do_404_del') == 3) {
24 $wpdb->query("Truncate table $table_name ");
25 }
26 }
27
28
29
30 $options = $util->get_my_options();
31
32
33 if ($util->get_option_value('p404_discovery_status') != '1')
34 $util->info_option_msg("404 error pages discovery property is disabled now!, you can re-enable it from options tab.");
35
36
37
38 $WPSR_get_current_parameters_ = $util->WPSR_get_current_parameters(array('search', 'page_num', 'add', 'edit'));
39
40 ?>
41
42 <script type="text/javascript">
43 //---------------------------------------------------------
44
45 function decodeHtmlCharCodes(str) {
46 return str.replace(/(&#(\d+);)/g, function(match, capture, charCode) {
47 return String.fromCharCode(charCode);
48 });
49 }
50
51
52 function go_search() {
53 var sword = document.getElementById('search').value;
54 if (sword != '') {
55 var link = decodeHtmlCharCodes("<?php echo sprintf('%s', esc_js($WPSR_get_current_parameters_)); ?>") + "&search=" + sword;
56 window.location = link;
57 } else {
58 alert('Please input any search words!');
59 document.getElementById('search').focus();
60 }
61
62 }
63
64
65 function go_del() {
66
67 if (confirm('Are you sure you want to delete all 404 links?')) {
68 var goto_url = decodeHtmlCharCodes("<?php echo sprintf('%s', esc_js($WPSR_get_current_parameters_)); ?>");
69
70 window.location = goto_url + "&do_404_del=" + document.getElementById('del_404_option').value;
71 }
72 }
73 </script>
74
75 <h3>New Discovered 404 links
76 <hr>
77 </h3>
78 <div class="link_buttons">
79 <table border="0" width="100%">
80 <tr>
81 <td align="left">
82 <input onkeyup="if (event.keyCode == 13) go_search();" style="height: 30px; border-radius: 3px !important;" id="search" type="text" name="search" value="<?php echo htmlentities(esc_attr($util->get('search'))) ?>" size="40">
83 <a onclick="go_search()" style="padding:3px 10px !important" class="btn-custom btn-search" href="#">
84 <span class="dashicons dashicons-search"></span>
85 Search
86 </a>
87 <a class="btn-custom btn-search" style="padding:3px 10px !important" href="<?php echo esc_url($util->WPSR_get_current_parameters('search')); ?>">
88 <span class="dashicons dashicons-screenoptions"></span>
89 Show All
90 </a>
91 </td>
92 <td align="right">
93 <select style="height: 30px; border-radius: 3px !important;" data-size="5" class="selectpicker" name="del_404_option" id="del_404_option">
94 <option value="1"><?php echo __('Keep this month', 'seo-redirection'); ?></option>
95 <option value="2"><?php echo __('Keep last 3 months', 'seo-redirection'); ?></option>
96 <option value="3"><?php echo __('Delete all', 'seo-redirection'); ?></option>
97 </select>
98 <a class="btn-custom btn-delete" style="padding:3px 10px !important" onclick="go_del()" href="#">
99 <span class="dashicons dashicons-trash"></span>
100 Delete
101 </a>
102 </td>
103 </tr>
104 </table>
105 </div>
106 <?php
107
108 $grid = new datagrid();
109 $grid->set_data_source($table_name);
110 $grid->set_table_attr('class', 'wp-list-table widefat fixed striped');
111 $grid->add_select_field('ID');
112 $grid->add_select_field('link');
113 $grid->add_select_field('ip');
114 $grid->add_select_field('referrer');
115
116 $grid->set_order(" ID desc ");
117
118 if ($util->get('search') != '') {
119 $search = $util->get('search');
120
121 $grid->set_filter(" link like '%%$search%%' or ctime like '%%$search%%'
122 or referrer like '%%$search%%' or country like '%%$search%%' or ip like '%%$search%%'
123 or os like '%%$search%%' or browser like '%%$search%%'
124 ");
125 }
126
127 $grid->set_table_attr('width', '100%');
128
129 $grid->set_col_attr(1, 'width', '60%');
130 $grid->set_col_attr(1, 'align', 'left');
131
132 $grid->set_col_attr(2, 'width', '30%');
133 $grid->set_col_attr(2, 'align', 'left');
134
135 $grid->set_col_attr(3, 'width', '30%');
136 $grid->set_col_attr(3, 'align', 'left');
137
138
139
140 $grid->add_php_col(" <a target='_blank' href='db_link_url'>db_link</a>", 'Link');
141 $grid->add_data_col('ctime', 'Discovered');
142
143 if ($util->get_option_value('ip_logging_status') == 0) {
144 $grid->add_html_col('--', __('IP', 'seo-redirection'));
145 } else if ($util->get_option_value('ip_logging_status') == 1) {
146 $grid->add_html_col('<a target="_blank" href="https://tools.keycdn.com/geo?host={db_ip}">{db_ip}</a>', __('IP', 'seo-redirection'));
147 } else {
148
149 $grid->add_php_col(' db_ip ', __('IP', 'seo-redirection'));
150 }
151
152
153
154
155 $grid->run();
156
157
158
159 ?>
160 <div><b style="color:red">Have many broken links?</b><br />
161 keep track of 404 errors using our powerful SEO Redirection Plugin to show and fix all broken links & 404 errors that occur on your site. <a target="_blank" href="https://www.wp-buy.com/product/seo-redirection-premium-wordpress-plugin/">click here to fix and improve your site SEO</a></div>
162 <br /><br />