private function orderBy($order) {
        if(is_array($order) && !empty(array_filter($order))) {
            $string = array();
            foreach($order as $fieldorder => $fieldvalue) {
                if(!empty($fieldorder) && !empty($fieldvalue)) {
                    $string[] = sprintf("`%s` %s", SafeString::makeSafe($fieldorder), strtoupper(SafeString::makeSafe($fieldvalue)));
                }
                elseif($fieldvalue === 'RAND()') {
                    $string[] = $fieldvalue;
                }
            }
            return sprintf(" ORDER BY %s", implode(", ", $string));
        }
        elseif($order == 'RAND()') {
            return " ORDER BY RAND()";
        }
        return false;
    }
private function orderBy($order) {
        if(is_array($order) && !empty(array_filter($order))) {
            $string = array();
            foreach($order as $fieldorder => $fieldvalue) {
                if(!empty($fieldorder) && !empty($fieldvalue)) {
                    $string[] = sprintf("`%s` %s", SafeString::makeSafe($fieldorder), strtoupper(SafeString::makeSafe($fieldvalue)));
                }
                elseif($fieldvalue === 'RAND()') {
                    $string[] = $fieldvalue;
                }
            }
            return sprintf(" ORDER BY %s", implode(", ", $string));
        }
        elseif($order == 'RAND()') {
            return " ORDER BY RAND()";
        }
        return false;
    }
private function orderBy ( $ order ) { if ( is_array ( $ order ) && ! empty ( array_filter ( $ order ) ) ) { $ string = array ( ) ; foreach ( $ order as $ fieldorder => $ fieldvalue ) { if ( ! empty ( $ fieldorder ) && ! empty ( $ fieldvalue ) ) { $ string [ ] = sprintf ( "`%s` %s" , SafeString :: makeSafe ( $ fieldorder ) , strtoupper ( SafeString :: makeSafe ( $ fieldvalue ) ) ) ; } elseif ( $ fieldvalue === 'RAND()' ) { $ string [ ] = $ fieldvalue ; } } return sprintf ( " ORDER BY %s" , implode ( ", " , $ string ) ) ; } elseif ( $ order == 'RAND()' ) { return " ORDER BY RAND()" ; } return false ; }
Sets the order sting for the SQL query based on an array or string
@param array|string $order This should be either set to array('fieldname' => 'ASC/DESC') or RAND()
@return string|false If the SQL query has an valid order by will return a string else returns false
Sets the order sting for the SQL query based on an array or string