@@ -49,10 +49,10 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
4949
5050 $ attributes = stringify_attributes ($ attributes );
5151
52- if (stripos ( $ attributes , 'method= ' ) === false ) {
52+ if (! str_contains ( strtolower ( $ attributes) , 'method= ' )) {
5353 $ attributes .= ' method="post" ' ;
5454 }
55- if (stripos ( $ attributes , 'accept-charset= ' ) === false ) {
55+ if (! str_contains ( strtolower ( $ attributes) , 'accept-charset= ' )) {
5656 $ config = config (App::class);
5757 $ attributes .= ' accept-charset=" ' . strtolower ($ config ->charset ) . '" ' ;
5858 }
@@ -62,7 +62,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
6262 // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
6363 $ before = service ('filters ' )->getFilters ()['before ' ];
6464
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" ' )) ) {
6666 $ form .= csrf_field ($ csrfId ?? null );
6767 }
6868
@@ -223,11 +223,11 @@ function form_textarea($data = '', string $value = '', $extra = ''): string
223223 }
224224
225225 // 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= ' ))) {
227227 unset($ defaults ['rows ' ]);
228228 }
229229
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= ' ))) {
231231 unset($ defaults ['cols ' ]);
232232 }
233233
@@ -248,7 +248,7 @@ function form_multiselect($name = '', array $options = [], array $selected = [],
248248 {
249249 $ extra = stringify_attributes ($ extra );
250250
251- if (stripos ( $ extra, 'multiple ' ) === false ) {
251+ if (! str_contains ( strtolower ( $ extra), strtolower ( 'multiple ' )) ) {
252252 $ extra .= ' multiple="multiple" ' ;
253253 }
254254
@@ -305,7 +305,7 @@ function form_dropdown($data = '', $options = [], $selected = [], $extra = ''):
305305 }
306306
307307 $ 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" ' : '' ;
309309 $ form = '<select ' . rtrim (parse_form_attributes ($ data , $ defaults )) . $ extra . $ multiple . "> \n" ;
310310
311311 foreach ($ options as $ key => $ val ) {
0 commit comments