本文整理汇总了PHP中DataHandler类的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler类的具体用法?PHP DataHandler怎么用?PHP DataHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deactivate_plugin
/**
* Deactivate a plugin
*
* @since 1.0
*
* @param string $plugin_file Relative path to plugin
* @return bool Whether plugin was deactivated
*/
function deactivate_plugin($plugin_file)
{
global $current_plugins;
if (!isset($current_plugins[md5($plugin_file)])) {
return false;
}
if (!validate_plugin($plugin_file)) {
return false;
}
unset($current_plugins[md5($plugin_file)]);
$data = new DataHandler();
$data->save('plugins.data', serialize($current_plugins));
return true;
}
示例2: addComments
/**
* @param $title
* @param $description
* @param $user_id
* @param $t_id
* @param $active
* @return void
*/
public function addComments($title = NULL, $description = NULL, $user_id = NULL, $t_id = "insert", $active = NULL)
{
//se passar o p_id indica que está editando um term já existente
//criando a array a ser inserida - usado como se fosse um mini VO
$this->startCommentDAO();
$CommentVO = $this->CommentDAO->getItemVO();
$CommentVO->setStatus($t_id == "insert" || $t_id == NULL ? CommentDAO::STATUS_INSERT : CommentDAO::STATUS_UPDATE);
$CommentVO->setTitle($title);
$CommentVO->setDescription($description);
$CommentVO->setUserId($user_id);
$CommentVO->setTableId($this->id);
$CommentVO->setTable($this->__table);
$CommentVO->setActive($active);
//verifica se deve c a array de parameter
if ($this->id > 0) {
//se já tem id é pq é um dado já cadastrado
$this->getComments();
}
//se não tem, então vai adicionar só os terms novos
if (!count($this->__arrayComments) > 0) {
//iniciando a array para demonstrar que já buscou ou tentou buscar
$this->__arrayComments = array();
}
$t_id = DataHandler::forceInt($t_id);
if ($t_id > 0) {
$CommentVO->setId($t_id);
}
$this->updateComment($CommentVO);
//else {
//push/
//echo "<li>adicionando".var_dump($CommentVO)."</li>";
//$this->__arrayComments[] = $CommentVO;
//}
//s vai realmente adicionar quando for chamado o metodo cadastrar()
}
示例3: createImage
/**
* Creation of the original image object.
*
* @return object of the image created.
*/
function createImage()
{
//est� conferindo o arquivo pela exten��o contando que foi conferido o tipo de arquivo ao recebe-lo
$extensao = DataHandler::returnExtensionOfFile($this->image);
// echo Debug::li(filetype($this->image));
// exit();
switch (strtolower($extensao)) {
case 'jpg':
case 'jpeg':
return imagecreatefromjpeg($this->image);
break;
case 'gif':
return imagecreatefromgif($this->image);
break;
case 'png':
return imagecreatefrompng($this->image);
break;
case 'bmp':
return imagecreatefromwbmp($this->image);
break;
default:
return imagecreatefromjpeg($this->image);
break;
}
}
示例4: setFetchArray
public function setFetchArray($array)
{
//print_r($array);
$this->id = DataHandler::getValueByArrayIndex($array, "id");
$this->active = DataHandler::getValueByArrayIndex($array, "active");
$this->name = DataHandler::getValueByArrayIndex($array, "name");
$this->title = DataHandler::getValueByArrayIndex($array, "title");
$this->hat = DataHandler::getValueByArrayIndex($array, "hat");
$this->description = DataHandler::getValueByArrayIndex($array, "description");
$this->content = DataHandler::getValueByArrayIndex($array, "content");
$this->author = DataHandler::getValueByArrayIndex($array, "author");
$this->template_url = DataHandler::getValueByArrayIndex($array, "template_url");
$this->slug = DataHandler::getValueByArrayIndex($array, "slug");
$this->key_words = DataHandler::getValueByArrayIndex($array, "key_words");
$this->date = DataHandler::getValueByArrayIndex($array, "date");
$this->date_in = DataHandler::getValueByArrayIndex($array, "date_in");
$this->date_out = DataHandler::getValueByArrayIndex($array, "date_out");
$this->order = DataHandler::getValueByArrayIndex($array, "order");
$this->request_table_id = DataHandler::getValueByArrayIndex($array, "table_id");
$this->request_table = DataHandler::getValueByArrayIndex($array, "table");
$this->request_content_id = DataHandler::getValueByArrayIndex($array, "content_id");
$this->request_slug = DataHandler::getValueByArrayIndex($array, "slug");
$this->request_locale = DataHandler::getValueByArrayIndex($array, "locale");
$this->request_quant_start = DataHandler::getValueByArrayIndex($array, "quant_start");
$this->request_quant_limit = DataHandler::getValueByArrayIndex($array, "quant_limit");
$this->request_type_of_return = DataHandler::getValueByArrayIndex($array, "type_of_return");
}
示例5: setFetchArray
public function setFetchArray($array)
{
$this->image_info_id = DataHandler::getValueByArrayIndex($array, "image_info_id");
$this->image_info_type = DataHandler::getValueByArrayIndex($array, "image_info_type");
$this->image_info_active = DataHandler::getValueByArrayIndex($array, "image_info_active");
$this->image_info_url = DataHandler::getValueByArrayIndex($array, "image_info_url");
$this->image_info_name = DataHandler::getValueByArrayIndex($array, "image_info_name");
$this->image_info_description = DataHandler::getValueByArrayIndex($array, "image_info_description");
$this->image_info_order = DataHandler::getValueByArrayIndex($array, "image_info_order");
$this->image_info_locale = DataHandler::getValueByArrayIndex($array, "image_info_locale");
$this->image_info_author = DataHandler::getValueByArrayIndex($array, "image_info_author");
$this->request_image_id = DataHandler::getValueByArrayIndex($array, "image_id");
$this->request_image_url = DataHandler::getValueByArrayIndex($array, "image_url");
//abaixo, ATENÇÃO: Filedata
$this->file_data = DataHandler::getValueByArrayIndex($array, "Filedata");
$this->file_url = DataHandler::getValueByArrayIndex($array, "file_url");
//info de requisição de thumb
$this->request_max_width = DataHandler::getValueByArrayIndex($array, "max_width");
$this->request_max_height = DataHandler::getValueByArrayIndex($array, "max_height");
$this->request_crop = DataHandler::getValueByArrayIndex($array, "crop");
$this->request_direct_show = DataHandler::getValueByArrayIndex($array, "direct_show");
$this->request_natural_size = DataHandler::getValueByArrayIndex($array, "natural_size");
//info de vinculo
$this->table = DataHandler::getValueByArrayIndex($array, "table");
$this->table_id = DataHandler::getValueByArrayIndex($array, "table_id");
}
示例6: setFetchArray
public function setFetchArray($array)
{
//print_r($array);
$this->host = DataHandler::getValueByArrayIndex($array, "host");
$this->smtp_auth = DataHandler::getValueByArrayIndex($array, "smtp_auth") == NULL ? FALSE : TRUE;
$this->username = DataHandler::getValueByArrayIndex($array, "username");
$this->password = DataHandler::getValueByArrayIndex($array, "password");
$this->from = DataHandler::getValueByArrayIndex($array, "from");
$this->from_name = DataHandler::getValueByArrayIndex($array, "from_name");
$this->to = DataHandler::getValueByArrayIndex($array, "to");
$this->is_html = DataHandler::getValueByArrayIndex($array, "is_html") == NULL ? FALSE : TRUE;
$this->subject = DataHandler::getValueByArrayIndex($array, "subject");
$this->add_address = DataHandler::getValueByArrayIndex($array, "add_address");
$this->body = DataHandler::getValueByArrayIndex($array, "body");
if (DataHandler::getValueByArrayIndex($array, "char_set") != NULL) {
switch (strtolower(DataHandler::getValueByArrayIndex($array, "char_set"))) {
case "iso-8859-1":
$this->char_set = "ISO-8859-1";
break;
case "utf-8":
default:
$this->char_set = "UTF-8";
break;
}
}
}
示例7: setFetchArray
public function setFetchArray($array)
{
//print_r($array);
$this->captcha_code = DataHandler::getValueByArrayIndex($array, "captcha_code");
$this->captcha_image = DataHandler::getValueByArrayIndex($array, "captcha_image");
$this->captcha_value = DataHandler::getValueByArrayIndex($array, "captcha_value");
}
示例8: 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;
}
}
示例9: addVote
public function addVote($uID, $iStance, $iComment)
{
$input = array('stance' => $iStance, 'comment' => $iComment);
$rtn = Validator::init('addVote', $input);
if (is_array($rtn)) {
foreach ($rtn as $key => $value) {
if ($rtn[$key] != 'valid') {
$flag = false;
}
}
} else {
return false;
}
if (!isset($flag)) {
$rtn = DataHandler::insertRegVote($this->getID(), $uID, $iStance, $iComment);
if ($rtn[0] == true) {
if (is_numeric($rtn[1])) {
array_push($this->voterefs, $rtn);
CookiesManager::SetCookies($this->id, $rtn[1]);
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return 'Invalid Input';
}
}
示例10: toStdClass
/**
* @param string $LOCALE
* @return stdClass
*/
public function toStdClass($LOCALE = NULL, $force = FALSE)
{
if (!$force && $this->__cacheObjReturn) {
return $this->__cacheObjReturn;
}
$obj = new stdClass();
$arrayMetodos = get_class_methods($this);
//filtra os metodos do tipo get
// print_r($this->arrayMethodExeptionGET);
// exit();
foreach ($arrayMetodos as $metodo) {
if (!in_array($metodo, $this->arrayMethodExeptionGET) && @ereg("^get", $metodo)) {
//da o nome do atributo para o mesmo nome do metodo publico get, só que sem o get
$atributo = @ereg_replace("^get_", "", DataHandler::ecmaToUnderline($metodo));
//pegando o valor
if ($LOCALE) {
$tempValor = $this->{$metodo}($LOCALE);
} else {
$tempValor = $this->{$metodo}();
}
//adiciona o atributo no objeto de retorno
$obj->{$atributo} = $tempValor;
}
}
$this->__cacheObjReturn = $obj;
return $obj;
}
示例11: 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);
}
}
}
示例12: index
public function index()
{
require_once '../application/services/DataHandler.php';
$data = array('id' => '1000202555', 'fb_sig_user' => '1000202555', 'call_id' => 'call1276839998658', 'swf_version' => 85);
$testcase = new DataHandler();
$ret = $testcase->handle('retrieve_data', (object) $data, 'retrieve_data');
echo "<br>========handle===========";
print_r($ret);
// $ret = $testcase->initUserMapData();
//echo '<pre>';
// echo "<br>========initUserMapData===========";
//print_r($ret);
// unset($ret);
// $ret = $testcase->getUserMaps(100020206);
// echo '<pre>';
// echo "<br>========getUserMaps===========";
// print_r($ret);
echo '</pre>';
}
示例13: __construct
function __construct($fileName)
{
// *** Open up the file
$this->image = $this->openImage($fileName);
// save the extension
$this->extension_file = strtolower(DataHandler::returnExtensionOfFile($fileName));
// *** Get width and height
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
}
示例14: getZipedFiles
/**
* envie por post uma array de ids de files, só os ids
* file/get_ziped_files
*/
public function getZipedFiles()
{
if (!UserClient::getId() > 0) {
//nao tem permissao
Navigation::redirect("405");
exit;
}
$array_file_ids = DataHandler::getValueByArrayIndex($_POST, "file_id");
//Debug::print_r($_REQUEST);
$array_file_vo = array();
if (is_array($array_file_ids)) {
foreach ($array_file_ids as $id) {
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
}
} else {
//erro, não é uma array, verifica se pelo menos é 1 único id
$id = DataHandler::forceInt($array_file_ids);
if ($id > 0) {
//é um id único
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
} else {
//erro mesmo, esse dado é zoado, estoura excessão
throw new Exception("No ids sended", 404);
exit;
}
}
//a pasta zip precisa existir
DataHandler::createFolderIfNotExist("upload/zip/");
//verifica o nome do arquivo baseado nos ids enviados conforme regra inventada agora
$zip_name = "upload/zip/" . md5(implode("|", $array_file_ids));
DataHandler::createFolderIfNotExist($zip_name);
$zip_name = $zip_name . "/teto.zip";
if (!file_exists($zip_name)) {
//echo Debug::li($zip_name);exit();
$Zip = new ZipArchive();
$Zip->open($zip_name, ZipArchive::CREATE);
foreach ($array_file_vo as $FileVO) {
$url = $FileVO->getUrl();
$array = explode("/", $url);
$file = $array[count($array) - 1];
$Zip->addFile($url, $file);
}
$Zip->close();
}
header("Location: " . Config::getRootPath($zip_name));
exit;
}
示例15: limit
/**
*
* @param (int) $quant_limite = NULL
* @param (int) $quant_inicial = NULL
* @return string
*/
public function limit($quant_limit = NULL, $quant_start = NULL)
{
//$quant_start
$quant_limit = DataHandler::forceInt($quant_limit);
$quant_limit = $quant_limit < 0 ? 0 : $quant_limit;
$quant_start = DataHandler::forceInt($quant_start);
$quant_start = $quant_start < 0 ? 0 : $quant_start;
if ($quant_limit > 0) {
return " LIMIT {$quant_start}, {$quant_limit} ";
}
return "";
}