private function _escape($value, $htmlEntities = false)
    {
        if (get_magic_quotes_gpc()) {
            if ($htmlEntities) {
                return htmlspecialchars($value);
            }

            return $value;
        }

        if (is_array($value)) {
            return array_map(function ($n) use ($htmlEntities) {
                $val = stripslashes($n);

                if ($htmlEntities) {
                    return htmlspecialchars($val);
                }

                return $val;
            }, $value);
        }
        $val = stripslashes($value);

        if ($htmlEntities) {
            return htmlspecialchars($val);
        }

        return $val;
    }
private function _escape($value, $htmlEntities = false)
    {
        if (get_magic_quotes_gpc()) {
            if ($htmlEntities) {
                return htmlspecialchars($value);
            }

            return $value;
        }

        if (is_array($value)) {
            return array_map(function ($n) use ($htmlEntities) {
                $val = stripslashes($n);

                if ($htmlEntities) {
                    return htmlspecialchars($val);
                }

                return $val;
            }, $value);
        }
        $val = stripslashes($value);

        if ($htmlEntities) {
            return htmlspecialchars($val);
        }

        return $val;
    }
private function _escape ( $ value , $ htmlEntities = false ) { if ( get_magic_quotes_gpc ( ) ) { if ( $ htmlEntities ) { return htmlspecialchars ( $ value ) ; } return $ value ; } if ( is_array ( $ value ) ) { return array_map ( function ( $ n ) use ( $ htmlEntities ) { $ val = stripslashes ( $ n ) ; if ( $ htmlEntities ) { return htmlspecialchars ( $ val ) ; } return $ val ; } , $ value ) ; } $ val = stripslashes ( $ value ) ; if ( $ htmlEntities ) { return htmlspecialchars ( $ val ) ; } return $ val ; }
escape string value.

@param $value
@param $htmlEntities

@return string
escape string value .