|
15 | 15 | * 16/01/2021 -> getIdAntes (refatorado método) |
16 | 16 | * 16/01/2021 -> Renomeado método gerarLinkWebsite para gerarLinkInterno |
17 | 17 | * 20/01/2021 -> Melhorada performance geral da classe |
| 18 | + * 20/01/2021 -> Renomeado método tratar para URLizer |
18 | 19 | */ |
19 | 20 |
|
20 | 21 | class url { |
@@ -96,7 +97,7 @@ public function agora() { |
96 | 97 | * @return bool Verifica se possui o o que for informado aqui na url. Se tiver, retorna true. |
97 | 98 | */ |
98 | 99 | public function contem($palavra) { |
99 | | - if ((in_array($palavra, $this->partes)) || ( in_array($this->tratar($palavra), $this->partes)) || $this->get($palavra)!=="" || preg_match("/$palavra/", implode('/',$this->partes))) { |
| 100 | + if ($palavra!=="" && ((in_array($palavra, $this->partes)) || ( in_array($this->URLizer($palavra), $this->partes)) || $this->get($palavra)!=="" || preg_match("/$palavra/", implode('/',$this->partes)))) { |
100 | 101 | return true; |
101 | 102 | } else { |
102 | 103 | return false; |
@@ -183,7 +184,7 @@ public function getURLApos($palavra) { |
183 | 184 | * @return int $id Retorna a ID que está depois da palavra informada |
184 | 185 | */ |
185 | 186 | public function getIdApos($palavra) { |
186 | | - return $this->getId($this->getApos($this->tratar($palavra),true)); |
| 187 | + return $this->getId($this->getApos($this->URLizer($palavra),true)); |
187 | 188 | } |
188 | 189 |
|
189 | 190 | /** |
@@ -237,7 +238,7 @@ public function getURLAntes($palavra) { |
237 | 238 | * @return int $id Retorna a ID que está antes da palavra informada. |
238 | 239 | */ |
239 | 240 | public function getIdAntes($palavra) { |
240 | | - return $this->getId($this->getAntes($this->tratar($palavra),true)); |
| 241 | + return $this->getId($this->getAntes($this->URLizer($palavra),true)); |
241 | 242 | } |
242 | 243 |
|
243 | 244 | /** |
|
0 commit comments