Change behaviour from serialize to json for language elements

This commit is contained in:
Antonio de la Rosa 2016-03-15 01:24:38 +01:00
parent 1cad6220b8
commit 49bd15247d

View file

@ -15,6 +15,7 @@ use PhangoApp\PhaI18n\I18n;
use PhangoApp\PhaModels\Forms\MultiLangForm; use PhangoApp\PhaModels\Forms\MultiLangForm;
use PhangoApp\PhaModels\Forms\TextForm; use PhangoApp\PhaModels\Forms\TextForm;
use PhangoApp\PhaModels\CoreFields\SlugifyField; use PhangoApp\PhaModels\CoreFields\SlugifyField;
use PhangoApp\PhaModels\CoreFields\TextField;
/** /**
* Multilanguage fields. * Multilanguage fields.
@ -36,10 +37,10 @@ class I18nField extends PhangoField {
//This method is used for check all members from serialize //This method is used for check all members from serialize
function __construct($type_field) function __construct()
{ {
$this->type_field=&$type_field; $this->type_field=new TextField();
$this->parameters=[]; $this->parameters=[];
} }
@ -67,7 +68,7 @@ class I18nField extends PhangoField {
} }
$ser_value=addslashes(serialize($value)); $ser_value=addslashes(json_encode($value));
return $ser_value; return $ser_value;
@ -85,7 +86,7 @@ class I18nField extends PhangoField {
static function show_formatted($value) static function show_formatted($value)
{ {
$arr_lang=@unserialize($value); $arr_lang=json_decode($value, true);
settype($arr_lang, 'array'); settype($arr_lang, 'array');