@@ -9,31 +9,31 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_jwysiwyg_editor() { |
| 12 | - $editor['jwysiwyg'] = array( |
|
| 12 | + $editor['jwysiwyg'] = array( |
|
| 13 | 13 | 'title' => 'jWYSIWYG', |
| 14 | 14 | 'vendor url' => 'http://code.google.com/p/jwysiwyg/', |
| 15 | 15 | 'download url' => 'http://code.google.com/p/jwysiwyg/downloads/list', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Source', |
| 19 | 19 | 'files' => array('jquery.wysiwyg.js'), |
| 20 | - ), |
|
| 21 | - 'pack' => array( |
|
| 20 | + ), |
|
| 21 | + 'pack' => array( |
|
| 22 | 22 | 'title' => 'Packed', |
| 23 | 23 | 'files' => array('jquery.wysiwyg.pack.js'), |
| 24 | - ), |
|
| 24 | + ), |
|
| 25 | 25 | ), |
| 26 | 26 | 'version callback' => 'wysiwyg_jwysiwyg_version', |
| 27 | 27 | // @todo Wrong property; add separate properties for editor requisites. |
| 28 | 28 | 'css path' => wysiwyg_get_path('jwysiwyg'), |
| 29 | 29 | 'versions' => array( |
| 30 | - '0.5' => array( |
|
| 30 | + '0.5' => array( |
|
| 31 | 31 | 'js files' => array('jwysiwyg.js'), |
| 32 | 32 | 'css files' => array('jquery.wysiwyg.css'), |
| 33 | - ), |
|
| 33 | + ), |
|
| 34 | 34 | ), |
| 35 | - ); |
|
| 36 | - return $editor; |
|
| 35 | + ); |
|
| 36 | + return $editor; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | * The installed editor version. |
| 47 | 47 | */ |
| 48 | 48 | function wysiwyg_jwysiwyg_version($editor) { |
| 49 | - $script = $editor['library path'] . '/jquery.wysiwyg.js'; |
|
| 50 | - if (!file_exists($script)) { |
|
| 49 | + $script = $editor['library path'] . '/jquery.wysiwyg.js'; |
|
| 50 | + if (!file_exists($script)) { |
|
| 51 | 51 | return; |
| 52 | - } |
|
| 53 | - $script = fopen($script, 'r'); |
|
| 54 | - fgets($script); |
|
| 55 | - $line = fgets($script); |
|
| 56 | - if (preg_match('@([0-9\.]+)$@', $line, $version)) { |
|
| 52 | + } |
|
| 53 | + $script = fopen($script, 'r'); |
|
| 54 | + fgets($script); |
|
| 55 | + $line = fgets($script); |
|
| 56 | + if (preg_match('@([0-9\.]+)$@', $line, $version)) { |
|
| 57 | 57 | fclose($script); |
| 58 | 58 | return $version[1]; |
| 59 | - } |
|
| 60 | - fclose($script); |
|
| 59 | + } |
|
| 60 | + fclose($script); |
|
| 61 | 61 | } |
| 62 | 62 | |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_fckeditor_editor() { |
| 12 | - $editor['fckeditor'] = array( |
|
| 12 | + $editor['fckeditor'] = array( |
|
| 13 | 13 | 'title' => 'FCKeditor', |
| 14 | 14 | 'vendor url' => 'http://www.fckeditor.net', |
| 15 | 15 | 'download url' => 'http://www.fckeditor.net/download', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Default', |
| 19 | 19 | 'files' => array('fckeditor.js'), |
| 20 | - ), |
|
| 20 | + ), |
|
| 21 | 21 | ), |
| 22 | 22 | 'version callback' => 'wysiwyg_fckeditor_version', |
| 23 | 23 | 'themes callback' => 'wysiwyg_fckeditor_themes', |
@@ -25,19 +25,19 @@ discard block |
||
| 25 | 25 | 'plugin callback' => 'wysiwyg_fckeditor_plugins', |
| 26 | 26 | 'plugin settings callback' => 'wysiwyg_fckeditor_plugin_settings', |
| 27 | 27 | 'proxy plugin' => array( |
| 28 | - 'drupal' => array( |
|
| 28 | + 'drupal' => array( |
|
| 29 | 29 | 'load' => TRUE, |
| 30 | 30 | 'proxy' => TRUE, |
| 31 | - ), |
|
| 31 | + ), |
|
| 32 | 32 | ), |
| 33 | 33 | 'proxy plugin settings callback' => 'wysiwyg_fckeditor_proxy_plugin_settings', |
| 34 | 34 | 'versions' => array( |
| 35 | - '2.6' => array( |
|
| 35 | + '2.6' => array( |
|
| 36 | 36 | 'js files' => array('fckeditor-2.6.js'), |
| 37 | - ), |
|
| 37 | + ), |
|
| 38 | 38 | ), |
| 39 | - ); |
|
| 40 | - return $editor; |
|
| 39 | + ); |
|
| 40 | + return $editor; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * The installed editor version. |
| 51 | 51 | */ |
| 52 | 52 | function wysiwyg_fckeditor_version($editor) { |
| 53 | - $library = $editor['library path'] . '/fckeditor.js'; |
|
| 54 | - if (!file_exists($library)) { |
|
| 53 | + $library = $editor['library path'] . '/fckeditor.js'; |
|
| 54 | + if (!file_exists($library)) { |
|
| 55 | 55 | return; |
| 56 | - } |
|
| 57 | - $library = fopen($library, 'r'); |
|
| 58 | - $max_lines = 100; |
|
| 59 | - while ($max_lines && $line = fgets($library, 60)) { |
|
| 56 | + } |
|
| 57 | + $library = fopen($library, 'r'); |
|
| 58 | + $max_lines = 100; |
|
| 59 | + while ($max_lines && $line = fgets($library, 60)) { |
|
| 60 | 60 | if (preg_match('@^FCKeditor.prototype.Version\s*= \'([\d\.]+)@', $line, $version)) { |
| 61 | - fclose($library); |
|
| 62 | - return $version[1]; |
|
| 61 | + fclose($library); |
|
| 62 | + return $version[1]; |
|
| 63 | 63 | } |
| 64 | 64 | $max_lines--; |
| 65 | - } |
|
| 66 | - fclose($library); |
|
| 65 | + } |
|
| 66 | + fclose($library); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * theme name. |
| 80 | 80 | */ |
| 81 | 81 | function wysiwyg_fckeditor_themes($editor, $profile) { |
| 82 | - return array('default', 'office2003', 'silver'); |
|
| 82 | + return array('default', 'office2003', 'silver'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * Drupal.settings.wysiwyg.configs.{editor} |
| 98 | 98 | */ |
| 99 | 99 | function wysiwyg_fckeditor_settings($editor, $config, $theme) { |
| 100 | - $settings = array( |
|
| 100 | + $settings = array( |
|
| 101 | 101 | 'EditorPath' => base_path() . $editor['library path'] . '/', |
| 102 | 102 | 'SkinPath' => base_path() . $editor['library path'] . '/editor/skins/' . $theme . '/', |
| 103 | 103 | 'CustomConfigurationsPath' => base_path() . drupal_get_path('module', 'wysiwyg') . '/editors/js/fckeditor.config.js', |
@@ -116,105 +116,105 @@ discard block |
||
| 116 | 116 | // @todo Check whether completely disabling ProcessHTMLEntities is an option. |
| 117 | 117 | 'IncludeLatinEntities' => FALSE, |
| 118 | 118 | 'IncludeGreekEntities' => FALSE, |
| 119 | - ); |
|
| 120 | - if (isset($config['block_formats'])) { |
|
| 119 | + ); |
|
| 120 | + if (isset($config['block_formats'])) { |
|
| 121 | 121 | $settings['FontFormats'] = strtr($config['block_formats'], array(',' => ';')); |
| 122 | - } |
|
| 123 | - if (isset($config['apply_source_formatting'])) { |
|
| 122 | + } |
|
| 123 | + if (isset($config['apply_source_formatting'])) { |
|
| 124 | 124 | $settings['FormatOutput'] = $settings['FormatSource'] = $config['apply_source_formatting']; |
| 125 | - } |
|
| 126 | - if (isset($config['paste_auto_cleanup_on_paste'])) { |
|
| 125 | + } |
|
| 126 | + if (isset($config['paste_auto_cleanup_on_paste'])) { |
|
| 127 | 127 | $settings['AutoDetectPasteFromWord'] = $config['paste_auto_cleanup_on_paste']; |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - if (isset($config['css_setting'])) { |
|
| 130 | + if (isset($config['css_setting'])) { |
|
| 131 | 131 | if ($config['css_setting'] == 'theme') { |
| 132 | - $settings['EditorAreaCSS'] = implode(',', wysiwyg_get_css()); |
|
| 132 | + $settings['EditorAreaCSS'] = implode(',', wysiwyg_get_css()); |
|
| 133 | 133 | } |
| 134 | 134 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 135 | - $settings['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 135 | + $settings['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 136 | + } |
|
| 136 | 137 | } |
| 137 | - } |
|
| 138 | 138 | |
| 139 | - // Use our custom toolbar set. |
|
| 140 | - $settings['ToolbarSet'] = 'Wysiwyg'; |
|
| 141 | - // Populate our custom toolbar set for fckeditor.config.js. |
|
| 142 | - $settings['buttons'] = array(); |
|
| 143 | - if (!empty($config['buttons'])) { |
|
| 139 | + // Use our custom toolbar set. |
|
| 140 | + $settings['ToolbarSet'] = 'Wysiwyg'; |
|
| 141 | + // Populate our custom toolbar set for fckeditor.config.js. |
|
| 142 | + $settings['buttons'] = array(); |
|
| 143 | + if (!empty($config['buttons'])) { |
|
| 144 | 144 | $plugins = wysiwyg_get_plugins($editor['name']); |
| 145 | 145 | foreach ($config['buttons'] as $plugin => $buttons) { |
| 146 | - foreach ($buttons as $button => $enabled) { |
|
| 146 | + foreach ($buttons as $button => $enabled) { |
|
| 147 | 147 | // Iterate separately over buttons and extensions properties. |
| 148 | 148 | foreach (array('buttons', 'extensions') as $type) { |
| 149 | - // Skip unavailable plugins. |
|
| 150 | - if (!isset($plugins[$plugin][$type][$button])) { |
|
| 149 | + // Skip unavailable plugins. |
|
| 150 | + if (!isset($plugins[$plugin][$type][$button])) { |
|
| 151 | 151 | continue; |
| 152 | - } |
|
| 153 | - // Add buttons. |
|
| 154 | - if ($type == 'buttons') { |
|
| 152 | + } |
|
| 153 | + // Add buttons. |
|
| 154 | + if ($type == 'buttons') { |
|
| 155 | 155 | $settings['buttons'][] = $button; |
| 156 | - } |
|
| 157 | - // Allow plugins to add or override global configuration settings. |
|
| 158 | - if (!empty($plugins[$plugin]['options'])) { |
|
| 156 | + } |
|
| 157 | + // Allow plugins to add or override global configuration settings. |
|
| 158 | + if (!empty($plugins[$plugin]['options'])) { |
|
| 159 | 159 | $settings = array_merge($settings, $plugins[$plugin]['options']); |
| 160 | - } |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | - } |
|
| 162 | + } |
|
| 163 | + } |
|
| 163 | 164 | } |
| 164 | - } |
|
| 165 | - // For now, all buttons are placed into one row. |
|
| 166 | - $settings['buttons'] = array($settings['buttons']); |
|
| 165 | + // For now, all buttons are placed into one row. |
|
| 166 | + $settings['buttons'] = array($settings['buttons']); |
|
| 167 | 167 | |
| 168 | - return $settings; |
|
| 168 | + return $settings; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Build a JS settings array of native external plugins that need to be loaded separately. |
| 173 | 173 | */ |
| 174 | 174 | function wysiwyg_fckeditor_plugin_settings($editor, $profile, $plugins) { |
| 175 | - $settings = array(); |
|
| 176 | - foreach ($plugins as $name => $plugin) { |
|
| 175 | + $settings = array(); |
|
| 176 | + foreach ($plugins as $name => $plugin) { |
|
| 177 | 177 | // Register all plugins that need to be loaded. |
| 178 | 178 | if (!empty($plugin['load'])) { |
| 179 | - $settings[$name] = array(); |
|
| 180 | - // Add path for native external plugins; internal ones do not need a path. |
|
| 181 | - if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 179 | + $settings[$name] = array(); |
|
| 180 | + // Add path for native external plugins; internal ones do not need a path. |
|
| 181 | + if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 182 | 182 | // All native FCKeditor plugins use the filename fckplugin.js. |
| 183 | 183 | $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; |
| 184 | - } |
|
| 185 | - if (!empty($plugin['languages'])) { |
|
| 184 | + } |
|
| 185 | + if (!empty($plugin['languages'])) { |
|
| 186 | 186 | $settings[$name]['languages'] = $plugin['languages']; |
| 187 | - } |
|
| 187 | + } |
|
| 188 | + } |
|
| 188 | 189 | } |
| 189 | - } |
|
| 190 | - return $settings; |
|
| 190 | + return $settings; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * Build a JS settings array for Drupal plugins loaded via the proxy plugin. |
| 195 | 195 | */ |
| 196 | 196 | function wysiwyg_fckeditor_proxy_plugin_settings($editor, $profile, $plugins) { |
| 197 | - $settings = array(); |
|
| 198 | - foreach ($plugins as $name => $plugin) { |
|
| 197 | + $settings = array(); |
|
| 198 | + foreach ($plugins as $name => $plugin) { |
|
| 199 | 199 | // Populate required plugin settings. |
| 200 | 200 | $settings[$name] = $plugin['dialog settings'] + array( |
| 201 | - 'title' => $plugin['title'], |
|
| 202 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 203 | - 'iconTitle' => $plugin['icon title'], |
|
| 204 | - // @todo These should only be set if the plugin defined them. |
|
| 205 | - 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 201 | + 'title' => $plugin['title'], |
|
| 202 | + 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 203 | + 'iconTitle' => $plugin['icon title'], |
|
| 204 | + // @todo These should only be set if the plugin defined them. |
|
| 205 | + 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 206 | 206 | ); |
| 207 | - } |
|
| 208 | - return $settings; |
|
| 207 | + } |
|
| 208 | + return $settings; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 213 | 213 | */ |
| 214 | 214 | function wysiwyg_fckeditor_plugins($editor) { |
| 215 | - $plugins = array( |
|
| 215 | + $plugins = array( |
|
| 216 | 216 | 'default' => array( |
| 217 | - 'buttons' => array( |
|
| 217 | + 'buttons' => array( |
|
| 218 | 218 | 'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'), |
| 219 | 219 | 'StrikeThrough' => t('Strike-through'), |
| 220 | 220 | 'JustifyLeft' => t('Align left'), 'JustifyCenter' => t('Align center'), 'JustifyRight' => t('Align right'), 'JustifyFull' => t('Justify'), |
@@ -240,39 +240,39 @@ discard block |
||
| 240 | 240 | 'Flash' => t('Flash'), 'Smiley' => t('Smiley'), |
| 241 | 241 | 'FitWindow' => t('FitWindow'), |
| 242 | 242 | 'SpellCheck' => t('Check spelling'), |
| 243 | - ), |
|
| 244 | - 'internal' => TRUE, |
|
| 243 | + ), |
|
| 244 | + 'internal' => TRUE, |
|
| 245 | 245 | ), |
| 246 | 246 | 'autogrow' => array( |
| 247 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 248 | - 'extensions' => array( |
|
| 247 | + 'path' => $editor['library path'] . '/editor/plugins', |
|
| 248 | + 'extensions' => array( |
|
| 249 | 249 | 'autogrow' => t('Autogrow'), |
| 250 | - ), |
|
| 251 | - 'options' => array( |
|
| 250 | + ), |
|
| 251 | + 'options' => array( |
|
| 252 | 252 | 'AutoGrowMax' => 800, |
| 253 | - ), |
|
| 254 | - 'internal' => TRUE, |
|
| 255 | - 'load' => TRUE, |
|
| 253 | + ), |
|
| 254 | + 'internal' => TRUE, |
|
| 255 | + 'load' => TRUE, |
|
| 256 | 256 | ), |
| 257 | 257 | 'bbcode' => array( |
| 258 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 259 | - 'extensions' => array( |
|
| 258 | + 'path' => $editor['library path'] . '/editor/plugins', |
|
| 259 | + 'extensions' => array( |
|
| 260 | 260 | 'bbcode' => t('BBCode'), |
| 261 | - ), |
|
| 262 | - 'internal' => TRUE, |
|
| 263 | - 'load' => TRUE, |
|
| 261 | + ), |
|
| 262 | + 'internal' => TRUE, |
|
| 263 | + 'load' => TRUE, |
|
| 264 | 264 | ), |
| 265 | 265 | 'dragresizetable' => array( |
| 266 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 267 | - 'extensions' => array( |
|
| 266 | + 'path' => $editor['library path'] . '/editor/plugins', |
|
| 267 | + 'extensions' => array( |
|
| 268 | 268 | 'dragresizetable' => t('Table drag/resize'), |
| 269 | - ), |
|
| 270 | - 'internal' => TRUE, |
|
| 271 | - 'load' => TRUE, |
|
| 269 | + ), |
|
| 270 | + 'internal' => TRUE, |
|
| 271 | + 'load' => TRUE, |
|
| 272 | 272 | ), |
| 273 | 273 | 'tablecommands' => array( |
| 274 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 275 | - 'buttons' => array( |
|
| 274 | + 'path' => $editor['library path'] . '/editor/plugins', |
|
| 275 | + 'buttons' => array( |
|
| 276 | 276 | 'TableCellProp' => t('Table: Cell properties'), |
| 277 | 277 | 'TableInsertRowAfter' => t('Table: Insert row after'), |
| 278 | 278 | 'TableInsertColumnAfter' => t('Table: Insert column after'), |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | 'TableDeleteCells' => t('Table: Delete cells'), |
| 283 | 283 | 'TableMergeCells' => t('Table: Merge cells'), |
| 284 | 284 | 'TableHorizontalSplitCell' => t('Table: Horizontal split cell'), |
| 285 | - ), |
|
| 286 | - 'internal' => TRUE, |
|
| 287 | - 'load' => TRUE, |
|
| 285 | + ), |
|
| 286 | + 'internal' => TRUE, |
|
| 287 | + 'load' => TRUE, |
|
| 288 | 288 | ), |
| 289 | - ); |
|
| 290 | - return $plugins; |
|
| 289 | + ); |
|
| 290 | + return $plugins; |
|
| 291 | 291 | } |
| 292 | 292 | |
@@ -9,36 +9,36 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_wymeditor_editor() { |
| 12 | - $editor['wymeditor'] = array( |
|
| 12 | + $editor['wymeditor'] = array( |
|
| 13 | 13 | 'title' => 'WYMeditor', |
| 14 | 14 | 'vendor url' => 'http://www.wymeditor.org/', |
| 15 | 15 | 'download url' => 'http://www.wymeditor.org/download/', |
| 16 | 16 | 'library path' => wysiwyg_get_path('wymeditor') . '/wymeditor', |
| 17 | 17 | 'libraries' => array( |
| 18 | - 'min' => array( |
|
| 18 | + 'min' => array( |
|
| 19 | 19 | 'title' => 'Minified', |
| 20 | 20 | 'files' => array('jquery.wymeditor.min.js'), |
| 21 | - ), |
|
| 22 | - 'pack' => array( |
|
| 21 | + ), |
|
| 22 | + 'pack' => array( |
|
| 23 | 23 | 'title' => 'Packed', |
| 24 | 24 | 'files' => array('jquery.wymeditor.pack.js'), |
| 25 | - ), |
|
| 26 | - 'src' => array( |
|
| 25 | + ), |
|
| 26 | + 'src' => array( |
|
| 27 | 27 | 'title' => 'Source', |
| 28 | 28 | 'files' => array('jquery.wymeditor.js'), |
| 29 | - ), |
|
| 29 | + ), |
|
| 30 | 30 | ), |
| 31 | 31 | 'version callback' => 'wysiwyg_wymeditor_version', |
| 32 | 32 | 'themes callback' => 'wysiwyg_wymeditor_themes', |
| 33 | 33 | 'settings callback' => 'wysiwyg_wymeditor_settings', |
| 34 | 34 | 'plugin callback' => 'wysiwyg_wymeditor_plugins', |
| 35 | 35 | 'versions' => array( |
| 36 | - '0.5-rc1' => array( |
|
| 36 | + '0.5-rc1' => array( |
|
| 37 | 37 | 'js files' => array('wymeditor.js'), |
| 38 | - ), |
|
| 38 | + ), |
|
| 39 | 39 | ), |
| 40 | - ); |
|
| 41 | - return $editor; |
|
| 40 | + ); |
|
| 41 | + return $editor; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | * The installed editor version. |
| 52 | 52 | */ |
| 53 | 53 | function wysiwyg_wymeditor_version($editor) { |
| 54 | - $script = $editor['library path'] . '/jquery.wymeditor.js'; |
|
| 55 | - if (!file_exists($script)) { |
|
| 54 | + $script = $editor['library path'] . '/jquery.wymeditor.js'; |
|
| 55 | + if (!file_exists($script)) { |
|
| 56 | 56 | return; |
| 57 | - } |
|
| 58 | - $script = fopen($script, 'r'); |
|
| 59 | - fgets($script); |
|
| 60 | - $line = fgets($script); |
|
| 61 | - if (preg_match('@version\s+([0-9a-z\.-]+)@', $line, $version)) { |
|
| 57 | + } |
|
| 58 | + $script = fopen($script, 'r'); |
|
| 59 | + fgets($script); |
|
| 60 | + $line = fgets($script); |
|
| 61 | + if (preg_match('@version\s+([0-9a-z\.-]+)@', $line, $version)) { |
|
| 62 | 62 | fclose($script); |
| 63 | 63 | return $version[1]; |
| 64 | - } |
|
| 65 | - fclose($script); |
|
| 64 | + } |
|
| 65 | + fclose($script); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * theme name. |
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_wymeditor_themes($editor, $profile) { |
| 81 | - return array('compact', 'default', 'minimal', 'silver', 'twopanels'); |
|
| 81 | + return array('compact', 'default', 'minimal', 'silver', 'twopanels'); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,99 +96,99 @@ discard block |
||
| 96 | 96 | * Drupal.settings.wysiwyg.configs.{editor} |
| 97 | 97 | */ |
| 98 | 98 | function wysiwyg_wymeditor_settings($editor, $config, $theme) { |
| 99 | - // @todo Setup $library in wysiwyg_load_editor() already. |
|
| 100 | - $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
|
| 101 | - $settings = array( |
|
| 99 | + // @todo Setup $library in wysiwyg_load_editor() already. |
|
| 100 | + $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
|
| 101 | + $settings = array( |
|
| 102 | 102 | 'basePath' => base_path() . $editor['library path'] . '/', |
| 103 | 103 | 'wymPath' => $editor['libraries'][$library]['files'][0], |
| 104 | 104 | // @todo Does not work in Drupal; jQuery can live anywhere. |
| 105 | 105 | 'jQueryPath' => base_path() . 'misc/jquery.js', |
| 106 | 106 | 'updateSelector' => '.form-submit', |
| 107 | 107 | 'skin' => $theme, |
| 108 | - ); |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | - if (isset($config['language'])) { |
|
| 110 | + if (isset($config['language'])) { |
|
| 111 | 111 | $settings['lang'] = $config['language']; |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - // Add configured buttons. |
|
| 115 | - $settings['toolsItems'] = array(); |
|
| 116 | - if (!empty($config['buttons'])) { |
|
| 114 | + // Add configured buttons. |
|
| 115 | + $settings['toolsItems'] = array(); |
|
| 116 | + if (!empty($config['buttons'])) { |
|
| 117 | 117 | $buttoninfo = _wysiwyg_wymeditor_button_info(); |
| 118 | 118 | $plugins = wysiwyg_get_plugins($editor['name']); |
| 119 | 119 | foreach ($config['buttons'] as $plugin => $buttons) { |
| 120 | - foreach ($buttons as $button => $enabled) { |
|
| 120 | + foreach ($buttons as $button => $enabled) { |
|
| 121 | 121 | // Iterate separately over buttons and extensions properties. |
| 122 | 122 | foreach (array('buttons', 'extensions') as $type) { |
| 123 | - // Skip unavailable plugins. |
|
| 124 | - if (!isset($plugins[$plugin][$type][$button])) { |
|
| 123 | + // Skip unavailable plugins. |
|
| 124 | + if (!isset($plugins[$plugin][$type][$button])) { |
|
| 125 | 125 | continue; |
| 126 | - } |
|
| 127 | - // Add buttons. |
|
| 128 | - if ($type == 'buttons') { |
|
| 126 | + } |
|
| 127 | + // Add buttons. |
|
| 128 | + if ($type == 'buttons') { |
|
| 129 | 129 | // Merge meta-data for internal default buttons. |
| 130 | 130 | if (isset($buttoninfo[$button])) { |
| 131 | - $buttoninfo[$button] += array('name' => $button); |
|
| 132 | - $settings['toolsItems'][] = $buttoninfo[$button]; |
|
| 131 | + $buttoninfo[$button] += array('name' => $button); |
|
| 132 | + $settings['toolsItems'][] = $buttoninfo[$button]; |
|
| 133 | 133 | } |
| 134 | 134 | // For custom buttons, try to provide a valid button definition. |
| 135 | 135 | else { |
| 136 | - $settings['toolsItems'][] = array( |
|
| 136 | + $settings['toolsItems'][] = array( |
|
| 137 | 137 | 'name' => $button, |
| 138 | 138 | 'title' => $plugins[$plugin][$type][$button], |
| 139 | 139 | 'css' => 'wym_tools_' . $button, |
| 140 | - ); |
|
| 140 | + ); |
|
| 141 | + } |
|
| 141 | 142 | } |
| 142 | - } |
|
| 143 | 143 | } |
| 144 | - } |
|
| 144 | + } |
|
| 145 | + } |
|
| 145 | 146 | } |
| 146 | - } |
|
| 147 | 147 | |
| 148 | - if (!empty($config['block_formats'])) { |
|
| 148 | + if (!empty($config['block_formats'])) { |
|
| 149 | 149 | $containers = array( |
| 150 | - 'p' => 'Paragraph', |
|
| 151 | - 'h1' => 'Heading_1', |
|
| 152 | - 'h2' => 'Heading_2', |
|
| 153 | - 'h3' => 'Heading_3', |
|
| 154 | - 'h4' => 'Heading_4', |
|
| 155 | - 'h5' => 'Heading_5', |
|
| 156 | - 'h6' => 'Heading_6', |
|
| 157 | - 'pre' => 'Preformatted', |
|
| 158 | - 'blockquote' => 'Blockquote', |
|
| 159 | - 'th' => 'Table_Header', |
|
| 150 | + 'p' => 'Paragraph', |
|
| 151 | + 'h1' => 'Heading_1', |
|
| 152 | + 'h2' => 'Heading_2', |
|
| 153 | + 'h3' => 'Heading_3', |
|
| 154 | + 'h4' => 'Heading_4', |
|
| 155 | + 'h5' => 'Heading_5', |
|
| 156 | + 'h6' => 'Heading_6', |
|
| 157 | + 'pre' => 'Preformatted', |
|
| 158 | + 'blockquote' => 'Blockquote', |
|
| 159 | + 'th' => 'Table_Header', |
|
| 160 | 160 | ); |
| 161 | 161 | foreach (explode(',', $config['block_formats']) as $tag) { |
| 162 | - if (isset($containers[$tag])) { |
|
| 162 | + if (isset($containers[$tag])) { |
|
| 163 | 163 | $settings['containersItems'][] = array( |
| 164 | - 'name' => strtoupper($tag), |
|
| 165 | - 'title' => $containers[$tag], |
|
| 166 | - 'css' => 'wym_containers_' . $tag, |
|
| 164 | + 'name' => strtoupper($tag), |
|
| 165 | + 'title' => $containers[$tag], |
|
| 166 | + 'css' => 'wym_containers_' . $tag, |
|
| 167 | 167 | ); |
| 168 | - } |
|
| 168 | + } |
|
| 169 | + } |
|
| 169 | 170 | } |
| 170 | - } |
|
| 171 | 171 | |
| 172 | - if (isset($config['css_setting'])) { |
|
| 172 | + if (isset($config['css_setting'])) { |
|
| 173 | 173 | if ($config['css_setting'] == 'theme') { |
| 174 | - // WYMeditor only supports one CSS file currently. |
|
| 175 | - $settings['stylesheet'] = reset(wysiwyg_get_css()); |
|
| 174 | + // WYMeditor only supports one CSS file currently. |
|
| 175 | + $settings['stylesheet'] = reset(wysiwyg_get_css()); |
|
| 176 | 176 | } |
| 177 | 177 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 178 | - $settings['stylesheet'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 178 | + $settings['stylesheet'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 179 | + } |
|
| 179 | 180 | } |
| 180 | - } |
|
| 181 | 181 | |
| 182 | - return $settings; |
|
| 182 | + return $settings; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 187 | 187 | */ |
| 188 | 188 | function wysiwyg_wymeditor_plugins($editor) { |
| 189 | - $plugins = array( |
|
| 189 | + $plugins = array( |
|
| 190 | 190 | 'default' => array( |
| 191 | - 'buttons' => array( |
|
| 191 | + 'buttons' => array( |
|
| 192 | 192 | 'Bold' => t('Bold'), 'Italic' => t('Italic'), |
| 193 | 193 | 'InsertOrderedList' => t('Bullet list'), 'InsertUnorderedList' => t('Numbered list'), |
| 194 | 194 | 'Outdent' => t('Outdent'), 'Indent' => t('Indent'), |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | 'Paste' => t('Paste'), |
| 201 | 201 | 'InsertTable' => t('Table'), |
| 202 | 202 | 'Preview' => t('Preview'), |
| 203 | - ), |
|
| 204 | - 'internal' => TRUE, |
|
| 203 | + ), |
|
| 204 | + 'internal' => TRUE, |
|
| 205 | 205 | ), |
| 206 | - ); |
|
| 207 | - return $plugins; |
|
| 206 | + ); |
|
| 207 | + return $plugins; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
| 211 | 211 | * Helper function to provide additional meta-data for internal default buttons. |
| 212 | 212 | */ |
| 213 | 213 | function _wysiwyg_wymeditor_button_info() { |
| 214 | - return array( |
|
| 214 | + return array( |
|
| 215 | 215 | 'Bold' => array('title'=> 'Strong', 'css'=> 'wym_tools_strong'), |
| 216 | 216 | 'Italic' => array('title'=> 'Emphasis', 'css'=> 'wym_tools_emphasis'), |
| 217 | 217 | 'Superscript' => array('title'=> 'Superscript', 'css'=> 'wym_tools_superscript'), |
@@ -229,5 +229,5 @@ discard block |
||
| 229 | 229 | 'Paste' => array('title'=> 'Paste_From_Word', 'css'=> 'wym_tools_paste'), |
| 230 | 230 | 'ToggleHtml' => array('title'=> 'HTML', 'css'=> 'wym_tools_html'), |
| 231 | 231 | 'Preview' => array('title'=> 'Preview', 'css'=> 'wym_tools_preview'), |
| 232 | - ); |
|
| 232 | + ); |
|
| 233 | 233 | } |
@@ -9,23 +9,23 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_ckeditor_editor() { |
| 12 | - $editor['ckeditor'] = array( |
|
| 12 | + $editor['ckeditor'] = array( |
|
| 13 | 13 | 'title' => 'CKEditor', |
| 14 | 14 | 'vendor url' => 'http://ckeditor.com', |
| 15 | 15 | 'download url' => 'http://ckeditor.com/download', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Default', |
| 19 | 19 | 'files' => array( |
| 20 | - 'ckeditor.js' => array('preprocess' => FALSE), |
|
| 20 | + 'ckeditor.js' => array('preprocess' => FALSE), |
|
| 21 | 21 | ), |
| 22 | - ), |
|
| 23 | - 'src' => array( |
|
| 22 | + ), |
|
| 23 | + 'src' => array( |
|
| 24 | 24 | 'title' => 'Source', |
| 25 | 25 | 'files' => array( |
| 26 | - 'ckeditor_source.js' => array('preprocess' => FALSE), |
|
| 26 | + 'ckeditor_source.js' => array('preprocess' => FALSE), |
|
| 27 | + ), |
|
| 27 | 28 | ), |
| 28 | - ), |
|
| 29 | 29 | ), |
| 30 | 30 | 'version callback' => 'wysiwyg_ckeditor_version', |
| 31 | 31 | 'themes callback' => 'wysiwyg_ckeditor_themes', |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | 'plugin callback' => 'wysiwyg_ckeditor_plugins', |
| 34 | 34 | 'plugin settings callback' => 'wysiwyg_ckeditor_plugin_settings', |
| 35 | 35 | 'proxy plugin' => array( |
| 36 | - 'drupal' => array( |
|
| 36 | + 'drupal' => array( |
|
| 37 | 37 | 'load' => TRUE, |
| 38 | 38 | 'proxy' => TRUE, |
| 39 | - ), |
|
| 39 | + ), |
|
| 40 | 40 | ), |
| 41 | 41 | 'proxy plugin settings callback' => 'wysiwyg_ckeditor_proxy_plugin_settings', |
| 42 | 42 | 'versions' => array( |
| 43 | - '3.0.0.3665' => array( |
|
| 43 | + '3.0.0.3665' => array( |
|
| 44 | 44 | 'js files' => array('ckeditor-3.0.js'), |
| 45 | - ), |
|
| 45 | + ), |
|
| 46 | 46 | ), |
| 47 | - ); |
|
| 48 | - return $editor; |
|
| 47 | + ); |
|
| 48 | + return $editor; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -58,25 +58,25 @@ discard block |
||
| 58 | 58 | * The installed editor version. |
| 59 | 59 | */ |
| 60 | 60 | function wysiwyg_ckeditor_version($editor) { |
| 61 | - $library = $editor['library path'] . '/ckeditor.js'; |
|
| 62 | - if (!file_exists($library)) { |
|
| 61 | + $library = $editor['library path'] . '/ckeditor.js'; |
|
| 62 | + if (!file_exists($library)) { |
|
| 63 | 63 | return; |
| 64 | - } |
|
| 65 | - $library = fopen($library, 'r'); |
|
| 66 | - $max_lines = 8; |
|
| 67 | - while ($max_lines && $line = fgets($library, 500)) { |
|
| 64 | + } |
|
| 65 | + $library = fopen($library, 'r'); |
|
| 66 | + $max_lines = 8; |
|
| 67 | + while ($max_lines && $line = fgets($library, 500)) { |
|
| 68 | 68 | // version:'CKEditor 3.0 SVN',revision:'3665' |
| 69 | 69 | // version:'3.0 RC',revision:'3753' |
| 70 | 70 | // version:'3.0.1',revision:'4391' |
| 71 | 71 | if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version)) { |
| 72 | - fclose($library); |
|
| 73 | - // Version numbers need to have three parts since 3.0.1. |
|
| 74 | - $version[1] = preg_replace('/^(\d+)\.(\d+)$/', '${1}.${2}.0', $version[1]); |
|
| 75 | - return $version[1] . '.' . $version[2]; |
|
| 72 | + fclose($library); |
|
| 73 | + // Version numbers need to have three parts since 3.0.1. |
|
| 74 | + $version[1] = preg_replace('/^(\d+)\.(\d+)$/', '${1}.${2}.0', $version[1]); |
|
| 75 | + return $version[1] . '.' . $version[2]; |
|
| 76 | 76 | } |
| 77 | 77 | $max_lines--; |
| 78 | - } |
|
| 79 | - fclose($library); |
|
| 78 | + } |
|
| 79 | + fclose($library); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -92,23 +92,23 @@ discard block |
||
| 92 | 92 | * theme name. |
| 93 | 93 | */ |
| 94 | 94 | function wysiwyg_ckeditor_themes($editor, $profile) { |
| 95 | - // @todo Skins are not themes but this will do for now. |
|
| 96 | - $path = $editor['library path'] . '/skins/'; |
|
| 97 | - if (file_exists($path) && ($dir_handle = opendir($path))) { |
|
| 95 | + // @todo Skins are not themes but this will do for now. |
|
| 96 | + $path = $editor['library path'] . '/skins/'; |
|
| 97 | + if (file_exists($path) && ($dir_handle = opendir($path))) { |
|
| 98 | 98 | $themes = array(); |
| 99 | 99 | while ($file = readdir($dir_handle)) { |
| 100 | - if (is_dir($path . $file) && substr($file, 0, 1) != '.' && $file != 'CVS') { |
|
| 100 | + if (is_dir($path . $file) && substr($file, 0, 1) != '.' && $file != 'CVS') { |
|
| 101 | 101 | $themes[] = $file; |
| 102 | - } |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | closedir($dir_handle); |
| 105 | 105 | natcasesort($themes); |
| 106 | 106 | $themes = array_values($themes); |
| 107 | 107 | return !empty($themes) ? $themes : array('default'); |
| 108 | - } |
|
| 109 | - else { |
|
| 108 | + } |
|
| 109 | + else { |
|
| 110 | 110 | return array('default'); |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * Drupal.settings.wysiwyg.configs.{editor} |
| 127 | 127 | */ |
| 128 | 128 | function wysiwyg_ckeditor_settings($editor, $config, $theme) { |
| 129 | - $settings = array( |
|
| 129 | + $settings = array( |
|
| 130 | 130 | 'baseHref' => $GLOBALS['base_url'] . '/', |
| 131 | 131 | 'width' => '100%', |
| 132 | 132 | // For better compatibility with smaller textareas. |
@@ -142,155 +142,155 @@ discard block |
||
| 142 | 142 | // @todo Check whether completely disabling ProcessHTMLEntities is an option. |
| 143 | 143 | 'entities_latin' => FALSE, |
| 144 | 144 | 'entities_greek' => FALSE, |
| 145 | - ); |
|
| 145 | + ); |
|
| 146 | 146 | |
| 147 | - // Add HTML block format settings; common block formats are already predefined |
|
| 148 | - // by CKEditor. |
|
| 149 | - if (isset($config['block_formats'])) { |
|
| 147 | + // Add HTML block format settings; common block formats are already predefined |
|
| 148 | + // by CKEditor. |
|
| 149 | + if (isset($config['block_formats'])) { |
|
| 150 | 150 | $block_formats = explode(',', drupal_strtolower($config['block_formats'])); |
| 151 | 151 | $predefined_formats = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'address', 'div'); |
| 152 | 152 | foreach (array_diff($block_formats, $predefined_formats) as $tag) { |
| 153 | - $tag = trim($tag); |
|
| 154 | - $settings["format_$tag"] = array('element' => $tag); |
|
| 153 | + $tag = trim($tag); |
|
| 154 | + $settings["format_$tag"] = array('element' => $tag); |
|
| 155 | 155 | } |
| 156 | 156 | $settings['format_tags'] = implode(';', $block_formats); |
| 157 | - } |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - if (isset($config['apply_source_formatting'])) { |
|
| 159 | + if (isset($config['apply_source_formatting'])) { |
|
| 160 | 160 | $settings['apply_source_formatting'] = $config['apply_source_formatting']; |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - if (isset($config['css_setting'])) { |
|
| 163 | + if (isset($config['css_setting'])) { |
|
| 164 | 164 | // Versions below 3.0.1 could only handle one stylesheet. |
| 165 | 165 | if (version_compare($editor['installed version'], '3.0.1.4391', '<')) { |
| 166 | - if ($config['css_setting'] == 'theme') { |
|
| 166 | + if ($config['css_setting'] == 'theme') { |
|
| 167 | 167 | $settings['contentsCss'] = reset(wysiwyg_get_css()); |
| 168 | - } |
|
| 169 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 168 | + } |
|
| 169 | + elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 170 | 170 | $settings['contentsCss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 171 | - } |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | else { |
| 174 | - if ($config['css_setting'] == 'theme') { |
|
| 174 | + if ($config['css_setting'] == 'theme') { |
|
| 175 | 175 | $settings['contentsCss'] = wysiwyg_get_css(); |
| 176 | - } |
|
| 177 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 176 | + } |
|
| 177 | + elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 178 | 178 | $settings['contentsCss'] = explode(',', strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()))); |
| 179 | - } |
|
| 179 | + } |
|
| 180 | + } |
|
| 180 | 181 | } |
| 181 | - } |
|
| 182 | 182 | |
| 183 | - if (isset($config['language'])) { |
|
| 183 | + if (isset($config['language'])) { |
|
| 184 | 184 | $settings['language'] = $config['language']; |
| 185 | - } |
|
| 186 | - if (isset($config['resizing'])) { |
|
| 185 | + } |
|
| 186 | + if (isset($config['resizing'])) { |
|
| 187 | 187 | // CKEditor tests "!== false", so ensure it is a Boolean. |
| 188 | 188 | $settings['resize_enabled'] = (bool) $config['resizing']; |
| 189 | - } |
|
| 190 | - if (isset($config['toolbar_loc'])) { |
|
| 189 | + } |
|
| 190 | + if (isset($config['toolbar_loc'])) { |
|
| 191 | 191 | $settings['toolbarLocation'] = $config['toolbar_loc']; |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - $settings['toolbar'] = array(); |
|
| 195 | - if (!empty($config['buttons'])) { |
|
| 194 | + $settings['toolbar'] = array(); |
|
| 195 | + if (!empty($config['buttons'])) { |
|
| 196 | 196 | $extra_plugins = array(); |
| 197 | 197 | $plugins = wysiwyg_get_plugins($editor['name']); |
| 198 | 198 | foreach ($config['buttons'] as $plugin => $buttons) { |
| 199 | - foreach ($buttons as $button => $enabled) { |
|
| 199 | + foreach ($buttons as $button => $enabled) { |
|
| 200 | 200 | // Iterate separately over buttons and extensions properties. |
| 201 | 201 | foreach (array('buttons', 'extensions') as $type) { |
| 202 | - // Skip unavailable plugins. |
|
| 203 | - if (!isset($plugins[$plugin][$type][$button])) { |
|
| 202 | + // Skip unavailable plugins. |
|
| 203 | + if (!isset($plugins[$plugin][$type][$button])) { |
|
| 204 | 204 | continue; |
| 205 | - } |
|
| 206 | - // Add buttons. |
|
| 207 | - if ($type == 'buttons') { |
|
| 205 | + } |
|
| 206 | + // Add buttons. |
|
| 207 | + if ($type == 'buttons') { |
|
| 208 | 208 | $settings['toolbar'][] = $button; |
| 209 | - } |
|
| 210 | - // Add external Drupal plugins to the list of extensions. |
|
| 211 | - if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { |
|
| 209 | + } |
|
| 210 | + // Add external Drupal plugins to the list of extensions. |
|
| 211 | + if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { |
|
| 212 | 212 | $extra_plugins[] = $button; |
| 213 | - } |
|
| 214 | - // Add external plugins to the list of extensions. |
|
| 215 | - elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { |
|
| 213 | + } |
|
| 214 | + // Add external plugins to the list of extensions. |
|
| 215 | + elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { |
|
| 216 | 216 | $extra_plugins[] = $plugin; |
| 217 | - } |
|
| 218 | - // Add internal buttons that also need to be loaded as extension. |
|
| 219 | - elseif ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { |
|
| 217 | + } |
|
| 218 | + // Add internal buttons that also need to be loaded as extension. |
|
| 219 | + elseif ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { |
|
| 220 | 220 | $extra_plugins[] = $plugin; |
| 221 | - } |
|
| 222 | - // Add plain extensions. |
|
| 223 | - elseif ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { |
|
| 221 | + } |
|
| 222 | + // Add plain extensions. |
|
| 223 | + elseif ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { |
|
| 224 | 224 | $extra_plugins[] = $plugin; |
| 225 | - } |
|
| 226 | - // Allow plugins to add or override global configuration settings. |
|
| 227 | - if (!empty($plugins[$plugin]['options'])) { |
|
| 225 | + } |
|
| 226 | + // Allow plugins to add or override global configuration settings. |
|
| 227 | + if (!empty($plugins[$plugin]['options'])) { |
|
| 228 | 228 | $settings = array_merge($settings, $plugins[$plugin]['options']); |
| 229 | - } |
|
| 229 | + } |
|
| 230 | + } |
|
| 230 | 231 | } |
| 231 | - } |
|
| 232 | 232 | } |
| 233 | 233 | if (!empty($extra_plugins)) { |
| 234 | - $settings['extraPlugins'] = implode(',', $extra_plugins); |
|
| 234 | + $settings['extraPlugins'] = implode(',', $extra_plugins); |
|
| 235 | 235 | } |
| 236 | - } |
|
| 237 | - // For now, all buttons are placed into one row. |
|
| 238 | - $settings['toolbar'] = array($settings['toolbar']); |
|
| 236 | + } |
|
| 237 | + // For now, all buttons are placed into one row. |
|
| 238 | + $settings['toolbar'] = array($settings['toolbar']); |
|
| 239 | 239 | |
| 240 | - return $settings; |
|
| 240 | + return $settings; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * Build a JS settings array of native external plugins that need to be loaded separately. |
| 245 | 245 | */ |
| 246 | 246 | function wysiwyg_ckeditor_plugin_settings($editor, $profile, $plugins) { |
| 247 | - $settings = array(); |
|
| 248 | - foreach ($plugins as $name => $plugin) { |
|
| 247 | + $settings = array(); |
|
| 248 | + foreach ($plugins as $name => $plugin) { |
|
| 249 | 249 | // Register all plugins that need to be loaded. |
| 250 | 250 | if (!empty($plugin['load'])) { |
| 251 | - $settings[$name] = array(); |
|
| 252 | - // Add path for native external plugins. |
|
| 253 | - if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 251 | + $settings[$name] = array(); |
|
| 252 | + // Add path for native external plugins. |
|
| 253 | + if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 254 | 254 | $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; |
| 255 | - } |
|
| 256 | - // Force native internal plugins to use the standard path. |
|
| 257 | - else { |
|
| 255 | + } |
|
| 256 | + // Force native internal plugins to use the standard path. |
|
| 257 | + else { |
|
| 258 | 258 | $settings[$name]['path'] = base_path() . $editor['library path'] . '/plugins/' . $name . '/'; |
| 259 | - } |
|
| 260 | - // CKEditor defaults to 'plugin.js' on its own when filename is not set. |
|
| 261 | - if (!empty($plugin['filename'])) { |
|
| 259 | + } |
|
| 260 | + // CKEditor defaults to 'plugin.js' on its own when filename is not set. |
|
| 261 | + if (!empty($plugin['filename'])) { |
|
| 262 | 262 | $settings[$name]['fileName'] = $plugin['filename']; |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | } |
| 265 | - } |
|
| 266 | - return $settings; |
|
| 265 | + } |
|
| 266 | + return $settings; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | 270 | * Build a JS settings array for Drupal plugins loaded via the proxy plugin. |
| 271 | 271 | */ |
| 272 | 272 | function wysiwyg_ckeditor_proxy_plugin_settings($editor, $profile, $plugins) { |
| 273 | - $settings = array(); |
|
| 274 | - foreach ($plugins as $name => $plugin) { |
|
| 273 | + $settings = array(); |
|
| 274 | + foreach ($plugins as $name => $plugin) { |
|
| 275 | 275 | // Populate required plugin settings. |
| 276 | 276 | $settings[$name] = $plugin['dialog settings'] + array( |
| 277 | - 'title' => $plugin['title'], |
|
| 278 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 279 | - 'iconTitle' => $plugin['icon title'], |
|
| 280 | - // @todo These should only be set if the plugin defined them. |
|
| 281 | - 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 277 | + 'title' => $plugin['title'], |
|
| 278 | + 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 279 | + 'iconTitle' => $plugin['icon title'], |
|
| 280 | + // @todo These should only be set if the plugin defined them. |
|
| 281 | + 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 282 | 282 | ); |
| 283 | - } |
|
| 284 | - return $settings; |
|
| 283 | + } |
|
| 284 | + return $settings; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 289 | 289 | */ |
| 290 | 290 | function wysiwyg_ckeditor_plugins($editor) { |
| 291 | - $plugins = array( |
|
| 291 | + $plugins = array( |
|
| 292 | 292 | 'default' => array( |
| 293 | - 'buttons' => array( |
|
| 293 | + 'buttons' => array( |
|
| 294 | 294 | 'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'), |
| 295 | 295 | 'Strike' => t('Strike-through'), |
| 296 | 296 | 'JustifyLeft' => t('Align left'), 'JustifyCenter' => t('Align center'), 'JustifyRight' => t('Align right'), 'JustifyBlock' => t('Justify'), |
@@ -317,17 +317,17 @@ discard block |
||
| 317 | 317 | 'Maximize' => t('Maximize'), |
| 318 | 318 | 'SpellChecker' => t('Check spelling'), 'Scayt' => t('Check spelling as you type'), |
| 319 | 319 | 'About' => t('About'), |
| 320 | - ), |
|
| 321 | - 'internal' => TRUE, |
|
| 320 | + ), |
|
| 321 | + 'internal' => TRUE, |
|
| 322 | 322 | ), |
| 323 | - ); |
|
| 323 | + ); |
|
| 324 | 324 | |
| 325 | - if (version_compare($editor['installed version'], '3.1.0.4885', '<')) { |
|
| 325 | + if (version_compare($editor['installed version'], '3.1.0.4885', '<')) { |
|
| 326 | 326 | unset($plugins['default']['buttons']['CreateDiv']); |
| 327 | - } |
|
| 328 | - if (version_compare($editor['installed version'], '3.5.0.6260', '<')) { |
|
| 327 | + } |
|
| 328 | + if (version_compare($editor['installed version'], '3.5.0.6260', '<')) { |
|
| 329 | 329 | unset($plugins['default']['buttons']['Iframe']); |
| 330 | - } |
|
| 331 | - return $plugins; |
|
| 330 | + } |
|
| 331 | + return $plugins; |
|
| 332 | 332 | } |
| 333 | 333 | |
@@ -9,32 +9,32 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_markitup_editor() { |
| 12 | - $editor['markitup'] = array( |
|
| 12 | + $editor['markitup'] = array( |
|
| 13 | 13 | 'title' => 'markItUp', |
| 14 | 14 | 'vendor url' => 'http://markitup.jaysalvat.com', |
| 15 | 15 | 'download url' => 'http://markitup.jaysalvat.com/downloads', |
| 16 | 16 | 'library path' => wysiwyg_get_path('markitup'), |
| 17 | 17 | 'libraries' => array( |
| 18 | - '' => array( |
|
| 18 | + '' => array( |
|
| 19 | 19 | 'title' => 'Source', |
| 20 | 20 | 'files' => array('markitup/jquery.markitup.js'), |
| 21 | - ), |
|
| 22 | - 'pack' => array( |
|
| 21 | + ), |
|
| 22 | + 'pack' => array( |
|
| 23 | 23 | 'title' => 'Packed', |
| 24 | 24 | 'files' => array('markitup/jquery.markitup.pack.js'), |
| 25 | - ), |
|
| 25 | + ), |
|
| 26 | 26 | ), |
| 27 | 27 | 'version callback' => 'wysiwyg_markitup_version', |
| 28 | 28 | 'themes callback' => 'wysiwyg_markitup_themes', |
| 29 | 29 | 'settings callback' => 'wysiwyg_markitup_settings', |
| 30 | 30 | 'plugin callback' => 'wysiwyg_markitup_plugins', |
| 31 | 31 | 'versions' => array( |
| 32 | - '1.1.5' => array( |
|
| 32 | + '1.1.5' => array( |
|
| 33 | 33 | 'js files' => array('markitup.js'), |
| 34 | - ), |
|
| 34 | + ), |
|
| 35 | 35 | ), |
| 36 | - ); |
|
| 37 | - return $editor; |
|
| 36 | + ); |
|
| 37 | + return $editor; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -47,22 +47,22 @@ discard block |
||
| 47 | 47 | * The installed editor version. |
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_markitup_version($editor) { |
| 50 | - // Changelog was in markitup/markitup/readme.txt <= 1.1.5. |
|
| 51 | - $changelog = $editor['library path'] . '/markitup/readme.txt'; |
|
| 52 | - if (!file_exists($changelog)) { |
|
| 50 | + // Changelog was in markitup/markitup/readme.txt <= 1.1.5. |
|
| 51 | + $changelog = $editor['library path'] . '/markitup/readme.txt'; |
|
| 52 | + if (!file_exists($changelog)) { |
|
| 53 | 53 | // Changelog was moved up to markitup/CHANGELOG.md after 1.1.5. |
| 54 | 54 | $changelog = $editor['library path'] . '/CHANGELOG.md'; |
| 55 | 55 | if (!file_exists($changelog)) { |
| 56 | - return; |
|
| 56 | + return; |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | - } |
|
| 59 | - $changelog = fopen($changelog, 'r'); |
|
| 60 | - $line = fgets($changelog); |
|
| 61 | - if (preg_match('@([0-9\.]+)@', $line, $version)) { |
|
| 59 | + $changelog = fopen($changelog, 'r'); |
|
| 60 | + $line = fgets($changelog); |
|
| 61 | + if (preg_match('@([0-9\.]+)@', $line, $version)) { |
|
| 62 | 62 | fclose($changelog); |
| 63 | 63 | return $version[1]; |
| 64 | - } |
|
| 65 | - fclose($changelog); |
|
| 64 | + } |
|
| 65 | + fclose($changelog); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * theme name. |
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_markitup_themes($editor, $profile) { |
| 81 | - return array('simple', 'markitup'); |
|
| 81 | + return array('simple', 'markitup'); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,91 +96,91 @@ discard block |
||
| 96 | 96 | * Drupal.settings.wysiwyg.configs.{editor} |
| 97 | 97 | */ |
| 98 | 98 | function wysiwyg_markitup_settings($editor, $config, $theme) { |
| 99 | - // Whoever is guilty for adding this horrible CSS-file-without-filepath |
|
| 100 | - // override "feature" to Drupal core... stand in the corner! |
|
| 101 | - drupal_add_css($editor['library path'] . '/markitup/skins/' . $theme . '/style.css', 'theme'); |
|
| 99 | + // Whoever is guilty for adding this horrible CSS-file-without-filepath |
|
| 100 | + // override "feature" to Drupal core... stand in the corner! |
|
| 101 | + drupal_add_css($editor['library path'] . '/markitup/skins/' . $theme . '/style.css', 'theme'); |
|
| 102 | 102 | |
| 103 | - $settings = array( |
|
| 103 | + $settings = array( |
|
| 104 | 104 | 'root' => base_path() . $editor['library path'] . '/markitup/', |
| 105 | 105 | 'nameSpace' => $theme, |
| 106 | 106 | 'markupSet' => array(), |
| 107 | - ); |
|
| 107 | + ); |
|
| 108 | 108 | |
| 109 | - // Add configured buttons or all available. |
|
| 110 | - $default_buttons = array( |
|
| 109 | + // Add configured buttons or all available. |
|
| 110 | + $default_buttons = array( |
|
| 111 | 111 | 'bold' => array( |
| 112 | - 'name' => t('Bold'), |
|
| 113 | - 'className' => 'markitup-bold', |
|
| 114 | - 'key' => 'B', |
|
| 115 | - 'openWith' => '(!(<strong>|!|<b>)!)', |
|
| 116 | - 'closeWith' => '(!(</strong>|!|</b>)!)', |
|
| 112 | + 'name' => t('Bold'), |
|
| 113 | + 'className' => 'markitup-bold', |
|
| 114 | + 'key' => 'B', |
|
| 115 | + 'openWith' => '(!(<strong>|!|<b>)!)', |
|
| 116 | + 'closeWith' => '(!(</strong>|!|</b>)!)', |
|
| 117 | 117 | ), |
| 118 | 118 | 'italic' => array( |
| 119 | - 'name' => t('Italic'), |
|
| 120 | - 'className' => 'markitup-italic', |
|
| 121 | - 'key' => 'I', |
|
| 122 | - 'openWith' => '(!(<em>|!|<i>)!)', |
|
| 123 | - 'closeWith' => '(!(</em>|!|</i>)!)', |
|
| 119 | + 'name' => t('Italic'), |
|
| 120 | + 'className' => 'markitup-italic', |
|
| 121 | + 'key' => 'I', |
|
| 122 | + 'openWith' => '(!(<em>|!|<i>)!)', |
|
| 123 | + 'closeWith' => '(!(</em>|!|</i>)!)', |
|
| 124 | 124 | ), |
| 125 | 125 | 'stroke' => array( |
| 126 | - 'name' => t('Strike-through'), |
|
| 127 | - 'className' => 'markitup-stroke', |
|
| 128 | - 'key' => 'S', |
|
| 129 | - 'openWith' => '<del>', |
|
| 130 | - 'closeWith' => '</del>', |
|
| 126 | + 'name' => t('Strike-through'), |
|
| 127 | + 'className' => 'markitup-stroke', |
|
| 128 | + 'key' => 'S', |
|
| 129 | + 'openWith' => '<del>', |
|
| 130 | + 'closeWith' => '</del>', |
|
| 131 | 131 | ), |
| 132 | 132 | 'image' => array( |
| 133 | - 'name' => t('Image'), |
|
| 134 | - 'className' => 'markitup-image', |
|
| 135 | - 'key' => 'P', |
|
| 136 | - 'replaceWith' => '<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />', |
|
| 133 | + 'name' => t('Image'), |
|
| 134 | + 'className' => 'markitup-image', |
|
| 135 | + 'key' => 'P', |
|
| 136 | + 'replaceWith' => '<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />', |
|
| 137 | 137 | ), |
| 138 | 138 | 'link' => array( |
| 139 | - 'name' => t('Link'), |
|
| 140 | - 'className' => 'markitup-link', |
|
| 141 | - 'key' => 'K', |
|
| 142 | - 'openWith' => '<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', |
|
| 143 | - 'closeWith' => '</a>', |
|
| 144 | - 'placeHolder' => 'Your text to link...', |
|
| 139 | + 'name' => t('Link'), |
|
| 140 | + 'className' => 'markitup-link', |
|
| 141 | + 'key' => 'K', |
|
| 142 | + 'openWith' => '<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', |
|
| 143 | + 'closeWith' => '</a>', |
|
| 144 | + 'placeHolder' => 'Your text to link...', |
|
| 145 | 145 | ), |
| 146 | 146 | // @todo |
| 147 | 147 | // 'cleanup' => array('name' => t('Clean-up'), 'className' => 'markitup-cleanup', 'replaceWith' => 'function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") }'), |
| 148 | 148 | 'preview' => array( |
| 149 | - 'name' => t('Preview'), |
|
| 150 | - 'className' => 'markitup-preview', |
|
| 151 | - 'call' => 'preview', |
|
| 149 | + 'name' => t('Preview'), |
|
| 150 | + 'className' => 'markitup-preview', |
|
| 151 | + 'call' => 'preview', |
|
| 152 | 152 | ), |
| 153 | - ); |
|
| 154 | - $settings['markupSet'] = array(); |
|
| 155 | - if (!empty($config['buttons'])) { |
|
| 153 | + ); |
|
| 154 | + $settings['markupSet'] = array(); |
|
| 155 | + if (!empty($config['buttons'])) { |
|
| 156 | 156 | foreach ($config['buttons'] as $plugin) { |
| 157 | - foreach ($plugin as $button => $enabled) { |
|
| 157 | + foreach ($plugin as $button => $enabled) { |
|
| 158 | 158 | if (isset($default_buttons[$button])) { |
| 159 | - $settings['markupSet'][$button] = $default_buttons[$button]; |
|
| 159 | + $settings['markupSet'][$button] = $default_buttons[$button]; |
|
| 160 | + } |
|
| 160 | 161 | } |
| 161 | - } |
|
| 162 | 162 | } |
| 163 | - } |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - return $settings; |
|
| 165 | + return $settings; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 170 | 170 | */ |
| 171 | 171 | function wysiwyg_markitup_plugins($editor) { |
| 172 | - return array( |
|
| 172 | + return array( |
|
| 173 | 173 | 'default' => array( |
| 174 | - 'buttons' => array( |
|
| 174 | + 'buttons' => array( |
|
| 175 | 175 | 'bold' => t('Bold'), 'italic' => t('Italic'), |
| 176 | 176 | 'stroke' => t('Strike-through'), |
| 177 | 177 | 'link' => t('Link'), |
| 178 | 178 | 'image' => t('Image'), |
| 179 | 179 | // 'cleanup' => t('Clean-up'), |
| 180 | 180 | 'preview' => t('Preview'), |
| 181 | - ), |
|
| 182 | - 'internal' => TRUE, |
|
| 181 | + ), |
|
| 182 | + 'internal' => TRUE, |
|
| 183 | 183 | ), |
| 184 | - ); |
|
| 184 | + ); |
|
| 185 | 185 | } |
| 186 | 186 | |
@@ -9,36 +9,36 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_yui_editor() { |
| 12 | - $editor['yui'] = array( |
|
| 12 | + $editor['yui'] = array( |
|
| 13 | 13 | 'title' => 'YUI editor', |
| 14 | 14 | 'vendor url' => 'http://developer.yahoo.com/yui/editor/', |
| 15 | 15 | 'download url' => 'http://developer.yahoo.com/yui/download/', |
| 16 | 16 | 'library path' => wysiwyg_get_path('yui') . '/build', |
| 17 | 17 | 'libraries' => array( |
| 18 | - 'min' => array( |
|
| 18 | + 'min' => array( |
|
| 19 | 19 | 'title' => 'Minified', |
| 20 | 20 | 'files' => array( |
| 21 | - 'yahoo-dom-event/yahoo-dom-event.js', |
|
| 22 | - 'animation/animation-min.js', |
|
| 23 | - 'element/element-min.js', |
|
| 24 | - 'container/container-min.js', |
|
| 25 | - 'menu/menu-min.js', |
|
| 26 | - 'button/button-min.js', |
|
| 27 | - 'editor/editor-min.js', |
|
| 21 | + 'yahoo-dom-event/yahoo-dom-event.js', |
|
| 22 | + 'animation/animation-min.js', |
|
| 23 | + 'element/element-min.js', |
|
| 24 | + 'container/container-min.js', |
|
| 25 | + 'menu/menu-min.js', |
|
| 26 | + 'button/button-min.js', |
|
| 27 | + 'editor/editor-min.js', |
|
| 28 | 28 | ), |
| 29 | - ), |
|
| 30 | - 'src' => array( |
|
| 29 | + ), |
|
| 30 | + 'src' => array( |
|
| 31 | 31 | 'title' => 'Source', |
| 32 | 32 | 'files' => array( |
| 33 | - 'yahoo-dom-event/yahoo-dom-event.js', |
|
| 34 | - 'animation/animation.js', |
|
| 35 | - 'element/element.js', |
|
| 36 | - 'container/container.js', |
|
| 37 | - 'menu/menu.js', |
|
| 38 | - 'button/button.js', |
|
| 39 | - 'editor/editor.js', |
|
| 33 | + 'yahoo-dom-event/yahoo-dom-event.js', |
|
| 34 | + 'animation/animation.js', |
|
| 35 | + 'element/element.js', |
|
| 36 | + 'container/container.js', |
|
| 37 | + 'menu/menu.js', |
|
| 38 | + 'button/button.js', |
|
| 39 | + 'editor/editor.js', |
|
| 40 | + ), |
|
| 40 | 41 | ), |
| 41 | - ), |
|
| 42 | 42 | ), |
| 43 | 43 | 'version callback' => 'wysiwyg_yui_version', |
| 44 | 44 | 'themes callback' => 'wysiwyg_yui_themes', |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | 'settings callback' => 'wysiwyg_yui_settings', |
| 47 | 47 | 'plugin callback' => 'wysiwyg_yui_plugins', |
| 48 | 48 | 'versions' => array( |
| 49 | - '2.7.0' => array( |
|
| 49 | + '2.7.0' => array( |
|
| 50 | 50 | 'js files' => array('yui.js'), |
| 51 | - ), |
|
| 51 | + ), |
|
| 52 | 52 | ), |
| 53 | - ); |
|
| 54 | - return $editor; |
|
| 53 | + ); |
|
| 54 | + return $editor; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * The installed editor version. |
| 65 | 65 | */ |
| 66 | 66 | function wysiwyg_yui_version($editor) { |
| 67 | - $library = $editor['library path'] . '/editor/editor.js'; |
|
| 68 | - if (!file_exists($library)) { |
|
| 67 | + $library = $editor['library path'] . '/editor/editor.js'; |
|
| 68 | + if (!file_exists($library)) { |
|
| 69 | 69 | return; |
| 70 | - } |
|
| 71 | - $library = fopen($library, 'r'); |
|
| 72 | - $max_lines = 10; |
|
| 73 | - while ($max_lines && $line = fgets($library, 60)) { |
|
| 70 | + } |
|
| 71 | + $library = fopen($library, 'r'); |
|
| 72 | + $max_lines = 10; |
|
| 73 | + while ($max_lines && $line = fgets($library, 60)) { |
|
| 74 | 74 | if (preg_match('@version:\s([0-9\.]+)@', $line, $version)) { |
| 75 | - fclose($library); |
|
| 76 | - return $version[1]; |
|
| 75 | + fclose($library); |
|
| 76 | + return $version[1]; |
|
| 77 | 77 | } |
| 78 | 78 | $max_lines--; |
| 79 | - } |
|
| 80 | - fclose($library); |
|
| 79 | + } |
|
| 80 | + fclose($library); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * theme name. |
| 94 | 94 | */ |
| 95 | 95 | function wysiwyg_yui_themes($editor, $profile) { |
| 96 | - return array('sam'); |
|
| 96 | + return array('sam'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | * The internal library name (array key) to use. |
| 106 | 106 | */ |
| 107 | 107 | function wysiwyg_yui_load($editor, $library) { |
| 108 | - drupal_add_css($editor['library path'] . '/menu/assets/skins/sam/menu.css'); |
|
| 109 | - drupal_add_css($editor['library path'] . '/button/assets/skins/sam/button.css'); |
|
| 110 | - drupal_add_css($editor['library path'] . '/fonts/fonts-min.css'); |
|
| 111 | - drupal_add_css($editor['library path'] . '/container/assets/skins/sam/container.css'); |
|
| 112 | - drupal_add_css($editor['library path'] . '/editor/assets/skins/sam/editor.css'); |
|
| 108 | + drupal_add_css($editor['library path'] . '/menu/assets/skins/sam/menu.css'); |
|
| 109 | + drupal_add_css($editor['library path'] . '/button/assets/skins/sam/button.css'); |
|
| 110 | + drupal_add_css($editor['library path'] . '/fonts/fonts-min.css'); |
|
| 111 | + drupal_add_css($editor['library path'] . '/container/assets/skins/sam/container.css'); |
|
| 112 | + drupal_add_css($editor['library path'] . '/editor/assets/skins/sam/editor.css'); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -127,58 +127,58 @@ discard block |
||
| 127 | 127 | * Drupal.settings.wysiwyg.configs.{editor} |
| 128 | 128 | */ |
| 129 | 129 | function wysiwyg_yui_settings($editor, $config, $theme) { |
| 130 | - $settings = array( |
|
| 130 | + $settings = array( |
|
| 131 | 131 | 'theme' => $theme, |
| 132 | 132 | 'animate' => TRUE, |
| 133 | 133 | 'handleSubmit' => TRUE, |
| 134 | 134 | 'markup' => 'xhtml', |
| 135 | 135 | 'ptags' => TRUE, |
| 136 | - ); |
|
| 136 | + ); |
|
| 137 | 137 | |
| 138 | - if (isset($config['path_loc']) && $config['path_loc'] != 'none') { |
|
| 138 | + if (isset($config['path_loc']) && $config['path_loc'] != 'none') { |
|
| 139 | 139 | $settings['dompath'] = $config['path_loc']; |
| 140 | - } |
|
| 141 | - // Enable auto-height feature when editor should be resizable. |
|
| 142 | - if (!empty($config['resizing'])) { |
|
| 140 | + } |
|
| 141 | + // Enable auto-height feature when editor should be resizable. |
|
| 142 | + if (!empty($config['resizing'])) { |
|
| 143 | 143 | $settings['autoHeight'] = TRUE; |
| 144 | - } |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - $settings += array( |
|
| 146 | + $settings += array( |
|
| 147 | 147 | 'toolbar' => array( |
| 148 | - 'collapse' => FALSE, |
|
| 149 | - 'draggable' => TRUE, |
|
| 150 | - 'buttonType' => 'advanced', |
|
| 151 | - 'buttons' => array(), |
|
| 148 | + 'collapse' => FALSE, |
|
| 149 | + 'draggable' => TRUE, |
|
| 150 | + 'buttonType' => 'advanced', |
|
| 151 | + 'buttons' => array(), |
|
| 152 | 152 | ), |
| 153 | - ); |
|
| 154 | - if (!empty($config['buttons'])) { |
|
| 153 | + ); |
|
| 154 | + if (!empty($config['buttons'])) { |
|
| 155 | 155 | $buttons = array(); |
| 156 | 156 | foreach ($config['buttons'] as $plugin => $enabled_buttons) { |
| 157 | - foreach ($enabled_buttons as $button => $enabled) { |
|
| 157 | + foreach ($enabled_buttons as $button => $enabled) { |
|
| 158 | 158 | $extra = array(); |
| 159 | 159 | if ($button == 'heading') { |
| 160 | - $extra = array('menu' => array( |
|
| 160 | + $extra = array('menu' => array( |
|
| 161 | 161 | array('text' => 'Normal', 'value' => 'none', 'checked' => TRUE), |
| 162 | - )); |
|
| 163 | - if (!empty($config['block_formats'])) { |
|
| 162 | + )); |
|
| 163 | + if (!empty($config['block_formats'])) { |
|
| 164 | 164 | $headings = array( |
| 165 | - 'p' => array('text' => 'Paragraph', 'value' => 'p'), |
|
| 166 | - 'h1' => array('text' => 'Heading 1', 'value' => 'h1'), |
|
| 167 | - 'h2' => array('text' => 'Heading 2', 'value' => 'h2'), |
|
| 168 | - 'h3' => array('text' => 'Heading 3', 'value' => 'h3'), |
|
| 169 | - 'h4' => array('text' => 'Heading 4', 'value' => 'h4'), |
|
| 170 | - 'h5' => array('text' => 'Heading 5', 'value' => 'h5'), |
|
| 171 | - 'h6' => array('text' => 'Heading 6', 'value' => 'h6'), |
|
| 165 | + 'p' => array('text' => 'Paragraph', 'value' => 'p'), |
|
| 166 | + 'h1' => array('text' => 'Heading 1', 'value' => 'h1'), |
|
| 167 | + 'h2' => array('text' => 'Heading 2', 'value' => 'h2'), |
|
| 168 | + 'h3' => array('text' => 'Heading 3', 'value' => 'h3'), |
|
| 169 | + 'h4' => array('text' => 'Heading 4', 'value' => 'h4'), |
|
| 170 | + 'h5' => array('text' => 'Heading 5', 'value' => 'h5'), |
|
| 171 | + 'h6' => array('text' => 'Heading 6', 'value' => 'h6'), |
|
| 172 | 172 | ); |
| 173 | 173 | foreach (explode(',', $config['block_formats']) as $tag) { |
| 174 | - if (isset($headings[$tag])) { |
|
| 174 | + if (isset($headings[$tag])) { |
|
| 175 | 175 | $extra['menu'][] = $headings[$tag]; |
| 176 | - } |
|
| 176 | + } |
|
| 177 | + } |
|
| 177 | 178 | } |
| 178 | - } |
|
| 179 | 179 | } |
| 180 | 180 | else if ($button == 'fontname') { |
| 181 | - $extra = array('menu' => array( |
|
| 181 | + $extra = array('menu' => array( |
|
| 182 | 182 | array('text' => 'Arial', 'checked' => TRUE), |
| 183 | 183 | array('text' => 'Arial Black'), |
| 184 | 184 | array('text' => 'Comic Sans MS'), |
@@ -188,32 +188,32 @@ discard block |
||
| 188 | 188 | array('text' => 'Times New Roman'), |
| 189 | 189 | array('text' => 'Trebuchet MS'), |
| 190 | 190 | array('text' => 'Verdana'), |
| 191 | - )); |
|
| 191 | + )); |
|
| 192 | 192 | } |
| 193 | 193 | $buttons[] = wysiwyg_yui_button_setting($editor, $plugin, $button, $extra); |
| 194 | - } |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | // Group buttons in a dummy group. |
| 197 | 197 | $buttons = array('group' => 'default', 'label' => '', 'buttons' => $buttons); |
| 198 | 198 | $settings['toolbar']['buttons'] = array($buttons); |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - if (isset($config['css_setting'])) { |
|
| 201 | + if (isset($config['css_setting'])) { |
|
| 202 | 202 | if ($config['css_setting'] == 'theme') { |
| 203 | - $settings['extracss'] = wysiwyg_get_css(); |
|
| 203 | + $settings['extracss'] = wysiwyg_get_css(); |
|
| 204 | 204 | } |
| 205 | 205 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 206 | - $settings['extracss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 207 | - $settings['extracss'] = explode(',', $settings['extracss']); |
|
| 206 | + $settings['extracss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 207 | + $settings['extracss'] = explode(',', $settings['extracss']); |
|
| 208 | 208 | } |
| 209 | 209 | // YUI only supports inline CSS, so we need to use @import directives. |
| 210 | 210 | // Syntax: '@import "/base/path/to/theme/style.css"; ' |
| 211 | 211 | if (!empty($settings['extracss'])) { |
| 212 | - $settings['extracss'] = '@import "' . implode('"; @import "', $settings['extracss']) . '";'; |
|
| 212 | + $settings['extracss'] = '@import "' . implode('"; @import "', $settings['extracss']) . '";'; |
|
| 213 | + } |
|
| 213 | 214 | } |
| 214 | - } |
|
| 215 | 215 | |
| 216 | - return $settings; |
|
| 216 | + return $settings; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -230,52 +230,52 @@ discard block |
||
| 230 | 230 | * resulting button. |
| 231 | 231 | */ |
| 232 | 232 | function wysiwyg_yui_button_setting($editor, $plugin, $button, $extra = array()) { |
| 233 | - static $plugins; |
|
| 233 | + static $plugins; |
|
| 234 | 234 | |
| 235 | - if (!isset($plugins)) { |
|
| 235 | + if (!isset($plugins)) { |
|
| 236 | 236 | // @todo Invoke all enabled plugins, not just internals. |
| 237 | 237 | $plugins = wysiwyg_yui_plugins($editor); |
| 238 | - } |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - // Return a simple separator. |
|
| 241 | - if ($button === 'separator') { |
|
| 240 | + // Return a simple separator. |
|
| 241 | + if ($button === 'separator') { |
|
| 242 | 242 | return array('type' => 'separator'); |
| 243 | - } |
|
| 244 | - // Setup defaults. |
|
| 245 | - $type = 'push'; |
|
| 246 | - $label = $plugins[$plugin]['buttons'][$button]; |
|
| 243 | + } |
|
| 244 | + // Setup defaults. |
|
| 245 | + $type = 'push'; |
|
| 246 | + $label = $plugins[$plugin]['buttons'][$button]; |
|
| 247 | 247 | |
| 248 | - // Special handling for certain buttons. |
|
| 249 | - if (in_array($button, array('heading', 'fontname'))) { |
|
| 248 | + // Special handling for certain buttons. |
|
| 249 | + if (in_array($button, array('heading', 'fontname'))) { |
|
| 250 | 250 | $type = 'select'; |
| 251 | 251 | $label = $extra['menu'][0]['text']; |
| 252 | - } |
|
| 253 | - elseif (in_array($button, array('fontsize'))) { |
|
| 252 | + } |
|
| 253 | + elseif (in_array($button, array('fontsize'))) { |
|
| 254 | 254 | $type = 'spin'; |
| 255 | - } |
|
| 256 | - elseif (in_array($button, array('forecolor', 'backcolor'))) { |
|
| 255 | + } |
|
| 256 | + elseif (in_array($button, array('forecolor', 'backcolor'))) { |
|
| 257 | 257 | $type = 'color'; |
| 258 | - } |
|
| 258 | + } |
|
| 259 | 259 | |
| 260 | - $button = array( |
|
| 260 | + $button = array( |
|
| 261 | 261 | 'type' => $type, |
| 262 | 262 | 'label' => $label, |
| 263 | 263 | 'value' => $button, |
| 264 | - ); |
|
| 265 | - // Add arbitrary other elements, if defined. |
|
| 266 | - if (!empty($extra)) { |
|
| 264 | + ); |
|
| 265 | + // Add arbitrary other elements, if defined. |
|
| 266 | + if (!empty($extra)) { |
|
| 267 | 267 | $button = array_merge($button, $extra); |
| 268 | - } |
|
| 269 | - return $button; |
|
| 268 | + } |
|
| 269 | + return $button; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 274 | 274 | */ |
| 275 | 275 | function wysiwyg_yui_plugins($editor) { |
| 276 | - return array( |
|
| 276 | + return array( |
|
| 277 | 277 | 'default' => array( |
| 278 | - 'buttons' => array( |
|
| 278 | + 'buttons' => array( |
|
| 279 | 279 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 280 | 280 | 'strikethrough' => t('Strike-through'), |
| 281 | 281 | 'justifyleft' => t('Align left'), 'justifycenter' => t('Align center'), 'justifyright' => t('Align right'), 'justifyfull' => t('Justify'), |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | 'hiddenelements' => t('Show/hide hidden elements'), |
| 290 | 290 | 'removeformat' => t('Remove format'), |
| 291 | 291 | 'heading' => t('HTML block format'), 'fontname' => t('Font'), 'fontsize' => t('Font size'), |
| 292 | - ), |
|
| 293 | - 'internal' => TRUE, |
|
| 292 | + ), |
|
| 293 | + 'internal' => TRUE, |
|
| 294 | 294 | ), |
| 295 | - ); |
|
| 295 | + ); |
|
| 296 | 296 | } |
| 297 | 297 | |
@@ -9,29 +9,29 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_openwysiwyg_editor() { |
| 12 | - $editor['openwysiwyg'] = array( |
|
| 12 | + $editor['openwysiwyg'] = array( |
|
| 13 | 13 | 'title' => 'openWYSIWYG', |
| 14 | 14 | 'vendor url' => 'http://www.openwebware.com', |
| 15 | 15 | 'download url' => 'http://www.openwebware.com/download.shtml', |
| 16 | 16 | 'library path' => wysiwyg_get_path('openwysiwyg') . '/scripts', |
| 17 | 17 | 'libraries' => array( |
| 18 | - 'src' => array( |
|
| 18 | + 'src' => array( |
|
| 19 | 19 | 'title' => 'Source', |
| 20 | 20 | 'files' => array('wysiwyg.js'), |
| 21 | - ), |
|
| 21 | + ), |
|
| 22 | 22 | ), |
| 23 | 23 | 'version callback' => 'wysiwyg_openwysiwyg_version', |
| 24 | 24 | 'themes callback' => 'wysiwyg_openwysiwyg_themes', |
| 25 | 25 | 'settings callback' => 'wysiwyg_openwysiwyg_settings', |
| 26 | 26 | 'plugin callback' => 'wysiwyg_openwysiwyg_plugins', |
| 27 | 27 | 'versions' => array( |
| 28 | - '1.4.7' => array( |
|
| 28 | + '1.4.7' => array( |
|
| 29 | 29 | 'js files' => array('openwysiwyg.js'), |
| 30 | 30 | 'css files' => array('openwysiwyg.css'), |
| 31 | - ), |
|
| 31 | + ), |
|
| 32 | 32 | ), |
| 33 | - ); |
|
| 34 | - return $editor; |
|
| 33 | + ); |
|
| 34 | + return $editor; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | * The installed editor version. |
| 45 | 45 | */ |
| 46 | 46 | function wysiwyg_openwysiwyg_version($editor) { |
| 47 | - // 'library path' has '/scripts' appended already. |
|
| 48 | - $changelog = $editor['editor path'] . '/changelog'; |
|
| 49 | - if (!file_exists($changelog)) { |
|
| 47 | + // 'library path' has '/scripts' appended already. |
|
| 48 | + $changelog = $editor['editor path'] . '/changelog'; |
|
| 49 | + if (!file_exists($changelog)) { |
|
| 50 | 50 | return; |
| 51 | - } |
|
| 52 | - $changelog = fopen($changelog, 'r'); |
|
| 53 | - $line = fgets($changelog, 20); |
|
| 54 | - if (preg_match('@v([\d\.]+)@', $line, $version)) { |
|
| 51 | + } |
|
| 52 | + $changelog = fopen($changelog, 'r'); |
|
| 53 | + $line = fgets($changelog, 20); |
|
| 54 | + if (preg_match('@v([\d\.]+)@', $line, $version)) { |
|
| 55 | 55 | fclose($changelog); |
| 56 | 56 | return $version[1]; |
| 57 | - } |
|
| 58 | - fclose($changelog); |
|
| 57 | + } |
|
| 58 | + fclose($changelog); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * theme name. |
| 72 | 72 | */ |
| 73 | 73 | function wysiwyg_openwysiwyg_themes($editor, $profile) { |
| 74 | - return array('default'); |
|
| 74 | + return array('default'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -89,58 +89,58 @@ discard block |
||
| 89 | 89 | * Drupal.settings.wysiwyg.configs.{editor} |
| 90 | 90 | */ |
| 91 | 91 | function wysiwyg_openwysiwyg_settings($editor, $config, $theme) { |
| 92 | - $settings = array( |
|
| 92 | + $settings = array( |
|
| 93 | 93 | 'path' => base_path() . $editor['editor path'] . '/', |
| 94 | 94 | 'Width' => '100%', |
| 95 | - ); |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - if (isset($config['path_loc']) && $config['path_loc'] == 'none') { |
|
| 97 | + if (isset($config['path_loc']) && $config['path_loc'] == 'none') { |
|
| 98 | 98 | $settings['StatusBarEnabled'] = FALSE; |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - if (isset($config['css_setting'])) { |
|
| 101 | + if (isset($config['css_setting'])) { |
|
| 102 | 102 | if ($config['css_setting'] == 'theme') { |
| 103 | - $settings['CSSFile'] = reset(wysiwyg_get_css()); |
|
| 103 | + $settings['CSSFile'] = reset(wysiwyg_get_css()); |
|
| 104 | 104 | } |
| 105 | 105 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 106 | - $settings['CSSFile'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 106 | + $settings['CSSFile'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 107 | + } |
|
| 107 | 108 | } |
| 108 | - } |
|
| 109 | 109 | |
| 110 | - $settings['Toolbar'] = array(); |
|
| 111 | - if (!empty($config['buttons'])) { |
|
| 110 | + $settings['Toolbar'] = array(); |
|
| 111 | + if (!empty($config['buttons'])) { |
|
| 112 | 112 | $plugins = wysiwyg_get_plugins($editor['name']); |
| 113 | 113 | foreach ($config['buttons'] as $plugin => $buttons) { |
| 114 | - foreach ($buttons as $button => $enabled) { |
|
| 114 | + foreach ($buttons as $button => $enabled) { |
|
| 115 | 115 | foreach (array('buttons', 'extensions') as $type) { |
| 116 | - // Skip unavailable plugins. |
|
| 117 | - if (!isset($plugins[$plugin][$type][$button])) { |
|
| 116 | + // Skip unavailable plugins. |
|
| 117 | + if (!isset($plugins[$plugin][$type][$button])) { |
|
| 118 | 118 | continue; |
| 119 | - } |
|
| 120 | - // Add buttons. |
|
| 121 | - if ($type == 'buttons') { |
|
| 119 | + } |
|
| 120 | + // Add buttons. |
|
| 121 | + if ($type == 'buttons') { |
|
| 122 | 122 | $settings['Toolbar'][0][] = $button; |
| 123 | - } |
|
| 123 | + } |
|
| 124 | + } |
|
| 124 | 125 | } |
| 125 | - } |
|
| 126 | 126 | } |
| 127 | - } |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - // @todo |
|
| 129 | + // @todo |
|
| 130 | 130 | // if (isset($config['block_formats'])) { |
| 131 | 131 | // $settings['DropDowns']['headings']['elements'] = explode(',', $config['block_formats']); |
| 132 | 132 | // } |
| 133 | 133 | |
| 134 | - return $settings; |
|
| 134 | + return $settings; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 139 | 139 | */ |
| 140 | 140 | function wysiwyg_openwysiwyg_plugins($editor) { |
| 141 | - $plugins = array( |
|
| 141 | + $plugins = array( |
|
| 142 | 142 | 'default' => array( |
| 143 | - 'buttons' => array( |
|
| 143 | + 'buttons' => array( |
|
| 144 | 144 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 145 | 145 | 'strikethrough' => t('Strike-through'), |
| 146 | 146 | 'justifyleft' => t('Align left'), 'justifycenter' => t('Align center'), 'justifyright' => t('Align right'), 'justifyfull' => t('Justify'), |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | 'print' => t('Print'), |
| 165 | 165 | 'inserttable' => t('Table'), |
| 166 | 166 | 'help' => t('Help'), |
| 167 | - ), |
|
| 168 | - 'internal' => TRUE, |
|
| 167 | + ), |
|
| 168 | + 'internal' => TRUE, |
|
| 169 | 169 | ), |
| 170 | - ); |
|
| 171 | - return $plugins; |
|
| 170 | + ); |
|
| 171 | + return $plugins; |
|
| 172 | 172 | } |
| 173 | 173 | |
@@ -9,32 +9,32 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_whizzywig_editor() { |
| 12 | - $editor['whizzywig'] = array( |
|
| 12 | + $editor['whizzywig'] = array( |
|
| 13 | 13 | 'title' => 'Whizzywig', |
| 14 | 14 | 'vendor url' => 'http://www.unverse.net', |
| 15 | 15 | 'download url' => 'http://www.unverse.net/whizzywig-download.html', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Default', |
| 19 | 19 | 'files' => array('whizzywig.js', 'xhtml.js'), |
| 20 | - ), |
|
| 20 | + ), |
|
| 21 | 21 | ), |
| 22 | 22 | 'version callback' => 'wysiwyg_whizzywig_version', |
| 23 | 23 | 'settings callback' => 'wysiwyg_whizzywig_settings', |
| 24 | 24 | 'plugin callback' => 'wysiwyg_whizzywig_plugins', |
| 25 | 25 | 'versions' => array( |
| 26 | - '55' => array( |
|
| 26 | + '55' => array( |
|
| 27 | 27 | 'js files' => array('whizzywig.js'), |
| 28 | - ), |
|
| 29 | - '56' => array( |
|
| 28 | + ), |
|
| 29 | + '56' => array( |
|
| 30 | 30 | 'js files' => array('whizzywig-56.js'), |
| 31 | - ), |
|
| 32 | - '60' => array( |
|
| 31 | + ), |
|
| 32 | + '60' => array( |
|
| 33 | 33 | 'js files' => array('whizzywig-60.js'), |
| 34 | - ), |
|
| 34 | + ), |
|
| 35 | 35 | ), |
| 36 | - ); |
|
| 37 | - return $editor; |
|
| 36 | + ); |
|
| 37 | + return $editor; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -47,19 +47,19 @@ discard block |
||
| 47 | 47 | * The installed editor version. |
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_whizzywig_version($editor) { |
| 50 | - $script = $editor['library path'] . '/whizzywig.js'; |
|
| 51 | - if (!file_exists($script)) { |
|
| 50 | + $script = $editor['library path'] . '/whizzywig.js'; |
|
| 51 | + if (!file_exists($script)) { |
|
| 52 | 52 | return; |
| 53 | - } |
|
| 54 | - $script = fopen($script, 'r'); |
|
| 55 | - $line = fgets($script, 43); |
|
| 56 | - // 55: Whizzywig v55i |
|
| 57 | - // 60: Whizzywig 60 |
|
| 58 | - if (preg_match('@Whizzywig v?([0-9]+)@', $line, $version)) { |
|
| 53 | + } |
|
| 54 | + $script = fopen($script, 'r'); |
|
| 55 | + $line = fgets($script, 43); |
|
| 56 | + // 55: Whizzywig v55i |
|
| 57 | + // 60: Whizzywig 60 |
|
| 58 | + if (preg_match('@Whizzywig v?([0-9]+)@', $line, $version)) { |
|
| 59 | 59 | fclose($script); |
| 60 | 60 | return $version[1]; |
| 61 | - } |
|
| 62 | - fclose($script); |
|
| 61 | + } |
|
| 62 | + fclose($script); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -77,53 +77,53 @@ discard block |
||
| 77 | 77 | * Drupal.settings.wysiwyg.configs.{editor} |
| 78 | 78 | */ |
| 79 | 79 | function wysiwyg_whizzywig_settings($editor, $config, $theme) { |
| 80 | - $settings = array(); |
|
| 80 | + $settings = array(); |
|
| 81 | 81 | |
| 82 | - // Add path to button images, if available. |
|
| 83 | - if (is_dir($editor['library path'] . '/btn')) { |
|
| 82 | + // Add path to button images, if available. |
|
| 83 | + if (is_dir($editor['library path'] . '/btn')) { |
|
| 84 | 84 | $settings['buttonPath'] = base_path() . $editor['library path'] . '/btn/'; |
| 85 | - } |
|
| 86 | - if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) { |
|
| 85 | + } |
|
| 86 | + if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) { |
|
| 87 | 87 | $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/WhizzywigToolbar.png'; |
| 88 | - } |
|
| 89 | - // Filename changed in version 60. |
|
| 90 | - elseif (file_exists($editor['library path'] . '/icons.png')) { |
|
| 88 | + } |
|
| 89 | + // Filename changed in version 60. |
|
| 90 | + elseif (file_exists($editor['library path'] . '/icons.png')) { |
|
| 91 | 91 | $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/icons.png'; |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - // Add configured buttons or all available. |
|
| 95 | - $settings['buttons'] = array(); |
|
| 96 | - if (!empty($config['buttons'])) { |
|
| 94 | + // Add configured buttons or all available. |
|
| 95 | + $settings['buttons'] = array(); |
|
| 96 | + if (!empty($config['buttons'])) { |
|
| 97 | 97 | $buttons = array(); |
| 98 | 98 | foreach ($config['buttons'] as $plugin) { |
| 99 | - $buttons = array_merge($buttons, $plugin); |
|
| 99 | + $buttons = array_merge($buttons, $plugin); |
|
| 100 | 100 | } |
| 101 | 101 | $settings['buttons'] = implode(' ', array_keys($buttons)); |
| 102 | - } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - // Add editor content stylesheet. |
|
| 105 | - if (isset($config['css_setting'])) { |
|
| 104 | + // Add editor content stylesheet. |
|
| 105 | + if (isset($config['css_setting'])) { |
|
| 106 | 106 | if ($config['css_setting'] == 'theme') { |
| 107 | - $css = path_to_theme() . '/style.css'; |
|
| 108 | - if (file_exists($css)) { |
|
| 107 | + $css = path_to_theme() . '/style.css'; |
|
| 108 | + if (file_exists($css)) { |
|
| 109 | 109 | $settings['externalCSS'] = base_path() . $css; |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | } |
| 112 | 112 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 113 | - $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 113 | + $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 114 | + } |
|
| 114 | 115 | } |
| 115 | - } |
|
| 116 | 116 | |
| 117 | - return $settings; |
|
| 117 | + return $settings; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 122 | 122 | */ |
| 123 | 123 | function wysiwyg_whizzywig_plugins($editor) { |
| 124 | - return array( |
|
| 124 | + return array( |
|
| 125 | 125 | 'default' => array( |
| 126 | - 'buttons' => array( |
|
| 126 | + 'buttons' => array( |
|
| 127 | 127 | 'formatblock' => t('HTML block format'), 'fontname' => t('Font'), 'fontsize' => t('Font size'), |
| 128 | 128 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 129 | 129 | 'left' => t('Align left'), 'center' => t('Align center'), 'right' => t('Align right'), |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | 'clean' => t('Clean-up'), |
| 140 | 140 | 'html' => t('Source code'), |
| 141 | 141 | 'spellcheck' => t('Spell check'), |
| 142 | - ), |
|
| 143 | - 'internal' => TRUE, |
|
| 142 | + ), |
|
| 143 | + 'internal' => TRUE, |
|
| 144 | 144 | ), |
| 145 | - ); |
|
| 145 | + ); |
|
| 146 | 146 | } |
| 147 | 147 | |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_nicedit_editor() { |
| 12 | - $editor['nicedit'] = array( |
|
| 12 | + $editor['nicedit'] = array( |
|
| 13 | 13 | 'title' => 'NicEdit', |
| 14 | 14 | 'vendor url' => 'http://nicedit.com', |
| 15 | 15 | 'download url' => 'http://nicedit.com/download.php', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Source', |
| 19 | 19 | 'files' => array('nicEdit.js'), |
| 20 | - ), |
|
| 20 | + ), |
|
| 21 | 21 | ), |
| 22 | 22 | 'version callback' => 'wysiwyg_nicedit_version', |
| 23 | 23 | 'settings callback' => 'wysiwyg_nicedit_settings', |
| 24 | 24 | 'plugin callback' => 'wysiwyg_nicedit_plugins', |
| 25 | 25 | 'versions' => array( |
| 26 | - '0.9' => array( |
|
| 26 | + '0.9' => array( |
|
| 27 | 27 | 'js files' => array('nicedit.js'), |
| 28 | - ), |
|
| 28 | + ), |
|
| 29 | 29 | ), |
| 30 | - ); |
|
| 31 | - return $editor; |
|
| 30 | + ); |
|
| 31 | + return $editor; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * The installed editor version. |
| 42 | 42 | */ |
| 43 | 43 | function wysiwyg_nicedit_version($editor) { |
| 44 | - // @see http://nicedit.com/forums/viewtopic.php?t=425 |
|
| 45 | - return '0.9'; |
|
| 44 | + // @see http://nicedit.com/forums/viewtopic.php?t=425 |
|
| 45 | + return '0.9'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * Drupal.settings.wysiwyg.configs.{editor} |
| 61 | 61 | */ |
| 62 | 62 | function wysiwyg_nicedit_settings($editor, $config, $theme) { |
| 63 | - $settings = array( |
|
| 63 | + $settings = array( |
|
| 64 | 64 | 'iconsPath' => base_path() . $editor['library path'] . '/nicEditorIcons.gif', |
| 65 | - ); |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | - // Add configured buttons or all available. |
|
| 68 | - $settings['buttonList'] = array(); |
|
| 69 | - if (!empty($config['buttons'])) { |
|
| 67 | + // Add configured buttons or all available. |
|
| 68 | + $settings['buttonList'] = array(); |
|
| 69 | + if (!empty($config['buttons'])) { |
|
| 70 | 70 | $buttons = array(); |
| 71 | 71 | foreach ($config['buttons'] as $plugin) { |
| 72 | - $buttons = array_merge($buttons, $plugin); |
|
| 72 | + $buttons = array_merge($buttons, $plugin); |
|
| 73 | 73 | } |
| 74 | 74 | $settings['buttonList'] = array_keys($buttons); |
| 75 | - } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - // Add editor content stylesheet. |
|
| 78 | - if (isset($config['css_setting'])) { |
|
| 77 | + // Add editor content stylesheet. |
|
| 78 | + if (isset($config['css_setting'])) { |
|
| 79 | 79 | if ($config['css_setting'] == 'theme') { |
| 80 | - $css = path_to_theme() . '/style.css'; |
|
| 81 | - if (file_exists($css)) { |
|
| 80 | + $css = path_to_theme() . '/style.css'; |
|
| 81 | + if (file_exists($css)) { |
|
| 82 | 82 | $settings['externalCSS'] = base_path() . $css; |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 86 | - $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 86 | + $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 87 | + } |
|
| 87 | 88 | } |
| 88 | - } |
|
| 89 | 89 | |
| 90 | - return $settings; |
|
| 90 | + return $settings; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 95 | 95 | */ |
| 96 | 96 | function wysiwyg_nicedit_plugins($editor) { |
| 97 | - return array( |
|
| 97 | + return array( |
|
| 98 | 98 | 'default' => array( |
| 99 | - 'buttons' => array( |
|
| 99 | + 'buttons' => array( |
|
| 100 | 100 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 101 | 101 | 'strikethrough' => t('Strike-through'), |
| 102 | 102 | 'left' => t('Align left'), 'center' => t('Align center'), 'right' => t('Align right'), |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | 'link' => t('Link'), 'unlink' => t('Unlink'), |
| 112 | 112 | 'fontFormat' => t('HTML block format'), 'fontFamily' => t('Font'), 'fontSize' => t('Font size'), |
| 113 | 113 | 'xhtml' => t('Source code'), |
| 114 | - ), |
|
| 115 | - 'internal' => TRUE, |
|
| 114 | + ), |
|
| 115 | + 'internal' => TRUE, |
|
| 116 | 116 | ), |
| 117 | - ); |
|
| 117 | + ); |
|
| 118 | 118 | } |
| 119 | 119 | |