Changeset 2230 for plugins/doTwit/_public.php
- Timestamp:
- 05/08/10 16:18:51 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/doTwit/_public.php
r2158 r2230 1 1 <?php 2 # -- BEGIN LICENSE BLOCK ----------------------------------3 # This file is part of Dotwit, a plugin for Dotclear.4 # 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of doTwit, a plugin for Dotclear. 4 # 5 5 # Copyright (c) 2007 Valentin VAN MEEUWEN 6 6 # <adresse email> 7 # 7 # 8 8 # Licensed under the GPL version 2.0 license. 9 9 # A copy of this license is available in LICENSE file or at 10 10 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 11 # -- END LICENSE BLOCK ------------------------------------ 11 # ***** END LICENSE BLOCK ***** 12 13 if (!defined('DC_RC_PATH')) { return; } 14 15 require dirname(__FILE__).'/_widgets.php'; 12 16 13 17 class doTwit … … 68 72 $res = 69 73 '<div class="doTwit">'. 70 ($w->title ? '<h2><a href="http://twitter.com/'.$w->idTwit er.'">'.$w->title.'</a></h2>' : '').74 ($w->title ? '<h2><a href="http://twitter.com/'.$w->idTwitter.'">'.$w->title.'</a></h2>' : ''). 71 75 '<ul>'; 72 76 … … 75 79 if( count($xml->status) == 0 ) 76 80 { 77 $res .= ' Données indisponible sur Twitter !';81 $res .= '<p>'.__('Data inalienable on Twitter!').'</p>'; 78 82 return $res; 79 83 } 80 84 81 foreach($xml->status as $elm) { 82 85 foreach($xml->status as $elm) { 86 87 $search = array( 88 'url' => "/(http|mailto|news|ftp|https):\/\/(([-A-z0-9\/.?_=#@+%&:~])*)/", 89 'reply' =>"/@([A-Za-z0-9-_]+)/", 90 'hashtag' => "/#([A-z0-9-_]+)/" 91 ); 92 $replace = array( 93 'url' => "<span class=\"doTwitlink\"><a href=\"$1://$2\" onclick=\"window.open(this.href); return false;\">$1://$2</a></span>", 94 'reply' =>"<span class=\"doTwitreply\"><a href=\"http://twitter.com/$1\" onclick=\"window.open(this.href); return false;\">@$1</a></span>", 95 'hashtag' => "<span class=\"doTwithashtag\"><a href=\"http://search.twitter.com/search?q=%23$1\">#$1</a></span>" 96 ); 83 97 $twi['id'][$nb] = (int) $elm->id; 84 $twi['desc'][$nb] = eregi_replace("(http|mailto|news|ftp|https)://(([-éa-z0-9\/\.\?_=#@:~])*)", "<a href=\"\\1://\\2\" target=\"_blank\" style=\"color:blue;\">\\1://\\2</a>",$elm->text);98 $twi['desc'][$nb] = preg_replace($search, $replace, $elm->text); 85 99 $twi['screen_name'][$nb] = (string) $elm->user->screen_name; 86 100 $twi['name'][$nb] = (string) $elm->user->name; … … 90 104 if( $w->display_timeout) { 91 105 $twi['time'][$nb] = ((int) strtotime($elm->created_at)); 92 $twi['date'][$nb] = date('d/m/ YH\hi', $twi['time'][$nb]);93 $twi['desc'][$nb] .= ' < a href="http://twitter.com/'.$twi['screen_name'][$nb].'/statuses/'.$twi['id'][$nb].'" target="_blank">depuis '. $twi['date'][$nb].'</a>';106 $twi['date'][$nb] = date('d/m/y H\hi', $twi['time'][$nb]); 107 $twi['desc'][$nb] .= ' <br /><span class="doTwitstatut"><a href="http://twitter.com/'.$twi['screen_name'][$nb].'/statuses/'.$elm->id.'" onclick="window.open(this.href); return false;">'.__('on').' '. $twi['date'][$nb].'</a></span>'; 94 108 95 109 } … … 104 118 105 119 if( $w->display_profil_image && $twi['img'][$i] != '' ) { 106 $res .= '<li class=" img" style="background: none;padding-left:2px;border-bottom: 1px solid silver;">';107 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" target="_blank" style="font-weight:bold;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">';108 $res .= '<img src="'.$twi['img'][$i].'" alt="'.$twi['name'][$i].'" style="float:left;margin-right:3px;margin-bottom:2px;border:1px solid silver;"/>';120 $res .= '<li class="doTwitavatar">'; 121 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" onclick="window.open(this.href); return false;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">'; 122 $res .= '<img src="'.$twi['img'][$i].'" alt="'.$twi['name'][$i].'" />'; 109 123 $res .= '</a>'; 110 $res .= '<div style="word-wrap: break-word;padding-left:30px;">';111 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" target="_blank" style="font-weight:bold;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">';124 $res .= '<div class="doTwittxt">'; 125 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" onclick="window.open(this.href); return false;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">'; 112 126 $res .= $twi['screen_name'][$i].'</a> '; 113 127 $res .= $twi['desc'][$i].'</div>'; 114 $res .= '<div style="clear:both;height:1px;"> </div></li>';128 $res .= '<div class="doTwitclear"> </div></li>'; 115 129 }else { 116 $res .= '<li style="border-bottom: 1px solid silver;">';117 $res .= '<div style="word-wrap: break-word;">';118 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" target="_blank" style="font-weight:bold;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">';130 $res .= '<li class="doTwitnoavatar">'; 131 $res .= '<div class="doTwittxt">'; 132 $res .= '<a href="http://twitter.com/'.$twi['screen_name'][$i].'" onclick="window.open(this.href); return false;" title="'.$twi['name'][$i].' ('.$twi['location'][$i].')">'; 119 133 $res .= $twi['screen_name'][$i]; 120 134 $res .= '</a> '.$twi['desc'][$i].'</div>';
Note: See TracChangeset
for help on using the changeset viewer.