Skip to content
Browse files

Finally figured out how to implement html5 time smarty patch by @ophian

… correctly.
  • Loading branch information...
1 parent 3c158f4 commit fe365236764222b3bdfb47fa743d9a7bcae99248 @yellowled committed Apr 17, 2012
Showing with 16 additions and 8 deletions.
  1. +1 −1 comments.tpl
  2. +10 −2 config.inc.php
  3. +1 −1 entries.tpl
  4. +1 −1 entries_summary.tpl
  5. +1 −1 plugin_commentsearch_searchresults.tpl
  6. +1 −1 plugin_staticpage.tpl
  7. +1 −1 trackbacks.tpl
View
2 comments.tpl
@@ -1,6 +1,6 @@
{foreach from=$comments item=comment name="comments"}
<article id="c{$comment.id}" class="serendipity_comment{if $entry.author == $comment.author} serendipity_comment_author_self{/if} {cycle values="odd,even"} {if $comment.depth > 8}commentlevel-9{else}commentlevel-{$comment.depth}{/if}">
- <h4>{if $comment.url}<a href="{$comment.url}">{/if}{$comment.author|@default:$CONST.ANONYMOUS}{if $comment.url}</a>{/if} {$CONST.ON} <time datetime="{$comment.timestamp|@serendipity_smarty_html5time}" pubdate>{$comment.timestamp|@formatTime:$template_option.date_format}</time>:</h4>
+ <h4>{if $comment.url}<a href="{$comment.url}">{/if}{$comment.author|@default:$CONST.ANONYMOUS}{if $comment.url}</a>{/if} {$CONST.ON} <time datetime="{$comment.timestamp|@serendipity_html5time}" pubdate>{$comment.timestamp|@formatTime:$template_option.date_format}</time>:</h4>
<div class="serendipity_commentBody clearfix content">
{if $comment.avatar}{$comment.avatar}{/if}
View
12 config.inc.php
@@ -7,7 +7,15 @@
'currpage2' => $_SERVER['REQUEST_URI']));
function serendipity_smarty_html5time($timestamp) { return date("c", $timestamp); }
-$serendipity['smarty']->register_modifier('serendipity_smarty_html5time', 'serendipity_smarty_html5time');
+if( defined('Smarty::SMARTY_VERSION') ) {
+ $serendipity['smarty']->registerPlugin('modifier', 'serendipity_html5time', 'serendipity_smarty_html5time');
+} else {
+ // old Smarty 2 syntax
+ $serendipity['smarty']->register_modifier('serendipity_html5time', 'serendipity_smarty_html5time');
+}
+
+// function serendipity_smarty_html5time($timestamp) { return date("c", $timestamp); }
+// $serendipity['smarty']->register_modifier('serendipity_smarty_html5time', 'serendipity_smarty_html5time');
if (class_exists('serendipity_event_spamblock')) {
$required_fieldlist = serendipity_db_query("SELECT value FROM {$serendipity['dbPrefix']}config WHERE name LIKE '%spamblock%required_fields'", true, 'assoc');
@@ -76,4 +84,4 @@ function serendipity_smarty_html5time($timestamp) { return date("c", $timestamp)
$template_global_config = array('navigation' => true);
$template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option'], true);
-serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config);
+serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config);
View
2 entries.tpl
@@ -5,7 +5,7 @@
<header class="clearfix">
<h2><a href="{$entry.link}">{$entry.title}</a></h2>
- <span class="serendipity_byline">{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.ON} <time datetime="{$entry.timestamp|@serendipity_smarty_html5time}" pubdate>{$entry.timestamp|@formatTime:$template_option.date_format}</time>{if $entry.is_entry_owner and not $is_preview} | <a href="{$entry.link_edit}">{$CONST.EDIT_ENTRY}</a>{/if}</span>
+ <span class="serendipity_byline">{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.ON} <time datetime="{$entry.timestamp|@serendipity_html5time}" pubdate>{$entry.timestamp|@formatTime:$template_option.date_format}</time>{if $entry.is_entry_owner and not $is_preview} | <a href="{$entry.link_edit}">{$CONST.EDIT_ENTRY}</a>{/if}</span>
</header>
<div class="clearfix content serendipity_entry_body">
View
2 entries_summary.tpl
@@ -6,7 +6,7 @@
{foreach from=$entries item="sentries"}
{foreach from=$sentries.entries item="entry"}
<li><a href="{$entry.link}">{$entry.title}</a>
- <span class="serendipity_byline">{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.ON} <time datetime="{$entry.timestamp|@serendipity_smarty_html5time}" pubdate>{$entry.timestamp|@formatTime:$template_option.date_format}</time></span>
+ <span class="serendipity_byline">{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.ON} <time datetime="{$entry.timestamp|@serendipity_html5time}" pubdate>{$entry.timestamp|@formatTime:$template_option.date_format}</time></span>
</li>
{/foreach}
{/foreach}
View
2 plugin_commentsearch_searchresults.tpl
@@ -3,7 +3,7 @@
{if $comment_results}
<ul class="plainList">
{foreach from=$comment_results item="result"}
- <li><span>{if $result.type == 'TRACKBACK'}<a href="{$result.url|@escape}">{else}<b>{/if}{$result.author|@escape}{if $result.type == 'TRACKBACK'}</a>{else}</b>{/if} {$CONST.IN} <a href="{$result.permalink|@escape}">{$result.title|@escape}</a> {$CONST.ON} <time datetime="{$result.ctimestamp|@serendipity_smarty_html5time}">{$result.ctimestamp|@formatTime:$template_option.date_format}</time>:</span>
+ <li><span>{if $result.type == 'TRACKBACK'}<a href="{$result.url|@escape}">{else}<b>{/if}{$result.author|@escape}{if $result.type == 'TRACKBACK'}</a>{else}</b>{/if} {$CONST.IN} <a href="{$result.permalink|@escape}">{$result.title|@escape}</a> {$CONST.ON} <time datetime="{$result.ctimestamp|@serendipity_html5time}">{$result.ctimestamp|@formatTime:$template_option.date_format}</time>:</span>
{$result.comment|@strip_tags|@truncate:200:" ... "}
</li>
{/foreach}
View
2 plugin_staticpage.tpl
@@ -36,7 +36,7 @@
<span class="visuallyhidden">{$CONST.POSTED_BY} </span>{$staticpage_author|@escape}
{/if}
{if $staticpage_lastchange}
- | <span class="visuallyhidden">{$CONST.ON} </span><time datetime="{$staticpage_lastchange|@serendipity_smarty_html5time}" pubdate>{$staticpage_lastchange|date_format:$template_option.date_format}</time>
+ | <span class="visuallyhidden">{$CONST.ON} </span><time datetime="{$staticpage_lastchange|@serendipity_html5time}" pubdate>{$staticpage_lastchange|date_format:$template_option.date_format}</time>
{/if}
{if $staticpage_adminlink AND $staticpage_adminlink.page_user}
| <a href="{$staticpage_adminlink.link_edit}">{$staticpage_adminlink.link_name|@escape}</a>
View
2 trackbacks.tpl
@@ -1,6 +1,6 @@
{foreach from=$trackbacks item=trackback}
<article id="c{$trackback.id}" class="serendipity_comment {cycle values="odd,even"}">
- <h4><cite>{$trackback.author|@default:$CONST.ANONYMOUS}</cite> {$CONST.ON} <time datetime="{$trackback.timestamp|@serendipity_smarty_html5time}" pubdate>{$trackback.timestamp|@formatTime:$template_option.date_format}</time>: <a href="{$trackback.url|@strip_tags}">{$trackback.title}</a></h4>
+ <h4><cite>{$trackback.author|@default:$CONST.ANONYMOUS}</cite> {$CONST.ON} <time datetime="{$trackback.timestamp|@serendipity_html5time}" pubdate>{$trackback.timestamp|@formatTime:$template_option.date_format}</time>: <a href="{$trackback.url|@strip_tags}">{$trackback.title}</a></h4>
<details>
<summary>{$CONST.VIEW_EXTENDED_ENTRY|@sprintf:$trackback.title}</summary>

0 comments on commit fe36523

Please sign in to comment.
Something went wrong with that request. Please try again.