Browse Source

- Fix a couple of little issues for the Vcard and Post formating

pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
0d48b231d8
  1. 4
      app/helpers/DateHelper.php
  2. 9
      app/helpers/StringHelper.php
  3. 4
      app/widgets/ContactCard/ContactCard.php
  4. 4
      app/widgets/WidgetCommon/WidgetCommon.php

4
app/helpers/DateHelper.php

@ -45,7 +45,7 @@ function getTimezoneCorrection() {
* @param timestamp $string
* @return string
*/
function prepareDate($time, $hours = true) {
function prepareDate($time, $hours = true) {
$dotw = getDays();
$moty = getMonths();
@ -81,7 +81,7 @@ function prepareDate($time, $hours = true) {
}
if($hours)
$date .= ' - '. date('H:i', $time);
if($time)
return $date;
}

9
app/helpers/StringHelper.php

@ -76,7 +76,14 @@ function prepareString($string) {
}
}, ' ' . $string
);
// We remove all the style attributes
$string = preg_replace_callback(
'/(<[^>]+) style=".*?"/i', function($match) {
return $match[1];
}, $string
);
// Twitter hashtags
$string = preg_replace_callback(
"/ #[a-zA-Z0-9_-]*/", function ($match) {

4
app/widgets/ContactCard/ContactCard.php

@ -58,10 +58,10 @@ class ContactCard extends WidgetCommon
<span>'.$contact->name.'</span>
</div>';
if($this->testIsSet($contact->date))
if(strtotime($contact->date) != 0)
$html .= '<div class="element simple">
<label for="day">'.t('Date of Birth').'</label>
<span>'.date('j M Y',strtotime($contact->date)).'</span>
<span>'.prepareDate(strtotime($contact->date), false).'</span>
</div>';
if($contact->gender != 'N' && $this->testIsSet($contact->gender))

4
app/widgets/WidgetCommon/WidgetCommon.php

@ -53,7 +53,7 @@ class WidgetCommon extends WidgetBase {
if(current(explode('.', $post->jid)) == 'nsfw')
$spoiler = ' movim_toggle_class(this, \'show\')';
if($this->user->getLogin() == $post->aid) {
$class = 'me ';
@ -67,6 +67,8 @@ class WidgetCommon extends WidgetBase {
}
$avatar = $post->getContact()->getPhoto('m');
} elseif(isset($post->aid)) {
$avatar = $post->getContact()->getPhoto('m', $post->aid);
// A little hack which display a colored avatar for the Groups
} elseif(!filter_var($post->jid, FILTER_VALIDATE_EMAIL) && $post->node != '') {
$avatar = $post->getContact()->getPhoto('m', $post->node);

Loading…
Cancel
Save