@@ -128,7 +128,7 @@ function img($src = '', bool $indexPage = false, $attributes = ''): string
128128 unset($ attributes ['alt ' ], $ attributes ['src ' ]);
129129 }
130130
131- return $ img . stringify_attributes ($ attributes ) . ' / > ' ;
131+ return $ img . stringify_attributes ($ attributes ) . _solidus () . ' > ' ;
132132 }
133133}
134134
@@ -229,8 +229,6 @@ function script_tag($src = '', bool $indexPage = false): string
229229 */
230230 function link_tag ($ href = '' , string $ rel = 'stylesheet ' , string $ type = 'text/css ' , string $ title = '' , string $ media = '' , bool $ indexPage = false , string $ hreflang = '' ): string
231231 {
232- $ link = '<link ' ;
233-
234232 // extract fields if needed
235233 if (is_array ($ href )) {
236234 $ rel = $ href ['rel ' ] ?? $ rel ;
@@ -243,34 +241,30 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c
243241 }
244242
245243 if (! preg_match ('#^([a-z]+:)?//#i ' , $ href )) {
246- if ($ indexPage === true ) {
247- $ link .= 'href=" ' . site_url ($ href ) . '" ' ;
248- } else {
249- $ link .= 'href=" ' . slash_item ('baseURL ' ) . $ href . '" ' ;
250- }
244+ $ attributes ['href ' ] = $ indexPage ? site_url ($ href ) : slash_item ('baseURL ' ) . $ href ;
251245 } else {
252- $ link .= 'href=" ' . $ href . ' " ' ;
246+ $ attributes [ 'href ' ] = $ href ;
253247 }
254248
255249 if ($ hreflang !== '' ) {
256- $ link .= 'hreflang=" ' . $ hreflang . ' " ' ;
250+ $ attributes [ 'hreflang ' ] = $ hreflang ;
257251 }
258252
259- $ link .= 'rel=" ' . $ rel . ' " ' ;
253+ $ attributes [ 'rel ' ] = $ rel ;
260254
261255 if (! in_array ($ rel , ['alternate ' , 'canonical ' ], true )) {
262- $ link .= 'type=" ' . $ type . ' " ' ;
256+ $ attributes [ 'type ' ] = $ type ;
263257 }
264258
265259 if ($ media !== '' ) {
266- $ link .= 'media=" ' . $ media . ' " ' ;
260+ $ attributes [ 'media ' ] = $ media ;
267261 }
268262
269263 if ($ title !== '' ) {
270- $ link .= 'title=" ' . $ title . ' " ' ;
264+ $ attributes [ 'title ' ] = $ title ;
271265 }
272266
273- return $ link . ' / > ' ;
267+ return ' < link' . stringify_attributes ( $ attributes ) . _solidus () . ' > ' ;
274268 }
275269}
276270
@@ -423,7 +417,7 @@ function source(string $src, string $type = 'unknown', string $attributes = '',
423417 $ source .= ' ' . $ attributes ;
424418 }
425419
426- return $ source . ' / > ' ;
420+ return $ source . _solidus () . ' > ' ;
427421 }
428422}
429423
@@ -442,7 +436,7 @@ function track(string $src, string $kind, string $srcLanguage, string $label): s
442436 . '" kind=" ' . $ kind
443437 . '" srclang=" ' . $ srcLanguage
444438 . '" label=" ' . $ label
445- . '" / > ' ;
439+ . '" ' . _solidus () . ' > ' ;
446440 }
447441}
448442
@@ -496,7 +490,7 @@ function param(string $name, string $value, string $type = 'ref', string $attrib
496490 return '<param name=" ' . $ name
497491 . '" type=" ' . $ type
498492 . '" value=" ' . $ value
499- . '" ' . $ attributes . ' / > ' ;
493+ . '" ' . $ attributes . _solidus () . ' > ' ;
500494 }
501495}
502496
@@ -518,7 +512,7 @@ function embed(string $src, string $type = 'unknown', string $attributes = '', b
518512
519513 return '<embed src=" ' . $ src
520514 . '" type=" ' . $ type . '" '
521- . $ attributes . " / > \n" ;
515+ . $ attributes . _solidus () . " > \n" ;
522516 }
523517}
524518
0 commit comments