PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / trunk
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts vtrunk
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
← All changes | admin/includes/class.filter.snippet.php +24 -24 2.4.4trunk View file →
@@ -1,11 +1,9 @@
1 1 <?php
2 2 /**
3 3 * Filter for snippet list
4 4 *
5 - * @author Webcraftic <wordpress.webraftic@gmail.com>
6 - * @copyright (c) 16.11.2018, Webcraftic
7 - * @version 1.0
5 + * @package Woody_Code_Snippets
8 6 */
9 7
10 8 // Exit if accessed directly
11 9 if ( ! defined( 'ABSPATH' ) ) {
@@ -25,20 +23,22 @@
25 23 /**
26 24 * Create the dropdown
27 25 */
28 26 function restrictManagePosts() {
29 - $type = WINP_Plugin::app()->request->get( 'post_type', 'post' );
27 + $type = WINP_HTTP::get( 'post_type', 'post' );
30 28
31 - $terms = get_terms( [
32 - 'taxonomy' => WINP_SNIPPETS_TAXONOMY,
33 - 'hide_empty' => true,
34 - ] );
29 + $terms = get_terms(
30 + [
31 + 'taxonomy' => WINP_SNIPPETS_TAXONOMY,
32 + 'hide_empty' => true,
33 + ]
34 + );
35 35
36 36 if ( WINP_SNIPPETS_POST_TYPE == $type && ! empty( $terms ) ) { ?>
37 - <select name="winp_filter_tag">
38 - <option value=""><?php _e( 'Filter by tag:', 'insert-php' ); ?></option>
37 + <select name="winp_filter_tag">
38 + <option value=""><?php _e( 'Filter by tag:', 'insert-php' ); ?></option>
39 39 <?php
40 - $current_filter = WINP_Plugin::app()->request->get( 'winp_filter_tag', '' );
40 + $current_filter = WINP_HTTP::get( 'winp_filter_tag', '' );
41 41 foreach ( $terms as $term ) {
42 42 if ( is_object( $term ) && isset( $term->slug ) ) {
43 43 printf( '<option value="%s"%s>%s</option>', $term->slug, $term->slug == $current_filter ? ' selected="selected"' : '', $term->name );
44 44 }
@@ -43,9 +43,9 @@
43 43 printf( '<option value="%s"%s>%s</option>', $term->slug, $term->slug == $current_filter ? ' selected="selected"' : '', $term->name );
44 44 }
45 45 }
46 46 ?>
47 - </select>
47 + </select>
48 48 <?php
49 49 }
50 50
51 51 $types = [
@@ -57,13 +57,14 @@
57 57 'Text',
58 58 'Advertisement',
59 59 ];
60 60
61 - if ( WINP_SNIPPETS_POST_TYPE == $type && ! empty( $types ) ) { ?>
62 - <select name="winp_filter_type">
63 - <option value=""><?php _e( 'Filter by type:', 'insert-php' ); ?></option>
61 + if ( WINP_SNIPPETS_POST_TYPE == $type && ! empty( $types ) ) {
62 + ?>
63 + <select name="winp_filter_type">
64 + <option value=""><?php _e( 'Filter by type:', 'insert-php' ); ?></option>
64 65 <?php
65 - $current_type = WINP_Plugin::app()->request->get( 'winp_filter_type', '' );
66 + $current_type = WINP_HTTP::get( 'winp_filter_type', '' );
66 67 foreach ( $types as $t ) {
67 68 if ( is_string( $t ) ) {
68 69 printf( '<option value="%s"%s>%s</option>', strtolower( $t ), strtolower( $t ) == $current_type ? ' selected="selected"' : '', $t );
69 70 }
@@ -68,9 +69,9 @@
68 69 printf( '<option value="%s"%s>%s</option>', strtolower( $t ), strtolower( $t ) == $current_type ? ' selected="selected"' : '', $t );
69 70 }
70 71 }
71 72 ?>
72 - </select>
73 + </select>
73 74 <?php
74 75 }
75 76 }
76 77
@@ -81,16 +82,16 @@
81 82 */
82 83 function parseQuery( $query ) {
83 84 global $pagenow;
84 85
85 - $type = WINP_Plugin::app()->request->get( 'post_type' );
86 + $type = WINP_HTTP::get( 'post_type' );
86 87
87 - if ( WINP_SNIPPETS_POST_TYPE == $type && is_admin() && 'edit.php' == $pagenow && WINP_Plugin::app()->request->get( 'winp_filter_tag', '' ) ) {
88 + if ( WINP_SNIPPETS_POST_TYPE == $type && is_admin() && 'edit.php' == $pagenow && WINP_HTTP::get( 'winp_filter_tag', '' ) ) {
88 89 $taxquery = [
89 90 [
90 91 'taxonomy' => WINP_SNIPPETS_TAXONOMY,
91 92 'field' => 'slug',
92 - 'terms' => [ WINP_Plugin::app()->request->get( 'winp_filter_tag', '' ) ],
93 + 'terms' => [ WINP_HTTP::get( 'winp_filter_tag', '' ) ],
93 94 'operator' => 'IN',
94 95 ],
95 96 ];
96 97 $query->set( 'tax_query', $taxquery );
@@ -95,17 +96,16 @@
95 96 ];
96 97 $query->set( 'tax_query', $taxquery );
97 98 }
98 99
99 - if ( WINP_SNIPPETS_POST_TYPE == $type && is_admin() && 'edit.php' == $pagenow && WINP_Plugin::app()->request->get( 'winp_filter_type', '' ) ) {
100 + if ( WINP_SNIPPETS_POST_TYPE == $type && is_admin() && 'edit.php' == $pagenow && WINP_HTTP::get( 'winp_filter_type', '' ) ) {
100 101 $meta_query = [
101 102 [
102 103 'key' => 'wbcr_inp_snippet_type',
103 - 'value' => WINP_Plugin::app()->request->get( 'winp_filter_type', '' ),
104 + 'value' => WINP_HTTP::get( 'winp_filter_type', '' ),
104 105 'compare' => '=',
105 - ]
106 + ],
106 107 ];
107 108 $query->set( 'meta_query', $meta_query );
108 109 }
109 110 }
110 -
111 111 }