Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param string     $caption   Caption
  * @param string     $name      Name for textarea field
  * @param array|null $configs   configuration - keys:
  *                              editor - editor identifier
  *                              name - textarea field name
  *                              width, height - dimensions for textarea
  *                              value - text content
  * @param bool       $nohtml    use non-WYSIWYG eitor onfailure
  * @param string     $OnFailure editor to be used if current one failed
  */
 public function __construct($caption, $name, $configs = null, $nohtml = false, $OnFailure = '')
 {
     // Backward compatibility: $name -> editor name; $configs['name'] -> textarea field name
     if (!isset($configs['editor'])) {
         $configs['editor'] = $name;
         $name = $configs['name'];
         // New: $name -> textarea field name;
         //      $configs['editor'] -> editor name;
         //      $configs['name'] -> textarea field name
     } else {
         $configs['name'] = $name;
     }
     parent::__construct($caption, $name);
     $editor_handler = \XoopsEditorHandler::getInstance();
     $this->editor = $editor_handler->get($configs['editor'], $configs, $nohtml, $OnFailure);
 }
Exemplo n.º 2
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->attributes['advanced'] = true;
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @param string  $caption    Caption
  * @param string  $name       name attribute
  * @param string  $value      Initial text
  * @param integer $rows       Number of rows
  * @param integer $cols       Number of columns
  * @param string  $hiddentext Identifier for hidden Text
  * @param array   $options    Extra options
  */
 public 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;
     }
     $xoops = \Xoops::getInstance();
     if (!isset($options['editor'])) {
         if ($editor = $xoops->getConfig('editor')) {
             $options['editor'] = $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) {
             $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 \XoopsBaseConfig::get('root-path') . $path;
             if (class_exists($class)) {
                 $this->htmlEditor = new $class($options);
             }
             if ($inLoop > 1) {
                 $this->htmlEditor = null;
             }
         }
     }
     $inLoop = 0;
 }