本文整理汇总了PHP中DataHandler::removeSpecialCharacters方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::removeSpecialCharacters方法的具体用法?PHP DataHandler::removeSpecialCharacters怎么用?PHP DataHandler::removeSpecialCharacters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::removeSpecialCharacters方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* @param $table
* @param $table_id
* @param $therm
* @param $locale
* @param $value
* @param $active
* @return unknown_type
*/
public function insert($table = NULL, $table_id = NULL, $therm = NULL, $locale = NULL, $value = NULL, $active = 1)
{
/*
if($table == NULL || $table_id == NULL){
$ReturnDataVO = new ReturnDataVO();
$ReturnDataVO->success = FALSE;
$ReturnDataVO->result = DbInterface::ERROR_TERM_DONOT_HAVE_TABLE_OR_TABLE_ID;
return $ReturnDataVO;
}
*/
$table = $table == NULL ? "NULL" : "'" . DataHandler::forceString($table) . "'";
$table_id = $table_id == NULL ? "NULL" : DataHandler::forceInt($table_id);
$query = "INSERT INTO \r\n\t\t\t\t\t\ttherm(\r\n\t\t\t\t\t\t\t\t`id`,\r\n\t\t\t\t\t\t\t\t`table`,\r\n\t\t\t\t\t\t\t\t`table_id`,\r\n\t\t\t\t\t\t\t\t`therm`,\r\n\t\t\t\t\t\t\t\t`locale`,\r\n\t\t\t\t\t\t\t\t`value`,\r\n\t\t\t\t\t\t\t\t`active`\r\n\t\t\t\t\t\t)VALUES(\r\n\t\t\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\t\t\t'" . DataHandler::removeSpecialCharacters($table) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceInt($table_id) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceString($therm) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceString($locale) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceString($value) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceInt($active) . "'\r\n\t\t\t\t\t\t\t\t)";
$ReturnDataVO = parent::query($query, TRUE);
if (!$ReturnDataVO->success) {
$ReturnDataVO->result = DbInterface::ERROR_TERM_INSERT_COMMIT;
}
return $ReturnDataVO;
}
示例2: setName
public function setName($name = NULL)
{
$this->name = DataHandler::removeSpecialCharacters($name);
}
示例3: 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
//.........这里部分代码省略.........
示例4: addFilter
private function addFilter(&$query, $id, $active, $name, $title, $hat, $description, $content, $author, $template_url, $slug, $key_words, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type)
{
if ($id !== NULL) {
$query .= " AND `content`.id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `content`.active = '" . DataHandler::forceInt($active) . "'";
}
if ($name !== NULL) {
$query .= " AND `content`.name = '" . DataHandler::forceString($name) . "'";
}
if ($title !== NULL) {
$query .= " AND `content`.title = '" . DataHandler::forceString($title) . "'";
}
if ($hat !== NULL) {
$query .= " AND `content`.hat = '" . DataHandler::forceString($hat) . "'";
}
if ($description !== NULL) {
$query .= " AND `content`.description = '" . DataHandler::forceString($description) . "'";
}
if ($content !== NULL) {
$query .= " AND `content`.content = '" . DataHandler::forceString($content) . "'";
}
if ($author !== NULL) {
$query .= " AND `content`.author = '" . DataHandler::forceString($author) . "'";
}
if ($template_url !== NULL) {
$query .= " AND `content`.template_url = '" . DataHandler::removeSpecialCharacters($template_url) . "'";
}
if ($slug !== NULL) {
$query .= " AND `content`.slug = '" . DataHandler::removeSpecialCharacters($slug) . "'";
}
if ($key_words !== NULL) {
$query .= " AND `content`.key_words = '" . DataHandler::removeSpecialCharacters($key_words) . "'";
}
if ($date !== NULL) {
$date_symbol = parent::compareSimble($date_symbol);
$date = parent::dateHandlerScape($date);
$query .= " AND `date` {$date_symbol} {$date} ";
}
if ($date_in !== NULL) {
$date_in_symbol = parent::compareSimble($date_in_symbol);
$date_in = parent::dateHandlerScape($date_in);
$query .= " AND `date_in` {$date_in_symbol} {$date_in} ";
}
if ($date_out !== NULL) {
$date_out_symbol = parent::compareSimble($date_out_symbol);
$date_out = parent::dateHandlerScape($date_out);
$query .= " AND `date_out` {$date_out_symbol} {$date_out} ";
}
//adiciona a ordenação na query
$orderBy = "";
if ($order_type != NULL) {
$order_type = parent::verifyOrderType($order_type);
$orderBy .= ", `order` " . $order_type;
}
if ($orderBy != NULL) {
$query .= " ORDER BY " . $orderBy;
}
}
示例5: setSlug
/**
* @param $slug
* @param $locale
* @return void
*/
public function setSlug($slug, $locale = NULL)
{
if ($locale == NULL) {
$this->slug = DataHandler::removeSpecialCharacters($slug);
} else {
$this->addTherms(ContentVO::TERM_SLUG, $locale, DataHandler::removeSpecialCharacters($slug));
}
}
示例6: setImageUrl
/**
* @param $image_url
* @param $locale
* @return void
*/
public function setImageUrl($image_url, $locale = NULL)
{
if ($locale == NULL) {
$this->image_url = DataHandler::removeSpecialCharacters($image_url);
} else {
$this->addTherms(HighLightsVO::TERM_IMAGE_URL, $locale, DataHandler::removeSpecialCharacters($image_url));
}
}
示例7: addFilter
private function addFilter(&$query, $id, $active, $name, $link, $content, $image_url, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($name !== NULL) {
$query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
}
if ($link !== NULL) {
$query .= " AND `link` = '" . DataHandler::forceString($link) . "'";
}
if ($content !== NULL) {
$query .= " AND `content` = '" . DataHandler::forceString($content) . "'";
}
if ($image_url !== NULL) {
$query .= " AND `image_url` = '" . DataHandler::removeSpecialCharacters($image_url) . "'";
}
if ($date !== NULL) {
$date_symbol = parent::compareSimble($date_symbol);
$date = parent::dateHandlerScape($date);
$query .= " AND `date` {$date_symbol} {$date} ";
}
if ($date_in !== NULL) {
$date_in_symbol = parent::compareSimble($date_in_symbol);
$date_in = parent::dateHandlerScape($date_in);
$query .= " AND `date_in` {$date_in_symbol} {$date_in} ";
}
if ($date_out !== NULL) {
$date_out_symbol = parent::compareSimble($date_out_symbol);
$date_out = parent::dateHandlerScape($date_out);
$query .= " AND `date_out` {$date_out_symbol} {$date_out} ";
}
//adiciona a ordenação na query
$orderBy = "";
if ($order_type != NULL) {
$order_type = parent::verifyOrderType($order_type);
$orderBy .= ", `order` " . $order_type;
}
if ($orderBy != NULL) {
$query .= " ORDER BY " . $orderBy;
}
}
示例8: searchFile
/**
* @param $array_url retorno da Navigation::getUri
* @param $_startFolder string passe o caminho da view
* @return ReturnSearchClassVO
*/
private static function searchFile($array_url, $_startFolder = "")
{
//iniciando o objeto de retorno
$returnReturnSearchClassVO = new ReturnSearchClassVO();
$searchFileOrFolderName = "";
//($searchFileOrFolderName != "")?"/".DataHandler::removeSpecialCharacters($searchFileOrFolderName):"";
//array completa sem a parte filtrada da url
$array = $array_url;
//Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
$contador = 0;
//varredura de hierarquia invertida
for ($i = count($array) - 1; $i >= 0; $i--) {
//pegando o string path, tirando o ultimo folder, pois estara no lastFolder
$stringPath = implode("/", array_slice($array, 0, $i));
$stringPath = DataHandler::removeLastBar($stringPath);
$lastFolder = DataHandler::removeSpecialCharacters($array[$i]);
//criando a array (além dos limites) - que não foi tratada
$contador++;
$arrayRestFolder = array_slice($array, count($array) - $contador, count($array));
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
//echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ".$_startFolder."----".$stringPath." ");
$searchFileOrFolderName = "";
//verifica se tem CAMINHO/ultimaPasta.php
$caminhoBase = $_startFolder . "/" . trim($stringPath) . "/" . $lastFolder;
$caminhoBase = DataHandler::removeDobleBars(DataHandler::removeDobleBars($caminhoBase));
if (file_exists($caminhoBase . ".php")) {
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->className = "";
$returnReturnSearchClassVO->folder = "";
$returnReturnSearchClassVO->urlToInclude = $caminhoBase . ".php";
$returnReturnSearchClassVO->file = $lastFolder . ".php";
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
return $returnReturnSearchClassVO;
}
//verifica se existe CAMINHO/ultimaPasta/index.php
if (file_exists($caminhoBase . "/index.php")) {
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->className = "";
$returnReturnSearchClassVO->folder = "";
$returnReturnSearchClassVO->urlToInclude = $caminhoBase . "/index.php";
$returnReturnSearchClassVO->file = "index.php";
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
//echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ". $_startFolder.$stringPath."/index.php");
return $returnReturnSearchClassVO;
}
}
// end for($i = count($array)-1; $i >= 0; $i--){
return $returnReturnSearchClassVO;
}
示例9: 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();
}
示例10: insert
/**
* @param string $table required
* @param int $table_id required
* @param string $linked_table required
* @param int $linked_table_id required
* @param int $active
* @return ReturnDataVO|unknown
*/
public function insert($table = NULL, $table_id = NULL, $linked_table = NULL, $linked_table_id = NULL, $active = 1, $order = 10)
{
//Debug::li("LinkDAO . insert chamado [$table , $table_id , $linked_table , $linked_table_id , $active, $order ]");
//exit();
if ($table == NULL || $table_id == NULL || $linked_table == NULL || $linked_table_id == NULL) {
$ReturnDataVO = new ReturnDataVO();
$ReturnDataVO->success = FALSE;
$ReturnDataVO->result = DbInterface::ERROR_LINK_DONOT_HAVE_TABLE_OR_TABLE_ID;
return $ReturnDataVO;
}
//order com valor default
$order = DataHandler::forceInt($order);
//verifica se já existe
$returnResultVO = $this->select(self::RETURN_STD_OBJECT, DataHandler::removeSpecialCharacters($table), DataHandler::forceInt($table_id), DataHandler::removeSpecialCharacters($linked_table), DataHandler::forceInt($linked_table_id), 0);
if ($returnResultVO->success && count($returnResultVO->result) > 0) {
//já existe um link identico, ve se tem muitos mais e deleta todos, deixa um e usa ele
if (count($returnResultVO->result) > 1) {
//tem mais que 1, tira o resto deixa só o primeiro
for ($i = 1; $i < count($returnResultVO->result); $i++) {
//deletando um a um, menos o primeiro
$stdTemp = $returnResultVO->result[$i];
$this->delete($stdTemp->id);
}
}
//agora da o update no que sobrou, ou seja, o primeiro
$StdLinkTemp = $returnResultVO->result[0];
//dando updante no primeiro
return $this->update($StdLinkTemp->id, 1, NULL, NULL, NULL, NULL, $order);
}
$query = "INSERT INTO \r\n\t\t\t\t\t\t`link`(\r\n\t\t\t\t\t\t\t\t`id`,\r\n\t\t\t\t\t\t\t\t`table`, \r\n\t\t \t\t\t\t\t\t`table_id`, \r\n\t\t \t\t\t\t\t\t`linked_table`, \r\n\t\t \t\t\t\t\t\t`linked_table_id`, \r\n\t\t \t\t\t\t\t\t`active`,\r\n\t\t \t\t\t\t\t\t`order`\r\n\t\t\t\t\t\t)VALUES(\r\n\t\t\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\t\t\t'" . DataHandler::removeSpecialCharacters($table) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceInt($table_id) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::removeSpecialCharacters($linked_table) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceInt($linked_table_id) . "',\r\n\t\t\t\t\t\t\t\t'" . DataHandler::forceInt($active) . "',\r\n\t\t\t\t\t\t\t\t'" . $order . "'\r\n\t\t\t\t\t\t\t\t)";
//Debug::li("LinkDAO . insert : $query ");exit();
$ReturnDataVO = parent::query($query, TRUE);
if (!$ReturnDataVO->success) {
$ReturnDataVO->result = DbInterface::ERROR_LINK_INSERT_COMMIT;
}
return $ReturnDataVO;
}
示例11: searchFileOrFolder
/**
* Retorna apenas 1 resultado dentro do ReturnSearchFileVO, os dados em ReturnSearchFileVO são todos referentes ao mesmo resultado
* @param $_startFolder string
* @param $searchClass string
* @return ReturnSearchClassVO
*/
public static function searchFileOrFolder($_urlToIgnore = "", $_startFolder = "", $search_file_mode = Navigation::SEARCH_FILE_MODE_FILE, $searchFileOrFolderName = "", $autoInclude = FALSE)
{
//iniciando o objeto de retorno
$returnReturnSearchClassVO = new ReturnSearchClassVO();
$searchFileOrFolderName = $searchFileOrFolderName != "" ? "/" . DataHandler::removeSpecialCharacters($searchFileOrFolderName) : "";
//array completa sem a parte filtrada da url
$array = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
//Debug::print_r($array);
$contador = 0;
//varredura de hierarquia invertida
for ($i = count($array) - 1; $i >= 0; $i--) {
//echo Debug::li($i." = valor de i ", FALSE, "FFFF00");
switch ($search_file_mode) {
case Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD:
$arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, FALSE, $i + 1);
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
$stringPath = "";
if ($i > 0) {
$stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i - 1);
}
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF55");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
$currentFolder = str_replace("/", "", $currentFolder);
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
//procurando folder
$searchFileOrFolderName = DataHandler::urlFolderNameToClassName($currentFolder);
//echo " valor de searchFileOrFolderName ";
//echo Debug::print_r($searchFileOrFolderName);
//echo "<br>";
$tempMetodo = "init";
if ($i + 1 < count($array)) {
$tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
}
//echo Debug::li("<b>tempMetodo:".$tempMetodo."</b>", false, NULL, NULL, "0000ff");
//echo $_startFolder.$stringPath."/".$searchFileOrFolderName.".php";
if (file_exists($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php")) {
//echo Debug::li("<b>A classe:".$_startFolder.$stringPath."/".$searchFileOrFolderName.".php </b>");
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->file = $searchFileOrFolderName . ".php";
$returnReturnSearchClassVO->folder = DataHandler::removeDobleBars($_startFolder . $stringPath . "/");
$returnReturnSearchClassVO->urlToInclude = DataHandler::removeDobleBars($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php");
$returnReturnSearchClassVO->className = $searchFileOrFolderName;
$returnReturnSearchClassVO->methodName = $tempMetodo;
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
$className = $returnReturnSearchClassVO->className;
if ($autoInclude) {
include_once $_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php";
//echo $className;
$classe = new $className();
//inicia o metodo como vazio
$returnReturnSearchClassVO->methodName = "init";
//Se existir uma pasta acima dessa, ve qual é pois pode ser tentativa de acessar metodo
if ($i + 1 < count($array)) {
//echo Debug::li(" >>>>> ".$array[$i+1]);
$tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
//verifica se o metodo existe
if (ClassHandler::isMethodPublic($classe, $tempMetodo)) {
$returnReturnSearchClassVO->methodName = $tempMetodo;
}
}
$metodo = $returnReturnSearchClassVO->methodName;
//echo $metodo;
return $classe->{$metodo}();
}
return $returnReturnSearchClassVO;
}
break;
case Navigation::SEARCH_FILE_MODE_FILE:
default:
$stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i + 1);
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
$stringPath = DataHandler::removeLastBar($stringPath);
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
$lastFolder = "";
if ($i + 1 < count($array)) {
$lastFolder = "/" . DataHandler::removeSpecialCharacters($array[$i + 1]);
}
//echo Debug::li($lastFolder." = valor de lastFolder ", FALSE, "FFFF00");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF00");
//criando a array (além dos limites) - que não foi tratada
$contador++;
//echo Debug::li($contador." = valor de contador ", FALSE, "FFFF00");
$arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, count($array), count($array) - $contador);
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
//.........这里部分代码省略.........
示例12: 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
//.........这里部分代码省略.........