You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
465 B

  1. <?php
  2. function view($template, $data=[]) {
  3. global $templates;
  4. return $templates->render($template, $data);
  5. }
  6. // Adds slash if no path is in the URL
  7. function normalize_url($url) {
  8. return parse_url($url, PHP_URL_PATH) == '' ? $url.'/' : $url;
  9. }
  10. function should_follow_redirects($url) {
  11. $host = parse_url($url, PHP_URL_HOST);
  12. if(preg_match('/brid\.gy|appspot\.com|blogspot\.com|youtube\.com/', $host)) {
  13. return false;
  14. } else {
  15. return true;
  16. }
  17. }