Skip to content

Commit 1a21e11

Browse files
author
Wazabii
committed
Improvements
1 parent fe9fa1e commit 1a21e11

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

Utility/Attr.php

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,19 @@ public function __toString(): string
5555
public function getValue(): string
5656
{
5757
if (!$this->hasBeenEncoded) {
58+
5859
$this->hasBeenEncoded = true;
59-
if ($this->encode) {
60-
// I will rather escape qoutes then encode them in prep is on
61-
$this->value = Encode::value($this->value)->encode(function ($val) {
62-
return $val;
63-
}, ($this->prep ? ENT_NOQUOTES : ENT_QUOTES))->get();
64-
65-
} else {
66-
if (is_string($this->value)) {
67-
$this->value = Connect::prep($this->value);
68-
}
69-
}
60+
$this->value = Encode::value($this->value)
61+
->specialChar($this->encode, ($this->prep ? ENT_NOQUOTES : ENT_QUOTES))
62+
->urlEncode(false)
63+
->encode();
64+
7065
if ($this->jsonEncode && is_array($this->value)) {
7166
// If prep is on then escape after json_encode,
7267
// otherwise json encode will possibly escape the escaped value
73-
$this->value = json_encode($this->value, JSON_UNESCAPED_SLASHES);
68+
$this->value = json_encode($this->value);
7469
}
75-
70+
7671
if($this->prep) {
7772
$this->value = Connect::prep($this->value);
7873
}
@@ -136,22 +131,4 @@ public function encode(bool $encode): self
136131
$this->encode = $encode;
137132
return $this;
138133
}
139-
140-
/**
141-
* // DEPRECATED
142-
* If Request[key] is array then auto convert it to json to make it database ready
143-
* @param bool $yes = true
144-
* @return self
145-
*/
146-
/*
147-
function mysqlVar(bool $mysqlVar = true): self
148-
{
149-
$this->mysqlVar = $mysqlVar;
150-
$this->enclose = false;
151-
$this->jsonEncode = false;
152-
$this->encode = false;
153-
$this->prep = false;
154-
return $this;
155-
}
156-
*/
157134
}

0 commit comments

Comments
 (0)