From c41eb3d651d489bb87771cebaf84cbdaac0ba803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaussoin=20Timoth=C3=A9e?= Date: Wed, 19 Mar 2014 17:17:56 +0100 Subject: [PATCH] - Fix some warnings and XHTML errors --- app/views/page.tpl | 2 +- app/widgets/Bookmark/_bookmark_list.tpl | 14 ++++--- app/widgets/Chat/Chat.php | 54 +++++++++++++------------ app/widgets/Feed/Feed.php | 2 +- app/widgets/Feed/feed.css | 4 +- app/widgets/Profile/Profile.php | 2 +- app/widgets/Roster/_roster_contact.tpl | 1 + system/Utils.php | 28 ++++++++++++- 8 files changed, 70 insertions(+), 37 deletions(-) diff --git a/app/views/page.tpl b/app/views/page.tpl index 04b657f76..83e0bab07 100644 --- a/app/views/page.tpl +++ b/app/views/page.tpl @@ -9,7 +9,7 @@ - + addCss('css/animations.css'); diff --git a/app/widgets/Bookmark/_bookmark_list.tpl b/app/widgets/Bookmark/_bookmark_list.tpl index 73f902400..ff45d16b7 100644 --- a/app/widgets/Bookmark/_bookmark_list.tpl +++ b/app/widgets/Bookmark/_bookmark_list.tpl @@ -1,10 +1,12 @@

{$c->t('Conferences')}

-{loop="conferences"} -
  • - {$value->name} - X -
  • -{/loop} +

    {$c->t('Groups')}

    {loop="subscriptions"} diff --git a/app/widgets/Chat/Chat.php b/app/widgets/Chat/Chat.php index c9f8e0546..d2098ef85 100644 --- a/app/widgets/Chat/Chat.php +++ b/app/widgets/Chat/Chat.php @@ -299,35 +299,39 @@ class Chat extends WidgetBase { $message->body = $message->subject; } - $html='
    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=' +
    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 .= '"> - + avatar ' . date('H:i', strtotime($message->published)) . ''; + if($muc != false) { $html.=' - ' . $message->ressource . ' + ' . + $message->ressource . ' '; } $html .= '
    ' . $content . '
    diff --git a/app/widgets/Feed/Feed.php b/app/widgets/Feed/Feed.php index 0363909fb..d9f5cf2d6 100644 --- a/app/widgets/Feed/Feed.php +++ b/app/widgets/Feed/Feed.php @@ -99,7 +99,7 @@ class Feed extends WidgetCommon { if($session->config['config'] == false) { $html .= - '
    '. + '
    '. t("Your server doesn't support post publication, you can only read contact's feeds"). '
    '; } elseif(!isset($session->config['feed'])) { diff --git a/app/widgets/Feed/feed.css b/app/widgets/Feed/feed.css index 8b1378917..1faddb353 100644 --- a/app/widgets/Feed/feed.css +++ b/app/widgets/Feed/feed.css @@ -1 +1,3 @@ - +#feedhead .message { + margin: 0 1em; +} diff --git a/app/widgets/Profile/Profile.php b/app/widgets/Profile/Profile.php index a77a6a437..65414b2ab 100644 --- a/app/widgets/Profile/Profile.php +++ b/app/widgets/Profile/Profile.php @@ -95,7 +95,7 @@ class Profile extends WidgetCommon // My avatar $html .= ' - + avatar '; // Contact general infos diff --git a/app/widgets/Roster/_roster_contact.tpl b/app/widgets/Roster/_roster_contact.tpl index f91821a48..e55fd49ef 100644 --- a/app/widgets/Roster/_roster_contact.tpl +++ b/app/widgets/Roster/_roster_contact.tpl @@ -40,6 +40,7 @@ avatar{$value.name} {$value.ressource} diff --git a/system/Utils.php b/system/Utils.php index c929e56bf..96dc58d66 100644 --- a/system/Utils.php +++ b/system/Utils.php @@ -84,6 +84,8 @@ function prepareString($string) { ); //$string = str_replace(']*>.+<\/a>)(?:]*>.+<\/a>)|([^="\'])((?:https?):\/\/([^<> \n\r]+)))/ix', function ($match) { - //print '
    preg[2]';\system\Debug::dump($match); if (isset($match[2]) && strlen($match[2])>0) { return stripslashes($match[1].'
    '.$match[3].''); } 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, + ''.$hashtag.'',$twitt); + }*/ + + }, ' ' . $string + ); + + $string = preg_replace_callback( + "/@[a-zA-Z0-9_-]*/", function ($match) { + /* + foreach($val_at[0] as $at){ + $twitt = str_replace($at,''.$at.'',$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 = ' '; + $replace = ' smiley'; $string = preg_replace('/(^|[ ])('.$key.')/', $replace, $string); }