/** * Returns the array of the photos in specified folder * @param int $folderId The identifier of the folder * @return array|null */ public function getPhotosById($folderId) { if (!class_exists('GridGallery_Photos_Model_Photos', false)) { if ($this->debugEnabled) { wp_die(sprintf('The required class \'GridGallery_Photos_Model_Photos\' is does not exists in method', __METHOD__)); } return null; } $photos = new GridGallery_Photos_Model_Photos($this->debugEnabled); return $photos->getPhotosByFolderId($folderId); }
protected function remove($galleryId, array $identifiers) { $folders = array(); $photos = null; foreach ($identifiers as $resourceId) { if ($this->photoExists($galleryId, $resourceId)) { $this->removePhotoFromGallery($galleryId, $resourceId); } else { if (empty($folders)) { $folders = $this->getGalleryFolders($galleryId); } if (null === $photos) { $photos = new GridGallery_Photos_Model_Photos($this->debugEnabled); } foreach ($folders as $folder) { $folderId = $folder->resource_id; $folderPhotos = $photos->getPhotosByFolderId($folderId); if ($folderPhotos) { foreach ($folderPhotos as $folderPhoto) { if ($folderPhoto->id === $resourceId) { $this->exclude($galleryId, $folderId, $resourceId); } } } } } } }