Example #1
0
        }
        $mode = explode(',', $mode);
        foreach ($mode as $m) {
            static::$MODE |= constant('static::' . $m);
        }
    }
    /**
     * Escapes the symbol by adding surrounding backticks.
     *
     * @param array|string $str   The string to be escaped.
     * @param string       $quote Quote to be used when escaping.
     *
     * @return string
     */
    public static function escape($str, $quote = '`')
    {
        if (is_array($str)) {
            foreach ($str as $key => $value) {
                $str[$key] = static::escape($value);
            }
            return $str;
        }
        if (static::$MODE & Context::ANSI_QUOTES) {
            $quote = '"';
        }
        return $quote . str_replace($quote, $quote . $quote, $str) . $quote;
    }
}
// Initialing the default context.
Context::load();