~dantrevino/ubuntu-us-florida-website/main

« back to all changes in this revision

Viewing changes to plugins/editors/jce.php

  • Committer: Dan Trevnio
  • Date: 2009-03-24 20:37:18 UTC
  • Revision ID: dantrevino@gmail.com-20090324203718-pg0e3lp4ztjjku9o
initialĀ siteĀ import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * @version             $Id: jce.php 9526 2007-12-08 23:29:19Z robs $
 
4
 * @package             Joomla
 
5
 * @copyright   Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
 
6
 * @license             GNU/GPL, see LICENSE.php
 
7
 * Joomla! is free software. This version may have been modified pursuant
 
8
 * to the GNU General Public License, and as distributed it includes or
 
9
 * is derivative of works licensed under the GNU General Public License or
 
10
 * other free or open source software licenses.
 
11
 * See COPYRIGHT.php for copyright notices and details.
 
12
 */
 
13
 
 
14
// Do not allow direct access
 
15
defined( '_JEXEC' ) or die( 'Restricted access' );
 
16
 
 
17
jimport( 'joomla.plugin.plugin' );
 
18
 
 
19
/**
 
20
 * JCE WYSIWYG Editor Plugin
 
21
 *
 
22
 * @author Louis Landry <louis.landry@joomla.org>
 
23
 * @package Editors
 
24
 * @since 1.5
 
25
 */
 
26
class plgEditorJCE extends JPlugin
 
