| 1 |
<?php |
<?php |
| 2 |
// $Id: bbcode_wysiwyg.module,v 1.4.4.3 2008/01/01 17:56:15 jrbeeman Exp $ |
// $Id: bbcode_wysiwyg.module,v 1.4.4.4 2008/04/14 17:00:51 jrbeeman Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_perm(). |
* Implementation of hook_perm(). |
| 86 |
$buttons = variable_get('bbcode_wysiwyg_buttons_enabled', array()); |
$buttons = variable_get('bbcode_wysiwyg_buttons_enabled', array()); |
| 87 |
$open_tags = array(); |
$open_tags = array(); |
| 88 |
foreach ($buttons as $key => $value) { |
foreach ($buttons as $key => $value) { |
| 89 |
$open_tags[$key] = false; |
$open_tags[$key] = FALSE; |
| 90 |
} |
} |
| 91 |
return array( |
return array( |
| 92 |
'bbcode_wysiwyg' => array( |
'bbcode_wysiwyg' => array( |
| 96 |
'attachTo' => $element, |
'attachTo' => $element, |
| 97 |
'buttons' => $buttons, |
'buttons' => $buttons, |
| 98 |
'openTags' => $open_tags, |
'openTags' => $open_tags, |
| 99 |
'keydown_ctrl' => false, |
'keydown_ctrl' => FALSE, |
| 100 |
'keydown_shift' => false, |
'keydown_shift' => FALSE, |
| 101 |
), |
), |
| 102 |
); |
); |
| 103 |
} |
} |
| 117 |
* Implementation of hook_form_alter |
* Implementation of hook_form_alter |
| 118 |
*/ |
*/ |
| 119 |
function bbcode_wysiwyg_form_alter($form_id, &$form) { |
function bbcode_wysiwyg_form_alter($form_id, &$form) { |
| 120 |
$show = false; |
$show = FALSE; |
| 121 |
$is_node = false; |
$is_node = FALSE; |
| 122 |
$attach_to = ''; |
$attach_to = ''; |
| 123 |
$other_forms = variable_get('bbcode_wysiwyg_other_forms', array()); |
$other_forms = variable_get('bbcode_wysiwyg_other_forms', array()); |
| 124 |
$node_forms = variable_get('bbcode_wysiwyg_node_forms', array()); |
$node_forms = variable_get('bbcode_wysiwyg_node_forms', array()); |
| 125 |
|
|
| 126 |
if ($form['#id'] == 'node-form' && $node_forms[$form['type']['#value']]) { |
if ($form['#id'] == 'node-form' && $node_forms[$form['type']['#value']]) { |
| 127 |
$show = true; |
$show = TRUE; |
| 128 |
$is_node = true; |
$is_node = TRUE; |
| 129 |
$attach_to = 'edit-body'; |
$attach_to = 'edit-body'; |
| 130 |
} |
} |
| 131 |
else if ($other_forms[$form_id]) { |
else if ($other_forms[$form_id]) { |
| 132 |
$show = true; |
$show = TRUE; |
| 133 |
$attach_to = 'edit-comment'; |
$attach_to = 'edit-comment'; |
| 134 |
} |
} |
| 135 |
|
|
| 153 |
$name = str_replace(array('[', ']'), array('', ''), $node->name); |
$name = str_replace(array('[', ']'), array('', ''), $node->name); |
| 154 |
$body = '<a href="javascript:void(null);" onclick="var txt=getTextarea();insertAtCursor(txt,\'[quote='. $name .']'. $body .'[/quote]\');txt.focus()">'. t('quote') .'</a>'; |
$body = '<a href="javascript:void(null);" onclick="var txt=getTextarea();insertAtCursor(txt,\'[quote='. $name .']'. $body .'[/quote]\');txt.focus()">'. t('quote') .'</a>'; |
| 155 |
// quote this post |
// quote this post |
| 156 |
$links['bbcode_wysiwyg_quote'] = array('title' => $body, 'html' => true); |
$links['bbcode_wysiwyg_quote'] = array('title' => $body, 'html' => TRUE); |
| 157 |
} |
} |
| 158 |
return $links; |
return $links; |
| 159 |
} |
} |