summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsun2009-06-09 00:18:12 (GMT)
committer sun2009-06-09 00:18:12 (GMT)
commit54a65ca8851e015869b9c0fcab99d09864f5b55f (patch)
tree2236672ec4068af56a4b2f94b9793ef3e0124d47
parent21c81d60ad7ed4c4cd70d46093e92af446d17e9e (diff)
by sun: Major code clean-up.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--editors/fckeditor.inc47
-rw-r--r--editors/jwysiwyg.inc6
-rw-r--r--editors/markitup.inc40
-rw-r--r--editors/nicedit.inc10
-rw-r--r--editors/openwysiwyg.inc44
-rw-r--r--editors/tinymce.inc228
-rw-r--r--editors/whizzywig.inc10
-rw-r--r--editors/wymeditor.inc37
-rw-r--r--editors/yui.inc43
-rw-r--r--plugins/break.inc4
-rw-r--r--wysiwyg.admin.inc8
-rw-r--r--wysiwyg.api.php13
-rw-r--r--wysiwyg.module14
14 files changed, 257 insertions, 248 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index d4b5fb2..7c6264f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-2.x, xxxx-xx-xx
---------------------------
+by sun: Major code clean-up.
#331089 by wwalc: Fixed FCKeditor toolbar buttons do not wrap.
#407014 by sun: Fixed/removed migration from other editor integration modules.
#485264 by sun: Changed installation instructions to be more concise.
diff --git a/editors/fckeditor.inc b/editors/fckeditor.inc
index 28cd6b7..56649ff 100644
--- a/editors/fckeditor.inc
+++ b/editors/fckeditor.inc
@@ -6,12 +6,10 @@
* Editor integration functions for FCKeditor.
*/
-
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_fckeditor_editor() {
- $editor = array();
$editor['fckeditor'] = array(
'title' => 'FCKeditor',
'vendor url' => 'http://www.fckeditor.net',
@@ -35,7 +33,7 @@ function wysiwyg_fckeditor_editor() {
),
'proxy plugin settings callback' => 'wysiwyg_fckeditor_proxy_plugin_settings',
'versions' => array(
- 2.6 => array(
+ '2.6' => array(
'js files' => array('fckeditor-2.6.js'),
),
),
@@ -67,6 +65,22 @@ function wysiwyg_fckeditor_version($editor) {
}
/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_fckeditor_themes($editor, $profile) {
+ return array('default', 'office2003', 'silver');
+}
+
+/**
* Return runtime editor settings for a given wysiwyg profile.
*
* @param $editor
@@ -82,8 +96,8 @@ function wysiwyg_fckeditor_version($editor) {
*/
function wysiwyg_fckeditor_settings($editor, $config, $theme) {
$settings = array(
- 'EditorPath' => base_path() . $editor['library path'] .'/',
- 'SkinPath' => base_path() . $editor['library path'] .'/editor/skins/'. $theme .'/',
+ 'EditorPath' => base_path() . $editor['library path'] . '/',
+ 'SkinPath' => base_path() . $editor['library path'] . '/editor/skins/' . $theme . '/',
'CustomConfigurationsPath' => base_path() . drupal_get_path('module', 'wysiwyg') . '/editors/js/fckeditor.config.js',
'Width' => '100%',
'Height' => 420,
@@ -155,22 +169,6 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) {
}
/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_fckeditor_themes($editor, $profile) {
- return array('default', 'office2003', 'silver');
-}
-
-/**
* Build a JS settings array of native external plugins that need to be loaded separately.
*/
function wysiwyg_fckeditor_plugin_settings($editor, $profile, $plugins) {
@@ -200,17 +198,17 @@ function wysiwyg_fckeditor_proxy_plugin_settings($editor, $profile, $plugins) {
// Populate required plugin settings.
$settings[$name] = $plugin['dialog settings'] + array(
'title' => $plugin['title'],
- 'icon' => base_path() . $plugin['icon path'] .'/'. $plugin['icon file'],
+ 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'],
'iconTitle' => $plugin['icon title'],
// @todo These should only be set if the plugin defined them.
- 'css' => base_path() . $plugin['css path'] .'/'. $plugin['css file'],
+ 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'],
);
}
return $settings;
}
/**
- * Return internal plugins for FCKeditor; semi-implementation of hook_wysiwyg_plugin().
+ * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_fckeditor_plugins($editor) {
$plugins = array(
@@ -234,7 +232,6 @@ function wysiwyg_fckeditor_plugins($editor) {
'RemoveFormat' => t('Remove format'),
'SpecialChar' => t('Character map'),
'About' => t('About'),
-
'FontFormat' => t('HTML block format'), 'FontName' => t('Font'), 'FontSize' => t('Font size'), 'Style' => t('Font style'),
'Table' => t('Table'),
'Find' => t('Search'), 'Replace' => t('Replace'), 'SelectAll' => t('Select all'),
diff --git a/editors/jwysiwyg.inc b/editors/jwysiwyg.inc
index 58a14a6..3c810e5 100644
--- a/editors/jwysiwyg.inc
+++ b/editors/jwysiwyg.inc
@@ -1,12 +1,15 @@
<?php
// $Id$
+/**
+ * @file
+ * Editor integration functions for jWYSIWYG.
+ */
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_jwysiwyg_editor() {
- $editor = array();
$editor['jwysiwyg'] = array(
'title' => 'jWYSIWYG',
'vendor url' => 'http://code.google.com/p/jwysiwyg/',
@@ -52,5 +55,6 @@ function wysiwyg_jwysiwyg_version($editor) {
fclose($script);
return $version[1];
}
+ fclose($script);
}
diff --git a/editors/markitup.inc b/editors/markitup.inc
index 48d73f1..218dc6a 100644
--- a/editors/markitup.inc
+++ b/editors/markitup.inc
@@ -6,12 +6,10 @@
* Editor integration functions for markItUp.
*/
-
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_markitup_editor() {
- $editor = array();
$editor['markitup'] = array(
'title' => 'markItUp',
'vendor url' => 'http://markitup.jaysalvat.com',
@@ -28,8 +26,8 @@ function wysiwyg_markitup_editor() {
),
),
'version callback' => 'wysiwyg_markitup_version',
- 'settings callback' => 'wysiwyg_markitup_settings',
'themes callback' => 'wysiwyg_markitup_themes',
+ 'settings callback' => 'wysiwyg_markitup_settings',
'plugin callback' => 'wysiwyg_markitup_plugins',
'versions' => array(
'1.1.5' => array(
@@ -61,6 +59,22 @@ function wysiwyg_markitup_version($editor) {
}
/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_markitup_themes($editor, $profile) {
+ return array('simple', 'markitup');
+}
+
+/**
* Return runtime editor settings for a given wysiwyg profile.
*
* @param $editor
@@ -78,7 +92,7 @@ function wysiwyg_markitup_settings($editor, $config, $theme) {
// Whoever is guilty for adding this horrible CSS-file-without-filepath
// override "feature" to Drupal core... stand in the corner!
drupal_add_css($editor['library path'] . '/skins/' . $theme . '/style.css', 'theme');
-
+
$settings = array(
'root' => base_path() . $editor['library path'] . '/',
'nameSpace' => $theme,
@@ -130,7 +144,7 @@ function wysiwyg_markitup_settings($editor, $config, $theme) {
'call' => 'preview',
),
);
-
+
if (!empty($config['buttons'])) {
foreach ($config['buttons'] as $plugin) {
foreach ($plugin as $button => $enabled) {
@@ -148,22 +162,6 @@ function wysiwyg_markitup_settings($editor, $config, $theme) {
}
/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_markitup_themes($editor, $profile) {
- return array('simple', 'markitup');
-}
-
-/**
* Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_markitup_plugins($editor) {
diff --git a/editors/nicedit.inc b/editors/nicedit.inc
index dd23f95..a03d987 100644
--- a/editors/nicedit.inc
+++ b/editors/nicedit.inc
@@ -1,12 +1,15 @@
<?php
// $Id$
+/**
+ * @file
+ * Editor integration functions for NicEdit.
+ */
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_nicedit_editor() {
- $editor = array();
$editor['nicedit'] = array(
'title' => 'NicEdit',
'vendor url' => 'http://nicedit.com',
@@ -77,7 +80,7 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) {
// Add editor content stylesheet.
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
- $css = path_to_theme() .'/style.css';
+ $css = path_to_theme() . '/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
}
@@ -91,12 +94,11 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) {
}
/**
- * Return internal plugins for nicEdit; semi-implementation of hook_wysiwyg_plugin().
+ * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_nicedit_plugins($editor) {
return array(
'default' => array(
- #'path' => $editor['library path'] .'/themes/advanced',
'buttons' => array(
'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'),
'strikethrough' => t('Strike-through'),
diff --git a/editors/openwysiwyg.inc b/editors/openwysiwyg.inc
index 90cd395..fcaa682 100644
--- a/editors/openwysiwyg.inc
+++ b/editors/openwysiwyg.inc
@@ -2,10 +2,14 @@
// $Id$
/**
+ * @file
+ * Editor integration functions for openWYSIWYG.
+ */
+
+/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_openwysiwyg_editor() {
- $editor = array();
$editor['openwysiwyg'] = array(
'title' => 'openWYSIWYG',
'vendor url' => 'http://www.openwebware.com',
@@ -21,7 +25,6 @@ function wysiwyg_openwysiwyg_editor() {
'themes callback' => 'wysiwyg_openwysiwyg_themes',
'settings callback' => 'wysiwyg_openwysiwyg_settings',
'plugin callback' => 'wysiwyg_openwysiwyg_plugins',
- 'plugin settings callback' => 'wysiwyg_openwysiwyg_plugin_settings',
'versions' => array(
'1.4.7' => array(
'js files' => array('openwysiwyg.js'),
@@ -42,7 +45,7 @@ function wysiwyg_openwysiwyg_editor() {
* The installed editor version.
*/
function wysiwyg_openwysiwyg_version($editor) {
- $changelog = $editor['editor path'] .'/changelog';
+ $changelog = $editor['editor path'] . '/changelog';
$changelog = fopen($changelog, 'r');
$line = fgets($changelog, 20);
if (preg_match('@v([\d\.]+)@', $line, $version)) {
@@ -53,6 +56,22 @@ function wysiwyg_openwysiwyg_version($editor) {
}
/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_openwysiwyg_themes($editor, $profile) {
+ return array('default');
+}
+
+/**
* Return runtime editor settings for a given wysiwyg profile.
*
* @param $editor
@@ -113,22 +132,6 @@ function wysiwyg_openwysiwyg_settings($editor, $config, $theme) {
}
/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_openwysiwyg_themes($editor, $profile) {
- return array('default');
-}
-
-/**
* Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_openwysiwyg_plugins($editor) {
@@ -152,12 +155,13 @@ function wysiwyg_openwysiwyg_plugins($editor) {
'visualaid' => t('Visual aid'),
'removeformat' => t('Remove format'),
'charmap' => t('Character map'),
- 'help' => t('Help')),
'headings' => t('HTML block format'), 'font' => t('Font'), 'fontsize' => t('Font size'),
'maximize' => t('Fullscreen'),
'preview' => t('Preview'),
'print' => t('Print'),
'inserttable' => t('Table'),
+ 'help' => t('Help'),
+ ),
'internal' => TRUE,
),
);
diff --git a/editors/tinymce.inc b/editors/tinymce.inc
index ae1235d..36ebc52 100644
--- a/editors/tinymce.inc
+++ b/editors/tinymce.inc
@@ -1,25 +1,24 @@
<?php
// $Id$
+/**
+ * @file
+ * Editor integration functions for TinyMCE.
+ */
/**
* Plugin implementation of hook_editor().
*
- * - Function signature and returned editor name nust match include filename.
- * - Returns an array of supported editor versions along with support files.
- *
* @todo wysiwyg_<editor>_alter() to add/inject optional libraries like gzip.
*/
function wysiwyg_tinymce_editor() {
- $editor = array();
$editor['tinymce'] = array(
- // Required properties
'title' => 'TinyMCE',
'vendor url' => 'http://tinymce.moxiecode.com',
'download url' => 'http://tinymce.moxiecode.com/download.php',
'library path' => wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce',
- 'libraries' => array( // We cannot assume that all editors need just one js library.
- '' => array( // Key may be used in wysiwyg_tinymce_settings() for exec mode.
+ 'libraries' => array(
+ '' => array(
'title' => 'Minified',
'files' => array('tiny_mce.js'),
),
@@ -40,18 +39,15 @@ function wysiwyg_tinymce_editor() {
),
),
'proxy plugin settings callback' => 'wysiwyg_tinymce_proxy_plugin_settings',
- 'versions' => array( // Each version can override global editor properties.
+ 'versions' => array(
'2.1' => array(
- // 'include files' => array('tinymce-2.inc'),
'js files' => array('tinymce-2.js'),
'css files' => array('tinymce-2.css'),
'download url' => 'http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430&release_id=557383',
),
'3.1' => array(
- // 'include files' => array('tinymce-3.inc'),
'js files' => array('tinymce-3.js'),
'css files' => array('tinymce-3.css'),
- // 'plugin callback' => 'wysiwyg_tinymce_3_plugins',
'libraries' => array(
'' => array(
'title' => 'Minified',
@@ -84,7 +80,7 @@ function wysiwyg_tinymce_editor() {
* The installed editor version.
*/
function wysiwyg_tinymce_version($editor) {
- $script = $editor['library path'] .'/tiny_mce.js';
+ $script = $editor['library path'] . '/tiny_mce.js';
$script = fopen($script, 'r');
// Version is contained in the first 80 chars.
$line = fgets($script, 80);
@@ -92,8 +88,39 @@ function wysiwyg_tinymce_version($editor) {
// 3.x: majorVersion:'3',minorVersion:'2.0.1'
if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) {
fclose($script);
- return $version[1] .'.'. $version[2];
+ return $version[1] . '.' . $version[2];
+ }
+ fclose($script);
+}
+
+/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_tinymce_themes($editor, $profile) {
+ /*
+ $themes = array();
+ $dir = $editor['library path'] . '/themes/';
+ if (is_dir($dir) && $dh = opendir($dir)) {
+ while (($file = readdir($dh)) !== FALSE) {
+ if (!in_array($file, array('.', '..', 'CVS', '.svn')) && is_dir($dir . $file)) {
+ $themes[$file] = $file;
+ }
+ }
+ closedir($dh);
+ asort($themes);
}
+ return $themes;
+ */
+ return array('advanced', 'simple');
}
/**
@@ -111,7 +138,7 @@ function wysiwyg_tinymce_version($editor) {
* Drupal.settings.wysiwyg.configs.{editor}
*/
function wysiwyg_tinymce_settings($editor, $config, $theme) {
- $init = array(
+ $settings = array(
'button_tile_map' => TRUE, // @todo Add a setting for this.
'document_base_url' => base_path(),
'mode' => 'none',
@@ -131,37 +158,37 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) {
'entities' => '160,nbsp,173,shy,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm',
);
if (isset($config['apply_source_formatting'])) {
- $init['apply_source_formatting'] = $config['apply_source_formatting'];
+ $settings['apply_source_formatting'] = $config['apply_source_formatting'];
}
if (isset($config['convert_fonts_to_spans'])) {
- $init['convert_fonts_to_spans'] = $config['convert_fonts_to_spans'];
+ $settings['convert_fonts_to_spans'] = $config['convert_fonts_to_spans'];
}
if (isset($config['language'])) {
- $init['language'] = $config['language'];
+ $settings['language'] = $config['language'];
}
if (isset($config['paste_auto_cleanup_on_paste'])) {
- $init['paste_auto_cleanup_on_paste'] = $config['paste_auto_cleanup_on_paste'];
+ $settings['paste_auto_cleanup_on_paste'] = $config['paste_auto_cleanup_on_paste'];
}
if (isset($config['preformatted'])) {
- $init['preformatted'] = $config['preformatted'];
+ $settings['preformatted'] = $config['preformatted'];
}
if (isset($config['remove_linebreaks'])) {
- $init['remove_linebreaks'] = $config['remove_linebreaks'];
+ $settings['remove_linebreaks'] = $config['remove_linebreaks'];
}
if (isset($config['verify_html'])) {
- $init['verify_html'] = $config['verify_html'];
+ $settings['verify_html'] = $config['verify_html'];
}
if (!empty($config['css_classes'])) {
- $init['theme_advanced_styles'] = implode(';', array_filter(explode("\n", str_replace("\r", '', $config['css_classes']))));
+ $settings['theme_advanced_styles'] = implode(';', array_filter(explode("\n", str_replace("\r", '', $config['css_classes']))));
}
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
- $init['content_css'] = implode(',', wysiwyg_get_css());
+ $settings['content_css'] = implode(',', wysiwyg_get_css());
}
else if ($config['css_setting'] == 'self' && isset($config['css_path'])) {
- $init['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
+ $settings['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
}
@@ -169,17 +196,19 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) {
// Also map the plugin metadata for each button.
// @todo What follows is a pain; needs a rewrite.
if (!empty($config['buttons']) && is_array($config['buttons'])) {
- // $init['buttons'] are stacked into $init['theme_advanced_buttons1'] later.
+ // $settings['buttons'] are stacked into
+ // $settings['theme_advanced_buttons1'] later.
// @todo Add a toolbar designer based on jQuery UI.
- $init['buttons'] = array();
- // Only array keys in $init['extensions'] matter; added to $init['plugins']
- // later.
- $init['extensions'] = array();
- // $init['extended_valid_elements'] are just stacked, unique'd later, and
- // transformed into a comma-separated string in wysiwyg_add_editor_settings().
+ $settings['buttons'] = array();
+ // Only array keys in $settings['extensions'] matter; added to
+ // $settings['plugins'] later.
+ $settings['extensions'] = array();
+ // $settings['extended_valid_elements'] are just stacked, unique'd later,
+ // and transformed into a comma-separated string in
+ // wysiwyg_add_editor_settings().
// @todo Needs a complete plugin API redesign using arrays for
// tag => attributes definitions and array_merge_recursive().
- $init['extended_valid_elements'] = array();
+ $settings['extended_valid_elements'] = array();
$plugins = wysiwyg_get_plugins($editor['name']);
foreach ($config['buttons'] as $plugin => $buttons) {
@@ -192,49 +221,47 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) {
}
// Add buttons.
if ($type == 'buttons') {
- $init['buttons'][] = $button;
+ $settings['buttons'][] = $button;
}
// Add external Drupal plugins to the list of extensions.
if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) {
- $init['extensions'][_wysiwyg_tinymce_plugin_name('add', $button)] = 1;
+ $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $button)] = 1;
}
// Add external plugins to the list of extensions.
else if ($type == 'buttons' && empty($plugins[$plugin]['internal'])) {
- $init['extensions'][_wysiwyg_tinymce_plugin_name('add', $plugin)] = 1;
+ $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $plugin)] = 1;
}
// Add internal buttons that also need to be loaded as extension.
else if ($type == 'buttons' && !empty($plugins[$plugin]['load'])) {
- $init['extensions'][$plugin] = 1;
+ $settings['extensions'][$plugin] = 1;
}
// Add plain extensions.
else if ($type == 'extensions' && !empty($plugins[$plugin]['load'])) {
- $init['extensions'][$plugin] = 1;
+ $settings['extensions'][$plugin] = 1;
}
// Allow plugins to add valid HTML elements.
if (!empty($plugins[$plugin]['extended_valid_elements'])) {
- $init['extended_valid_elements'] = array_merge($init['extended_valid_elements'], $plugins[$plugin]['extended_valid_elements']);
+ $settings['extended_valid_elements'] = array_merge($settings['extended_valid_elements'], $plugins[$plugin]['extended_valid_elements']);
}
// Allow plugins to add or override global configuration settings.
if (!empty($plugins[$plugin]['options'])) {
- $init = array_merge($init, $plugins[$plugin]['options']);
+ $settings = array_merge($settings, $plugins[$plugin]['options']);
}
}
}
}
// Clean-up.
- $init['extended_valid_elements'] = array_unique($init['extended_valid_elements']);
- if ($init['extensions']) {
- $init['plugins'] = array_keys($init['extensions']);
- unset($init['extensions']);
- } else {
- unset($init['extensions']);
+ $settings['extended_valid_elements'] = array_unique($settings['extended_valid_elements']);
+ if ($settings['extensions']) {
+ $settings['plugins'] = array_keys($settings['extensions']);
}
+ unset($settings['extensions']);
}
// Add theme-specific settings.
switch ($theme) {
case 'advanced':
- $init += array(
+ $settings += array(
'theme_advanced_resize_horizontal' => FALSE,
'theme_advanced_resizing_use_cookie' => FALSE,
'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom',
@@ -243,66 +270,36 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) {
'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left',
);
if (isset($config['block_formats'])) {
- $init['theme_advanced_blockformats'] = $config['block_formats'];
+ $settings['theme_advanced_blockformats'] = $config['block_formats'];
}
- if (isset($init['buttons'])) {
+ if (isset($settings['buttons'])) {
// These rows explicitly need to be set to be empty, otherwise TinyMCE
// loads its default buttons of the advanced theme for each row.
- $init += array(
+ $settings += array(
'theme_advanced_buttons1' => array(),
'theme_advanced_buttons2' => array(),
'theme_advanced_buttons3' => array(),
);
// @todo Allow to sort/arrange editor buttons.
- for ($i = 0; $i < count($init['buttons']); $i++) {
- $init['theme_advanced_buttons1'][] = $init['buttons'][$i];
+ for ($i = 0; $i < count($settings['buttons']); $i++) {
+ $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i];
}
}
break;
}
- unset($init['buttons']);
+ unset($settings['buttons']);
// Convert the config values into the form expected by TinyMCE.
- foreach ($init as $key => $value) {
+ foreach ($settings as $key => $value) {
if (is_bool($value)) {
continue;
}
if (is_array($value)) {
- $init[$key] = implode(',', $init[$key]);
+ $settings[$key] = implode(',', $settings[$key]);
}
}
- return $init;
-}
-
-/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_tinymce_themes($editor, $profile) {
- /*
- $themes = array();
- $dir = $editor['library path'] . '/themes/';
- if (is_dir($dir) && $dh = opendir($dir)) {
- while (($file = readdir($dh)) !== FALSE) {
- if (!in_array($file, array('.', '..', 'CVS', '.svn')) && is_dir($dir . $file)) {
- $themes[$file] = $file;
- }
- }
- closedir($dh);
- asort($themes);
- }
- return $themes;
- */
- return array('advanced', 'simple');
+ return $settings;
}
/**
@@ -334,10 +331,10 @@ function wysiwyg_tinymce_proxy_plugin_settings($editor, $profile, $plugins) {
// Populate required plugin settings.
$settings[$name] = $plugin['dialog settings'] + array(
'title' => $plugin['title'],
- 'icon' => base_path() . $plugin['icon path'] .'/'. $plugin['icon file'],
+ 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'],
'iconTitle' => $plugin['icon title'],
// @todo These should only be set if the plugin defined them.
- 'css' => base_path() . $plugin['css path'] .'/'. $plugin['css file'],
+ 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'],
);
}
return $settings;
@@ -348,7 +345,7 @@ function wysiwyg_tinymce_proxy_plugin_settings($editor, $profile, $plugins) {
*
* TinyMCE requires that external plugins, which should not be loaded from
* its own plugin repository are prefixed with a hiven in the name.
- *
+ *
* @param string $op
* Operation to perform, 'add' or 'remove' (hiven).
* @param string $name
@@ -357,7 +354,7 @@ function wysiwyg_tinymce_proxy_plugin_settings($editor, $profile, $plugins) {
function _wysiwyg_tinymce_plugin_name($op, $name) {
if ($op == 'add') {
if (strpos($name, '-') !== 0) {
- return '-'. $name;
+ return '-' . $name;
}
return $name;
}
@@ -375,7 +372,7 @@ function _wysiwyg_tinymce_plugin_name($op, $name) {
function wysiwyg_tinymce_plugins($editor) {
$plugins = array(
'default' => array(
- 'path' => $editor['library path'] .'/themes/advanced',
+ 'path' => $editor['library path'] . '/themes/advanced',
'buttons' => array(
'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'),
'strikethrough' => t('Strike-through'),
@@ -394,11 +391,12 @@ function wysiwyg_tinymce_plugins($editor) {
'visualaid' => t('Visual aid'),
'removeformat' => t('Remove format'),
'charmap' => t('Character map'),
- 'help' => t('Help')),
+ 'help' => t('Help'),
+ ),
'internal' => TRUE,
),
'advhr' => array(
- 'path' => $editor['library path'] .'/plugins/advhr',
+ 'path' => $editor['library path'] . '/plugins/advhr',
'buttons' => array('advhr' => t('Advanced horizontal rule')),
'extended_valid_elements' => array('hr[class|width|size|noshade]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
@@ -406,7 +404,7 @@ function wysiwyg_tinymce_plugins($editor) {
'load' => TRUE,
),
'advimage' => array(
- 'path' => $editor['library path'] .'/plugins/advimage',
+ 'path' => $editor['library path'] . '/plugins/advimage',
'extensions' => array('advimage' => t('Advanced image')),
'extended_valid_elements' => array('img[src|alt|title|align|width|height|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
@@ -414,7 +412,7 @@ function wysiwyg_tinymce_plugins($editor) {
'load' => TRUE,
),
'advlink' => array(
- 'path' => $editor['library path'] .'/plugins/advlink',
+ 'path' => $editor['library path'] . '/plugins/advlink',
'extensions' => array('advlink' => t('Advanced link')),
'extended_valid_elements' => array('a[name|href|target|title|class|onfocus|onblur|onclick|ondlbclick|onmousedown|onmouseup|onmouseover|onmouseout|onkeypress|onkeydown|onkeyup|id|style|rel]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
@@ -422,49 +420,49 @@ function wysiwyg_tinymce_plugins($editor) {
'load' => TRUE,
),
'autosave' => array(
- 'path' => $editor['library path'] .'/plugins/autosave',
+ 'path' => $editor['library path'] . '/plugins/autosave',
'extensions' => array('autosave' => t('Auto save')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
'internal' => TRUE,
'load' => TRUE,
),
'contextmenu' => array(
- 'path' => $editor['library path'] .'/plugins/contextmenu',
+ 'path' => $editor['library path'] . '/plugins/contextmenu',
'extensions' => array('contextmenu' => t('Context menu')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
'internal' => TRUE,
'load' => TRUE,
),
'directionality' => array(
- 'path' => $editor['library path'] .'/plugins/directionality',
+ 'path' => $editor['library path'] . '/plugins/directionality',
'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
'internal' => TRUE,
'load' => TRUE,
),
'emotions' => array(
- 'path' => $editor['library path'] .'/plugins/emotions',
+ 'path' => $editor['library path'] . '/plugins/emotions',
'buttons' => array('emotions' => t('Emotions')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
'internal' => TRUE,
'load' => TRUE,
),
'font' => array(
- 'path' => $editor['library path'] .'/plugins/font',
+ 'path' => $editor['library path'] . '/plugins/font',
'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')),
'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font',
'internal' => TRUE,
),
'fullscreen' => array(
- 'path' => $editor['library path'] .'/plugins/fullscreen',
+ 'path' => $editor['library path'] . '/plugins/fullscreen',
'buttons' => array('fullscreen' => t('Fullscreen')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
'internal' => TRUE,
'load' => TRUE,
),
'inlinepopups' => array(
- 'path' => $editor['library path'] .'/plugins/inlinepopups',
+ 'path' => $editor['library path'] . '/plugins/inlinepopups',
'extensions' => array('inlinepopups' => t('Inline popups')),
'options' => array(
'dialog_type' => array('modal'),
@@ -474,7 +472,7 @@ function wysiwyg_tinymce_plugins($editor) {
'load' => TRUE,
),
'insertdatetime' => array(
- 'path' => $editor['library path'] .'/plugins/insertdatetime',
+ 'path' => $editor['library path'] . '/plugins/insertdatetime',
'buttons' => array('insertdate' => t('Insert date'), 'inserttime' => t('Insert time')),
'options' => array(
'plugin_insertdate_dateFormat' => array('%Y-%m-%d'),
@@ -485,49 +483,49 @@ function wysiwyg_tinymce_plugins($editor) {
'load' => TRUE,
),
'layer' => array(
- 'path' => $editor['library path'] .'/plugins/layer',
+ 'path' => $editor['library path'] . '/plugins/layer',
'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer',
'internal' => TRUE,
'load' => TRUE,
),
'paste' => array(
- 'path' => $editor['library path'] .'/plugins/paste',
+ 'path' => $editor['library path'] . '/plugins/paste',
'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
'internal' => TRUE,
'load' => TRUE,
),
'preview' => array(
- 'path' => $editor['library path'] .'/plugins/preview',
+ 'path' => $editor['library path'] . '/plugins/preview',
'buttons' => array('preview' => t('Preview')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',
'internal' => TRUE,
'load' => TRUE,
),
'print' => array(
- 'path' => $editor['library path'] .'/plugins/print',
+ 'path' => $editor['library path'] . '/plugins/print',
'buttons' => array('print' => t('Print')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print',
'internal' => TRUE,
'load' => TRUE,
),
'searchreplace' => array(
- 'path' => $editor['library path'] .'/plugins/searchreplace',
+ 'path' => $editor['library path'] . '/plugins/searchreplace',
'buttons' => array('search' => t('Search'), 'replace' => t('Replace')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
'internal' => TRUE,
'load' => TRUE,
),
'style' => array(
- 'path' => $editor['library path'] .'/plugins/style',
+ 'path' => $editor['library path'] . '/plugins/style',
'buttons' => array('styleprops' => t('Style properties')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
'internal' => TRUE,
'load' => TRUE,
),
'table' => array(
- 'path' => $editor['library path'] .'/plugins/table',
+ 'path' => $editor['library path'] . '/plugins/table',
'buttons' => array('tablecontrols' => t('Table')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
'internal' => TRUE,
@@ -536,7 +534,7 @@ function wysiwyg_tinymce_plugins($editor) {
);
if (version_compare($editor['installed version'], '3', '<')) {
$plugins['flash'] = array(
- 'path' => $editor['library path'] .'/plugins/flash',
+ 'path' => $editor['library path'] . '/plugins/flash',
'buttons' => array('flash' => t('Flash')),
'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',
@@ -546,14 +544,14 @@ function wysiwyg_tinymce_plugins($editor) {
}
if (version_compare($editor['installed version'], '2.0.6', '>')) {
$plugins['media'] = array(
- 'path' => $editor['library path'] .'/plugins/media',
+ 'path' => $editor['library path'] . '/plugins/media',
'buttons' => array('media' => t('Media')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
- 'internal' => TRUE,
+ 'internal' => TRUE,
'load' => TRUE,
);
$plugins['xhtmlxtras'] = array(
- 'path' => $editor['library path'] .'/plugins/xhtmlxtras',
+ 'path' => $editor['library path'] . '/plugins/xhtmlxtras',
'buttons' => array('cite' => t('Citation'), 'del' => t('Deleted'), 'abbr' => t('Abbreviation'), 'acronym' => t('Acronym'), 'ins' => t('Inserted')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
'internal' => TRUE,
@@ -562,14 +560,14 @@ function wysiwyg_tinymce_plugins($editor) {
}
if (version_compare($editor['installed version'], '3', '>')) {
$plugins['bbcode'] = array(
- 'path' => $editor['library path'] .'/plugins/bbcode',
+ 'path' => $editor['library path'] . '/plugins/bbcode',
'extensions' => array('bbcode' => t('BBCode')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
'internal' => TRUE,
'load' => TRUE,
);
$plugins['safari'] = array(
- 'path' => $editor['library path'] .'/plugins/safari',
+ 'path' => $editor['library path'] . '/plugins/safari',
'extensions' => array('safari' => t('Safari compatibility')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',
'internal' => TRUE,
diff --git a/editors/whizzywig.inc b/editors/whizzywig.inc
index d30fa5a..521407c 100644
--- a/editors/whizzywig.inc
+++ b/editors/whizzywig.inc
@@ -1,12 +1,15 @@
<?php
// $Id$
+/**
+ * @file
+ * Editor integration functions for Whizzywig.
+ */
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_whizzywig_editor() {
- $editor = array();
$editor['whizzywig'] = array(
'title' => 'Whizzywig',
'vendor url' => 'http://www.unverse.net',
@@ -46,6 +49,7 @@ function wysiwyg_whizzywig_version($editor) {
fclose($script);
return $version[1];
}
+ fclose($script);
}
/**
@@ -85,7 +89,7 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) {
// Add editor content stylesheet.
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
- $css = path_to_theme() .'/style.css';
+ $css = path_to_theme() . '/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
}
@@ -99,7 +103,7 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) {
}
/**
- * Return internal plugins for Whizzywig; semi-implementation of hook_wysiwyg_plugin().
+ * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_whizzywig_plugins($editor) {
return array(
diff --git a/editors/wymeditor.inc b/editors/wymeditor.inc
index 4a7479b..e48fd48 100644
--- a/editors/wymeditor.inc
+++ b/editors/wymeditor.inc
@@ -10,7 +10,6 @@
* Plugin implementation of hook_editor().
*/
function wysiwyg_wymeditor_editor() {
- $editor = array();
$editor['wymeditor'] = array(
'title' => 'WYMeditor',
'vendor url' => 'http://www.wymeditor.org/',
@@ -31,11 +30,11 @@ function wysiwyg_wymeditor_editor() {
),
),
'version callback' => 'wysiwyg_wymeditor_version',
- 'settings callback' => 'wysiwyg_wymeditor_settings',
'themes callback' => 'wysiwyg_wymeditor_themes',
+ 'settings callback' => 'wysiwyg_wymeditor_settings',
'versions' => array(
'0.5-rc1' => array(
- 'js files' => array('wymeditor.js')
+ 'js files' => array('wymeditor.js'),
),
),
);
@@ -64,6 +63,22 @@ function wysiwyg_wymeditor_version($editor) {
}
/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_wymeditor_themes($editor, $profile) {
+ return array('compact', 'default', 'minimal', 'silver', 'twopanels');
+}
+
+/**
* Return runtime editor settings for a given wysiwyg profile.
*
* @param $editor
@@ -130,19 +145,3 @@ function wysiwyg_wymeditor_settings($editor, $config, $theme) {
return $settings;
}
-/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_wymeditor_themes($editor, $profile) {
- return array('compact', 'default', 'minimal', 'silver', 'twopanels');
-}
-
diff --git a/editors/yui.inc b/editors/yui.inc
index 7d96800..1c79405 100644
--- a/editors/yui.inc
+++ b/editors/yui.inc
@@ -1,14 +1,17 @@
<?php
// $Id$
+/**
+ * @file
+ * Editor integration functions for YUI editor.
+ */
/**
* Plugin implementation of hook_editor().
*/
function wysiwyg_yui_editor() {
- $editor = array();
$editor['yui'] = array(
- 'title' => 'YUI',
+ 'title' => 'YUI editor',
'vendor url' => 'http://developer.yahoo.com/yui/editor/',
'download url' => 'http://developer.yahoo.com/yui/download/',
'library path' => wysiwyg_get_path('yui') . '/build',
@@ -39,9 +42,9 @@ function wysiwyg_yui_editor() {
),
),
'version callback' => 'wysiwyg_yui_version',
+ 'themes callback' => 'wysiwyg_yui_themes',
'load callback' => 'wysiwyg_yui_load',
'settings callback' => 'wysiwyg_yui_settings',
- 'themes callback' => 'wysiwyg_yui_themes',
'plugin callback' => 'wysiwyg_yui_plugins',
'versions' => array(
'2.7.0' => array(
@@ -76,6 +79,22 @@ function wysiwyg_yui_version($editor) {
}
/**
+ * Determine available editor themes or check/reset a given one.
+ *
+ * @param $editor
+ * A processed hook_editor() array of editor properties.
+ * @param $profile
+ * A wysiwyg editor profile.
+ *
+ * @return
+ * An array of theme names. The first returned name should be the default
+ * theme name.
+ */
+function wysiwyg_yui_themes($editor, $profile) {
+ return array('sam');
+}
+
+/**
* Perform additional actions upon loading this editor.
*
* @param $editor
@@ -248,22 +267,6 @@ function wysiwyg_yui_button_setting($editor, $plugin, $button, $extra = array())
}
/**
- * Determine available editor themes or check/reset a given one.
- *
- * @param $editor
- * A processed hook_editor() array of editor properties.
- * @param $profile
- * A wysiwyg editor profile.
- *
- * @return
- * An array of theme names. The first returned name should be the default
- * theme name.
- */
-function wysiwyg_yui_themes($editor, $profile) {
- return array('sam');
-}
-
-/**
* Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_yui_plugins($editor) {
@@ -278,7 +281,7 @@ function wysiwyg_yui_plugins($editor) {
'undo' => t('Undo'), 'redo' => t('Redo'),
'createlink' => t('Link'),
'insertimage' => t('Image'),
- 'forecolor' => t('Font Color'), 'backcolor' => t('Background Color'),
+ 'forecolor' => t('Font Color'), 'backcolor' => t('Background Color'),
'superscript' => t('Sup'), 'subscript' => t('Sub'),
'hiddenelements' => t('Show/hide hidden elements'),
'removeformat' => t('Remove format'),
diff --git a/plugins/break.inc b/plugins/break.inc
index 861bcc9..da239da 100644
--- a/plugins/break.inc
+++ b/plugins/break.inc
@@ -10,14 +10,12 @@
* Implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_break_plugin() {
- $plugins = array();
$plugins['break'] = array(
'title' => t('Teaser break'),
'vendor url' => 'http://drupal.org/project/wysiwyg',
'icon file' => 'break.gif',
'icon title' => t('Separate the teaser and body of this content'),
- 'settings' => array(
- ),
+ 'settings' => array(),
);
return $plugins;
}
diff --git a/wysiwyg.admin.inc b/wysiwyg.admin.inc
index 83ddd7f..f5fcd99 100644
--- a/wysiwyg.admin.inc
+++ b/wysiwyg.admin.inc
@@ -117,15 +117,15 @@ function wysiwyg_profile_form($form_state, $profile) {
if (!empty($meta['path'])) {
// @todo Button icon locations are different in editors, editor versions,
// and contrib/custom plugins (like Image Assist, f.e.).
- $img_src = $meta['path'] ."/images/$name.gif";
+ $img_src = $meta['path'] . "/images/$name.gif";
// Handle plugins that have more than one button.
if (!file_exists($img_src)) {
- $img_src = $meta['path'] ."/images/$button.gif";
+ $img_src = $meta['path'] . "/images/$button.gif";
}
- $icon = file_exists($img_src) ? '<img src="'. base_path() . $img_src .'" title="'. $button .'" style="border: 1px solid grey; vertical-align: middle;" />' : '';
+ $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : '';
}
$title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title);
- $title = (!empty($icon) ? $icon .' '. $title : $title);
+ $title = (!empty($icon) ? $icon . ' ' . $title : $title);
$form['buttons'][$name][$button] = array(
'#type' => 'checkbox',
'#title' => $title,
diff --git a/wysiwyg.api.php b/wysiwyg.api.php
index 6b60d73..5746561 100644
--- a/wysiwyg.api.php
+++ b/wysiwyg.api.php
@@ -23,9 +23,10 @@
* tinyMCE.importCSS(inst.getDoc(), this.baseURL + '/myplugin.css');
* },
* @endcode
- *
+ *
* @param string $editor
* An (lowercase) editor name to return plugins for.
+ *
* @return array
* An associative array having internal plugin names as keys, an array of
* plugin meta-information as values:
@@ -46,14 +47,14 @@ function hook_wysiwyg_plugin($editor) {
case 'tinymce':
return array(
'myplugin' => array(
- 'type' => 'external',
- 'title' => t('My plugin title'),
+ 'type' => 'external',
+ 'title' => t('My plugin title'),
'description' => t('My plugin title'),
// Regular callback URL for external TinyMCE plugins.
- 'path' => drupal_get_path('module', 'mymodule') .'/myplugin',
+ 'path' => drupal_get_path('module', 'mymodule') . '/myplugin',
// Wysiwyg wrapper plugin AJAX callback.
- 'callback' => url('myplugin/browse'),
- 'icon' => drupal_get_path('module', 'mymodule') .'/myplugin/myplugin.png',
+ 'callback' => url('myplugin/browse'),
+ 'icon' => drupal_get_path('module', 'mymodule') . '/myplugin/myplugin.png',
'extended_valid_elements' => array('tag[attribute1|attribute2=default_value]'),
// Might need to be set later on; after retrieving customized editor
// layout.
diff --git a/wysiwyg.module b/wysiwyg.module
index 4f45c75..7633d13 100644
--- a/wysiwyg.module
+++ b/wysiwyg.module
@@ -77,7 +77,7 @@ function wysiwyg_theme() {
function wysiwyg_help($path, $arg) {
switch ($path) {
case 'admin/settings/wysiwyg':
- $output = '<p>'. t('A Wysiwyg profile can be associated to an input format. A Wysiwyg profile defines which client-side editor is loaded, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') .'</p>';
+ $output = '<p>' . t('A Wysiwyg profile can be associated to an input format. A Wysiwyg profile defines which client-side editor is loaded, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>';
return $output;
}
}
@@ -340,7 +340,7 @@ function wysiwyg_add_editor_settings($profile, $theme) {
$config = wysiwyg_get_editor_config($profile, $theme);
// drupal_to_js() does not properly convert numeric array keys, so we need
// to use a string instead of the format id.
- drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format'. $profile->format => $config)))), 'setting');
+ drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting');
$formats[$profile->format] = TRUE;
}
}
@@ -414,7 +414,7 @@ function wysiwyg_add_plugin_settings($profile) {
// Invoke the editor's plugin settings callback, so it can populate the
// settings for native external plugins with required values.
$settings_native = call_user_func($editor['plugin settings callback'], $editor, $profile, $profile_plugins_native);
-
+
drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting');
}
@@ -429,7 +429,7 @@ function wysiwyg_add_plugin_settings($profile) {
if (!isset($processed_plugins[$proxy][$plugin])) {
$profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin] = $meta;
// Load the Drupal plugin's JavaScript.
- drupal_add_js($meta['js path'] .'/'. $meta['js file']);
+ drupal_add_js($meta['js path'] . '/' . $meta['js file']);
// Add plugin-specific settings.
if (isset($meta['settings'])) {
drupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting');
@@ -443,7 +443,7 @@ function wysiwyg_add_plugin_settings($profile) {
// Invoke the editor's proxy plugin settings callback, so it can populate
// the settings for Drupal plugins with custom, required values.
$settings_drupal = call_user_func($editor['proxy plugin settings callback'], $editor, $profile, $profile_plugins_drupal);
-
+
drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting');
}
}
@@ -869,7 +869,7 @@ function wysiwyg_get_libraries() {
}
// Always search sites/all/*.
- $searchdir[] = 'sites/all/'. $directory;
+ $searchdir[] = 'sites/all/' . $directory;
// Also search sites/<domain>/*.
if (file_exists("$config/$directory")) {
@@ -913,7 +913,7 @@ function wysiwyg_get_directories($plugintype) {
foreach (module_implements('wysiwyg_include_directory') as $module) {
$result = module_invoke($module, 'wysiwyg_include_directory', $plugintype);
if (isset($result) && is_string($result)) {
- $directories[$module .'_'] = drupal_get_path('module', $module) .'/'. $result;
+ $directories[$module . '_'] = drupal_get_path('module', $module) . '/' . $result;
}
}
return $directories;