/**
  * {@inheritdoc}
  */
 public function get_editor()
 {
     $editor = new TinyMCEEditor();
     $editor->set_forbidden_tags($this->get_forbidden_tags());
     return $editor;
 }
 /**
  * @desc Display the editor
  * @return string Formated editor.
  */
 public function display()
 {
     $template = $this->get_template();
     $displayed_icons_number = 0;
     list($toolbar1, $toolbar2, $toolbar3) = array('', '', '');
     foreach ($this->array_tags as $tag => $tinymce_tag) {
         $tag = preg_replace('`[0-9]`', '', $tag);
         if (!in_array($tag, $this->forbidden_tags)) {
             $toolbar1 .= $tinymce_tag . ',';
             $displayed_icons_number++;
         }
     }
     foreach ($this->array_tags2 as $tag => $tinymce_tag) {
         $tag = preg_replace('`[0-9]`', '', $tag);
         if (!in_array($tag, $this->forbidden_tags)) {
             if ($displayed_icons_number < 18) {
                 $toolbar1 .= $tinymce_tag . ',';
             } else {
                 $toolbar2 .= $tinymce_tag . ',';
             }
             $displayed_icons_number++;
         }
     }
     foreach ($this->array_tags3 as $tag => $tinymce_tag) {
         $tag = preg_replace('`[0-9]`', '', $tag);
         if (!in_array($tag, $this->forbidden_tags)) {
             if ($tag != 'insertfile' || $tag == 'insertfile' && AppContext::get_current_user()->check_auth(FileUploadConfig::load()->get_authorization_enable_interface_files(), FileUploadConfig::AUTH_FILES_BIT)) {
                 if ($displayed_icons_number < 25) {
                     $toolbar1 .= $tinymce_tag . ',';
                 } else {
                     if ($displayed_icons_number < 35) {
                         $toolbar2 .= $tinymce_tag . ',';
                     } else {
                         $toolbar3 .= $tinymce_tag . ',';
                     }
                 }
                 $displayed_icons_number++;
             }
         }
     }
     $language = substr(AppContext::get_current_user()->get_locale(), 0, 2);
     switch ($language) {
         case 'fr':
             $language = 'fr_FR';
             break;
         case 'en':
             $language = 'en_GB';
             break;
         default:
             break;
     }
     $form_field_infos = explode('_', $this->identifier);
     $form_name = $form_field_infos[0];
     unset($form_field_infos[0]);
     $field_name = implode('_', $form_field_infos);
     $template->put_all(array('C_NOT_JS_INCLUDED' => self::$js_included, 'C_HTMLFORM' => !empty($form_name) && !empty($field_name), 'PAGE_PATH' => $_SERVER['PHP_SELF'], 'FIELD' => $this->identifier, 'FORM_NAME' => $form_name, 'FIELD_NAME' => $field_name, 'FORBIDDEN_TAGS' => implode(',', $this->forbidden_tags), 'L_REQUIRE_TEXT' => LangLoader::get_message('require_text', 'main'), 'C_TOOLBAR1' => !empty($toolbar1), 'C_TOOLBAR2' => !empty($toolbar2), 'C_TOOLBAR3' => !empty($toolbar3), 'TOOLBAR1' => preg_replace('`\\|(,\\|)+`', '|', trim($toolbar1, ',')), 'TOOLBAR2' => preg_replace('`\\|(,\\|)+`', '|', trim($toolbar2, ',')), 'TOOLBAR3' => preg_replace('`\\|(,\\|)+`', '|', trim($toolbar3, ',')), 'LANGUAGE' => $language));
     self::$js_included = true;
     //Chargement des smileys.
     $smileys = SmileysCache::load()->get_smileys();
     $smile_by_line = 9;
     $nbr_smile = count($smileys);
     $j = 1;
     foreach ($smileys as $code_smile => $infos) {
         $template->assign_block_vars('smiley', array('C_NEW_ROW' => is_int(($j - 1) / $smile_by_line), 'C_LAST_OF_THE_ROW' => is_int($j / $smile_by_line), 'C_END_ROW' => is_int($j / $smile_by_line) || $nbr_smile == $j, 'C_LAST_ROW' => $nbr_smile == $j, 'URL' => Url::to_rel('/images/smileys/' . $infos['url_smiley']), 'CODE' => addslashes($code_smile)));
         $j++;
     }
     return $template->render();
 }