@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | * Form builder for Wysiwyg profile form. |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_profile_form($form_state, $profile) { |
| 12 | - // Merge in defaults. |
|
| 13 | - $profile = (array) $profile; |
|
| 14 | - $profile += array( |
|
| 12 | + // Merge in defaults. |
|
| 13 | + $profile = (array) $profile; |
|
| 14 | + $profile += array( |
|
| 15 | 15 | 'format' => 0, |
| 16 | 16 | 'editor' => '', |
| 17 | - ); |
|
| 18 | - if (empty($profile['settings'])) { |
|
| 17 | + ); |
|
| 18 | + if (empty($profile['settings'])) { |
|
| 19 | 19 | $profile['settings'] = array(); |
| 20 | - } |
|
| 21 | - $profile['settings'] += array( |
|
| 20 | + } |
|
| 21 | + $profile['settings'] += array( |
|
| 22 | 22 | 'default' => TRUE, |
| 23 | 23 | 'user_choose' => FALSE, |
| 24 | 24 | 'show_toggle' => TRUE, |
@@ -42,264 +42,264 @@ discard block |
||
| 42 | 42 | 'css_setting' => 'theme', |
| 43 | 43 | 'css_path' => NULL, |
| 44 | 44 | 'css_classes' => NULL, |
| 45 | - ); |
|
| 46 | - $profile = (object) $profile; |
|
| 45 | + ); |
|
| 46 | + $profile = (object) $profile; |
|
| 47 | 47 | |
| 48 | - $formats = filter_formats(); |
|
| 49 | - $editor = wysiwyg_get_editor($profile->editor); |
|
| 50 | - drupal_set_title(t('%editor profile for %format', array('%editor' => $editor['title'], '%format' => $formats[$profile->format]->name))); |
|
| 48 | + $formats = filter_formats(); |
|
| 49 | + $editor = wysiwyg_get_editor($profile->editor); |
|
| 50 | + drupal_set_title(t('%editor profile for %format', array('%editor' => $editor['title'], '%format' => $formats[$profile->format]->name))); |
|
| 51 | 51 | |
| 52 | - $form['format'] = array('#type' => 'value', '#value' => $profile->format); |
|
| 53 | - $form['input_format'] = array('#type' => 'value', '#value' => $formats[$profile->format]->name); |
|
| 54 | - $form['editor'] = array('#type' => 'value', '#value' => $profile->editor); |
|
| 52 | + $form['format'] = array('#type' => 'value', '#value' => $profile->format); |
|
| 53 | + $form['input_format'] = array('#type' => 'value', '#value' => $formats[$profile->format]->name); |
|
| 54 | + $form['editor'] = array('#type' => 'value', '#value' => $profile->editor); |
|
| 55 | 55 | |
| 56 | - $form['basic'] = array( |
|
| 56 | + $form['basic'] = array( |
|
| 57 | 57 | '#type' => 'fieldset', |
| 58 | 58 | '#title' => t('Basic setup'), |
| 59 | 59 | '#collapsible' => TRUE, |
| 60 | 60 | '#collapsed' => TRUE, |
| 61 | - ); |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - $form['basic']['default'] = array( |
|
| 63 | + $form['basic']['default'] = array( |
|
| 64 | 64 | '#type' => 'checkbox', |
| 65 | 65 | '#title' => t('Enabled by default'), |
| 66 | 66 | '#default_value' => $profile->settings['default'], |
| 67 | 67 | '#return_value' => 1, |
| 68 | 68 | '#description' => t('The default editor state for users having access to this profile. Users are able to override this state if the next option is enabled.'), |
| 69 | - ); |
|
| 69 | + ); |
|
| 70 | 70 | |
| 71 | - $form['basic']['user_choose'] = array( |
|
| 71 | + $form['basic']['user_choose'] = array( |
|
| 72 | 72 | '#type' => 'checkbox', |
| 73 | 73 | '#title' => t('Allow users to choose default'), |
| 74 | 74 | '#default_value' => $profile->settings['user_choose'], |
| 75 | 75 | '#return_value' => 1, |
| 76 | 76 | '#description' => t('If allowed, users will be able to choose their own editor default state in their user account settings.'), |
| 77 | - ); |
|
| 77 | + ); |
|
| 78 | 78 | |
| 79 | - $form['basic']['show_toggle'] = array( |
|
| 79 | + $form['basic']['show_toggle'] = array( |
|
| 80 | 80 | '#type' => 'checkbox', |
| 81 | 81 | '#title' => t('Show <em>enable/disable rich text</em> toggle link'), |
| 82 | 82 | '#default_value' => $profile->settings['show_toggle'], |
| 83 | 83 | '#return_value' => 1, |
| 84 | 84 | '#description' => t('Whether or not to show the <em>enable/disable rich text</em> toggle link below a textarea. If disabled, the user setting or global default is used (see above).'), |
| 85 | - ); |
|
| 85 | + ); |
|
| 86 | 86 | |
| 87 | - $form['basic']['theme'] = array( |
|
| 87 | + $form['basic']['theme'] = array( |
|
| 88 | 88 | '#type' => 'hidden', |
| 89 | 89 | '#value' => $profile->settings['theme'], |
| 90 | - ); |
|
| 90 | + ); |
|
| 91 | 91 | |
| 92 | - $form['basic']['language'] = array( |
|
| 92 | + $form['basic']['language'] = array( |
|
| 93 | 93 | '#type' => 'select', |
| 94 | 94 | '#title' => t('Interface language'), |
| 95 | 95 | '#default_value' => $profile->settings['language'], |
| 96 | - ); |
|
| 97 | - // @see _locale_prepare_predefined_list() |
|
| 98 | - require_once './includes/locale.inc'; |
|
| 99 | - $predefined = _locale_get_predefined_list(); |
|
| 100 | - foreach ($predefined as $key => $value) { |
|
| 96 | + ); |
|
| 97 | + // @see _locale_prepare_predefined_list() |
|
| 98 | + require_once './includes/locale.inc'; |
|
| 99 | + $predefined = _locale_get_predefined_list(); |
|
| 100 | + foreach ($predefined as $key => $value) { |
|
| 101 | 101 | // Include native name in output, if possible |
| 102 | 102 | if (count($value) > 1) { |
| 103 | - $tname = t($value[0]); |
|
| 104 | - $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])"; |
|
| 103 | + $tname = t($value[0]); |
|
| 104 | + $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])"; |
|
| 105 | 105 | } |
| 106 | 106 | else { |
| 107 | - $predefined[$key] = t($value[0]); |
|
| 107 | + $predefined[$key] = t($value[0]); |
|
| 108 | + } |
|
| 108 | 109 | } |
| 109 | - } |
|
| 110 | - asort($predefined); |
|
| 111 | - $form['basic']['language']['#options'] = $predefined; |
|
| 110 | + asort($predefined); |
|
| 111 | + $form['basic']['language']['#options'] = $predefined; |
|
| 112 | 112 | |
| 113 | - $form['buttons'] = array( |
|
| 113 | + $form['buttons'] = array( |
|
| 114 | 114 | '#type' => 'fieldset', |
| 115 | 115 | '#title' => t('Buttons and plugins'), |
| 116 | 116 | '#collapsible' => TRUE, |
| 117 | 117 | '#collapsed' => TRUE, |
| 118 | 118 | '#tree' => TRUE, |
| 119 | 119 | '#theme' => 'wysiwyg_admin_button_table', |
| 120 | - ); |
|
| 120 | + ); |
|
| 121 | 121 | |
| 122 | - $plugins = wysiwyg_get_plugins($profile->editor); |
|
| 123 | - // Generate the button list. |
|
| 124 | - foreach ($plugins as $name => $meta) { |
|
| 122 | + $plugins = wysiwyg_get_plugins($profile->editor); |
|
| 123 | + // Generate the button list. |
|
| 124 | + foreach ($plugins as $name => $meta) { |
|
| 125 | 125 | if (isset($meta['buttons']) && is_array($meta['buttons'])) { |
| 126 | - foreach ($meta['buttons'] as $button => $title) { |
|
| 126 | + foreach ($meta['buttons'] as $button => $title) { |
|
| 127 | 127 | $icon = ''; |
| 128 | 128 | if (!empty($meta['path'])) { |
| 129 | - // @todo Button icon locations are different in editors, editor versions, |
|
| 130 | - // and contrib/custom plugins (like Image Assist, f.e.). |
|
| 131 | - $img_src = $meta['path'] . "/images/$name.gif"; |
|
| 132 | - // Handle plugins that have more than one button. |
|
| 133 | - if (!file_exists($img_src)) { |
|
| 129 | + // @todo Button icon locations are different in editors, editor versions, |
|
| 130 | + // and contrib/custom plugins (like Image Assist, f.e.). |
|
| 131 | + $img_src = $meta['path'] . "/images/$name.gif"; |
|
| 132 | + // Handle plugins that have more than one button. |
|
| 133 | + if (!file_exists($img_src)) { |
|
| 134 | 134 | $img_src = $meta['path'] . "/images/$button.gif"; |
| 135 | - } |
|
| 136 | - $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : ''; |
|
| 135 | + } |
|
| 136 | + $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : ''; |
|
| 137 | 137 | } |
| 138 | 138 | $title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title); |
| 139 | 139 | $title = (!empty($icon) ? $icon . ' ' . $title : $title); |
| 140 | 140 | $form['buttons'][$name][$button] = array( |
| 141 | - '#type' => 'checkbox', |
|
| 142 | - '#title' => $title, |
|
| 143 | - '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, |
|
| 141 | + '#type' => 'checkbox', |
|
| 142 | + '#title' => $title, |
|
| 143 | + '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, |
|
| 144 | 144 | ); |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | else if (isset($meta['extensions']) && is_array($meta['extensions'])) { |
| 148 | - foreach ($meta['extensions'] as $extension => $title) { |
|
| 148 | + foreach ($meta['extensions'] as $extension => $title) { |
|
| 149 | 149 | $form['buttons'][$name][$extension] = array( |
| 150 | - '#type' => 'checkbox', |
|
| 151 | - '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title, |
|
| 152 | - '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE, |
|
| 150 | + '#type' => 'checkbox', |
|
| 151 | + '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title, |
|
| 152 | + '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE, |
|
| 153 | 153 | ); |
| 154 | - } |
|
| 154 | + } |
|
| 155 | + } |
|
| 155 | 156 | } |
| 156 | - } |
|
| 157 | 157 | |
| 158 | - $form['appearance'] = array( |
|
| 158 | + $form['appearance'] = array( |
|
| 159 | 159 | '#type' => 'fieldset', |
| 160 | 160 | '#title' => t('Editor appearance'), |
| 161 | 161 | '#collapsible' => TRUE, |
| 162 | 162 | '#collapsed' => TRUE, |
| 163 | - ); |
|
| 163 | + ); |
|
| 164 | 164 | |
| 165 | - $form['appearance']['toolbar_loc'] = array( |
|
| 165 | + $form['appearance']['toolbar_loc'] = array( |
|
| 166 | 166 | '#type' => 'select', |
| 167 | 167 | '#title' => t('Toolbar location'), |
| 168 | 168 | '#default_value' => $profile->settings['toolbar_loc'], |
| 169 | 169 | '#options' => array('bottom' => t('Bottom'), 'top' => t('Top')), |
| 170 | 170 | '#description' => t('This option controls whether the editor toolbar is displayed above or below the editing area.'), |
| 171 | - ); |
|
| 171 | + ); |
|
| 172 | 172 | |
| 173 | - $form['appearance']['toolbar_align'] = array( |
|
| 173 | + $form['appearance']['toolbar_align'] = array( |
|
| 174 | 174 | '#type' => 'select', |
| 175 | 175 | '#title' => t('Button alignment'), |
| 176 | 176 | '#default_value' => $profile->settings['toolbar_align'], |
| 177 | 177 | '#options' => array('center' => t('Center'), 'left' => t('Left'), 'right' => t('Right')), |
| 178 | 178 | '#description' => t('This option controls the alignment of icons in the editor toolbar.'), |
| 179 | - ); |
|
| 179 | + ); |
|
| 180 | 180 | |
| 181 | - $form['appearance']['path_loc'] = array( |
|
| 181 | + $form['appearance']['path_loc'] = array( |
|
| 182 | 182 | '#type' => 'select', |
| 183 | 183 | '#title' => t('Path location'), |
| 184 | 184 | '#default_value' => $profile->settings['path_loc'], |
| 185 | 185 | '#options' => array('none' => t('Hide'), 'top' => t('Top'), 'bottom' => t('Bottom')), |
| 186 | 186 | '#description' => t('Where to display the path to HTML elements (i.e. <code>body > table > tr > td</code>).'), |
| 187 | - ); |
|
| 187 | + ); |
|
| 188 | 188 | |
| 189 | - $form['appearance']['resizing'] = array( |
|
| 189 | + $form['appearance']['resizing'] = array( |
|
| 190 | 190 | '#type' => 'checkbox', |
| 191 | 191 | '#title' => t('Enable resizing button'), |
| 192 | 192 | '#default_value' => $profile->settings['resizing'], |
| 193 | 193 | '#return_value' => 1, |
| 194 | 194 | '#description' => t('This option gives you the ability to enable/disable the resizing button. If enabled, the Path location toolbar must be set to "Top" or "Bottom" in order to display the resize icon.'), |
| 195 | - ); |
|
| 195 | + ); |
|
| 196 | 196 | |
| 197 | - $form['output'] = array( |
|
| 197 | + $form['output'] = array( |
|
| 198 | 198 | '#type' => 'fieldset', |
| 199 | 199 | '#title' => t('Cleanup and output'), |
| 200 | 200 | '#collapsible' => TRUE, |
| 201 | 201 | '#collapsed' => TRUE, |
| 202 | - ); |
|
| 202 | + ); |
|
| 203 | 203 | |
| 204 | - $form['output']['verify_html'] = array( |
|
| 204 | + $form['output']['verify_html'] = array( |
|
| 205 | 205 | '#type' => 'checkbox', |
| 206 | 206 | '#title' => t('Verify HTML'), |
| 207 | 207 | '#default_value' => $profile->settings['verify_html'], |
| 208 | 208 | '#return_value' => 1, |
| 209 | 209 | '#description' => t('If enabled, potentially malicious code like <code><HEAD></code> tags will be removed from HTML contents.'), |
| 210 | - ); |
|
| 210 | + ); |
|
| 211 | 211 | |
| 212 | - $form['output']['preformatted'] = array( |
|
| 212 | + $form['output']['preformatted'] = array( |
|
| 213 | 213 | '#type' => 'checkbox', |
| 214 | 214 | '#title' => t('Preformatted'), |
| 215 | 215 | '#default_value' => $profile->settings['preformatted'], |
| 216 | 216 | '#return_value' => 1, |
| 217 | 217 | '#description' => t('If enabled, the editor will insert TAB characters on tab and preserve other whitespace characters just like a PRE element in HTML does.'), |
| 218 | - ); |
|
| 218 | + ); |
|
| 219 | 219 | |
| 220 | - $form['output']['convert_fonts_to_spans'] = array( |
|
| 220 | + $form['output']['convert_fonts_to_spans'] = array( |
|
| 221 | 221 | '#type' => 'checkbox', |
| 222 | 222 | '#title' => t('Convert <font> tags to styles'), |
| 223 | 223 | '#default_value' => $profile->settings['convert_fonts_to_spans'], |
| 224 | 224 | '#return_value' => 1, |
| 225 | 225 | '#description' => t('If enabled, HTML tags declaring the font size, font family, font color and font background color will be replaced by inline CSS styles.'), |
| 226 | - ); |
|
| 226 | + ); |
|
| 227 | 227 | |
| 228 | - $form['output']['remove_linebreaks'] = array( |
|
| 228 | + $form['output']['remove_linebreaks'] = array( |
|
| 229 | 229 | '#type' => 'checkbox', |
| 230 | 230 | '#title' => t('Remove linebreaks'), |
| 231 | 231 | '#default_value' => $profile->settings['remove_linebreaks'], |
| 232 | 232 | '#return_value' => 1, |
| 233 | 233 | '#description' => t('If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters.'), |
| 234 | - ); |
|
| 234 | + ); |
|
| 235 | 235 | |
| 236 | - $form['output']['apply_source_formatting'] = array( |
|
| 236 | + $form['output']['apply_source_formatting'] = array( |
|
| 237 | 237 | '#type' => 'checkbox', |
| 238 | 238 | '#title' => t('Apply source formatting'), |
| 239 | 239 | '#default_value' => $profile->settings['apply_source_formatting'], |
| 240 | 240 | '#return_value' => 1, |
| 241 | 241 | '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.'), |
| 242 | - ); |
|
| 242 | + ); |
|
| 243 | 243 | |
| 244 | - $form['output']['paste_auto_cleanup_on_paste'] = array( |
|
| 244 | + $form['output']['paste_auto_cleanup_on_paste'] = array( |
|
| 245 | 245 | '#type' => 'checkbox', |
| 246 | 246 | '#title' => t('Force cleanup on standard paste'), |
| 247 | 247 | '#default_value' => $profile->settings['paste_auto_cleanup_on_paste'], |
| 248 | 248 | '#return_value' => 1, |
| 249 | 249 | '#description' => t('If enabled, the default paste function (CTRL-V or SHIFT-INS) behaves like the "paste from word" plugin function.'), |
| 250 | - ); |
|
| 250 | + ); |
|
| 251 | 251 | |
| 252 | - $form['css'] = array( |
|
| 252 | + $form['css'] = array( |
|
| 253 | 253 | '#type' => 'fieldset', |
| 254 | 254 | '#title' => t('CSS'), |
| 255 | 255 | '#collapsible' => TRUE, |
| 256 | 256 | '#collapsed' => TRUE, |
| 257 | - ); |
|
| 257 | + ); |
|
| 258 | 258 | |
| 259 | - $form['css']['block_formats'] = array( |
|
| 259 | + $form['css']['block_formats'] = array( |
|
| 260 | 260 | '#type' => 'textfield', |
| 261 | 261 | '#title' => t('Block formats'), |
| 262 | 262 | '#default_value' => $profile->settings['block_formats'], |
| 263 | 263 | '#size' => 40, |
| 264 | 264 | '#maxlength' => 250, |
| 265 | 265 | '#description' => t('Comma separated list of HTML block formats. Possible values: <code>@format-list</code>.', array('@format-list' => 'p,h1,h2,h3,h4,h5,h6,div,blockquote,address,pre,code,dt,dd')), |
| 266 | - ); |
|
| 266 | + ); |
|
| 267 | 267 | |
| 268 | - $form['css']['css_setting'] = array( |
|
| 268 | + $form['css']['css_setting'] = array( |
|
| 269 | 269 | '#type' => 'select', |
| 270 | 270 | '#title' => t('Editor CSS'), |
| 271 | 271 | '#default_value' => $profile->settings['css_setting'], |
| 272 | 272 | '#options' => array('theme' => t('Use theme CSS'), 'self' => t('Define CSS'), 'none' => t('Editor default CSS')), |
| 273 | 273 | '#description' => t('Defines the CSS to be used in the editor area.<br />Use theme CSS - loads stylesheets from current site theme.<br/>Define CSS - enter path for stylesheet files below.<br />Editor default CSS - uses default stylesheets from editor.'), |
| 274 | - ); |
|
| 274 | + ); |
|
| 275 | 275 | |
| 276 | - $form['css']['css_path'] = array( |
|
| 276 | + $form['css']['css_path'] = array( |
|
| 277 | 277 | '#type' => 'textfield', |
| 278 | 278 | '#title' => t('CSS path'), |
| 279 | 279 | '#default_value' => $profile->settings['css_path'], |
| 280 | 280 | '#size' => 40, |
| 281 | 281 | '#maxlength' => 255, |
| 282 | 282 | '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.') . '<br />' . t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)') . '<br />' . t('Example:') . ' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css', |
| 283 | - ); |
|
| 283 | + ); |
|
| 284 | 284 | |
| 285 | - $form['css']['css_classes'] = array( |
|
| 285 | + $form['css']['css_classes'] = array( |
|
| 286 | 286 | '#type' => 'textarea', |
| 287 | 287 | '#title' => t('CSS classes'), |
| 288 | 288 | '#default_value' => $profile->settings['css_classes'], |
| 289 | 289 | '#description' => t('Optionally define CSS classes for the "Font style" dropdown list.<br />Enter one class on each line in the format: !format. Example: !example<br />If left blank, CSS classes are automatically imported from all loaded stylesheet(s).', array('!format' => '<code>[title]=[class]</code>', '!example' => 'My heading=header1')), |
| 290 | - ); |
|
| 290 | + ); |
|
| 291 | 291 | |
| 292 | - $form['submit'] = array( |
|
| 292 | + $form['submit'] = array( |
|
| 293 | 293 | '#type' => 'submit', |
| 294 | 294 | '#value' => t('Save'), |
| 295 | 295 | '#weight' => 100, |
| 296 | - ); |
|
| 297 | - $form['cancel'] = array( |
|
| 296 | + ); |
|
| 297 | + $form['cancel'] = array( |
|
| 298 | 298 | '#value' => l(t('Cancel'), 'admin/settings/wysiwyg'), |
| 299 | 299 | '#weight' => 110, |
| 300 | - ); |
|
| 300 | + ); |
|
| 301 | 301 | |
| 302 | - return $form; |
|
| 302 | + return $form; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -308,258 +308,258 @@ discard block |
||
| 308 | 308 | * @see wysiwyg_profile_form() |
| 309 | 309 | */ |
| 310 | 310 | function wysiwyg_profile_form_submit($form, &$form_state) { |
| 311 | - $values = $form_state['values']; |
|
| 312 | - if (isset($values['buttons'])) { |
|
| 311 | + $values = $form_state['values']; |
|
| 312 | + if (isset($values['buttons'])) { |
|
| 313 | 313 | // Store only enabled buttons for each plugin. |
| 314 | 314 | foreach ($values['buttons'] as $plugin => $buttons) { |
| 315 | - $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]); |
|
| 315 | + $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]); |
|
| 316 | 316 | } |
| 317 | 317 | // Store only enabled plugins. |
| 318 | 318 | $values['buttons'] = array_filter($values['buttons']); |
| 319 | - } |
|
| 320 | - // Remove any white-space from 'block_formats' setting, since editor |
|
| 321 | - // implementations rely on a comma-separated list to explode(). |
|
| 322 | - $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']); |
|
| 323 | - |
|
| 324 | - // Remove input format name. |
|
| 325 | - $format = $values['format']; |
|
| 326 | - $input_format = $values['input_format']; |
|
| 327 | - $editor = $values['editor']; |
|
| 328 | - unset($values['format'], $values['input_format'], $values['editor']); |
|
| 329 | - |
|
| 330 | - // Remove FAPI values. |
|
| 331 | - // @see system_settings_form_submit() |
|
| 332 | - unset($values['submit'], $values['form_id'], $values['op'], $values['form_token'], $values['form_build_id']); |
|
| 333 | - |
|
| 334 | - // Determine if this is an update. |
|
| 335 | - if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) { |
|
| 319 | + } |
|
| 320 | + // Remove any white-space from 'block_formats' setting, since editor |
|
| 321 | + // implementations rely on a comma-separated list to explode(). |
|
| 322 | + $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']); |
|
| 323 | + |
|
| 324 | + // Remove input format name. |
|
| 325 | + $format = $values['format']; |
|
| 326 | + $input_format = $values['input_format']; |
|
| 327 | + $editor = $values['editor']; |
|
| 328 | + unset($values['format'], $values['input_format'], $values['editor']); |
|
| 329 | + |
|
| 330 | + // Remove FAPI values. |
|
| 331 | + // @see system_settings_form_submit() |
|
| 332 | + unset($values['submit'], $values['form_id'], $values['op'], $values['form_token'], $values['form_build_id']); |
|
| 333 | + |
|
| 334 | + // Determine if this is an update. |
|
| 335 | + if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) { |
|
| 336 | 336 | $update = array(); |
| 337 | - } |
|
| 338 | - else { |
|
| 337 | + } |
|
| 338 | + else { |
|
| 339 | 339 | $update = array('format'); |
| 340 | - } |
|
| 341 | - $wysiwyg = new stdClass(); |
|
| 342 | - $wysiwyg->format = $format; |
|
| 343 | - $wysiwyg->editor = $editor; |
|
| 344 | - $wysiwyg->settings = $values; |
|
| 340 | + } |
|
| 341 | + $wysiwyg = new stdClass(); |
|
| 342 | + $wysiwyg->format = $format; |
|
| 343 | + $wysiwyg->editor = $editor; |
|
| 344 | + $wysiwyg->settings = $values; |
|
| 345 | 345 | |
| 346 | - // Insert new profile data. |
|
| 347 | - drupal_write_record('wysiwyg', $wysiwyg, $update); |
|
| 346 | + // Insert new profile data. |
|
| 347 | + drupal_write_record('wysiwyg', $wysiwyg, $update); |
|
| 348 | 348 | |
| 349 | - drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format))); |
|
| 349 | + drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format))); |
|
| 350 | 350 | |
| 351 | - $form_state['redirect'] = 'admin/settings/wysiwyg'; |
|
| 351 | + $form_state['redirect'] = 'admin/settings/wysiwyg'; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | 355 | * Layout for the buttons in the Wysiwyg Editor profile form. |
| 356 | 356 | */ |
| 357 | 357 | function theme_wysiwyg_admin_button_table($form) { |
| 358 | - $buttons = array(); |
|
| 358 | + $buttons = array(); |
|
| 359 | 359 | |
| 360 | - // Flatten forms array. |
|
| 361 | - foreach (element_children($form) as $name) { |
|
| 360 | + // Flatten forms array. |
|
| 361 | + foreach (element_children($form) as $name) { |
|
| 362 | 362 | foreach (element_children($form[$name]) as $button) { |
| 363 | - $buttons[] = drupal_render($form[$name][$button]); |
|
| 363 | + $buttons[] = drupal_render($form[$name][$button]); |
|
| 364 | + } |
|
| 364 | 365 | } |
| 365 | - } |
|
| 366 | 366 | |
| 367 | - // Split checkboxes into rows with 3 columns. |
|
| 368 | - $total = count($buttons); |
|
| 369 | - $rows = array(); |
|
| 370 | - for ($i = 0; $i < $total; $i++) { |
|
| 367 | + // Split checkboxes into rows with 3 columns. |
|
| 368 | + $total = count($buttons); |
|
| 369 | + $rows = array(); |
|
| 370 | + for ($i = 0; $i < $total; $i++) { |
|
| 371 | 371 | $row = array(); |
| 372 | 372 | $row[] = array('data' => $buttons[$i]); |
| 373 | 373 | if (isset($buttons[++$i])) { |
| 374 | - $row[] = array('data' => $buttons[$i]); |
|
| 374 | + $row[] = array('data' => $buttons[$i]); |
|
| 375 | 375 | } |
| 376 | 376 | if (isset($buttons[++$i])) { |
| 377 | - $row[] = array('data' => $buttons[$i]); |
|
| 377 | + $row[] = array('data' => $buttons[$i]); |
|
| 378 | 378 | } |
| 379 | 379 | $rows[] = $row; |
| 380 | - } |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | - $output = theme('table', array(), $rows, array('width' => '100%')); |
|
| 382 | + $output = theme('table', array(), $rows, array('width' => '100%')); |
|
| 383 | 383 | |
| 384 | - return $output; |
|
| 384 | + return $output; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
| 388 | 388 | * Display overview of setup Wysiwyg Editor profiles; menu callback. |
| 389 | 389 | */ |
| 390 | 390 | function wysiwyg_profile_overview() { |
| 391 | - include_once './includes/install.inc'; |
|
| 391 | + include_once './includes/install.inc'; |
|
| 392 | 392 | |
| 393 | - // Check which wysiwyg editors are installed. |
|
| 394 | - $editors = wysiwyg_get_all_editors(); |
|
| 395 | - $count = count($editors); |
|
| 396 | - $status = array(); |
|
| 397 | - $options = array('' => t('No editor')); |
|
| 393 | + // Check which wysiwyg editors are installed. |
|
| 394 | + $editors = wysiwyg_get_all_editors(); |
|
| 395 | + $count = count($editors); |
|
| 396 | + $status = array(); |
|
| 397 | + $options = array('' => t('No editor')); |
|
| 398 | 398 | |
| 399 | - foreach ($editors as $name => $editor) { |
|
| 399 | + foreach ($editors as $name => $editor) { |
|
| 400 | 400 | $status[$name] = array( |
| 401 | - 'severity' => (isset($editor['error']) ? REQUIREMENT_ERROR : ($editor['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO)), |
|
| 402 | - 'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array('!vendor-url' => $editor['vendor url'], '@editor' => $editor['title'], '!download-url' => $editor['download url'])), |
|
| 403 | - 'value' => (isset($editor['installed version']) ? $editor['installed version'] : t('Not installed.')), |
|
| 404 | - 'description' => (isset($editor['error']) ? $editor['error'] : ''), |
|
| 401 | + 'severity' => (isset($editor['error']) ? REQUIREMENT_ERROR : ($editor['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO)), |
|
| 402 | + 'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array('!vendor-url' => $editor['vendor url'], '@editor' => $editor['title'], '!download-url' => $editor['download url'])), |
|
| 403 | + 'value' => (isset($editor['installed version']) ? $editor['installed version'] : t('Not installed.')), |
|
| 404 | + 'description' => (isset($editor['error']) ? $editor['error'] : ''), |
|
| 405 | 405 | ); |
| 406 | 406 | if ($editor['installed']) { |
| 407 | - $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : ''); |
|
| 407 | + $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : ''); |
|
| 408 | 408 | } |
| 409 | 409 | else { |
| 410 | - // Build on-site installation instructions. |
|
| 411 | - // @todo Setup $library in wysiwyg_load_editor() already. |
|
| 412 | - $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
|
| 413 | - $targs = array( |
|
| 410 | + // Build on-site installation instructions. |
|
| 411 | + // @todo Setup $library in wysiwyg_load_editor() already. |
|
| 412 | + $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
|
| 413 | + $targs = array( |
|
| 414 | 414 | '@editor-path' => $editor['editor path'], |
| 415 | 415 | '@library-filepath' => $editor['library path'] . '/' . (isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])), |
| 416 | - ); |
|
| 417 | - $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>'; |
|
| 418 | - $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>'; |
|
| 416 | + ); |
|
| 417 | + $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>'; |
|
| 418 | + $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>'; |
|
| 419 | 419 | |
| 420 | - $status[$name]['description'] .= $instructions; |
|
| 421 | - $count--; |
|
| 420 | + $status[$name]['description'] .= $instructions; |
|
| 421 | + $count--; |
|
| 422 | 422 | } |
| 423 | 423 | // In case there is an error, always show installation instructions. |
| 424 | 424 | if (isset($editor['error'])) { |
| 425 | - $show_instructions = TRUE; |
|
| 425 | + $show_instructions = TRUE; |
|
| 426 | + } |
|
| 426 | 427 | } |
| 427 | - } |
|
| 428 | - if (!$count) { |
|
| 428 | + if (!$count) { |
|
| 429 | 429 | $show_instructions = TRUE; |
| 430 | - } |
|
| 431 | - $form['status'] = array( |
|
| 430 | + } |
|
| 431 | + $form['status'] = array( |
|
| 432 | 432 | '#type' => 'fieldset', |
| 433 | 433 | '#title' => t('Installation instructions'), |
| 434 | 434 | '#collapsible' => TRUE, |
| 435 | 435 | '#collapsed' => !isset($show_instructions), |
| 436 | 436 | '#description' => (!$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : ''), |
| 437 | 437 | '#weight' => 10, |
| 438 | - ); |
|
| 439 | - $form['status']['report'] = array('#value' => theme('status_report', $status)); |
|
| 438 | + ); |
|
| 439 | + $form['status']['report'] = array('#value' => theme('status_report', $status)); |
|
| 440 | 440 | |
| 441 | - if (!$count) { |
|
| 441 | + if (!$count) { |
|
| 442 | 442 | return $form; |
| 443 | - } |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - $formats = filter_formats(); |
|
| 446 | - // Reset Wysiwyg cache |
|
| 447 | - $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 448 | - $form['formats'] = array( |
|
| 445 | + $formats = filter_formats(); |
|
| 446 | + // Reset Wysiwyg cache |
|
| 447 | + $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 448 | + $form['formats'] = array( |
|
| 449 | 449 | '#type' => 'item', |
| 450 | 450 | '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'), |
| 451 | 451 | '#tree' => TRUE, |
| 452 | - ); |
|
| 452 | + ); |
|
| 453 | 453 | |
| 454 | - $enable_save = FALSE; |
|
| 455 | - $in_code_only = FALSE; |
|
| 456 | - foreach ($formats as $id => $format) { |
|
| 454 | + $enable_save = FALSE; |
|
| 455 | + $in_code_only = FALSE; |
|
| 456 | + foreach ($formats as $id => $format) { |
|
| 457 | 457 | $form['formats'][$id]['name'] = array( |
| 458 | - '#value' => check_plain($format->name), |
|
| 458 | + '#value' => check_plain($format->name), |
|
| 459 | 459 | ); |
| 460 | 460 | // Only display editor selection for associated input formats to avoid |
| 461 | 461 | // confusion about disabled selection. |
| 462 | 462 | if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) { |
| 463 | - $in_code_only = !empty($profiles[$id]->in_code_only); |
|
| 464 | - $form['formats'][$id]['editor'] = array( |
|
| 463 | + $in_code_only = !empty($profiles[$id]->in_code_only); |
|
| 464 | + $form['formats'][$id]['editor'] = array( |
|
| 465 | 465 | '#value' => $options[$profiles[$id]->editor], |
| 466 | - ); |
|
| 467 | - if ($in_code_only) { |
|
| 466 | + ); |
|
| 467 | + if ($in_code_only) { |
|
| 468 | 468 | $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>'; |
| 469 | - } |
|
| 469 | + } |
|
| 470 | 470 | } |
| 471 | 471 | else { |
| 472 | - $form['formats'][$id]['editor'] = array( |
|
| 472 | + $form['formats'][$id]['editor'] = array( |
|
| 473 | 473 | '#type' => 'select', |
| 474 | 474 | '#default_value' => '', |
| 475 | 475 | '#options' => $options, |
| 476 | - ); |
|
| 477 | - $enable_save = TRUE; |
|
| 476 | + ); |
|
| 477 | + $enable_save = TRUE; |
|
| 478 | 478 | } |
| 479 | 479 | if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) { |
| 480 | - $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit'); |
|
| 481 | - $form['formats'][$id]['edit'] = array( |
|
| 480 | + $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit'); |
|
| 481 | + $form['formats'][$id]['edit'] = array( |
|
| 482 | 482 | '#value' => l($edit, "admin/settings/wysiwyg/profile/$id/edit"), |
| 483 | - ); |
|
| 484 | - // Only display delete/revert links for wysiwyg loaded from the database |
|
| 485 | - if (!$in_code_only) { |
|
| 483 | + ); |
|
| 484 | + // Only display delete/revert links for wysiwyg loaded from the database |
|
| 485 | + if (!$in_code_only) { |
|
| 486 | 486 | $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal'))?t('Delete'):t('Revert'); |
| 487 | 487 | $form['formats'][$id]['delete'] = array( |
| 488 | - '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"), |
|
| 488 | + '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"), |
|
| 489 | 489 | ); |
| 490 | - } |
|
| 490 | + } |
|
| 491 | + } |
|
| 491 | 492 | } |
| 492 | - } |
|
| 493 | 493 | |
| 494 | - // Submitting the form when no editors can be selected causes errors. |
|
| 495 | - if ($enable_save) { |
|
| 494 | + // Submitting the form when no editors can be selected causes errors. |
|
| 495 | + if ($enable_save) { |
|
| 496 | 496 | $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); |
| 497 | - } |
|
| 498 | - return $form; |
|
| 497 | + } |
|
| 498 | + return $form; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
| 502 | 502 | * Return HTML for the Wysiwyg profile overview form. |
| 503 | 503 | */ |
| 504 | 504 | function theme_wysiwyg_profile_overview($form) { |
| 505 | - if (!isset($form['formats'])) { |
|
| 505 | + if (!isset($form['formats'])) { |
|
| 506 | 506 | return; |
| 507 | - } |
|
| 508 | - $output = ''; |
|
| 509 | - $header = array(t('Input format'), t('Editor'), array('data' => t('Operations'), 'colspan' => 3)); |
|
| 510 | - $rows = array(); |
|
| 511 | - foreach (element_children($form['formats']) as $item) { |
|
| 507 | + } |
|
| 508 | + $output = ''; |
|
| 509 | + $header = array(t('Input format'), t('Editor'), array('data' => t('Operations'), 'colspan' => 3)); |
|
| 510 | + $rows = array(); |
|
| 511 | + foreach (element_children($form['formats']) as $item) { |
|
| 512 | 512 | $format = &$form['formats'][$item]; |
| 513 | 513 | $rows[] = array( |
| 514 | - drupal_render($format['name']), |
|
| 515 | - drupal_render($format['editor']), |
|
| 516 | - isset($format['edit']) ? drupal_render($format['edit']) : '', |
|
| 517 | - isset($format['export']) ? drupal_render($format['export']) : '', |
|
| 518 | - isset($format['delete']) ? drupal_render($format['delete']) : '', |
|
| 519 | - ); |
|
| 520 | - } |
|
| 521 | - $form['formats']['table']['#value'] = theme('table', $header, $rows); |
|
| 522 | - $output .= drupal_render($form); |
|
| 523 | - return $output; |
|
| 514 | + drupal_render($format['name']), |
|
| 515 | + drupal_render($format['editor']), |
|
| 516 | + isset($format['edit']) ? drupal_render($format['edit']) : '', |
|
| 517 | + isset($format['export']) ? drupal_render($format['export']) : '', |
|
| 518 | + isset($format['delete']) ? drupal_render($format['delete']) : '', |
|
| 519 | + ); |
|
| 520 | + } |
|
| 521 | + $form['formats']['table']['#value'] = theme('table', $header, $rows); |
|
| 522 | + $output .= drupal_render($form); |
|
| 523 | + return $output; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
| 527 | 527 | * Submit callback for Wysiwyg profile overview form. |
| 528 | 528 | */ |
| 529 | 529 | function wysiwyg_profile_overview_submit($form, &$form_state) { |
| 530 | - foreach ($form_state['values']['formats'] as $format => $values) { |
|
| 530 | + foreach ($form_state['values']['formats'] as $format => $values) { |
|
| 531 | 531 | db_query("UPDATE {wysiwyg} SET editor = '%s' WHERE format = %d", $values['editor'], $format); |
| 532 | 532 | if (!db_affected_rows()) { |
| 533 | - db_query("INSERT INTO {wysiwyg} (format, editor) VALUES (%d, '%s')", $format, $values['editor']); |
|
| 533 | + db_query("INSERT INTO {wysiwyg} (format, editor) VALUES (%d, '%s')", $format, $values['editor']); |
|
| 534 | + } |
|
| 534 | 535 | } |
| 535 | - } |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /** |
| 539 | 539 | * Delete editor profile confirmation form. |
| 540 | 540 | */ |
| 541 | 541 | function wysiwyg_profile_delete_confirm(&$form_state, $profile) { |
| 542 | - $formats = filter_formats(); |
|
| 543 | - $format = $formats[$profile->format]; |
|
| 544 | - $form['format'] = array('#type' => 'value', '#value' => $format); |
|
| 545 | - if (isset($profile->type) && $profile->type == t('Overridden')) { |
|
| 542 | + $formats = filter_formats(); |
|
| 543 | + $format = $formats[$profile->format]; |
|
| 544 | + $form['format'] = array('#type' => 'value', '#value' => $format); |
|
| 545 | + if (isset($profile->type) && $profile->type == t('Overridden')) { |
|
| 546 | 546 | $form['revert'] = array( |
| 547 | - '#type' => 'value', |
|
| 548 | - '#value' => TRUE, |
|
| 547 | + '#type' => 'value', |
|
| 548 | + '#value' => TRUE, |
|
| 549 | 549 | ); |
| 550 | 550 | return confirm_form( |
| 551 | - $form, |
|
| 552 | - t('Are you sure you want to revert the profile settings for %name?', array('%name' => $format->name)), |
|
| 553 | - 'admin/settings/wysiwyg', |
|
| 554 | - t('This action cannot be undone.'), t('Revert'), t('Cancel') |
|
| 551 | + $form, |
|
| 552 | + t('Are you sure you want to revert the profile settings for %name?', array('%name' => $format->name)), |
|
| 553 | + 'admin/settings/wysiwyg', |
|
| 554 | + t('This action cannot be undone.'), t('Revert'), t('Cancel') |
|
| 555 | 555 | ); |
| 556 | - } |
|
| 557 | - return confirm_form( |
|
| 556 | + } |
|
| 557 | + return confirm_form( |
|
| 558 | 558 | $form, |
| 559 | 559 | t('Are you sure you want to remove the profile for %name?', array('%name' => $format->name)), |
| 560 | 560 | 'admin/settings/wysiwyg', |
| 561 | 561 | t('This action cannot be undone.'), t('Remove'), t('Cancel') |
| 562 | - ); |
|
| 562 | + ); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -568,16 +568,16 @@ discard block |
||
| 568 | 568 | * @see wysiwyg_profile_delete_confirm() |
| 569 | 569 | */ |
| 570 | 570 | function wysiwyg_profile_delete_confirm_submit($form, &$form_state) { |
| 571 | - $format = $form_state['values']['format']; |
|
| 572 | - $wysiwyg = new stdClass(); |
|
| 573 | - $wysiwyg->format = $format->format; |
|
| 574 | - wysiwyg_profile_delete($wysiwyg); |
|
| 575 | - if (!empty($form_state['values']['revert'])) { |
|
| 571 | + $format = $form_state['values']['format']; |
|
| 572 | + $wysiwyg = new stdClass(); |
|
| 573 | + $wysiwyg->format = $format->format; |
|
| 574 | + wysiwyg_profile_delete($wysiwyg); |
|
| 575 | + if (!empty($form_state['values']['revert'])) { |
|
| 576 | 576 | drupal_set_message(t('Wysiwyg profile settings for %name has been reverted.', array('%name' => $format->name))); |
| 577 | - } |
|
| 578 | - else { |
|
| 577 | + } |
|
| 578 | + else { |
|
| 579 | 579 | drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name))); |
| 580 | - } |
|
| 581 | - $form_state['redirect'] = 'admin/settings/wysiwyg'; |
|
| 580 | + } |
|
| 581 | + $form_state['redirect'] = 'admin/settings/wysiwyg'; |
|
| 582 | 582 | } |
| 583 | 583 | |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | if (count($value) > 1) { |
| 103 | 103 | $tname = t($value[0]); |
| 104 | 104 | $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])"; |
| 105 | - } |
|
| 106 | - else { |
|
| 105 | + } else { |
|
| 107 | 106 | $predefined[$key] = t($value[0]); |
| 108 | 107 | } |
| 109 | 108 | } |
@@ -143,8 +142,7 @@ discard block |
||
| 143 | 142 | '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, |
| 144 | 143 | ); |
| 145 | 144 | } |
| 146 | - } |
|
| 147 | - else if (isset($meta['extensions']) && is_array($meta['extensions'])) { |
|
| 145 | + } else if (isset($meta['extensions']) && is_array($meta['extensions'])) { |
|
| 148 | 146 | foreach ($meta['extensions'] as $extension => $title) { |
| 149 | 147 | $form['buttons'][$name][$extension] = array( |
| 150 | 148 | '#type' => 'checkbox', |
@@ -334,8 +332,7 @@ discard block |
||
| 334 | 332 | // Determine if this is an update. |
| 335 | 333 | if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) { |
| 336 | 334 | $update = array(); |
| 337 | - } |
|
| 338 | - else { |
|
| 335 | + } else { |
|
| 339 | 336 | $update = array('format'); |
| 340 | 337 | } |
| 341 | 338 | $wysiwyg = new stdClass(); |
@@ -405,8 +402,7 @@ discard block |
||
| 405 | 402 | ); |
| 406 | 403 | if ($editor['installed']) { |
| 407 | 404 | $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : ''); |
| 408 | - } |
|
| 409 | - else { |
|
| 405 | + } else { |
|
| 410 | 406 | // Build on-site installation instructions. |
| 411 | 407 | // @todo Setup $library in wysiwyg_load_editor() already. |
| 412 | 408 | $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
@@ -467,8 +463,7 @@ discard block |
||
| 467 | 463 | if ($in_code_only) { |
| 468 | 464 | $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>'; |
| 469 | 465 | } |
| 470 | - } |
|
| 471 | - else { |
|
| 466 | + } else { |
|
| 472 | 467 | $form['formats'][$id]['editor'] = array( |
| 473 | 468 | '#type' => 'select', |
| 474 | 469 | '#default_value' => '', |
@@ -574,8 +569,7 @@ discard block |
||
| 574 | 569 | wysiwyg_profile_delete($wysiwyg); |
| 575 | 570 | if (!empty($form_state['values']['revert'])) { |
| 576 | 571 | drupal_set_message(t('Wysiwyg profile settings for %name has been reverted.', array('%name' => $format->name))); |
| 577 | - } |
|
| 578 | - else { |
|
| 572 | + } else { |
|
| 579 | 573 | drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name))); |
| 580 | 574 | } |
| 581 | 575 | $form_state['redirect'] = 'admin/settings/wysiwyg'; |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | $profile['settings'] = array(); |
| 20 | 20 | } |
| 21 | 21 | $profile['settings'] += array( |
| 22 | - 'default' => TRUE, |
|
| 23 | - 'user_choose' => FALSE, |
|
| 24 | - 'show_toggle' => TRUE, |
|
| 22 | + 'default' => true, |
|
| 23 | + 'user_choose' => false, |
|
| 24 | + 'show_toggle' => true, |
|
| 25 | 25 | 'theme' => 'advanced', |
| 26 | 26 | 'language' => 'en', |
| 27 | 27 | 'access' => 1, |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | 'toolbar_loc' => 'top', |
| 31 | 31 | 'toolbar_align' => 'left', |
| 32 | 32 | 'path_loc' => 'bottom', |
| 33 | - 'resizing' => TRUE, |
|
| 33 | + 'resizing' => true, |
|
| 34 | 34 | // Also available, but buggy in TinyMCE 2.x: blockquote,code,dt,dd,samp. |
| 35 | 35 | 'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div', |
| 36 | - 'verify_html' => TRUE, |
|
| 37 | - 'preformatted' => FALSE, |
|
| 38 | - 'convert_fonts_to_spans' => TRUE, |
|
| 39 | - 'remove_linebreaks' => TRUE, |
|
| 40 | - 'apply_source_formatting' => FALSE, |
|
| 41 | - 'paste_auto_cleanup_on_paste' => FALSE, |
|
| 36 | + 'verify_html' => true, |
|
| 37 | + 'preformatted' => false, |
|
| 38 | + 'convert_fonts_to_spans' => true, |
|
| 39 | + 'remove_linebreaks' => true, |
|
| 40 | + 'apply_source_formatting' => false, |
|
| 41 | + 'paste_auto_cleanup_on_paste' => false, |
|
| 42 | 42 | 'css_setting' => 'theme', |
| 43 | - 'css_path' => NULL, |
|
| 44 | - 'css_classes' => NULL, |
|
| 43 | + 'css_path' => null, |
|
| 44 | + 'css_classes' => null, |
|
| 45 | 45 | ); |
| 46 | 46 | $profile = (object) $profile; |
| 47 | 47 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | $form['basic'] = array( |
| 57 | 57 | '#type' => 'fieldset', |
| 58 | 58 | '#title' => t('Basic setup'), |
| 59 | - '#collapsible' => TRUE, |
|
| 60 | - '#collapsed' => TRUE, |
|
| 59 | + '#collapsible' => true, |
|
| 60 | + '#collapsed' => true, |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | $form['basic']['default'] = array( |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | $form['buttons'] = array( |
| 114 | 114 | '#type' => 'fieldset', |
| 115 | 115 | '#title' => t('Buttons and plugins'), |
| 116 | - '#collapsible' => TRUE, |
|
| 117 | - '#collapsed' => TRUE, |
|
| 118 | - '#tree' => TRUE, |
|
| 116 | + '#collapsible' => true, |
|
| 117 | + '#collapsed' => true, |
|
| 118 | + '#tree' => true, |
|
| 119 | 119 | '#theme' => 'wysiwyg_admin_button_table', |
| 120 | 120 | ); |
| 121 | 121 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $form['buttons'][$name][$button] = array( |
| 141 | 141 | '#type' => 'checkbox', |
| 142 | 142 | '#title' => $title, |
| 143 | - '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, |
|
| 143 | + '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : false, |
|
| 144 | 144 | ); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $form['buttons'][$name][$extension] = array( |
| 150 | 150 | '#type' => 'checkbox', |
| 151 | 151 | '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title, |
| 152 | - '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE, |
|
| 152 | + '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : false, |
|
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $form['appearance'] = array( |
| 159 | 159 | '#type' => 'fieldset', |
| 160 | 160 | '#title' => t('Editor appearance'), |
| 161 | - '#collapsible' => TRUE, |
|
| 162 | - '#collapsed' => TRUE, |
|
| 161 | + '#collapsible' => true, |
|
| 162 | + '#collapsed' => true, |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | $form['appearance']['toolbar_loc'] = array( |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | $form['output'] = array( |
| 198 | 198 | '#type' => 'fieldset', |
| 199 | 199 | '#title' => t('Cleanup and output'), |
| 200 | - '#collapsible' => TRUE, |
|
| 201 | - '#collapsed' => TRUE, |
|
| 200 | + '#collapsible' => true, |
|
| 201 | + '#collapsed' => true, |
|
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | 204 | $form['output']['verify_html'] = array( |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | $form['css'] = array( |
| 253 | 253 | '#type' => 'fieldset', |
| 254 | 254 | '#title' => t('CSS'), |
| 255 | - '#collapsible' => TRUE, |
|
| 256 | - '#collapsed' => TRUE, |
|
| 255 | + '#collapsible' => true, |
|
| 256 | + '#collapsed' => true, |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | 259 | $form['css']['block_formats'] = array( |
@@ -422,16 +422,16 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | // In case there is an error, always show installation instructions. |
| 424 | 424 | if (isset($editor['error'])) { |
| 425 | - $show_instructions = TRUE; |
|
| 425 | + $show_instructions = true; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | if (!$count) { |
| 429 | - $show_instructions = TRUE; |
|
| 429 | + $show_instructions = true; |
|
| 430 | 430 | } |
| 431 | 431 | $form['status'] = array( |
| 432 | 432 | '#type' => 'fieldset', |
| 433 | 433 | '#title' => t('Installation instructions'), |
| 434 | - '#collapsible' => TRUE, |
|
| 434 | + '#collapsible' => true, |
|
| 435 | 435 | '#collapsed' => !isset($show_instructions), |
| 436 | 436 | '#description' => (!$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : ''), |
| 437 | 437 | '#weight' => 10, |
@@ -444,15 +444,15 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | $formats = filter_formats(); |
| 446 | 446 | // Reset Wysiwyg cache |
| 447 | - $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 447 | + $profiles = wysiwyg_profile_load_all(true); |
|
| 448 | 448 | $form['formats'] = array( |
| 449 | 449 | '#type' => 'item', |
| 450 | 450 | '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'), |
| 451 | - '#tree' => TRUE, |
|
| 451 | + '#tree' => true, |
|
| 452 | 452 | ); |
| 453 | 453 | |
| 454 | - $enable_save = FALSE; |
|
| 455 | - $in_code_only = FALSE; |
|
| 454 | + $enable_save = false; |
|
| 455 | + $in_code_only = false; |
|
| 456 | 456 | foreach ($formats as $id => $format) { |
| 457 | 457 | $form['formats'][$id]['name'] = array( |
| 458 | 458 | '#value' => check_plain($format->name), |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | '#default_value' => '', |
| 475 | 475 | '#options' => $options, |
| 476 | 476 | ); |
| 477 | - $enable_save = TRUE; |
|
| 477 | + $enable_save = true; |
|
| 478 | 478 | } |
| 479 | 479 | if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) { |
| 480 | 480 | $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit'); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | if (isset($profile->type) && $profile->type == t('Overridden')) { |
| 546 | 546 | $form['revert'] = array( |
| 547 | 547 | '#type' => 'value', |
| 548 | - '#value' => TRUE, |
|
| 548 | + '#value' => true, |
|
| 549 | 549 | ); |
| 550 | 550 | return confirm_form( |
| 551 | 551 | $form, |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_profile_form($form_state, $profile) { |
| 12 | 12 | // Merge in defaults. |
| 13 | - $profile = (array) $profile; |
|
| 13 | + $profile = (array)$profile; |
|
| 14 | 14 | $profile += array( |
| 15 | 15 | 'format' => 0, |
| 16 | 16 | 'editor' => '', |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'css_path' => NULL, |
| 44 | 44 | 'css_classes' => NULL, |
| 45 | 45 | ); |
| 46 | - $profile = (object) $profile; |
|
| 46 | + $profile = (object)$profile; |
|
| 47 | 47 | |
| 48 | 48 | $formats = filter_formats(); |
| 49 | 49 | $editor = wysiwyg_get_editor($profile->editor); |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | if (!empty($meta['path'])) { |
| 129 | 129 | // @todo Button icon locations are different in editors, editor versions, |
| 130 | 130 | // and contrib/custom plugins (like Image Assist, f.e.). |
| 131 | - $img_src = $meta['path'] . "/images/$name.gif"; |
|
| 131 | + $img_src = $meta['path']."/images/$name.gif"; |
|
| 132 | 132 | // Handle plugins that have more than one button. |
| 133 | 133 | if (!file_exists($img_src)) { |
| 134 | - $img_src = $meta['path'] . "/images/$button.gif"; |
|
| 134 | + $img_src = $meta['path']."/images/$button.gif"; |
|
| 135 | 135 | } |
| 136 | - $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : ''; |
|
| 136 | + $icon = file_exists($img_src) ? '<img src="'.base_path().$img_src.'" title="'.$button.'" style="border: 1px solid grey; vertical-align: middle;" />' : ''; |
|
| 137 | 137 | } |
| 138 | 138 | $title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title); |
| 139 | - $title = (!empty($icon) ? $icon . ' ' . $title : $title); |
|
| 139 | + $title = (!empty($icon) ? $icon.' '.$title : $title); |
|
| 140 | 140 | $form['buttons'][$name][$button] = array( |
| 141 | 141 | '#type' => 'checkbox', |
| 142 | 142 | '#title' => $title, |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | '#default_value' => $profile->settings['css_path'], |
| 280 | 280 | '#size' => 40, |
| 281 | 281 | '#maxlength' => 255, |
| 282 | - '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.') . '<br />' . t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)') . '<br />' . t('Example:') . ' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css', |
|
| 282 | + '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.').'<br />'.t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)').'<br />'.t('Example:').' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css', |
|
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | 285 | $form['css']['css_classes'] = array( |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | 'description' => (isset($editor['error']) ? $editor['error'] : ''), |
| 405 | 405 | ); |
| 406 | 406 | if ($editor['installed']) { |
| 407 | - $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : ''); |
|
| 407 | + $options[$name] = $editor['title'].(isset($editor['installed version']) ? ' '.$editor['installed version'] : ''); |
|
| 408 | 408 | } |
| 409 | 409 | else { |
| 410 | 410 | // Build on-site installation instructions. |
@@ -412,10 +412,10 @@ discard block |
||
| 412 | 412 | $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
| 413 | 413 | $targs = array( |
| 414 | 414 | '@editor-path' => $editor['editor path'], |
| 415 | - '@library-filepath' => $editor['library path'] . '/' . (isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])), |
|
| 415 | + '@library-filepath' => $editor['library path'].'/'.(isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])), |
|
| 416 | 416 | ); |
| 417 | - $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>'; |
|
| 418 | - $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>'; |
|
| 417 | + $instructions = '<p>'.t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs).'</p>'; |
|
| 418 | + $instructions .= '<p>'.t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs).'</p>'; |
|
| 419 | 419 | |
| 420 | 420 | $status[$name]['description'] .= $instructions; |
| 421 | 421 | $count--; |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | '#value' => $options[$profiles[$id]->editor], |
| 466 | 466 | ); |
| 467 | 467 | if ($in_code_only) { |
| 468 | - $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>'; |
|
| 468 | + $form['formats'][$id]['name']['#value'] .= ' <em>('.t('From: !module module', array('!module' => $profiles[$id]->export_module)).')</em>'; |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | else { |
@@ -477,13 +477,13 @@ discard block |
||
| 477 | 477 | $enable_save = TRUE; |
| 478 | 478 | } |
| 479 | 479 | if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) { |
| 480 | - $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit'); |
|
| 480 | + $edit = !empty($profiles[$id]->in_code_only) ?t('Override') : t('Edit'); |
|
| 481 | 481 | $form['formats'][$id]['edit'] = array( |
| 482 | 482 | '#value' => l($edit, "admin/settings/wysiwyg/profile/$id/edit"), |
| 483 | 483 | ); |
| 484 | 484 | // Only display delete/revert links for wysiwyg loaded from the database |
| 485 | 485 | if (!$in_code_only) { |
| 486 | - $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal'))?t('Delete'):t('Revert'); |
|
| 486 | + $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal')) ?t('Delete') : t('Revert'); |
|
| 487 | 487 | $form['formats'][$id]['delete'] = array( |
| 488 | 488 | '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"), |
| 489 | 489 | ); |
@@ -9,13 +9,13 @@ |
||
| 9 | 9 | * Implementation of hook_wysiwyg_plugin(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_break_plugin() { |
| 12 | - $plugins['break'] = array( |
|
| 12 | + $plugins['break'] = array( |
|
| 13 | 13 | 'title' => t('Teaser break'), |
| 14 | 14 | 'vendor url' => 'http://drupal.org/project/wysiwyg', |
| 15 | 15 | 'icon file' => 'break.gif', |
| 16 | 16 | 'icon title' => t('Separate the teaser and body of this content'), |
| 17 | 17 | 'settings' => array(), |
| 18 | - ); |
|
| 19 | - return $plugins; |
|
| 18 | + ); |
|
| 19 | + return $plugins; |
|
| 20 | 20 | } |
| 21 | 21 | |
@@ -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 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * The installed editor version. |
| 47 | 47 | */ |
| 48 | 48 | function wysiwyg_jwysiwyg_version($editor) { |
| 49 | - $script = $editor['library path'] . '/jquery.wysiwyg.js'; |
|
| 49 | + $script = $editor['library path'].'/jquery.wysiwyg.js'; |
|
| 50 | 50 | if (!file_exists($script)) { |
| 51 | 51 | return; |
| 52 | 52 | } |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * The installed editor version. |
| 51 | 51 | */ |
| 52 | 52 | function wysiwyg_fckeditor_version($editor) { |
| 53 | - $library = $editor['library path'] . '/fckeditor.js'; |
|
| 53 | + $library = $editor['library path'].'/fckeditor.js'; |
|
| 54 | 54 | if (!file_exists($library)) { |
| 55 | 55 | return; |
| 56 | 56 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | function wysiwyg_fckeditor_settings($editor, $config, $theme) { |
| 100 | 100 | $settings = array( |
| 101 | - 'EditorPath' => base_path() . $editor['library path'] . '/', |
|
| 102 | - 'SkinPath' => base_path() . $editor['library path'] . '/editor/skins/' . $theme . '/', |
|
| 103 | - 'CustomConfigurationsPath' => base_path() . drupal_get_path('module', 'wysiwyg') . '/editors/js/fckeditor.config.js', |
|
| 101 | + 'EditorPath' => base_path().$editor['library path'].'/', |
|
| 102 | + 'SkinPath' => base_path().$editor['library path'].'/editor/skins/'.$theme.'/', |
|
| 103 | + 'CustomConfigurationsPath' => base_path().drupal_get_path('module', 'wysiwyg').'/editors/js/fckeditor.config.js', |
|
| 104 | 104 | 'Width' => '100%', |
| 105 | 105 | 'Height' => 420, |
| 106 | 106 | 'LinkBrowser' => FALSE, |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | // Add path for native external plugins; internal ones do not need a path. |
| 181 | 181 | if (empty($plugin['internal']) && isset($plugin['path'])) { |
| 182 | 182 | // All native FCKeditor plugins use the filename fckplugin.js. |
| 183 | - $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; |
|
| 183 | + $settings[$name]['path'] = base_path().$plugin['path'].'/'; |
|
| 184 | 184 | } |
| 185 | 185 | if (!empty($plugin['languages'])) { |
| 186 | 186 | $settings[$name]['languages'] = $plugin['languages']; |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | // Populate required plugin settings. |
| 200 | 200 | $settings[$name] = $plugin['dialog settings'] + array( |
| 201 | 201 | 'title' => $plugin['title'], |
| 202 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 202 | + 'icon' => base_path().$plugin['icon path'].'/'.$plugin['icon file'], |
|
| 203 | 203 | 'iconTitle' => $plugin['icon title'], |
| 204 | 204 | // @todo These should only be set if the plugin defined them. |
| 205 | - 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 205 | + 'css' => base_path().$plugin['css path'].'/'.$plugin['css file'], |
|
| 206 | 206 | ); |
| 207 | 207 | } |
| 208 | 208 | return $settings; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | 'internal' => TRUE, |
| 245 | 245 | ), |
| 246 | 246 | 'autogrow' => array( |
| 247 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 247 | + 'path' => $editor['library path'].'/editor/plugins', |
|
| 248 | 248 | 'extensions' => array( |
| 249 | 249 | 'autogrow' => t('Autogrow'), |
| 250 | 250 | ), |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | 'load' => TRUE, |
| 256 | 256 | ), |
| 257 | 257 | 'bbcode' => array( |
| 258 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 258 | + 'path' => $editor['library path'].'/editor/plugins', |
|
| 259 | 259 | 'extensions' => array( |
| 260 | 260 | 'bbcode' => t('BBCode'), |
| 261 | 261 | ), |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | 'load' => TRUE, |
| 264 | 264 | ), |
| 265 | 265 | 'dragresizetable' => array( |
| 266 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 266 | + 'path' => $editor['library path'].'/editor/plugins', |
|
| 267 | 267 | 'extensions' => array( |
| 268 | 268 | 'dragresizetable' => t('Table drag/resize'), |
| 269 | 269 | ), |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | 'load' => TRUE, |
| 272 | 272 | ), |
| 273 | 273 | 'tablecommands' => array( |
| 274 | - 'path' => $editor['library path'] . '/editor/plugins', |
|
| 274 | + 'path' => $editor['library path'].'/editor/plugins', |
|
| 275 | 275 | 'buttons' => array( |
| 276 | 276 | 'TableCellProp' => t('Table: Cell properties'), |
| 277 | 277 | 'TableInsertRowAfter' => t('Table: Insert row after'), |
@@ -130,8 +130,7 @@ |
||
| 130 | 130 | if (isset($config['css_setting'])) { |
| 131 | 131 | if ($config['css_setting'] == 'theme') { |
| 132 | 132 | $settings['EditorAreaCSS'] = implode(',', wysiwyg_get_css()); |
| 133 | - } |
|
| 134 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 133 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 135 | 134 | $settings['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 136 | 135 | } |
| 137 | 136 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | 'plugin settings callback' => 'wysiwyg_fckeditor_plugin_settings', |
| 27 | 27 | 'proxy plugin' => array( |
| 28 | 28 | 'drupal' => array( |
| 29 | - 'load' => TRUE, |
|
| 30 | - 'proxy' => TRUE, |
|
| 29 | + 'load' => true, |
|
| 30 | + 'proxy' => true, |
|
| 31 | 31 | ), |
| 32 | 32 | ), |
| 33 | 33 | 'proxy plugin settings callback' => 'wysiwyg_fckeditor_proxy_plugin_settings', |
@@ -103,19 +103,19 @@ discard block |
||
| 103 | 103 | 'CustomConfigurationsPath' => base_path() . drupal_get_path('module', 'wysiwyg') . '/editors/js/fckeditor.config.js', |
| 104 | 104 | 'Width' => '100%', |
| 105 | 105 | 'Height' => 420, |
| 106 | - 'LinkBrowser' => FALSE, |
|
| 107 | - 'LinkUpload' => FALSE, |
|
| 108 | - 'ImageBrowser' => FALSE, |
|
| 109 | - 'ImageUpload' => FALSE, |
|
| 110 | - 'FlashBrowser' => FALSE, |
|
| 111 | - 'FlashUpload' => FALSE, |
|
| 106 | + 'LinkBrowser' => false, |
|
| 107 | + 'LinkUpload' => false, |
|
| 108 | + 'ImageBrowser' => false, |
|
| 109 | + 'ImageUpload' => false, |
|
| 110 | + 'FlashBrowser' => false, |
|
| 111 | + 'FlashUpload' => false, |
|
| 112 | 112 | // By default, FCKeditor converts most characters into HTML entities. Since |
| 113 | 113 | // it does not support a custom definition, but Drupal supports Unicode, we |
| 114 | 114 | // disable at least the additional character sets. FCKeditor always converts |
| 115 | 115 | // XML default characters '&', '<', '>'. |
| 116 | 116 | // @todo Check whether completely disabling ProcessHTMLEntities is an option. |
| 117 | - 'IncludeLatinEntities' => FALSE, |
|
| 118 | - 'IncludeGreekEntities' => FALSE, |
|
| 117 | + 'IncludeLatinEntities' => false, |
|
| 118 | + 'IncludeGreekEntities' => false, |
|
| 119 | 119 | ); |
| 120 | 120 | if (isset($config['block_formats'])) { |
| 121 | 121 | $settings['FontFormats'] = strtr($config['block_formats'], array(',' => ';')); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | 'FitWindow' => t('FitWindow'), |
| 242 | 242 | 'SpellCheck' => t('Check spelling'), |
| 243 | 243 | ), |
| 244 | - 'internal' => TRUE, |
|
| 244 | + 'internal' => true, |
|
| 245 | 245 | ), |
| 246 | 246 | 'autogrow' => array( |
| 247 | 247 | 'path' => $editor['library path'] . '/editor/plugins', |
@@ -251,24 +251,24 @@ discard block |
||
| 251 | 251 | 'options' => array( |
| 252 | 252 | 'AutoGrowMax' => 800, |
| 253 | 253 | ), |
| 254 | - 'internal' => TRUE, |
|
| 255 | - 'load' => TRUE, |
|
| 254 | + 'internal' => true, |
|
| 255 | + 'load' => true, |
|
| 256 | 256 | ), |
| 257 | 257 | 'bbcode' => array( |
| 258 | 258 | 'path' => $editor['library path'] . '/editor/plugins', |
| 259 | 259 | 'extensions' => array( |
| 260 | 260 | 'bbcode' => t('BBCode'), |
| 261 | 261 | ), |
| 262 | - 'internal' => TRUE, |
|
| 263 | - 'load' => TRUE, |
|
| 262 | + 'internal' => true, |
|
| 263 | + 'load' => true, |
|
| 264 | 264 | ), |
| 265 | 265 | 'dragresizetable' => array( |
| 266 | 266 | 'path' => $editor['library path'] . '/editor/plugins', |
| 267 | 267 | 'extensions' => array( |
| 268 | 268 | 'dragresizetable' => t('Table drag/resize'), |
| 269 | 269 | ), |
| 270 | - 'internal' => TRUE, |
|
| 271 | - 'load' => TRUE, |
|
| 270 | + 'internal' => true, |
|
| 271 | + 'load' => true, |
|
| 272 | 272 | ), |
| 273 | 273 | 'tablecommands' => array( |
| 274 | 274 | 'path' => $editor['library path'] . '/editor/plugins', |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | 'TableMergeCells' => t('Table: Merge cells'), |
| 284 | 284 | 'TableHorizontalSplitCell' => t('Table: Horizontal split cell'), |
| 285 | 285 | ), |
| 286 | - 'internal' => TRUE, |
|
| 287 | - 'load' => TRUE, |
|
| 286 | + 'internal' => true, |
|
| 287 | + 'load' => true, |
|
| 288 | 288 | ), |
| 289 | 289 | ); |
| 290 | 290 | return $plugins; |
@@ -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 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'title' => 'WYMeditor', |
| 14 | 14 | 'vendor url' => 'http://www.wymeditor.org/', |
| 15 | 15 | 'download url' => 'http://www.wymeditor.org/download/', |
| 16 | - 'library path' => wysiwyg_get_path('wymeditor') . '/wymeditor', |
|
| 16 | + 'library path' => wysiwyg_get_path('wymeditor').'/wymeditor', |
|
| 17 | 17 | 'libraries' => array( |
| 18 | 18 | 'min' => array( |
| 19 | 19 | 'title' => 'Minified', |
@@ -51,7 +51,7 @@ 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'; |
|
| 54 | + $script = $editor['library path'].'/jquery.wymeditor.js'; |
|
| 55 | 55 | if (!file_exists($script)) { |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | // @todo Setup $library in wysiwyg_load_editor() already. |
| 100 | 100 | $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
| 101 | 101 | $settings = array( |
| 102 | - 'basePath' => base_path() . $editor['library path'] . '/', |
|
| 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 | - 'jQueryPath' => base_path() . 'misc/jquery.js', |
|
| 105 | + 'jQueryPath' => base_path().'misc/jquery.js', |
|
| 106 | 106 | 'updateSelector' => '.form-submit', |
| 107 | 107 | 'skin' => $theme, |
| 108 | 108 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $settings['toolsItems'][] = array( |
| 137 | 137 | 'name' => $button, |
| 138 | 138 | 'title' => $plugins[$plugin][$type][$button], |
| 139 | - 'css' => 'wym_tools_' . $button, |
|
| 139 | + 'css' => 'wym_tools_'.$button, |
|
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $settings['containersItems'][] = array( |
| 164 | 164 | 'name' => strtoupper($tag), |
| 165 | 165 | 'title' => $containers[$tag], |
| 166 | - 'css' => 'wym_containers_' . $tag, |
|
| 166 | + 'css' => 'wym_containers_'.$tag, |
|
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -173,8 +173,7 @@ |
||
| 173 | 173 | if ($config['css_setting'] == 'theme') { |
| 174 | 174 | // WYMeditor only supports one CSS file currently. |
| 175 | 175 | $settings['stylesheet'] = reset(wysiwyg_get_css()); |
| 176 | - } |
|
| 177 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 176 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 178 | 177 | $settings['stylesheet'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 179 | 178 | } |
| 180 | 179 | } |
@@ -201,7 +201,7 @@ |
||
| 201 | 201 | 'InsertTable' => t('Table'), |
| 202 | 202 | 'Preview' => t('Preview'), |
| 203 | 203 | ), |
| 204 | - 'internal' => TRUE, |
|
| 204 | + 'internal' => true, |
|
| 205 | 205 | ), |
| 206 | 206 | ); |
| 207 | 207 | return $plugins; |
@@ -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 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * The installed editor version. |
| 59 | 59 | */ |
| 60 | 60 | function wysiwyg_ckeditor_version($editor) { |
| 61 | - $library = $editor['library path'] . '/ckeditor.js'; |
|
| 61 | + $library = $editor['library path'].'/ckeditor.js'; |
|
| 62 | 62 | if (!file_exists($library)) { |
| 63 | 63 | return; |
| 64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | fclose($library); |
| 73 | 73 | // Version numbers need to have three parts since 3.0.1. |
| 74 | 74 | $version[1] = preg_replace('/^(\d+)\.(\d+)$/', '${1}.${2}.0', $version[1]); |
| 75 | - return $version[1] . '.' . $version[2]; |
|
| 75 | + return $version[1].'.'.$version[2]; |
|
| 76 | 76 | } |
| 77 | 77 | $max_lines--; |
| 78 | 78 | } |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | function wysiwyg_ckeditor_themes($editor, $profile) { |
| 95 | 95 | // @todo Skins are not themes but this will do for now. |
| 96 | - $path = $editor['library path'] . '/skins/'; |
|
| 96 | + $path = $editor['library path'].'/skins/'; |
|
| 97 | 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 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | function wysiwyg_ckeditor_settings($editor, $config, $theme) { |
| 129 | 129 | $settings = array( |
| 130 | - 'baseHref' => $GLOBALS['base_url'] . '/', |
|
| 130 | + 'baseHref' => $GLOBALS['base_url'].'/', |
|
| 131 | 131 | 'width' => '100%', |
| 132 | 132 | // For better compatibility with smaller textareas. |
| 133 | 133 | 'resize_minWidth' => 450, |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | if (isset($config['resizing'])) { |
| 187 | 187 | // CKEditor tests "!== false", so ensure it is a Boolean. |
| 188 | - $settings['resize_enabled'] = (bool) $config['resizing']; |
|
| 188 | + $settings['resize_enabled'] = (bool)$config['resizing']; |
|
| 189 | 189 | } |
| 190 | 190 | if (isset($config['toolbar_loc'])) { |
| 191 | 191 | $settings['toolbarLocation'] = $config['toolbar_loc']; |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | $settings[$name] = array(); |
| 252 | 252 | // Add path for native external plugins. |
| 253 | 253 | if (empty($plugin['internal']) && isset($plugin['path'])) { |
| 254 | - $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; |
|
| 254 | + $settings[$name]['path'] = base_path().$plugin['path'].'/'; |
|
| 255 | 255 | } |
| 256 | 256 | // Force native internal plugins to use the standard path. |
| 257 | 257 | else { |
| 258 | - $settings[$name]['path'] = base_path() . $editor['library path'] . '/plugins/' . $name . '/'; |
|
| 258 | + $settings[$name]['path'] = base_path().$editor['library path'].'/plugins/'.$name.'/'; |
|
| 259 | 259 | } |
| 260 | 260 | // CKEditor defaults to 'plugin.js' on its own when filename is not set. |
| 261 | 261 | if (!empty($plugin['filename'])) { |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | // Populate required plugin settings. |
| 276 | 276 | $settings[$name] = $plugin['dialog settings'] + array( |
| 277 | 277 | 'title' => $plugin['title'], |
| 278 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 278 | + 'icon' => base_path().$plugin['icon path'].'/'.$plugin['icon file'], |
|
| 279 | 279 | 'iconTitle' => $plugin['icon title'], |
| 280 | 280 | // @todo These should only be set if the plugin defined them. |
| 281 | - 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], |
|
| 281 | + 'css' => base_path().$plugin['css path'].'/'.$plugin['css file'], |
|
| 282 | 282 | ); |
| 283 | 283 | } |
| 284 | 284 | return $settings; |
@@ -105,8 +105,7 @@ discard block |
||
| 105 | 105 | natcasesort($themes); |
| 106 | 106 | $themes = array_values($themes); |
| 107 | 107 | return !empty($themes) ? $themes : array('default'); |
| 108 | - } |
|
| 109 | - else { |
|
| 108 | + } else { |
|
| 110 | 109 | return array('default'); |
| 111 | 110 | } |
| 112 | 111 | } |
@@ -165,16 +164,13 @@ discard block |
||
| 165 | 164 | if (version_compare($editor['installed version'], '3.0.1.4391', '<')) { |
| 166 | 165 | if ($config['css_setting'] == 'theme') { |
| 167 | 166 | $settings['contentsCss'] = reset(wysiwyg_get_css()); |
| 168 | - } |
|
| 169 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 167 | + } elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 170 | 168 | $settings['contentsCss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 171 | 169 | } |
| 172 | - } |
|
| 173 | - else { |
|
| 170 | + } else { |
|
| 174 | 171 | if ($config['css_setting'] == 'theme') { |
| 175 | 172 | $settings['contentsCss'] = wysiwyg_get_css(); |
| 176 | - } |
|
| 177 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 173 | + } elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 178 | 174 | $settings['contentsCss'] = explode(',', strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()))); |
| 179 | 175 | } |
| 180 | 176 | } |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 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 | 22 | ), |
| 23 | 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 | ), |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | 'plugin settings callback' => 'wysiwyg_ckeditor_plugin_settings', |
| 35 | 35 | 'proxy plugin' => array( |
| 36 | 36 | 'drupal' => array( |
| 37 | - 'load' => TRUE, |
|
| 38 | - 'proxy' => TRUE, |
|
| 37 | + 'load' => true, |
|
| 38 | + 'proxy' => true, |
|
| 39 | 39 | ), |
| 40 | 40 | ), |
| 41 | 41 | 'proxy plugin settings callback' => 'wysiwyg_ckeditor_proxy_plugin_settings', |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | // disable at least the additional character sets. CKEditor always converts |
| 141 | 141 | // XML default characters '&', '<', '>'. |
| 142 | 142 | // @todo Check whether completely disabling ProcessHTMLEntities is an option. |
| 143 | - 'entities_latin' => FALSE, |
|
| 144 | - 'entities_greek' => FALSE, |
|
| 143 | + 'entities_latin' => false, |
|
| 144 | + 'entities_greek' => false, |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | // Add HTML block format settings; common block formats are already predefined |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'SpellChecker' => t('Check spelling'), 'Scayt' => t('Check spelling as you type'), |
| 319 | 319 | 'About' => t('About'), |
| 320 | 320 | ), |
| 321 | - 'internal' => TRUE, |
|
| 321 | + 'internal' => true, |
|
| 322 | 322 | ), |
| 323 | 323 | ); |
| 324 | 324 | |
@@ -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 | |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_markitup_version($editor) { |
| 50 | 50 | // Changelog was in markitup/markitup/readme.txt <= 1.1.5. |
| 51 | - $changelog = $editor['library path'] . '/markitup/readme.txt'; |
|
| 51 | + $changelog = $editor['library path'].'/markitup/readme.txt'; |
|
| 52 | 52 | if (!file_exists($changelog)) { |
| 53 | 53 | // Changelog was moved up to markitup/CHANGELOG.md after 1.1.5. |
| 54 | - $changelog = $editor['library path'] . '/CHANGELOG.md'; |
|
| 54 | + $changelog = $editor['library path'].'/CHANGELOG.md'; |
|
| 55 | 55 | if (!file_exists($changelog)) { |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | function wysiwyg_markitup_settings($editor, $config, $theme) { |
| 99 | 99 | // Whoever is guilty for adding this horrible CSS-file-without-filepath |
| 100 | 100 | // override "feature" to Drupal core... stand in the corner! |
| 101 | - drupal_add_css($editor['library path'] . '/markitup/skins/' . $theme . '/style.css', 'theme'); |
|
| 101 | + drupal_add_css($editor['library path'].'/markitup/skins/'.$theme.'/style.css', 'theme'); |
|
| 102 | 102 | |
| 103 | 103 | $settings = array( |
| 104 | - 'root' => base_path() . $editor['library path'] . '/markitup/', |
|
| 104 | + 'root' => base_path().$editor['library path'].'/markitup/', |
|
| 105 | 105 | 'nameSpace' => $theme, |
| 106 | 106 | 'markupSet' => array(), |
| 107 | 107 | ); |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | // 'cleanup' => t('Clean-up'), |
| 180 | 180 | 'preview' => t('Preview'), |
| 181 | 181 | ), |
| 182 | - 'internal' => TRUE, |
|
| 182 | + 'internal' => true, |
|
| 183 | 183 | ), |
| 184 | 184 | ); |
| 185 | 185 | } |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 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 | - 'library path' => wysiwyg_get_path('yui') . '/build', |
|
| 16 | + 'library path' => wysiwyg_get_path('yui').'/build', |
|
| 17 | 17 | 'libraries' => array( |
| 18 | 18 | 'min' => array( |
| 19 | 19 | 'title' => 'Minified', |
@@ -64,7 +64,7 @@ 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'; |
|
| 67 | + $library = $editor['library path'].'/editor/editor.js'; |
|
| 68 | 68 | if (!file_exists($library)) { |
| 69 | 69 | return; |
| 70 | 70 | } |
@@ -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 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 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 | |
@@ -176,8 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - } |
|
| 180 | - else if ($button == 'fontname') { |
|
| 179 | + } else if ($button == 'fontname') { |
|
| 181 | 180 | $extra = array('menu' => array( |
| 182 | 181 | array('text' => 'Arial', 'checked' => TRUE), |
| 183 | 182 | array('text' => 'Arial Black'), |
@@ -201,8 +200,7 @@ discard block |
||
| 201 | 200 | if (isset($config['css_setting'])) { |
| 202 | 201 | if ($config['css_setting'] == 'theme') { |
| 203 | 202 | $settings['extracss'] = wysiwyg_get_css(); |
| 204 | - } |
|
| 205 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 203 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 206 | 204 | $settings['extracss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 207 | 205 | $settings['extracss'] = explode(',', $settings['extracss']); |
| 208 | 206 | } |
@@ -249,11 +247,9 @@ discard block |
||
| 249 | 247 | if (in_array($button, array('heading', 'fontname'))) { |
| 250 | 248 | $type = 'select'; |
| 251 | 249 | $label = $extra['menu'][0]['text']; |
| 252 | - } |
|
| 253 | - elseif (in_array($button, array('fontsize'))) { |
|
| 250 | + } elseif (in_array($button, array('fontsize'))) { |
|
| 254 | 251 | $type = 'spin'; |
| 255 | - } |
|
| 256 | - elseif (in_array($button, array('forecolor', 'backcolor'))) { |
|
| 252 | + } elseif (in_array($button, array('forecolor', 'backcolor'))) { |
|
| 257 | 253 | $type = 'color'; |
| 258 | 254 | } |
| 259 | 255 | |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | function wysiwyg_yui_settings($editor, $config, $theme) { |
| 130 | 130 | $settings = array( |
| 131 | 131 | 'theme' => $theme, |
| 132 | - 'animate' => TRUE, |
|
| 133 | - 'handleSubmit' => TRUE, |
|
| 132 | + 'animate' => true, |
|
| 133 | + 'handleSubmit' => true, |
|
| 134 | 134 | 'markup' => 'xhtml', |
| 135 | - 'ptags' => TRUE, |
|
| 135 | + 'ptags' => true, |
|
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | 138 | if (isset($config['path_loc']) && $config['path_loc'] != 'none') { |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | // Enable auto-height feature when editor should be resizable. |
| 142 | 142 | if (!empty($config['resizing'])) { |
| 143 | - $settings['autoHeight'] = TRUE; |
|
| 143 | + $settings['autoHeight'] = true; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $settings += array( |
| 147 | 147 | 'toolbar' => array( |
| 148 | - 'collapse' => FALSE, |
|
| 149 | - 'draggable' => TRUE, |
|
| 148 | + 'collapse' => false, |
|
| 149 | + 'draggable' => true, |
|
| 150 | 150 | 'buttonType' => 'advanced', |
| 151 | 151 | 'buttons' => array(), |
| 152 | 152 | ), |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $extra = array(); |
| 159 | 159 | if ($button == 'heading') { |
| 160 | 160 | $extra = array('menu' => array( |
| 161 | - array('text' => 'Normal', 'value' => 'none', 'checked' => TRUE), |
|
| 161 | + array('text' => 'Normal', 'value' => 'none', 'checked' => true), |
|
| 162 | 162 | )); |
| 163 | 163 | if (!empty($config['block_formats'])) { |
| 164 | 164 | $headings = array( |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | else if ($button == 'fontname') { |
| 181 | 181 | $extra = array('menu' => array( |
| 182 | - array('text' => 'Arial', 'checked' => TRUE), |
|
| 182 | + array('text' => 'Arial', 'checked' => true), |
|
| 183 | 183 | array('text' => 'Arial Black'), |
| 184 | 184 | array('text' => 'Comic Sans MS'), |
| 185 | 185 | array('text' => 'Courier New'), |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | 'removeformat' => t('Remove format'), |
| 291 | 291 | 'heading' => t('HTML block format'), 'fontname' => t('Font'), 'fontsize' => t('Font size'), |
| 292 | 292 | ), |
| 293 | - 'internal' => TRUE, |
|
| 293 | + 'internal' => true, |
|
| 294 | 294 | ), |
| 295 | 295 | ); |
| 296 | 296 | } |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'title' => 'openWYSIWYG', |
| 14 | 14 | 'vendor url' => 'http://www.openwebware.com', |
| 15 | 15 | 'download url' => 'http://www.openwebware.com/download.shtml', |
| 16 | - 'library path' => wysiwyg_get_path('openwysiwyg') . '/scripts', |
|
| 16 | + 'library path' => wysiwyg_get_path('openwysiwyg').'/scripts', |
|
| 17 | 17 | 'libraries' => array( |
| 18 | 18 | 'src' => array( |
| 19 | 19 | 'title' => 'Source', |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function wysiwyg_openwysiwyg_version($editor) { |
| 47 | 47 | // 'library path' has '/scripts' appended already. |
| 48 | - $changelog = $editor['editor path'] . '/changelog'; |
|
| 48 | + $changelog = $editor['editor path'].'/changelog'; |
|
| 49 | 49 | if (!file_exists($changelog)) { |
| 50 | 50 | return; |
| 51 | 51 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function wysiwyg_openwysiwyg_settings($editor, $config, $theme) { |
| 92 | 92 | $settings = array( |
| 93 | - 'path' => base_path() . $editor['editor path'] . '/', |
|
| 93 | + 'path' => base_path().$editor['editor path'].'/', |
|
| 94 | 94 | 'Width' => '100%', |
| 95 | 95 | ); |
| 96 | 96 | |
@@ -101,8 +101,7 @@ |
||
| 101 | 101 | if (isset($config['css_setting'])) { |
| 102 | 102 | if ($config['css_setting'] == 'theme') { |
| 103 | 103 | $settings['CSSFile'] = reset(wysiwyg_get_css()); |
| 104 | - } |
|
| 105 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 104 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 106 | 105 | $settings['CSSFile'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 107 | 106 | } |
| 108 | 107 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | 97 | if (isset($config['path_loc']) && $config['path_loc'] == 'none') { |
| 98 | - $settings['StatusBarEnabled'] = FALSE; |
|
| 98 | + $settings['StatusBarEnabled'] = false; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (isset($config['css_setting'])) { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'inserttable' => t('Table'), |
| 166 | 166 | 'help' => t('Help'), |
| 167 | 167 | ), |
| 168 | - 'internal' => TRUE, |
|
| 168 | + 'internal' => true, |
|
| 169 | 169 | ), |
| 170 | 170 | ); |
| 171 | 171 | return $plugins; |