Code Duplication    Length = 19-19 lines in 2 locations

engine/lib/river.php 2 locations

@@ 657-675 (lines=19) @@
654
 * @since 1.8.0
655
 * @access private
656
 */
657
function _elgg_river_get_action_where_sql($types) {
658
	if (!$types) {
659
		return '';
660
	}
661
662
	if (!is_array($types)) {
663
		$types = sanitise_string($types);
664
		return "(rv.action_type = '$types')";
665
	}
666
667
	// sanitize types array
668
	$types_sanitized = array();
669
	foreach ($types as $type) {
670
		$types_sanitized[] = sanitise_string($type);
671
	}
672
673
	$type_str = implode("','", $types_sanitized);
674
	return "(rv.action_type IN ('$type_str'))";
675
}
676
677
/**
678
 * Get the where clause based on river view strings
@@ 686-704 (lines=19) @@
683
 * @since 1.8.0
684
 * @access private
685
 */
686
function _elgg_river_get_view_where_sql($views) {
687
	if (!$views) {
688
		return '';
689
	}
690
691
	if (!is_array($views)) {
692
		$views = sanitise_string($views);
693
		return "(rv.view = '$views')";
694
	}
695
696
	// sanitize views array
697
	$views_sanitized = array();
698
	foreach ($views as $view) {
699
		$views_sanitized[] = sanitise_string($view);
700
	}
701
702
	$view_str = implode("','", $views_sanitized);
703
	return "(rv.view IN ('$view_str'))";
704
}
705
706
/**
707
 * Sets the access ID on river items for a particular object