Code Duplication    Length = 13-15 lines in 4 locations

ecrire/public/composer.php 1 location

@@ 740-753 (lines=14) @@
737
 * @param string $join
738
 * @return string
739
 */
740
function calculer_where_to_string($v, $join = 'AND'){
741
	if (empty($v))
742
		return '';
743
744
	if (!is_array($v)) {
745
		return $v;
746
	} else {
747
		$exp = "";
748
		if (strtoupper($join) === 'AND')
749
			return $exp . join(" $join ", array_map('calculer_where_to_string', $v));
750
		else
751
			return $exp . join($join, $v);
752
	}
753
}
754
755
756
//condition suffisante (mais non necessaire) pour qu'une table soit utile

ecrire/req/mysql.php 1 location

@@ 333-347 (lines=15) @@
330
 * @param string $join
331
 * @return string
332
 */
333
function calculer_mysql_expression($expression, $v, $join = 'AND'){
334
	if (empty($v))
335
		return '';
336
	
337
	$exp = "\n$expression ";
338
	
339
	if (!is_array($v)) {
340
		return $exp . $v;
341
	} else {
342
		if (strtoupper($join) === 'AND')
343
			return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v));
344
		else
345
			return $exp . join($join, $v);
346
	}
347
}
348
349
// http://doc.spip.org/@spip_mysql_select_as
350
/**

ecrire/req/pg.php 1 location

@@ 706-718 (lines=13) @@
703
704
705
// http://doc.spip.org/@calculer_pg_expression
706
function calculer_pg_expression($expression, $v, $join = 'AND'){
707
	if (empty($v))
708
		return '';
709
	
710
	$exp = "\n$expression ";
711
	
712
	if (!is_array($v)) $v = array($v);
713
	
714
	if (strtoupper($join) === 'AND')
715
			return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v));
716
		else
717
			return $exp . join($join, $v);
718
}
719
720
// http://doc.spip.org/@spip_pg_select_as
721
function spip_pg_select_as($args)

ecrire/req/sqlite_generique.php 1 location

@@ 1484-1498 (lines=15) @@
1481
 * @param string $join
1482
 * @return string
1483
 */
1484
function _sqlite_calculer_expression($expression, $v, $join = 'AND'){
1485
	if (empty($v))
1486
		return '';
1487
1488
	$exp = "\n$expression ";
1489
1490
	if (!is_array($v)){
1491
		return $exp.$v;
1492
	} else {
1493
		if (strtoupper($join)==='AND')
1494
			return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
1495
		else
1496
			return $exp.join($join, $v);
1497
	}
1498
}
1499
1500
1501
/**