Commit 9e8e526a authored by sun's avatar sun

#328948 by sun: Fixed PHP notices when editors are assigned, but not configured.

parent db932f81
......@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-x.x, xxxx-xx-xx
---------------------------
#328948 by sun: Fixed PHP notices when editors are assigned, but not configured.
#327710 by sun: Fixed nicEdit version could not be detected.
#328116 by sun: Added Safari plugin for TinyMCE 3.
#327710 by sun: Added nicEdit support.
......
......@@ -90,9 +90,6 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) {
'ToolbarStartExpanded' => TRUE,
'EnterMode' => 'p',
'ShiftEnterMode' => 'br',
'FontFormats' => strtr($config['block_formats'], array(',' => ';')),
'FormatSource' => $config['apply_source_formatting'],
'FormatOutput' => $config['preformatted'],
'LinkBrowser' => FALSE,
'LinkUpload' => FALSE,
'ImageBrowser' => FALSE,
......@@ -100,15 +97,26 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) {
'FlashBrowser' => FALSE,
'FlashUpload' => FALSE,
);
if (isset($config['block_formats'])) {
$init['FontFormats'] = strtr($config['block_formats'], array(',' => ';'));
}
if (isset($config['apply_source_formatting'])) {
$init['FormatSource'] = $config['apply_source_formatting'];
}
if (isset($config['preformatted'])) {
$init['FormatOutput'] = $config['preformatted'];
}
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$init['EditorAreaCSS'] = base_path() . $css;
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$init['EditorAreaCSS'] = base_path() . $css;
}
}
else if ($config['css_setting'] == 'self' && isset($config['css_path'])) {
$init['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
}
else if ($config['css_setting'] == 'self') {
$init['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
return $init;
......
......@@ -77,14 +77,16 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) {
}
// Add editor content stylesheet.
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
}
}
else if ($config['css_setting'] == 'self' && isset($config['css_path'])) {
$settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
}
else if ($config['css_setting'] == 'self') {
$settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
return $settings;
......
......@@ -107,35 +107,51 @@ function wysiwyg_tinymce_version($editor) {
*/
function wysiwyg_tinymce_settings($editor, $config, $theme) {
$init = array(
'apply_source_formatting' => $config['apply_source_formatting'],
'button_tile_map' => TRUE, // @todo Add a setting for this.
'convert_fonts_to_spans' => $config['convert_fonts_to_spans'],
'document_base_url' => base_path(),
'entity_encoding' => 'raw',
'language' => $config['language'],
'mode' => 'none',
'paste_auto_cleanup_on_paste' => $config['paste_auto_cleanup_on_paste'],
'plugins' => array(),
'preformatted' => $config['preformatted'],
'relative_urls' => FALSE,
'remove_linebreaks' => $config['remove_linebreaks'],
'theme' => $theme,
'verify_html' => $config['verify_html'],
'width' => '100%',
);
if (isset($config['apply_source_formatting'])) {
$init['apply_source_formatting'] = $config['apply_source_formatting'];
}
if (isset($config['convert_fonts_to_spans'])) {
$init['convert_fonts_to_spans'] = $config['convert_fonts_to_spans'];
}
if (isset($config['language'])) {
$init['language'] = $config['language'];
}
if (isset($config['paste_auto_cleanup_on_paste'])) {
$init['paste_auto_cleanup_on_paste'] = $config['paste_auto_cleanup_on_paste'];
}
if (isset($config['preformatted'])) {
$init['preformatted'] = $config['preformatted'];
}
if (isset($config['remove_linebreaks'])) {
$init['remove_linebreaks'] = $config['remove_linebreaks'];
}
if (isset($config['verify_html'])) {
$init['verify_html'] = $config['verify_html'];
}
if ($config['css_classes']) {
if (!empty($config['css_classes'])) {
$init['theme_advanced_styles'] = implode(';', array_filter(explode("\n", str_replace("\r", '', $config['css_classes']))));
}
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$init['content_css'] = base_path() . $css;
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() .'/style.css';
if (file_exists($css)) {
$init['content_css'] = base_path() . $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()));
}
}
else if ($config['css_setting'] == 'self') {
$init['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()));
}
// Find the enabled buttons and the button row they belong on.
......@@ -204,22 +220,36 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) {
switch ($theme) {
case 'advanced':
$init += array(
'theme_advanced_blockformats' => $config['block_formats'] ? $config['block_formats'] : 'p,h2,h3,h4,h5,h6',
'theme_advanced_path_location' => $config['path_loc'],
'theme_advanced_resizing' => $config['resizing'],
'theme_advanced_resize_horizontal' => FALSE,
'theme_advanced_resizing_use_cookie' => FALSE,
'theme_advanced_toolbar_location' => $config['toolbar_loc'],
'theme_advanced_toolbar_align' => $config['toolbar_align'],
// Note: These rows need to be set to NULL otherwise TinyMCE loads its
// own buttons as defined in advanced theme.
'theme_advanced_buttons1' => array(),
'theme_advanced_buttons2' => array(),
'theme_advanced_buttons3' => array(),
);
if (isset($config['block_formats'])) {
$init['theme_advanced_blockformats'] = $config['block_formats'];
}
if (isset($config['path_loc'])) {
$init['theme_advanced_path_location'] = $config['path_loc'];
}
if (isset($config['resizing'])) {
$init['theme_advanced_resizing'] = $config['resizing'];
}
if (isset($config['toolbar_loc'])) {
$init['theme_advanced_toolbar_location'] = $config['toolbar_loc'];
}
if (isset($config['toolbar_align'])) {
$init['theme_advanced_toolbar_align'] = $config['toolbar_align'];
}
for ($i = 0; $i < count($init['buttons']); $i++) {
$init['theme_advanced_buttons1'][] = $init['buttons'][$i];
if (isset($init['buttons'])) {
// Note: These rows need to be set to NULL otherwise TinyMCE loads its
// own buttons as defined in advanced theme.
$init += array(
'theme_advanced_buttons1' => array(),
'theme_advanced_buttons2' => array(),
'theme_advanced_buttons3' => array(),
);
for ($i = 0; $i < count($init['buttons']); $i++) {
$init['theme_advanced_buttons1'][] = $init['buttons'][$i];
}
}
break;
}
......
......@@ -253,7 +253,7 @@ function wysiwyg_load_editor($profile) {
drupal_add_js(array('wysiwyg' => array(
'configs' => array($editor['name'] => array()),
// @todo Move into profile settings.
'showToggle' => $profile->settings['show_toggle'],
'showToggle' => isset($profile->settings['show_toggle']) ? $profile->settings['show_toggle'] : TRUE,
// @todo http://drupal.org/node/322433
'status' => $status,
// @todo Move into (global) editor settings.
......@@ -477,7 +477,7 @@ function wysiwyg_user_get_status($profile) {
$status = $user->wysiwyg_status;
}
else {
$status = isset($profile->settings['default']) ? $profile->settings['default'] : FALSE;
$status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE;
}
return $status;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment