00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 class aliroEditor {
00044
00045 private static $instance = __CLASS__;
00046 private $mambothandler = '';
00047 private $initiated = false;
00048
00049 private function __construct () {
00050 $this->mambothandler = aliroMambotHandler::getInstance();
00051 }
00052
00053 private function __clone () {
00054
00055 }
00056
00057 public static function getInstance () {
00058 return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
00059 }
00060
00061 public function initEditor() {
00062 $this->initiated = true;
00063 return $this->triggerEditor ('onIniEditor');
00064 }
00065
00066 public function getEditorContents( $editorArea, $hiddenField ) {
00067 echo $this->getEditorContentsText($editorArea, $hiddenField);
00068 }
00069
00070 public function getEditorContentsText ( $editorArea, $hiddenField ) {
00071 if (!$this->initiated) $this->initEditor();
00072 return $this->triggerEditor ('onGetEditorContents', array($editorArea, $hiddenField));
00073 }
00074
00075 public function editorAreaText ($name, $content, $hiddenField, $width, $height, $col, $row) {
00076 if (!$this->initiated) $this->initEditor();
00077 return $this->triggerEditor ('onEditorArea', array($name, $content, $hiddenField, $width, $height, $col, $row));
00078 }
00079
00080 public function editorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
00081 echo $this->editorAreaText ($name, $content, $hiddenField, $width, $height, $col, $row);
00082 }
00083
00084 private function triggerEditor ($trigger, $arguments=null) {
00085 $html = '';
00086 if ($arguments) $results = call_user_func(array($this->mambothandler, 'triggerOnce'), $trigger, $arguments);
00087 else $results = call_user_func(array($this->mambothandler, 'triggerOnce'), $trigger);
00088 foreach ($results as $result) $html .= trim($result);
00089 return $html;
00090 }
00091
00092 }