| @@ 199-204 (lines=6) @@ | ||
| 196 | public function formatLike(Model $Model, $data, $options = array()) { |
|
| 197 | $options = array_merge($this->settings[$Model->alias], $options); |
|
| 198 | $from = $to = $substFrom = $substTo = array(); |
|
| 199 | if ($options['wildcardAny'] !== '%') { |
|
| 200 | $from[] = '%'; |
|
| 201 | $to[] = '\%'; |
|
| 202 | $substFrom[] = $options['wildcardAny']; |
|
| 203 | $substTo[] = '%'; |
|
| 204 | } |
|
| 205 | if ($options['wildcardOne'] !== '_') { |
|
| 206 | $from[] = '_'; |
|
| 207 | $to[] = '\_'; |
|
| @@ 205-210 (lines=6) @@ | ||
| 202 | $substFrom[] = $options['wildcardAny']; |
|
| 203 | $substTo[] = '%'; |
|
| 204 | } |
|
| 205 | if ($options['wildcardOne'] !== '_') { |
|
| 206 | $from[] = '_'; |
|
| 207 | $to[] = '\_'; |
|
| 208 | $substFrom[] = $options['wildcardOne']; |
|
| 209 | $substTo[] = '_'; |
|
| 210 | } |
|
| 211 | if (!empty($from)) { |
|
| 212 | // escape first |
|
| 213 | $data = str_replace($from, $to, $data); |
|