本文整理汇总了PHP中Kohana::unserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::unserialize方法的具体用法?PHP Kohana::unserialize怎么用?PHP Kohana::unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::unserialize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _load_values
protected function _load_values(array $values)
{
if (!empty($values['data'])) {
$values['data'] = Kohana::unserialize($values['data']);
}
parent::_load_values($values);
}
示例2: code
public function code()
{
if ($this->_code === FALSE) {
try {
$this->_code = Kohana::unserialize($this->code);
} catch (Exception $e) {
$this->_code = new Model_Widget_HTML();
}
$this->_code->id = $this->id;
}
return $this->_code;
}
示例3: find_by_keyword
/**
*
* @param string $keyword
* @param boolean $only_title
* @param string $modules
* @param integer $limit
* @param integer $offset
* @return array
*/
public function find_by_keyword($keyword, $only_title = FALSE, $modules = NULL, $limit = 50, $offset = 0)
{
if (Kohana::$profiling === TRUE) {
$benchmark = Profiler::start('Search', __FUNCTION__);
}
$query = DB::select('id', 'module', 'title', 'annotation', 'params')->from('search_index');
$result = $this->_get_query($query, $keyword, $only_title, $modules, $limit, $offset)->execute()->as_array();
$ids = array();
foreach ($result as $row) {
$row['params'] = Kohana::unserialize($row['params']);
$ids[$row['module']][$row['id']] = $row;
}
if (isset($benchmark)) {
Profiler::stop($benchmark);
}
return $ids;
}
示例4: get
/**
*
* @param string $key
* @param mixed $default
* @param integer $user_id
* @return mixed
*/
public static function get($key, $default = NULL, $user_id = NULL)
{
if ($user_id === NULL) {
$user_id = Auth::get_id();
}
self::_load($user_id);
$value = Arr::path(self::$_cache, $user_id . '.' . $key);
if ($value !== NULL) {
return @Kohana::unserialize($value);
} else {
if ($user_id === 0) {
return $default;
}
self::_load(0);
$value = Arr::path(self::$_cache, 0 . '.' . $key);
if ($value !== NULL) {
return @Kohana::unserialize($value);
} else {
return $default;
}
}
}
示例5: load_from_array
/**
*
* @param array $data
* @return Model_Widget_Decorator
*/
public static function load_from_array(array $data)
{
if (empty($data) or !self::exists_by_type($data['type'])) {
return NULL;
}
$widget = Kohana::unserialize($data['code']);
unset($data['code'], $data['type']);
foreach ($data as $key => $value) {
$widget->{$key} = $value;
}
self::$_cache[$widget->id] = $widget;
return $widget;
}
示例6: data
public function data()
{
return Kohana::unserialize($this->data);
}
示例7: unserialize
/**
* Prepares the database connection and reloads the object.
*
* @param string $data String for unserialization
* @return void
*/
public function unserialize($data)
{
// Initialize model
$this->_initialize();
foreach (Kohana::unserialize($data) as $name => $var) {
$this->{$name} = $var;
}
if ($this->_reload_on_wakeup === TRUE) {
// Reload the object
$this->reload();
}
}
示例8: _load_settings
/**
* Загрузка параметров плагина из БД
*
* @return \Plugin_Decorator
*/
protected function _load_settings()
{
$settings = DB::select('settings')->from(Plugin::TABLE_NAME)->where('id', '=', $this->id())->cache_key(Plugin::CACHE_KEY . '::plugin::' . $this->id())->cached(Date::DAY)->limit(1)->execute()->get('settings');
$this->_settings = !empty($settings) ? Kohana::unserialize($settings) : array();
return $this;
}
示例9: load_from_array
/**
* Загрузка разедла из массива данных
*
* @param array $data
* @return Datasource_Section
*/
public static function load_from_array(array $data)
{
$section = Kohana::unserialize($data['code']);
$section->_id = $data['id'];
$section->name = $data['name'];
$section->description = Arr::get($data, 'description');
$section->_docs = (int) Arr::get($data, 'docs');
$section->_is_indexable = (bool) Arr::get($data, 'indexed');
$section->_created_by_id = (int) Arr::get($data, 'created_by_id');
$section->_folder_id = (int) Arr::get($data, 'folder_id');
return $section;
}
示例10: get_field_from_array
/**
* Преобразование массива в объект поля
*
* @see DataSource_Hybrid_Field_Factory::get_fields()
*
* @param array $array
* @return null|\DataSource_Hybrid_Field
* @throws Kohana_Exception
*/
public static function get_field_from_array(array $array = NULL)
{
if (empty($array) or !isset($array['type'])) {
return NULL;
}
$class_name = 'DataSource_Hybrid_Field_' . $array['type'];
if (!class_exists($class_name)) {
return NULL;
}
if (isset($array['props'])) {
$props = Kohana::unserialize($array['props']);
unset($array['props']);
if (is_array($props)) {
$array = Arr::merge($array, $props);
}
}
$result = DataSource_Hybrid_Field::factory($array['type'], $array);
$result->set_id(Arr::get($array, 'id'));
$result->set_ds(Arr::get($array, 'ds_id'));
return $result;
}