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


PHP DataHandler::removeAccent方法代码示例

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


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

示例1: 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

示例2: 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

示例3: commit

 public function commit()
 {
     if (DataHandler::getValueByArrayIndex($_POST, "title") != NULL) {
         $slug = DataHandler::removeAccent(DataHandler::getValueByArrayIndex($_POST, "title"));
         $slug = DataHandler::removeSpecialCharacters($slug);
         $slug = strtolower($slug);
         $_POST["slug"] = $slug;
     }
     if (DataHandler::getValueByArrayIndex($_POST, "date") !== NULL && $_POST["date"] == "") {
         $_POST["date"] = "now()";
     }
     if ($this->sub == "unidades") {
         $_POST["content"] = "unidades";
     }
     //Debug::print_r($_POST);
     //exit();
     //echo Debug::li($this->my_redirect);exit();
     $this->redirect_with_id = FALSE;
     if (DataHandler::getValueByArrayIndex($_POST, "category")) {
         if (is_array($_POST["category"])) {
             //$_POST["category"] = $_POST["category"];
             if ($this->sub == "blog") {
                 $_POST["category"][] = 36;
             }
             //echo Debug::print_r($_POST["category"]);
             //exit();
         } else {
             throw new Exception("envie a array de categoria. Sem isso a content nao funciona.");
         }
     }
     parent::commit();
 }
开发者ID:reytuty,项目名称:facil,代码行数:32,代码来源:Page.php

示例4: commit

 /**
  * Da redirect
  * Envie redirect_with_id para o seu redirect_to ir com o parametro id no final
  * @return void
  */
 public function commit($redirect_page = TRUE, $link_table = "image")
 {
     $contentVO = new ContentSiteVO();
     if (isset($_POST["id"])) {
         $contentVO->setId($_POST["id"], TRUE);
     }
     $contentVO->setFetchArray($_POST);
     //antes de tudo, faz a validação
     $ValidationReturnResultVO = new ReturnResultVO();
     $ValidationReturnResultVO->success = TRUE;
     if (DataHandler::getValueByArrayIndex($_POST, "array_validation")) {
         $array_validation = DataHandler::getValueByArrayIndex($_POST, "array_validation");
         //array de fields que deveriam ser validados e estão errados
         $array_fields_errors = array();
         if (is_array($array_validation)) {
             //se for array, valida a array
             //varre a validação
             foreach ($array_validation as $field_name) {
                 $temp_ReturnResultVO = $this->validateContentFields($field_name, $contentVO);
                 if (!$temp_ReturnResultVO->success) {
                     //echo Debug::li("Content.php erro na validacao : $field_name ");
                     //da o push na array_fields error
                     $array_fields_errors[] = $field_name;
                     //já muda o success do result para false para saber que não precisa mais commitar
                     $ValidationReturnResultVO->success = FALSE;
                 }
             }
         } else {
             if (is_string($array_validation)) {
                 //se for só uma string valida só 1 deles
                 $temp_ReturnResultVO = $this->validateContentFields($field_name, $contentVO);
                 if (!$temp_ReturnResultVO->success) {
                     //da o push na array_fields error
                     $array_fields_errors[] = $field_name;
                     //já muda o success do result para false para saber que não precisa mais commitar
                     $ValidationReturnResultVO->success = FALSE;
                 }
             }
         }
     }
     if (!$ValidationReturnResultVO->success) {
         //coloco na result a array de fields com error
         $ValidationReturnResultVO->result = $array_fields_errors;
         //retorna para o edit de quem extends essa classe
         return $this->{$my_edit_method}($ValidationReturnResultVO);
         //daqui nao passa
         exit;
     }
     //vai criar as key_words do content
     $key_words = "";
     $key_words .= " " . DataHandler::removeAccent($contentVO->getAuthor());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getContent());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getDescription());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getHat());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getName());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getSlug());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getTitle());
     $contentVO->setKeyWords($key_words);
     $returnResultVO = $contentVO->commit();
     $content_id = $contentVO->getId();
     //adicionando link com categoria(s) enviada(s)
     //pega a instancia
     $LinkDAO = LinkDAO::getInstance();
     if (FALSE) {
         $LinkDAO = new LinkDAO();
     }
     //deleta vinculos com categoria
     $LinkDAO->deleteAllFromLinkedTableByTableAndTableId('content', $content_id, 'category');
     $have_category_to_commit = FALSE;
     if (!is_array($_POST["category"])) {
         $_POST["category"] = array($_POST["category"]);
     }
     $arrayCategory = $_POST["category"];
     //Debug::print_r($arrayCategory);exit();
     $order = 10;
     if (!is_array($_POST["order"])) {
         $order = $_POST["order"];
     }
     foreach ($arrayCategory as $category_id) {
         ///print_r($category_id);
         //echo Debug::li("categoria id:".$category_id);
         //cada categoria enviada é mais um link com categoria que deve ser adicionado
         //echo $order;exit();
         $LinkDAO->insert('category', $category_id, 'content', $contentVO->getId(), 1, $order);
         // $contentVO->addLink("category", $category_id);
         $have_category_to_commit = TRUE;
     }
     //exit();
     //caso tenha o que adicionar como link em categoria, commita
     if ($have_category_to_commit) {
         $contentVO->commit();
     }
     //fim da adição do content em categoria
     //-----------------------------==================================== [[[  add imagens ]]]
     $array_image_file = DataHandler::getValueByArrayIndex($_FILES, "image");
//.........这里部分代码省略.........
开发者ID:reytuty,项目名称:facil,代码行数:101,代码来源:Content.php


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