TYPO3 API  SVNRelease
class.tx_rtehtmlarea_defaultinline.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2007-2011 Stanislas Rolland <typo3(arobas)sjbr.ca>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the Typo3 project. The Typo3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00024 /**
00025  * DefaultInline plugin for htmlArea RTE
00026  *
00027  * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
00028  *
00029  * TYPO3 SVN ID: $Id: class.tx_rtehtmlarea_defaultinline.php 10120 2011-01-18 20:03:36Z ohader $
00030  *
00031  */
00032 class tx_rtehtmlarea_defaultinline extends tx_rtehtmlarea_api {
00033 
00034     protected $extensionKey = 'rtehtmlarea';    // The key of the extension that is extending htmlArea RTE
00035     protected $pluginName = 'DefaultInline';    // The name of the plugin registered by the extension
00036     protected $relativePathToLocallangFile = 'extensions/DefaultInline/locallang.xml';  // Path to this main locallang file of the extension relative to the extension dir.
00037     protected $relativePathToSkin = 'extensions/DefaultInline/skin/htmlarea.css';       // Path to the skin (css) file relative to the extension dir.
00038     protected $htmlAreaRTE;             // Reference to the invoking object
00039     protected $thisConfig;              // Reference to RTE PageTSConfig
00040     protected $toolbar;             // Reference to RTE toolbar array
00041     protected $LOCAL_LANG;              // Frontend language array
00042 
00043     protected $pluginButtons = 'bold,italic,strikethrough,subscript,superscript,underline';
00044     protected $convertToolbarForHtmlAreaArray = array (
00045         'bold'          => 'Bold',
00046         'italic'        => 'Italic',
00047         'underline'     => 'Underline',
00048         'strikethrough'     => 'StrikeThrough',
00049         'superscript'       => 'Superscript',
00050         'subscript'     => 'Subscript',
00051         );
00052 
00053     /**
00054      * Return JS configuration of the htmlArea plugins registered by the extension
00055      *
00056      * @param   integer     Relative id of the RTE editing area in the form
00057      *
00058      * @return string       JS configuration for registered plugins
00059      *
00060      * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)
00061      * Each of the instructions should be of the form:
00062      *  RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
00063      */
00064     public function buildJavascriptConfiguration($RTEcounter) {
00065         global $TSFE, $LANG;
00066 
00067         $registerRTEinJavascriptString = '';
00068         return $registerRTEinJavascriptString;
00069     }
00070 
00071     /**
00072      * Return tranformed content
00073      *
00074      * @param   string      $content: The content that is about to be sent to the RTE
00075      *
00076      * @return  string      the transformed content
00077      */
00078     public function transformContent($content) {
00079 
00080             // Change the strong and em tags for gecko browsers
00081         if ($this->htmlAreaRTE->client['browser'] == 'gecko') {
00082                 // change <strong> to <b>
00083             $content = preg_replace('/<(\/?)strong/i', "<$1b", $content);
00084                 // change <em> to <i>
00085             $content = preg_replace('/<(\/?)em([^b>]*>)/i', "<$1i$2", $content);
00086         }
00087 
00088         return $content;
00089     }
00090 
00091 } // end of class
00092 
00093 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php'])) {
00094     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php']);
00095 }
00096 
00097 ?>