本文整理汇总了PHP中DataHandler::strToURL方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::strToURL方法的具体用法?PHP DataHandler::strToURL怎么用?PHP DataHandler::strToURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::strToURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareCategories
private function prepareCategories(&$array)
{
foreach ($array as $category) {
$category->slug = DataHandler::strToURL($category->name);
if (count($category->__array_category) > 0) {
$this->prepareCategories($category->__array_category);
}
}
}
示例2: commit
public function commit($redirect_page = TRUE, $gallery_type = "image")
{
//iniciando o retorno padrao
$_POST["active"] = 1;
if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
$_POST["category"] = array($this->category_id);
} else {
if (!is_array($_POST["category"])) {
$_POST["category"] = array($_POST["category"], $this->category_id);
} else {
//é uma array, mas melhor garantir que tem o produto id
$_POST["category"][] = $this->category_id;
}
}
if (isset($_POST["hat"])) {
$hat = $_POST["hat"];
//tira o vinculo com a tabela ano (que nao existe)
if ($content_id) {
//adiciona o vinculo com a tabela ano de indice hat
$LinkDAO = LinkDAO::getInstance();
}
//deleta vinculos com categoria
$LinkDAO->deleteAllFromLinkedTableByTableAndTableId('content', $content_id, 'ano');
$LinkDAO->insert('ano', $hat, 'content', $content_id, 1, 0);
}
if (isset($_POST["title"])) {
$_POST["slug"] = DataHandler::strToURL($_POST["title"]);
}
if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
$_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
}
if (!isset($_POST["order"])) {
$_POST["order"] = NULL;
}
$return = parent::commit(FALSE, $gallery_type);
$this->updatePdf($return->id);
if ($redirect_page) {
//Navigation::redirect($this->my_redirect);
Navigation::redirect("backend/client/change/id." . $return->id);
exit;
}
return $return;
}
示例3: commit
public function commit($redirect_page = TRUE, $gallery_type = "image")
{
//iniciando o retorno padrao
$_POST["active"] = 1;
if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
$_POST["category"] = array($this->category_id);
} else {
if (!is_array($_POST["category"])) {
$_POST["category"] = array($_POST["category"], $this->category_id);
} else {
//é uma array, mas melhor garantir que tem o produto id
$_POST["category"][] = $this->category_id;
}
}
if (isset($_POST["title"])) {
$_POST["slug"] = DataHandler::strToURL($_POST["title"]);
}
if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
$_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
}
if (!isset($_POST["order"])) {
$_POST["order"] = NULL;
}
if (!isset($_POST["hat"])) {
$_POST["hat"] = "nao";
}
if (!isset($_POST["author"])) {
$_POST["author"] = "nao";
}
return parent::commit($redirect_page, $gallery_type);
}
示例4: getZip
/**
* baixar o zip do mal
* ?products={product_id:N,gallery:true,dimensions:true,files:[]}|{product_id:N,gallery:true,dimensions:true,files:[]}
*/
public function getZip()
{
if (!UserClient::getId() > 0) {
//nao tem permissao
Navigation::redirect("405");
exit;
}
set_time_limit(0);
//tratando variaveis enviadas
$files_id = DataHandler::getValueByArrayIndex($_POST, "file_id");
$imagens = DataHandler::getValueByArrayIndex($_POST, "imagens");
$pdf = DataHandler::getValueByArrayIndex($_POST, "pdf");
//precisa saber quais sao os produtos envolvidos
$array_products_id = array();
$array_files = array();
if ($files_id) {
foreach ($files_id as $file_id) {
$temp_array = explode("_", $file_id);
$product_id = $temp_array[0];
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
$array_files[] = $product_id;
}
}
}
if ($imagens) {
foreach ($imagens as $product_id) {
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
}
}
}
if ($pdf) {
foreach ($pdf as $product_id) {
if (!in_array($product_id, $array_products_id)) {
$array_products_id[] = $product_id;
}
}
}
$ReturnResultVO = new ReturnResultVO();
$ProductVO = new ContentSiteVO();
$FileVO = new FileVO();
//se tiver produtos para tratar
if (count($array_products_id) > 0) {
//a pasta zip precisa existir
$zip_path = "upload/zip/";
DataHandler::createFolderIfNotExist($zip_path);
$array_products_to_zip = array();
$unique_str = "";
//nome final do zip que vai baixar, adiciona alguns parametros indicadores
$zip_name = "teto";
if (count($array_products_id) > 0) {
//sao varios produtos
$zip_name = $zip_name . "_produtos";
}
//cada indice dessa array, tem que ser array, terá um json com as info:
foreach ($array_products_id as $product_id) {
$resultProduto = $ProductVO->setId($product_id, TRUE);
if ($resultProduto->success) {
$stdProduct = $ProductVO->toStdClass();
$array_products_to_zip[] = $stdProduct;
$array_images = array();
if ($imagens) {
if (in_array($product_id, $imagens)) {
$array_gallery = $ProductVO->getImages(NULL, "gallery", true);
foreach ($array_gallery as $imageVO) {
$array_images[] = $imageVO->getURL();
$unique_str .= "|" . $imageVO->getId();
//add a imagem na pasta
}
//
$array_dimensions = $ProductVO->getImages(NULL, "dimensions", true);
foreach ($array_dimensions as $imageVO) {
$array_images[] = $imageVO->getURL();
//add a imagem na pasta
$unique_str .= "|" . $imageVO->getId();
}
}
}
$stdProduct->images = $array_images;
$array_file_vo = array();
//cria a pasta do produto no zip
$product_folder_name = DataHandler::strToURL($stdProduct->title);
if (count($array_files) > 0) {
if (in_array($product_id, $array_files)) {
//esse produto pediu algum file
$temp_array_files = $ProductVO->getFiles();
foreach ($temp_array_files as $FileVO) {
if (in_array($FileVO->id, $files_id)) {
$array_file_vo[] = $FileVO;
$unique_str .= "|f." . $file_id;
//add a url do arquivo no zip na pasta
}
}
}
}
//.........这里部分代码省略.........
示例5: commit
public function commit($redirect_page = TRUE, $gallery_type = "image")
{
//iniciando o retorno padrao
//$_POST["active"] = 1;
if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
$_POST["category"] = array($this->category_id);
} else {
if (!is_array($_POST["category"])) {
$_POST["category"] = array($_POST["category"], $this->category_id);
} else {
//é uma array, mas melhor garantir que tem o produto id
$_POST["category"][] = $this->category_id;
}
}
if (isset($_POST["title"])) {
$_POST["slug"] = DataHandler::strToURL($_POST["title"]);
}
if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
$_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
}
if (!isset($_POST["order"])) {
$_POST["order"] = NULL;
}
if (!isset($_POST["hat"])) {
$_POST["hat"] = "nao";
}
if (isset($_POST["nao_e_produto"])) {
$_POST["active"] = 2;
}
if (!isset($_POST["author"])) {
$_POST["author"] = "nao";
}
// Debug::print_r($_POST);exit();
$return = parent::commit(FALSE, $gallery_type);
$this->updatePdf($return->id);
if ($redirect_page) {
//Navigation::redirect($this->my_redirect);
Navigation::redirect("backend/product/change/id." . $return->id);
exit;
}
return $return;
}