コード例 #1
0
ファイル: ajax.php プロジェクト: Tommar/vino
 /**
  * Get images from Phoca Gallery Component
  */
 function getImagesFromPhoca(&$photos)
 {
     if (!is_array($photos)) {
         $photos = array();
     }
     require_once JPATH_ROOT . '/modules/mod_bt_apb/helpers/helper.php';
     $helper = new BtApbHelper();
     if (!$helper->checkPhocaComponent()) {
         $this->result["message"] = JText::_('COM_PHOCA_NOT_EXIST');
     } else {
         $rs = $helper->getPhocaPhotos(JRequest::getString('phoca_catid'));
         if (count($rs) > 0) {
             foreach ($rs as $photo) {
                 $file = JURI::root() . "images/phocagallery/" . $photo->filename;
                 $fileInfo = pathinfo($file);
                 $hashedName = md5($this->moduleID . '-' . 'phoca-' . $photo->cat_name . '-' . $fileInfo['filename']);
                 if ($file && !JFile::exists($this->saveDir . "/tmp/manager/{$hashedName}.{$fileInfo["extension"]}") && !in_array($hashedName . '.' . $fileInfo["extension"], $this->items)) {
                     $objFile = new stdClass();
                     $objFile->file = str_replace('http://', '', $file);
                     $objFile->title = $photo->title;
                     $objFile->source = 'phoca-' . $photo->cat_name;
                     $photos[] = $objFile;
                 }
             }
         }
     }
 }