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


PHP DataHandler::returnFilenameWithoutExtension方法代码示例

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


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

示例1: foreach

                        <?php 
if (isset($HttpContentResult->array_files)) {
    foreach ($HttpContentResult->array_files as $row) {
        ?>
 
                        <tr>
                            <td align="center" id="item<?php 
        echo $row->id;
        ?>
"><?php 
        echo $row->id;
        ?>
</td>
                            <td>
                            <?php 
        $nome = explode("/", DataHandler::returnFilenameWithoutExtension($row->url));
        $nome = $nome[count($nome) - 1];
        echo $nome;
        ?>
                            </td>
                            <td align="center"><a href="<?php 
        echo $row->url;
        ?>
"><?php 
        echo strtoupper(DataHandler::returnExtensionOfFile($row->url));
        ?>
</a></td>
                            <td><?php 
        echo DataHandler::bytesInString(filesize($row->url));
        ?>
</td>
开发者ID:reytuty,项目名称:facil,代码行数:31,代码来源:index.php

示例2: insert

 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na infoPost
     $VO = new FileVO();
     if ($this->infoPost->file_info_id) {
         $VO->setId($this->infoPost->file_info_id, TRUE);
     }
     $VO->setActive($this->infoPost->file_info_active);
     $VO->setName($this->infoPost->file_info_name);
     $VO->setDescription($this->infoPost->file_info_description);
     $VO->setType($this->infoPost->file_info_type);
     $VO->setAuthor($this->infoPost->file_info_author);
     $VO->setLocale($this->infoPost->file_info_locale);
     $VO->setOrder($this->infoPost->file_info_order);
     //("JÁ") gera id para criar pasta onde vai ser guardado o arquivo
     $ReturnResultFileVO = $VO->commit();
     if ($ReturnResultFileVO->success) {
         $ReturnResultFileVO->result = $VO->getId();
     } else {
         //erro, os motivos estão na ReturnResultVO abaixo
         return $ReturnResultFileVO;
     }
     //pega o id da file
     $FILE_ID = $VO->getId();
     $ReturnResultFileVO = new ReturnResultVO();
     if (isset($this->infoPost->file_data) && !$this->infoPost->file_info_id > 0) {
         set_time_limit(0);
         $sentFileData = $this->infoPost->file_data;
         //$_FILES['Filedata'];
         $name = $sentFileData['name'];
         // extens�o enviada
         $sentExtension = DataHandler::returnExtensionOfFile($name);
         // remove caracteres escrotos
         $name = DataHandler::returnFilenameWithoutExtension($name);
         $name = DataHandler::removeAccent($name);
         $name = DataHandler::removeSpecialCharacters($name);
         $name = trim(substr($name, 0, 80));
         switch ($sentFileData["type"]) {
             case "text/plain":
                 $extension = "txt";
                 break;
             default:
                 $extension = strtolower($sentExtension);
                 break;
         }
         //verifica se a pasta existe, se não existir, inventa
         DataHandler::createFolderIfNotExist($this->defaultFolderForNewFiles);
         // pasta de upload de files está no config.php
         $tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewFiles . "/" . $FILE_ID);
         DataHandler::createFolderIfNotExist($tempFolder);
         $tempUrl = $tempFolder . "/" . strtolower($name . "." . $extension);
         $i = 2;
         while (file_exists($tempUrl)) {
             $tempUrl = $tempFolder . "/" . strtolower($name . "-" . $i . "." . $extension);
             $i++;
         }
         $VO->setUrl($tempUrl);
         $ReturnResultFileVO = $VO->commit();
         //Debug::li("aaa");
         if ($ReturnResultFileVO->success) {
             //incluir o vinculo com a linked_table e linked_table_id
             //receber 	table
             //			table_id
             if ($this->infoPost->table) {
                 $table = $this->infoPost->table;
                 $table_id = $this->infoPost->table_id;
                 include_once "library/facil3/core/dao/LinkDAO.class.php";
                 $LinkDAO = new LinkDAO();
                 //vincula a foto ao table e table_id enviado
                 $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
                 if (!$ReturnResultVinculoVO->success) {
                     //deu erro ao vincular
                     $ReturnResultVO->success = false;
                     $ReturnResultVO->appendMessage($ReturnResultVinculoVO->array_messages);
                     return $ReturnResultVO;
                 }
             } else {
                 $ReturnResultVO->addMessage(Translation::text("LibraryLanguage::WARNING_FILE_NO_LINKED_TABLE"));
             }
             //movendo o arquivo para sua respectiva pasta.
             $localFile = $VO->getUrl();
             if (!move_uploaded_file($sentFileData['tmp_name'], $localFile)) {
                 $ReturnResultVO->success = false;
                 $ReturnResultVO->addMessage(Translation::text("Arquivo não encontrado"));
                 return $ReturnResultVO;
             } else {
                 $ReturnResultVO->success = TRUE;
                 $ReturnResultVO->result = $VO->getId();
                 $ReturnResultVO->addMessage(Translation::text("Arquivo gravado"));
             }
         } else {
             return $ReturnResultFileVO;
         }
         return $ReturnResultVO;
     } else {
         $ReturnResultFileVO = new ReturnResultVO();
         $ReturnResultFileVO->addMessage("Envie o Filedata");
         // nao veio filedata
//.........这里部分代码省略.........
开发者ID:reytuty,项目名称:facil,代码行数:101,代码来源:FacilFile.php

示例3: insert

 /**
  * recebe a imagem por post
  * @return ReturnResultVO
  */
 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na infoPost
     $VO = new ImageVO();
     //var_dump($this->infoPost);
     //exit();
     if ($this->infoPost->image_info_id > 0) {
         //passou o id, vai atualizar essa VO
         //					echo Debug::li("image_info_id >>>>>>>>>> ".$this->infoPost->image_info_id);
         $VO->setId($this->infoPost->image_info_id, TRUE);
     }
     $VO->setActive($this->infoPost->image_info_active);
     $VO->setName($this->infoPost->image_info_name);
     $VO->setDescription($this->infoPost->image_info_description);
     $VO->setType($this->infoPost->image_info_type);
     $VO->setAuthor($this->infoPost->image_info_author);
     $VO->setLocale($this->infoPost->image_info_locale);
     $VO->setOrder($this->infoPost->image_info_order);
     //				var_dump($_FILES);
     //				var_dump($this->infoPost->file_data);
     //comitando as infos enviadas, dados apenas
     if ($VO->getId() > 0 || $this->infoPost->file_data['tmp_name']) {
         //só comita a imagem se tiver ou id ou enviado o file_data, se não nem tem o que fazer
         $ReturnResultImageVO = $VO->commit();
     } else {
         //nem enviou o id e nem o file_data, retorna
         $ReturnResultVO->addMessage(Translation::text("Have nothing to commit."));
         return $ReturnResultVO;
     }
     if ($ReturnResultImageVO->success) {
         $ReturnResultImageVO->result = $VO->getId();
     } else {
         //erro, os motivos estão na ReturnResultVO abaixo
         return $ReturnResultImageVO;
     }
     //pega o id da imagem
     $IMAGE_ID = $VO->getId();
     $ReturnResultImageVO = new ReturnResultVO();
     //echo Debug::li("this->infoPost->file_data: ".$this->infoPost->file_data);
     if (isset($this->infoPost->file_data) && $this->infoPost->file_data['tmp_name']) {
         set_time_limit(0);
         //var_dump($_FILES);
         $sentFileData = $this->infoPost->file_data;
         //$_FILES['Filedata'];
         $name = $sentFileData['name'];
         // extens�o enviada
         $sentExtension = DataHandler::returnExtensionOfFile($name);
         // remove caracteres escrotos
         $name = DataHandler::returnFilenameWithoutExtension($name);
         $name = DataHandler::removeAccent($name);
         $name = DataHandler::removeSpecialCharacters($name);
         $name = trim(substr($name, 0, 80));
         switch ($sentFileData["type"]) {
             case "image/pjpeg":
             case "image/jpeg":
             case "image/jpg":
                 $extension = "jpg";
                 break;
             case "image/gif":
                 $extension = "gif";
                 break;
             case "image/png":
             case "image/x-png":
                 $extension = "png";
                 break;
             case "image/bmp":
                 $extension = "bmp";
                 break;
             default:
                 $extension = strtolower($sentExtension);
                 break;
         }
         //verifica se a pasta existe, se não existir, inventa
         DataHandler::createFolderIfNotExist($this->defaultFolderForNewImages);
         // pasta de upload de imagens est� no config.php
         $tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewImages . "/" . $IMAGE_ID);
         DataHandler::createFolderIfNotExist($tempFolder);
         //echo Debug::li("name: $name");
         $tempUrl = $tempFolder . "/original_" . strtolower($name . "." . $extension);
         //echo Debug::li("tempUrl: $tempUrl");
         //exit();
         $i = 2;
         while (file_exists($tempUrl)) {
             $tempUrl = $tempFolder . "/original_" . strtolower($name . "-" . $i . "." . $extension);
             $i++;
         }
         $VO->setUrl($tempUrl);
         $ReturnResultImageVO = $VO->commit();
         //Debug::li("aaa");
         //Debug::print_r($ReturnResultImageVO);
         if ($ReturnResultImageVO->success) {
             //incluir o vinculo com a linked_table e linked_table_id
             //receber 	table
             //			table_id
//.........这里部分代码省略.........
开发者ID:reytuty,项目名称:facil,代码行数:101,代码来源:FacilImage.php


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