From e2e32eecacc0959ff283fb83f06fa3c6488bb6e9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 7 Jun 2016 22:29:50 +0200 Subject: [PATCH] New template for shared content instead of hardcoded stuff in source --- include/bbcode.php | 41 +++++++++++++++++-------------- view/templates/shared-content.tpl | 13 ++++++++++ view/theme/duepuntozero/style.css | 6 +++-- view/theme/frio/css/style.css | 4 ++- view/theme/vier/style.css | 16 ++++++++++-- 5 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 view/templates/shared-content.tpl diff --git a/include/bbcode.php b/include/bbcode.php index 6cce25bcf..bb4f77ebf 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -396,18 +396,17 @@ function bb_ShareAttributes($share, $simplehtml) { $itemcache = get_itemcachepath(); + preg_match("/posted='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $posted = $matches[1]; + + preg_match('/posted="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $posted = $matches[1]; + // relative dates only make sense when they aren't cached - if ($itemcache == "") { - preg_match("/posted='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") - $posted = $matches[1]; - - preg_match('/posted="(.*?)"/ism', $attributes, $matches); - if ($matches[1] != "") - $posted = $matches[1]; - + if ($itemcache == "") $reldate = (($posted) ? " " . relative_date($posted) : ''); - } $data = get_contact_details_by_url($profile); @@ -489,16 +488,20 @@ function bb_ShareAttributes($share, $simplehtml) { $text .= "

".$link; break; default: - $headline = trim($share[1])."\n"; - $headline .= '
'."\n"; - $headline .= '
'."\n"; - if ($avatar != "") - $headline .= ''; + $text = trim($share[1])."\n"; - $headline .= sprintf(t('%s wrote the following post'.$reldate.':'), $profile, $author, $link); - $headline .= "
\n"; - $text = $headline.'
'.trim($share[3])."
\n"; - $text .= "
\n"; + $tpl = get_markup_template('shared-content.tpl'); + $text .= replace_macros($tpl, + array( + '$profile' => $profile, + '$avatar' => $avatar, + '$author' => $author, + '$link' => $link, + '$posted' => $posted, + '$reldate' => $reldate, + '$content' => trim($share[3]) + ) + ); break; } return($text); diff --git a/view/templates/shared-content.tpl b/view/templates/shared-content.tpl new file mode 100644 index 000000000..74f6aed6d --- /dev/null +++ b/view/templates/shared-content.tpl @@ -0,0 +1,13 @@ +
+
+ {{if $avatar}} + + + + {{/if}} + {{*{{$author}} wrote the following post{{$reldate}}:*}} + + +
+
{{$content}}
+
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 49754c838..9732edb15 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1112,7 +1112,8 @@ input#dfrn-url { left: 65px; } -.wall-item-ago { +.wall-item-ago, +.shared-time { color: #888888; font-size: 0.8em; } @@ -1201,7 +1202,8 @@ input#dfrn-url { .wall-item-wrapper-end { clear: both; } -.wall-item-name-link { +.wall-item-name-link, +.shared-author { font-weight: bold; text-decoration: none; color: #3172BD; diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 00d49b8a6..81c4e690a 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1242,7 +1242,8 @@ section #jotOpen { .media-heading { margin: 0 0 5px; } -.wall-item-name { +.wall-item-name, +.shared-author { font-size: 15px; font-weight: bold; } @@ -1572,6 +1573,7 @@ ul.dropdown-menu li:hover { /* Media Classes */ .media .time, +.media .shared-time, .media .location, .media .location a { font-size: 11px; diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index ebe8a895b..d53c2f393 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -1426,6 +1426,15 @@ section.minimal { font-size: 12px; } +.shared-time { + color: #999; + font-size: 12px; +} + +.shared_header { + line-height: 14px; +} + .wall-item-network { color: #999; font-size: 12px; @@ -1504,7 +1513,8 @@ section.minimal { color: #36c; } -.wall-item-container .wall-item-name { +.wall-item-container .wall-item-name, +.wall-item-container .shared-author { color: black; font-weight: bold; -webkit-transition: all 0.2s ease-in-out; @@ -1515,7 +1525,9 @@ section.minimal { } .toplevel_item:hover .wall-item-name, -.wall-item-container:hover .wall-item-name { +.wall-item-container:hover .wall-item-name, +.toplevel_item:hover .shared-author, +.wall-item-container:hover .shared-author { color: #36c; font-weight: bold; -webkit-transition: all 0.2s ease-in-out;