Beispiel #1
0
 /**
  * static class returns the appropriate object for the item
  * @param rsgGallery of the parent gallery
  * @param array of the database row
  * @return the apropriate item object
  */
 function getCorrectItemObject(&$gallery, $row)
 {
     // get mime type of file
     $mimetype = MimeTypes::getMimeType($row['name']);
     // get only the general content type
     $type = explode('/', $mimetype);
     $type = $type[0];
     if (file_exists(JPATH_RSGALLERY2_ADMIN . '/includes/items/' . $type . '.php')) {
         require_once JPATH_RSGALLERY2_ADMIN . '/includes/items/' . $type . '.php';
         $itemClass = "rsgItem_{$type}";
         return new $itemClass($type, $mimetype, $gallery, $row);
     } else {
         $itemClass = "rsgItem";
         return new $itemClass($type, $mimetype, $gallery, $row);
     }
 }
 public function testMissingMimeType()
 {
     $this->assertFalse(MimeTypes::getMimeType('NoSuchExtension'));
 }