[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

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

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 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'] = $_SESSION['WYSIWYG_TEMPLATE'];
  57      if(empty($wysiwyg_editor['template']) || $wysiwyg_editor['template'] == 'phpwcms_basic') {
  58          $wysiwyg_editor['template'] = 'phpwcms';
  59      } elseif($wysiwyg_editor['template'] == 'Default') {
  60          $wysiwyg_editor['template'] = 'Full';
  61      }
  62      
  63      // simple textarea - no WYSIWYG editor
  64      echo '<textarea name="'.$wysiwyg_editor['field'].'" rows="'.$wysiwyg_editor['rows'].'" id="'.$wysiwyg_editor['field'].'">';
  65      echo html_specialchars($wysiwyg_editor['value']).'</textarea>';
  66      echo '<script type="text/javascript">
  67          var phpwcms_ckeditor_config = "'.PHPWCMS_URL.TEMPLATE_PATH.'config/ckeditor/";
  68          CKEDITOR.replace("'.$wysiwyg_editor['field'].'", {
  69              customConfig: phpwcms_ckeditor_config+"ckeditor.config.js",
  70              language: "'.$wysiwyg_editor['lang'].'",
  71              toolbar: "'.$wysiwyg_editor['template'].'"';
  72      if (!empty($phpwcms['FCK_FileBrowser'])) {
  73          echo ',
  74              filebrowserBrowseUrl: "'.PHPWCMS_URL.'/filebrowser.php?opt=16",
  75              filebrowserImageBrowseUrl : "'.PHPWCMS_URL.'/filebrowser.php?opt=17",
  76              filebrowserWindowWidth: "640", filebrowserWindowHeight: "480"';
  77      }
  78          echo '
  79          });
  80      </script>';
  81  
  82  } else {
  83  
  84      // simple textarea - no WYSIWYG editor
  85      echo '<textarea name="'.$wysiwyg_editor['field'].'" rows="'.$wysiwyg_editor['rows'];
  86      echo '" class="v12" id="'.$wysiwyg_editor['field'].'" ';
  87      echo 'style="width:'.$wysiwyg_editor['width'].';height:'.$wysiwyg_editor['height'].';">';
  88      echo html_specialchars($wysiwyg_editor['value']).'</textarea>';
  89  
  90  }
  91  
  92  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1