Ansel_Gallery::countImages PHP Method

countImages() public method

Returns the number of images in this gallery and, optionally, all sub-galleries.
public countImages ( boolean $subgalleries = false ) : integer
$subgalleries boolean Determines whether subgalleries should be counted or not.
return integer number of images in this gallery
    public function countImages($subgalleries = false)
    {
        return $this->_modeHelper->countImages($subgalleries);
    }

Usage Example

示例#1
0
文件: Gallery.php 项目: horde/horde
 /**
  * @param boolean $retry
  *
  * @return Ansel_Gallery
  */
 private function _getGallery($retry = false)
 {
     // Make sure we haven't already selected a gallery.
     if ($this->_gallery instanceof Ansel_Gallery) {
         return $this->_gallery;
     }
     // Get the gallery object and cache it.
     if (isset($this->_params['gallery']) && $this->_params['gallery'] != '__random') {
         $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->_params['gallery']);
     } else {
         $this->_gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getRandomGallery();
     }
     // Protect at least a little bit against getting an empty gallery. We
     // can't just loop until we get one with images since it's possible we
     // actually don't *have* any with images yet.
     if ($this->_params['gallery'] == '__random' && !empty($this->_gallery) && !$this->_gallery->countImages() && $this->_gallery->hasSubGalleries() && !$retry) {
         $this->_gallery = null;
         $this->_gallery = $this->_getGallery(true);
     }
     if (empty($this->_gallery)) {
         throw new Horde_Exception_NotFound(_("Gallery does not exist."));
     } elseif (!$this->_gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW) || !$this->_gallery->isOldEnough() || $this->_gallery->hasPasswd()) {
         throw new Horde_Exception_PermissionDenied(_("Access denied viewing this gallery."));
     }
     // Return the gallery.
     return $this->_gallery;
 }
All Usage Examples Of Ansel_Gallery::countImages