Browse Source

- Fix some warnings and XHTML errors

pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
c41eb3d651
  1. 2
      app/views/page.tpl
  2. 14
      app/widgets/Bookmark/_bookmark_list.tpl
  3. 54
      app/widgets/Chat/Chat.php
  4. 2
      app/widgets/Feed/Feed.php
  5. 4
      app/widgets/Feed/feed.css
  6. 2
      app/widgets/Profile/Profile.php
  7. 1
      app/widgets/Roster/_roster_contact.tpl
  8. 28
      system/Utils.php

2
app/views/page.tpl

@ -9,7 +9,7 @@
<link rel="stylesheet" href="<?php echo BASE_URI; ?>app/assets/js/leaflet.css" />
<script src="<?php echo BASE_URI; ?>app/assets/js/leaflet.js"></script>
<meta name="viewport" content="width=device-width, user-scalable=no";>
<meta name="viewport" content="width=device-width, user-scalable=no">
<?php
$this->addCss('css/animations.css');

14
app/widgets/Bookmark/_bookmark_list.tpl

@ -1,10 +1,12 @@
<h2>{$c->t('Conferences')}</h2>
{loop="conferences"}
<li>
<a href="#" onclick="{$c->getMucJoin($value)}">{$value->name}</a>
<a href="#" onclick="{$c->getMucRemove($value)}">X</a>
</li>
{/loop}
<ul>
{loop="conferences"}
<li>
<a href="#" onclick="{$c->getMucJoin($value)}">{$value->name}</a>
<a href="#" onclick="{$c->getMucRemove($value)}">X</a>
</li>
{/loop}
</ul>
<h2>{$c->t('Groups')}</h2>
{loop="subscriptions"}

54
app/widgets/Chat/Chat.php

@ -299,35 +299,39 @@ class Chat extends WidgetBase {
$message->body = $message->subject;
}
$html='<div class="message ';
if($message->session == $message->jidfrom) {
$html .= 'me';
}
if(isset($message->html)) {
$type = 'html';
$content = $message->html;
} else {
$type='';
$content = prepareString(
htmlentities($message->body, ENT_COMPAT, "UTF-8"));
}
if(preg_match("#^/me#", $message->body)) {
$html .= ' own ';
$content = '** ' . substr($message->body, 4);
}
if(preg_match("#^\?OTR:#", $message->body)) {
$html .= ' crypt ';
$content = t('Encrypted message');
}
$c = new \modl\Contact();
$html='
<div class="message ';
if($message->session == $message->jidfrom) {
$html .= 'me';
}
if(isset($message->html)) {
$type = 'html';
$content = $message->html;
} else {
$type='';
$content = prepareString(
htmlentities($message->body, ENT_COMPAT, "UTF-8"));
}
if(preg_match("#^/me#", $message->body)) {
$html .= ' own ';
$content = '** ' . substr($message->body, 4);
}
if(preg_match("#^\?OTR:#", $message->body)) {
$html .= ' crypt ';
$content = t('Encrypted message');
}
$c = new \modl\Contact();
$html .= '">
<img class="avatar" src="' . $c->getPhoto('xs', $message->jidfrom) . '" />
<img class="avatar" src="' . $c->getPhoto('xs', $message->jidfrom) . '" alt="avatar"/>
<span class="date">' . date('H:i', strtotime($message->published)) . '</span>';
if($muc != false) {
$html.='
<span class="ressource ' . $this->colorNameMuc($message->ressource) . '">' . $message->ressource . '
<span
class="ressource ' . $this->colorNameMuc($message->ressource) . '">' .
$message->ressource . '
</span>';
}
$html .= '<div class="content ' . $type . '">' . $content . '</div>

2
app/widgets/Feed/Feed.php

@ -99,7 +99,7 @@ class Feed extends WidgetCommon {
if($session->config['config'] == false) {
$html .=
'<div class="message warning" style="margin: 0 1em;">'.
'<div class="message warning">'.
t("Your server doesn't support post publication, you can only read contact's feeds").
'</div>';
} elseif(!isset($session->config['feed'])) {

4
app/widgets/Feed/feed.css

@ -1 +1,3 @@
#feedhead .message {
margin: 0 1em;
}

2
app/widgets/Profile/Profile.php

@ -95,7 +95,7 @@ class Profile extends WidgetCommon
// My avatar
$html .= '
<a href="'.Route::urlize('friend',$this->user->getLogin()).'">
<img src="'.$me->getPhoto('l').'"/>
<img src="'.$me->getPhoto('l').'" alt="avatar"/>
</a>';
// Contact general infos

1
app/widgets/Roster/_roster_contact.tpl

@ -40,6 +40,7 @@
<img
class="avatar"
src="{$value.avatar}"
alt="avatar"
/>{$value.name}
<span class="ressource">{$value.ressource}</span>
</a>

28
system/Utils.php

@ -84,6 +84,8 @@ function prepareString($string) {
);
//$string = str_replace('<a ', '<a target="_blank" ', $string);
//replace begin by www
$string = preg_replace_callback(
@ -100,7 +102,6 @@ function prepareString($string) {
//replace begin by http - https (before www)
$string = preg_replace_callback(
'/(?(?=<a[^>]*>.+<\/a>)(?:<a[^>]*>.+<\/a>)|([^="\'])((?:https?):\/\/([^<> \n\r]+)))/ix', function ($match) {
//print '<br />preg[2]';\system\Debug::dump($match);
if (isset($match[2]) && strlen($match[2])>0) {
return stripslashes($match[1].'<a href=\"'.$match[2].'\" target=\"_blank\">'.$match[3].'</a>');
} else {
@ -109,6 +110,29 @@ function prepareString($string) {
}, ' ' . $string
);
// Twitter hashtags
$string = preg_replace_callback(
"/#[a-zA-Z0-9_-]*/", function ($match) {
/*
foreach($val_hashtag[0] as $hashtag){
$twitt = str_replace($hashtag,
'<a href="http://search.twitter.com/search?q='.urlencode($hashtag).
'" target="_blank">'.$hashtag.'</a>',$twitt);
}*/
}, ' ' . $string
);
$string = preg_replace_callback(
"/@[a-zA-Z0-9_-]*/", function ($match) {
/*
foreach($val_at[0] as $at){
$twitt = str_replace($at,'<a href="http://twitter.com/'.str_replace("@","",$at).
'" target="_blank">'.$at.'</a>',$twitt);
}*/
}, ' ' . $string
);
//remove all scripts
$string = preg_replace_callback(
'#<[/]?script[^>]*>#is', function ($match) {
@ -129,7 +153,7 @@ function prepareString($string) {
$path = BASE_URI . 'themes/' . $theme . '/img/smileys/';
foreach($smileys as $key => $value) {
$replace = ' <img class="smiley" src="'.$path.$value.'">';
$replace = ' <img class="smiley" alt="smiley" src="'.$path.$value.'">';
$string = preg_replace('/(^|[ ])('.$key.')/', $replace, $string);
}

Loading…
Cancel
Save