forked from misterbisson/scriblio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass-facet-searchword.php
More file actions
93 lines (78 loc) · 1.96 KB
/
Copy pathclass-facet-searchword.php
File metadata and controls
93 lines (78 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
class Facet_Searchword implements Facet
{
var $query_var = 's';
var $exclude_from_widget = TRUE;
function __construct( $name , $args , $facets_object )
{
$this->name = $name;
$this->args = $args;
$this->facets = $facets_object;
$this->label = __( 'Search Keyword' );
$this->labels = (object) array(
'name' => 'Search Keyword',
'singular_name' => 'Search Keyword',
'search_items' => 'Search Keywords',
'popular_items' => 'Popular Keywords',
'all_items' => 'All Keywords',
'parent_item' => '',
'parent_item_colon' => '',
'edit_item' => 'Edit Keyword',
'view_item' => 'View Keyword',
'update_item' => 'Update Keyword',
'add_new_item' => 'Add New Keyword',
'new_item_name' => 'New Keyword Name',
'separate_items_with_commas' => 'Separate keyword with commas',
'add_or_remove_items' => 'Add or remove keyword',
'choose_from_most_used' => 'Choose from the most used keyword',
'menu_name' => 'Keywords',
'name_admin_bar' => 's',
);
}
function register_query_var()
{
return $this->query_var;
}
function parse_query( $query_terms , $wp_query )
{
$term = wp_kses( trim( urldecode( $query_terms ) ), array() );
$this->selected_terms[ $term ] = (object) array(
'facet' => $this->name,
'slug' => urlencode( $term ),
'name' => $term,
);
return $this->selected_terms;
}
function get_terms_in_corpus()
{
return array();
}
function get_terms_in_found_set()
{
return array();
}
function get_terms_in_post( $post_id = FALSE )
{
return array();
}
function selected( $term )
{
return( isset( $this->selected_terms[ $term->name ] ));
}
function queryterm_add( $term , $current )
{
$current[ $term->name ] = $term;
return $current;
}
function queryterm_remove( $term , $current )
{
unset( $current[ $term->name ] );
return $current;
}
function permalink( $terms )
{
if( is_array( $terms ))
$terms = implode( ' ' , array_keys( $terms ));
return get_search_link( $terms );
}
}