This commit was manufactured by cvs2svn to create branch 'Kasper'.
[Packages/TYPO3.CMS.git] / typo3 / rte_cleaner.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skårhøj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * EXAMPLE SCRIPT! Simply strips HTML of content from RTE
29 * Belongs to the "rte" extension
30 *
31 * @author Kasper Skårhøj <kasper@typo3.com>
32 * @package TYPO3
33 * @subpackage core
34 *
35 */
36
37
38
39 $BACK_PATH="";
40 require ("init.php");
41 require ("template.php");
42 //include("sysext/lang/locallang_rte_user.php");
43
44
45 // ***************************
46 // Script Classes
47 // ***************************
48 class SC_rte_cleaner {
49 var $content;
50 var $siteURL;
51 var $doc;
52
53 function init() {
54 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
55
56 $this->siteURL = substr(t3lib_div::getIndpEnv("TYPO3_SITE_URL"),0,-1);
57
58 $this->doc = t3lib_div::makeInstance("template");
59 $this->doc->backPath = $BACK_PATH;
60 $this->doc->form = '';
61 $this->doc->JScode='
62 <script language="javascript" type="text/javascript">
63 var RTEobj = self.parent.parent;
64
65 function setSelectedTextContent(content) {
66 var oSel = RTEobj.GLOBAL_SEL;
67 var sType = oSel.type;
68 if (sType=="Text") {
69 oSel.pasteHTML(content);
70 }
71 }
72 </script>
73 ';
74 }
75 function main() {
76 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
77
78 $this->content="";
79 $this->content.=$this->doc->startPage("RTE cleaner");
80
81 $this->content.='
82 <script language="javascript" type="text/javascript">
83 // alert('.$GLOBALS['LANG']->JScharCode(t3lib_div::GPvar("processContent")).');
84 setSelectedTextContent(unescape("'.rawurlencode(strip_tags(t3lib_div::GPvar("processContent"))).'"));
85 RTEobj.edHidePopup();
86 </script>
87 ';
88 }
89 function printContent() {
90 global $SOBE;
91 $this->content.= $this->doc->endPage();
92 echo $this->content;
93 }
94
95 // ***************************
96 // OTHER FUNCTIONS:
97 // ***************************
98 }
99
100 // Include extension?
101 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/rte_cleaner.php"]) {
102 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/rte_cleaner.php"]);
103 }
104
105
106
107
108
109 // Make instance:
110 $SOBE = t3lib_div::makeInstance("SC_rte_cleaner");
111 $SOBE->init();
112 $SOBE->main();
113 $SOBE->printContent();
114 ?>