/** * Renders a view. * * Add an additional filter to modify view data * * @param boolean set to TRUE to echo the output instead of returning it * @param callback special renderer to pass the output through * @return string if print is FALSE * @return void if print is TRUE */ public function render($print = FALSE, $renderer = FALSE) { // Run view_pre_render filter to allow plugins/themes to add extra data to a view Event::run('ushahidi_filter.view_pre_render', $this->kohana_local_data); // View specific hook pre render hook ie. ushahidi_filter.view_pre_render.reports_main Event::run('ushahidi_filter.view_pre_render.' . str_replace('/', '_', $this->name), $this->kohana_local_data); return parent::render($print, $renderer); }
/** * Override View_Core::render so that we trap errors stemming from bad PHP includes and show a * visible stack trace to help developers. * * @see View_Core::render */ public function render($print=false, $renderer=false) { try { return parent::render($print, $renderer); } catch (Exception $e) { Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); return ""; } }
public function __construct($name, $data = NULL, $type = NULL) { $smarty_ext = Kohana::config('smarty.templates_ext'); if (Kohana::config('smarty.integration') == TRUE and Kohana::find_file('views', $name, FALSE, empty($type) ? $smarty_ext : $type)) { $type = empty($type) ? $smarty_ext : $type; } parent::__construct($name, $data, $type); }
public function set_filename($name, $type = NULL) { if ($path = Kohana::find_file('themes/' . theme::$name . '/views', $name) or $path = Kohana::find_file(theme::$name . '/views', $name) or $path = Kohana::find_file('default/views', $name)) { $this->kohana_filename = $path; $this->kohana_filetype = EXT; } else { parent::set_filename($name, $type); } return $this; }
/** * Override View_Core::render so that we trap errors stemming from bad PHP includes and show a * visible stack trace to help developers. * * @see View_Core::render */ public function render($print = false, $renderer = false, $modifier = false) { try { $this->kohana_local_data = array_merge(View::$global_data, $this->kohana_local_data); return parent::render($print, $renderer, $modifier); } catch (Exception $e) { Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); return ""; } }
public function set_filename($name, $type = NULL) { if ($path = Kohana::find_file('themes/' . theme::$name . '/views', $name, FALSE, Kohana::config('bc.view_ext')) or $path = Kohana::find_file(theme::$name . '/views', $name, FALSE, Kohana::config('bc.view_ext')) or $path = Kohana::find_file('views', $name, FALSE, Kohana::config('bc.view_ext'))) { $this->kohana_filename = $path; $this->kohana_filetype = Kohana::config('bc.view_ext'); } else { parent::set_filename($name, $type); } return $this; }
public function template($print = FALSE, $renderer = FALSE) { $output = (string) parent::render(FALSE, $renderer); $output = json_encode($output); $output = str_replace(array('\\n', ' '), '', $output); if ($print === TRUE) { echo $output; return; } return $output; }
public function set_filename($name, $type = NULL) { $theme = Kohana::config('filebrowser.theme'); if (Kohana::find_file('views/../../../config/themes/' . $theme . '/', $name)) { parent::set_filename('../../../config/themes/' . $theme . '/' . $name, $type); } elseif (Kohana::find_file('views/../../../config/themes/default/', $name)) { parent::set_filename('../../../config/themes/default/' . $name, $type); } else { parent::set_filename('../../../config/themes/' . $theme . '/' . $name, $type); } return $this; }
/** * Override View_Core::render so that we trap errors stemming from bad PHP includes and show a * visible stack trace to help developers. * * @see View_Core::render */ public function render($print = false, $renderer = false) { try { return parent::render($print, $renderer); } catch (Exception $e) { if (!IN_PRODUCTION) { print $e->getTraceAsString(); return $e->getMessage(); } Kohana::Log('error', $e->getTraceAsString()); Kohana::Log('debug', $e->getMessage()); return ""; } }
public function __construct($name, $data = NULL, $type = NULL) { parent::__construct($name, $data, $type); }
/** * Override the set_filename property accessor to keep a record of the view name, letting us check for * plugins which are linked to this view's path. */ public function set_filename($name, $type = NULL) { parent::set_filename($name, $type); $this->viewname = $name; }