Exemplo n.º 1
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link IcmsPersistableObject)
  * @param	string    $key      the form name
  */
 function __construct($title, $key, $value, $width = '100%', $height = '400px', $editor_name = null, $language = 'php')
 {
     parent::__construct($title, $key, $value);
     if ($editor_name == null) {
         global $xoopsConfig;
         $editor_name = $xoopsConfig['sourceeditor_default'];
     }
     require_once XOOPS_ROOT_PATH . '/class/xoopseditor.php';
     $editor_handler = XoopsEditorHandler::getInstance('source');
     $this->editor =& $editor_handler->get($editor_name, array('name' => $key, 'value' => $value, 'language' => $language, 'width' => $width, 'height' => $height));
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param    string     $caption    Caption
  * @param    string     $name       "name" attribute
  * @param    string     $value      Initial text
  * @param    int        $rows       Number of rows
  * @param    int        $cols       Number of columns
  * @param    string     $hiddentext Identifier for hidden Text
  * @param    array      $options    Extra options
  */
 function __construct($caption, $name, $value = "", $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array())
 {
     static $inLoop = 0;
     $inLoop++;
     // Second loop, invalid, return directly
     if ($inLoop > 2) {
         return;
     }
     // Else, initialize
     parent::__construct($caption, $name, $value, $rows, $cols);
     $this->_hiddenText = $hiddentext;
     if ($inLoop > 1) {
         return;
     }
     if (!isset($options['editor'])) {
         $configs = @(include $GLOBALS['xoops']->path("var/configs/xoopsconfig.php"));
         if (!empty($configs['editor'])) {
             $options['editor'] = $configs['editor'];
         }
     }
     if (!empty($this->htmlEditor) || !empty($options['editor'])) {
         $options['name'] = $this->getName();
         $options['value'] = $this->getValue();
         if (!empty($options['editor'])) {
             $this->htmlEditor = is_array($options['editor']) ? $options['editor'] : array($options['editor']);
         }
         if (count($this->htmlEditor) == 1) {
             xoops_load('XoopsEditorHandler');
             $editor_handler =& XoopsEditorHandler::getInstance();
             $this->htmlEditor = $editor_handler->get($this->htmlEditor[0], $options);
             if ($inLoop > 1) {
                 $this->htmlEditor = null;
             }
         } else {
             list($class, $path) = $this->htmlEditor;
             include_once XOOPS_ROOT_PATH . $path;
             if (class_exists($class)) {
                 $this->htmlEditor = new $class($options);
             }
             if ($inLoop > 1) {
                 $this->htmlEditor = null;
             }
         }
     }
     $inLoop = 0;
 }