Zebra_Database::_is_mysql_function PHP Method

_is_mysql_function() private method

@access private
private _is_mysql_function ( $value )
    private function _is_mysql_function($value)
    {
        $valid = false;
        // if value looks like one or more nested functions
        if (!is_array($value) && preg_match('/^[a-z]+\\(/i', $value) && preg_match_all('/([a-z]+\\()/i', $value, $matches)) {
            $valid = true;
            // iterate through what look like MySQL functions
            foreach ($matches[0] as $match) {
                // if entry is not a MySQL function
                if (!in_array(strtoupper(substr($match, 0, -1)), $this->mysql_functions)) {
                    // it means we made a mistake, don't look further
                    $valid = false;
                    break;
                }
            }
        }
        // return the result
        return $valid;
    }