| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Search Template Tags. | |
| 4 | + * bbPress Search Template Tags | |
| 5 | 5 | * |
| 6 | 6 | * @package bbPress |
| 7 | 7 | * @subpackage TemplateTags |
| 8 | 8 | */ |
| @@ -16,10 +16,10 @@ | ||
| 16 | 16 | * The main search loop. WordPress does the heavy lifting. |
| 17 | 17 | * |
| 18 | 18 | * @since 2.3.0 bbPress (r4579) |
| 19 | 19 | * |
| 20 | - * @param array $args All the arguments supported by {@link WP_Query}. | |
| 21 | - * @return object Multidimensional array of search information. | |
| 20 | + * @param array $args All the arguments supported by {@link WP_Query} | |
| 21 | + * @return object Multidimensional array of search information | |
| 22 | 22 | */ |
| 23 | 23 | function bbp_has_search_results( $args = array() ) { |
| 24 | 24 | |
| 25 | 25 | /** Defaults **************************************************************/ |
| @@ -113,13 +113,13 @@ | ||
| 113 | 113 | return apply_filters( 'bbp_has_search_results', $bbp->search_query->have_posts(), $bbp->search_query ); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | - * Whether there are more search results available in the loop. | |
| 117 | + * Whether there are more search results available in the loop | |
| 118 | 118 | * |
| 119 | 119 | * @since 2.3.0 bbPress (r4579) |
| 120 | 120 | * |
| 121 | - * @return object Search information. | |
| 121 | + * @return object Search information | |
| 122 | 122 | */ |
| 123 | 123 | function bbp_search_results() { |
| 124 | 124 | |
| 125 | 125 | // Put into variable to check against next |
| @@ -133,13 +133,13 @@ | ||
| 133 | 133 | return $have_posts; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | - * Loads up the current search result in the loop. | |
| 137 | + * Loads up the current search result in the loop | |
| 138 | 138 | * |
| 139 | 139 | * @since 2.3.0 bbPress (r4579) |
| 140 | 140 | * |
| 141 | - * @return object Search information. | |
| 141 | + * @return object Search information | |
| 142 | 142 | */ |
| 143 | 143 | function bbp_the_search_result() { |
| 144 | 144 | $search_result = bbpress()->search_query->the_post(); |
| 145 | 145 | |
| @@ -151,9 +151,9 @@ | ||
| 151 | 151 | return $search_result; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | - * Output the search page title. | |
| 155 | + * Output the search page title | |
| 156 | 156 | * |
| 157 | 157 | * @since 2.3.0 bbPress (r4579) |
| 158 | 158 | */ |
| 159 | 159 | function bbp_search_title() { |
| @@ -159,13 +159,13 @@ | ||
| 159 | 159 | function bbp_search_title() { |
| 160 | 160 | echo bbp_get_search_title(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -/** | |
| 164 | - * Get the search page title. | |
| 165 | - * | |
| 166 | - * @since 2.3.0 bbPress (r4579) | |
| 167 | - */ | |
| 163 | + /** | |
| 164 | + * Get the search page title | |
| 165 | + * | |
| 166 | + * @since 2.3.0 bbPress (r4579) | |
| 167 | + */ | |
| 168 | 168 | function bbp_get_search_title() { |
| 169 | 169 | |
| 170 | 170 | // Get search terms |
| 171 | 171 | $search_terms = bbp_get_search_terms(); |
| @@ -184,9 +184,9 @@ | ||
| 184 | 184 | return apply_filters( 'bbp_get_search_title', $title, $search_terms ); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | - * Output the search url. | |
| 188 | + * Output the search url | |
| 189 | 189 | * |
| 190 | 190 | * @since 2.3.0 bbPress (r4579) |
| 191 | 191 | */ |
| 192 | 192 | function bbp_search_url() { |
| @@ -191,16 +191,15 @@ | ||
| 191 | 191 | */ |
| 192 | 192 | function bbp_search_url() { |
| 193 | 193 | echo esc_url( bbp_get_search_url() ); |
| 194 | 194 | } |
| 195 | - | |
| 196 | -/** | |
| 197 | - * Return the search url. | |
| 198 | - * | |
| 199 | - * @since 2.3.0 bbPress (r4579) | |
| 200 | - * | |
| 201 | - * @return string Search url. | |
| 202 | - */ | |
| 195 | + /** | |
| 196 | + * Return the search url | |
| 197 | + * | |
| 198 | + * @since 2.3.0 bbPress (r4579) | |
| 199 | + * | |
| 200 | + * @return string Search url | |
| 201 | + */ | |
| 203 | 202 | function bbp_get_search_url() { |
| 204 | 203 | |
| 205 | 204 | // Pretty permalinks |
| 206 | 205 | if ( bbp_use_pretty_urls() ) { |
| @@ -224,9 +223,9 @@ | ||
| 224 | 223 | return apply_filters( 'bbp_get_search_url', $url ); |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | 226 | /** |
| 228 | - * Output the search results url. | |
| 227 | + * Output the search results url | |
| 229 | 228 | * |
| 230 | 229 | * @since 2.4.0 bbPress (r4928) |
| 231 | 230 | */ |
| 232 | 231 | function bbp_search_results_url() { |
| @@ -231,16 +230,15 @@ | ||
| 231 | 230 | */ |
| 232 | 231 | function bbp_search_results_url() { |
| 233 | 232 | echo esc_url( bbp_get_search_results_url() ); |
| 234 | 233 | } |
| 235 | - | |
| 236 | -/** | |
| 237 | - * Return the search url. | |
| 238 | - * | |
| 239 | - * @since 2.4.0 bbPress (r4928) | |
| 240 | - * | |
| 241 | - * @return string Search url. | |
| 242 | - */ | |
| 234 | + /** | |
| 235 | + * Return the search url | |
| 236 | + * | |
| 237 | + * @since 2.4.0 bbPress (r4928) | |
| 238 | + * | |
| 239 | + * @return string Search url | |
| 240 | + */ | |
| 243 | 241 | function bbp_get_search_results_url() { |
| 244 | 242 | |
| 245 | 243 | // Get the search terms |
| 246 | 244 | $search_terms = bbp_get_search_terms(); |
| @@ -274,29 +272,29 @@ | ||
| 274 | 272 | return apply_filters( 'bbp_get_search_results_url', $url ); |
| 275 | 273 | } |
| 276 | 274 | |
| 277 | 275 | /** |
| 278 | - * Output the search terms. | |
| 276 | + * Output the search terms | |
| 279 | 277 | * |
| 280 | 278 | * @since 2.3.0 bbPress (r4579) |
| 281 | 279 | * |
| 282 | - * @param string $search_terms Optional. Search terms. | |
| 280 | + * @param string $search_terms Optional. Search terms | |
| 283 | 281 | */ |
| 284 | 282 | function bbp_search_terms( $search_terms = '' ) { |
| 285 | 283 | echo esc_attr( bbp_get_search_terms( $search_terms ) ); |
| 286 | 284 | } |
| 287 | 285 | |
| 288 | -/** | |
| 289 | - * Get the search terms. | |
| 290 | - * | |
| 291 | - * @since 2.3.0 bbPress (r4579) | |
| 292 | - * | |
| 293 | - * If search terms are supplied, those are used. Otherwise check the | |
| 294 | - * search rewrite id query var. | |
| 295 | - * | |
| 296 | - * @param string $passed_terms Optional. Search terms. | |
| 297 | - * @return bool|string Search terms on success, false on failure. | |
| 298 | - */ | |
| 286 | + /** | |
| 287 | + * Get the search terms | |
| 288 | + * | |
| 289 | + * @since 2.3.0 bbPress (r4579) | |
| 290 | + * | |
| 291 | + * If search terms are supplied, those are used. Otherwise check the | |
| 292 | + * search rewrite id query var. | |
| 293 | + * | |
| 294 | + * @param string $passed_terms Optional. Search terms | |
| 295 | + * @return bool|string Search terms on success, false on failure | |
| 296 | + */ | |
| 299 | 297 | function bbp_get_search_terms( $passed_terms = '' ) { |
| 300 | 298 | |
| 301 | 299 | // Sanitize terms if they were passed in |
| 302 | 300 | if ( ! empty( $passed_terms ) ) { |
| @@ -350,9 +348,9 @@ | ||
| 350 | 348 | |
| 351 | 349 | /** Pagination ****************************************************************/ |
| 352 | 350 | |
| 353 | 351 | /** |
| 354 | - * Return the base URL used inside of pagination links. | |
| 352 | + * Return the base URL used inside of pagination links | |
| 355 | 353 | * |
| 356 | 354 | * @since 2.6.0 bbPress (r6679) |
| 357 | 355 | * |
| 358 | 356 | * @return string |
| @@ -383,9 +381,9 @@ | ||
| 383 | 381 | return apply_filters( 'bbp_get_search_pagination_base', $base ); |
| 384 | 382 | } |
| 385 | 383 | |
| 386 | 384 | /** |
| 387 | - * Output the search result pagination count. | |
| 385 | + * Output the search result pagination count | |
| 388 | 386 | * |
| 389 | 387 | * @since 2.3.0 bbPress (r4579) |
| 390 | 388 | */ |
| 391 | 389 | function bbp_search_pagination_count() { |
| @@ -391,15 +389,15 @@ | ||
| 391 | 389 | function bbp_search_pagination_count() { |
| 392 | 390 | echo bbp_get_search_pagination_count(); |
| 393 | 391 | } |
| 394 | 392 | |
| 395 | -/** | |
| 396 | - * Return the search results pagination count. | |
| 397 | - * | |
| 398 | - * @since 2.3.0 bbPress (r4579) | |
| 399 | - * | |
| 400 | - * @return string Search pagination count. | |
| 401 | - */ | |
| 393 | + /** | |
| 394 | + * Return the search results pagination count | |
| 395 | + * | |
| 396 | + * @since 2.3.0 bbPress (r4579) | |
| 397 | + * | |
| 398 | + * @return string Search pagination count | |
| 399 | + */ | |
| 402 | 400 | function bbp_get_search_pagination_count() { |
| 403 | 401 | $bbp = bbpress(); |
| 404 | 402 | |
| 405 | 403 | // Define local variable(s) |
| @@ -431,9 +429,9 @@ | ||
| 431 | 429 | } else { |
| 432 | 430 | $retstr = sprintf( |
| 433 | 431 | /* translators: 1: Number of results being viewed, 2: First result number, 3: Last result number, 4: Total results */ |
| 434 | 432 | _n( |
| 435 | - 'Viewing %1$s result - %2$s through %3$s (of %4$s total)', | |
| 433 | + 'Viewing %2$s results (of %4$s total)', | |
| 436 | 434 | 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', |
| 437 | 435 | $bbp->search_query->post_count, |
| 438 | 436 | 'bbpress' |
| 439 | 437 | ), |
| @@ -442,15 +440,16 @@ | ||
| 442 | 440 | $to_num, |
| 443 | 441 | $total_num |
| 444 | 442 | ); |
| 445 | 443 | |
| 446 | - // Filter & return | |
| 447 | - return apply_filters( 'bbp_get_search_pagination_count', esc_html( $retstr ) ); | |
| 448 | 444 | } |
| 445 | + | |
| 446 | + // Filter & return | |
| 447 | + return apply_filters( 'bbp_get_search_pagination_count', esc_html( $retstr ) ); | |
| 449 | 448 | } |
| 450 | 449 | |
| 451 | 450 | /** |
| 452 | - * Output search pagination links. | |
| 451 | + * Output search pagination links | |
| 453 | 452 | * |
| 454 | 453 | * @since 2.3.0 bbPress (r4579) |
| 455 | 454 | */ |
| 456 | 455 | function bbp_search_pagination_links() { |
| @@ -456,21 +455,21 @@ | ||
| 456 | 455 | function bbp_search_pagination_links() { |
| 457 | 456 | echo bbp_get_search_pagination_links(); |
| 458 | 457 | } |
| 459 | 458 | |
| 460 | -/** | |
| 461 | - * Return search pagination links. | |
| 462 | - * | |
| 463 | - * @since 2.3.0 bbPress (r4579) | |
| 464 | - * | |
| 465 | - * @return string Search pagination links. | |
| 466 | - */ | |
| 467 | -function bbp_get_search_pagination_links() { | |
| 459 | + /** | |
| 460 | + * Return search pagination links | |
| 461 | + * | |
| 462 | + * @since 2.3.0 bbPress (r4579) | |
| 463 | + * | |
| 464 | + * @return string Search pagination links | |
| 465 | + */ | |
| 466 | + function bbp_get_search_pagination_links() { | |
| 468 | 467 | $bbp = bbpress(); |
| 469 | 468 | |
| 470 | 469 | if ( ! isset( $bbp->search_query->pagination_links ) || empty( $bbp->search_query->pagination_links ) ) { |
| 471 | 470 | return false; |
| 472 | - } | |
| 471 | + } | |
| 473 | 472 | |
| 474 | 473 | // Filter & return |
| 475 | 474 | return apply_filters( 'bbp_get_search_pagination_links', $bbp->search_query->pagination_links ); |
| 476 | -} | |
| 475 | + } | |