Platinum SEO Pack - Version 2.2.9

Version Description

2020-01-10 - Added a Bulk Edit Feature to SEO - Editors. Users can now edit SEO Titles and Descriptions in bulk. Made a few changes to the way Posts can be searched in Redirections module.

Download this release

Release Info

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

Code changes from version 2.2.8 to 2.2.9

Changelog.txt CHANGED
@@ -1,8 +1,11 @@
 
 
 
1
  = 2.2.8 =
2
  2020-12-28 - Made some alterations to 404 Manager and Redirections Manager to make it more user friendly. Included an option to retrieve all Posts in Redirections manager. one can also filter the Posts based on Post name or WordPress title. This would make it easier to create redirections in bulk for Posts (all post types). Restricted the filtering option to Posts while Redirected URLs may only be retrieved as a whole (All option). The same also applies to Redirection logs which are created for Redirected URLs if one chooses to log the redirect. The log entries can be deleted as a whole or selectively.
3
 
4
  = 2.2.7 =
5
- 2020-12-23 - in the export import utility, added a message to indicate the number of rows imported. This will help users to know whether all the rows in the file have been imported. Further, added translational options for the various headers and messages.
6
 
7
  = 2.2.6 =
8
  2020-12-20 - The plugin now has an Export/Import Utility to export Platinum SEO Options (Sitewide Settings) and platinum SEO Meta Data (of all Post types). You may find this utility in Platinum SEO and social Pack -> Tools.
1
+ = 2.2.9 =
2
+ 2020-01-10 - Added a Bulk Edit Feature to SEO - Editors. Users can now edit SEO Titles and Descriptions in bulk. Made a few changes to the way Posts can be searched in Redirections module.
3
+
4
  = 2.2.8 =
5
  2020-12-28 - Made some alterations to 404 Manager and Redirections Manager to make it more user friendly. Included an option to retrieve all Posts in Redirections manager. one can also filter the Posts based on Post name or WordPress title. This would make it easier to create redirections in bulk for Posts (all post types). Restricted the filtering option to Posts while Redirected URLs may only be retrieved as a whole (All option). The same also applies to Redirection logs which are created for Redirected URLs if one chooses to log the redirect. The log entries can be deleted as a whole or selectively.
6
 
7
  = 2.2.7 =
8
+ 2020-12-23 - In the export import utility, added a message to indicate the number of rows imported. This will help users to know whether all the rows in the file have been imported. Further, added translational options for the various headers and messages.
9
 
10
  = 2.2.6 =
11
  2020-12-20 - The plugin now has an Export/Import Utility to export Platinum SEO Options (Sitewide Settings) and platinum SEO Meta Data (of all Post types). You may find this utility in Platinum SEO and social Pack -> Tools.
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
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.9
8
  Author: Techblissonline.com (Rajesh)
9
  Author URI: https://techblissonline.com/
10
  Text Domain: platinum-seo-pack
