| | 1 | <?php |
|---|
| | 2 | /** |
|---|
| | 3 | * @package jelix |
|---|
| | 4 | * @subpackage coord_plugin |
|---|
| | 5 | * @author Loic Mathaud |
|---|
| | 6 | * @copyright 2007 Loic Mathaud |
|---|
| | 7 | * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file |
|---|
| | 8 | */ |
|---|
| | 9 | |
|---|
| | 10 | /** |
|---|
| | 11 | * Jelix plugin to use the Zend Framework library |
|---|
| | 12 | * |
|---|
| | 13 | * In order not to load Zend at each action, you need to explicitely activate it ! |
|---|
| | 14 | * |
|---|
| | 15 | * Use the $pluginParams property of the controller |
|---|
| | 16 | * Example : public $pluginParams = array('index' => array('zd.active' => true)); |
|---|
| | 17 | */ |
|---|
| | 18 | class jzendframeworkCoordPlugin implements jICoordPlugin { |
|---|
| | 19 | |
|---|
| | 20 | public $config; |
|---|
| | 21 | |
|---|
| | 22 | /** |
|---|
| | 23 | * @param array $config list of configuration parameters |
|---|
| | 24 | */ |
|---|
| | 25 | public function __construct($config) { |
|---|
| | 26 | $this->config = $config; |
|---|
| | 27 | } |
|---|
| | 28 | |
|---|
| | 29 | /** |
|---|
| | 30 | * Add the ZF library directory to the include_path |
|---|
| | 31 | * Include the Zend Loader class to enable the use of Zend_Loader::loadClass() |
|---|
| | 32 | */ |
|---|
| | 33 | public function beforeAction($params) { |
|---|
| | 34 | if (isset($params['zf.active']) && $params['zf.active'] == 'true') { |
|---|
| | 35 | set_include_path(get_include_path().PATH_SEPARATOR.$this->config['zendLibPath']); |
|---|
| | 36 | include_once($this->config['zendLibPath'].'/Zend/Loader.php'); |
|---|
| | 37 | } |
|---|
| | 38 | return null; |
|---|
| | 39 | } |
|---|
| | 40 | |
|---|
| | 41 | public function beforeOutput() {} |
|---|
| | 42 | public function afterProcess() {} |
|---|
| | 43 | } |
|---|
| | 44 | |