@@ -49,10 +49,10 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
49
49
50
50
$ attributes = stringify_attributes ($ attributes );
51
51
52
- if (stripos ( $ attributes , 'method= ' ) === false ) {
52
+ if (! str_contains ( strtolower ( $ attributes) , 'method= ' )) {
53
53
$ attributes .= ' method="post" ' ;
54
54
}
55
- if (stripos ( $ attributes , 'accept-charset= ' ) === false ) {
55
+ if (! str_contains ( strtolower ( $ attributes) , 'accept-charset= ' )) {
56
56
$ config = config (App::class);
57
57
$ attributes .= ' accept-charset=" ' . strtolower ($ config ->charset ) . '" ' ;
58
58
}
@@ -62,7 +62,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
62
62
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
63
63
$ before = service ('filters ' )->getFilters ()['before ' ];
64
64
65
- if ((in_array ('csrf ' , $ before , true ) || array_key_exists ('csrf ' , $ before )) && str_contains ($ action , base_url ()) && stripos ( $ form, 'method="get" ' ) === false ) {
65
+ if ((in_array ('csrf ' , $ before , true ) || array_key_exists ('csrf ' , $ before )) && str_contains ($ action , base_url ()) && ! str_contains ( strtolower ( $ form), strtolower ( 'method="get" ' )) ) {
66
66
$ form .= csrf_field ($ csrfId ?? null );
67
67
}
68
68
@@ -223,11 +223,11 @@ function form_textarea($data = '', string $value = '', $extra = ''): string
223
223
}
224
224
225
225
// Unsets default rows and cols if defined in extra field as array or string.
226
- if ((is_array ($ extra ) && array_key_exists ('rows ' , $ extra )) || (is_string ($ extra ) && stripos ( preg_replace ('/\s+/ ' , '' , $ extra ), 'rows= ' ) !== false )) {
226
+ if ((is_array ($ extra ) && array_key_exists ('rows ' , $ extra )) || (is_string ($ extra ) && str_contains ( strtolower ( preg_replace ('/\s+/ ' , '' , $ extra )) , 'rows= ' ))) {
227
227
unset($ defaults ['rows ' ]);
228
228
}
229
229
230
- if ((is_array ($ extra ) && array_key_exists ('cols ' , $ extra )) || (is_string ($ extra ) && stripos ( preg_replace ('/\s+/ ' , '' , $ extra ), 'cols= ' ) !== false )) {
230
+ if ((is_array ($ extra ) && array_key_exists ('cols ' , $ extra )) || (is_string ($ extra ) && str_contains ( strtolower ( preg_replace ('/\s+/ ' , '' , $ extra )) , 'cols= ' ))) {
231
231
unset($ defaults ['cols ' ]);
232
232
}
233
233
@@ -248,7 +248,7 @@ function form_multiselect($name = '', array $options = [], array $selected = [],
248
248
{
249
249
$ extra = stringify_attributes ($ extra );
250
250
251
- if (stripos ( $ extra, 'multiple ' ) === false ) {
251
+ if (! str_contains ( strtolower ( $ extra), strtolower ( 'multiple ' )) ) {
252
252
$ extra .= ' multiple="multiple" ' ;
253
253
}
254
254
@@ -305,7 +305,7 @@ function form_dropdown($data = '', $options = [], $selected = [], $extra = ''):
305
305
}
306
306
307
307
$ extra = stringify_attributes ($ extra );
308
- $ multiple = (count ($ selected ) > 1 && stripos ( $ extra , 'multiple ' ) === false ) ? ' multiple="multiple" ' : '' ;
308
+ $ multiple = (count ($ selected ) > 1 && ! str_contains ( strtolower ( $ extra) , 'multiple ' )) ? ' multiple="multiple" ' : '' ;
309
309
$ form = '<select ' . rtrim (parse_form_attributes ($ data , $ defaults )) . $ extra . $ multiple . "> \n" ;
310
310
311
311
foreach ($ options as $ key => $ val ) {
0 commit comments