C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RJRNN8D\mambots\editors\tinymce.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* @version $Id: tinymce.php,v 1.5 2005/02/11 11:10:55 stingrey Exp $
* @package Mambo
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$_MAMBOTS->registerFunction( 'onInitEditor', 'botTinymceEditorInit' );
$_MAMBOTS->registerFunction( 'onGetEditorContents', 'botTinymceEditorGetContents' );
$_MAMBOTS->registerFunction( 'onEditorArea', 'botTinymceEditorEditorArea' );

/**
* TinyMCE WYSIWYG Editor - javascript initialisation
*/
function botTinymceEditorInit() {
    global 
$mosConfig_live_site, $database, $mosConfig_absolute_path;

    
// load tinymce info
    
$query = "SELECT id FROM #__mambots WHERE element = 'tinymce' AND folder = 'editors'";
    
$database->setQuery( $query );
    
$id = $database->loadResult();
    
$mambot = new mosMambot( $database );
    
$mambot->load( $id );
    
$params =& new mosParameters( $mambot->params );

    
$theme = $params->get( 'theme', 'default' );

     
$toolbar             = $params->def( 'toolbar', 'top' );
     
$html_height        = $params->def( 'html_height', '550' );
     
$html_width            = $params->def( 'html_width', '750' );
     
$text_direction        = $params->def( 'text_direction', 'ltr' );
    
$content_css        = $params->def( 'content_css', 1 );
     
$content_css_custom    = $params->def( 'content_css_custom', '' );
     
$invalid_elements    = $params->def( 'invalid_elements', 'script,object,applet,iframe' );
     
$newlines            = $params->def( 'newlines', 'false' );
     
     if ( 
$content_css ) {
         
$query = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'";
         
$database->setQuery( $query );
         
$template         = $database->loadResult();
         
$content_css    = 'content_css : "'. $mosConfig_live_site .'/templates/'. $template .'/css/template_css.css"';
     } else {
         if ( 
$content_css_custom ) {
             
$content_css = 'content_css : "'. $content_css_custom .'"';
         } else {
             
$content_css = '';
         }
     }
     
    return <<<EOD
<script type="text/javascript" src="$mosConfig_live_site/mambots/editors/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        theme : "
$theme",
        language : "uk",
        mode : "specific_textareas",
        document_base_url : "
$mosConfig_live_site/mambots/editors/tinymce/",
         invalid_elements : "
$invalid_elements",
         theme_advanced_toolbar_location : "
$toolbar",
         theme_advanced_source_editor_height : "
$html_height",
        theme_advanced_source_editor_width : "
$html_width",
         directionality: "
$text_direction",
         force_br_newlines : "
$newlines",
         
$content_css,        
        debug : false
    });
</script>
EOD;
}
/**
* TinyMCE WYSIWYG Editor - copy editor contents to form field
* @param string The name of the editor area
* @param string The name of the form field
*/
function botTinymceEditorGetContents( $editorArea, $hiddenField ) {
    return <<<EOD

        tinyMCE.triggerSave();
EOD;
}
/**
* TinyMCE WYSIWYG Editor - display the editor
* @param string The name of the editor area
* @param string The content of the field
* @param string The name of the form field
* @param string The width of the editor area
* @param string The height of the editor area
* @param int The number of columns for the editor area
* @param int The number of rows for the editor area
*/
function botTinymceEditorEditorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
    global 
$mosConfig_live_site, $_MAMBOTS;

    
$results = $_MAMBOTS->trigger( 'onCustomEditorButton' );
    
$buttons = array();
    foreach (
$results as $result) {
        
$buttons[] = '<img src="'.$mosConfig_live_site.'/mambots/editors-xtd/'.$result[0].'" onclick="tinyMCE.execCommand(\'mceInsertContent\',false,\''.$result[1].'\')" />';
    }
    
$buttons = implode( "", $buttons );

    return <<<EOD

<textarea id="
$hiddenField" name="$hiddenField" cols="$col" rows="$row" style="width:{$width}px; height:{$height}px;" mce_editable="true">$content</textarea>
<br />
$buttons
EOD;
}
?>