Exemplo n.º 1
0
 /**
  * Return the comments for a strip
  *
  * @param Strip $strip The strip for which we want obtain the comments
  * @param Lang $lang The language object is use when the connection with forum isn't ok
  * @access public
  * @static
  * @return string The comments for the strip or an error message if the connection with forum isn't ok
  */
 public static function getComments(Strip $strip, Lang $lang)
 {
     $url = Config::getFluxbbForum() . '/extern.php?action=topic&ttitle=' . urlencode($strip->getTitle()) . '&max_subject_length=' . Config::getFluxbbMaxLength();
     $text = file_get_contents($url);
     if ($text === false) {
         $text = $lang->getForumError();
     } else {
         $text = utf8_encode($text);
     }
     return $text;
 }
Exemplo n.º 2
0
 /**
  * This method launch the job
  *
  * @access protected
  * @static
  */
 protected static function launch()
 {
     Strip::createCache();
 }
Exemplo n.º 3
0
 /**
  * Return the strip with the numeric key of the cache
  *
  * @access public
  * @static
  * @return Strip The strip wanted
  */
 public static function getStrip($id = 0)
 {
     $last_id = self::getLastId();
     // if the id of strip isn't valid, return a new strip
     if ($last_id === -1 || $id > $last_id) {
         return new Strip();
     }
     $cache_iterator = new ArrayIterator(self::$cache);
     $cache_iterator->seek($id);
     return Strip::getCache($cache_iterator->key());
 }
Exemplo n.º 4
0
 /**
  * Create cache for one or all necessary strips
  *
  * @param string $file The filename of the strip for which we must regenerate cache or null if we must regenerate all cache file necessary
  * @access public
  * @static
  */
 public static function createCache($file = null)
 {
     if ($file === null) {
         // we must regenerate all SVG cache
         $actual_cache = Cache::getCache();
         Cache::setCache();
         $new_cache = Cache::getCache();
         $compare = array_diff($new_cache, $actual_cache);
         foreach ($compare as $filename => $time) {
             $strip = new Strip($filename, true);
             $strip->setCache();
         }
     } else {
         $strip = new Strip($file, true);
         $strip->setCache();
     }
 }