[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_lib/ -> wysiwyg.editor.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // wysiwyg editor
  24  
  25  if(!isset($wysiwyg_editor['value']))    $wysiwyg_editor['value']    = '';
  26  if(!isset($wysiwyg_editor['field']))    $wysiwyg_editor['field']    = 'wysiwyg_editor';
  27  if(!isset($wysiwyg_editor['height']))    $wysiwyg_editor['height']    = '350px';
  28  if(!isset($wysiwyg_editor['width']))    $wysiwyg_editor['width']    = '440px';
  29  if(!isset($wysiwyg_editor['rows']))        $wysiwyg_editor['rows']        = '15';
  30  if(!isset($wysiwyg_editor['editor'])){
  31      $wysiwyg_editor['editor']    = 1;
  32      if(isset($_SESSION["WYSIWYG_EDITOR"])) $wysiwyg_editor['editor'] = $_SESSION["WYSIWYG_EDITOR"];
  33  }
  34  $wysiwyg_editor['lang']    = isset($_SESSION["wcs_user_lang"]) ? $_SESSION["wcs_user_lang"] : 'en';
  35  
  36  if($wysiwyg_editor['editor'] == 2) {
  37  
  38      //load FCKeditor
  39      include_once (PHPWCMS_ROOT.'/include/inc_ext/fckeditor/fckeditor.php');
  40  
  41      $oFCKeditor = new FCKeditor($wysiwyg_editor['field']);
  42      $oFCKeditor->BasePath                             = PHPWCMS_URL.'include/inc_ext/fckeditor/';
  43      $oFCKeditor->Config['CustomConfigurationsPath']    = PHPWCMS_URL.'include/inc_ext/fckeditor/fckeditor_config.js.php' ;
  44      
  45      $oFCKeditor->Value                                 = $wysiwyg_editor['value'];
  46      $oFCKeditor->Width                                 = str_replace('px', '', $wysiwyg_editor['width']);
  47      $oFCKeditor->Height                             = str_replace('px', '', $wysiwyg_editor['height']);
  48      $oFCKeditor->ToolbarSet                            = $_SESSION['WYSIWYG_TEMPLATE'];
  49      $oFCKeditor->Create();
  50  
  51  } elseif($wysiwyg_editor['editor'] == 1) {
  52      
  53      $BE['HEADER']['ckeditor.js']    = getJavaScriptSourceLink('include/inc_ext/ckeditor/ckeditor.js');
  54      $BE['HEADER']['ckeditor.styles.default.js']    = getJavaScriptSourceLink(TEMPLATE_PATH.'config/ckeditor/ckeditor.styles.default.js');
  55      
  56      $wysiwyg_editor['template'] = 'Basic';
  57      switch(strtolower($_SESSION['WYSIWYG_TEMPLATE'])) {
  58          case 'default':
  59          case 'full':
  60              $wysiwyg_editor['template'] = 'Full';
  61              break;    
  62      }
  63      
  64      // simple textarea - no WYSIWYG editor
  65      echo '<textarea name="'.$wysiwyg_editor['field'].'" rows="'.$wysiwyg_editor['rows'];
  66      echo '" class="v12" id="'.$wysiwyg_editor['field'].'" ';
  67      echo 'style="width:'.$wysiwyg_editor['width'].';height:'.$wysiwyg_editor['height'].';">';
  68      echo html_specialchars($wysiwyg_editor['value']).'</textarea>';
  69      echo LF;
  70      echo '    <script type="text/javascript">
  71          var phpwcms_ckeditor_config = "'.PHPWCMS_URL.TEMPLATE_PATH.'config/ckeditor/";
  72          CKEDITOR.replace("'.$wysiwyg_editor['field'].'", {
  73              customConfig: phpwcms_ckeditor_config+"ckeditor.config.js",
  74              language: "'.$wysiwyg_editor['lang'].'",
  75              toolbar: "'.$wysiwyg_editor['template'].'"
  76          });
  77      </script>';
  78  
  79  } else {
  80  
  81      // simple textarea - no WYSIWYG editor
  82      echo '<textarea name="'.$wysiwyg_editor['field'].'" rows="'.$wysiwyg_editor['rows'];
  83      echo '" class="v12" id="'.$wysiwyg_editor['field'].'" ';
  84      echo 'style="width:'.$wysiwyg_editor['width'].';height:'.$wysiwyg_editor['height'].';">';
  85      echo html_specialchars($wysiwyg_editor['value']).'</textarea>';
  86  
  87  }
  88  
  89  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7