27
{
 
28
        /**
 
29
         * Constructor
 
30
         *
 
31
         * For php4 compatability we must not use the __constructor as a constructor for plugins
 
32
         * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
 
33
         * This causes problems with cross-referencing necessary for the observer design pattern.
 
34
         *
 
35
         * @param       object $subject The object to observe
 
36
         * @param       array  $config  An array that holds the plugin configuration
 
37
         * @since 1.5
 
38
         */
 
39
        function plgEditorJCE(& $subject, $config){
 
40
                parent::__construct($subject, $config);
 
41
        }
 
42
 
 
43
        /**
 
44
         * Method to handle the onInit event.
 
45
         *  - Initializes the TinyMCE WYSIWYG Editor
 
46
         *
 
47
         * @access public
 
48
         * @return string JavaScript Initialization string
 
49
         * @since 1.5
 
50
         */
 
51
        function onInit(){
 
52
                global $mainframe;
 
53
                        
 
54
                // Editor gets loaded twice in Legacy mode???
 
55
                if( defined( '_JCE_ISLOADED' ) ){
 
56
                        return false;
 
57
                }
 
58
                define( '_JCE_ISLOADED', 1 );
 
59
                
 
60
                if( !is_dir( JPATH_SITE .DS. 'components' .DS. 'com_jce' ) || !is_dir( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_jce' ) ){
 
61
                        JError::raiseWarning( '404', 'The JCE Administration Component is not installed! The Editor cannot function without it!' );
 
62
                }
 
63
 
 
64
                JLoader::import( 'editors.jce.libraries.classes.editor', JPATH_PLUGINS );
 
65
                
 
66
                $jce            =& JContentEditor::getInstance();
 
67
                $url            = $jce->getSite();
 
68
                
 
69
                $load = "\t<script type=\"text/javascript\" src=\"". $url ."plugins/editors/jce/tiny_mce/tiny_mce.js?version=". $jce->getVersion() ."\"></script>\n";
 
70
                $load .= "<script type=\"text/javascript\" src=\"". $url ."plugins/editors/jce/libraries/js/editor.js?version=". $jce->getVersion() ."\"></script>\n";
 
71
                
 
72
                $params         = $jce->getEditorParams();
 
73
                $return         = '';
 
74
                $init           = '';
 
75
                
 
76
                if( $jce->checkUser() ){                        
 
77
                        $param  = array();
 
78
                                        
 
79
                        //Url
 
80
                        $param['document_base_url']                                     = $url;
 
81
                        $param['site_url']                                                              = $mainframe->isAdmin() ? $url . 'administrator/' : $url;
 
82
                        
 
83
                        //Theme
 
84
                        $param['theme_advanced_toolbar_location']               = $jce->getParam( $params, 'editor_theme_advanced_toolbar_location', 'top', 'bottom' );
 
85
                        $param['theme_advanced_toolbar_align']                  = $jce->getParam( $params, 'editor_theme_advanced_toolbar_align', 'left', 'center' );
 
86
                        $param['theme_advanced_path']                                   = '1';
 
87
                        $param['theme_advanced_statusbar_location']     = $jce->getParam( $params, 'editor_theme_advanced_statusbar_location', 'bottom', 'none' );
 
88
                        
 
89
                        $param['theme_advanced_resizing']                       = $jce->getParam( $params, 'editor_theme_advanced_resizing', '1', '0' );
 
90
                        $param['theme_advanced_resize_horizontal']          = $jce->getParam( $params, 'editor_theme_advanced_resize_horizontal', '1', '0' );
 
91
                        $param['theme_advanced_resizing_use_cookie']    = $jce->getParam( $params, 'editor_theme_advanced_resizing_use_cookie', '1', '0' );
 
92
                        
 
93
                        $param['theme_advanced_source_editor_width']    = $jce->getParam( $params, 'editor_theme_advanced_source_editor_width', '750', '500' );
 
94
                        $param['theme_advanced_source_editor_height']   = $jce->getParam( $params, 'editor_theme_advanced_source_editor_height', '550', '400' );
 
95
                        $param['theme_advanced_source_editor_php']              = $jce->getParam( $params, 'editor_allow_php', '0' );
 
96
                        $param['theme_advanced_source_editor_script']   = $jce->getParam( $params, 'editor_allow_script', '0' );
 
97
                        $param['theme_advanced_source_editor_highlight']= $jce->getParam( $params, 'editor_theme_advanced_source_editor_highlight', '1' );
 
98
                        
 
99
                        $param['theme_advanced_disable']                                = $jce->getRemovePlugins();
 
100
                        $param['theme_advanced_blockformats']                   = $jce->getParam( $params, 'editor_theme_advanced_blockformats', 'p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp,pre', 'p,address,pre,h1,h2,h3,h4,h5,h6' );
 
101
                        
 
102
                        $param['theme_advanced_fonts']                                  = $jce->getEditorFonts( $jce->getParam( $params, 'editor_theme_advanced_fonts_add', '' ), $jce->getParam( $params, 'editor_theme_advanced_fonts_remove', '' ) );        
 
103
                        
 
104
                        //$param['font_size_classes']                                   = $jce->getParam( $params, 'editor_font_size_classes', '' );
 
105
                        $param['font_size_style_values']                                = $jce->getParam( $params, 'editor_font_size_style_values', '8pt,10pt,12pt,14pt,18pt,24pt,36pt' );
 
106
                        
 
107
                        // Defaults
 
108
                        $param['theme_advanced_buttons1']                               = '';
 
109
                        $param['theme_advanced_buttons2']                               = '';
 
110
                        $param['theme_advanced_buttons3']                               = '';
 
111
                        
 
112
                        $rows = $jce->getRows();
 
113
                        for( $i=1; $i<=count( $rows ); $i++ ){
 
114
                                $param['theme_advanced_buttons'. $i] = $rows[$i];
 
115
                        }
 
116
                        
 
117
                        $param['verify_html']                                                   = $jce->getParam( $params, 'editor_verify_html', '0', '1' );    
 
118
                        $param['event_elements']                                        = $jce->getParam( $params, 'editor_event_elements', 'a,img', 'a,img' );
 
119
                        
 
120
                        $param['width']                                                         = $jce->getParam( $params, 'editor_width', '' );
 
121
                        $param['height']                                                        = $jce->getParam( $params, 'editor_height', '' );
 
122
                        
 
123
                        $param['plugin_preview_width']                          = $jce->getParam( $params, 'preview_width', '750', '550' );
 
124
                        $param['plugin_preview_height']                         = $jce->getParam( $params, 'preview_height', '550', '600' );
 
125
                                        
 
126
                        
 
127
                        $param['custom_colors']                                         = $jce->getParam( $params, 'custom_colors', '', '' );
 
128
                        
 
129
                        $param['table_inline_editing']                          = $jce->getParam( $params, 'editor_table_inline_editing', '0', '0' );
 
130
                        $param['fix_list_elements']                                     = $jce->getParam( $params, 'editor_fix_list_elements', '1', '0' );
 
131
                        $param['fix_table_elements']                            = $jce->getParam( $params, 'editor_fix_table_elements', '1', '0' );
 
132
                                        
 
133
                        //Default template url
 
134
                        $param['content_css'] = $url . "templates/" . $jce->getSiteTemplate() . "/css/template.css";
 
135
                        
 
136
                        //Custom template url
 
137
                        if( $params->get( 'editor_content_css', '1' ) == '0' ){
 
138
                                $custom = $params->get( 'editor_content_css_custom', '' );
 
139
                                $param['content_css'] = $url . str_replace( '$template', $jce->getSiteTemplate(), $custom );
 
140
                        }       
 
141
                        
 
142
                        // Plugins array
 
143
                        $plugins = array();
 
144
                        
 
145
                        $invalid_elements[] = $jce->getParam( $params, 'editor_invalid_elements', '', '' );
 
146
                        $elements = $jce->getElements(); 
 
147
                        
 
148
                        if( $jce->getParam( $params, 'allow_script', '0' ) ){
 
149
                                $invalid_elements[] = 'script';
 
150
                        }else{
 
151
                                $jce->removeKey( $invalid_elements, 'script' );
 
152
                        }                       
 
153
                        //Paste
 
154
                        if( $jce->isLoaded( 'paste' ) ){
 
155
                                $paste_params = $jce->getPluginParams( 'paste' );
 
156
                                
 
157
                                $param['paste_create_paragraphs']               = $jce->getParam( $paste_params, 'paste_create_paragraphs', '1', '1' );
 
158
                                $param['paste_create_linebreaks']               = $jce->getParam( $paste_params, 'paste_create_linebreaks', '1', '1' );
 
159
                                $param['paste_use_dialog']                              = $jce->getParam( $paste_params, 'paste_use_dialog', '0', '0' );
 
160
                                $param['paste_auto_cleanup_on_paste']   = $jce->getParam( $paste_params, 'paste_auto_cleanup_on_paste', '0', '0' );
 
161
                                $param['paste_strip_class_attributes']  = $jce->getParam( $paste_params, 'paste_strip_class_attributes', 'all', 'all' );
 
162
                                $param['paste_remove_spans']                    = $jce->getParam( $paste_params, 'paste_remove_spans', '1', '1' );
 
163
                                $param['paste_remove_styles']                   = $jce->getParam( $paste_params, 'paste_remove_styles', '1', '1' );
 
164
                        }
 
165
                        if( $jce->isLoaded( 'media' ) || $jce->isLoaded( 'mediamanager' ) ){
 
166
                                $media_params = $jce->getPluginParams( 'media' );               
 
167
                                //Media parameters
 
168
                                $param['media_use_script'] = $jce->getParam( $media_params, 'media_use_script', '0', '0' );
 
169
                                if( $param['media_use_script'] && $jce->getParam( $params, 'editor_allow_script', '0' ) ){
 
170
                                        $jce->removeKey( $invalid_elements, 'script' );
 
171
                                }
 
172
                                $media_codebase_flash           = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0';
 
173
                                $media_codebase_shockwave       = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=11,0,0,458';
 
174
                                $media_codebase_mplayer         = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
 
175
                                $media_codebase_quicktime       = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
 
176
                                $media_codebase_real            = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0';
 
177
                                $media_codebase_divx            = 'http://go.divx.com/plugin/DivXBrowserPlugin.cab';
 
178
                                
 
179
                                $param['media_codebase_flash']          = $jce->getParam( $media_params, 'media_codebase_flash', $media_codebase_flash, $media_codebase_flash );
 
180
                                $param['media_codebase_shockwave']      = $jce->getParam( $media_params, 'media_codebase_shockwave', $media_codebase_shockwave, $media_codebase_shockwave );
 
181
                                $param['media_codebase_mplayer']        = $jce->getParam( $media_params, 'media_codebase_mplayer', $media_codebase_mplayer, $media_codebase_mplayer );
 
182
                                $param['media_codebase_quicktime']      = $jce->getParam( $media_params, 'media_codebase_quicktime', $media_codebase_quicktime, $media_codebase_quicktime );
 
183
                                $param['media_codebase_real']           = $jce->getParam( $media_params, 'media_codebase_real', $media_codebase_real, $media_codebase_real );
 
184
                                $param['media_codebase_divx']           = $jce->getParam( $media_params, 'media_codebase_divx', $media_codebase_divx, $media_codebase_divx );
 
185
                        }
 
186
                        
 
187
                        // Media Manager
 
188
                        if( $jce->isLoaded( 'mediamanager' ) && !$jce->isLoaded( 'media' ) ){
 
189
                                $plugins[] = 'media';
 
190
                        }
 
191
                                
 
192
                        //Template Manager
 
193
                        if( $jce->isLoaded( 'templatemanager' ) ){
 
194
                                $tpl_params = $jce->getPluginParams( 'templatemanager' );
 
195
                                $rv = $jce->getParam( $tpl_params, 'template_replace_values', '', '' );
 
196
                                if( strpos( $rv, ',' ) == strlen( $rv ) ){
 
197
                                        $rv = substr( $rv, 0, -1 );
 
198
                                }
 
199
                                $rv = str_replace( array( '$username', '$usertype', '$name', '$email' ), array( $jce->getUser('username'), $jce->getUser('usertype'), $jce->getUser('name'), $jce->getUser('email') ), $rv );
 
200
                                $param['template_replace_values']                       = "{" . $rv . "}";
 
201
                                $param['template_selected_content_classes']     = $jce->getParam( $tpl_params, 'template_selected_content_classes', '' );
 
202
                                $param['template_cdate_classes']                        = $jce->getParam( $tpl_params, 'template_cdate_classes', 'cdate creationdate' );
 
203
                                $param['template_mdate_classes']                        = $jce->getParam( $tpl_params, 'template_mdate_classes', 'mdate modifieddate' );
 
204
                                $param['template_cdate_format']                         = $jce->getParam( $tpl_params, 'template_cdate_format', '%m/%d/%Y : %H:%M:%S' );
 
205
                                $param['template_mdate_format']                         = $jce->getParam( $tpl_params, 'template_mdate_format', '%m/%d/%Y : %H:%M:%S' );
 
206
                        }
 
207
                        
 
208
                        //Spellchecker
 
209
                        $spell_params = $jce->getPluginParams( 'spellchecker' );
 
210
                        $param['spellchecker_languages'] = '+' . $jce->getParam( $spell_params, 'spellchecker_languages', 'English=en', '' );
 
211
        
 
212
                        //Languages
 
213
                        $param['language']                      = $jce->getLanguage();
 
214
                        $param['directionality']        = $jce->getLanguageDir();
 
215
        
 
216
                        // Paragraph handling
 
217
                        $param['forced_root_block']     = $jce->getParam( $params, 'editor_forced_root_block', '0', 'p' );
 
218
                        
 
219
                        if( $params->get( 'editor_newlines', '0' ) == '1' ){
 
220
                                $param['force_br_newlines'] = '1';
 
221
                                $param['force_p_newlines']      = '0';
 
222
                        }else{
 
223
                                $param['force_br_newlines'] = '0';
 
224
                                $param['force_p_newlines']      = '1';
 
225
                        }
 
226
                        
 
227
                        //Elements
 
228
                        $param['invalid_elements']                      = implode( ',', $invalid_elements );
 
229
                        $param['extended_valid_elements']       = $elements;            
 
230
                        $param['plugins']                                       = $jce->getPlugins();                           
 
231
                        
 
232
                        // 'Look & Feel'
 
233
                        $param['skin']                                          = $jce->getParam( $params, 'editor_skin', 'default', 'default' );
 
234
                        $param['skin_variant']                          = $jce->getParam( $params, 'editor_skin_variant', 'default', 'default' );
 
235
                        $param['inlinepopups_skin']             = $jce->getParam( $params, 'editor_inlinepopups_skin', 'clearlooks2' );
 
236
                        $param['body_class']                            = $jce->getParam( $params, 'editor_body_class_type', 'custom' ) == 'contrast' ? 'mceForceColors' : $jce->getParam( $params, 'body_class_custom', '' ); 
 
237
                        
 
238
                        //Other - user specified
 
239
                        $userParams             = $params->get( 'editor_custom_config', '' );
 
240
                        $baseParams             = array(
 
241
                                'entity_encoding', 
 
242
                                'mode', 
 
243
                                'cleanup_callback', 
 
244
                                'save_callback', 
 
245
                                'file_browser_callback',
 
246
                                'oninit',
 
247
                                'editor_selector'
 
248
                        );
 
249
                        if( $userParams ){
 
250
                                $userParams = explode( ';', $userParams );
 
251
                                foreach( $userParams as $userParam ){
 
252
                                        $keys = explode( ':', $userParam );
 
253
                                        if( !in_array( trim( $keys[0] ), $baseParams ) ){
 
254
                                                $param[trim( $keys[0] )] = trim( $keys[1] );
 
255
                                        }
 
256
                                }
 
257
                        }
 
258
                        $callbackFile = $params->get( 'editor_callback_file', '' );
 
259
                        
 
260
                        // Relative urls?
 
261
                        $param['relative_urls'] = $jce->getParam( $params, 'editor_relative_urls', '1', '1' );
 
262
                        if( $param['relative_urls'] == '0' ){
 
263
                                $param['remove_script_host'] = '0';
 
264
                        }
 
265
                        foreach( $param as $k => $v ){
 
266
                                if( $v != ''){
 
267
                                        // objects or arrays or functions
 
268
                                        if( preg_match('/(\[[^\]*]\]|\{[^\}]*\}|function\([^\}]*\})/', $v ) ){
 
269
                                                $v = $v;
 
270
                                        // anything that is not solely an integer
 
271
                                        }else if( !is_numeric( $v ) ){
 
272
                                                $v = '"'. $v .'"';
 
273
                                        // 1 or 0 become true/false
 
274
                                        }else if( $v == '1' || $v == '0' ){
 
275
                                                $v = intval( $v ) ? 'true' : 'false';
 
276
                                        }
 
277
                                        $init .= "\t\t\t". $k .": ". $v .",\n";
 
278
                                }
 
279
                                if( preg_match('/theme_advanced_buttons([1-3])/', $k ) && $v == '' ){
 
280
                                        $init .= "\t\t\t". $k .": \"\",\n";
 
281
                                }
 
282
                        }
 
283
                        $theme = 'advanced';
 
284
                }else{
 
285
                        $params->set( 'editor_toggle', '0' );
 
286
                        $params->set( 'editor_allow_php', '0' );
 
287
                        $params->set( 'editor_allow_script', '0' );
 
288
                        $theme = 'none';
 
289
                }                       
 
290
                $return .= $load .
 
291
                "<script type=\"text/javascript\">
 
292
                tinyMCE.init({
 
293
                        mode: 'textareas',
 
294
                        theme: '". $theme ."',
 
295
                        entity_encoding: 'raw',
 
296
                        editor_selector: 'mceEditor',\n";
 
297
                        $return .= $init;
 
298
                        $return .= "\t\t\tonpageload: 'jceOnLoad',
 
299
                        cleanup_callback: 'jceCleanup',
 
300
                        save_callback: 'jceSave',
 
301
                        file_browser_callback: 'jceBrowser'
 
302
                });
 
303
                JContentEditor.set({
 
304
                        pluginmode      : ". $params->get( 'editor_pluginmode', '0' ) .",
 
305
                        state           : '". $params->get( 'editor_state', 'mceEditor' ) ."',
 
306
                        allowToggle : ". $params->get( 'editor_toggle', '1' ) .",
 
307
                        php             : ". $params->get( 'editor_allow_php', '0' ) .",
 
308
                        javascript      : ". $params->get( 'editor_allow_script', '0' ) .",
 
309
                        toggleText      : '". $jce->xmlEncode( $params->get( 'editor_toggle_text', '[show/hide]' ) ) ."'
 
310
                });
 
311
                function jceSave(id, html, body){
 
312
                        return JContentEditor.save(html);
 
313
                };
 
314
                function jceCleanup(type, value){
 
315
                        return JContentEditor.cleanup(type, value);
 
316
                };
 
317
                function jceBrowser(name, url, type, win){
 
318
                        return JContentEditor.browser(name, url, type, win);
 
319
                };
 
320
                </script>";
 
321
                if( $params->get( 'callback_file' ) ){
 
322
                        $return .= "\n<script type=\"text/javascript\" src=\"". $mainframe->getSiteURL() . $callbackFile ."\"></script>\n";
 
323
                }
 
324
                return $return;
 
325
        }
 
326
 
 
327
        /**
 
328
         * TinyMCE WYSIWYG Editor - get the editor content
 
329
         *
 
330
         * @param string        The name of the editor
 
331
         */
 
332
        function onGetContent( $editor ) {
 
333
                return "JContentEditor.getContent('".$editor."');";
 
334
        }
 
335
 
 
336
        /**
 
337
         * TinyMCE WYSIWYG Editor - set the editor content
 
338
         *
 
339
         * @param string        The name of the editor
 
340
         */
 
341
        function onSetContent( $editor, $html ) {
 
342
                return "tinyMCE.activeEditor.setContent(".$html.");";
 
343
        }
 
344
 
 
345
        /**
 
346
         * TinyMCE WYSIWYG Editor - copy editor content to form field
 
347
         *
 
348
         * @param string        The name of the editor
 
349
         */
 
350
        function onSave( $editor ) {
 
351
                return "tinyMCE.triggerSave();";
 
352
        }
 
353
 
 
354
        /**
 
355
         * TinyMCE WYSIWYG Editor - display the editor
 
356
         *
 
357
         * @param string The name of the editor area
 
358
         * @param string The content of the field
 
359
         * @param string The width of the editor area
 
360
         * @param string The height of the editor area
 
361
         * @param int The number of columns for the editor area
 
362
         * @param int The number of rows for the editor area
 
363
         * @param mixed Can be boolean or array.
 
364
         */
 
365
        function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true)
 
366
        {
 
367
                // Only add "px" to width and height if they are not given as a percentage
 
368
                if (is_numeric( $width )) {
 
369
                        $width .= 'px';
 
370
                }
 
371
                if (is_numeric( $height )) {
 
372
                        $height .= 'px';
 
373
                }
 
374
 
 
375
                $buttons = $this->_displayButtons($name, $buttons);
 
376
                $editor = "<div id=\"jce_editor_".$name."_toggle\"></div>";
 
377
                $editor .= "<textarea id=\"$name\" name=\"$name\" cols=\"$col\" rows=\"$row\" style=\"width:{$width}; height:{$height};\" class=\"mceEditor\">$content</textarea>\n" . $buttons;
 
378
                $editor .= "<script type=\"text/javascript\">function jceOnLoad(){JContentEditor.initEditorMode('$name');}</script>";
 
379
                
 
380
                return $editor;
 
381
        }
 
382
 
 
383
        function onGetInsertMethod($name)
 
384
        {
 
385
                $doc = & JFactory::getDocument();
 
386
 
 
387
                $js= "function jInsertEditorText( text, editor ) {
 
388
                        tinyMCE.execInstanceCommand(editor, 'mceInsertContent',false,text);
 
389
                }";
 
390
                $doc->addScriptDeclaration($js);
 
391
 
 
392
                return true;
 
393
        }
 
394
 
 
395
        function _displayButtons($name, $buttons)
 
396
        {
 
397
                // Load modal popup behavior
 
398
                JHTML::_('behavior.modal', 'a.modal-button');
 
399
 
 
400
                $args['name'] = $name;
 
401
                $args['event'] = 'onGetInsertMethod';
 
402
 
 
403
                $return = '';
 
404
                $results[] = $this->update($args);
 
405
                foreach ($results as $result) {
 
406
                        if (is_string($result) && trim($result)) {
 
407
                                $return .= $result;
 
408
                        }
 
409
                }
 
410
 
 
411
                if(!empty($buttons))
 
412
                {
 
413
                        $results = $this->_subject->getButtons($name, $buttons);
 
414
 
 
415
                        /*
 
416
                         * This will allow plugins to attach buttons or change the behavior on the fly using AJAX
 
417
                         */
 
418
                        $return .= "\n<div id=\"editor-xtd-buttons\">\n";
 
419
                        foreach ($results as $button)
 
420
                        {
 
421
                                /*
 
422
                                 * Results should be an object
 
423
                                 */
 
424
                                if ( $button->get('name') )
 
425
                                {
 
426
                                        $modal          = ($button->get('modal')) ? 'class="modal-button"' : null;
 
427
                                        $href           = ($button->get('link')) ? 'href="'.JURI::base().$button->get('link').'"' : null;
 
428
                                        $onclick        = ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
 
429
                                        $return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
 
430
                                }
 
431
                        }
 
432
                        $return .= "</div>\n";
 
433
                }
 
434
 
 
435
                return $return;
 
436
        }
 
437
}
 
438
?>
 
 
b'\\ No newline at end of file'