diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-05-01 22:03:05 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-05-01 22:03:05 +0200 |
commit | 8f93ff5aea99ca98693a47d3f09043f65dee9ac2 (patch) | |
tree | e5493b8ce523fe78bfce42c772bfc4d8c5a196a9 | |
parent | e7797f36cf7fd98c825f497bc7f24015c95e8d22 (diff) |
use function to generate links to css files
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | application/helpers/filebin_helper.php | 11 | ||||
-rw-r--r-- | application/views/file/header.php | 2 | ||||
-rw-r--r-- | application/views/file/html_header.php | 4 | ||||
-rw-r--r-- | application/views/file/upload_form.php | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index ac09da7d2..4c1423725 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -201,4 +201,15 @@ function random_alphanum($min_length, $max_length = null) return $random; } +function link_with_mtime($file) +{ + $link = base_url($file); + + if (file_exists(FCPATH.$file)) { + $link .= "?".filemtime(FCPATH.$file); + } + + return $link; +} + # vim: set noet: diff --git a/application/views/file/header.php b/application/views/file/header.php index ca540c805..733c6788e 100644 --- a/application/views/file/header.php +++ b/application/views/file/header.php @@ -3,7 +3,7 @@ <head> <title><?php echo isset($title) ? $title : ''; ?></title> - <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>data/default.css?<?php echo filemtime(FCPATH."/data/default.css"); ?>" media="screen" /> + <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/default.css"); ?>" media="screen" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex,nofollow" /> </head> diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php index 284844410..b2c49c3b2 100644 --- a/application/views/file/html_header.php +++ b/application/views/file/html_header.php @@ -2,8 +2,8 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $title; ?></title> - <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>data/paste.css?<?php echo filemtime(FCPATH."/data/paste.css"); ?>" /> - <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>data/paste-<?php echo $current_highlight; ?>.css<?php if (file_exists(FCPATH."/data/paste-".$current_highlight.".css")) { echo "?".filemtime(FCPATH."/data/paste-".$current_highlight.".css");} ?>" /> + <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/paste.css"); ?>" /> + <link rel="stylesheet" type="text/css" href="<?php echo link_with_mtime("/data/paste-$current_highlight.css"); ?>" /> </head> <body> <div class="top_bar"> diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php index e0bdef935..f4d325e0b 100644 --- a/application/views/file/upload_form.php +++ b/application/views/file/upload_form.php @@ -18,7 +18,7 @@ var max_upload_size = "<?php echo $max_upload_size; ?>"; /* ]]> */ </script> - <script type="text/javascript" src="<?php echo base_url(); ?>data/js/upload_form.js?<?php echo filemtime(FCPATH."/data/js/upload_form.js"); ?>"></script> + <script type="text/javascript" src="<?php echo link_with_mtime("/data/js/upload_form.js"); ?>"></script> </div> <? } else { ?> You have to <?=anchor("user/login", "log in"); ?> to be able to upload/paste. |