mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
fix version query for css and js files for dev needs
This commit is contained in:
parent
7f39f91ecd
commit
3ce91c9f44
2 changed files with 35 additions and 12 deletions
|
|
@ -10,14 +10,14 @@
|
|||
<title><?php mttinfo('title'); ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/gif" href="<?php mttinfo('theme_url'); ?>images/logo.gif">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>style.css?v=<?php mttinfo('version'); ?>" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>markdown.css?v=<?php mttinfo('version'); ?>" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>style.css?v=<?php filever('theme', 'style.css'); ?>" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>markdown.css?v=<?php filever('theme', 'markdown.css'); ?>" media="all">
|
||||
<?php if (in_array(get_mttinfo('appearance'), ['system','dark'])): ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>dark.css?v=<?php mttinfo('version'); ?>" media="screen">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>dark.css?v=<?php filever('theme', 'dark.css'); ?>" media="screen">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>print.css?v=<?php mttinfo('version'); ?>" media="print">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>print.css?v=<?php filever('theme', 'print.css'); ?>" media="print">
|
||||
<?php if(Config::get('rtl')): ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>style_rtl.css?v=<?php mttinfo('version'); ?>" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>style_rtl.css?v=<?php filever('theme', 'style_rtl.css'); ?>" media="all">
|
||||
<?php endif; ?>
|
||||
<?php do_action('theme_head_end'); ?>
|
||||
</head>
|
||||
|
|
@ -27,8 +27,8 @@
|
|||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>js/jquery.min.js?v=3.6.4"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>js/jquery-ui.min.js?v=1.13.2"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>js/jquery.ui.touch-punch.js?v=1.0.8-2"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>mytinytodo.js?v=<?php mttinfo('version'); ?>"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>mytinytodo_api.js?v=<?php mttinfo('version'); ?>"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>mytinytodo.js?v=<?php filever('content', 'mytinytodo.js'); ?>"></script>
|
||||
<script type="text/javascript" src="<?php mttinfo('content_url'); ?>mytinytodo_api.js?v=<?php filever('content', 'mytinytodo_api.js'); ?>"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
|
|
|||
33
src/init.php
33
src/init.php
|
|
@ -392,11 +392,7 @@ function get_unsafe_mttinfo($v)
|
|||
$_mttinfo['title'] = (Config::get('title') != '') ? Config::get('title') : __('My Tiny Todolist');
|
||||
return $_mttinfo['title'];
|
||||
case 'version':
|
||||
if (MTT_DEBUG) {
|
||||
$_mttinfo['version'] = mytinytodo\Version::VERSION . '-' . time();
|
||||
} else {
|
||||
$_mttinfo['version'] = mytinytodo\Version::VERSION;
|
||||
}
|
||||
$_mttinfo['version'] = mytinytodo\Version::VERSION;
|
||||
return $_mttinfo['version'];
|
||||
case 'appearance':
|
||||
$_mttinfo['appearance'] = Config::get('appearance');
|
||||
|
|
@ -471,3 +467,30 @@ function loadExtensions()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function filever(string $dir, string $filename)
|
||||
{
|
||||
if (!MTT_DEBUG) {
|
||||
return mttinfo('version');
|
||||
}
|
||||
$prefix = get_mttinfo('version'). '-'. time();
|
||||
$path = null;
|
||||
if ($dir == 'content') {
|
||||
$path = MTTPATH. 'content/';
|
||||
}
|
||||
else if ($dir == 'theme') {
|
||||
$path = MTTPATH. 'content/'. MTT_THEME. '/';
|
||||
}
|
||||
else {
|
||||
return print($prefix. '-unknown');
|
||||
}
|
||||
$fullPath = $path. $filename;
|
||||
if (!file_exists($fullPath)) {
|
||||
return print($prefix. '-not-found');
|
||||
}
|
||||
$mtime = filemtime($fullPath);
|
||||
if ($mtime === false) {
|
||||
return print($prefix. '-no-access');
|
||||
}
|
||||
return print($mtime);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue