mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Cleanup
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class databox_fieldUnknown extends databox_field
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param databox $databox
|
||||
* @param int $id
|
||||
* @return databox_fieldUnknown
|
||||
*/
|
||||
public function __construct(databox $databox, $id)
|
||||
{
|
||||
$this->set_databox($databox);
|
||||
$this->sbas_id = $databox->get_sbas_id();
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param databox $databox
|
||||
* @param int $id
|
||||
* @return databox_fieldUnknown
|
||||
*/
|
||||
public static function get_instance(databox &$databox, $id)
|
||||
{
|
||||
$cache_key = 'field_' . $id;
|
||||
$instance_id = $databox->get_sbas_id() . '_' . $id;
|
||||
if ( ! isset(self::$_instance[$instance_id]) || (self::$_instance[$instance_id] instanceof self) === false) {
|
||||
try {
|
||||
self::$_instance[$instance_id] = $databox->get_data_from_cache($cache_key);
|
||||
} catch (Exception $e) {
|
||||
self::$_instance[$instance_id] = new self($databox, $id);
|
||||
$databox->set_data_to_cache(self::$_instance[$instance_id], $cache_key);
|
||||
}
|
||||
}
|
||||
|
||||
return self::$_instance[$instance_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true because the field is unknown
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_on_error()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user