psp-include/bulkeditors/psp_bulk_edit_renderer.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $psp_bulkedit_meta_nonce = wp_create_nonce( 'psp_bulkedit_meta_nonce' );
11
+ wp_enqueue_script( 'psp-ajax-bulkedit-script', plugins_url( 'settings/js/psp-bulkedit.js', PSP_PLUGIN_SETTINGS_URL ), array('jquery'), '2.2.9' );
12
+ wp_localize_script( 'psp-ajax-bulkedit-script', 'psp_ajax_bulkeditor_object', array( 'bedit_ajax_url' => admin_url( 'admin-ajax.php'), 'pspbeditnonce' => $psp_bulkedit_meta_nonce) );
13
+ // wp_enqueue_script( 'psp-bulkedit', plugins_url( '/js/psp-bulkedit.js', __FILE__ ), array( 'jquery' ) );
14
+ //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
15
+ wp_enqueue_style("psp-settings-bs-css", plugins_url( 'settings/css/psp-settings-bs.css', PSP_PLUGIN_SETTINGS_URL ));
16
+ wp_enqueue_style("psp-settings-css", plugins_url( 'settings/css/psp-settings.css', PSP_PLUGIN_SETTINGS_URL ));
17
+ //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.1');
18
+ ?>
19
+ <style>
20
+ .page-numbers {
21
+ display: inline-block;
22
+ padding: 5px 10px;
23
+ margin: 0 2px 0 0;
24
+ border: 1px solid #eee;
25
+ line-height: 1;
26
+ text-decoration: none;
27
+ border-radius: 2px;
28
+ font-weight: 600;
29
+ color:#111;
30
+
31
+ }
32
+ .page-numbers.current,
33
+ a.page-numbers:hover {
34
+ background: grey; /* color:#f9f9f9;*/
35
+ color:#fff;
36
+ }
37
+ a.check {
38
+ color:#fff;
39
+ }
40
+ a.check:hover {
41
+ color:#0073aa;
42
+ }
43
+ .pspthe {
44
+ width: 40%;
45
+ }
46
+ .editdiv {
47
+ display: none;
48
+ }
49
+ .editabletext{
50
+ width: 99%;
51
+ }
52
+ .editabletextarea{
53
+ width: 99%;
54
+ height: 50px;
55
+ }
56
+ </style>
57
+
58
+ <div class="wrap">
59
+
60
+ <h2><?php esc_html_e('Techblissonline Platinum SEO Bulk Editor:', 'platinum-seo-pack'); ?></h2>
61
+ <a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=platinum-seo-social-pack-by-techblissonline&psptab=psp_permalink" ?>"> <?php esc_html_e('Redirection Settings', 'platinum-seo-pack') ?></a> | <a href="https://techblissonline.com/redirection-in-wordpress/" target="_blank" rel="noopener"><?php esc_html_e('Manage Redirections in WordPress', 'platinum-seo-pack'); ?></a> | <a href="https://techblissonline.com/http-redirection-status-codes-301-302-307-308/" target="_blank" rel="noopener"><?php esc_html_e('HTTP Redirection Status Codes', 'platinum-seo-pack'); ?></a>
62
+ <form id="psp-search" action="" method="get">
63
+ <div class="form-table top">
64
+ <div class="alignleft actions">
65
+
66
+ <input type="hidden" name="page" id="page" value="bulkeditor">
67
+ <div id="pspmetatypes" class="alignleft">
68
+ <strong><?php echo "Edit " ?></strong><select id="psp_meta_type" name="psp_meta_type"><?php $dditems = array('' => 'SEO Title', 'description' => 'Meta Description');
69
+ foreach($dditems as $key => $val) {
70
+ $selected = (isset($_GET['psp_meta_type']) && $_GET['psp_meta_type']==$key) ? 'selected="selected"' : '';
71
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
72
+ } ?>
73
+ </select>
74
+ </div>
75
+ <div id="pspposttypes" class="alignleft">
76
+ <strong><?php echo "of " ?></strong><select id="psp_post_type" name="psp_post_type"><?php $dditems = array('' => 'Posts',);
77
+ foreach($dditems as $key => $val) {
78
+ $selected = (isset($_GET['psp_post_type']) && $_GET['psp_post_type']==$key) ? 'selected="selected"' : '';
79
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
80
+ } ?>
81
+ </select>
82
+ </div>
83
+ <div id="pspfilter" class="alignleft">
84
+ <select id="psp_filter" name="psp_filter"><?php
85
+ $dditems = array('' => 'All', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With', 'equals' => 'Equal to' );
86
+ //} else {
87
+ // $dditems = array('' => 'All', 'equals' => 'Equal to', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With');
88
+ //}
89
+ foreach($dditems as $key => $val) {
90
+ $selected = (isset($_GET['psp_filter']) && $_GET['psp_filter']==$key) ? 'selected="selected"' : '';
91
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
92
+ } ?></select></div>
93
+ <div id="pspsearchfield" class="alignleft hidden">
94
+ <input type="search" name="post-search-input" id="post-search-input" class="post-search-input" value="<?php echo (isset($_GET['post-search-input']) ? esc_attr(sanitize_text_field($_GET['post-search-input'])) : ''); ?>">
95
+ </div>
96
+
97
+ <div id="searchitdiv" class="alignleft"><input type="submit" name="searchit" id="searchit" class="button-secondary search" value="Search"></div>
98
+
99
+ </div>
100
+
101
+ </div>
102
+ </form>
103
+ <br class="clear" />
104
+ <form id="psp-edit" action="" method="post">
105
+ <div id="psp-edit-div" class="hidden">
106
+
107
+ </div>
108
+ <?php
109
+ if (empty($psp_meta_type)) {
110
+
111
+ wp_nonce_field( 'do_psp_posts_bulkedit_title', 'psp_posts_bulkedit_title_nonce' );
112
+
113
+ } else {
114
+ wp_nonce_field( 'do_psp_posts_bulkedit_desc', 'psp_posts_bulkedit_desc_nonce' );
115
+ }
116
+ ?>
117
+ <div class="tablenav">
118
+ <div class="alignleft">
119
+ <select id="psp_action" name="psp_action">
120
+ <?php
121
+ $dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Permanently');
122
+ //$dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Permanently', 'deleteall' => 'Delete All');
123
+ foreach($dditems as $key => $val) {
124
+ //$selected = (isset($_POST['psp_action']) && $_POST['psp_action']==$key) ? 'selected="selected"' : '';
125
+ $selected = '';
126
+ echo "<option id='$key' value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
127
+ } ?>
128
+ </select>
129
+ </div>
130
+ <div id="psp-delete-div" class="hidden alignleft">
131
+ <input type="submit" value="<?php _e('Delete'); ?>" id="deleteit" name="deleteit" class="button-secondary delete" />
132
+ </div>
133
+
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
+ <?php //if($psp_redir_type == "psplogs") { ?>
154
+
155
+ <table class="widefat">
156
+ <thead>
157
+ <tr class="psp-header">
158
+ <th scope="col" class=""><input onclick="checkAll(document.getElementById('psp-edit'));" type="checkbox"></th>
159
+ <th scope="col" class="pspth">ID</th>
160
+ <th scope="col" class="pspth">WordPress Post Title</th>
161
+ <?php if (empty($psp_meta_type)) { ?>
162
+ <th scope="col" class="pspthe">Techblissonline Platinum SEO Title</th>
163
+ <?php } else { ?>
164
+ <th scope="col" class="pspthe">Techblissonline Platinum SEO Meta Description</th>
165
+ <?php } ?>
166
+ <th scope="col" class="pspth">Update</th>
167
+ </tr>
168
+ </thead>
169
+ <?php
170
+ if(count($bad_links) > 0) { ?>
171
+ <tbody>
172
+ <?php
173
+ $bgcolor = '';
174
+ //$class = 'alternate' == $class ? '' : 'alternate';
175
+ $class = 'alternate';
176
+ foreach($bad_links as $bad_link){
177
+
178
+ $psp_id = !empty( $bad_link->psp_id) ? $bad_link->psp_id : '';
179
+ $psp_post_name = !empty( $bad_link->psp_post_name) ? $bad_link->psp_post_name : '';
180
+ if (empty($psp_meta_type)) {
181
+ $psp_editable_text = !empty( $bad_link->psp_title) ? esc_attr($bad_link->psp_title) : '';
182
+ } else {
183
+ $psp_editable_text = !empty( $bad_link->psp_description) ? esc_textarea($bad_link->psp_description) : '';
184
+ }
185
+
186
+ $class = 'alternate' == $class ? '' : 'alternate';
187
+ ?>
188
+ <tr id="<?php echo $psp_id; ?>" class="<?php echo trim( esc_attr($class) . ' author-self status-publish'); ?>" valign="top">
189
+ <th scope="row" class=""><?php if ( current_user_can( 'edit_posts', $bad_link->psp_id ) ) { ?><input type="checkbox" name="update[]" value="<?php echo $psp_id; ?>" /><?php } ?></th>
190
+ <td><strong><?php if ( current_user_can( 'edit_posts', $bad_link->psp_id ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php echo $psp_id; ?>" target="_blank" title="<?php echo esc_attr(sprintf(__('Edit "%s"'), $psp_post_name)); ?>"><?php echo $psp_id; ?></a><?php } else { echo $psp_id; } ?></strong></td>
191
+ <td><?php echo !empty($psp_post_name) ? esc_attr($psp_post_name) : ' - '; ?></td>
192
+ <?php if (empty($psp_meta_type)) { ?>
193
+ <td><div class='editdiv' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' - '; ?></div><input type='text' class='editabletext' value='<?php echo $psp_editable_text; ?>' id='editabletext-<?php echo $psp_id; ?>' ></td>
194
+ <td><div class="psp-bs alignright"><input style="display:block;margin:auto" name="psp_title" id="psp_data_update_<?php echo $psp_id; ?>" class="psp_meta_updater_btn btn btn-success" type="btn" value="Update" /><p id ="loader-<?php echo $psp_id; ?>" class="psp_data_update-loader hidden"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-video-loader.gif'; ?>" class="img-responsive" alt="updating..."/></p></div><br /><span id="updatedmsg-<?php echo $psp_id; ?>" class="pspmsg"></span></td>
195
+ <?php } else { ?>
196
+ <td><div class='editdiv' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' - '; ?></div><textarea id=<?php echo 'editabletextarea-'.$psp_id ?> type='text' class='editabletextarea' id='editabletext_<?php echo $psp_id; ?>' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' '; ?></textarea></td>
197
+ <td><div class="psp-bs alignright"><input style="display:block;margin:auto" name="psp_description" id="psp_data_update_<?php echo $psp_id; ?>" class="psp_meta_updater_btn btn btn-success" type="btn" value="Update" /><p id ="loader-<?php echo $psp_id; ?>" class="psp_data_update-loader hidden"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-video-loader.gif'; ?>" class="img-responsive" alt="updating..."/></p></div><br /><span id="updatedmsg-<?php echo $psp_id; ?>" class="pspmsg"></span></td>
198
+ <?php } ?>
199
+ </tr>
200
+ <?php } ?>
201
+ </tbody>
202
+ <?php } ?>
203
+ </table>
204
+
205
+ <?php //} ?>
206
+ </form>
207
+
208
+ <div class="tablenav top">
209
+
210
+ <?php
211
+ if ( $page_links )
212
+ echo "<div class='tablenav-pages'>$page_links</div>";
213
+ ?>
214
+
215
+ </div>
216
+
217
+ <br class="clear" />
218
+
219
+ </div>
psp-include/bulkeditors/psp_bulk_editor.php ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 PspBulkEdit {
9
+
10
+ private static $obj_handle = null;
11
+
12
+ protected $psp_helper;
13
+
14
+ protected $psp_plugin_options_key = 'platinum-seo-social-pack-by-techblissonline';
15
+
16
+ public static function get_instance() {
17
+
18
+ if ( null == self::$obj_handle ) {
19
+ self::$obj_handle = new self;
20
+ }
21
+
22
+ return self::$obj_handle;
23
+
24
+ } // end get_instance;
25
+ //can be made private for singleton pattern
26
+ public function __construct() {
27
+
28
+ $psp_helper_instance = PspHelper::get_instance();
29
+ $this->psp_helper = $psp_helper_instance;
30
+
31
+ add_action('admin_menu', array(&$this, 'psp_bulkedit_admin_menu'));
32
+
33
+ add_action( 'wp_ajax_psp_update_meta_data', array($this, 'psp_update_meta_data' ), 1);
34
+
35
+ add_filter('set-screen-option', array(&$this, 'psp_set_screen_option'), 10, 3);
36
+
37
+ }
38
+
39
+ public function psp_bulkedit_admin_menu() {
40
+
41
+ $psp_bulkedit_page = add_management_page('Bulk Editor', 'Platinum SEO Bulk Editor', 'manage_options', 'bulkeditor', array($this, 'bulkedit_mgmtpage'));
42
+ $psp_bulkedit_page_2 = add_submenu_page($this->psp_plugin_options_key, esc_html__('Techblissonline Platinum SEO Bulk Editor', 'platinum-seo-pack'), '<span class="dashicons dashicons-admin-tools"></span> '.esc_html__('BulkEditor', 'platinum-seo-pack'), 'manage_options', 'bulkeditor', array($this, 'bulkedit_mgmtpage'));
43
+
44
+ //$psp_bulkedit_page = add_management_page('Bulk Editor', 'Platinum SEO Bulk Editor', 'manage_options', 'bulkeditor', array($this, 'bulkedit_mgmtpage'));
45
+ //$psp_bulkedit_page_2 = 'platinum-seo-and-social-pack_page_bulkeditor';
46
+ //error_log('redir '. $psp_redir_page);
47
+
48
+ //add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
49
+ //add_action("load-$psp_bulkedit_page_2", array($this, 'psp_screen_options'));
50
+
51
+ add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
52
+ add_action("load-$psp_bulkedit_page_2", array($this, 'psp_screen_options'));
53
+ //add_filter("manage_".$psp_bulkedit_page."_columns", array($this, 'psp_screen_column_options'));
54
+ //add_filter("manage_".$psp_bulkedit_page_2."_columns", array($this, 'psp_screen_column_options'));
55
+
56
+ }
57
+
58
+ public function psp_screen_options() {
59
+
60
+ //$psp_404_page = "tools_page_manager404";
61
+ //$psp_404_page_2 = 'platinum-seo-and-social-pack_page_manager404';
62
+ $psp_bulkedit_page = "tools_page_bulkeditor";
63
+ $psp_bulkedit_page_2 = "platinum-seo-and-social-pack_page_bulkeditor";
64
+
65
+ $screen = get_current_screen();
66
+
67
+ //error_log($screen->id);
68
+
69
+ // get out of here if we are not on our settings page
70
+ if(!is_object($screen) || ($screen->id != $psp_bulkedit_page_2 && $screen->id != $psp_bulkedit_page ))
71
+ {
72
+ return;
73
+ }
74
+ if ($screen->id == $psp_bulkedit_page_2 || $screen->id == $psp_bulkedit_page) {
75
+ $redir_args = array(
76
+ 'label' => __('Rows per page'),
77
+ 'default' => 10,
78
+ 'option' => 'psp_bulkedit_rows_per_page'
79
+ );
80
+ add_screen_option( 'per_page', $redir_args );
81
+ }
82
+ /***
83
+ if ($screen->id == $psp_404_page || $screen->id == $psp_404_page_2) {
84
+ $filter_args = array(
85
+ 'label' => __('Rows per page'),
86
+ 'default' => 10,
87
+ 'option' => 'psp_filter_rows_per_page'
88
+ );
89
+ add_screen_option( 'per_page', $filter_args );
90
+ }**/
91
+ }
92
+
93
+ public function psp_screen_column_options() {
94
+
95
+ $psp_bulkedit_page = "tools_page_bulkeditor";
96
+ $psp_bulkedit_page_2 = "platinum-seo-and-social-pack_page_bulkeditor";
97
+
98
+ $screen = get_current_screen();
99
+
100
+ //error_log($screen->id);
101
+
102
+ // get out of here if we are not on our settings page
103
+ if(!is_object($screen) || ( $screen->id != $psp_bulkedit_page_2 && $screen->id != $psp_bulkedit_page ))
104
+ {
105
+ return;
106
+ }
107
+ /***
108
+ $psp_redir_type = isset($_GET['psp_redir_type']) ? sanitize_key($_GET['psp_redir_type']) : '';
109
+
110
+ if ($psp_redir_type != "psplogs") {
111
+ return;
112
+ }
113
+ ***/
114
+ if ($screen->id == $psp_bulkedit_page_2 || $screen->id == $psp_bulkedit_page) {
115
+ $columns = array('ipaddress' => 'IP Address', 'useragent' => 'User Agent','referrer' => 'Referrer');
116
+ return $columns;
117
+
118
+ }
119
+ }
120
+
121
+ public function psp_set_screen_option($status, $option, $value) {
122
+
123
+ //error_log('option '.$option.' '.$status.' '.$value);
124
+
125
+ if ( 'psp_bulkedit_rows_per_page' == $option) {
126
+ //error_log("psp rows ".$value);
127
+ return sanitize_key($value);
128
+ }
129
+ }
130
+
131
+ public function psp_update_meta_data() {
132
+
133
+ check_ajax_referer( 'psp_bulkedit_meta_nonce', 'pspbedit_ajax_nonce');
134
+ $psp_post_id = isset($_POST['pspid']) ? sanitize_key( $_POST['pspid'] ) : '';
135
+ $whattoupdate = isset($_POST['title']) ? sanitize_key( $_POST['title'] ) : '';
136
+ //$update_status = false;
137
+ //error_log("psp_post_id ".$psp_post_id);
138
+ //error_log("whattoupdate ".$whattoupdate);
139
+ if($whattoupdate == "psp_title") {
140
+ $valuetoupdate = isset($_POST['pspvalue']) ? sanitize_text_field( $_POST['pspvalue'] ) : '';
141
+ //error_log("title ".$valuetoupdate);
142
+ if ( !empty($valuetoupdate) ) {
143
+ $update_status = update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_title', $valuetoupdate );
144
+ } else {
145
+ $update_status = delete_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_title');
146
+ }
147
+ } else if ( $whattoupdate == "psp_description" ) {
148
+ $valuetoupdate = isset($_POST['pspvalue']) ? sanitize_textarea_field( $_POST['pspvalue'] ) : '';
149
+ //error_log("description ".$valuetoupdate);
150
+ //update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description', $valuetoupdate );
151
+ if ( !empty($valuetoupdate) ) {
152
+ $update_status = update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description', $valuetoupdate );
153
+ } else {
154
+ $update_status = delete_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description');
155
+ }
156
+ }
157
+
158
+ if($update_status === false) {
159
+ $result['type'] = "error";
160
+ $result['message'] = "Not updated or Update Error!";
161
+ //error_log("failed");
162
+ } else {
163
+ $result['type'] = "success";
164
+ $result['message'] = "Updated!";
165
+ //error_log("success");
166
+ }
167
+
168
+ if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
169
+ $result = json_encode($result);
170
+ //error_log(print_r($result, true));
171
+ echo $result;
172
+ } else {
173
+ //header("Location: ".$_SERVER["HTTP_REFERER"]);
174
+ }
175
+ //$result = json_encode($result);
176
+ // echo $result;
177
+ //echo ''. esc_html(' Updated!', 'platinum-seo-pack');
178
+ //echo ucwords($plugin)." Meta Titles and Descriptions successfully Imported";
179
+ wp_die();
180
+
181
+ }
182
+
183
+ public function bulkedit_mgmtpage() {
184
+
185
+ global $wpdb;
186
+
187
+ $tbl_posts = $wpdb->prefix . "posts";
188
+ //$tbl_postmeta = $wpdb->prefix . "postmeta";
189
+ $tbl_postmeta = $wpdb->prefix . "platinumseometa";
190
+ //$psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
191
+ $psp_meta_log = $wpdb->prefix . "psp_meta_log";
192
+
193
+ $posts_list = array();
194
+ $sql_posts = '';
195
+ $bad_links = array();
196
+ $sql_posts_1 = '';
197
+ $sql_posts_2 = '';
198
+ $psp_meta_type = isset($_GET['psp_meta_type']) ? sanitize_key($_GET['psp_meta_type']) : '';
199
+
200
+ // Handle bulk deletes
201
+ if ( isset($_POST['deleteit']) && isset($_POST['update']) ) {
202
+
203
+ foreach( (array) $_POST['update'] as $psp_id ) {
204
+
205
+ $psp_id = sanitize_key($psp_id);
206
+ if ( !current_user_can('edit_posts', $psp_id) )
207
+ wp_die( __('You are not allowed to Delete.') );
208
+
209
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
210
+
211
+ //Delete SQL here
212
+
213
+ if ( empty($psp_meta_type) && isset( $_POST['psp_posts_bulkedit_title_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_posts_bulkedit_title_nonce']), 'do_psp_posts_bulkedit_title' )) {
214
+ delete_metadata( 'platinumseo', $psp_id, '_techblissonline_psp_title');
215
+ } else if ( ($psp_meta_type == "description") && isset( $_POST['psp_posts_bulkedit_desc_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_posts_bulkedit_desc_nonce']), 'do_psp_posts_bulkedit_desc' )) {
216
+ delete_metadata( 'platinumseo', $psp_id, '_techblissonline_psp_description');
217
+ }
218
+
219
+
220
+ }
221
+ }
222
+
223
+ //Handle search
224
+ if ( !empty($_GET['psp_filter']) && !empty($_GET['post-search-input']) ) {
225
+
226
+ if (!empty($_GET['post-search-input'])) {
227
+
228
+ $psp_search = sanitize_text_field($_GET['post-search-input']);
229
+
230
+ if ($_GET['psp_filter'] == "contains") {
231
+
232
+ $psp_like = '%'.$wpdb->esc_like($psp_search).'%';
233
+ //$psp_like = '%'. $psp_search.'%';
234
+
235
+ }
236
+
237
+ if ($_GET['psp_filter'] == "starts-with") {
238
+
239
+ $psp_like = $wpdb->esc_like($psp_search).'%';
240
+ }
241
+
242
+ if ($_GET['psp_filter'] == "ends-with") {
243
+
244
+ $psp_like = '%'.$wpdb->esc_like($psp_search);
245
+
246
+ }
247
+
248
+ if ($_GET['psp_filter'] == "equals") {
249
+
250
+ $psp_like = "equals";
251
+ }
252
+
253
+ }
254
+
255
+ if (!empty($psp_like)) {
256
+
257
+ if (empty($psp_meta_type)) {
258
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title LIKE %s", $psp_like );
259
+
260
+ if ($psp_like == "equals") {
261
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title = %s", $psp_search );
262
+ }
263
+ } else if($psp_meta_type == "description") {
264
+
265
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title LIKE %s", $psp_like );
266
+
267
+ if ($psp_like == "equals") {
268
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title = %s", $psp_search );
269
+ }
270
+
271
+ }
272
+ //error_log($sql_posts_1);
273
+ $posts_list = $wpdb->get_results($sql_posts_1, OBJECT);
274
+
275
+ }
276
+
277
+
278
+ } else if ( empty($_GET['psp_filter']) ) {
279
+
280
+ if (empty($psp_meta_type)) {
281
+ $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish'";
282
+ } else {
283
+ $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish'";
284
+ }
285
+
286
+ $posts_list = $wpdb->get_results($sql_posts_2, OBJECT);
287
+ }
288
+
289
+ $total_no_posts = count($posts_list);
290
+
291
+ //error_log("total number of posts ".$total_no_posts);
292
+
293
+ $max_posts_per_page = 10;
294
+ $user = get_current_user_id();
295
+ $screen = get_current_screen();
296
+ // retrieve the "per_page" option
297
+ $screen_option = $screen->get_option('per_page', 'option');
298
+ // retrieve the value of the option stored for the current user
299
+ //error_log('screen option '.$screen_option);
300
+ $max_posts_per_page = get_user_meta($user, $screen_option, true);
301
+
302
+ if ( empty ( $max_posts_per_page) || $max_posts_per_page < 1 ) {
303
+ // get the default value if none is set
304
+ $max_posts_per_page = $screen->get_option( 'per_page', 'default' );
305
+ }
306
+
307
+ // now use $per_page to set the number of items displayed
308
+ //$max_posts_per_page = 10;
309
+ $link_count = ceil($total_no_posts/$max_posts_per_page);
310
+ $page_no = isset( $_GET['paged'] ) ? sanitize_key( $_GET['paged'] ) : 1;
311
+
312
+ $limit_sql = ' LIMIT '.(($page_no - 1) * $max_posts_per_page).', '.$max_posts_per_page;
313
+ //if($sql_posts != '') $sql_posts .= $limit_sql;
314
+ if($sql_posts_1 != '') $sql_posts = $sql_posts_1 . $limit_sql;
315
+ if($sql_posts_2 != '') $sql_posts = $sql_posts_2 . $limit_sql;
316
+
317
+ if($sql_posts != '') $bad_links = $wpdb->get_results( $sql_posts );
318
+ //if($sql_posts_2 != '') $bad_links_2 = $wpdb->get_results( $sql_posts_2 );
319
+
320
+ $page_links = paginate_links( array(
321
+ 'base' => add_query_arg( 'paged', '%#%' ),
322
+ 'format' => '',
323
+ 'total' => ceil($total_no_posts/$max_posts_per_page),
324
+ 'current' => $page_no
325
+ ));
326
+
327
+ include_once( 'psp_bulk_edit_renderer.php' );
328
+ }
329
+
330
+ }
331
+ ?>
psp-include/settings/js/psp-bulkedit.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function psp_update_seo_data(id, title, value, loader) {
2
+ //alert(title);
3
+ var psp_data = {
4
+ action: 'psp_update_meta_data',
5
+ pspbedit_ajax_nonce: psp_ajax_bulkeditor_object.pspbeditnonce,
6
+ title: title,
7
+ pspvalue: value,
8
+ pspid: id,
9
+ };
10
+
11
+ jQuery.ajax({
12
+ type : "post",
13
+ dataType : "json",
14
+ url : psp_ajax_bulkeditor_object.bedit_ajax_url,
15
+ data : psp_data,
16
+ success: function(response) {
17
+ //jQuery(loader).addClass('hidden');
18
+
19
+ if(response.type === "success") {
20
+ //write to html
21
+ jQuery("#updatedmsg-"+id).html(response.message);
22
+ setTimeout(
23
+ function()
24
+ {
25
+ //do something special
26
+ jQuery(".pspmsg").addClass('hidden');
27
+ }, 1000);
28
+ //alert(response.message);
29
+ } else if(response.type === "error") {
30
+ //write to html
31
+ jQuery("#updatedmsg-"+id).html(response.message);
32
+ setTimeout(
33
+ function()
34
+ {
35
+ //do something special
36
+ jQuery(".pspmsg").addClass('hidden');
37
+ }, 1000);
38
+ //alert(response.message);
39
+ }
40
+
41
+ jQuery(loader).addClass('hidden');
42
+ }
43
+ });
44
+ /***
45
+ jQuery.post(psp_ajax_bulkeditor_object.bedit_ajax_url, psp_data, function(response) {
46
+ jQuery(loader).addClass('hidden');
47
+ alert(response.type);
48
+ alert(JSON.stringify(response));
49
+ if(response.type === "success") {
50
+ //write to html
51
+ alert('Update Status: ' + response.message);
52
+ }
53
+ //alert('Update Status: ' + response);
54
+ });
55
+ ***/
56
+ /***
57
+ jQuery.post( psp_ajax_bulkeditor_object.bedit_ajax_url, psp_data ).error(
58
+ function() {
59
+ jQuery(loader).addClass('hidden');
60
+ //alert('error');
61
+ }).success( function(response) {
62
+ JSON.stringify(response);
63
+ jQuery(loader).addClass('hidden');
64
+ if(response.type == "success") {
65
+ //write to html
66
+ alert('Update Status: ' + response.message);
67
+ }
68
+ //alert('Update Status: ' + response);
69
+ //alert('success');
70
+ });
71
+
72
+ ***/
73
+ return false;
74
+
75
+ }
76
+
77
+ jQuery(document).ready(function($) {
78
+ jQuery('#psp_filter').on('change', function (){
79
+ if($('#psp_filter').val() === '' ) {
80
+ $( "#pspsearchfield" ).addClass('hidden');
81
+ } else {
82
+ $( "#pspsearchfield" ).removeClass('hidden');
83
+ }
84
+ });
85
+ if($('#psp_filter').val() === '' ) {
86
+ $( "#pspsearchfield" ).addClass('hidden');
87
+ } else {
88
+ $( "#pspsearchfield" ).removeClass('hidden');
89
+ }
90
+ jQuery('.psp_meta_updater_btn').keypress(function (e) {
91
+ var key = e.which;
92
+ if(key == 13) // the enter key code
93
+ {
94
+ $(this).click();
95
+ return false;
96
+ }
97
+ });
98
+ jQuery('#psp_action').on('change', function (){
99
+
100
+ if($(this).val() == 'delete' || $(this).val() == 'deleteall') {
101
+
102
+ $("#psp-delete-div").removeClass('hidden');
103
+
104
+ } else {
105
+
106
+ $("#psp-delete-div").addClass('hidden');
107
+
108
+ }
109
+
110
+
111
+ });
112
+
113
+ jQuery('.psp_meta_updater_btn').on('click', function (){
114
+ //jQuery(".psp-titles-loader").show();
115
+ jQuery(".pspmsg").html("");
116
+ jQuery(".pspmsg").removeClass('hidden');
117
+ $btn = $(".psp_data_update-loader");
118
+ $id = $(this).closest('tr').attr('id');
119
+
120
+ if (this.name == "psp_title") {
121
+ //alert ("title " + this.name);
122
+ $value = $("input#editabletext-"+$id).val();
123
+ } else {
124
+ //alert ("desc " + this.name);
125
+ $value = $("textarea#editabletextarea-"+$id).val();
126
+ }
127
+
128
+ $("#loader-"+$id).removeClass('hidden');
129
+ //$(".psp_data_update-loader").removeClass('hidden');
130
+ psp_update_seo_data($id, this.name, $value, $btn);
131
+ });
132
+ });
psp-include/settings/psp_bulk_edit_renderer.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $psp_bulkedit_meta_nonce = wp_create_nonce( 'psp_bulkedit_meta_nonce' );
11
+ wp_enqueue_script( 'psp-ajax-bulkedit-script', plugins_url( 'settings/js/psp-bulkedit.js', PSP_PLUGIN_SETTINGS_URL ), array('jquery'), '2.2.9' );
12
+ wp_localize_script( 'psp-ajax-bulkedit-script', 'psp_ajax_bulkeditor_object', array( 'bedit_ajax_url' => admin_url( 'admin-ajax.php'), 'pspbeditnonce' => $psp_bulkedit_meta_nonce) );
13
+ // wp_enqueue_script( 'psp-bulkedit', plugins_url( '/js/psp-bulkedit.js', __FILE__ ), array( 'jquery' ) );
14
+ //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
15
+ wp_enqueue_style("psp-settings-bs-css", plugins_url( 'settings/css/psp-settings-bs.css', PSP_PLUGIN_SETTINGS_URL ));
16
+ wp_enqueue_style("psp-settings-css", plugins_url( 'settings/css/psp-settings.css', PSP_PLUGIN_SETTINGS_URL ));
17
+ //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.1');
18
+ ?>
19
+ <style>
20
+ .page-numbers {
21
+ display: inline-block;
22
+ padding: 5px 10px;
23
+ margin: 0 2px 0 0;
24
+ border: 1px solid #eee;
25
+ line-height: 1;
26
+ text-decoration: none;
27
+ border-radius: 2px;
28
+ font-weight: 600;
29
+ color:#111;
30
+
31
+ }
32
+ .page-numbers.current,
33
+ a.page-numbers:hover {
34
+ background: grey; /* color:#f9f9f9;*/
35
+ color:#fff;
36
+ }
37
+ a.check {
38
+ color:#fff;
39
+ }
40
+ a.check:hover {
41
+ color:#0073aa;
42
+ }
43
+ .pspthe {
44
+ width: 40%;
45
+ }
46
+ .editdiv {
47
+ display: none;
48
+ }
49
+ .editabletext{
50
+ width: 99%;
51
+ }
52
+ .editabletextarea{
53
+ width: 99%;
54
+ height: 50px;
55
+ }
56
+ .psp-search {
57
+ width: 90%;
58
+ }
59
+ #pspsearchfield {
60
+ width: 45%;
61
+ }
62
+ #post-search-input{
63
+ width: 99%;
64
+ }
65
+ </style>
66
+
67
+ <div class="wrap">
68
+
69
+ <h2><?php esc_html_e('Techblissonline Platinum SEO Bulk Editor:', 'platinum-seo-pack'); ?></h2>
70
+
71
+ <form id="psp-search" action="" method="get">
72
+ <div class="form-table top">
73
+ <div class="psp-search alignleft actions">
74
+
75
+ <input type="hidden" name="page" id="page" value="psp-tools-by-techblissonline">
76
+ <div id="pspmetatypes" class="alignleft">
77
+ <strong><?php echo "Edit " ?></strong><select id="psp_meta_type" name="psp_meta_type"><?php $dditems = array('' => 'SEO Title', 'description' => 'Meta Description');
78
+ foreach($dditems as $key => $val) {
79
+ $selected = (isset($_GET['psp_meta_type']) && $_GET['psp_meta_type']==$key) ? 'selected="selected"' : '';
80
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
81
+ } ?>
82
+ </select>
83
+ </div>
84
+ <div id="pspposttypes" class="alignleft">
85
+ <strong><?php echo "of " ?></strong><select id="psp_post_type" name="psp_post_type"><?php $dditems = array('' => 'Posts',);
86
+ foreach($dditems as $key => $val) {
87
+ $selected = (isset($_GET['psp_post_type']) && $_GET['psp_post_type']==$key) ? 'selected="selected"' : '';
88
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
89
+ } ?>
90
+ </select>
91
+ </div>
92
+ <div id="pspfilter" class="alignleft">
93
+ <select id="psp_filter" name="psp_filter"><?php
94
+ $dditems = array('' => 'All', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With', 'equals' => 'Equal to' );
95
+ //} else {
96
+ // $dditems = array('' => 'All', 'equals' => 'Equal to', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With');
97
+ //}
98
+ foreach($dditems as $key => $val) {
99
+ $selected = (isset($_GET['psp_filter']) && $_GET['psp_filter']==$key) ? 'selected="selected"' : '';
100
+ echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
101
+ } ?></select></div>
102
+ <div id="pspsearchfield" class="alignleft hidden">
103
+ <input type="search" name="post-search-input" id="post-search-input" class="post-search-input" placeholder="Enter Word(s) in WordPress Post Title..." value="<?php echo (isset($_GET['post-search-input']) ? esc_attr(sanitize_text_field($_GET['post-search-input'])) : ''); ?>">
104
+ </div>
105
+
106
+ <div id="searchitdiv" class="alignleft"><input type="submit" name="searchit" id="searchit" class="button-secondary search" value="Search"></div>
107
+
108
+ </div>
109
+
110
+ </div>
111
+ </form>
112
+ <br class="clear" />
113
+ <form id="psp-edit" action="" method="post">
114
+ <div id="psp-edit-div" class="hidden">
115
+
116
+ </div>
117
+ <?php
118
+ if (empty($psp_meta_type)) {
119
+
120
+ wp_nonce_field( 'do_psp_posts_bulkedit_title', 'psp_posts_bulkedit_title_nonce' );
121
+
122
+ } else {
123
+ wp_nonce_field( 'do_psp_posts_bulkedit_desc', 'psp_posts_bulkedit_desc_nonce' );
124
+ }
125
+ ?>
126
+ <div class="tablenav">
127
+ <div class="alignleft">
128
+ <select id="psp_action" name="psp_action">
129
+ <?php
130
+ $dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Selected');
131
+ //$dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Permanently', 'deleteall' => 'Delete All');
132
+ foreach($dditems as $key => $val) {
133
+ //$selected = (isset($_POST['psp_action']) && $_POST['psp_action']==$key) ? 'selected="selected"' : '';
134
+ $selected = '';
135
+ echo "<option id='$key' value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
136
+ } ?>
137
+ </select>
138
+ </div>
139
+ <div id="psp-delete-div" class="hidden alignleft">
140
+ <input type="submit" value="<?php _e('Delete'); ?>" id="deleteit" name="deleteit" class="button-secondary delete" />
141
+ </div>
142
+
143
+ <script type="text/javascript">
144
+ <!--
145
+ function checkAll(form) {
146
+ for (i = 0, n = form.elements.length; i < n; i++) {
147
+ if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
148
+ if(form.elements[i].checked == true)
149
+ form.elements[i].checked = false;
150
+ else
151
+ form.elements[i].checked = true;
152
+ }
153
+ }
154
+ }
155
+ //-->
156
+ </script>
157
+ <?php
158
+ if ( $page_links )
159
+ echo "<div class='tablenav-pages alignright'>$page_links</div>";
160
+ ?>
161
+ </div>
162
+ <?php //if($psp_redir_type == "psplogs") { ?>
163
+
164
+ <table class="widefat">
165
+ <thead>
166
+ <tr class="psp-header">
167
+ <th scope="col" class=""><input onclick="checkAll(document.getElementById('psp-edit'));" type="checkbox"></th>
168
+ <th scope="col" class="pspth">ID</th>
169
+ <th scope="col" class="pspth">WordPress Post Title</th>
170
+ <?php if (empty($psp_meta_type)) { ?>
171
+ <th scope="col" class="pspthe">Techblissonline Platinum SEO Title</th>
172
+ <?php } else { ?>
173
+ <th scope="col" class="pspthe">Techblissonline Platinum SEO Meta Description</th>
174
+ <?php } ?>
175
+ <th scope="col" class="pspth">Update</th>
176
+ </tr>
177
+ </thead>
178
+ <?php
179
+ if(count($bad_links) > 0) { ?>
180
+ <tbody>
181
+ <?php
182
+ $bgcolor = '';
183
+ //$class = 'alternate' == $class ? '' : 'alternate';
184
+ $class = 'alternate';
185
+ foreach($bad_links as $bad_link){
186
+
187
+ $psp_id = !empty( $bad_link->psp_id) ? $bad_link->psp_id : '';
188
+ $psp_post_name = !empty( $bad_link->psp_post_name) ? $bad_link->psp_post_name : '';
189
+ if (empty($psp_meta_type)) {
190
+ $psp_editable_text = !empty( $bad_link->psp_title) ? esc_attr($bad_link->psp_title) : '';
191
+ } else {
192
+ $psp_editable_text = !empty( $bad_link->psp_description) ? esc_textarea($bad_link->psp_description) : '';
193
+ }
194
+
195
+ $class = 'alternate' == $class ? '' : 'alternate';
196
+ ?>
197
+ <tr id="<?php echo $psp_id; ?>" class="<?php echo trim( esc_attr($class) . ' author-self status-publish'); ?>" valign="top">
198
+ <th scope="row" class=""><?php if ( current_user_can( 'edit_posts', $bad_link->psp_id ) ) { ?><input type="checkbox" name="update[]" value="<?php echo $psp_id; ?>" /><?php } ?></th>
199
+ <td><strong><?php if ( current_user_can( 'edit_posts', $bad_link->psp_id ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php echo $psp_id; ?>" target="_blank" title="<?php echo esc_attr(sprintf(__('Edit "%s"'), $psp_post_name)); ?>"><?php echo $psp_id; ?></a><?php } else { echo $psp_id; } ?></strong></td>
200
+ <td><?php echo !empty($psp_post_name) ? esc_attr($psp_post_name) : ' - '; ?></td>
201
+ <?php if (empty($psp_meta_type)) { ?>
202
+ <td><div class='editdiv' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' - '; ?></div><input type='text' class='editabletext' value='<?php echo $psp_editable_text; ?>' id='editabletext-<?php echo $psp_id; ?>' ></td>
203
+ <td><div class="psp-bs alignright"><input style="display:block;margin:auto" name="psp_title" id="psp_data_update_<?php echo $psp_id; ?>" class="psp_meta_updater_btn btn btn-success" type="btn" value="Update" /><p id ="loader-<?php echo $psp_id; ?>" class="psp_data_update-loader hidden"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-video-loader.gif'; ?>" class="img-responsive" alt="updating..."/></p></div><br /><span id="updatedmsg-<?php echo $psp_id; ?>" class="pspmsg"></span></td>
204
+ <?php } else { ?>
205
+ <td><div class='editdiv' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' - '; ?></div><textarea id=<?php echo 'editabletextarea-'.$psp_id ?> type='text' class='editabletextarea' id='editabletext_<?php echo $psp_id; ?>' ><?php echo !empty($psp_editable_text) ? ($psp_editable_text) : ' '; ?></textarea></td>
206
+ <td><div class="psp-bs alignright"><input style="display:block;margin:auto" name="psp_description" id="psp_data_update_<?php echo $psp_id; ?>" class="psp_meta_updater_btn btn btn-success" type="btn" value="Update" /><p id ="loader-<?php echo $psp_id; ?>" class="psp_data_update-loader hidden"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-video-loader.gif'; ?>" class="img-responsive" alt="updating..."/></p></div><br /><span id="updatedmsg-<?php echo $psp_id; ?>" class="pspmsg"></span></td>
207
+ <?php } ?>
208
+ </tr>
209
+ <?php } ?>
210
+ </tbody>
211
+ <?php } ?>
212
+ </table>
213
+
214
+ <?php //} ?>
215
+ </form>
216
+
217
+ <div class="tablenav top">
218
+
219
+ <?php
220
+ if ( $page_links )
221
+ echo "<div class='tablenav-pages'>$page_links</div>";
222
+ ?>
223
+
224
+ </div>
225
+
226
+ <br class="clear" />
227
+
228
+ </div>
psp-include/settings/psp_redirect_404.php CHANGED
@@ -550,7 +550,12 @@ class PspRedirections {
550
 
551
  if (!empty($_GET['post-search-input'])) {
552
 
553
- $psp_search = sanitize_title($_GET['post-search-input']);
 
 
 
 
 
554
 
555
  if ($_GET['psp_filter'] == "contains") {
556
 
@@ -580,9 +585,9 @@ class PspRedirections {
580
  if (!empty($psp_like)) {
581
  //$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 );
582
  if (empty($psp_redir_type)) {
583
- $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_name AS psp_post_name FROM $tbl_posts a WHERE a.post_name LIKE %s", $psp_like );
584
  if ($psp_like == "equals") {
585
- $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_name AS psp_post_name FROM $tbl_posts a WHERE a.post_name = %s", $psp_search );
586
  }
587
  } else if($psp_redir_type == "pspurls") {
588
  //$sql_posts_2 = $wpdb-prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code FROM %s a WHERE a.source_url LIKE %s", array( $psp_redirections_tbl, $psp_like ));
@@ -628,7 +633,7 @@ class PspRedirections {
628
 
629
  if (empty($psp_redir_type)) {
630
 
631
- $sql_posts_1 = $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.ID = b.platinumseo_id AND a.ID = c.platinumseo_id AND (b.meta_key=%s) AND (c.meta_key=%s)", array('_techblissonline_psp_redirect_to_url', '_techblissonline_psp_redirect_status_code') );
632
  } else {
633
 
634
  if($psp_redir_type == "pspurls") {
@@ -653,7 +658,7 @@ class PspRedirections {
653
  } else if ( empty($_GET['psp_filter']) ) {
654
 
655
  if (empty($psp_redir_type)) {
656
- $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_name AS psp_post_name FROM $tbl_posts a";
657
  $posts_list = $wpdb->get_results($sql_posts_2, OBJECT);
658
  error_log("posts array ".print_r($posts_list, 'n'));
659
  } else {
550
 
551
  if (!empty($_GET['post-search-input'])) {
552
 
553
+ //$psp_search = sanitize_title($_GET['post-search-input']);
554
+ if (empty($psp_redir_type)) {
555
+ $psp_search = sanitize_text_field($_GET['post-search-input']);
556
+ } else {
557
+ $psp_search = sanitize_title($_GET['post-search-input']);
558
+ }
559
 
560
  if ($_GET['psp_filter'] == "contains") {
561
 
585
  if (!empty($psp_like)) {
586
  //$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 );
587
  if (empty($psp_redir_type)) {
588
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name FROM $tbl_posts a WHERE a.post_status='publish' AND a.post_title LIKE %s", $psp_like );
589
  if ($psp_like == "equals") {
590
+ $sql_posts_2 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name FROM $tbl_posts a WHERE a.post_status='publish' AND a.post_title = %s", $psp_search );
591
  }
592
  } else if($psp_redir_type == "pspurls") {
593
  //$sql_posts_2 = $wpdb-prepare("SELECT a.id AS psp_id, a.source_url AS psp_post_name, a.dest_url AS psp_redirect, a.redir_code AS psp_redirect_code FROM %s a WHERE a.source_url LIKE %s", array( $psp_redirections_tbl, $psp_like ));
633
 
634
  if (empty($psp_redir_type)) {
635
 
636
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title 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.ID = b.platinumseo_id AND a.ID = c.platinumseo_id AND (b.meta_key=%s) AND (c.meta_key=%s)", array('_techblissonline_psp_redirect_to_url', '_techblissonline_psp_redirect_status_code') );
637
  } else {
638
 
639
  if($psp_redir_type == "pspurls") {
658
  } else if ( empty($_GET['psp_filter']) ) {
659
 
660
  if (empty($psp_redir_type)) {
661
+ $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_title AS psp_post_name FROM $tbl_posts a WHERE a.post_status='publish'";
662
  $posts_list = $wpdb->get_results($sql_posts_2, OBJECT);
663
  error_log("posts array ".print_r($posts_list, 'n'));
664
  } else {
psp-include/settings/psp_redirect_list_renderer.php CHANGED
@@ -7,9 +7,9 @@ Author URI: http://techblissonline.com/
7
  */
8
  ?>
9
  <?php
10
- wp_enqueue_script( 'psp-redirect', plugins_url( '/js/psp-redirect.js', __FILE__ ), array( 'jquery' ) );
11
  //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
12
- wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.1');
13
  ?>
14
  <style>
15
  .page-numbers {
@@ -34,6 +34,15 @@ a.check {
34
  }
35
  a.check:hover {
36
  color:#0073aa;
 
 
 
 
 
 
 
 
 
37
  }
38
  </style>
39
 
@@ -43,7 +52,7 @@ a.check:hover {
43
  <a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=platinum-seo-social-pack-by-techblissonline&psptab=psp_permalink" ?>"> <?php esc_html_e('Redirection Settings', 'platinum-seo-pack') ?></a> | <a href="https://techblissonline.com/redirection-in-wordpress/" target="_blank" rel="noopener"><?php esc_html_e('Manage Redirections in WordPress', 'platinum-seo-pack'); ?></a> | <a href="https://techblissonline.com/http-redirection-status-codes-301-302-307-308/" target="_blank" rel="noopener"><?php esc_html_e('HTTP Redirection Status Codes', 'platinum-seo-pack'); ?></a>
44
  <form id="psp-search" action="" method="get">
45
  <div class="form-table top">
46
- <div class="alignleft actions">
47
 
48
  <input type="hidden" name="page" id="page" value="redirectionmanager">
49
  <div id="pspredirmethod" class="alignleft">
@@ -54,16 +63,16 @@ a.check:hover {
54
  } ?></select></div>
55
  <div id="pspfilter" class="alignleft">
56
  <select id="psp_filter" name="psp_filter"><?php if ($psp_redir_type == '') {
57
- $dditems = array('' => 'All', 'equals' => 'Equal to', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With', 'redirected' => 'Redirected', );
58
  } else {
59
- $dditems = array('' => 'All', 'equals' => 'Equal to', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With');
60
  }
61
  foreach($dditems as $key => $val) {
62
  $selected = (isset($_GET['psp_filter']) && $_GET['psp_filter']==$key) ? 'selected="selected"' : '';
63
  echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
64
  } ?></select></div>
65
  <div id="pspsearchfield" class="alignleft hidden">
66
- <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'])) : ''); ?>">
67
  </div>
68
 
69
  <div id="searchitdiv" class="alignleft"><input type="submit" name="searchit" id="searchit" class="button-secondary search" value="Search"></div>
@@ -129,17 +138,17 @@ a.check:hover {
129
  <?php
130
  if (empty($psp_redir_type)) {
131
  //$dditems = array('' => 'Bulk Actions', 'addnew' => 'Add New', 'edit' => 'Edit', 'delete' => 'Move to Trash');
132
- $dditems = array('' => 'Bulk Actions', 'edit' => 'Edit', 'delete' => 'Delete Permanently');
133
  //wp_nonce_field( 'do_psp_posts_redirect_actions', 'psp_posts_redirect_actions_nonce' );
134
 
135
  } else if ($psp_redir_type == "pspurls") {
136
 
137
- $dditems = array('' => 'Bulk Actions', 'addnew' => 'Add New', 'edit' => 'Edit', 'delete' => 'Delete Permanently');
138
  //wp_nonce_field( 'do_psp_urls_redirect_actions', 'psp_urls_redirect_actions_nonce' );
139
 
140
  } else {
141
 
142
- $dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Permanently', 'deleteall' => 'Delete All');
143
  //wp_nonce_field( 'do_psp_logs_redirect_actions', 'psp_logs_redirect_actions_nonce' );
144
  }
145
 
@@ -230,7 +239,7 @@ a.check:hover {
230
  <?php if ($psp_redir_type !== '') { ?>
231
  <th scope="col">Request Path/URL</th>
232
  <?php } else { ?>
233
- <th scope="col">Post Name</th>
234
  <?php } ?>
235
  <th scope="col">Redirect To</th>
236
  <th scope="col">Redirect Method</th>
7
  */
8
  ?>
9
  <?php
10
+ wp_enqueue_script( 'psp-redirect', plugins_url( '/js/psp-redirect.js', __FILE__ ), array( 'jquery' ), '2.2.9' );
11
  //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
12
+ wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.9');
13
  ?>
14
  <style>
15
  .page-numbers {
34
  }
35
  a.check:hover {
36
  color:#0073aa;
37
+ }
38
+ .psp-search {
39
+ width: 90%;
40
+ }
41
+ #pspsearchfield {
42
+ width: 50%;
43
+ }
44
+ #post-search-input{
45
+ width: 99%;
46
  }
47
  </style>
48
 
52
  <a href="<?php echo get_admin_url(get_current_blog_id())."admin.php?page=platinum-seo-social-pack-by-techblissonline&psptab=psp_permalink" ?>"> <?php esc_html_e('Redirection Settings', 'platinum-seo-pack') ?></a> | <a href="https://techblissonline.com/redirection-in-wordpress/" target="_blank" rel="noopener"><?php esc_html_e('Manage Redirections in WordPress', 'platinum-seo-pack'); ?></a> | <a href="https://techblissonline.com/http-redirection-status-codes-301-302-307-308/" target="_blank" rel="noopener"><?php esc_html_e('HTTP Redirection Status Codes', 'platinum-seo-pack'); ?></a>
53
  <form id="psp-search" action="" method="get">
54
  <div class="form-table top">
55
+ <div class="psp-search alignleft actions">
56
 
57
  <input type="hidden" name="page" id="page" value="redirectionmanager">
58
  <div id="pspredirmethod" class="alignleft">
63
  } ?></select></div>
64
  <div id="pspfilter" class="alignleft">
65
  <select id="psp_filter" name="psp_filter"><?php if ($psp_redir_type == '') {
66
+ $dditems = array('' => 'All', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With', 'equals' => 'Equal to', 'redirected' => 'Redirected', );
67
  } else {
68
+ $dditems = array('' => 'All', 'contains' => 'that Contain', 'starts-with' => 'that Start with', 'ends-with' => 'that End With', 'equals' => 'Equal to', );
69
  }
70
  foreach($dditems as $key => $val) {
71
  $selected = (isset($_GET['psp_filter']) && $_GET['psp_filter']==$key) ? 'selected="selected"' : '';
72
  echo "<option value='".esc_attr($key)."' ".esc_attr($selected).">".esc_html($val)."</option>";
73
  } ?></select></div>
74
  <div id="pspsearchfield" class="alignleft hidden">
75
+ <input type="search" name="post-search-input" id="post-search-input" placeholder="Enter Word(s) in Post Title..." value="<?php echo (isset($_GET['post-search-input']) ? esc_attr(sanitize_text_field($_GET['post-search-input'])) : ''); ?>">
76
  </div>
77
 
78
  <div id="searchitdiv" class="alignleft"><input type="submit" name="searchit" id="searchit" class="button-secondary search" value="Search"></div>
138
  <?php
139
  if (empty($psp_redir_type)) {
140
  //$dditems = array('' => 'Bulk Actions', 'addnew' => 'Add New', 'edit' => 'Edit', 'delete' => 'Move to Trash');
141
+ $dditems = array('' => 'Bulk Actions', 'edit' => 'Edit', 'delete' => 'Delete Selected');
142
  //wp_nonce_field( 'do_psp_posts_redirect_actions', 'psp_posts_redirect_actions_nonce' );
143
 
144
  } else if ($psp_redir_type == "pspurls") {
145
 
146
+ $dditems = array('' => 'Bulk Actions', 'addnew' => 'Add New', 'edit' => 'Edit', 'delete' => 'Delete Selected');
147
  //wp_nonce_field( 'do_psp_urls_redirect_actions', 'psp_urls_redirect_actions_nonce' );
148
 
149
  } else {
150
 
151
+ $dditems = array('' => 'Bulk Actions', 'delete' => 'Delete Selected', 'deleteall' => 'Delete All');
152
  //wp_nonce_field( 'do_psp_logs_redirect_actions', 'psp_logs_redirect_actions_nonce' );
153
  }
154
 
239
  <?php if ($psp_redir_type !== '') { ?>
240
  <th scope="col">Request Path/URL</th>
241
  <?php } else { ?>
242
+ <th scope="col">Post Title</th>
243
  <?php } ?>
244
  <th scope="col">Redirect To</th>
245
  <th scope="col">Redirect Method</th>
psp-include/settings/psp_tools_settings.php CHANGED
@@ -23,6 +23,7 @@ class PspToolSettings extends PspSettings {
23
  private $psp_robots_settings_group = 'psp_robotstxt';
24
  private $psp_htaccess_settings_group = 'psp_htaccess';
25
  private $psp_ga_settings_group = 'psp_analytics';
 
26
 
27
  protected $psp_plugin_options_key = 'psp-tools-by-techblissonline';
28
  private $psp_settings_tabs = array();
@@ -51,19 +52,44 @@ class PspToolSettings extends PspSettings {
51
 
52
  $this->sitename = $psp_helper_instance->get_sitename();
53
 
 
54
  $this->psp_settings_tabs[$this->psp_ga_settings_group] = 'GA Tracking Code Editor';
55
  $this->psp_settings_tabs[$this->psp_robots_settings_group] = 'Robots.txt Editor';
56
  $this->psp_settings_tabs[$this->psp_htaccess_settings_group] = '.htaccess Editor';
57
 
58
  add_action( 'admin_init', array( &$this, 'psp_tools_settings_init' ) );
59
- //add_action( 'admin_menu', array( &$this, 'add_admin_menus' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  function psp_tools_settings_init() {
63
 
64
- $tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_ga_settings_group;
 
 
 
 
 
65
 
66
- //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
67
 
68
  $this->robotstxt_file = get_home_path() . 'robots.txt';
69
  $this->htaccess_file = get_home_path() . '.htaccess';
@@ -182,7 +208,7 @@ class PspToolSettings extends PspSettings {
182
  'option_name' => $psp_robotstxt_settings_name.'[use_virtual_robots_file]',
183
  'option_value' => $use_virtual_robots_file,
184
  'checkbox_label' => esc_html__( 'Yes, use a virtual robots.txt file', 'platinum-seo-pack' ),
185
- 'option_description' => esc_html__( 'If you do not have a physical robots.txt file in the root folder, a virtual robots.txt file with content as shown below will be displayed at your site URL folder. Make sure that you add the path to your site\'s sitemap.xml, if one doesn\'t exist in the content of the virtual sitemap shown below. If you try to save this without checking this option, a physical robots.txt file will be created in your root folder, provided the folder is writable. Checking this will not create a physical robots.txt file but the virtual robots.txt file with content as shown below will be retained and displayed.', 'platinum-seo-pack' ),
186
  );
187
 
188
  //$virtual_robots_field_id = 'psp_'.$setting_name.'_use_virtual_robots_file';
@@ -492,7 +518,7 @@ class PspToolSettings extends PspSettings {
492
  * to render the tabs.
493
  */
494
  function psp_tools_options_page() {
495
- $tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_ga_settings_group;
496
  if ($tab == $this->psp_robots_settings_group) {
497
  $psp_button = "submitrobotstxt";
498
  $psp_nonce_field = "psp-robotstxt-nonce";
@@ -514,12 +540,86 @@ class PspToolSettings extends PspSettings {
514
  $psp_cm_ga_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'text/javascript', 'codemirror'=> array('autoRefresh' => true)));
515
  wp_localize_script('psp-meta-box', 'psp_cm_ga_settings', $psp_cm_ga_settings);
516
  wp_enqueue_script( 'psp-cmjs', plugins_url( '/js/cmjs.js', __FILE__ ),array( 'jquery' ), false, true);
517
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  ?>
519
  <div class="wrap">
520
  <h1 style='line-height:30px;'><?php esc_html_e('Techblissonline Platinum SEO Pack Tools', 'platinum-seo-pack') ?></h1>
521
  <p style="color: red"><?php esc_html_e('You need to click the "Save Settings" button to save the changes you made to each individual tab before moving on to the next tab.', 'platinum-seo-pack') ?></p>
522
- <?php $this->psp_tools_tabs(); ?>
 
 
 
523
  <form name="platinum-seo-form" method="post" action="options.php">
524
  <?php wp_nonce_field( $psp_nonce_field, $psp_nonce_name );?>
525
  <?php settings_fields( $tab ); ?>
@@ -530,17 +630,265 @@ class PspToolSettings extends PspSettings {
530
 
531
  <div class="sidebar-cta">
532
  <h2>
533
- <a class="bookmarkme" href="<?php echo 'https://techblissonline.com/tools/'; ?>" target="_blank"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-logo.png'; ?>" class="img-responsive" alt="Techblissonline Platinum SEO WordPress Tools"/></a>
534
- <a class="bookmarkme" href="<?php echo 'https://techblissonline.com/tools/platinum-seo-wordpress-premium/'; ?>" target="_blank"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/platinum-seo-no.jpg'; ?>" class="img-responsive" alt="Techblissonline Platinum SEO WordPress Tools"/></a>
535
  </h2>
536
  <div class="container bg-info" id="tools" style="width:100%">
537
- <div class="row"><div class="h3 col-sm-12 btn-primary psp-btn"><a class="col-sm-12" style="text-decoration:none;width:100%;color:white;" href="https://techblissonline.com/tools/platinum-seo-wordpress-premium/" target="_blank">Platinum SEO Premium for WordPress</a></div><div class="h3 col-sm-12 btn-success psp-btn"><a class="col-sm-12" style="text-decoration:none;width:100%;color:white;" href="https://techblissonline.com/tools/" target="_blank">Techblissonline Platinum SEO Audit and Analysis Tools</a></div></div>
538
- </div>
 
 
539
  </div>
 
540
  </div>
541
  <?php
542
  }
543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  /*
545
  * Renders our tabs in the plugin options page,
546
  * walks through the object's tabs array and prints
@@ -548,18 +896,24 @@ class PspToolSettings extends PspSettings {
548
  * psp_options_page method.
549
  */
550
  function psp_tools_tabs() {
551
- $current_tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_ga_settings_group;
552
  //$current_tab = $active_tab;
553
- //wp_enqueue_style("psp-settings-bs-css", plugins_url( '/css/psp-settings-bs.css', __FILE__ ));
554
- //wp_enqueue_style("psp-htmlsettings-css", plugins_url( '/css/psp-html-settings.css', __FILE__ ));
555
- //wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
556
- wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.1');
557
- wp_enqueue_style("psp-settings-bswide-css", plugins_url( '/css/psp-settings-bswide.css', __FILE__ ));
 
 
 
558
  //screen_icon();
559
  echo '<h2 class="nav-tab-wrapper">';
560
  foreach ( $this->psp_settings_tabs as $tab_key => $tab_caption ) {
561
  $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
562
  $psp_icon = '';
 
 
 
563
  if ($tab_key == $this->psp_ga_settings_group) {
564
  $psp_icon = '<span class="dashicons dashicons-analytics"></span> ';
565
  }
@@ -570,7 +924,11 @@ class PspToolSettings extends PspSettings {
570
  $psp_icon = '<span class="dashicons dashicons-admin-page"></span> ';
571
  }
572
  echo '<a style="text-decoration:none" class="nav-tab ' . esc_attr($active) . '" href="?page=' . esc_attr($this->psp_plugin_options_key) . '&psptools=' . esc_attr($tab_key) . '">' . $psp_icon. esc_attr($tab_caption) . '</a>';
 
573
  }
574
  echo '</h2>';
 
 
 
575
  }
576
  }
23
  private $psp_robots_settings_group = 'psp_robotstxt';
24
  private $psp_htaccess_settings_group = 'psp_htaccess';
25
  private $psp_ga_settings_group = 'psp_analytics';
26
+ private $psp_bulk_editor_group = 'psp_bulkeditor';
27
 
28
  protected $psp_plugin_options_key = 'psp-tools-by-techblissonline';
29
  private $psp_settings_tabs = array();
52
 
53
  $this->sitename = $psp_helper_instance->get_sitename();
54
 
55
+ $this->psp_settings_tabs[$this->psp_bulk_editor_group] = 'Bulk Editor';
56
  $this->psp_settings_tabs[$this->psp_ga_settings_group] = 'GA Tracking Code Editor';
57
  $this->psp_settings_tabs[$this->psp_robots_settings_group] = 'Robots.txt Editor';
58
  $this->psp_settings_tabs[$this->psp_htaccess_settings_group] = '.htaccess Editor';
59
 
60
  add_action( 'admin_init', array( &$this, 'psp_tools_settings_init' ) );
61
+ add_action( 'admin_menu', array( &$this, 'psp_tools_admin_menu' ) );
62
+
63
+ add_action( 'wp_ajax_psp_update_meta_data', array($this, 'psp_update_meta_data' ), 1);
64
+
65
+ //add_filter('set-screen-option', array(&$this, 'psp_set_screen_option'), 10, 3);
66
+ add_filter('set_screen_option_psp_bulkedit_rows_per_page', array(&$this, 'psp_set_screen_option'), 10, 3);
67
+
68
+ //$psp_bulkedit_page = "platinum-seo-and-social-pack_page_psp-tools-by-techblissonline";
69
+ //add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
70
+ }
71
+
72
+ function psp_tools_admin_menu() {
73
+
74
+ $tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_bulk_editor_group;
75
+
76
+ if ( $tab == $this->psp_bulk_editor_group ) {
77
+ $psp_bulkedit_page = "platinum-seo-and-social-pack_page_psp-tools-by-techblissonline";
78
+ add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
79
+ }
80
+
81
  }
82
 
83
  function psp_tools_settings_init() {
84
 
85
+ $tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_bulk_editor_group;
86
+
87
+ //if ( $tab == $this->psp_bulk_editor_group ) {
88
+ // $psp_bulkedit_page = "platinum-seo-and-social-pack_page_psp-tools-by-techblissonline";
89
+ // add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
90
+ //}
91
 
92
+ wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ));
93
 
94
  $this->robotstxt_file = get_home_path() . 'robots.txt';
95
  $this->htaccess_file = get_home_path() . '.htaccess';
208
  'option_name' => $psp_robotstxt_settings_name.'[use_virtual_robots_file]',
209
  'option_value' => $use_virtual_robots_file,
210
  'checkbox_label' => esc_html__( 'Yes, use a virtual robots.txt file', 'platinum-seo-pack' ),
211
+ 'option_description' => esc_html__( 'Checking this will not create a physical robots.txt file but your robots.txt content will be visible to all visitors including search engine bots when they try to access the robots.txt file in the root. Even if you keep this unchecked, a physical robots.txt file will be created by Techblissonline platinum seo when you hit the "Save Settings" button.However, This will happen only if the file is writeable to root. If the file is not writeable to root, the content that you see here will be presented as a virtual rotots.txt file & this is done by wordpress by default.', 'platinum-seo-pack' ),
212
  );
213
 
214
  //$virtual_robots_field_id = 'psp_'.$setting_name.'_use_virtual_robots_file';
518
  * to render the tabs.
519
  */
520
  function psp_tools_options_page() {
521
+ $tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_bulk_editor_group;
522
  if ($tab == $this->psp_robots_settings_group) {
523
  $psp_button = "submitrobotstxt";
524
  $psp_nonce_field = "psp-robotstxt-nonce";
540
  $psp_cm_ga_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'text/javascript', 'codemirror'=> array('autoRefresh' => true)));
541
  wp_localize_script('psp-meta-box', 'psp_cm_ga_settings', $psp_cm_ga_settings);
542
  wp_enqueue_script( 'psp-cmjs', plugins_url( '/js/cmjs.js', __FILE__ ),array( 'jquery' ), false, true);
543
+ } elseif ($tab == $this->psp_bulk_editor_group) {
544
+ $psp_nonce_field = "psp-bulkedit-nonce";
545
+ $psp_nonce_name = "psp-be";
546
+ //$psp_bulkedit_page = "platinum-seo-and-social-pack_page_psp-tools-by-techblissonline";
547
+ //add_action("load-$psp_bulkedit_page", array($this, 'psp_screen_options'));
548
+ //return;
549
+ }
550
+ /**
551
+ //if ( isset( $_POST['submitrobotstxt'] ) ) {
552
+ if((isset($_GET['settings-updated']) && true == sanitize_key($_GET['settings-updated'])) && ($tab == $this->psp_robots_settings_group )){
553
+ if ( ! current_user_can( 'manage_options' ) ) {
554
+ die( esc_html__( 'You cannot edit the robots.txt file.', 'platinum-seo-pack' ) );
555
+ }
556
+
557
+ //check_admin_referer( 'psp-robotstxt' );
558
+ $psp_settings = get_option("psp_robotstxt_settings");
559
+ $use_virtual_robots_file = isset($psp_settings['use_virtual_robots_file']) ? esc_attr($psp_settings['use_virtual_robots_file']) : '';
560
+ $robotscontent = isset($psp_settings['content']) ? stripcslashes( esc_textarea($psp_settings['content'] )) : '';
561
+
562
+ $robotstxt_file = $this->robotstxt_file; //;
563
+
564
+ if (!$use_virtual_robots_file) {
565
+
566
+ if (empty($robotscontent)) {
567
+ $robotscontent = $this->getDefaultRobots();
568
+ }
569
+
570
+ if ( file_exists( $robotstxt_file )) {
571
+
572
+ if ( is_writable( $robotstxt_file ) ) {
573
+ $robotstxt_filehandle = fopen( $robotstxt_file, 'w+' );
574
+ fwrite( $robotstxt_filehandle, $robotscontent );
575
+ fclose( $robotstxt_filehandle );
576
+ $msg = esc_html__( 'Updated Robots.txt', 'platinum-seo-pack' );
577
+ }
578
+ } else {
579
+ if ( is_writable( get_home_path() ) ) {
580
+ $robotstxt_filehandle = fopen( $robotstxt_file, 'x' );
581
+ fwrite( $robotstxt_filehandle, $robotscontent );
582
+ fclose( $robotstxt_filehandle );
583
+ $msg = esc_html__( 'Created Robots.txt', 'platinum-seo-pack' );
584
+ }
585
+ }
586
+ }
587
+ }
588
+ **/
589
+ //if ( isset( $_POST['submithtaccess'] ) ) {
590
+ /**
591
+ if((isset($_GET['settings-updated']) && true == sanitize_key($_GET['settings-updated'])) && ($tab == $this->psp_htaccess_settings_group )){
592
+ if ( ! current_user_can( 'manage_options' ) ) {
593
+ die( esc_html__( 'You cannot edit the .htaccess file.', 'platinum-seo-pack' ) );
594
+ }
595
+
596
+ $psp_htaccess_settings = get_option("psp_htaccess_settings");
597
+ $htaccesscontent = isset($psp_htaccess_settings['content']) ? stripcslashes( html_entity_decode($psp_htaccess_settings['content']) ) : '';
598
+
599
+ $htaccess_file = $this->htaccess_file; //;
600
+
601
+ if ( file_exists( $htaccess_file )) {
602
+
603
+ if ( is_writable( $htaccess_file ) ) {
604
+ $htaccess_filehandle = fopen( $htaccess_file, 'w+' );
605
+ fwrite( $htaccess_filehandle, $htaccesscontent );
606
+ fclose( $htaccess_filehandle );
607
+ $msg = esc_html__( 'Updated .htaccess file', 'platinum-seo-pack' );
608
+ }
609
+ } else {
610
+ //do nothing.
611
+ }
612
+
613
+ }
614
+ **/
615
  ?>
616
  <div class="wrap">
617
  <h1 style='line-height:30px;'><?php esc_html_e('Techblissonline Platinum SEO Pack Tools', 'platinum-seo-pack') ?></h1>
618
  <p style="color: red"><?php esc_html_e('You need to click the "Save Settings" button to save the changes you made to each individual tab before moving on to the next tab.', 'platinum-seo-pack') ?></p>
619
+ <?php $this->psp_tools_tabs();
620
+ if ($tab !== $this->psp_bulk_editor_group ) {
621
+ ?>
622
+
623
  <form name="platinum-seo-form" method="post" action="options.php">
624
  <?php wp_nonce_field( $psp_nonce_field, $psp_nonce_name );?>
625
  <?php settings_fields( $tab ); ?>
630
 
631
  <div class="sidebar-cta">
632
  <h2>
633
+ <a class="bookmarkme" href="<?php echo 'https://techblissonline.com/tools/'; ?>" target="_blank"><img src="<?php echo esc_url(PSP_PLUGIN_URL).'images/techblissonline-logo.png'; ?>" class="img-responsive" alt="Techblissonline Platinum SEO Wordpress Tools"/></a>
 
634
  </h2>
635
  <div class="container bg-info" id="tools" style="width:100%">
636
+ <div class="row"><div class="h3 col-sm-12"><a class="btn-primary col-sm-12" href="https://techblissonline.com/tools/platinum-seo-wordpress-premium/" target="_blank">Platinum SEO Premium for wordpress</a></div><div class="h3 col-sm-12"><a class="btn-success col-sm-12" href="https://techblissonline.com/tools/" target="_blank">Techblissonline Platinum SEO Audit and Analysis Tools</a></div></div>
637
+ </div>
638
+ <a href="https://techblissonline.com/tools/" target="_blank">Be our Patreon and enjoy these premium Wordpress SEO tools for just $9</a>
639
+ <div class="container" style="width:100%"><a href="https://techblissonline.com/tools/" target="_blank"><span class="col-sm-12 dashicons dashicons-thumbs-up dashicons-psp"></span></a></div>
640
  </div>
641
+ <?php } ?>
642
  </div>
643
  <?php
644
  }
645
 
646
+ public function psp_screen_options() {
647
+
648
+ $psp_bulkedit_page = "platinum-seo-and-social-pack_page_psp-tools-by-techblissonline";
649
+
650
+ $screen = get_current_screen();
651
+
652
+ //error_log($screen->id);
653
+
654
+ // get out of here if we are not on our settings page
655
+ if(!is_object($screen) || ( $screen->id != $psp_bulkedit_page ))
656
+ {
657
+ return;
658
+ }
659
+ if ($screen->id == $psp_bulkedit_page) {
660
+ $bulkedit_args = array(
661
+ 'label' => __('Rows per page'),
662
+ 'default' => 10,
663
+ 'option' => 'psp_bulkedit_rows_per_page'
664
+ );
665
+ add_screen_option( 'per_page', $bulkedit_args );
666
+ }
667
+ /***
668
+ if ($screen->id == $psp_404_page || $screen->id == $psp_404_page_2) {
669
+ $filter_args = array(
670
+ 'label' => __('Rows per page'),
671
+ 'default' => 10,
672
+ 'option' => 'psp_filter_rows_per_page'
673
+ );
674
+ add_screen_option( 'per_page', $filter_args );
675
+ }**/
676
+ }
677
+
678
+ public function psp_set_screen_option($status, $option, $value) {
679
+
680
+ //error_log('option '.$option.' '.$status.' '.$value);
681
+
682
+ if ( 'psp_bulkedit_rows_per_page' == $option) {
683
+ error_log("psp rows status ".$status);
684
+ error_log("psp rows option ".$option);
685
+ error_log("psp rows ".$value);
686
+ return $value;
687
+ //return sanitize_key($value);
688
+ }
689
+ }
690
+
691
+ public function psp_update_meta_data() {
692
+
693
+ check_ajax_referer( 'psp_bulkedit_meta_nonce', 'pspbedit_ajax_nonce');
694
+ $psp_post_id = isset($_POST['pspid']) ? sanitize_key( $_POST['pspid'] ) : '';
695
+ $whattoupdate = isset($_POST['title']) ? sanitize_key( $_POST['title'] ) : '';
696
+ //$update_status = false;
697
+ //error_log("psp_post_id ".$psp_post_id);
698
+ //error_log("whattoupdate ".$whattoupdate);
699
+ if($whattoupdate == "psp_title") {
700
+ $valuetoupdate = isset($_POST['pspvalue']) ? sanitize_text_field( $_POST['pspvalue'] ) : '';
701
+ //error_log("title ".$valuetoupdate);
702
+ if ( !empty($valuetoupdate) ) {
703
+ $update_status = update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_title', $valuetoupdate );
704
+ } else {
705
+ $update_status = delete_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_title');
706
+ }
707
+ } else if ( $whattoupdate == "psp_description" ) {
708
+ $valuetoupdate = isset($_POST['pspvalue']) ? sanitize_textarea_field( $_POST['pspvalue'] ) : '';
709
+ //error_log("description ".$valuetoupdate);
710
+ //update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description', $valuetoupdate );
711
+ if ( !empty($valuetoupdate) ) {
712
+ $update_status = update_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description', $valuetoupdate );
713
+ } else {
714
+ $update_status = delete_metadata( 'platinumseo', $psp_post_id, '_techblissonline_psp_description');
715
+ }
716
+ }
717
+
718
+ if($update_status === false) {
719
+ $result['type'] = "error";
720
+ $result['message'] = "Not updated or Update Error!";
721
+ //error_log("failed");
722
+ } else {
723
+ $result['type'] = "success";
724
+ $result['message'] = "Updated!";
725
+ //error_log("success");
726
+ }
727
+
728
+ if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
729
+ $result = json_encode($result);
730
+ //error_log(print_r($result, true));
731
+ echo $result;
732
+ } else {
733
+ //header("Location: ".$_SERVER["HTTP_REFERER"]);
734
+ }
735
+ //$result = json_encode($result);
736
+ // echo $result;
737
+ //echo ''. esc_html(' Updated!', 'platinum-seo-pack');
738
+ //echo ucwords($plugin)." Meta Titles and Descriptions successfully Imported";
739
+ wp_die();
740
+
741
+ }
742
+
743
+ public function bulkedit_mgmtpage() {
744
+
745
+ global $wpdb;
746
+
747
+ $tbl_posts = $wpdb->prefix . "posts";
748
+ //$tbl_postmeta = $wpdb->prefix . "postmeta";
749
+ $tbl_postmeta = $wpdb->prefix . "platinumseometa";
750
+ //$psp_redirections_tbl = $wpdb->prefix . "psp_redirections";
751
+ $psp_meta_log = $wpdb->prefix . "psp_meta_log";
752
+
753
+ $posts_list = array();
754
+ $sql_posts = '';
755
+ $bad_links = array();
756
+ $sql_posts_1 = '';
757
+ $sql_posts_2 = '';
758
+ $psp_meta_type = isset($_GET['psp_meta_type']) ? sanitize_key($_GET['psp_meta_type']) : '';
759
+
760
+ // Handle bulk deletes
761
+ if ( isset($_POST['deleteit']) && isset($_POST['update']) ) {
762
+
763
+ foreach( (array) $_POST['update'] as $psp_id ) {
764
+
765
+ $psp_id = sanitize_key($psp_id);
766
+ if ( !current_user_can('edit_posts', $psp_id) )
767
+ wp_die( __('You are not allowed to Delete.') );
768
+
769
+ $psp_action = isset($_POST['psp_action']) ? sanitize_key($_POST['psp_action']) : '';
770
+
771
+ //Delete SQL here
772
+
773
+ if ( empty($psp_meta_type) && isset( $_POST['psp_posts_bulkedit_title_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_posts_bulkedit_title_nonce']), 'do_psp_posts_bulkedit_title' )) {
774
+ delete_metadata( 'platinumseo', $psp_id, '_techblissonline_psp_title');
775
+ } else if ( ($psp_meta_type == "description") && isset( $_POST['psp_posts_bulkedit_desc_nonce'] ) && wp_verify_nonce( sanitize_key($_POST['psp_posts_bulkedit_desc_nonce']), 'do_psp_posts_bulkedit_desc' )) {
776
+ delete_metadata( 'platinumseo', $psp_id, '_techblissonline_psp_description');
777
+ }
778
+
779
+
780
+ }
781
+ }
782
+
783
+ //Handle search
784
+ if ( !empty($_GET['psp_filter']) && !empty($_GET['post-search-input']) ) {
785
+
786
+ if (!empty($_GET['post-search-input'])) {
787
+
788
+ $psp_search = sanitize_text_field($_GET['post-search-input']);
789
+
790
+ if ($_GET['psp_filter'] == "contains") {
791
+
792
+ $psp_like = '%'.$wpdb->esc_like($psp_search).'%';
793
+ //$psp_like = '%'. $psp_search.'%';
794
+
795
+ }
796
+
797
+ if ($_GET['psp_filter'] == "starts-with") {
798
+
799
+ $psp_like = $wpdb->esc_like($psp_search).'%';
800
+ }
801
+
802
+ if ($_GET['psp_filter'] == "ends-with") {
803
+
804
+ $psp_like = '%'.$wpdb->esc_like($psp_search);
805
+
806
+ }
807
+
808
+ if ($_GET['psp_filter'] == "equals") {
809
+
810
+ $psp_like = "equals";
811
+ }
812
+
813
+ }
814
+
815
+ if (!empty($psp_like)) {
816
+
817
+ if (empty($psp_meta_type)) {
818
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title LIKE %s", $psp_like );
819
+
820
+ if ($psp_like == "equals") {
821
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title = %s", $psp_search );
822
+ }
823
+ } else if($psp_meta_type == "description") {
824
+
825
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title LIKE %s", $psp_like );
826
+
827
+ if ($psp_like == "equals") {
828
+ $sql_posts_1 = $wpdb->prepare("SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish' AND a.post_title = %s", $psp_search );
829
+ }
830
+
831
+ }
832
+ //error_log($sql_posts_1);
833
+ $posts_list = $wpdb->get_results($sql_posts_1, OBJECT);
834
+
835
+ }
836
+
837
+
838
+ } else if ( empty($_GET['psp_filter']) ) {
839
+
840
+ if (empty($psp_meta_type)) {
841
+ $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_title FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_title') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish'";
842
+ } else {
843
+ $sql_posts_2 = "SELECT a.ID AS psp_id, a.post_title AS psp_post_name, b.meta_value as psp_description FROM $tbl_posts a LEFT JOIN (Select platinumseo_id, meta_key, meta_value from $tbl_postmeta WHERE meta_key = '_techblissonline_psp_description') b ON a.ID = b.platinumseo_id WHERE a.post_status = 'publish'";
844
+ }
845
+
846
+ $posts_list = $wpdb->get_results($sql_posts_2, OBJECT);
847
+ }
848
+
849
+ $total_no_posts = count($posts_list);
850
+
851
+ //error_log("total number of posts ".$total_no_posts);
852
+
853
+ $max_posts_per_page = 10;
854
+ $user = get_current_user_id();
855
+ $screen = get_current_screen();
856
+ //error_log("screen ".print_r($screen, "n"));
857
+ // retrieve the "per_page" option
858
+ $screen_option = $screen->get_option('per_page', 'option');
859
+ // retrieve the value of the option stored for the current user
860
+ //error_log('screen option '.$screen_option);
861
+ $max_posts_per_page = get_user_meta($user, $screen_option, true);
862
+
863
+ if ( empty ( $max_posts_per_page) || $max_posts_per_page < 1 ) {
864
+ // get the default value if none is set
865
+ $max_posts_per_page = $screen->get_option( 'per_page', 'default' );
866
+ }
867
+
868
+ // now use $per_page to set the number of items displayed
869
+ //$max_posts_per_page = 10;
870
+ //error_log("max posts pers page ".$max_posts_per_page);
871
+ $link_count = ceil($total_no_posts/$max_posts_per_page);
872
+ $page_no = isset( $_GET['paged'] ) ? sanitize_key( $_GET['paged'] ) : 1;
873
+
874
+ $limit_sql = ' LIMIT '.(($page_no - 1) * $max_posts_per_page).', '.$max_posts_per_page;
875
+ //if($sql_posts != '') $sql_posts .= $limit_sql;
876
+ if($sql_posts_1 != '') $sql_posts = $sql_posts_1 . $limit_sql;
877
+ if($sql_posts_2 != '') $sql_posts = $sql_posts_2 . $limit_sql;
878
+
879
+ if($sql_posts != '') $bad_links = $wpdb->get_results( $sql_posts );
880
+ //if($sql_posts_2 != '') $bad_links_2 = $wpdb->get_results( $sql_posts_2 );
881
+
882
+ $page_links = paginate_links( array(
883
+ 'base' => add_query_arg( 'paged', '%#%' ),
884
+ 'format' => '',
885
+ 'total' => ceil($total_no_posts/$max_posts_per_page),
886
+ 'current' => $page_no
887
+ ));
888
+
889
+ include_once( 'psp_bulk_edit_renderer.php' );
890
+ }
891
+
892
  /*
893
  * Renders our tabs in the plugin options page,
894
  * walks through the object's tabs array and prints
896
  * psp_options_page method.
897
  */
898
  function psp_tools_tabs() {
899
+ $current_tab = isset( $_GET['psptools'] ) ? sanitize_key($_GET['psptools']) : $this->psp_bulk_editor_group;
900
  //$current_tab = $active_tab;
901
+ if ($current_tab !== $this->psp_bulk_editor_group) {
902
+ //wp_enqueue_style("psp-settings-bs-css", plugins_url( '/css/psp-settings-bs.css', __FILE__ ));
903
+ //wp_enqueue_style("psp-htmlsettings-css", plugins_url( '/css/psp-html-settings.css', __FILE__ ));
904
+ wp_enqueue_style("psp-settings-css", plugins_url( '/css/psp-settings.css', __FILE__ ), array(), '2.2.1');
905
+ wp_enqueue_style("psp-settings-bswide-css", plugins_url( '/css/psp-settings-bswide.css', __FILE__ ));
906
+ } else {
907
+
908
+ }
909
  //screen_icon();
910
  echo '<h2 class="nav-tab-wrapper">';
911
  foreach ( $this->psp_settings_tabs as $tab_key => $tab_caption ) {
912
  $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
913
  $psp_icon = '';
914
+ if ($tab_key == $this->psp_bulk_editor_group) {
915
+ $psp_icon = '<span class="dashicons dashicons-editor"></span> ';
916
+ }
917
  if ($tab_key == $this->psp_ga_settings_group) {
918
  $psp_icon = '<span class="dashicons dashicons-analytics"></span> ';
919
  }
924
  $psp_icon = '<span class="dashicons dashicons-admin-page"></span> ';
925
  }
926
  echo '<a style="text-decoration:none" class="nav-tab ' . esc_attr($active) . '" href="?page=' . esc_attr($this->psp_plugin_options_key) . '&psptools=' . esc_attr($tab_key) . '">' . $psp_icon. esc_attr($tab_caption) . '</a>';
927
+
928
  }
929
  echo '</h2>';
930
+ if ($current_tab == $this->psp_bulk_editor_group) {
931
+ $this->bulkedit_mgmtpage();
932
+ }
933
  }
934
  }
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.8";
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.9";
23
 
24
  public $sitename = "";
25
  public $sitedescription = "";
psp_main.php CHANGED
@@ -287,14 +287,14 @@ class PspMain {
287
  $user_id = get_current_user_id();
288
  // Add the meta so that the notice is permanently dismissed.
289
  //delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
290
- update_user_meta( $user_id, 'psp_ignore_notice', "v_228" );
291
  };
292
  };
293
  }
294
 
295
  public function platinum_seo_admin_notice__success() {
296
  $user_id = get_current_user_id();
297
- if ( "v_228" === trim(get_user_meta( $user_id, 'psp_ignore_notice', true ) )) return;
298
  global $pagenow;
299
  $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
300
  if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
@@ -304,7 +304,7 @@ class PspMain {
304
  'psp_ignore_notice' => '1',
305
  'action' => 'psp_delete_adminnotice',
306
  'nonce' => wp_create_nonce('psp_delete_adminnotice'),
307
- ] ) ) .'" 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.8'.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>
308
  </div>
309
  <?php
310
  }
287
  $user_id = get_current_user_id();
288
  // Add the meta so that the notice is permanently dismissed.
289
  //delete_user_meta( $user_id, 'psp_ignore_notice_v_209' );
290
+ update_user_meta( $user_id, 'psp_ignore_notice', "v_229" );
291
  };
292
  };
293
  }
294
 
295
  public function platinum_seo_admin_notice__success() {
296
  $user_id = get_current_user_id();
297
+ if ( "v_229" === trim(get_user_meta( $user_id, 'psp_ignore_notice', true ) )) return;
298
  global $pagenow;
299
  $psp_pages = array('platinum-seo-social-pack-by-techblissonline', 'psp-social-by-techblissonline', 'psp-tools-by-techblissonline', 'pspp-licenses');
300
  if ('index.php' === $pagenow || ( $pagenow == 'admin.php' && in_array(sanitize_key($_GET['page']), $psp_pages))) {
304
  'psp_ignore_notice' => '1',
305
  'action' => 'psp_delete_adminnotice',
306
  'nonce' => wp_create_nonce('psp_delete_adminnotice'),
307
+ ] ) ) .'" 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.9'.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>
308
  </div>
309
  <?php
310
  }
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.6
8
  Requires PHP: 5.6
9
- Stable tag: 2.2.8
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -75,11 +75,14 @@ Please read these **[FAQs](https://techblissonline.com/platinum-seo-pack-faq/)**
75
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
76
 
77
  == Changelog ==
 
 
 
78
  = 2.2.8 =
79
  2020-12-28 - Made some alterations to 404 Manager and Redirections Manager to make it more user friendly. Included an option to retrieve all Posts in Redirections manager. one can also filter the Posts based on Post name or WordPress title. This would make it easier to create redirections in bulk for Posts (all post types). Restricted the filtering option to Posts while Redirected URLs may only be retrieved as a whole (All option). The same also applies to Redirection logs which are created for Redirected URLs if one chooses to log the redirect. The log entries can be deleted as a whole or selectively.
80
 
81
  = 2.2.7 =
82
- 2020-12-23 - in the export import utility, added a message to indicate the number of rows imported. This will help users to know whether all the rows in the file have been imported. Further, added translational options for the various headers and messages.
83
 
84
  = 2.2.6 =
85
  2020-12-20 - The plugin now has an Export/Import Utility to export Platinum SEO Options (Sitewide Settings) and platinum SEO Meta Data (of all Post types). You may find this utility in Platinum SEO and social Pack -> Tools.
6
  Requires at least: 4.0
7
  Tested up to: 5.6
8
  Requires PHP: 5.6
9
+ Stable tag: 2.2.9
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
75
  4. Social Settings for Facebook, Twitter, Pinterest and LinkedIn. Generates Open Grah Tags and Twitter compatible Tags.
76
 
77
  == Changelog ==
78
+ = 2.2.9 =
79
+ 2020-01-10 - Added a Bulk Edit Feature to SEO - Editors. Users can now edit SEO Titles and Descriptions in bulk. Made a few changes to the way Posts can be searched in Redirections module.
80
+
81
  = 2.2.8 =
82
  2020-12-28 - Made some alterations to 404 Manager and Redirections Manager to make it more user friendly. Included an option to retrieve all Posts in Redirections manager. one can also filter the Posts based on Post name or WordPress title. This would make it easier to create redirections in bulk for Posts (all post types). Restricted the filtering option to Posts while Redirected URLs may only be retrieved as a whole (All option). The same also applies to Redirection logs which are created for Redirected URLs if one chooses to log the redirect. The log entries can be deleted as a whole or selectively.
83
 
84
  = 2.2.7 =
85
+ 2020-12-23 - In the export import utility, added a message to indicate the number of rows imported. This will help users to know whether all the rows in the file have been imported. Further, added translational options for the various headers and messages.
86
 
87
  = 2.2.6 =
88
  2020-12-20 - The plugin now has an Export/Import Utility to export Platinum SEO Options (Sitewide Settings) and platinum SEO Meta Data (of all Post types). You may find this utility in Platinum SEO and social Pack -> Tools.