| 1 | <?php |
| 2 | /* |
| 3 | * Copyright (C) 2003-2005 Polytechnique.org |
| 4 | * http://opensource.polytechnique.org/ |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | require_once 'Plugin/Render.php'; |
| 22 | |
| 23 | /** The RenderPhp plugin allows you to execute a file as PHP |
| 24 | * rather than return its content. |
| 25 | **/ |
| 26 | class RenderPhp extends Diogenes_Plugin_Render |
| 27 | { |
| 28 | /** Plugin name */ |
| 29 | var $name = "RenderPhp"; |
| 30 | |
| 31 | /** Plugin description */ |
| 32 | var $description = "This plugin allows you to execute a page as PHP code. Simply write your page as a PHP page and its output will be displayed within the template framework."; |
| 33 | |
| 34 | /** Execute a given file and return the output. |
| 35 | */ |
| 36 | function render($file) |
| 37 | { |
| 38 | ob_start(); |
| 39 | include($file); |
| 40 | $content = ob_get_contents(); |
| 41 | ob_end_clean(); |
| 42 | |
| 43 | return $content; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | ?> |