当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::getFullDirectory方法代码示例

本文整理汇总了PHP中Folder::getFullDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getFullDirectory方法的具体用法?PHP Folder::getFullDirectory怎么用?PHP Folder::getFullDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder::getFullDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save($write = true, $thumbnail = true)
 {
     if (empty($this->file_directory)) {
         if ($this->folder_id) {
             $folder = new Folder($_POST['folder_id']);
             if ($folder->id) {
                 $this->setDirectory($folder->getFullDirectory());
             } else {
                 return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Multimedia::save');
             }
         } else {
             return PHPWS_Error::get(FC_DIRECTORY_NOT_SET, 'filecabinet', 'PHPWS_Multimedia::save');
         }
     }
     if ($write) {
         $result = $this->write();
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     if (!$this->width || !$this->height) {
         $this->loadDimensions();
     }
     if ($thumbnail) {
         if ($this->isVideo()) {
             $this->makeVideoThumbnail();
         } else {
             $this->makeAudioThumbnail();
         }
     }
     if (empty($this->title)) {
         $this->title = $this->file_name;
     }
     $db = new PHPWS_DB('multimedia');
     $result = $db->saveObject($this);
     return $result;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:37,代码来源:Multimedia.php

示例2: save

 public function save($no_dupes = true, $write = true, $thumbnail = true)
 {
     if (empty($this->file_directory)) {
         if ($this->folder_id) {
             $folder = new Folder($_POST['folder_id']);
             if ($folder->id) {
                 $this->setDirectory($folder->getFullDirectory());
             } else {
                 return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Image::save');
             }
         } else {
             return PHPWS_Error::get(FC_DIRECTORY_NOT_SET, 'filecabinet', 'PHPWS_Image::save');
         }
     }
     if (!$this->folder_id) {
         return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Image::save');
     }
     if (!is_writable($this->file_directory)) {
         return PHPWS_Error::get(FC_BAD_DIRECTORY, 'filecabinet', 'PHPWS_Image::save', $this->file_directory);
     }
     if (empty($this->alt)) {
         if (empty($this->title)) {
             $this->loadTitleFromFilename();
         }
         $this->alt = $this->title;
     }
     if ($write) {
         $result = $this->write();
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     if ($thumbnail) {
         $this->makeThumbnail();
     }
     $db = new PHPWS_DB('images');
     if ((bool) $no_dupes && empty($this->id)) {
         $db->addWhere('file_name', $this->file_name);
         $db->addWhere('folder_id', $this->folder_id);
         $db->addColumn('id');
         $result = $db->select('one');
         if (PHPWS_Error::isError($result)) {
             return $result;
         } elseif (isset($result) && is_numeric($result)) {
             $this->id = $result;
             return TRUE;
         }
         $db->reset();
     }
     return $db->saveObject($this);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:51,代码来源:Image.php

示例3: classifyIntoFolder

 public function classifyIntoFolder($folder_id, $files)
 {
     if (empty($files)) {
         return;
     }
     $folder = new Folder($folder_id);
     if (!$folder->id) {
         return;
     }
     $classify_dir = $this->getClassifyDir();
     if (empty($classify_dir)) {
         return;
     }
     switch ($folder->ftype) {
         case IMAGE_FOLDER:
             $type = 'image';
             PHPWS_Core::initModClass('filecabinet', 'Image.php');
             $class_name = 'PHPWS_Image';
             break;
         case DOCUMENT_FOLDER:
             $type = 'document';
             PHPWS_Core::initModClass('filecabinet', 'Document.php');
             $class_name = 'PHPWS_Document';
             break;
         case MULTIMEDIA_FOLDER:
             $type = 'media';
             PHPWS_Core::initModClass('filecabinet', 'Multimedia.php');
             $class_name = 'PHPWS_Multimedia';
             break;
     }
     $allowed_types = $this->getAllowedTypes($type);
     foreach ($files as $filename) {
         $path = $classify_dir . $filename;
         $ext = PHPWS_File::getFileExtension($filename);
         if ($this->fileTypeAllowed($path, $type) && PHPWS_File::checkMimeType($path) && in_array($ext, $allowed_types)) {
             $file_obj = new $class_name();
             $file_obj->folder_id = $folder->id;
             $file_obj->setFilename($filename);
             $file_obj->setTitle(str_replace(".{$ext}", '', $filename));
             $file_obj->setDirectory($folder->getFullDirectory());
             $folder_directory = $file_obj->getPath();
             if (!@rename($path, $folder_directory)) {
                 PHPWS_Error::log(FC_FILE_MOVE, 'filecabinet', 'Cabinet::classifyIntoFolder', $folder_directory);
                 continue;
             }
             $file_obj->file_type = PHPWS_File::getMimeType($file_obj->getPath());
             $file_obj->loadFileSize();
             if ($folder->ftype == IMAGE_FOLDER) {
                 $file_obj->loadDimensions();
                 $file_obj->save(true, false);
             } else {
                 $file_obj->save(false);
             }
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:56,代码来源:Cabinet.php

示例4: save

 public function save($write = true)
 {
     if (empty($this->file_directory)) {
         if ($this->folder_id) {
             $folder = new Folder($_POST['folder_id']);
             if ($folder->id) {
                 $this->setDirectory($folder->getFullDirectory());
             } else {
                 return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Document::save');
             }
         } else {
             return PHPWS_Error::get(FC_DIRECTORY_NOT_SET, 'filecabinet', 'PHPWS_Document::save');
         }
     }
     if (!is_writable($this->file_directory)) {
         return PHPWS_Error::get(FC_BAD_DIRECTORY, 'filecabinet', 'PHPWS_Document::save', $this->file_directory);
     }
     if (empty($this->title)) {
         $this->loadTitleFromFilename();
     }
     if ($write) {
         $result = $this->write(false);
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     $db = new PHPWS_DB('documents');
     return $db->saveObject($this);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:29,代码来源:Document.php


注:本文中的Folder::getFullDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。