lib/SQLBuilder.php
public static function reverseOrder($order)
	{
		if (!trim($order))
			return $order;

		$parts = explode(',',$order);

		for ($i=0,$n=count($parts); $i<$n; ++$i)
		{
			$v = strtolower($parts[$i]);

			if (strpos($v,' asc') !== false)
				$parts[$i] = preg_replace('/asc/i','DESC',$parts[$i]);
			elseif (strpos($v,' desc') !== false)
				$parts[$i] = preg_replace('/desc/i','ASC',$parts[$i]);
			else
				$parts[$i] .= ' DESC';
		}
		return join(',',$parts);
	}
public static function reverseOrder($order)
	{
		if (!trim($order))
			return $order;

		$parts = explode(',',$order);

		for ($i=0,$n=count($parts); $i<$n; ++$i)
		{
			$v = strtolower($parts[$i]);

			if (strpos($v,' asc') !== false)
				$parts[$i] = preg_replace('/asc/i','DESC',$parts[$i]);
			elseif (strpos($v,' desc') !== false)
				$parts[$i] = preg_replace('/desc/i','ASC',$parts[$i]);
			else
				$parts[$i] .= ' DESC';
		}
		return join(',',$parts);
	}
public static function reverseOrder ( $ order ) { if ( ! trim ( $ order ) ) return $ order ; $ parts = explode ( ',' , $ order ) ; for ( $ i = 0 , $ n = count ( $ parts ) ; $ i < $ n ; ++ $ i ) { $ v = strtolower ( $ parts [ $ i ] ) ; if ( strpos ( $ v , ' asc' ) !== false ) $ parts [ $ i ] = preg_replace ( '/asc/i' , 'DESC' , $ parts [ $ i ] ) ; elseif ( strpos ( $ v , ' desc' ) !== false ) $ parts [ $ i ] = preg_replace ( '/desc/i' , 'ASC' , $ parts [ $ i ] ) ; else $ parts [ $ i ] .= ' DESC' ; } return join ( ',' , $ parts ) ; }
Reverses an order clause.
Reverses an order clause .