예제 #1
0
파일: dialog.php 프로젝트: ioanok/symfoxid
 function displayFileDetails($folderId = 0, $folderPath = '', $file = '', $fromPlugin = true)
 {
     global $EDITOR, $DIALOG;
     $response = $DIALOG->createAjaxResponse();
     $response->addScriptCall('FB.displayExtraDetails', NULL);
     // initial var check...
     if (!isset($folderId, $folderPath, $file) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($file)) {
         return $response;
     }
     $this->loadEmbedPlugins();
     if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
         $directory = $arr['directory'];
         $URL = $arr['URL'];
         $dir = $arr['dir'];
         $fs = new wproFilesystem();
         if ($fs->fileNameOk($file) && is_file($directory . $file)) {
             $extension = strrchr($file, '.');
             foreach ($this->embedPlugins as $name => $plugin) {
                 if ($plugin->local) {
                     if ($fs->extensionOK($extension, $plugin->extensions)) {
                         if ($fromPlugin) {
                             $response->addScriptCall('FB.populateLocalOptions', $name, $plugin->getDetails($directory . $file, $response));
                         }
                         $response->addScriptCall('FB.displayExtraDetails', $plugin->displayDetails($directory . $file, $response));
                         break;
                     }
                 }
             }
             if (!$fromPlugin || $fromPlugin == 'false') {
                 $arr = $fs->getFileInfo($extension);
                 $arr['size'] = $fs->fileSize($directory . $file);
                 $arr['description'] = $DIALOG->langEngine->get('files', $arr['description']);
                 $response->addScriptCall('FB.linksPopulateLocalOptions', $arr);
             }
         }
     }
     return $response;
 }