示例#1
0
 /**
  * Display FCKeditor.
  *
  */
 public function Create()
 {
     /*
      *Hack for FCKeditor
      *All Automne linx must be parsed and changed (FCKEditor does not allow non XHTML DTD tags)
      *Do not touch to this unless it be properly tested on IE and Gecko browsers
      * @author Sébastien Pauchet <*****@*****.**>
      */
     $this->Value = sensitiveIO::decodeWindowsChars($this->Value);
     if ($this->ToolbarSet == 'Default' && $this->Value != '') {
         //parse all plugin tags
         $this->Value = CMS_textEditor::parseInnerContent($this->Value);
         $this->Value = str_replace($replace, $replaceBy, $this->Value);
     }
     return $this->CreateHtml();
 }
示例#2
0
 /**
  * Parse content coming out of the WYSIWYG editor to handle all plugins tags
  *
  * @param string $text The outputed text of fckeditor
  * @param string $module The module codename which made the request
  * @return string the text with all plugin tags
  * @access public
  */
 function parseOuterContent($text, $module = MOD_STANDARD_CODENAME)
 {
     //if post only contain a space or empty div or paragraph then the block is empty.
     $cleanedText = trim(str_replace(array('&#160;', '&nbsp;', ' '), '', $text));
     if ($cleanedText == '<p></p>' || $cleanedText == '<div></div>') {
         $text = '';
     }
     if ($text) {
         /*
          * we need to do some replacements to be completely conform with Automne
          * you can add here all dirty tags to be removed from editor's output
          */
         $replace = array('{' => '&#123;', '}' => '&#125;', '&#123;&#123;' => '{{', '&#125;&#125;' => '}}', "%7B%7B" => "{{", "%7D%7D" => "}}", "/>" => " />", "<o:p>" => "", "</o:p>" => "", "<!--[if !supportLists]-->" => "", "<!--[endif]-->" => "", "<?php" => "", "<?" => "", "?>" => "");
         $text = str_replace(array_keys($replace), $replace, $text);
         $text = sensitiveIO::decodeWindowsChars($text);
         $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_WYSIWYG_OUTER_TAGS, RESOURCE_DATA_LOCATION_EDITION, new CMS_date());
         $wantedTags = $modulesTreatment->getWantedTags();
         //create regular expression on wanted tags
         $exp = '';
         foreach ($wantedTags as $aWantedTag) {
             $exp .= $exp ? '|<' . $aWantedTag["tagName"] : '<' . $aWantedTag["tagName"];
         }
         //is parsing needed (value contain some of these wanted tags)
         if (is_array($wantedTags) && $wantedTags && preg_match('#(' . $exp . ')+#', $text) !== false) {
             $modulesTreatment->setTreatmentParameters(array('module' => $module));
             $modulesTreatment->setDefinition($text);
             $text = $modulesTreatment->treatContent(true);
         }
     }
     return $text;
 }