Esempio n. 1
0
 public function prepareAttachmentLinks($data)
 {
     $photos = new GridGallery_Photos_Model_Photos();
     $id = $data['id'];
     // Called 'Extranal link', because 'link' reserved by WordPress.
     $data['external_link'] = get_post_meta($id, $photos->getMetadataField('link'), true);
     $data['target'] = get_post_meta($id, $photos->getMetadataField('target'), true);
     return $data;
 }
Esempio n. 2
0
 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);
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
 /**
  * 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);
 }
 public function isEmptyAction()
 {
     $debugEnabled = $this->getEnvironment()->isDev();
     $isEmpty = true;
     $photos = new GridGallery_Photos_Model_Photos($debugEnabled);
     $list = $photos->getAll();
     if (count($list) > 0) {
         $isEmpty = false;
     }
     return $this->response(Rsc_Http_Response::AJAX, array('isEmpty' => $isEmpty));
 }