Code Duplication    Length = 34-44 lines in 2 locations

modules/events_archive_filters/EED_Events_Archive_Filters.module.php 1 location

@@ 436-479 (lines=44) @@
433
		$orderby_params = is_array( $orderby_params ) ? $orderby_params : array( $orderby_params );
434
		foreach( $orderby_params as $orderby ) {
435
			$glue = $cntr == 1 || $cntr == count( $orderby_params ) ? ' ' : ', ';
436
			switch ( $orderby ) {
437
438
				case 'id' :
439
				case 'ID' :
440
					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
441
					break;
442
443
				case 'start_date' :
444
					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort;
445
					break;
446
447
				case 'end_date' :
448
					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
449
					break;
450
451
				case 'event_name' :
452
					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
453
					break;
454
455
				case 'category_slug' :
456
					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
457
					break;
458
459
				case 'ticket_start' :
460
					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
461
					break;
462
463
				case 'ticket_end' :
464
					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
465
					break;
466
467
				case 'venue_title' :
468
					$SQL .= $glue . 'venue_title ' . $sort;
469
					break;
470
471
				case 'city' :
472
					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
473
				break;
474
475
				case 'state' :
476
					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
477
				break;
478
479
			}
480
			$cntr++;
481
		}
482
		//echo '<h4>$SQL : ' . $SQL . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';

core/helpers/EEH_Event_Query.helper.php 1 location

@@ 626-659 (lines=34) @@
623
			// this will ad a comma depending on whether this is the first or last param
624
			$glue = $counter === 0 || $counter === count( $orderby_params ) ? ' ' : ', ';
625
			// ok what's we dealing with?
626
			switch ( $orderby ) {
627
				case 'id' :
628
				case 'ID' :
629
					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
630
					break;
631
				case 'end_date' :
632
					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
633
					break;
634
				case 'event_name' :
635
					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
636
					break;
637
				case 'category_slug' :
638
					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
639
					break;
640
				case 'ticket_start' :
641
					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
642
					break;
643
				case 'ticket_end' :
644
					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
645
					break;
646
				case 'venue_title' :
647
					$SQL .= $glue . 'venue_title ' . $sort;
648
					break;
649
				case 'city' :
650
					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
651
					break;
652
				case 'state' :
653
					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
654
					break;
655
				case 'start_date' :
656
				default :
657
					$SQL .= $glue . ' event_start_date ' . $sort;
658
					break;
659
			}
660
			// add to array of orderby params that have been added
661
			self::$_query_params['orderby'][ $orderby ] = TRUE;
662
			$counter ++;