-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoy-template.php
199 lines (173 loc) · 7.84 KB
/
oy-template.php
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
get_header();
echo "<div id='oy-unique' class='leftpane person-page'>";
echo '<div id="oy-hide-button" class="oy-rotate"><img src="' . plugins_url('img/arrow.png', __FILE__) . '"/></div>';
echo '<div id="oy-hide-tip">Arama kutusunu açmak için tıklayın.</div>';
echo '<div id="oy-arama-container">
<h1 class="oy-ayrinti-text"> Ayrıntılı Arama </h1>
<div class="oy-arama-form">
<form name="input" action="?name=ayrintili-ara" id="input" method="post" onsubmit="return validateSearch_real()">
<div class="oy-arama-major-field">
<h2>Kelimelerinin...</h2>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>hepsinin geçtiği:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-big" name="words_included" type="text"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>yan yana geçtiği:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-big" name="words_ordered" type="text"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>en az birinin geçtiği:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-big" name="words_at_least_one" type="text"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>geçmediği:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-big" name="words_excluded" type="text"/>
</div>
</div>
</div>
<div class="oy-divider"></div>
<div class="oy-arama-major-field">
<h2>Sonuçların...</h2>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>yazarı:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-mid" name="author_slug" type="username"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>yayınlanma tarih aralığı:</p></div>
<div class="oy-arama-box">
<input id="txtFromDate" class="custom_date oy-arama-input-small" name="date_begin" value="" type="text"/> - <input id="txtToDate" class="custom_date oy-arama-input-small" name="date_end" value="" type="text"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>minimum tutulma sayısı:</p></div>
<div class="oy-arama-box">
<input class="oy-arama-input-small-small" name="likes" pattern="\d*" type="number" value="0">
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>arama yeri:</p></div>
<div class="oy-arama-box">
<select class="oy-arama-select" id="oy-arama-tur-js-icin" name="search_type">
<option value="posts">Yazılar</option>
<option value="comments">Yorumlar</option>
</select>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>sırası:</p></div>
<div class="oy-arama-box">
<select class="oy-arama-select" name="date_order">
<option value="desc">Yeniden eskiye</option>
<option value="asc">Eskiden yeniye</option>
</select>
</div>
</div>
</div>
<div class="oy-divider"></div>
<div class="oy-arama-major-field" id="oy-etiket-just-for-yazi">
<h2>Etiketlerinin...</h2>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>en az birinin bulunduğu:</p></div>
<div class="oy-arama-box">
<input placeholder="(virgülle ayrılmış)" class="oy-arama-big" type="text" name="inc_tags"/>
</div>
</div>
<div class="oy-arama-input-field">
<div class="oy-arama-text"><p>hepsinin bulunduğu:</p></div>
<div class="oy-arama-box">
<input placeholder="(virgülle ayrılmış)" class="oy-arama-big" type="text" name="inc_tags_all"/>
</div>
</div>
</div>
<div class="oy-divider-borderless"></div>
<div class="oy-arama-major-field">
<div class="oy-arama-input-field">
<input value="Ara" type="submit">
</div>
</div>
<input type="hidden" name="oy_page" value="1"/>
</form>
</div>
</div>';
/*
Storing neccessary post data.
*/
$oy_author_slug = $_POST["author_slug"];
$oy_date_begin = $_POST["date_begin"];
$oy_date_end = $_POST["date_end"];
$oy_words_included = $_POST["words_included"];
$oy_words_ordered = $_POST["words_ordered"];
$oy_words_at_least_one = $_POST["words_at_least_one"];
$oy_words_excluded = $_POST["words_excluded"];
$oy_order = $_POST["date_order"];
$oy_likes = (int)$_POST["likes"];
$oy_type = $_POST["search_type"];
$oy_tags = $_POST["inc_tags"];
$oy_tags_all = $_POST["inc_tags_all"];
$oy_author_id = NULL;
$oy_page = (int)$_POST['oy_page'];
$oy_results_per_page = 20;
if ($oy_page <= 0) {
$oy_page = 1;
}
/*
If author is relevant to search get author id.
*/
if( $oy_author_slug != NULL ) {
$oy_author_id = oy_get_userid_by_display_name($oy_author_slug);
}
echo '<div class="oy-arama-sonuc-container">';
/*
Based on the search place,do the things.
- Generate query
- Evaluate query
- Print the results
- Be happy
*/
if ($oy_type == "comments") {
$query = oy_generate_comment_query($oy_author_slug, $oy_date_begin, $oy_date_end, $oy_words_included, $oy_words_ordered, $oy_words_at_least_one, $oy_words_excluded, $oy_order);
$result = $query->evaluate_query();
$oy_word_list = array();
if ($oy_words_included != NULL) {
$oy_word_list = array_merge($oy_word_list, explode(" ",$oy_words_included));
}
if ($oy_words_at_least_one != NULL) {
$oy_word_list = array_merge($oy_word_list, explode(" ",$oy_words_at_least_one));
}
if ($oy_words_ordered != NULL) {
array_push($oy_word_list, $oy_words_ordered);
}
echo $result["message"];
oy_print_comments($result["results"], $oy_word_list, $oy_page, $oy_results_per_page);
} elseif ($oy_type == "posts") {
$query = oy_generate_post_query($oy_author_id, $oy_date_begin, $oy_date_end, $oy_words_included, $oy_words_ordered, $oy_words_at_least_one, $oy_words_excluded, $oy_order, $oy_likes, $oy_author_slug,$oy_tags,$oy_tags_all);
$result = $query->evaluate_query();
$oy_word_list = array();
if ($oy_words_included != NULL) {
$oy_word_list = array_merge($oy_word_list, explode(" ", $oy_words_included));
}
if ($oy_words_at_least_one != NULL) {
$oy_word_list = array_merge($oy_word_list, explode(" ", $oy_words_at_least_one));
}
if ($oy_words_ordered != NULL) {
array_push($oy_word_list, $oy_words_ordered);
}
echo $result["message"];
oy_print_posts($result["results"],$oy_word_list, $oy_page, $oy_results_per_page);
}
echo "</div>";
echo "</div>";
get_sidebar();
get_footer();
?>