PluginProbe
Boxzilla – WordPress Popup Builder / 3.2
Boxzilla – WordPress Popup Builder v3.2
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/admin/class-autocomplete.php +18 -3 3.03.2 View file →
@@ -12,9 +12,9 @@
12 12 * AJAX listener for autocomplete
13 13 */
14 14 public function ajax() {
15 15 $q = ( isset( $_GET['q'] ) ) ? sanitize_text_field( $_GET['q'] ) : '';
16 - $type = ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'post', 'category', 'post_type' ) ) ) ? $_GET['type'] : 'post';
16 + $type = ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'post', 'category', 'post_type', 'post_tag' ) ) ) ? $_GET['type'] : 'post';
17 17
18 18 // do nothing if supplied 'q' parameter is omitted or empty
19 19 // or less than 2 characters long
20 20 if( empty( $q ) || strlen( $q ) < 2 ) {
@@ -35,8 +35,12 @@
35 35
36 36 case 'post_type':
37 37 echo $this->list_post_types( $q );
38 38 break;
39 +
40 + case 'post_tag':
41 + echo $this->list_tags( $q );
42 + break;
39 43 }
40 44
41 45 die();
42 46 }
@@ -59,11 +63,22 @@
59 63 *
60 64 * @return string
61 65 */
62 66 protected function list_categories( $query ) {
63 - $categories = get_terms( 'category', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
64 - return join( $categories, PHP_EOL );
67 + $terms = get_terms( 'category', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
68 + return join( $terms, PHP_EOL );
65 69 }
70 +
71 + /**
72 + * @param string $query
73 + *
74 + * @return string
75 + */
76 + protected function list_tags( $query ) {
77 + $terms = get_terms( 'post_tag', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
78 + return join( $terms, PHP_EOL );
79 + }
80 +
66 81
67 82 /**
68 83 * @param string $query
69 84 *