option HEADLINES_SMART_DATE
This commit is contained in:
parent
63186cdb78
commit
be773442d2
|
@ -1098,8 +1098,13 @@
|
||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$updated_fmt = date(get_pref($link, 'SHORT_DATE_FORMAT'),
|
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
|
||||||
strtotime($line["updated"]));
|
$updated_fmt = smart_date_time(strtotime($line["updated"]));
|
||||||
|
} else {
|
||||||
|
$short_date = get_pref($link, 'SHORT_DATE_FORMAT');
|
||||||
|
$updated_fmt = date($short_date, strtotime($line["updated"]));
|
||||||
|
}
|
||||||
|
|
||||||
print "<td class=\"hlUpdated\"><nobr>$updated_fmt</nobr></td>";
|
print "<td class=\"hlUpdated\"><nobr>$updated_fmt</nobr></td>";
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
|
@ -737,4 +737,24 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smart_date_time($timestamp) {
|
||||||
|
if (date("Y.m.d", $timestamp) == date("Y.m.d")) {
|
||||||
|
return date("G:i", $timestamp);
|
||||||
|
} else if (date("Y.m", $timestamp) == date("Y.m")) {
|
||||||
|
return date("M d, G:i", $timestamp);
|
||||||
|
} else {
|
||||||
|
return date("Y/m/d G:i");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function smart_date($timestamp) {
|
||||||
|
if (date("Y.m.d", $timestamp) == date("Y.m.d")) {
|
||||||
|
return "Today";
|
||||||
|
} else if (date("Y.m", $timestamp) == date("Y.m")) {
|
||||||
|
return date("D m", $timestamp);
|
||||||
|
} else {
|
||||||
|
return date("Y/m/d");
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -200,6 +200,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
|
||||||
|
|
||||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHOW_CONTENT_PREVIEW', 1, 'true', 'Show content preview in headlines list',2);
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHOW_CONTENT_PREVIEW', 1, 'true', 'Show content preview in headlines list',2);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3);
|
||||||
|
|
||||||
create table ttrss_user_prefs (
|
create table ttrss_user_prefs (
|
||||||
owner_uid integer not null,
|
owner_uid integer not null,
|
||||||
pref_name varchar(250),
|
pref_name varchar(250),
|
||||||
|
|
|
@ -185,6 +185,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
|
||||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 'Short date format',3);
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 'Short date format',3);
|
||||||
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3);
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3);
|
||||||
|
|
||||||
create table ttrss_user_prefs (
|
create table ttrss_user_prefs (
|
||||||
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
|
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
|
||||||
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
|
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
|
||||||
|
|
Loading…
Reference in New Issue