|
Revision 2229, 1.7 kB
(checked in by Shadowhand, 4 months ago)
|
Creating the IN_PRODUCTION flag, and access protection for module demo controllers.
|
- Property svn:eol-style set to
LF
- Property copyright set to
Copyright (c) 2007 Kohana Team
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php defined('SYSPATH') or die('No direct script access.'); |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
abstract class Controller_Core { |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
const ALLOW_PRODUCTION = TRUE; |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
* Loads URI, and Input into this controller. |
|---|
| 20 |
* |
|---|
| 21 |
* @return void |
|---|
| 22 |
*/ |
|---|
| 23 |
public function __construct() |
|---|
| 24 |
{ |
|---|
| 25 |
if (Kohana::$instance === NULL) |
|---|
| 26 |
{ |
|---|
| 27 |
|
|---|
| 28 |
Kohana::$instance = $this; |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
$this->uri = new URI; |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
$this->input = new Input; |
|---|
| 35 |
} |
|---|
| 36 |
else |
|---|
| 37 |
{ |
|---|
| 38 |
|
|---|
| 39 |
$this->uri = Kohana::$instance->uri; |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
$this->input = Kohana::$instance->input; |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
* Includes a View within the controller scope. |
|---|
| 48 |
* |
|---|
| 49 |
* @param string view filename |
|---|
| 50 |
* @param array array of view variables |
|---|
| 51 |
* @return string |
|---|
| 52 |
*/ |
|---|
| 53 |
public function _kohana_load_view($kohana_view_filename, $kohana_input_data) |
|---|
| 54 |
{ |
|---|
| 55 |
if ($kohana_view_filename == '') |
|---|
| 56 |
return; |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
ob_start(); |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
extract($kohana_input_data, EXTR_SKIP); |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
// this way insures that $this can be accessed as if the user was in |
|---|
| 66 |
// the controller, which gives the easiest access to libraries in views |
|---|
| 67 |
include $kohana_view_filename; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
return ob_get_clean(); |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
} |
|---|
| 74 |
|
|---|