本文整理汇总了PHP中DataHandler::forceString方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::forceString方法的具体用法?PHP DataHandler::forceString怎么用?PHP DataHandler::forceString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::forceString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectHighlights
/**
* busca todos os highlightss conforme requisições na HighlightsInfoPostVO
* @return ReturnResultVO
*/
public function selectHighlights()
{
$table = DataHandler::forceString($this->HighlightsInfoPostVO->request_table);
$table_id = DataHandler::forceInt($this->HighlightsInfoPostVO->request_table_id);
$quant_start = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_start);
$quant_limit = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_limit);
$type_of_return = DataHandler::forceString($this->HighlightsInfoPostVO->request_type_of_return);
$locale = DataHandler::forceString($this->HighlightsInfoPostVO->request_locale);
// se nao foi passado table e table id naum da pra procurar
if ($table == NULL && $table_id < 1) {
$ReturnResultVO->success = FALSE;
$ReturnResultVO->result = $this->array_highlights;
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND");
return $ReturnResultVO;
}
//inicia a LinkDAO para fazer a consulta
$DAO = HighLightsDAO::getInstance();
//busca highlightss vinculados a tabela e tabela id passados
$ReturnDataVO = $DAO->selectByTableId($table, $table_id, $type_of_return, "highlights", $quant_limit, $quant_start);
if ($ReturnDataVO->success) {
//Debug::print_r($ReturnDataVO);exit();
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $ReturnDataVO->result;
return $ReturnResultVO;
} else {
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $this->array_highlights;
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND");
return $ReturnResultVO;
}
}
示例2: update
/**
* @param $id
* @param $active
* @param $table
* @param $table_id
* @param $guide_name
* @param $locale
* @param $link
* @return unknown_type
*/
public function update($id, $active = 1, $table = NULL, $table_id = NULL, $linked_table = NULL, $linked_table_id = NULL, $order = NULL)
{
$ReturnDataVO = new ReturnDataVO();
//echo "<li>update</li>";
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_LINK_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$arrayFilter = array();
$query = "UPDATE link SET ";
$comma = "";
if ($active !== NULL) {
$query .= "{$comma} `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($table != NULL) {
$query .= " {$comma} `table` = '" . DataHandler::forceString($table) . "'";
$comma = " , ";
}
if ($table_id != NULL) {
$query .= " {$comma} `table_id` = '" . DataHandler::forceInt($table_id) . "'";
$comma = " , ";
}
if ($linked_table != NULL) {
$query .= " {$comma} `linked_table` = '" . DataHandler::forceString($linked_table) . "'";
$comma = ", ";
}
if ($linked_table_id != NULL) {
$query .= "{$comma} `linked_table_id` = '" . DataHandler::forceInt($linked_table_id) . "'";
$comma = ", ";
}
if ($order !== NULL) {
$query .= "{$comma} `order` = '" . DataHandler::forceInt($order) . "'";
$comma = ", ";
}
$query .= " WHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1 ";
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_LINK_UPDATE_DONOT_HAVE_UPDATES;
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
if (!$ReturnDataVO->success) {
$ReturnDataVO->code_return = DbInterface::ERROR_LINK_UPDATE_COMMIT;
}
return $ReturnDataVO;
}
}
示例3: setLocale
/**
* @param $locale
*
*/
public function setLocale($locale)
{
$this->locale = DataHandler::forceString($locale);
}
示例4: addFilter
private function addFilter(&$query, $id, $active, $state_id, $state, $country, $alias, $street, $number)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($state_id !== NULL) {
$query .= " AND `state_id` = '" . DataHandler::forceInt($state_id) . "'";
}
if ($state !== NULL) {
$query .= " AND `state` = '" . DataHandler::forceString($state) . "'";
}
if ($country !== NULL) {
$query .= " AND `country` = '" . DataHandler::forceString($country) . "'";
}
if ($alias !== NULL) {
$query .= " AND `alias` = '" . DataHandler::forceString($alias) . "'";
}
if ($street !== NULL) {
$query .= " AND `street` = '" . DataHandler::forceString($street) . "'";
}
if ($number !== NULL) {
$query .= " AND `number` = '" . DataHandler::forceString($number) . "'";
}
//adiciona a ordenação na query
}
示例5: select
public function select($typeOfReturn = NULL, $id = NULL, $active = NULL, $name = NULL, $url = NULL, $author = NULL, $order_type = DbInterface::ORDER_ASC, $quant_limit = NULL, $quant_started = NULL)
{
$typeOfReturn = $typeOfReturn === NULL ? NULL : $typeOfReturn;
$order_type = parent::verifyOrderType($order_type);
//echo "login[".$login."] - password[".$password."]";
$arrayFilter = array();
$query = "SELECT * FROM `image` WHERE 1";
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 ($url !== NULL) {
$query .= " AND `url` = '" . DataHandler::forceString($url) . "'";
}
if ($author !== NULL) {
$query .= " AND `author` = '" . DataHandler::forceString($author) . "'";
}
//limite
$query .= parent::limit($quant_limit, $quant_started);
$query .= " ORDER BY `order` {$order_type} ";
//executa a query
$ReturnDataVO = parent::query($query);
//verifica se conseguiu ocorreu tudo certo
if ($ReturnDataVO->success) {
switch ($typeOfReturn) {
case DbInterface::RETURN_ARRAY:
$ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_ARRAY);
break;
case DbInterface::RETURN_VO:
$ReturnDataVO->fetchAllVO($this);
break;
case DbInterface::RETURN_STD_OBJECT:
default:
//retornar tudo em objeto
$ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_OBJECT);
break;
}
return $ReturnDataVO;
} else {
return $ReturnDataVO;
}
}
示例6: addFilter
private function addFilter(&$query, $id, $active, $category_id, $name, $slug, $order_type)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($category_id !== NULL) {
$query .= " AND `category_id` = '" . DataHandler::forceInt($category_id) . "'";
}
if ($name !== NULL) {
$query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
}
if ($slug !== NULL) {
$query .= " AND `slug` = '" . DataHandler::forceString($slug) . "'";
}
//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;
}
}
示例7: consultValues
private function consultValues()
{
$ProductModelQuadroDAO = ProductModelQuadroDAO::getInstance();
$this->MaterialDAO = MaterialDAO::getInstance();
$this->ColorDAO = ColorDAO::getInstance();
$this->StyleDAO = StyleDAO::getInstance();
$this->FormatDAO = FormatDAO::getInstance();
$this->ThemeDAO = ThemeDAO::getInstance();
$this->CompositionDAO = CompositionDAO::getInstance();
$this->TechniqueDAO = TechniqueDAO::getInstance();
$this->TypeDAO = TypeDAO::getInstance();
//fazendo o que precisa fazer para ter os dados do menu
$this->arrayMaterial = $this->MaterialDAO->select(MaterialDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayMaterial);
$this->arrayColor = $this->ColorDAO->select(ColorDAO::RETURN_VO, NULL, 1);
// $this->addTotal($this->arrayColor);
//Debug::print_r($this->arrayColor);
//busca as imagens
if ($this->arrayColor->success) {
$tempVO = array();
foreach ($this->arrayColor->result as $ColorVO) {
$tempStdColor = $ColorVO->toStdClass();
//primeira letra maiuscula
$tempStdColor->name = ucfirst($tempStdColor->name);
$tempVO[] = $tempStdColor;
//Debug::print_r($tempVO);
}
$this->arrayColor->result = $tempVO;
}
$this->arrayStyle = $this->StyleDAO->select(StyleDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayStyle);
$this->arrayFormat = $this->FormatDAO->select(FormatDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayFormat);
$this->arrayTheme = $this->ThemeDAO->select(ThemeDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayTheme);
$this->arrayComposition = $this->CompositionDAO->select(CompositionDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayComposition);
$this->arrayTechnique = $this->TechniqueDAO->select(TechniqueDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayTechnique);
$this->arrayType = $this->TypeDAO->select(TypeDAO::RETURN_VO, NULL, 1);
$this->addTotal($this->arrayType);
//define a base da url
$this->url_final = Config::getRootPath("quadros/filter");
$this->arrayBreadCrumb = array();
if ($this->arrayVariable != NULL) {
$temp_array = array_splice($this->arrayRestFolder, 2, count($this->arrayRestFolder) - 1);
//Debug::print_r($temp_array);
//exit();
if ($this->arrayRestFolder[1] == "filter") {
$this->url_final .= "/" . implode("/", $temp_array);
//tirando a página da url final
$this->url_final = preg_replace("/\\/pag\\.[0-9]+?/", "", $this->url_final);
}
$array_relacao_variavel_resultado = array();
$array_relacao_variavel_resultado["search"] = "requestSearch";
$array_relacao_variavel_resultado["material"] = "requestMaterial";
$array_relacao_variavel_resultado["color"] = "requestColor";
$array_relacao_variavel_resultado["style"] = "requestStyle";
$array_relacao_variavel_resultado["format"] = "requestFormat";
$array_relacao_variavel_resultado["theme"] = "requestTheme";
$array_relacao_variavel_resultado["composition"] = "requestComposition";
$array_relacao_variavel_resultado["technique"] = "requestTechnique";
$array_relacao_variavel_resultado["type"] = "requestType";
$array_relacao_variavel_resultado["promocoes"] = "requestPromocao";
foreach ($this->arrayVariable as $variable => $value) {
if ($variable == "search" && DataHandler::forceString($value) != NULL) {
$this->requestResumeSearch = DataHandler::forceString(urldecode($value));
if (strlen($this->requestResumeSearch) > 10) {
$this->requestResumeSearch = substr($this->requestResumeSearch, 0, 10) . "...";
}
}
if (DataHandler::forceInt($value) > 0) {
if (isset($array_relacao_variavel_resultado[$variable]) && $array_relacao_variavel_resultado[$variable] != null) {
$this->{$array_relacao_variavel_resultado}[$variable] = DataHandler::forceInt(trim($value));
}
} else {
//se não nenhum desses itens segnifica q é sujeira por isso não grava na url
continue;
}
//popula o bread crumb de maneira incompleta pois seria esforço a toa procurar o título aqui
$this->arrayBreadCrumb[] = new BreadCrumbInfoVO("", $variable, $value);
//concatena as veriaveis ja enviadas para fazer a base do link
//$this->url_final .= "/".$variable.".".$value;
}
}
}
示例8: setOrder
/**
* @param $order (str)
* @return void
*/
public function setOrder($order)
{
$this->order = DataHandler::forceString($order);
}
示例9: get
/**
* serve para buscar um unico item especifico, baseado no id
* @return ReturnResultVO
*/
public function get()
{
//inicia um retorno de ReturnResultVO
$ReturnResultVO = new ReturnResultVO();
$table = DataHandler::forceString($this->ContentInfoPostVO->request_table);
$table_id = DataHandler::forceInt($this->ContentInfoPostVO->request_table_id);
$content_id = DataHandler::forceInt($this->ContentInfoPostVO->request_content_id);
$slug = DataHandler::forceString($this->ContentInfoPostVO->request_slug);
$locale = DataHandler::forceString($this->ContentInfoPostVO->request_locale);
$type_of_return = DataHandler::forceString($this->ContentInfoPostVO->request_type_of_return);
//verifica se foram passados os parametros necessarios para o slect
if ($table_id > 0 && $slug != NULL) {
$DAO = ContentDAO::getInstance();
//se foi passado locale o retorno vai ser em stClassVO
//se nao o retorno vem em VO para depois buscar os locales
$ReturnDataVO = $DAO->selectBySlugAndTableId($slug, $table, $table_id, $locale, $type_of_return);
//print_r($ReturnDataVO);
//se deu erro retorna
if (!$ReturnDataVO->success || count($ReturnDataVO->result) <= 0) {
//deu erro ao vincular
$ReturnResultVO->success = false;
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_CONTENT_NOT_FOUND");
return $ReturnResultVO;
}
//se foi passado o locale vei pegar os campos com locale
if ($locale != NULL) {
//faz o get com locale
$tempResult = array();
foreach ($ReturnDataVO->result as $vo) {
$tempResult = $vo->toStdClass($locale);
}
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $ReturnDataVO->result;
return $ReturnResultVO;
}
//se estiver tudo certo prepara o retorno no objeto ReturnResultVO
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $ReturnDataVO->result;
return $ReturnResultVO;
} else {
//Debug::print_r($this->ContentInfoPostVO);
$ReturnResultVO->success = FALSE;
$ReturnResultVO->result = array();
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_CONTENT_NOT_FOUND");
return $ReturnResultVO;
}
}
示例10: addFilter
private function addFilter(&$query, $id, $active, $name, $country_id, $uf)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($uf !== NULL) {
$query .= " AND `uf` = '" . DataHandler::forceString($uf) . "'";
}
if ($name !== NULL) {
$query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
}
if ($country_id !== NULL) {
$query .= " AND `country_id` = '" . DataHandler::forceInt($country_id) . "'";
}
}
示例11: update
/**
* @param $table
* @param $table_id
* @param $name
* @param $type
* @param $active
* @param $locale
* @param $varchar
* @param $text
* @param $number
* @param $int
* @param $date
* @return ReturnDataVO
*/
public function update($id, $table, $table_id, $name = NULL, $type = ParametherDAO::TYPE_VARCHAR, $active = 1, $locale = NULL, $varchar = NULL, $text = NULL, $number = NULL, $int = NULL, $date = NULL)
{
$ReturnDataVO = new ReturnDataVO();
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$query = "UPDATE `paramether` SET ";
$comma = "";
if ($active !== NULL) {
$query .= "{$comma} `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($table !== NULL) {
$query .= " {$comma} `table` = '" . DataHandler::forceString($table) . "'";
$comma = " , ";
}
if ($table_id !== NULL) {
$query .= " {$comma} `table_id` = '" . DataHandler::forceInt($table_id) . "'";
$comma = " , ";
}
if ($name !== NULL) {
$query .= "{$comma} `name` = '" . DataHandler::forceString($name) . "'";
$comma = ", ";
}
if ($type !== NULL) {
$query .= " {$comma} `type` = '" . DataHandler::forceString($type) . "'";
$comma = " , ";
}
if ($locale !== NULL) {
$query .= " {$comma} `locale` = '" . DataHandler::forceString($locale) . "'";
$comma = ", ";
}
if ($varchar !== NULL) {
$query .= " {$comma} `varchar` = '" . DataHandler::forceString($varchar) . "'";
$comma = ", ";
}
if ($text !== NULL) {
$query .= " {$comma} `text` = '" . DataHandler::forceString($text) . "'";
$comma = ", ";
}
if ($number !== NULL) {
$query .= " {$comma} `number` = '" . DataHandler::forceNumber($number) . "'";
$comma = ", ";
}
if ($int !== NULL) {
$query .= " {$comma} `int` = '" . DataHandler::forceInt($int) . "'";
$comma = ", ";
}
if ($date !== NULL) {
$query .= " {$comma} `date` = '" . DataHandler::convertDateToDB($date) . "'";
$comma = ", ";
}
$query .= " WHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1 ";
//echo $query;
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_UPDATES;
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
if (!$ReturnDataVO->success) {
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_COMMIT;
}
return $ReturnDataVO;
}
}
示例12: forceType
static function forceType($valor, $type = "string")
{
switch ($type) {
case "string":
case "date":
return DataHandler::forceString($valor);
break;
case "number":
return DataHandler::forceNumber($valor);
break;
case "int":
return DataHandler::forceInt($valor);
break;
default:
return DataHandler::forceString($valor);
break;
}
}
示例13: addFilter
private function addFilter(&$query, $id = NULL, $address_id = NULL, $name = NULL, $last_name = NULL, $birthday = NULL, $mobile = NULL, $telephone = NULL, $email = NULL, $rg = NULL, $cpf = NULL, $company = NULL, $website = NULL, $sex = NULL, $recive_news = NULL, $registred = NULL, $user_type_id = NULL, $date = NULL, $date_symbol = ">=")
{
if ($id !== NULL) {
$query .= " AND user.id = '" . DataHandler::forceInt($id) . "'";
}
if ($name !== NULL) {
$query .= " AND `name` LIKE '%" . DataHandler::forceString($name) . "%'";
}
if ($last_name !== NULL) {
$query .= " AND `last_name` ='" . DataHandler::forceString($last_name) . "'";
}
if ($birthday !== NULL) {
$query .= " AND `birthday` =" . $this->dateHandlerScape($birthday);
}
if ($mobile !== NULL) {
$query .= " AND `mobile` ='" . DataHandler::forceString($mobile) . "'";
}
if ($telephone !== NULL) {
$query .= " AND `telephone` ='" . DataHandler::forceString($telephone) . "'";
}
if ($email !== NULL) {
$query .= " AND `email` ='" . DataHandler::forceString($email) . "'";
}
if ($rg !== NULL) {
$query .= " AND `rg` ='" . DataHandler::forceString($rg) . "'";
}
if ($cpf !== NULL) {
$query .= " AND `cpf` ='" . DataHandler::forceString($cpf) . "'";
}
if ($company !== NULL) {
$query .= " AND `company` ='" . DataHandler::forceString($company) . "'";
}
if ($website !== NULL) {
$query .= " AND `website` ='" . DataHandler::forceString($website) . "'";
}
if ($sex !== NULL) {
$query .= " AND `sex` ='" . DataHandler::forceInt($sex) . "'";
}
if ($recive_news !== NULL) {
$query .= " AND `recive_news` ='" . DataHandler::forceInt($recive_news) . "'";
}
if ($registred !== NULL) {
$query .= " AND `registred` =" . $this->dateHandlerScape($registred) . "";
}
if ($user_type_id != NULL) {
$query .= " AND `user_type_id` =" . DataHandler::forceInt($user_type_id) . "";
}
if ($date !== NULL) {
$date_symbol = parent::compareSimble($date_symbol);
$date = parent::dateHandlerScape(DataHandler::convertDateToDB($date));
$query .= " AND `registred` {$date_symbol} {$date} ";
}
}
示例14: setSlug
/**
* @param $slug (str)
* @param $locale
* @return void
*/
public function setSlug($slug, $locale = NULL)
{
if ($locale == NULL) {
$this->slug = DataHandler::forceString($slug);
} else {
$this->addTherms(CategoryVO::CATEGORY_SLUG, $locale, $slug);
}
}
示例15: setDescription
/**
* @param $description (str)
* @param $locale
* @return void
*/
public function setDescription($description, $locale = NULL)
{
if ($locale == NULL) {
$this->description = DataHandler::forceString($description);
} else {
$this->addComments(CommentVO::TERM_DESCRIPTION, $locale, $description);
}
}