mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 19:39:16 -04:00
Preliminary work to cut over to Kohana 2.4
- Kohana::log() -> Kohana_Log::add() - Kohana::config_XXX -> Kohana_Config::instance()->XXX - Implement View::set_global in MY_View - Updated Cache_Database_Driver to latest APIs - ORM::$loaded -> ORM::loaded() - Updated item::viewable() to use K2.4 parenthesization
This commit is contained in:
@@ -18,6 +18,31 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class View extends View_Core {
|
||||
static $global_data;
|
||||
|
||||
/**
|
||||
* Reimplement Kohana 2.3's View::set_global() functionality.
|
||||
*/
|
||||
public function set_global($key, $value) {
|
||||
View::$global_data->$key = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
public function __isset($key) {
|
||||
if (isset(View::$global_data->$key)) {
|
||||
return true;
|
||||
}
|
||||
return parent::__isset($key);
|
||||
}
|
||||
|
||||
public function &__get($key) {
|
||||
Kohana_Log::add("error",print_r("__get($key)",1));
|
||||
if (isset(View::$global_data->$key)) {
|
||||
return View::$global_data->$key;
|
||||
}
|
||||
return parent::__get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override View_Core::__construct so that we can set the csrf value into all views.
|
||||
*
|
||||
@@ -38,7 +63,7 @@ class View extends View_Core {
|
||||
try {
|
||||
return parent::render($print, $renderer);
|
||||
} catch (Exception $e) {
|
||||
Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString());
|
||||
Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user