Changeset 136
- Timestamp:
- 06/28/09 18:06:25 (8 months ago)
- Location:
- branches/pre-1.0
- Files:
-
- 1 added
- 2 modified
- 15 copied
-
. (copied) (copied from trunk)
-
README (copied) (copied from trunk/README)
-
cfg/config.sample.php (copied) (copied from trunk/cfg/config.sample.php) (1 diff)
-
cron/cron.php (copied) (copied from trunk/cron/cron.php)
-
lib/Pubwich.php (copied) (copied from trunk/lib/Pubwich.php) (5 diffs)
-
lib/Services/Atom.php (copied) (copied from trunk/lib/Services/Atom.php) (2 diffs)
-
lib/Services/Delicious.php (copied) (copied from trunk/lib/Services/Delicious.php) (2 diffs)
-
lib/Services/Facebook.php (modified) (2 diffs)
-
lib/Services/Flickr.php (copied) (copied from trunk/lib/Services/Flickr.php) (2 diffs)
-
lib/Services/Lastfm.php (copied) (copied from trunk/lib/Services/Lastfm.php) (3 diffs)
-
lib/Services/RSS.php (copied) (copied from trunk/lib/Services/RSS.php)
-
lib/Services/Readernaut.php (copied) (copied from trunk/lib/Services/Readernaut.php) (2 diffs)
-
lib/Services/Service.php (modified) (2 diffs)
-
lib/Services/Twitter.php (copied) (copied from trunk/lib/Services/Twitter.php)
-
lib/Services/Vimeo.php (copied) (copied from trunk/lib/Services/Vimeo.php)
-
lib/Services/Youtube.php (copied) (copied from trunk/lib/Services/Youtube.php)
-
themes/default/functions.php (added)
-
themes/default/index.tpl.php (copied) (copied from trunk/themes/default/index.tpl.php) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pre-1.0/cfg/config.sample.php
r132 r136 3 3 // @@@ Renommer ce fichier en `config.php` 4 4 5 // À changer en production 6 error_reporting( E_ALL ^ E_NOTICE ); 7 // error_reporting( 0 ); 8 9 define( 'PUBWICH_LOGLEVEL', 0 ); 10 11 define('PUBWICH_URL', 'http://localhost/pubwich/'); 12 define('PUBWICH_THEME', 'default'); 13 14 // Localisation 15 date_default_timezone_set( 'America/Montreal' ); 16 setlocale( LC_ALL, 'fr_CA.UTF8', 'fr_FR.UTF8', 'fr.UTF8', 'fr_FR.UTF-8', 'fr.UTF-8' ); 17 18 // Configuration de Pubwich et des services utilisés 19 20 define( 'FLICKR_KEY', '__________________' ); 21 define( 'FLICKR_USERID', '__________________' ); // http://idgettr.com 22 define( 'FLICKR_USERNAME' '__________________' ); 23 define( 'FLICKR_TOTAL', 12 ); 24 25 define( 'LASTFM_KEY', '__________________' ); 26 define( 'LASTFM_USERNAME', '__________________' ); 27 define( 'LASTFM_TOTAL', 10 ); 28 29 define( 'DELICIOUS_USERNAME', '__________________' ); 30 define( 'DELICIOUS_TOTAL', 10 ); 31 32 define( 'TWITTER_USERID', '__________________' ); // cliquer sur le lien "RSS feed of _____'s updates" pour trouver votre identifiant numérique 33 define( 'TWITTER_USERNAME', '__________________' ); 34 define( 'TWITTER_TOTAL', 10 ); 35 36 define( 'READERNAUT_USERNAME', '__________________' ); 37 define( 'READERNAUT_TOTAL', 10 ); 38 39 define( 'YOUTUBE_USERNAME', '__________________' ); 40 define( 'YOUTUBE_TOTAL', 10 ); 41 42 Pubwich::setServices( 43 array( 44 array('Flickr', 'photos', array( FLICKR_KEY, FLICKR_USERID, FLICKR_USERNAME, FLICKR_TOTAL ) ), 45 array('Lastfm', 'albums', array ( LASTFM_KEY, LASTFM_USERNAME, LASTFM_TOTAL ) ), 46 array('Delicious', 'liens', array( DELICIOUS_USERNAME, DELICIOUS_TOTAL ) ), 47 array('Twitter', 'etats', array( TWITTER_USERID, TWITTER_USERNAME, TWITTER_TOTAL ) ), 48 array('Readernaut', 'livres', array( READERNAUT_USERNAME, READERNAUT_TOTAL ) ), 49 array('Atom', 'billets', array( 'http://remiprevost.com/atom/', 10 ) ), 50 array('Youtube', 'videos', array( YOUTUBE_USERNAME, YOUTUBE_TOTAL ) ), 51 ) 52 ); 53 54 // Système de cache 55 define( 'CACHE_LOCATION', dirname(__FILE__) . '/../cache/' ); 56 define( 'CACHE_LIMIT', 20 * 60 ); // On définit une limite de temps pour la cache, au cas où la cronjob ne fonctionnerait pas 57 5 // En cours de ré-écriture! -
branches/pre-1.0/lib/Pubwich.php
r134 r136 21 21 */ 22 22 static private $classes; 23 24 static private $columns; 23 25 24 26 static private $theme_url; … … 74 76 static public function setClasses() { 75 77 require('Services/Service.php'); 76 foreach ( self::getServices() as $service ) { 77 list($nom, $variable, $config) = $service; 78 $service_instance = strtolower( $nom . '_' . $variable ); 79 ${$service_instance} = Pubwich::loadService( $nom, $config ); 80 ${$service_instance}->variable = $variable; 81 self::$classes[] = ${$service_instance}; 78 $columnCounter = 0; 79 foreach ( self::getServices() as $column ) { 80 $columnCounter++; 81 self::$columns[$columnCounter] = array(); 82 foreach( $column as $service ) { 83 84 list($nom, $variable, $config) = $service; 85 $service_instance = strtolower( $nom . '_' . $variable ); 86 ${$service_instance} = Pubwich::loadService( $nom, $config ); 87 ${$service_instance}->variable = $variable; 88 self::$classes[] = ${$service_instance}; 89 self::$columns[$columnCounter][] = &${$service_instance}; 90 91 } 82 92 } 83 93 } … … 92 102 // Création de l'objet Savant3 93 103 $tpl =& new Savant3(); 94 $tpl->addPath('template', self::getThemePath()); 95 if (!file_exists(self::getThemePath()."/index.tpl.php")) { 104 $tpl->addPath( 'template', self::getThemePath() ); 105 106 if ( !file_exists(self::getThemePath()."/index.tpl.php") ) { 96 107 throw new PubwichErreur('Le fichier <code>/themes/'.PUBWICH_THEME.'/index.tpl.php</code> n\'a pas été trouvé. Il doit être présent.'); 108 } 109 110 if ( file_exists( self::getThemePath()."/functions.php" ) ) { 111 require( self::getThemePath()."/functions.php" ); 112 self::applyTheme(); 97 113 } 98 114 … … 108 124 } 109 125 126 /** 127 * Définit le chemin vers les fichiers du thème 128 * 129 * @return string 130 */ 110 131 static public function getThemePath() { 111 132 return self::$theme_path; 112 133 } 113 134 135 /** 136 * Définit l'URL vers les fichiers du thème 137 * 138 * @return string 139 */ 114 140 static public function getThemeUrl() { 115 141 return self::$theme_url; … … 174 200 } 175 201 202 } 203 204 /** 205 * Applique les différents filtres du thème courant 206 * 207 * return void 208 */ 209 static private function applyTheme() { 210 foreach( self::$classes as $classe ) { 211 212 $classFunction = get_class( $classe ) . '_itemTemplate'; 213 if ( function_exists( $classFunction ) ) { 214 $classe->setItemTemplate( call_user_func( $classFunction ) ); 215 } 216 217 $variableFunction = get_class( $classe ) . '_'.$classe->getVariable().'_itemTemplate'; 218 if ( function_exists( $variableFunction ) ) { 219 $classe->setItemTemplate( call_user_func( $variableFunction ) ); 220 } 221 } 222 } 223 224 /** 225 * Affiche les données 226 * 227 * return string 228 */ 229 static public function getLoop() { 230 $output = ''; 231 foreach( self::$columns as $col => $classes ) { 232 $output .= '<div class="col'.$col.'">'; 233 foreach( $classes as $classe ) { 234 $output .= self::renderBox( $classe ); 235 } 236 $output .= '</div>'; 237 } 238 return $output; 239 } 240 241 /* 242 * Affiche la boite d'une classe spécifique 243 * 244 * return string 245 */ 246 static private function renderBox( &$classe ) { 247 $output = ''; 248 $output .= '<div class="boite '.strtolower(get_class($classe)).'" id="'.$classe->getVariable().'">'."\n"; 249 $output .= ' <h2><a rel="me" href="'.$classe->urlTemplate.'">'.$classe->title.'</a> <span>'.$classe->description.'</span></h2>'."\n"; 250 $output .= ' <ul class="clearfix">'."\n"; 251 $compteur = 0; 252 foreach( $classe->getData() as $item ) { 253 $compteur++; 254 if ($classe->total && $compteur > $classe->total) { break; } 255 $template = $classe->getItemTemplate(); 256 $output .= ' '.$classe->renderItemTemplate( $template, $classe->populateItemTemplate( $item ) ); 257 } 258 $output .= ' </ul>'."\n"; 259 $output .= '</div>'."\n\n"; 260 return $output; 176 261 } 177 262 -
branches/pre-1.0/lib/Services/Atom.php
r132 r136 3 3 class Atom extends Service { 4 4 5 private $url_template = '%s'; 6 public $feed_url; 5 public function __construct( $config ){ 6 $this->setURL( $config['url'] ); 7 $this->total = $total; 7 8 8 public function __construct( $config ){9 list($url, $total) = $config;10 $this->set URL( sprintf( $this->url_template, $url ));11 $this-> feed_url = $url;12 $this->total = $total; 9 $this->title = $config['title']; 10 $this->description = $config['description']; 11 $this->setItemTemplate('<li><a href="{%link%}">{%title%}</a> {%date%}</li>'."\n"); 12 $this->setURLTemplate( $config['link'] ); 13 13 14 parent::__construct(); 14 15 } … … 24 25 } 25 26 27 public function populateItemTemplate( &$item ) { 28 $link = $item->link->attributes(); 29 $link = $link->href; 30 return array( 31 'link' => htmlspecialchars( $link ), 32 'title' => SmartyPants( $item->title ), 33 'date' => Pubwich::time_since( $item->published ) 34 ); 35 } 36 26 37 } -
branches/pre-1.0/lib/Services/Delicious.php
r132 r136 3 3 class Delicious extends Service { 4 4 5 private $url_template = 'http://feeds.delicious.com/v2/rss/%s?count=%s';6 5 public $username; 7 6 8 7 public function __construct( $config ){ 9 list($username, $total) = $config; 10 $this->setURL( sprintf( $this->url_template, $username, $total ) ); 11 $this->username = $username; 8 $this->setURL( sprintf( 'http://feeds.delicious.com/v2/rss/%s?count=%s', $config['username'], $config['total'] ) ); 9 $this->username = $config['username']; 10 11 $this->title = $config['title']; 12 $this->description = $config['description']; 13 $this->setItemTemplate('<li><a href="{%link%}">{%title%}</a></li>'."\n"); 14 $this->setURLTemplate('http://del.icio.us/'.$config['username'].'/'); 15 12 16 parent::__construct(); 17 13 18 } 14 19 … … 22 27 return $data->channel->item; 23 28 } 29 30 public function populateItemTemplate( &$item ) { 31 return array( 32 'link' => htmlspecialchars( $item->link ), 33 'title' => SmartyPants( $item->title ) 34 ); 35 } 24 36 25 37 } -
branches/pre-1.0/lib/Services/Facebook.php
r106 r136 7 7 8 8 public function __construct( $config ){ 9 list($id, $key, $total) = $config; 10 $this->setURL( sprintf( $this->url_template, $id, $id, $key ) ); 11 $this->total = $total; 9 $this->setURL( sprintf( 'http://www.facebook.com/feeds/status.php?id=%d&viewer=%d&key=%s&format=rss20', $config['id'], $config['id'], $config['key'] ) ); 10 $this->total = $config['total']; 11 $this->username = $config['username']; 12 13 $this->title = $config['title']; 14 $this->description = $config['description']; 15 $this->setItemTemplate('<li><a href="{%link%}">{%title%}</a> {%date%}</li>'."\n"); 16 $this->setURLTemplate('http://www.facebook.com/'.$config['username'].'/'); 17 12 18 parent::__construct(); 13 19 } … … 22 28 return $data->channel->item; 23 29 } 30 31 public function populateItemTemplate( &$item ) { 32 return array( 33 'link' => htmlspecialchars( $item->link ), 34 'title' => $item->title, 35 'date' => Pubwich::time_since( $item->pubDate ) 36 ); 37 } 24 38 25 39 } 26 -
branches/pre-1.0/lib/Services/Flickr.php
r132 r136 3 3 class Flickr extends Service { 4 4 5 private $url_template = 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=%s&user_id=%s&per_page=%d';6 5 public $username; 6 private $compteur, $row; 7 7 8 8 public function __construct( $config ){ 9 list($key, $id, $username, $total) = $config; 10 $this->setURL( sprintf( $this->url_template, $key, $id, $total ) ); 11 $this->username = $username; 9 $this->compteur = 0; 10 $this->setURL( sprintf( 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=%s&user_id=%s&per_page=%d', $config['key'], $config['userid'], $config['total'] ) ); 11 $this->username = $config['username']; 12 $this->row = $config['row']; 13 14 $this->title = $config['title']; 15 $this->description = $config['description']; 16 $this->setItemTemplate('<li{%classe%}><a href="{%link%}"><img src="{%photo%}" alt="{%title%}" /></a></li>'."\n"); 17 $this->setURLTemplate('http://www.flickr.com/photos/'.$config['username'].'/'); 18 12 19 parent::__construct(); 13 20 } … … 21 28 $data = parent::getData(); 22 29 return $data->photos->photo; 30 } 31 32 public function populateItemTemplate( &$item ) { 33 $this->compteur++; 34 return array( 35 'link' => $this->urlTemplate . $item['id'].'/', 36 'title' => htmlspecialchars( $item['title'] ), 37 'photo' => $this->getAbsoluteUrl( $item ), 38 'classe' => ($this->compteur % $this->row == 0 ) ? ' class="derniere"' : '' 39 ); 23 40 } 24 41 -
branches/pre-1.0/lib/Services/Lastfm.php
r132 r136 3 3 class LastFM extends Service { 4 4 5 p rivate $url_template = 'http://ws.audioscrobbler.com/2.0/?method=user.getweeklyalbumchart&api_key=%s&user=%s';6 p ublic $username;5 public $username, $size; 6 private $compteur, $key, $classes; 7 7 8 8 public function __construct( $config ){ 9 list($key, $username, $total) = $config; 10 $this->setURL( sprintf( $this->url_template, $key, $username ) ); 11 $this->total = $total; 12 $this->username = $username; 9 $this->setURL( sprintf( 'http://ws.audioscrobbler.com/2.0/?method=user.getweeklyalbumchart&api_key=%s&user=%s', $config['key'], $config['username'] ) ); 10 $this->total = $config['total']; 11 $this->username = $config['username']; 12 $this->size = $config['size']; 13 $this->key = $config['key']; 14 $this->compteur = 0; 15 $this->classes = array( 'premier', 'deuxieme', 'troisieme', 'quatrieme' ); 16 17 $this->title = $config['title']; 18 $this->description = $config['description']; 19 $this->setItemTemplate('<li{%classe%}><a href="{%link%}"><img src="{%image%}" width="{%size%}" height="{%size%}" alt="{%title%}"><strong><span>{%artist%}</span> {%album%}</strong></a></li>'."\n"); 20 $this->setURLTemplate('http://www.last.fm/user/'.$config['username'].'/'); 21 13 22 parent::__construct(); 23 } 24 25 public function populateItemTemplate( &$item ) { 26 $album = Smartypants( $item->name ); 27 $artist = Smartypants( $item->artist ); 28 $this->compteur++; 29 return array( 30 'link' => htmlspecialchars( $item->url ), 31 'title' => htmlspecialchars( $artist . ' — ' . $album ), 32 'artist' => $artist, 33 'album' => $album, 34 'image' => $this->getImage( $item ), 35 'size' => $this->size, 36 'classe' => isset($this->classes[$this->compteur-1]) ? ' class="'.$this->classes[$this->compteur-1].'"' : '', 37 ); 14 38 } 15 39 … … 92 116 } else { 93 117 $Cache_Lite->get( $id ); 94 $url = sprintf( "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=%s&artist=%s&album=%s", LASTFM_KEY, urlencode( $album->artist ), urlencode( $album->name ) );118 $url = sprintf( "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=%s&artist=%s&album=%s", $this->key, urlencode( $album->artist ), urlencode( $album->name ) ); 95 119 $data = FileFetcher::get( $url ); 96 120 $Cache_Lite->save( $data ); … … 108 132 public function buildAlbumCache( $rebuildCache ) { 109 133 $data = $this->getData(); 134 $compteur = 0; 110 135 if ( $data ) { 111 136 foreach ( $this->getData() as $album ) { 137 $compteur++; 138 if ($compteur > $this->total) { break; } 112 139 $this->fetchAlbum( $album, $rebuildCache ); 113 140 } -
branches/pre-1.0/lib/Services/Readernaut.php
r132 r136 3 3 class Readernaut extends Service { 4 4 5 private $url_template = 'http://readernaut.com/api/v1/xml/%s/books/?order_by=-created';6 5 public $username; 6 private $size; 7 7 8 8 public function __construct( $config ){ 9 list($username, $total) = $config; 10 $this->setURL( sprintf( $this->url_template, $username ) ); 11 $this->total = $total; 12 $this->username = $username; 9 $this->setURL( sprintf( 'http://readernaut.com/api/v1/xml/%s/books/?order_by=-created', $config['username'] ) ); 10 $this->total = $config['total']; 11 $this->username = $config['username']; 12 $this->size = $config['size']; 13 14 $this->title = $config['title']; 15 $this->description = $config['description']; 16 $this->setItemTemplate('<li><a href="{%link%}"><img src="{%image%}" width="{%size%}" alt="{%title%}" /><strong><span>{%title%}</span> {%author%}</strong></a></li>'."\n"); 17 $this->setURLTemplate('http://www.readernaut.com/'.$config['username'].'/'); 18 13 19 parent::__construct(); 14 20 } … … 23 29 return $data->reader_book; 24 30 } 31 32 public function populateItemTemplate( &$item ) { 33 return array( 34 'link' => $item->book_edition->permalink, 35 'title' => SmartyPants( $item->book_edition->title ), 36 'author' => SmartyPants( $item->book_edition->authors->author ), 37 'image' => $item->book_edition->covers->cover_small, 38 'size' => $this->size 39 ); 40 } 25 41 26 42 } -
branches/pre-1.0/lib/Services/Service.php
r106 r136 8 8 class Service { 9 9 10 public $data, $cache_id, $cache_options ;10 public $data, $cache_id, $cache_options, $itemTemplate, $title, $description, $urlTemplate; 11 11 private $url; 12 12 … … 103 103 } 104 104 105 /** 106 * Retourne le nom de la variable de l'instance 107 * 108 * return string 109 */ 105 110 public function getVariable() { 106 111 return $this->variable; 107 112 } 113 114 /** 115 * Définit le template de l'URL de profil du service 116 * 117 * return void 118 */ 119 public function setURLTemplate( $template ) { 120 $this->urlTemplate = $template; 121 } 122 123 /** 124 * 125 * 126 * 127 */ 128 public function setItemTemplate($template) { 129 $this->itemTemplate = $template; 130 } 131 132 /** 133 * 134 * 135 * 136 */ 137 public function getItemTemplate() { 138 return $this->itemTemplate; 139 } 140 141 /** 142 * Retourne un item selon un template et des données 143 * 144 * @param string $template 145 * @param array $data 146 * 147 * return string 148 */ 149 public function renderItemTemplate( $template, $data ) { 150 foreach ($data as $key=>$value) { 151 $template = str_replace( '{%'.$key.'%}', $value, $template ); 152 } 153 return $template; 154 } 108 155 109 156 } -
branches/pre-1.0/themes/default/index.tpl.php
r132 r136 14 14 <div class="clearfix"> 15 15 16 <div class="col1"> 17 <div class="boite wtf"> 18 <h2>Introduction</h2> 19 <div> <?php 20 echo SmartyPants(' 21 <p> 22 Voici mon petit texte d’introduction amusant. 23 </p> 24 '); 25 ?> 26 27 </div> 28 </div> 29 30 <div class="boite flickr" id="flickr"> 31 <h2><a rel="me" href="http://flickr.com/photos/<?=$this->photos->username?>/">Flick<em>r</em></a> <span>dernières photos postées</span></h2> 32 <?php 33 if ( !$this->photos->getData() ) { ?> 34 <div class="erreur"> 35 L’API public de <a href="http://flickr.com/">flickr.com</a> semble éprouver des problèmes. 36 </div> 37 <? 38 } else { 39 ?> 40 <ul class="clearfix"> 41 <? 42 $compteur = 0; 43 foreach ($this->photos->getData() as $photo) { 44 $compteur++; 45 ?> 46 <li<?=($compteur%4 == 0)?' class="derniere"':''?>><a title="<?=$photo['title']?>" href="http://www.flickr.com/photos/<?=$this->photos->username?>/<?=$photo['id']?>"><img alt="<?=$photo['title']?>" src="<?=$this->photos->getAbsoluteUrl($photo, 's')?>" width="75" height="75"></a></li> 47 <? } ?> 48 </ul> 49 <? 50 } 51 ?> 52 </div> 53 54 <div class="boite lastfm" id="lastfm"> 55 <h2><a rel="me" href="http://last.fm/user/<?=$this->albums->username?>/">last.fm</a> <span>albums les plus écoutés durant la dernière semaine</span></h2> 56 <?php 57 if ( !$this->albums->getData() ) { ?> 58 <div class="erreur"> 59 L’API public de <a href="http://last.fm/">last.fm</a> semble éprouver des problèmes. 60 </div> 61 <? 62 } else { 63 ?> 64 <ul> 65 <?php 66 $classes = array('premier', 'deuxieme', 'troisieme', 'quatrieme'); 67 $compteur = 0; 68 foreach ( $this->albums->getData() as $album ) { 69 $compteur++; 70 if ( $compteur > $this->albums->total ) { break; } 71 $image = $this->albums->getImage($album); 72 ?> 73 <li class="<?=$classes[$compteur-1]?>"> 74 <a href="<?=$album->url?>"><img height="64" width="64" src="<?=$image?>" alt=""><strong><span><?=Smartypants($album->artist)?></span> <?=Smartypants($album->name)?></strong></a> 75 </li> 76 <? } ?> 77 </ul> 78 <? } ?> 79 </div> 80 </div> 81 82 <div class="col2"> 83 <div class="boite twitter" id="twitter"> 84 <h2><a rel="me" href="http://twitter.com/<?=$this->etats->username?>/">Twitter</a> <span>derniers états postés</span></h2> 85 <?php 86 if ( !$this->etats->getData() ) { ?> 87 <div class="erreur"> 88 L’API public de <a href="http://twitter.com/">Twitter</a> semble éprouver des problèmes. 89 </div> 90 <? 91 } else { 92 ?> 93 <ul class="clearfix"> 94 <?php 95 foreach ( $this->etats->getData() as $etat ) { 96 $date = Pubwich::time_since( $etat->created_at ); 97 $text = $this->etats->filterContent( $etat->text ); 98 ?> 99 <li class="clearfix"> 100 <span class="date"><a href="http://twitter.com/<?=$this->etats->username?>/statuses/<?=$etat->id?>"><?=$date?></a></span> 101 <?=$text?> 102 </li> 103 <? } ?> 104 </ul> 105 <? } ?> 106 </div> 107 108 <div class="boite rss" id="rss-1"> 109 <h2><a rel="me" href="<?=$this->billets->feed_url?>">Fil RSS</a> <span>derniers billets</span></h2> 110 <?php 111 if ( !$this->billets->getData() ) { ?> 112 <div class="erreur"> 113 Le fil RSS <?=$this->billets->feed_url?> semble éprouver des problèmes. 114 </div> 115 <? } else { ?> 116 <ul> 117 <?php 118 $compteur = 0; 119 foreach ( $this->billets->getData() as $billet ) { 120 $compteur++; 121 if ( $compteur > $this->billets->total ) { break; } 122 ?> 123 <li> 124 <a href="<?=$billet->link?>"><?=$billet->title?></a> <small>(<?=Pubwich::time_since( $billet->published )?>)</small> 125 </li> 126 <? } ?> 127 </ul> 128 <? } ?> 129 </div> 130 </div> 131 132 <div class="col3"> 133 <div class="boite delicious" id="delicious"> 134 <h2><a rel="me" href="http://del.icio.us/<?=$this->liens->username?>/">del.icio.us</a> <span>derniers liens partagés</span></h2> 135 <?php 136 if ( !$this->liens->getData() ) { ?> 137 <div class="erreur"> 138 L’API public de <a href="http://delicious.com/">del.icio.us</a> semble éprouver des problèmes. 139 </div> 140 <? 141 } else { 142 ?> 143 <ul> 144 <?php foreach ( $this->liens->getData() as $lien ) { ?> 145 <li><a href="<?=htmlspecialchars( $lien->link )?>"><?=$lien->title ?></a></li> 146 <? } ?> 147 </ul> 148 <? } ?> 149 </div> 150 151 <div class="boite readernaut" id="readernaut"> 152 <h2><a rel="me" href="http://readernaut.com/<?=$this->livres->username?>/">Readernaut</a> <span>derniers livres ajoutés</span></h2> 153 <?php 154 if ( !$this->livres->getData() ) { ?> 155 <div class="erreur"> 156 L'API public de <a href="http://readernaut.com/">Readernaut</a> semble éprouver des problèmes. 157 </div> 158 <? 159 } else { 160 ?> 161 <ul class="clearfix"> 162 <?php 163 $compteur = 0; 164 foreach ( $this->livres->getData() as $livre ) { 165 $compteur++; 166 if ( $compteur > $this->livres->total ) { break; } 167 ?> 168 <li> 169 <a href="<?=$livre->book_edition->permalink?>"><img src="<?=$livre->book_edition->covers->cover_small?>" width="50" alt=""><strong><span><?=Smartypants($livre->book_edition->title)?></span> <?=Smartypants($livre->book_edition->authors->author)?></strong></a> 170 </li> 171 <? } ?> 172 </ul> 173 <? } ?> 174 </div> 175 <div class="boite youtube" id="youtube"> 176 <h2><a rel="me" href="http://youtube.com/user/<?=$this->videos->username?>/">Youtube</a> <span>derniers vidéos ajoutés</span></h2> 177 <?php 178 if ( !$this->videos->getData() ) { ?> 179 <div class="erreur"> 180 L’API public de <a href="http://youtube.com/">Youtube</a> semble éprouver des problèmes. 181 </div> 182 <? 183 } else { 184 ?> 185 <ul class="clearfix"> 186 <?php 187 $compteur = 0; 188 foreach ( $this->videos->getData() as $video ) { 189 $compteur++; 190 if ( $compteur > $this->videos->total ) { break; } 191 ?> 192 <li> 193 <? 194 $media = $video->children('http://search.yahoo.com/mrss/'); 195 $attrs = $media->group->thumbnail[0]->attributes(); 196 $img = $attrs['url']; 197 $title = (string) $media->group->title; 198 $url_attrs = $media->group->player->attributes(); 199 $url = $url_attrs['url']; 200 ?> 201 <a href="<?=$url?>"><img src="<?=$img?>" alt="<?=htmlspecialchars($title)?>" /><strong><?=$title?></strong></a> 202 </li> 203 <? } ?> 204 </ul> 205 <? } ?> 206 </div> 207 <div class="boite credits"> 208 <h2>Crédits</h2> 209 <p>Propulsé par <a href="http://pubwich.com/" class="pubwich"><strong>Pubwich</strong></a>, <a href="http://php.net">PHP 5</a>, <a href="http://ca2.php.net/simplexml">SimpleXML</a>, <a href="http://phpsavant.com/yawiki/index.php?area=Savant3">Savant3</a>, <a href="http://pear.php.net/package/Cache_Lite/">Cache_Lite</a>, <a href="http://michelf.com/projets/php-smartypants/">PHP Smartypants</a> et <a href="http://michelf.com/projets/php-markdown/">PHP Markdown</a>. 210 </div> 211 </div> 16 <?=Pubwich::getLoop()?> 212 17 213 18 </div>
