Escapes a column (escapes quotechar with escapechar)

@param string $input    A single value to be escaped for output
@return string    Escaped input value
489451
protected function escape($input)
    {
        return str_replace(
            $this->quotechar,
            $this->escapechar . $this->quotechar,
            $input
        );
    }
484661
public function quoteField(string $input): string
    {
        $input = $this->unquoteField($input);

        // nope.. quote all
        // if (ctype_lower($input)) {
        //     return $input;
        // }

        if ($this->isMysql()) {
            return '`'. str_replace('`', '``', $input) .'`';
        } elseif ($this->isPgsql()) {
            return '"'. str_replace('"', '""', $input) .'"';
        }
    }
565627
public static function encode($input)
    {
        $parts = explode('.', $input);

        foreach ($parts as &$part) {
            $part = static::encodePart($part);
        }

        return implode('.', $parts);
    }
812149
private function stringToUtf($input)
    {
        if (is_array($input)) {
            $temp = array();
            foreach ($input as $key => $value) {
                $temp[$this->stringToUtf($key)] = $this->stringToUtf($value);
            }
            $input = $temp;
        } elseif (is_string($input)) {
            $input = iconv('iso-8859-15', 'utf-8', $input);
        }

        return $input;
    }
1106134
public static function escape($mixed, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
    {

        if (is_string($mixed)) {
            $mixed = htmlspecialchars($mixed, $quote_style, $charset);
        } elseif (is_object($mixed) || is_array($mixed)) {
            foreach ($mixed as $k => &$v) {
                if ($v) {
                    if (is_object($mixed)) {
                        $mixed->$k = self::escape($v, $quote_style, $charset);
                    } else {
                        $mixed[$k] = self::escape($v, $quote_style, $charset);
                    }
                }
            }
        }

        return $mixed;
    }
189492
private function escape($value)
    {
        if (1 !== preg_match($this->escapeCharacterPattern, $value)) {
            return htmlspecialchars($value, ENT_QUOTES);
        }

        return str_replace(
            $this->controlCharacters, $this->escapeCharacters, htmlspecialchars($value, ENT_QUOTES)
        );
    }
51435
static String escapeText(final String input)
    {
        return escapeBytes(ByteBuffer.wrap(input.getBytes(ISO_8859_1))).toString();
    }
487419
public function escape($string)
    {
        if(is_string($string)) {
            $string = htmlspecialchars($string, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8', false);
        }

        return $string;
    }
485233
private static String escapeJavaString(String input)
    {
        int len = input.length();
        // assume (for performance, not for correctness) that string will not expand by more than 10 chars
        StringBuilder out = new StringBuilder(len + 10);
        for (int i = 0; i < len; i++) {
            char c = input.charAt(i);
            if (c >= 32 && c <= 0x7f) {
                if (c == '"') {
                    out.append('\\');
                    out.append('"');
                } else if (c == '\\') {
                    out.append('\\');
                    out.append('\\');
                } else {
                    out.append(c);
                }
            } else {
                out.append('\\');
                out.append('u');
                // one liner hack to have the hex string of length exactly 4
                out.append(Integer.toHexString(c | 0x10000).substring(1));
            }
        }
        return out.toString();
    }
197572
public function escapeAndQuote($value)
    {
        if (null === $value) {
            $pdoType = \PDO::PARAM_NULL;
        } else {
            $pdoType = \PDO::PARAM_STR;
        }

        return $this->getPdo()->quote($value, $pdoType);
    }
554943
public function escapeString(string $input, bool $quote = true): string
    {
        $resourceType = $this->resource->getType();
        $resourceObject = $this->resource->getObject();
        if ($resourceType == Resource::TYPE_MYSQL_LINK) {
            $input = $resourceObject->escape_string($input);
        } elseif ($resourceType == Resource::TYPE_PGSQL_LINK) {
            $input = pg_escape_string($resourceObject, $input);
        }

        if ($quote) {
            $input = $this->quote($input);
        }

        return $input;
    }
1236365
public function escape($value)
	{
		// Make sure the database is connected
		$this->_connection or $this->connect();

		$result = $this->_connection->quote($value);
		// poor-mans workaround for the fact that not all drivers implement quote()
		if (empty($result))
		{
			$result = "'".str_replace("'", "''", $value)."'";
		}
		return $result;
	}
1174894
protected function escapeColumns(array $output)
    {
        return array_map(function ($row) {
            if ($this->escapeColumns == '*') {
                $row = $this->escapeRow($row);
            } elseif (is_array($this->escapeColumns)) {
                $columns = array_diff($this->escapeColumns, $this->rawColumns);
                foreach ($columns as $key) {
                    array_set($row, $key, e(array_get($row, $key)));
                }
            }

            return $row;
        }, $output);
    }
222992
private static String escape(String input) {
        StringBuilder resultStr = new StringBuilder();
        for (char ch : input.toCharArray()) {
            if (isUnsafe(ch)) {
                resultStr.append('%');
                resultStr.append(toHex(ch / 16));
                resultStr.append(toHex(ch % 16));
            } else {
                resultStr.append(ch);
            }
        }
        return resultStr.toString();
    }
589271
static function Escape($str, $escapeQuotes = false)
	{
		if ($escapeQuotes)
		{
			$str = str_replace(VerySimpleXmlUtil::$replacementsAttrib,VerySimpleXmlUtil::$replacementsTempAttrib,$str);
			$str = str_replace(VerySimpleXmlUtil::$reservedAttrib,VerySimpleXmlUtil::$replacementsAttrib,$str);
			$str = str_replace(VerySimpleXmlUtil::$replacementsTempAttrib,VerySimpleXmlUtil::$replacementsAttrib,$str);
		}
		else
		{
			$str = str_replace(VerySimpleXmlUtil::$replacementsText,VerySimpleXmlUtil::$replacementsTempText,$str);
			$str = str_replace(VerySimpleXmlUtil::$reservedText,VerySimpleXmlUtil::$replacementsText,$str);
			$str = str_replace(VerySimpleXmlUtil::$replacementsTempText,VerySimpleXmlUtil::$replacementsText,$str);
		}
		return $str;
	}
213773
protected function _createRow($input) {
		foreach ($input as $key => $value) {
			$temp = str_replace('"', '""', $value);
			$temp = preg_replace("=(\r\n|\r|\n)=", "\n", $temp);
			$input[$key] = $this->delimiter.$temp.$this->delimiter;
		}
		$output = implode($this->separator, $input).$this->linebreaks;
		return $output;
	}
1297383
public function escape(string $text): string
    {
        $replacements = [
            '&' => '&amp;',
            '<' => '&lt;',
            '>' => '&gt;',
        ];

        return str_replace(array_keys($replacements), array_values($replacements), $text);
    }