1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Modules\Editor;
13
14 /**
15 * "PHP" editor.
16 */
17 class PHPEditor implements Editor
18 {
19 /**
20 * Returns content as is.
21 *
22 * @see Icybee\Modules\Editor.Editor::serialize()
23 */
24 public function serialize($content)
25 {
26 return $content;
27 }
28
29 /**
30 * Returns serialized content as is.
31 *
32 * @see Icybee\Modules\Editor.Editor::unserialize()
33 */
34 public function unserialize($serialized_content)
35 {
36 return $serialized_content;
37 }
38 /**
39 * @return PHPEditorElement
40 *
41 * @see Icybee\Modules\Editor.Editor::from()
42 */
43 public function from(array $attributes)
44 {
45 return new PHPEditorElement($attributes);
46 }
47
48 /**
49 * Returns content as is.
50 *
51 * @see Icybee\Modules\Editor.Editor::render()
52 */
53 public function render($content)
54 {
55 global $core;
56
57 ob_start();
58
59 eval('?>' . $content);
60
61 return ob_get_clean();
62 }
63 }