Dotclear

Changeset 2230 for plugins/doTwit


Ignore:
Timestamp:
05/08/10 16:18:51 (13 years ago)
Author:
brol
Message:

Version 1.3
externalisation de la css ; localisation ; refonte du code.

Location:
plugins/doTwit
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/doTwit/_admin.php

    r2158 r2230  
    11<?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# 
    55# Copyright (c) 2007 Valentin VAN MEEUWEN 
    66# <adresse email> 
    7 #  
     7# 
    88# Licensed under the GPL version 2.0 license. 
    99# A copy of this license is available in LICENSE file or at 
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    11 # -- END LICENSE BLOCK ------------------------------------ 
     11# ***** END LICENSE BLOCK ***** 
    1212 
    13 $core->addBehavior('initWidgets',array('doTwitBehaviors','initWidgets')); 
     13if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1414 
    15 class doTwitBehaviors 
    16 { 
    17      public static function initWidgets(&$widgets) 
    18     { 
    19           $widgets->create('dotwit',__('DoTwit'),array('DoTwit','dotwitWidget')); 
    20           $widgets->dotwit->setting('title',__('Titre (facultatif):'),''); 
    21           $widgets->dotwit->setting('idTwitter',__('Identifiant Twitter :'),''); 
    22           $widgets->dotwit->setting('pwdTwitter',__('Mot de passe Twitter :'),''); 
    23           $widgets->dotwit->setting('limit',__('Nombre de twit à afficher :'),1); 
    24           $widgets->dotwit->setting('homeonly',__('Home page only'),1,'check'); 
    25           $widgets->dotwit->setting('timeline_friends',__('Timeline amis (Timeline perso par défaut)'),1,'check'); 
    26           $widgets->dotwit->setting('display_timeout',__('Affichage du temps écoulé'),1,'check'); 
    27           $widgets->dotwit->setting('display_profil_image',__('Affichage des profils image'),1,'check'); 
    28      } 
    29 } 
    30  
     15l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); 
     16           
     17require dirname(__FILE__).'/_widgets.php'; 
    3118?> 
  • plugins/doTwit/_define.php

    r2158 r2230  
    11<?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# 
    55# Copyright (c) 2007 Valentin VAN MEEUWEN 
    66# <adresse email> 
    7 #  
     7# 
    88# Licensed under the GPL version 2.0 license. 
    99# A copy of this license is available in LICENSE file or at 
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    11 # -- END LICENSE BLOCK ------------------------------------ 
     11# ***** END LICENSE BLOCK ***** 
     12if (!defined('DC_RC_PATH')) { return; } 
    1213 
    1314$this->registerModule( 
    14      'DoTwit', 
    15      'Twitter for DotClear 2', 
    16      'Valentin VAN MEEUWEN - Exilius.net', 
    17      '1.2', 
    18      'admin' 
     15     /* Name */           "doTwit", 
     16     /* Description*/     "Twitter for DotClear 2", 
     17     /* Author */                "Valentin VAN MEEUWEN (Exilius.net), Pierre Van Glabeke (weeeb.fr)", 
     18     /* Version */        '1.3', 
     19     /* Permissions */         'admin' 
    1920); 
    2021?> 
  • plugins/doTwit/_install.php

    r2158 r2230  
    11<?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# 
    55# Copyright (c) 2007 Valentin VAN MEEUWEN 
    66# <adresse email> 
    7 #  
     7# 
    88# Licensed under the GPL version 2.0 license. 
    99# A copy of this license is available in LICENSE file or at 
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    11 # -- END LICENSE BLOCK ------------------------------------ 
     11# ***** END LICENSE BLOCK ***** 
    1212 
    1313# On lit la version du plugin 
     
    2525  
    2626# La procédure d'installation commence vraiment là 
    27 $core->setVersion('DoTwit',$m_version); 
     27$core->setVersion('doTwit',$m_version); 
    2828?> 
  • plugins/doTwit/_public.php

    r2158 r2230  
    11<?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# 
    55# Copyright (c) 2007 Valentin VAN MEEUWEN 
    66# <adresse email> 
    7 #  
     7# 
    88# Licensed under the GPL version 2.0 license. 
    99# A copy of this license is available in LICENSE file or at 
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    11 # -- END LICENSE BLOCK ------------------------------------ 
     11# ***** END LICENSE BLOCK ***** 
     12 
     13if (!defined('DC_RC_PATH')) { return; } 
     14 
     15require dirname(__FILE__).'/_widgets.php'; 
    1216 
    1317class doTwit 
     
    6872          $res = 
    6973          '<div class="doTwit">'. 
    70           ($w->title ? '<h2><a href="http://twitter.com/'.$w->idTwiter.'">'.$w->title.'</a></h2>' : ''). 
     74          ($w->title ? '<h2><a href="http://twitter.com/'.$w->idTwitter.'">'.$w->title.'</a></h2>' : ''). 
    7175          '<ul>'; 
    7276           
     
    7579          if( count($xml->status) == 0 ) 
    7680          { 
    77                $res .= 'Données indisponible sur Twitter !'; 
     81               $res .= '<p>'.__('Data inalienable on Twitter!').'</p>'; 
    7882               return $res; 
    7983          } 
    8084           
    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               ); 
    8397               $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); 
    8599               $twi['screen_name'][$nb] = (string) $elm->user->screen_name; 
    86100               $twi['name'][$nb] = (string) $elm->user->name; 
     
    90104               if( $w->display_timeout) { 
    91105                    $twi['time'][$nb] = ((int) strtotime($elm->created_at)); 
    92                     $twi['date'][$nb] = date('d/m/Y H\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>'; 
    94108                     
    95109               } 
     
    104118 
    105119               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].'" />'; 
    109123                    $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].')">'; 
    112126                    $res .= $twi['screen_name'][$i].'</a> '; 
    113127                    $res .= $twi['desc'][$i].'</div>'; 
    114                     $res .= '<div style="clear:both;height:1px;">&nbsp;</div></li>'; 
     128                    $res .= '<div class="doTwitclear">&nbsp;</div></li>'; 
    115129               }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].')">'; 
    119133                    $res .= $twi['screen_name'][$i]; 
    120134                    $res .= '</a> '.$twi['desc'][$i].'</div>'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map