Code Duplication    Length = 96-108 lines in 2 locations

wp-includes/query.php 2 locations

@@ 3331-3426 (lines=96) @@
3328
		 * Apply post-paging filters on where and join. Only plugins that
3329
		 * manipulate paging queries should use these hooks.
3330
		 */
3331
		if ( !$q['suppress_filters'] ) {
3332
			/**
3333
			 * Filters the WHERE clause of the query.
3334
			 *
3335
			 * Specifically for manipulating paging queries.
3336
			 *
3337
			 * @since 1.5.0
3338
			 *
3339
			 * @param string   $where The WHERE clause of the query.
3340
			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3341
			 */
3342
			$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
3343
3344
			/**
3345
			 * Filters the GROUP BY clause of the query.
3346
			 *
3347
			 * @since 2.0.0
3348
			 *
3349
			 * @param string   $groupby The GROUP BY clause of the query.
3350
			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3351
			 */
3352
			$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );
3353
3354
			/**
3355
			 * Filters the JOIN clause of the query.
3356
			 *
3357
			 * Specifically for manipulating paging queries.
3358
			 *
3359
			 * @since 1.5.0
3360
			 *
3361
			 * @param string   $join  The JOIN clause of the query.
3362
			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3363
			 */
3364
			$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );
3365
3366
			/**
3367
			 * Filters the ORDER BY clause of the query.
3368
			 *
3369
			 * @since 1.5.1
3370
			 *
3371
			 * @param string   $orderby The ORDER BY clause of the query.
3372
			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3373
			 */
3374
			$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );
3375
3376
			/**
3377
			 * Filters the DISTINCT clause of the query.
3378
			 *
3379
			 * @since 2.1.0
3380
			 *
3381
			 * @param string   $distinct The DISTINCT clause of the query.
3382
			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3383
			 */
3384
			$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );
3385
3386
			/**
3387
			 * Filters the LIMIT clause of the query.
3388
			 *
3389
			 * @since 2.1.0
3390
			 *
3391
			 * @param string   $limits The LIMIT clause of the query.
3392
			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3393
			 */
3394
			$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
3395
3396
			/**
3397
			 * Filters the SELECT clause of the query.
3398
			 *
3399
			 * @since 2.1.0
3400
			 *
3401
			 * @param string   $fields The SELECT clause of the query.
3402
			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3403
			 */
3404
			$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
3405
3406
			/**
3407
			 * Filters all query clauses at once, for convenience.
3408
			 *
3409
			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
3410
			 * fields (SELECT), and LIMITS clauses.
3411
			 *
3412
			 * @since 3.1.0
3413
			 *
3414
			 * @param array    $clauses The list of clauses for the query.
3415
			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3416
			 */
3417
			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
3418
3419
			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3420
			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3421
			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3422
			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3423
			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3424
			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3425
			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3426
		}
3427
3428
		/**
3429
		 * Fires to announce the query's current selection parameters.
@@ 3443-3550 (lines=108) @@
3440
		 * Filters again for the benefit of caching plugins.
3441
		 * Regular plugins should use the hooks above.
3442
		 */
3443
		if ( !$q['suppress_filters'] ) {
3444
			/**
3445
			 * Filters the WHERE clause of the query.
3446
			 *
3447
			 * For use by caching plugins.
3448
			 *
3449
			 * @since 2.5.0
3450
			 *
3451
			 * @param string   $where The WHERE clause of the query.
3452
			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3453
			 */
3454
			$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );
3455
3456
			/**
3457
			 * Filters the GROUP BY clause of the query.
3458
			 *
3459
			 * For use by caching plugins.
3460
			 *
3461
			 * @since 2.5.0
3462
			 *
3463
			 * @param string   $groupby The GROUP BY clause of the query.
3464
			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3465
			 */
3466
			$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );
3467
3468
			/**
3469
			 * Filters the JOIN clause of the query.
3470
			 *
3471
			 * For use by caching plugins.
3472
			 *
3473
			 * @since 2.5.0
3474
			 *
3475
			 * @param string   $join  The JOIN clause of the query.
3476
			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3477
			 */
3478
			$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );
3479
3480
			/**
3481
			 * Filters the ORDER BY clause of the query.
3482
			 *
3483
			 * For use by caching plugins.
3484
			 *
3485
			 * @since 2.5.0
3486
			 *
3487
			 * @param string   $orderby The ORDER BY clause of the query.
3488
			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3489
			 */
3490
			$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );
3491
3492
			/**
3493
			 * Filters the DISTINCT clause of the query.
3494
			 *
3495
			 * For use by caching plugins.
3496
			 *
3497
			 * @since 2.5.0
3498
			 *
3499
			 * @param string   $distinct The DISTINCT clause of the query.
3500
			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3501
			 */
3502
			$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
3503
3504
			/**
3505
			 * Filters the SELECT clause of the query.
3506
			 *
3507
			 * For use by caching plugins.
3508
			 *
3509
			 * @since 2.5.0
3510
			 *
3511
			 * @param string   $fields The SELECT clause of the query.
3512
			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3513
			 */
3514
			$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );
3515
3516
			/**
3517
			 * Filters the LIMIT clause of the query.
3518
			 *
3519
			 * For use by caching plugins.
3520
			 *
3521
			 * @since 2.5.0
3522
			 *
3523
			 * @param string   $limits The LIMIT clause of the query.
3524
			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3525
			 */
3526
			$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
3527
3528
			/**
3529
			 * Filters all query clauses at once, for convenience.
3530
			 *
3531
			 * For use by caching plugins.
3532
			 *
3533
			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
3534
			 * fields (SELECT), and LIMITS clauses.
3535
			 *
3536
			 * @since 3.1.0
3537
			 *
3538
			 * @param array    $pieces The pieces of the query.
3539
			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3540
			 */
3541
			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
3542
3543
			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3544
			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3545
			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3546
			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3547
			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3548
			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3549
			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3550
		}
3551
3552
		if ( ! empty($groupby) )
3553
			$groupby = 'GROUP BY ' . $groupby;