@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | function css_url(string $name) : string |
| 23 | 23 | { |
| 24 | - $name = explode('?', $name)[0]; |
|
| 25 | - $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
|
| 24 | + $name = explode('?', $name)[0]; |
|
| 25 | + $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
|
| 26 | 26 | |
| 27 | 27 | if (is_localfile($name)) { |
| 28 | 28 | $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
| 29 | 29 | $filename = WEBROOT.'css'.DS.$name; |
| 30 | 30 | |
| 31 | - return site_url() . 'css/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 31 | + return site_url() . 'css/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | function js_url(string $name) : string |
| 51 | 51 | { |
| 52 | 52 | $name = explode('?', $name)[0]; |
| 53 | - $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
|
| 53 | + $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
|
| 54 | 54 | |
| 55 | 55 | if (is_localfile($name)) |
| 56 | 56 | { |
| 57 | 57 | $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
| 58 | 58 | $filename = WEBROOT.'js'.DS.$name; |
| 59 | 59 | |
| 60 | - return site_url() . 'js/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 60 | + return site_url() . 'js/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | function lib_css_url(string $name) : string |
| 80 | 80 | { |
| 81 | 81 | $name = explode('?', $name)[0]; |
| 82 | - $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
| 82 | + $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
| 83 | 83 | |
| 84 | 84 | if (is_localfile($name)) |
| 85 | 85 | { |
| 86 | 86 | $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
| 87 | 87 | $filename = WEBROOT.'lib'.DS.$name; |
| 88 | 88 | |
| 89 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 89 | + return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | function lib_js_url(string $name) : string |
| 109 | 109 | { |
| 110 | 110 | $name = explode('?', $name)[0]; |
| 111 | - $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
| 111 | + $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
| 112 | 112 | |
| 113 | 113 | if (is_localfile($name)) |
| 114 | 114 | { |
| 115 | 115 | $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
| 116 | 116 | $filename = WEBROOT.'lib'.DS.$name; |
| 117 | 117 | |
| 118 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 118 | + return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | * inclu une ou plusieurs feuilles de style css |
| 133 | 133 | * |
| 134 | 134 | * @param string|string[] $name nom du fichier dont on veut inserer |
| 135 | - * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
| 135 | + * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
| 136 | 136 | * @return void|string |
| 137 | 137 | */ |
| 138 | 138 | function lib_styles($name, bool $print = true) |
| 139 | 139 | { |
| 140 | 140 | $name = (array) $name; |
| 141 | - $return = []; |
|
| 141 | + $return = []; |
|
| 142 | 142 | |
| 143 | 143 | foreach ($name As $style) |
| 144 | 144 | { |
@@ -152,25 +152,25 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | else if (is_localfile($style)) |
| 154 | 154 | { |
| 155 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 155 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 156 | 156 | $return[] = '<link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" /> -->'; |
| 157 | 157 | } |
| 158 | - else |
|
| 159 | - { |
|
| 160 | - $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
| 158 | + else |
|
| 159 | + { |
|
| 160 | + $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
| 161 | 161 | <link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" />'; |
| 162 | - } |
|
| 162 | + } |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $output = join("\n", $return); |
|
| 166 | + $output = join("\n", $return); |
|
| 167 | 167 | |
| 168 | - if (false === $print) |
|
| 169 | - { |
|
| 170 | - return $output; |
|
| 171 | - } |
|
| 168 | + if (false === $print) |
|
| 169 | + { |
|
| 170 | + return $output; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - echo $output; |
|
| 173 | + echo $output; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | function lib_scripts($name, bool $print = true) |
| 191 | 191 | { |
| 192 | 192 | $name = (array) $name; |
| 193 | - $return = []; |
|
| 193 | + $return = []; |
|
| 194 | 194 | |
| 195 | 195 | foreach ($name As $script) |
| 196 | 196 | { |
@@ -203,24 +203,24 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | else if (is_localfile($script)) |
| 205 | 205 | { |
| 206 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 206 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 207 | 207 | $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script> -->'; |
| 208 | 208 | } |
| 209 | - else |
|
| 210 | - { |
|
| 211 | - $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
| 212 | - } |
|
| 209 | + else |
|
| 210 | + { |
|
| 211 | + $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
| 212 | + } |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $output = join("\n", $return); |
|
| 216 | + $output = join("\n", $return); |
|
| 217 | 217 | |
| 218 | - if (false === $print) |
|
| 219 | - { |
|
| 220 | - return $output; |
|
| 221 | - } |
|
| 218 | + if (false === $print) |
|
| 219 | + { |
|
| 220 | + return $output; |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - echo $output; |
|
| 223 | + echo $output; |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | * inclu une ou plusieurs feuilles de style css |
| 235 | 235 | * |
| 236 | 236 | * @param string|string[] $name nom du fichier dont on veut inserer |
| 237 | - * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
| 237 | + * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
| 238 | 238 | * @return void|string |
| 239 | 239 | */ |
| 240 | 240 | function styles($name, bool $print = true) |
| 241 | 241 | { |
| 242 | 242 | $name = (array) $name; |
| 243 | - $return = []; |
|
| 243 | + $return = []; |
|
| 244 | 244 | |
| 245 | 245 | foreach ($name As $style) |
| 246 | 246 | { |
@@ -249,30 +249,30 @@ discard block |
||
| 249 | 249 | $style = (!preg_match('#\.css$#i', $style) ? $style.'.css' : $style); |
| 250 | 250 | if (is_file(WEBROOT.'css'.DS.str_replace('/', DS, $style))) |
| 251 | 251 | { |
| 252 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
| 252 | + $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
| 253 | 253 | <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
| 254 | 254 | } |
| 255 | 255 | else if (is_localfile($style)) |
| 256 | 256 | { |
| 257 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 257 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
| 258 | 258 | $return[] = '<link rel="stylesheet" type="text/css" href="'.css_url($style).'" /> -->'; |
| 259 | 259 | } |
| 260 | - else |
|
| 261 | - { |
|
| 262 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
| 260 | + else |
|
| 261 | + { |
|
| 262 | + $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
| 263 | 263 | <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $output = join("\n", $return); |
|
| 268 | + $output = join("\n", $return); |
|
| 269 | 269 | |
| 270 | - if (false === $print) |
|
| 271 | - { |
|
| 272 | - return $output; |
|
| 273 | - } |
|
| 270 | + if (false === $print) |
|
| 271 | + { |
|
| 272 | + return $output; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - echo $output; |
|
| 275 | + echo $output; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | function scripts($name, bool $print = true) |
| 293 | 293 | { |
| 294 | 294 | $name = (array) $name; |
| 295 | - $return = []; |
|
| 295 | + $return = []; |
|
| 296 | 296 | |
| 297 | 297 | foreach ($name As $script) |
| 298 | 298 | { |
@@ -308,21 +308,21 @@ discard block |
||
| 308 | 308 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
| 309 | 309 | $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script> -->'; |
| 310 | 310 | } |
| 311 | - else |
|
| 312 | - { |
|
| 313 | - $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
| 314 | - } |
|
| 311 | + else |
|
| 312 | + { |
|
| 313 | + $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
| 314 | + } |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $output = join("\n", $return); |
|
| 318 | + $output = join("\n", $return); |
|
| 319 | 319 | |
| 320 | - if (false === $print) |
|
| 321 | - { |
|
| 322 | - return $output; |
|
| 323 | - } |
|
| 320 | + if (false === $print) |
|
| 321 | + { |
|
| 322 | + return $output; |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - echo $output; |
|
| 325 | + echo $output; |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | function less_url(string $name) : string |
| 342 | 342 | { |
| 343 | 343 | $name = explode('?', $name)[0]; |
| 344 | - $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
|
| 344 | + $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
|
| 345 | 345 | |
| 346 | 346 | if (is_localfile($name)) |
| 347 | 347 | { |
| 348 | 348 | $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
| 349 | 349 | $filename = WEBROOT.'less'.DS.$name; |
| 350 | 350 | |
| 351 | - return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 351 | + return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | function less_styles($name, bool $print = true) |
| 372 | 372 | { |
| 373 | 373 | $name = (array) $name; |
| 374 | - $return = []; |
|
| 374 | + $return = []; |
|
| 375 | 375 | |
| 376 | 376 | foreach ($name As $style) |
| 377 | 377 | { |
@@ -387,21 +387,21 @@ discard block |
||
| 387 | 387 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
| 388 | 388 | $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" /> -->'; |
| 389 | 389 | } |
| 390 | - else |
|
| 391 | - { |
|
| 392 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
| 393 | - } |
|
| 390 | + else |
|
| 391 | + { |
|
| 392 | + $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
| 393 | + } |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $output = join("\n", $return); |
|
| 397 | + $output = join("\n", $return); |
|
| 398 | 398 | |
| 399 | - if (false === $print) |
|
| 400 | - { |
|
| 401 | - return $output; |
|
| 402 | - } |
|
| 399 | + if (false === $print) |
|
| 400 | + { |
|
| 401 | + return $output; |
|
| 402 | + } |
|
| 403 | 403 | |
| 404 | - echo $output; |
|
| 404 | + echo $output; |
|
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | function img_url(string $name) : string |
| 422 | 422 | { |
| 423 | 423 | $name = explode('?', $name)[0]; |
| 424 | - $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
| 424 | + $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
| 425 | 425 | |
| 426 | 426 | if (is_localfile($name)) |
| 427 | 427 | { |
| 428 | 428 | $filename = WEBROOT.'img'.DS.$name; |
| 429 | 429 | |
| 430 | - return site_url() . 'img/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 430 | + return site_url() . 'img/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | return $name; |
@@ -452,8 +452,8 @@ discard block |
||
| 452 | 452 | { |
| 453 | 453 | $return = '<img src="' . img_url($name) . '" alt="' . $alt . '"'; |
| 454 | 454 | |
| 455 | - $noprint = isset($options['print']) AND $options['print'] == false; |
|
| 456 | - unset($options['print']); |
|
| 455 | + $noprint = isset($options['print']) AND $options['print'] == false; |
|
| 456 | + unset($options['print']); |
|
| 457 | 457 | |
| 458 | 458 | foreach ($options As $key => $value) |
| 459 | 459 | { |
@@ -461,10 +461,10 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | $return .= ' />'; |
| 463 | 463 | |
| 464 | - if ($noprint === true) |
|
| 465 | - { |
|
| 466 | - return $return; |
|
| 467 | - } |
|
| 464 | + if ($noprint === true) |
|
| 465 | + { |
|
| 466 | + return $return; |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | 469 | echo $return; |
| 470 | 470 | } |
@@ -485,13 +485,13 @@ discard block |
||
| 485 | 485 | function docs_url(string $name) : string |
| 486 | 486 | { |
| 487 | 487 | $name = explode('?', $name)[0]; |
| 488 | - $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
| 488 | + $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
| 489 | 489 | |
| 490 | 490 | if (is_localfile($name)) |
| 491 | 491 | { |
| 492 | 492 | $filename = WEBROOT.'docs'.DS.$name; |
| 493 | 493 | |
| 494 | - return site_url() . 'docs/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 494 | + return site_url() . 'docs/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | return $name; |
@@ -513,13 +513,13 @@ discard block |
||
| 513 | 513 | function videos_url(string $name) : string |
| 514 | 514 | { |
| 515 | 515 | $name = explode('?', $name)[0]; |
| 516 | - $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
| 516 | + $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
| 517 | 517 | |
| 518 | 518 | if (is_localfile($name)) |
| 519 | 519 | { |
| 520 | 520 | $filename = WEBROOT.'videos'.DS.$name; |
| 521 | 521 | |
| 522 | - return site_url() . 'videos/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 522 | + return site_url() . 'videos/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | return $name; |