예제 #1
0
파일: pix.php 프로젝트: netixx/frankiz
 protected function getCachedArray()
 {
     global $globals;
     if (!PlCache::hasGlobal('pix')) {
         PlCache::setGlobal('pix', $this->loadFile('http://pix/frankiz.xml'), $globals->cache->pix);
     }
     return PlCache::getGlobal('pix');
 }
예제 #2
0
 public static function get()
 {
     global $globals;
     if (!PlCache::hasGlobal('concert_array')) {
         PlCache::setGlobal('concert_array', self::response(), 3600);
     }
     return PlCache::getGlobal('concert_array');
 }
예제 #3
0
 public static function get()
 {
     global $globals;
     if (!PlCache::hasGlobal('meteo')) {
         PlCache::setGlobal('meteo', new GoogleWeather(), $globals->cache->meteo);
     }
     return PlCache::getGlobal('meteo');
 }
예제 #4
0
 public static function get($destination = 'toParis')
 {
     global $globals;
     if (!PlCache::hasGlobal('rer_' . $destination)) {
         PlCache::setGlobal('rer_' . $destination, self::response($destination), $globals->cache->rer);
     }
     return PlCache::getGlobal('rer_' . $destination);
 }
예제 #5
0
파일: ik.php 프로젝트: netixx/frankiz
 public function run()
 {
     global $globals;
     if (!PlCache::hasGlobal('ik')) {
         $ikapi = new API('http://ik.frankiz.net/ajax/last', false);
         $json = json_decode($ikapi->response(), true);
         if (isset($json['ik']['id']) && $json['ik']['id'] != '') {
             $json = $json['ik'];
             $filename = $globals->spoolroot . '/htdocs/data/ik/' . $json['id'] . '.jpg';
             file_put_contents($filename, base64_decode($json['base64']));
             $ik = array('id' => $json['id'], 'title' => $json['title'], 'url' => $json['url']);
             PlCache::setGlobal('ik', $ik, $globals->cache->ik);
         }
     }
     $this->assign('ik', PlCache::getGlobal('ik'));
 }
예제 #6
0
파일: pointg.php 프로젝트: netixx/frankiz
 public static function getBars()
 {
     global $globals;
     if (!PlCache::hasGlobal('bar_array')) {
         PlCache::setGlobal('bar_array', self::response(), 720);
     }
     return PlCache::getGlobal('bar_array');
 }
예제 #7
0
파일: xray.php 프로젝트: netixx/frankiz
 public function run()
 {
     global $globals;
     // google calendar pour la prochaine émission
     // MAJ 1x/jour
     $gc = "http://www.google.com/calendar/feeds/binet.radio.xray%40gmail.com/public/full?alt=json&orderby=starttime&max-results=50&singleevents=true&sortorder=ascending&futureevents=true";
     // Check if cache needs to be refreshed : if emission < now or if last check was 12h ago
     if (PlCache::hasGlobal('xray_calendar')) {
         $xray_calendar = PlCache::getGlobal('xray_calendar');
         if (!isset($xray_calendar['time']) || !isset($xray_calendar['next_time']) || time() > min($xray_calendar['next_time'], $xray_calendar['time'] + 43200)) {
             PlCache::invalidateGlobal('xray_calendar');
         }
     }
     if (!PlCache::hasGlobal('xray_calendar')) {
         $calendar_api = new API($gc, true);
         $json_calendar = json_decode($calendar_api->response(), true);
         // First emission
         $feed = $json_calendar['feed']['entry'];
         $next_show = "surprise !";
         // Update no-emission every minute
         $next_time = time() + 60;
         for ($i = 0; $i < count($feed); $i++) {
             $entry = $feed[$i];
             $title = $entry['title']['$t'];
             if ($title[0] == '_') {
                 $name = substr($title, 1);
                 $start = new DateTime($entry['gd$when'][0]['startTime']);
                 $next_show = $name . " à " . strftime('%Hh, %A', $start->getTimestamp());
                 $next_time = $start->getTimestamp();
                 break;
             }
         }
         $xray_calendar = array('emission' => $next_show, 'next_time' => $next_time, 'time' => time());
         PlCache::setGlobal('xray_calendar', $xray_calendar, $globals->cache->xray_calendar);
     }
     /*
     
     // feed x-ray pour le dernier podcast
     // MAJ 1x/jour
     $podcasts_xml = "http://x-ray/blog/?feed=podcast";
     
     if (!PlCache::hasGlobal('xray_podcast')) {
         $podcast_api = new API($podcasts_xml, false);
         $podcasts  = $this->xml2array($podcast_api->response());
     
         $last_podcast = $podcasts['rss']['channel']['item'][0];
     
         $xray_podcast = array('titre' => utf8_decode($last_podcast['title']), 'url' => $last_podcast['link'], 'description' => utf8_decode($last_podcast['itunes:subtitle']));
         PlCache::setGlobal('xray_podcast', $xray_podcast, $globals->cache->xray_podcast);
     }
     */
     // titre en cours
     // MAJ toutes les 2 mn
     $nowplaying_xml = "http://x-ray/cache/info.xml";
     if (!PlCache::hasGlobal('xray_nowplaying')) {
         $nowplaying_api = new API($nowplaying_xml, false);
         $nowplaying = $this->xml2array($nowplaying_api->response());
         if (isset($nowplaying['info'])) {
             $song = $nowplaying['info'];
             $xray_nowplaying = array('title' => $song['title'], 'artist' => $song['artist'], 'album' => $song['album'], 'cover' => $song['cover']);
             PlCache::setGlobal('xray_nowplaying', $xray_nowplaying, $globals->cache->xray_nowplaying);
         }
     }
     $this->assign('xray_calendar', PlCache::getGlobal('xray_calendar'));
     //$this->assign('xray_podcast', PlCache::getGlobal('xray_podcast'));
     $this->assign('xray_nowplaying', PlCache::getGlobal('xray_nowplaying'));
 }