Search Exclude - Version 1.2.3

Version Description

  • Security release. All users are encouraged to update.
Download this release

Release Info

Developer pronskiy
Plugin Icon 128x128 Search Exclude
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

css/style.css CHANGED
File without changes
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: pronskiy, williamdodson, stevelock
3
  Tags: admin, plugin, search
4
  Requires at least: 3.3
5
- Tested up to: 4.9
6
- Stable tag: 1.2.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -78,6 +78,9 @@ function filterForProducts($exclude, $query)
78
 
79
  == Changelog ==
80
 
 
 
 
81
  = 1.2.2 =
82
  * Added action searchexclude_hide_from_search
83
  * Added filter searchexclude_filter_search
2
  Contributors: pronskiy, williamdodson, stevelock
3
  Tags: admin, plugin, search
4
  Requires at least: 3.3
5
+ Tested up to: 5.2
6
+ Stable tag: 1.2.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
78
 
79
  == Changelog ==
80
 
81
+ = 1.2.3 =
82
+ * Security release. All users are encouraged to update.
83
+
84
  = 1.2.2 =
85
  * Added action searchexclude_hide_from_search
86
  * Added filter searchexclude_filter_search
search-exclude.php CHANGED
@@ -140,13 +140,20 @@ class SearchExclude
140
 
141
  public function saveBulkEdit()
142
  {
143
- $postIds = !empty($_POST['post_ids']) ? $_POST[ 'post_ids' ] : false;
144
- $exclude = isset($_POST['sep_exclude']) && '' !== $_POST['sep_exclude'] ? $_POST[ 'sep_exclude' ] : null;
 
 
145
  if (is_array($postIds) && null !== $exclude) {
146
  $this->savePostIdsToSearchExclude($postIds, $exclude);
147
  }
148
  }
149
 
 
 
 
 
 
150
  public function enqueueEditScripts()
151
  {
152
  wp_enqueue_script(
@@ -268,7 +275,7 @@ class SearchExclude
268
  if (!isset($_POST['sep'])) return $postId;
269
 
270
  $sep = $_POST['sep'];
271
- $exclude = (isset($sep['exclude'])) ? $sep['exclude'] : 0 ;
272
 
273
  $this->savePostIdToSearchExclude($postId, $exclude);
274
 
@@ -296,11 +303,18 @@ class SearchExclude
296
 
297
  public function saveOptions()
298
  {
299
- if (isset($_POST['search_exclude_submit'])) {
 
 
 
 
300
 
301
- $excluded = $_POST['sep_exclude'];
302
- $this->saveExcluded($excluded);
303
  }
 
 
 
304
  }
305
  }
306
- $pluginSearchExclude = new SearchExclude();
140
 
141
  public function saveBulkEdit()
142
  {
143
+ $postIds = !empty($_POST['post_ids']) ? $this->filterPostIds($_POST[ 'post_ids' ]) : false;
144
+ $exclude = isset($_POST['sep_exclude']) && '' !== $_POST['sep_exclude']
145
+ ? filter_var($_POST['sep_exclude'], FILTER_VALIDATE_BOOLEAN)
146
+ : null;
147
  if (is_array($postIds) && null !== $exclude) {
148
  $this->savePostIdsToSearchExclude($postIds, $exclude);
149
  }
150
  }
151
 
152
+ private function filterPostIds($postIds)
153
+ {
154
+ return array_filter(filter_var($postIds, FILTER_VALIDATE_INT, FILTER_FORCE_ARRAY));
155
+ }
156
+
157
  public function enqueueEditScripts()
158
  {
159
  wp_enqueue_script(
275
  if (!isset($_POST['sep'])) return $postId;
276
 
277
  $sep = $_POST['sep'];
278
+ $exclude = (isset($sep['exclude'])) ? filter_var($sep['exclude'], FILTER_VALIDATE_BOOLEAN) : false;
279
 
280
  $this->savePostIdToSearchExclude($postId, $exclude);
281
 
303
 
304
  public function saveOptions()
305
  {
306
+ if (!isset($_POST['search_exclude_submit'])) {
307
+ return;
308
+ }
309
+
310
+ check_admin_referer( 'search_exclude_submit' );
311
 
312
+ if ( !current_user_can('edit_others_pages') ) {
313
+ wp_die( 'Not enough permissions', '', ['response' => 401, 'exit' => true] );
314
  }
315
+
316
+ $excluded = $this->filterPostIds($_POST['sep_exclude']);
317
+ $this->saveExcluded($excluded);
318
  }
319
  }
320
+ $pluginSearchExclude = new SearchExclude();
views/bulk_edit.php CHANGED
File without changes
views/column_cell.php CHANGED
File without changes
views/options.php CHANGED
@@ -23,7 +23,9 @@
23
  </tbody>
24
  </table>
25
 
 
 
26
  <p class="submit"><input type="submit" name="search_exclude_submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
27
  </form>
28
  <?php endif; ?>
29
- </div>
23
  </tbody>
24
  </table>
25
 
26
+ <?php wp_nonce_field( 'search_exclude_submit'); ?>
27
+
28
  <p class="submit"><input type="submit" name="search_exclude_submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
29
  </form>
30
  <?php endif; ?>
31
+ </div>
views/quick_edit.php CHANGED
File without changes