[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 /** 12 * sfRichTextEditorFCK implements the FCK rich text editor. 13 * 14 * <b>Options:</b> 15 * - tool - Sets the FCKEditor toolbar style 16 * - config - Sets custom path to the FCKEditor configuration file 17 * 18 * @package symfony 19 * @subpackage helper 20 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 21 * @version SVN: $Id: sfRichTextEditorFCK.class.php 3284 2007-01-15 19:05:48Z fabien $ 22 */ 23 class sfRichTextEditorFCK extends sfRichTextEditor 24 { 25 /** 26 * Returns the rich text editor as HTML. 27 * 28 * @return string Rich text editor HTML representation 29 */ 30 public function toHTML() 31 { 32 $options = $this->options; 33 34 // we need to know the id for things the rich text editor 35 // in advance of building the tag 36 $id = _get_option($options, 'id', $this->name); 37 38 $php_file = sfConfig::get('sf_rich_text_fck_js_dir').DIRECTORY_SEPARATOR.'fckeditor.php'; 39 40 if (!is_readable(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$php_file)) 41 { 42 throw new sfConfigurationException('You must install FCKEditor to use this helper (see rich_text_fck_js_dir settings).'); 43 } 44 45 // FCKEditor.php class is written with backward compatibility of PHP4. 46 // This reportings are to turn off errors with public properties and already declared constructor 47 $error_reporting = ini_get('error_reporting'); 48 error_reporting(E_ALL); 49 50 require_once(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$php_file); 51 52 // turn error reporting back to your settings 53 error_reporting($error_reporting); 54 55 $fckeditor = new FCKeditor($this->name); 56 $fckeditor->BasePath = sfContext::getInstance()->getRequest()->getRelativeUrlRoot().'/'.sfConfig::get('sf_rich_text_fck_js_dir').'/'; 57 $fckeditor->Value = $this->content; 58 59 if (isset($options['width'])) 60 { 61 $fckeditor->Width = $options['width']; 62 } 63 elseif (isset($options['cols'])) 64 { 65 $fckeditor->Width = (string)((int) $options['cols'] * 10).'px'; 66 } 67 68 if (isset($options['height'])) 69 { 70 $fckeditor->Height = $options['height']; 71 } 72 elseif (isset($options['rows'])) 73 { 74 $fckeditor->Height = (string)((int) $options['rows'] * 10).'px'; 75 } 76 77 if (isset($options['tool'])) 78 { 79 $fckeditor->ToolbarSet = $options['tool']; 80 } 81 82 if (isset($options['config'])) 83 { 84 $fckeditor->Config['CustomConfigurationsPath'] = javascript_path($options['config']); 85 } 86 87 $content = $fckeditor->CreateHtml(); 88 89 return $content; 90 } 91 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |