Mercurial > hg > rr-repo
comparison sites/all/modules/imce_wysiwyg/imce_wysiwyg.module @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ff03f76ab3fe |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Makes IMCE available as plugin for client-side editors integrated via | |
6 * Wysiwyg API. | |
7 */ | |
8 | |
9 /** | |
10 * Implements hook_wysiwyg_plugin(). | |
11 */ | |
12 function imce_wysiwyg_plugin($editor, $version) { | |
13 static $integrated = array(); | |
14 | |
15 if (!module_invoke('imce', 'access')) { | |
16 return; | |
17 } | |
18 // Load our invocation scripts. | |
19 if (empty($integrated)) { | |
20 $imcepath = drupal_get_path('module', 'imce'); | |
21 $path = drupal_get_path('module', 'imce_wysiwyg'); | |
22 drupal_add_js($imcepath . '/js/imce.js'); | |
23 drupal_add_js($imcepath . '/js/imce_set_app.js'); | |
24 drupal_add_js($path . '/js/imce_wysiwyg.js'); | |
25 } | |
26 | |
27 switch ($editor) { | |
28 case 'tinymce': | |
29 if (!isset($integrated[$editor])) { | |
30 $integrated[$editor] = TRUE; | |
31 // @todo If some other editor also needs the URL to be passed via | |
32 // Drupal.settings.imce, then we need another sub-key '$editor'. | |
33 $settings = array( | |
34 'imce' => array('url' => url('imce', array('query' => array('app' => $editor . '|url@')))), | |
35 ); | |
36 drupal_add_js($settings, 'setting'); | |
37 } | |
38 return array( | |
39 'imce' => array( | |
40 'extensions' => array('imce' => t('IMCE')), | |
41 'url' => 'http://drupal.org/project/imce', | |
42 'options' => array( | |
43 'file_browser_callback' => 'imceImageBrowser', | |
44 'inline_styles' => TRUE, | |
45 ), | |
46 'load' => FALSE, | |
47 ), | |
48 ); | |
49 | |
50 case 'ckeditor': | |
51 $integrated[$editor] = TRUE; | |
52 return array( | |
53 'imce' => array( | |
54 'extensions' => array('imce' => t('IMCE')), | |
55 'url' => 'http://drupal.org/project/imce', | |
56 'options' => array( | |
57 'filebrowserBrowseUrl' => url('imce', array('query' => array('app' => $editor . '|sendto@imceCkeditSendTo|params@'))), | |
58 ), | |
59 'load' => FALSE, | |
60 ), | |
61 ); | |
62 | |
63 case 'fckeditor': | |
64 $integrated[$editor] = TRUE; | |
65 return array( | |
66 'imce' => array( | |
67 'extensions' => array('imce' => t('IMCE')), | |
68 'url' => 'http://drupal.org/project/imce', | |
69 'options' => array( | |
70 'LinkBrowser' => TRUE, | |
71 'LinkBrowserURL' => url('imce', array('query' => array('app' => $editor . '|url@txtUrl'))), | |
72 'ImageBrowser' => TRUE, | |
73 'ImageBrowserURL' => url('imce', array('query' => array('app' => $editor . '|url@txtUrl|width@txtWidth|height@txtHeight'))), | |
74 'FlashBrowser' => TRUE, | |
75 'FlashBrowserURL' => url('imce', array('query' => array('app' => $editor . '|url@txtUrl'))), | |
76 ), | |
77 'load' => FALSE, | |
78 ), | |
79 ); | |
80 } | |
81 } | |
82 |