@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * An array containing editor properties as returned from hook_editor(). |
| 39 | 39 | * |
| 40 | 40 | * @return |
| 41 | - * The installed editor version. |
|
| 41 | + string The installed editor version. |
|
| 42 | 42 | */ |
| 43 | 43 | function wysiwyg_nicedit_version($editor) { |
| 44 | 44 | // @see http://nicedit.com/forums/viewtopic.php?t=425 |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_nicedit_editor() { |
| 12 | - $editor['nicedit'] = array( |
|
| 12 | + $editor['nicedit'] = array( |
|
| 13 | 13 | 'title' => 'NicEdit', |
| 14 | 14 | 'vendor url' => 'http://nicedit.com', |
| 15 | 15 | 'download url' => 'http://nicedit.com/download.php', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Source', |
| 19 | 19 | 'files' => array('nicEdit.js'), |
| 20 | - ), |
|
| 20 | + ), |
|
| 21 | 21 | ), |
| 22 | 22 | 'version callback' => 'wysiwyg_nicedit_version', |
| 23 | 23 | 'settings callback' => 'wysiwyg_nicedit_settings', |
| 24 | 24 | 'plugin callback' => 'wysiwyg_nicedit_plugins', |
| 25 | 25 | 'versions' => array( |
| 26 | - '0.9' => array( |
|
| 26 | + '0.9' => array( |
|
| 27 | 27 | 'js files' => array('nicedit.js'), |
| 28 | - ), |
|
| 28 | + ), |
|
| 29 | 29 | ), |
| 30 | - ); |
|
| 31 | - return $editor; |
|
| 30 | + ); |
|
| 31 | + return $editor; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * The installed editor version. |
| 42 | 42 | */ |
| 43 | 43 | function wysiwyg_nicedit_version($editor) { |
| 44 | - // @see http://nicedit.com/forums/viewtopic.php?t=425 |
|
| 45 | - return '0.9'; |
|
| 44 | + // @see http://nicedit.com/forums/viewtopic.php?t=425 |
|
| 45 | + return '0.9'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * Drupal.settings.wysiwyg.configs.{editor} |
| 61 | 61 | */ |
| 62 | 62 | function wysiwyg_nicedit_settings($editor, $config, $theme) { |
| 63 | - $settings = array( |
|
| 63 | + $settings = array( |
|
| 64 | 64 | 'iconsPath' => base_path() . $editor['library path'] . '/nicEditorIcons.gif', |
| 65 | - ); |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | - // Add configured buttons or all available. |
|
| 68 | - $settings['buttonList'] = array(); |
|
| 69 | - if (!empty($config['buttons'])) { |
|
| 67 | + // Add configured buttons or all available. |
|
| 68 | + $settings['buttonList'] = array(); |
|
| 69 | + if (!empty($config['buttons'])) { |
|
| 70 | 70 | $buttons = array(); |
| 71 | 71 | foreach ($config['buttons'] as $plugin) { |
| 72 | - $buttons = array_merge($buttons, $plugin); |
|
| 72 | + $buttons = array_merge($buttons, $plugin); |
|
| 73 | 73 | } |
| 74 | 74 | $settings['buttonList'] = array_keys($buttons); |
| 75 | - } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - // Add editor content stylesheet. |
|
| 78 | - if (isset($config['css_setting'])) { |
|
| 77 | + // Add editor content stylesheet. |
|
| 78 | + if (isset($config['css_setting'])) { |
|
| 79 | 79 | if ($config['css_setting'] == 'theme') { |
| 80 | - $css = path_to_theme() . '/style.css'; |
|
| 81 | - if (file_exists($css)) { |
|
| 80 | + $css = path_to_theme() . '/style.css'; |
|
| 81 | + if (file_exists($css)) { |
|
| 82 | 82 | $settings['externalCSS'] = base_path() . $css; |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 86 | - $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 86 | + $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 87 | + } |
|
| 87 | 88 | } |
| 88 | - } |
|
| 89 | 89 | |
| 90 | - return $settings; |
|
| 90 | + return $settings; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 95 | 95 | */ |
| 96 | 96 | function wysiwyg_nicedit_plugins($editor) { |
| 97 | - return array( |
|
| 97 | + return array( |
|
| 98 | 98 | 'default' => array( |
| 99 | - 'buttons' => array( |
|
| 99 | + 'buttons' => array( |
|
| 100 | 100 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 101 | 101 | 'strikethrough' => t('Strike-through'), |
| 102 | 102 | 'left' => t('Align left'), 'center' => t('Align center'), 'right' => t('Align right'), |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | 'link' => t('Link'), 'unlink' => t('Unlink'), |
| 112 | 112 | 'fontFormat' => t('HTML block format'), 'fontFamily' => t('Font'), 'fontSize' => t('Font size'), |
| 113 | 113 | 'xhtml' => t('Source code'), |
| 114 | - ), |
|
| 115 | - 'internal' => TRUE, |
|
| 114 | + ), |
|
| 115 | + 'internal' => TRUE, |
|
| 116 | 116 | ), |
| 117 | - ); |
|
| 117 | + ); |
|
| 118 | 118 | } |
| 119 | 119 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function wysiwyg_nicedit_settings($editor, $config, $theme) { |
| 63 | 63 | $settings = array( |
| 64 | - 'iconsPath' => base_path() . $editor['library path'] . '/nicEditorIcons.gif', |
|
| 64 | + 'iconsPath' => base_path().$editor['library path'].'/nicEditorIcons.gif', |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | // Add configured buttons or all available. |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | // Add editor content stylesheet. |
| 78 | 78 | if (isset($config['css_setting'])) { |
| 79 | 79 | if ($config['css_setting'] == 'theme') { |
| 80 | - $css = path_to_theme() . '/style.css'; |
|
| 80 | + $css = path_to_theme().'/style.css'; |
|
| 81 | 81 | if (file_exists($css)) { |
| 82 | - $settings['externalCSS'] = base_path() . $css; |
|
| 82 | + $settings['externalCSS'] = base_path().$css; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | if (file_exists($css)) { |
| 109 | 109 | $settings['externalCSS'] = base_path() . $css; |
| 110 | 110 | } |
| 111 | - } |
|
| 112 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 111 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 113 | 112 | $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 114 | 113 | } |
| 115 | 114 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | 'fontFormat' => t('HTML block format'), 'fontFamily' => t('Font'), 'fontSize' => t('Font size'), |
| 113 | 113 | 'xhtml' => t('Source code'), |
| 114 | 114 | ), |
| 115 | - 'internal' => TRUE, |
|
| 115 | + 'internal' => true, |
|
| 116 | 116 | ), |
| 117 | 117 | ); |
| 118 | 118 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * An array containing editor properties as returned from hook_editor(). |
| 42 | 42 | * |
| 43 | 43 | * @return |
| 44 | - * The installed editor version. |
|
| 44 | + null|string The installed editor version. |
|
| 45 | 45 | */ |
| 46 | 46 | function wysiwyg_openwysiwyg_version($editor) { |
| 47 | 47 | // 'library path' has '/scripts' appended already. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * A wysiwyg editor profile. |
| 68 | 68 | * |
| 69 | 69 | * @return |
| 70 | - * An array of theme names. The first returned name should be the default |
|
| 70 | + string[] An array of theme names. The first returned name should be the default |
|
| 71 | 71 | * theme name. |
| 72 | 72 | */ |
| 73 | 73 | function wysiwyg_openwysiwyg_themes($editor, $profile) { |
@@ -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; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * An array containing editor properties as returned from hook_editor(). |
| 78 | 78 | * |
| 79 | 79 | * @return |
| 80 | - * The installed editor version. |
|
| 80 | + null|string The installed editor version. |
|
| 81 | 81 | */ |
| 82 | 82 | function wysiwyg_tinymce_version($editor) { |
| 83 | 83 | $script = $editor['library path'] . '/tiny_mce.js'; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * A wysiwyg editor profile. |
| 105 | 105 | * |
| 106 | 106 | * @return |
| 107 | - * An array of theme names. The first returned name should be the default |
|
| 107 | + string[] An array of theme names. The first returned name should be the default |
|
| 108 | 108 | * theme name. |
| 109 | 109 | */ |
| 110 | 110 | function wysiwyg_tinymce_themes($editor, $profile) { |
@@ -11,20 +11,20 @@ discard block |
||
| 11 | 11 | * @todo wysiwyg_<editor>_alter() to add/inject optional libraries like gzip. |
| 12 | 12 | */ |
| 13 | 13 | function wysiwyg_tinymce_editor() { |
| 14 | - $editor['tinymce'] = array( |
|
| 14 | + $editor['tinymce'] = array( |
|
| 15 | 15 | 'title' => 'TinyMCE', |
| 16 | 16 | 'vendor url' => 'http://tinymce.moxiecode.com', |
| 17 | 17 | 'download url' => 'http://tinymce.moxiecode.com/download.php', |
| 18 | 18 | 'library path' => wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce', |
| 19 | 19 | 'libraries' => array( |
| 20 | - '' => array( |
|
| 20 | + '' => array( |
|
| 21 | 21 | 'title' => 'Minified', |
| 22 | 22 | 'files' => array('tiny_mce.js'), |
| 23 | - ), |
|
| 24 | - 'src' => array( |
|
| 23 | + ), |
|
| 24 | + 'src' => array( |
|
| 25 | 25 | 'title' => 'Source', |
| 26 | 26 | 'files' => array('tiny_mce_src.js'), |
| 27 | - ), |
|
| 27 | + ), |
|
| 28 | 28 | ), |
| 29 | 29 | 'version callback' => 'wysiwyg_tinymce_version', |
| 30 | 30 | 'themes callback' => 'wysiwyg_tinymce_themes', |
@@ -32,42 +32,42 @@ discard block |
||
| 32 | 32 | 'plugin callback' => 'wysiwyg_tinymce_plugins', |
| 33 | 33 | 'plugin settings callback' => 'wysiwyg_tinymce_plugin_settings', |
| 34 | 34 | 'proxy plugin' => array( |
| 35 | - 'drupal' => array( |
|
| 35 | + 'drupal' => array( |
|
| 36 | 36 | 'load' => TRUE, |
| 37 | 37 | 'proxy' => TRUE, |
| 38 | - ), |
|
| 38 | + ), |
|
| 39 | 39 | ), |
| 40 | 40 | 'proxy plugin settings callback' => 'wysiwyg_tinymce_proxy_plugin_settings', |
| 41 | 41 | 'versions' => array( |
| 42 | - '2.1' => array( |
|
| 42 | + '2.1' => array( |
|
| 43 | 43 | 'js files' => array('tinymce-2.js'), |
| 44 | 44 | 'css files' => array('tinymce-2.css'), |
| 45 | 45 | 'download url' => 'http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430&release_id=557383', |
| 46 | - ), |
|
| 47 | - // @todo Starting from 3.3, tiny_mce.js may support JS aggregation. |
|
| 48 | - '3.1' => array( |
|
| 46 | + ), |
|
| 47 | + // @todo Starting from 3.3, tiny_mce.js may support JS aggregation. |
|
| 48 | + '3.1' => array( |
|
| 49 | 49 | 'js files' => array('tinymce-3.js'), |
| 50 | 50 | 'css files' => array('tinymce-3.css'), |
| 51 | 51 | 'libraries' => array( |
| 52 | - '' => array( |
|
| 52 | + '' => array( |
|
| 53 | 53 | 'title' => 'Minified', |
| 54 | 54 | 'files' => array( |
| 55 | - 'tiny_mce.js' => array('preprocess' => FALSE), |
|
| 55 | + 'tiny_mce.js' => array('preprocess' => FALSE), |
|
| 56 | 56 | ), |
| 57 | - ), |
|
| 58 | - 'jquery' => array( |
|
| 57 | + ), |
|
| 58 | + 'jquery' => array( |
|
| 59 | 59 | 'title' => 'jQuery', |
| 60 | 60 | 'files' => array('tiny_mce_jquery.js'), |
| 61 | - ), |
|
| 62 | - 'src' => array( |
|
| 61 | + ), |
|
| 62 | + 'src' => array( |
|
| 63 | 63 | 'title' => 'Source', |
| 64 | 64 | 'files' => array('tiny_mce_src.js'), |
| 65 | - ), |
|
| 65 | + ), |
|
| 66 | + ), |
|
| 66 | 67 | ), |
| 67 | - ), |
|
| 68 | 68 | ), |
| 69 | - ); |
|
| 70 | - return $editor; |
|
| 69 | + ); |
|
| 70 | + return $editor; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | * The installed editor version. |
| 81 | 81 | */ |
| 82 | 82 | function wysiwyg_tinymce_version($editor) { |
| 83 | - $script = $editor['library path'] . '/tiny_mce.js'; |
|
| 84 | - if (!file_exists($script)) { |
|
| 83 | + $script = $editor['library path'] . '/tiny_mce.js'; |
|
| 84 | + if (!file_exists($script)) { |
|
| 85 | 85 | return; |
| 86 | - } |
|
| 87 | - $script = fopen($script, 'r'); |
|
| 88 | - // Version is contained in the first 200 chars. |
|
| 89 | - $line = fgets($script, 200); |
|
| 90 | - fclose($script); |
|
| 91 | - // 2.x: this.majorVersion="2";this.minorVersion="1.3" |
|
| 92 | - // 3.x: majorVersion:'3',minorVersion:'2.0.1' |
|
| 93 | - if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) { |
|
| 86 | + } |
|
| 87 | + $script = fopen($script, 'r'); |
|
| 88 | + // Version is contained in the first 200 chars. |
|
| 89 | + $line = fgets($script, 200); |
|
| 90 | + fclose($script); |
|
| 91 | + // 2.x: this.majorVersion="2";this.minorVersion="1.3" |
|
| 92 | + // 3.x: majorVersion:'3',minorVersion:'2.0.1' |
|
| 93 | + if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) { |
|
| 94 | 94 | return $version[1] . '.' . $version[2]; |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * theme name. |
| 109 | 109 | */ |
| 110 | 110 | function wysiwyg_tinymce_themes($editor, $profile) { |
| 111 | - /* |
|
| 111 | + /* |
|
| 112 | 112 | $themes = array(); |
| 113 | 113 | $dir = $editor['library path'] . '/themes/'; |
| 114 | 114 | if (is_dir($dir) && $dh = opendir($dir)) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | return $themes; |
| 124 | 124 | */ |
| 125 | - return array('advanced', 'simple'); |
|
| 125 | + return array('advanced', 'simple'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Drupal.settings.wysiwyg.configs.{editor} |
| 141 | 141 | */ |
| 142 | 142 | function wysiwyg_tinymce_settings($editor, $config, $theme) { |
| 143 | - $settings = array( |
|
| 143 | + $settings = array( |
|
| 144 | 144 | 'button_tile_map' => TRUE, // @todo Add a setting for this. |
| 145 | 145 | 'document_base_url' => base_path(), |
| 146 | 146 | 'mode' => 'none', |
@@ -158,49 +158,49 @@ discard block |
||
| 158 | 158 | // HTML control characters and invisible characters. TinyMCE always converts |
| 159 | 159 | // XML default characters '&', '<', '>'. |
| 160 | 160 | 'entities' => '160,nbsp,173,shy,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm', |
| 161 | - ); |
|
| 162 | - if (isset($config['apply_source_formatting'])) { |
|
| 161 | + ); |
|
| 162 | + if (isset($config['apply_source_formatting'])) { |
|
| 163 | 163 | $settings['apply_source_formatting'] = $config['apply_source_formatting']; |
| 164 | - } |
|
| 165 | - if (isset($config['convert_fonts_to_spans'])) { |
|
| 164 | + } |
|
| 165 | + if (isset($config['convert_fonts_to_spans'])) { |
|
| 166 | 166 | $settings['convert_fonts_to_spans'] = $config['convert_fonts_to_spans']; |
| 167 | - } |
|
| 168 | - if (isset($config['language'])) { |
|
| 167 | + } |
|
| 168 | + if (isset($config['language'])) { |
|
| 169 | 169 | $settings['language'] = $config['language']; |
| 170 | - } |
|
| 171 | - if (isset($config['paste_auto_cleanup_on_paste'])) { |
|
| 170 | + } |
|
| 171 | + if (isset($config['paste_auto_cleanup_on_paste'])) { |
|
| 172 | 172 | $settings['paste_auto_cleanup_on_paste'] = $config['paste_auto_cleanup_on_paste']; |
| 173 | - } |
|
| 174 | - if (isset($config['preformatted'])) { |
|
| 173 | + } |
|
| 174 | + if (isset($config['preformatted'])) { |
|
| 175 | 175 | $settings['preformatted'] = $config['preformatted']; |
| 176 | - } |
|
| 177 | - if (isset($config['remove_linebreaks'])) { |
|
| 176 | + } |
|
| 177 | + if (isset($config['remove_linebreaks'])) { |
|
| 178 | 178 | $settings['remove_linebreaks'] = $config['remove_linebreaks']; |
| 179 | - } |
|
| 180 | - if (isset($config['verify_html'])) { |
|
| 179 | + } |
|
| 180 | + if (isset($config['verify_html'])) { |
|
| 181 | 181 | $settings['verify_html'] = (bool) $config['verify_html']; |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - if (!empty($config['css_classes'])) { |
|
| 184 | + if (!empty($config['css_classes'])) { |
|
| 185 | 185 | $settings['theme_advanced_styles'] = implode(';', array_filter(explode("\n", str_replace("\r", '', $config['css_classes'])))); |
| 186 | - } |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - if (isset($config['css_setting'])) { |
|
| 188 | + if (isset($config['css_setting'])) { |
|
| 189 | 189 | if ($config['css_setting'] == 'theme') { |
| 190 | - $settings['content_css'] = implode(',', wysiwyg_get_css()); |
|
| 190 | + $settings['content_css'] = implode(',', wysiwyg_get_css()); |
|
| 191 | 191 | } |
| 192 | 192 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 193 | - $settings['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 193 | + $settings['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 194 | + } |
|
| 194 | 195 | } |
| 195 | - } |
|
| 196 | 196 | |
| 197 | - // Find the enabled buttons and the button row they belong on. |
|
| 198 | - // Also map the plugin metadata for each button. |
|
| 199 | - // @todo What follows is a pain; needs a rewrite. |
|
| 200 | - // $settings['buttons'] are stacked into $settings['theme_advanced_buttons1'] |
|
| 201 | - // later. |
|
| 202 | - $settings['buttons'] = array(); |
|
| 203 | - if (!empty($config['buttons']) && is_array($config['buttons'])) { |
|
| 197 | + // Find the enabled buttons and the button row they belong on. |
|
| 198 | + // Also map the plugin metadata for each button. |
|
| 199 | + // @todo What follows is a pain; needs a rewrite. |
|
| 200 | + // $settings['buttons'] are stacked into $settings['theme_advanced_buttons1'] |
|
| 201 | + // later. |
|
| 202 | + $settings['buttons'] = array(); |
|
| 203 | + if (!empty($config['buttons']) && is_array($config['buttons'])) { |
|
| 204 | 204 | // Only array keys in $settings['extensions'] matter; added to |
| 205 | 205 | // $settings['plugins'] later. |
| 206 | 206 | $settings['extensions'] = array(); |
@@ -213,54 +213,54 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $plugins = wysiwyg_get_plugins($editor['name']); |
| 215 | 215 | foreach ($config['buttons'] as $plugin => $buttons) { |
| 216 | - foreach ($buttons as $button => $enabled) { |
|
| 216 | + foreach ($buttons as $button => $enabled) { |
|
| 217 | 217 | // Iterate separately over buttons and extensions properties. |
| 218 | 218 | foreach (array('buttons', 'extensions') as $type) { |
| 219 | - // Skip unavailable plugins. |
|
| 220 | - if (!isset($plugins[$plugin][$type][$button])) { |
|
| 219 | + // Skip unavailable plugins. |
|
| 220 | + if (!isset($plugins[$plugin][$type][$button])) { |
|
| 221 | 221 | continue; |
| 222 | - } |
|
| 223 | - // Add buttons. |
|
| 224 | - if ($type == 'buttons') { |
|
| 222 | + } |
|
| 223 | + // Add buttons. |
|
| 224 | + if ($type == 'buttons') { |
|
| 225 | 225 | $settings['buttons'][] = $button; |
| 226 | - } |
|
| 227 | - // Add external Drupal plugins to the list of extensions. |
|
| 228 | - if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { |
|
| 226 | + } |
|
| 227 | + // Add external Drupal plugins to the list of extensions. |
|
| 228 | + if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { |
|
| 229 | 229 | $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $button)] = 1; |
| 230 | - } |
|
| 231 | - // Add external plugins to the list of extensions. |
|
| 232 | - else if ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { |
|
| 230 | + } |
|
| 231 | + // Add external plugins to the list of extensions. |
|
| 232 | + else if ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { |
|
| 233 | 233 | $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $plugin)] = 1; |
| 234 | - } |
|
| 235 | - // Add internal buttons that also need to be loaded as extension. |
|
| 236 | - else if ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { |
|
| 234 | + } |
|
| 235 | + // Add internal buttons that also need to be loaded as extension. |
|
| 236 | + else if ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { |
|
| 237 | 237 | $settings['extensions'][$plugin] = 1; |
| 238 | - } |
|
| 239 | - // Add plain extensions. |
|
| 240 | - else if ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { |
|
| 238 | + } |
|
| 239 | + // Add plain extensions. |
|
| 240 | + else if ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { |
|
| 241 | 241 | $settings['extensions'][$plugin] = 1; |
| 242 | - } |
|
| 243 | - // Allow plugins to add valid HTML elements. |
|
| 244 | - if (!empty($plugins[$plugin]['extended_valid_elements'])) { |
|
| 242 | + } |
|
| 243 | + // Allow plugins to add valid HTML elements. |
|
| 244 | + if (!empty($plugins[$plugin]['extended_valid_elements'])) { |
|
| 245 | 245 | $settings['extended_valid_elements'] = array_merge($settings['extended_valid_elements'], $plugins[$plugin]['extended_valid_elements']); |
| 246 | - } |
|
| 247 | - // Allow plugins to add or override global configuration settings. |
|
| 248 | - if (!empty($plugins[$plugin]['options'])) { |
|
| 246 | + } |
|
| 247 | + // Allow plugins to add or override global configuration settings. |
|
| 248 | + if (!empty($plugins[$plugin]['options'])) { |
|
| 249 | 249 | $settings = array_merge($settings, $plugins[$plugin]['options']); |
| 250 | - } |
|
| 250 | + } |
|
| 251 | + } |
|
| 251 | 252 | } |
| 252 | - } |
|
| 253 | 253 | } |
| 254 | 254 | // Clean-up. |
| 255 | 255 | $settings['extended_valid_elements'] = array_unique($settings['extended_valid_elements']); |
| 256 | 256 | if ($settings['extensions']) { |
| 257 | - $settings['plugins'] = array_keys($settings['extensions']); |
|
| 257 | + $settings['plugins'] = array_keys($settings['extensions']); |
|
| 258 | 258 | } |
| 259 | 259 | unset($settings['extensions']); |
| 260 | - } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - // Add theme-specific settings. |
|
| 263 | - switch ($theme) { |
|
| 262 | + // Add theme-specific settings. |
|
| 263 | + switch ($theme) { |
|
| 264 | 264 | case 'advanced': |
| 265 | 265 | $settings += array( |
| 266 | 266 | 'theme_advanced_resize_horizontal' => FALSE, |
@@ -269,36 +269,36 @@ discard block |
||
| 269 | 269 | 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
| 270 | 270 | 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
| 271 | 271 | 'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left', |
| 272 | - ); |
|
| 273 | - if (isset($config['block_formats'])) { |
|
| 272 | + ); |
|
| 273 | + if (isset($config['block_formats'])) { |
|
| 274 | 274 | $settings['theme_advanced_blockformats'] = $config['block_formats']; |
| 275 | - } |
|
| 276 | - if (isset($settings['buttons'])) { |
|
| 275 | + } |
|
| 276 | + if (isset($settings['buttons'])) { |
|
| 277 | 277 | // These rows explicitly need to be set to be empty, otherwise TinyMCE |
| 278 | 278 | // loads its default buttons of the advanced theme for each row. |
| 279 | 279 | $settings += array( |
| 280 | - 'theme_advanced_buttons1' => array(), |
|
| 281 | - 'theme_advanced_buttons2' => array(), |
|
| 282 | - 'theme_advanced_buttons3' => array(), |
|
| 280 | + 'theme_advanced_buttons1' => array(), |
|
| 281 | + 'theme_advanced_buttons2' => array(), |
|
| 282 | + 'theme_advanced_buttons3' => array(), |
|
| 283 | 283 | ); |
| 284 | 284 | // @todo Allow to sort/arrange editor buttons. |
| 285 | 285 | for ($i = 0; $i < count($settings['buttons']); $i++) { |
| 286 | - $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 286 | + $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 287 | 287 | } |
| 288 | - } |
|
| 289 | - break; |
|
| 290 | - } |
|
| 291 | - unset($settings['buttons']); |
|
| 288 | + } |
|
| 289 | + break; |
|
| 290 | + } |
|
| 291 | + unset($settings['buttons']); |
|
| 292 | 292 | |
| 293 | - // Convert the config values into the form expected by TinyMCE. |
|
| 294 | - $csv_settings = array('plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); |
|
| 295 | - foreach ($csv_settings as $key) { |
|
| 293 | + // Convert the config values into the form expected by TinyMCE. |
|
| 294 | + $csv_settings = array('plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); |
|
| 295 | + foreach ($csv_settings as $key) { |
|
| 296 | 296 | if (isset($settings[$key]) && is_array($settings[$key])) { |
| 297 | - $settings[$key] = implode(',', $settings[$key]); |
|
| 297 | + $settings[$key] = implode(',', $settings[$key]); |
|
| 298 | + } |
|
| 298 | 299 | } |
| 299 | - } |
|
| 300 | 300 | |
| 301 | - return $settings; |
|
| 301 | + return $settings; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -308,46 +308,46 @@ discard block |
||
| 308 | 308 | * directory) are loaded (once) upon initializing the editor. |
| 309 | 309 | */ |
| 310 | 310 | function wysiwyg_tinymce_plugin_settings($editor, $profile, $plugins) { |
| 311 | - $settings = array(); |
|
| 312 | - foreach ($plugins as $name => $plugin) { |
|
| 311 | + $settings = array(); |
|
| 312 | + foreach ($plugins as $name => $plugin) { |
|
| 313 | 313 | if (!empty($plugin['load'])) { |
| 314 | - // Add path for native external plugins; internal ones are loaded |
|
| 315 | - // automatically. |
|
| 316 | - if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 314 | + // Add path for native external plugins; internal ones are loaded |
|
| 315 | + // automatically. |
|
| 316 | + if (empty($plugin['internal']) && isset($plugin['path'])) { |
|
| 317 | 317 | // TinyMCE plugins commonly use the filename editor_plugin.js, but there |
| 318 | 318 | // is no default. Previously, Wysiwyg's API documentation suggested to |
| 319 | 319 | // have the 'path' contain the 'filename' property, so if 'filename' is |
| 320 | 320 | // not defined, automatically extract it from 'path' for backwards |
| 321 | 321 | // compatibility. |
| 322 | 322 | if (!isset($plugin['filename'])) { |
| 323 | - $parts = explode('/', $plugin['path']); |
|
| 324 | - $plugin['filename'] = array_pop($parts); |
|
| 325 | - $plugin['path'] = implode('/', $parts); |
|
| 323 | + $parts = explode('/', $plugin['path']); |
|
| 324 | + $plugin['filename'] = array_pop($parts); |
|
| 325 | + $plugin['path'] = implode('/', $parts); |
|
| 326 | 326 | } |
| 327 | 327 | $settings[$name] = base_path() . $plugin['path'] . '/' . $plugin['filename']; |
| 328 | - } |
|
| 328 | + } |
|
| 329 | 329 | } |
| 330 | - } |
|
| 331 | - return $settings; |
|
| 330 | + } |
|
| 331 | + return $settings; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * Build a JS settings array for Drupal plugins loaded via the proxy plugin. |
| 336 | 336 | */ |
| 337 | 337 | function wysiwyg_tinymce_proxy_plugin_settings($editor, $profile, $plugins) { |
| 338 | - $settings = array(); |
|
| 339 | - foreach ($plugins as $name => $plugin) { |
|
| 338 | + $settings = array(); |
|
| 339 | + foreach ($plugins as $name => $plugin) { |
|
| 340 | 340 | // Populate required plugin settings. |
| 341 | 341 | $settings[$name] = $plugin['dialog settings'] + array( |
| 342 | - 'title' => $plugin['title'], |
|
| 343 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 344 | - 'iconTitle' => $plugin['icon title'], |
|
| 342 | + 'title' => $plugin['title'], |
|
| 343 | + 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 344 | + 'iconTitle' => $plugin['icon title'], |
|
| 345 | 345 | ); |
| 346 | 346 | if (isset($plugin['css file'])) { |
| 347 | - $settings[$name]['css'] = base_path() . $plugin['css path'] . '/' . $plugin['css file']; |
|
| 347 | + $settings[$name]['css'] = base_path() . $plugin['css path'] . '/' . $plugin['css file']; |
|
| 348 | 348 | } |
| 349 | - } |
|
| 350 | - return $settings; |
|
| 349 | + } |
|
| 350 | + return $settings; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -362,28 +362,28 @@ discard block |
||
| 362 | 362 | * A plugin name. |
| 363 | 363 | */ |
| 364 | 364 | function _wysiwyg_tinymce_plugin_name($op, $name) { |
| 365 | - if ($op == 'add') { |
|
| 365 | + if ($op == 'add') { |
|
| 366 | 366 | if (strpos($name, '-') !== 0) { |
| 367 | - return '-' . $name; |
|
| 367 | + return '-' . $name; |
|
| 368 | 368 | } |
| 369 | 369 | return $name; |
| 370 | - } |
|
| 371 | - else if ($op == 'remove') { |
|
| 370 | + } |
|
| 371 | + else if ($op == 'remove') { |
|
| 372 | 372 | if (strpos($name, '-') === 0) { |
| 373 | - return substr($name, 1); |
|
| 373 | + return substr($name, 1); |
|
| 374 | 374 | } |
| 375 | 375 | return $name; |
| 376 | - } |
|
| 376 | + } |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 381 | 381 | */ |
| 382 | 382 | function wysiwyg_tinymce_plugins($editor) { |
| 383 | - $plugins = array( |
|
| 383 | + $plugins = array( |
|
| 384 | 384 | 'default' => array( |
| 385 | - 'path' => $editor['library path'] . '/themes/advanced', |
|
| 386 | - 'buttons' => array( |
|
| 385 | + 'path' => $editor['library path'] . '/themes/advanced', |
|
| 386 | + 'buttons' => array( |
|
| 387 | 387 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 388 | 388 | 'strikethrough' => t('Strike-through'), |
| 389 | 389 | 'justifyleft' => t('Align left'), 'justifycenter' => t('Align center'), 'justifyright' => t('Align right'), 'justifyfull' => t('Justify'), |
@@ -402,217 +402,217 @@ discard block |
||
| 402 | 402 | 'removeformat' => t('Remove format'), |
| 403 | 403 | 'charmap' => t('Character map'), |
| 404 | 404 | 'help' => t('Help'), |
| 405 | - ), |
|
| 406 | - 'internal' => TRUE, |
|
| 405 | + ), |
|
| 406 | + 'internal' => TRUE, |
|
| 407 | 407 | ), |
| 408 | 408 | 'advhr' => array( |
| 409 | - 'path' => $editor['library path'] . '/plugins/advhr', |
|
| 410 | - 'buttons' => array('advhr' => t('Advanced horizontal rule')), |
|
| 411 | - 'extended_valid_elements' => array('hr[class|width|size|noshade]'), |
|
| 412 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', |
|
| 413 | - 'internal' => TRUE, |
|
| 414 | - 'load' => TRUE, |
|
| 409 | + 'path' => $editor['library path'] . '/plugins/advhr', |
|
| 410 | + 'buttons' => array('advhr' => t('Advanced horizontal rule')), |
|
| 411 | + 'extended_valid_elements' => array('hr[class|width|size|noshade]'), |
|
| 412 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', |
|
| 413 | + 'internal' => TRUE, |
|
| 414 | + 'load' => TRUE, |
|
| 415 | 415 | ), |
| 416 | 416 | 'advimage' => array( |
| 417 | - 'path' => $editor['library path'] . '/plugins/advimage', |
|
| 418 | - 'extensions' => array('advimage' => t('Advanced image')), |
|
| 419 | - 'extended_valid_elements' => array('img[src|alt|title|align|width|height|usemap|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), |
|
| 420 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', |
|
| 421 | - 'internal' => TRUE, |
|
| 422 | - 'load' => TRUE, |
|
| 417 | + 'path' => $editor['library path'] . '/plugins/advimage', |
|
| 418 | + 'extensions' => array('advimage' => t('Advanced image')), |
|
| 419 | + 'extended_valid_elements' => array('img[src|alt|title|align|width|height|usemap|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), |
|
| 420 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', |
|
| 421 | + 'internal' => TRUE, |
|
| 422 | + 'load' => TRUE, |
|
| 423 | 423 | ), |
| 424 | 424 | 'advlink' => array( |
| 425 | - 'path' => $editor['library path'] . '/plugins/advlink', |
|
| 426 | - 'extensions' => array('advlink' => t('Advanced link')), |
|
| 427 | - 'extended_valid_elements' => array('a[name|href|target|title|class|onfocus|onblur|onclick|ondlbclick|onmousedown|onmouseup|onmouseover|onmouseout|onkeypress|onkeydown|onkeyup|id|style|rel]'), |
|
| 428 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', |
|
| 429 | - 'internal' => TRUE, |
|
| 430 | - 'load' => TRUE, |
|
| 425 | + 'path' => $editor['library path'] . '/plugins/advlink', |
|
| 426 | + 'extensions' => array('advlink' => t('Advanced link')), |
|
| 427 | + 'extended_valid_elements' => array('a[name|href|target|title|class|onfocus|onblur|onclick|ondlbclick|onmousedown|onmouseup|onmouseover|onmouseout|onkeypress|onkeydown|onkeyup|id|style|rel]'), |
|
| 428 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', |
|
| 429 | + 'internal' => TRUE, |
|
| 430 | + 'load' => TRUE, |
|
| 431 | 431 | ), |
| 432 | 432 | 'autosave' => array( |
| 433 | - 'path' => $editor['library path'] . '/plugins/autosave', |
|
| 434 | - 'extensions' => array('autosave' => t('Auto save')), |
|
| 435 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', |
|
| 436 | - 'internal' => TRUE, |
|
| 437 | - 'load' => TRUE, |
|
| 433 | + 'path' => $editor['library path'] . '/plugins/autosave', |
|
| 434 | + 'extensions' => array('autosave' => t('Auto save')), |
|
| 435 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', |
|
| 436 | + 'internal' => TRUE, |
|
| 437 | + 'load' => TRUE, |
|
| 438 | 438 | ), |
| 439 | 439 | 'contextmenu' => array( |
| 440 | - 'path' => $editor['library path'] . '/plugins/contextmenu', |
|
| 441 | - 'extensions' => array('contextmenu' => t('Context menu')), |
|
| 442 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', |
|
| 443 | - 'internal' => TRUE, |
|
| 444 | - 'load' => TRUE, |
|
| 440 | + 'path' => $editor['library path'] . '/plugins/contextmenu', |
|
| 441 | + 'extensions' => array('contextmenu' => t('Context menu')), |
|
| 442 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', |
|
| 443 | + 'internal' => TRUE, |
|
| 444 | + 'load' => TRUE, |
|
| 445 | 445 | ), |
| 446 | 446 | 'directionality' => array( |
| 447 | - 'path' => $editor['library path'] . '/plugins/directionality', |
|
| 448 | - 'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')), |
|
| 449 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', |
|
| 450 | - 'internal' => TRUE, |
|
| 451 | - 'load' => TRUE, |
|
| 447 | + 'path' => $editor['library path'] . '/plugins/directionality', |
|
| 448 | + 'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')), |
|
| 449 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', |
|
| 450 | + 'internal' => TRUE, |
|
| 451 | + 'load' => TRUE, |
|
| 452 | 452 | ), |
| 453 | 453 | 'emotions' => array( |
| 454 | - 'path' => $editor['library path'] . '/plugins/emotions', |
|
| 455 | - 'buttons' => array('emotions' => t('Emotions')), |
|
| 456 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', |
|
| 457 | - 'internal' => TRUE, |
|
| 458 | - 'load' => TRUE, |
|
| 454 | + 'path' => $editor['library path'] . '/plugins/emotions', |
|
| 455 | + 'buttons' => array('emotions' => t('Emotions')), |
|
| 456 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', |
|
| 457 | + 'internal' => TRUE, |
|
| 458 | + 'load' => TRUE, |
|
| 459 | 459 | ), |
| 460 | 460 | 'font' => array( |
| 461 | - 'path' => $editor['library path'] . '/plugins/font', |
|
| 462 | - 'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')), |
|
| 463 | - 'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'), |
|
| 464 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font', |
|
| 465 | - 'internal' => TRUE, |
|
| 461 | + 'path' => $editor['library path'] . '/plugins/font', |
|
| 462 | + 'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')), |
|
| 463 | + 'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'), |
|
| 464 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font', |
|
| 465 | + 'internal' => TRUE, |
|
| 466 | 466 | ), |
| 467 | 467 | 'fullscreen' => array( |
| 468 | - 'path' => $editor['library path'] . '/plugins/fullscreen', |
|
| 469 | - 'buttons' => array('fullscreen' => t('Fullscreen')), |
|
| 470 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', |
|
| 471 | - 'internal' => TRUE, |
|
| 472 | - 'load' => TRUE, |
|
| 468 | + 'path' => $editor['library path'] . '/plugins/fullscreen', |
|
| 469 | + 'buttons' => array('fullscreen' => t('Fullscreen')), |
|
| 470 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', |
|
| 471 | + 'internal' => TRUE, |
|
| 472 | + 'load' => TRUE, |
|
| 473 | 473 | ), |
| 474 | 474 | 'inlinepopups' => array( |
| 475 | - 'path' => $editor['library path'] . '/plugins/inlinepopups', |
|
| 476 | - 'extensions' => array('inlinepopups' => t('Inline popups')), |
|
| 477 | - 'options' => array( |
|
| 475 | + 'path' => $editor['library path'] . '/plugins/inlinepopups', |
|
| 476 | + 'extensions' => array('inlinepopups' => t('Inline popups')), |
|
| 477 | + 'options' => array( |
|
| 478 | 478 | 'dialog_type' => array('modal'), |
| 479 | - ), |
|
| 480 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', |
|
| 481 | - 'internal' => TRUE, |
|
| 482 | - 'load' => TRUE, |
|
| 479 | + ), |
|
| 480 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', |
|
| 481 | + 'internal' => TRUE, |
|
| 482 | + 'load' => TRUE, |
|
| 483 | 483 | ), |
| 484 | 484 | 'insertdatetime' => array( |
| 485 | - 'path' => $editor['library path'] . '/plugins/insertdatetime', |
|
| 486 | - 'buttons' => array('insertdate' => t('Insert date'), 'inserttime' => t('Insert time')), |
|
| 487 | - 'options' => array( |
|
| 485 | + 'path' => $editor['library path'] . '/plugins/insertdatetime', |
|
| 486 | + 'buttons' => array('insertdate' => t('Insert date'), 'inserttime' => t('Insert time')), |
|
| 487 | + 'options' => array( |
|
| 488 | 488 | 'plugin_insertdate_dateFormat' => '%Y-%m-%d', |
| 489 | 489 | 'plugin_insertdate_timeFormat' => '%H:%M:%S', |
| 490 | - ), |
|
| 491 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime', |
|
| 492 | - 'internal' => TRUE, |
|
| 493 | - 'load' => TRUE, |
|
| 490 | + ), |
|
| 491 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime', |
|
| 492 | + 'internal' => TRUE, |
|
| 493 | + 'load' => TRUE, |
|
| 494 | 494 | ), |
| 495 | 495 | 'layer' => array( |
| 496 | - 'path' => $editor['library path'] . '/plugins/layer', |
|
| 497 | - 'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')), |
|
| 498 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer', |
|
| 499 | - 'internal' => TRUE, |
|
| 500 | - 'load' => TRUE, |
|
| 496 | + 'path' => $editor['library path'] . '/plugins/layer', |
|
| 497 | + 'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')), |
|
| 498 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer', |
|
| 499 | + 'internal' => TRUE, |
|
| 500 | + 'load' => TRUE, |
|
| 501 | 501 | ), |
| 502 | 502 | 'paste' => array( |
| 503 | - 'path' => $editor['library path'] . '/plugins/paste', |
|
| 504 | - 'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')), |
|
| 505 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', |
|
| 506 | - 'internal' => TRUE, |
|
| 507 | - 'load' => TRUE, |
|
| 503 | + 'path' => $editor['library path'] . '/plugins/paste', |
|
| 504 | + 'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')), |
|
| 505 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', |
|
| 506 | + 'internal' => TRUE, |
|
| 507 | + 'load' => TRUE, |
|
| 508 | 508 | ), |
| 509 | 509 | 'preview' => array( |
| 510 | - 'path' => $editor['library path'] . '/plugins/preview', |
|
| 511 | - 'buttons' => array('preview' => t('Preview')), |
|
| 512 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', |
|
| 513 | - 'internal' => TRUE, |
|
| 514 | - 'load' => TRUE, |
|
| 510 | + 'path' => $editor['library path'] . '/plugins/preview', |
|
| 511 | + 'buttons' => array('preview' => t('Preview')), |
|
| 512 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', |
|
| 513 | + 'internal' => TRUE, |
|
| 514 | + 'load' => TRUE, |
|
| 515 | 515 | ), |
| 516 | 516 | 'print' => array( |
| 517 | - 'path' => $editor['library path'] . '/plugins/print', |
|
| 518 | - 'buttons' => array('print' => t('Print')), |
|
| 519 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
|
| 520 | - 'internal' => TRUE, |
|
| 521 | - 'load' => TRUE, |
|
| 517 | + 'path' => $editor['library path'] . '/plugins/print', |
|
| 518 | + 'buttons' => array('print' => t('Print')), |
|
| 519 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
|
| 520 | + 'internal' => TRUE, |
|
| 521 | + 'load' => TRUE, |
|
| 522 | 522 | ), |
| 523 | 523 | 'searchreplace' => array( |
| 524 | - 'path' => $editor['library path'] . '/plugins/searchreplace', |
|
| 525 | - 'buttons' => array('search' => t('Search'), 'replace' => t('Replace')), |
|
| 526 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', |
|
| 527 | - 'internal' => TRUE, |
|
| 528 | - 'load' => TRUE, |
|
| 524 | + 'path' => $editor['library path'] . '/plugins/searchreplace', |
|
| 525 | + 'buttons' => array('search' => t('Search'), 'replace' => t('Replace')), |
|
| 526 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', |
|
| 527 | + 'internal' => TRUE, |
|
| 528 | + 'load' => TRUE, |
|
| 529 | 529 | ), |
| 530 | 530 | 'style' => array( |
| 531 | - 'path' => $editor['library path'] . '/plugins/style', |
|
| 532 | - 'buttons' => array('styleprops' => t('Style properties')), |
|
| 533 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', |
|
| 534 | - 'internal' => TRUE, |
|
| 535 | - 'load' => TRUE, |
|
| 531 | + 'path' => $editor['library path'] . '/plugins/style', |
|
| 532 | + 'buttons' => array('styleprops' => t('Style properties')), |
|
| 533 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', |
|
| 534 | + 'internal' => TRUE, |
|
| 535 | + 'load' => TRUE, |
|
| 536 | 536 | ), |
| 537 | 537 | 'table' => array( |
| 538 | - 'path' => $editor['library path'] . '/plugins/table', |
|
| 539 | - 'buttons' => array('tablecontrols' => t('Table')), |
|
| 540 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', |
|
| 541 | - 'internal' => TRUE, |
|
| 542 | - 'load' => TRUE, |
|
| 538 | + 'path' => $editor['library path'] . '/plugins/table', |
|
| 539 | + 'buttons' => array('tablecontrols' => t('Table')), |
|
| 540 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', |
|
| 541 | + 'internal' => TRUE, |
|
| 542 | + 'load' => TRUE, |
|
| 543 | 543 | ), |
| 544 | - ); |
|
| 545 | - if (version_compare($editor['installed version'], '3', '<')) { |
|
| 544 | + ); |
|
| 545 | + if (version_compare($editor['installed version'], '3', '<')) { |
|
| 546 | 546 | $plugins['flash'] = array( |
| 547 | - 'path' => $editor['library path'] . '/plugins/flash', |
|
| 548 | - 'buttons' => array('flash' => t('Flash')), |
|
| 549 | - 'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'), |
|
| 550 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash', |
|
| 551 | - 'internal' => TRUE, |
|
| 552 | - 'load' => TRUE, |
|
| 547 | + 'path' => $editor['library path'] . '/plugins/flash', |
|
| 548 | + 'buttons' => array('flash' => t('Flash')), |
|
| 549 | + 'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'), |
|
| 550 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash', |
|
| 551 | + 'internal' => TRUE, |
|
| 552 | + 'load' => TRUE, |
|
| 553 | 553 | ); |
| 554 | - } |
|
| 555 | - if (version_compare($editor['installed version'], '2.0.6', '>')) { |
|
| 554 | + } |
|
| 555 | + if (version_compare($editor['installed version'], '2.0.6', '>')) { |
|
| 556 | 556 | $plugins['media'] = array( |
| 557 | - 'path' => $editor['library path'] . '/plugins/media', |
|
| 558 | - 'buttons' => array('media' => t('Media')), |
|
| 559 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
|
| 560 | - 'internal' => TRUE, |
|
| 561 | - 'load' => TRUE, |
|
| 557 | + 'path' => $editor['library path'] . '/plugins/media', |
|
| 558 | + 'buttons' => array('media' => t('Media')), |
|
| 559 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
|
| 560 | + 'internal' => TRUE, |
|
| 561 | + 'load' => TRUE, |
|
| 562 | 562 | ); |
| 563 | 563 | $plugins['xhtmlxtras'] = array( |
| 564 | - 'path' => $editor['library path'] . '/plugins/xhtmlxtras', |
|
| 565 | - 'buttons' => array('cite' => t('Citation'), 'del' => t('Deleted'), 'abbr' => t('Abbreviation'), 'acronym' => t('Acronym'), 'ins' => t('Inserted'), 'attribs' => t('HTML attributes')), |
|
| 566 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', |
|
| 567 | - 'internal' => TRUE, |
|
| 568 | - 'load' => TRUE, |
|
| 564 | + 'path' => $editor['library path'] . '/plugins/xhtmlxtras', |
|
| 565 | + 'buttons' => array('cite' => t('Citation'), 'del' => t('Deleted'), 'abbr' => t('Abbreviation'), 'acronym' => t('Acronym'), 'ins' => t('Inserted'), 'attribs' => t('HTML attributes')), |
|
| 566 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', |
|
| 567 | + 'internal' => TRUE, |
|
| 568 | + 'load' => TRUE, |
|
| 569 | 569 | ); |
| 570 | - } |
|
| 571 | - if (version_compare($editor['installed version'], '3', '>')) { |
|
| 570 | + } |
|
| 571 | + if (version_compare($editor['installed version'], '3', '>')) { |
|
| 572 | 572 | $plugins['bbcode'] = array( |
| 573 | - 'path' => $editor['library path'] . '/plugins/bbcode', |
|
| 574 | - 'extensions' => array('bbcode' => t('BBCode')), |
|
| 575 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', |
|
| 576 | - 'internal' => TRUE, |
|
| 577 | - 'load' => TRUE, |
|
| 573 | + 'path' => $editor['library path'] . '/plugins/bbcode', |
|
| 574 | + 'extensions' => array('bbcode' => t('BBCode')), |
|
| 575 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', |
|
| 576 | + 'internal' => TRUE, |
|
| 577 | + 'load' => TRUE, |
|
| 578 | 578 | ); |
| 579 | 579 | if (version_compare($editor['installed version'], '3.3', '<')) { |
| 580 | - $plugins['safari'] = array( |
|
| 580 | + $plugins['safari'] = array( |
|
| 581 | 581 | 'path' => $editor['library path'] . '/plugins/safari', |
| 582 | 582 | 'extensions' => array('safari' => t('Safari compatibility')), |
| 583 | 583 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', |
| 584 | 584 | 'internal' => TRUE, |
| 585 | 585 | 'load' => TRUE, |
| 586 | - ); |
|
| 586 | + ); |
|
| 587 | 587 | } |
| 588 | - } |
|
| 589 | - if (version_compare($editor['installed version'], '3.2.5', '>=')) { |
|
| 588 | + } |
|
| 589 | + if (version_compare($editor['installed version'], '3.2.5', '>=')) { |
|
| 590 | 590 | $plugins['autoresize'] = array( |
| 591 | - 'path' => $editor['library path'] . '/plugins/autoresize', |
|
| 592 | - 'extensions' => array('autoresize' => t('Auto resize')), |
|
| 593 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize', |
|
| 594 | - 'internal' => TRUE, |
|
| 595 | - 'load' => TRUE, |
|
| 591 | + 'path' => $editor['library path'] . '/plugins/autoresize', |
|
| 592 | + 'extensions' => array('autoresize' => t('Auto resize')), |
|
| 593 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize', |
|
| 594 | + 'internal' => TRUE, |
|
| 595 | + 'load' => TRUE, |
|
| 596 | 596 | ); |
| 597 | - } |
|
| 598 | - if (version_compare($editor['installed version'], '3.3', '>=')) { |
|
| 597 | + } |
|
| 598 | + if (version_compare($editor['installed version'], '3.3', '>=')) { |
|
| 599 | 599 | $plugins['advlist'] = array( |
| 600 | - 'path' => $editor['library path'] . '/plugins/advlist', |
|
| 601 | - 'extensions' => array('advlist' => t('Advanced list')), |
|
| 602 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist', |
|
| 603 | - 'internal' => TRUE, |
|
| 604 | - 'load' => TRUE, |
|
| 600 | + 'path' => $editor['library path'] . '/plugins/advlist', |
|
| 601 | + 'extensions' => array('advlist' => t('Advanced list')), |
|
| 602 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist', |
|
| 603 | + 'internal' => TRUE, |
|
| 604 | + 'load' => TRUE, |
|
| 605 | 605 | ); |
| 606 | - } |
|
| 607 | - if (version_compare($editor['installed version'], '3.2.6', '>=')) { |
|
| 606 | + } |
|
| 607 | + if (version_compare($editor['installed version'], '3.2.6', '>=')) { |
|
| 608 | 608 | $plugins['wordcount'] = array( |
| 609 | - 'path' => $editor['library path'] . '/plugins/wordcount', |
|
| 610 | - 'extensions' => array('wordcount' => t('Word count')), |
|
| 611 | - 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', |
|
| 612 | - 'internal' => TRUE, |
|
| 613 | - 'load' => TRUE, |
|
| 609 | + 'path' => $editor['library path'] . '/plugins/wordcount', |
|
| 610 | + 'extensions' => array('wordcount' => t('Word count')), |
|
| 611 | + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', |
|
| 612 | + 'internal' => TRUE, |
|
| 613 | + 'load' => TRUE, |
|
| 614 | 614 | ); |
| 615 | - } |
|
| 616 | - return $plugins; |
|
| 615 | + } |
|
| 616 | + return $plugins; |
|
| 617 | 617 | } |
| 618 | 618 | |
@@ -261,32 +261,32 @@ |
||
| 261 | 261 | |
| 262 | 262 | // Add theme-specific settings. |
| 263 | 263 | switch ($theme) { |
| 264 | - case 'advanced': |
|
| 264 | + case 'advanced': |
|
| 265 | + $settings += array( |
|
| 266 | + 'theme_advanced_resize_horizontal' => FALSE, |
|
| 267 | + 'theme_advanced_resizing_use_cookie' => FALSE, |
|
| 268 | + 'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom', |
|
| 269 | + 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
|
| 270 | + 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
|
| 271 | + 'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left', |
|
| 272 | + ); |
|
| 273 | + if (isset($config['block_formats'])) { |
|
| 274 | + $settings['theme_advanced_blockformats'] = $config['block_formats']; |
|
| 275 | + } |
|
| 276 | + if (isset($settings['buttons'])) { |
|
| 277 | + // These rows explicitly need to be set to be empty, otherwise TinyMCE |
|
| 278 | + // loads its default buttons of the advanced theme for each row. |
|
| 265 | 279 | $settings += array( |
| 266 | - 'theme_advanced_resize_horizontal' => FALSE, |
|
| 267 | - 'theme_advanced_resizing_use_cookie' => FALSE, |
|
| 268 | - 'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom', |
|
| 269 | - 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
|
| 270 | - 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
|
| 271 | - 'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left', |
|
| 280 | + 'theme_advanced_buttons1' => array(), |
|
| 281 | + 'theme_advanced_buttons2' => array(), |
|
| 282 | + 'theme_advanced_buttons3' => array(), |
|
| 272 | 283 | ); |
| 273 | - if (isset($config['block_formats'])) { |
|
| 274 | - $settings['theme_advanced_blockformats'] = $config['block_formats']; |
|
| 284 | + // @todo Allow to sort/arrange editor buttons. |
|
| 285 | + for ($i = 0; $i < count($settings['buttons']); $i++) { |
|
| 286 | + $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 275 | 287 | } |
| 276 | - if (isset($settings['buttons'])) { |
|
| 277 | - // These rows explicitly need to be set to be empty, otherwise TinyMCE |
|
| 278 | - // loads its default buttons of the advanced theme for each row. |
|
| 279 | - $settings += array( |
|
| 280 | - 'theme_advanced_buttons1' => array(), |
|
| 281 | - 'theme_advanced_buttons2' => array(), |
|
| 282 | - 'theme_advanced_buttons3' => array(), |
|
| 283 | - ); |
|
| 284 | - // @todo Allow to sort/arrange editor buttons. |
|
| 285 | - for ($i = 0; $i < count($settings['buttons']); $i++) { |
|
| 286 | - $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 287 | - } |
|
| 288 | - } |
|
| 289 | - break; |
|
| 288 | + } |
|
| 289 | + break; |
|
| 290 | 290 | } |
| 291 | 291 | unset($settings['buttons']); |
| 292 | 292 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | 'title' => 'TinyMCE', |
| 16 | 16 | 'vendor url' => 'http://tinymce.moxiecode.com', |
| 17 | 17 | 'download url' => 'http://tinymce.moxiecode.com/download.php', |
| 18 | - 'library path' => wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce', |
|
| 18 | + 'library path' => wysiwyg_get_path('tinymce').'/jscripts/tiny_mce', |
|
| 19 | 19 | 'libraries' => array( |
| 20 | 20 | '' => array( |
| 21 | 21 | 'title' => 'Minified', |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * The installed editor version. |
| 81 | 81 | */ |
| 82 | 82 | function wysiwyg_tinymce_version($editor) { |
| 83 | - $script = $editor['library path'] . '/tiny_mce.js'; |
|
| 83 | + $script = $editor['library path'].'/tiny_mce.js'; |
|
| 84 | 84 | if (!file_exists($script)) { |
| 85 | 85 | return; |
| 86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // 2.x: this.majorVersion="2";this.minorVersion="1.3" |
| 92 | 92 | // 3.x: majorVersion:'3',minorVersion:'2.0.1' |
| 93 | 93 | if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) { |
| 94 | - return $version[1] . '.' . $version[2]; |
|
| 94 | + return $version[1].'.'.$version[2]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $settings['remove_linebreaks'] = $config['remove_linebreaks']; |
| 179 | 179 | } |
| 180 | 180 | if (isset($config['verify_html'])) { |
| 181 | - $settings['verify_html'] = (bool) $config['verify_html']; |
|
| 181 | + $settings['verify_html'] = (bool)$config['verify_html']; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (!empty($config['css_classes'])) { |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $plugin['filename'] = array_pop($parts); |
| 325 | 325 | $plugin['path'] = implode('/', $parts); |
| 326 | 326 | } |
| 327 | - $settings[$name] = base_path() . $plugin['path'] . '/' . $plugin['filename']; |
|
| 327 | + $settings[$name] = base_path().$plugin['path'].'/'.$plugin['filename']; |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -340,11 +340,11 @@ discard block |
||
| 340 | 340 | // Populate required plugin settings. |
| 341 | 341 | $settings[$name] = $plugin['dialog settings'] + array( |
| 342 | 342 | 'title' => $plugin['title'], |
| 343 | - 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], |
|
| 343 | + 'icon' => base_path().$plugin['icon path'].'/'.$plugin['icon file'], |
|
| 344 | 344 | 'iconTitle' => $plugin['icon title'], |
| 345 | 345 | ); |
| 346 | 346 | if (isset($plugin['css file'])) { |
| 347 | - $settings[$name]['css'] = base_path() . $plugin['css path'] . '/' . $plugin['css file']; |
|
| 347 | + $settings[$name]['css'] = base_path().$plugin['css path'].'/'.$plugin['css file']; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | return $settings; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | function _wysiwyg_tinymce_plugin_name($op, $name) { |
| 365 | 365 | if ($op == 'add') { |
| 366 | 366 | if (strpos($name, '-') !== 0) { |
| 367 | - return '-' . $name; |
|
| 367 | + return '-'.$name; |
|
| 368 | 368 | } |
| 369 | 369 | return $name; |
| 370 | 370 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | function wysiwyg_tinymce_plugins($editor) { |
| 383 | 383 | $plugins = array( |
| 384 | 384 | 'default' => array( |
| 385 | - 'path' => $editor['library path'] . '/themes/advanced', |
|
| 385 | + 'path' => $editor['library path'].'/themes/advanced', |
|
| 386 | 386 | 'buttons' => array( |
| 387 | 387 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 388 | 388 | 'strikethrough' => t('Strike-through'), |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | 'internal' => TRUE, |
| 407 | 407 | ), |
| 408 | 408 | 'advhr' => array( |
| 409 | - 'path' => $editor['library path'] . '/plugins/advhr', |
|
| 409 | + 'path' => $editor['library path'].'/plugins/advhr', |
|
| 410 | 410 | 'buttons' => array('advhr' => t('Advanced horizontal rule')), |
| 411 | 411 | 'extended_valid_elements' => array('hr[class|width|size|noshade]'), |
| 412 | 412 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | 'load' => TRUE, |
| 415 | 415 | ), |
| 416 | 416 | 'advimage' => array( |
| 417 | - 'path' => $editor['library path'] . '/plugins/advimage', |
|
| 417 | + 'path' => $editor['library path'].'/plugins/advimage', |
|
| 418 | 418 | 'extensions' => array('advimage' => t('Advanced image')), |
| 419 | 419 | 'extended_valid_elements' => array('img[src|alt|title|align|width|height|usemap|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), |
| 420 | 420 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | 'load' => TRUE, |
| 423 | 423 | ), |
| 424 | 424 | 'advlink' => array( |
| 425 | - 'path' => $editor['library path'] . '/plugins/advlink', |
|
| 425 | + 'path' => $editor['library path'].'/plugins/advlink', |
|
| 426 | 426 | 'extensions' => array('advlink' => t('Advanced link')), |
| 427 | 427 | 'extended_valid_elements' => array('a[name|href|target|title|class|onfocus|onblur|onclick|ondlbclick|onmousedown|onmouseup|onmouseover|onmouseout|onkeypress|onkeydown|onkeyup|id|style|rel]'), |
| 428 | 428 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', |
@@ -430,49 +430,49 @@ discard block |
||
| 430 | 430 | 'load' => TRUE, |
| 431 | 431 | ), |
| 432 | 432 | 'autosave' => array( |
| 433 | - 'path' => $editor['library path'] . '/plugins/autosave', |
|
| 433 | + 'path' => $editor['library path'].'/plugins/autosave', |
|
| 434 | 434 | 'extensions' => array('autosave' => t('Auto save')), |
| 435 | 435 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', |
| 436 | 436 | 'internal' => TRUE, |
| 437 | 437 | 'load' => TRUE, |
| 438 | 438 | ), |
| 439 | 439 | 'contextmenu' => array( |
| 440 | - 'path' => $editor['library path'] . '/plugins/contextmenu', |
|
| 440 | + 'path' => $editor['library path'].'/plugins/contextmenu', |
|
| 441 | 441 | 'extensions' => array('contextmenu' => t('Context menu')), |
| 442 | 442 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', |
| 443 | 443 | 'internal' => TRUE, |
| 444 | 444 | 'load' => TRUE, |
| 445 | 445 | ), |
| 446 | 446 | 'directionality' => array( |
| 447 | - 'path' => $editor['library path'] . '/plugins/directionality', |
|
| 447 | + 'path' => $editor['library path'].'/plugins/directionality', |
|
| 448 | 448 | 'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')), |
| 449 | 449 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', |
| 450 | 450 | 'internal' => TRUE, |
| 451 | 451 | 'load' => TRUE, |
| 452 | 452 | ), |
| 453 | 453 | 'emotions' => array( |
| 454 | - 'path' => $editor['library path'] . '/plugins/emotions', |
|
| 454 | + 'path' => $editor['library path'].'/plugins/emotions', |
|
| 455 | 455 | 'buttons' => array('emotions' => t('Emotions')), |
| 456 | 456 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', |
| 457 | 457 | 'internal' => TRUE, |
| 458 | 458 | 'load' => TRUE, |
| 459 | 459 | ), |
| 460 | 460 | 'font' => array( |
| 461 | - 'path' => $editor['library path'] . '/plugins/font', |
|
| 461 | + 'path' => $editor['library path'].'/plugins/font', |
|
| 462 | 462 | 'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')), |
| 463 | 463 | 'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'), |
| 464 | 464 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font', |
| 465 | 465 | 'internal' => TRUE, |
| 466 | 466 | ), |
| 467 | 467 | 'fullscreen' => array( |
| 468 | - 'path' => $editor['library path'] . '/plugins/fullscreen', |
|
| 468 | + 'path' => $editor['library path'].'/plugins/fullscreen', |
|
| 469 | 469 | 'buttons' => array('fullscreen' => t('Fullscreen')), |
| 470 | 470 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', |
| 471 | 471 | 'internal' => TRUE, |
| 472 | 472 | 'load' => TRUE, |
| 473 | 473 | ), |
| 474 | 474 | 'inlinepopups' => array( |
| 475 | - 'path' => $editor['library path'] . '/plugins/inlinepopups', |
|
| 475 | + 'path' => $editor['library path'].'/plugins/inlinepopups', |
|
| 476 | 476 | 'extensions' => array('inlinepopups' => t('Inline popups')), |
| 477 | 477 | 'options' => array( |
| 478 | 478 | 'dialog_type' => array('modal'), |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | 'load' => TRUE, |
| 483 | 483 | ), |
| 484 | 484 | 'insertdatetime' => array( |
| 485 | - 'path' => $editor['library path'] . '/plugins/insertdatetime', |
|
| 485 | + 'path' => $editor['library path'].'/plugins/insertdatetime', |
|
| 486 | 486 | 'buttons' => array('insertdate' => t('Insert date'), 'inserttime' => t('Insert time')), |
| 487 | 487 | 'options' => array( |
| 488 | 488 | 'plugin_insertdate_dateFormat' => '%Y-%m-%d', |
@@ -493,49 +493,49 @@ discard block |
||
| 493 | 493 | 'load' => TRUE, |
| 494 | 494 | ), |
| 495 | 495 | 'layer' => array( |
| 496 | - 'path' => $editor['library path'] . '/plugins/layer', |
|
| 496 | + 'path' => $editor['library path'].'/plugins/layer', |
|
| 497 | 497 | 'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')), |
| 498 | 498 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer', |
| 499 | 499 | 'internal' => TRUE, |
| 500 | 500 | 'load' => TRUE, |
| 501 | 501 | ), |
| 502 | 502 | 'paste' => array( |
| 503 | - 'path' => $editor['library path'] . '/plugins/paste', |
|
| 503 | + 'path' => $editor['library path'].'/plugins/paste', |
|
| 504 | 504 | 'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')), |
| 505 | 505 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', |
| 506 | 506 | 'internal' => TRUE, |
| 507 | 507 | 'load' => TRUE, |
| 508 | 508 | ), |
| 509 | 509 | 'preview' => array( |
| 510 | - 'path' => $editor['library path'] . '/plugins/preview', |
|
| 510 | + 'path' => $editor['library path'].'/plugins/preview', |
|
| 511 | 511 | 'buttons' => array('preview' => t('Preview')), |
| 512 | 512 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', |
| 513 | 513 | 'internal' => TRUE, |
| 514 | 514 | 'load' => TRUE, |
| 515 | 515 | ), |
| 516 | 516 | 'print' => array( |
| 517 | - 'path' => $editor['library path'] . '/plugins/print', |
|
| 517 | + 'path' => $editor['library path'].'/plugins/print', |
|
| 518 | 518 | 'buttons' => array('print' => t('Print')), |
| 519 | 519 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
| 520 | 520 | 'internal' => TRUE, |
| 521 | 521 | 'load' => TRUE, |
| 522 | 522 | ), |
| 523 | 523 | 'searchreplace' => array( |
| 524 | - 'path' => $editor['library path'] . '/plugins/searchreplace', |
|
| 524 | + 'path' => $editor['library path'].'/plugins/searchreplace', |
|
| 525 | 525 | 'buttons' => array('search' => t('Search'), 'replace' => t('Replace')), |
| 526 | 526 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', |
| 527 | 527 | 'internal' => TRUE, |
| 528 | 528 | 'load' => TRUE, |
| 529 | 529 | ), |
| 530 | 530 | 'style' => array( |
| 531 | - 'path' => $editor['library path'] . '/plugins/style', |
|
| 531 | + 'path' => $editor['library path'].'/plugins/style', |
|
| 532 | 532 | 'buttons' => array('styleprops' => t('Style properties')), |
| 533 | 533 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', |
| 534 | 534 | 'internal' => TRUE, |
| 535 | 535 | 'load' => TRUE, |
| 536 | 536 | ), |
| 537 | 537 | 'table' => array( |
| 538 | - 'path' => $editor['library path'] . '/plugins/table', |
|
| 538 | + 'path' => $editor['library path'].'/plugins/table', |
|
| 539 | 539 | 'buttons' => array('tablecontrols' => t('Table')), |
| 540 | 540 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', |
| 541 | 541 | 'internal' => TRUE, |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | ); |
| 545 | 545 | if (version_compare($editor['installed version'], '3', '<')) { |
| 546 | 546 | $plugins['flash'] = array( |
| 547 | - 'path' => $editor['library path'] . '/plugins/flash', |
|
| 547 | + 'path' => $editor['library path'].'/plugins/flash', |
|
| 548 | 548 | 'buttons' => array('flash' => t('Flash')), |
| 549 | 549 | 'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'), |
| 550 | 550 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash', |
@@ -554,14 +554,14 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | if (version_compare($editor['installed version'], '2.0.6', '>')) { |
| 556 | 556 | $plugins['media'] = array( |
| 557 | - 'path' => $editor['library path'] . '/plugins/media', |
|
| 557 | + 'path' => $editor['library path'].'/plugins/media', |
|
| 558 | 558 | 'buttons' => array('media' => t('Media')), |
| 559 | 559 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
| 560 | 560 | 'internal' => TRUE, |
| 561 | 561 | 'load' => TRUE, |
| 562 | 562 | ); |
| 563 | 563 | $plugins['xhtmlxtras'] = array( |
| 564 | - 'path' => $editor['library path'] . '/plugins/xhtmlxtras', |
|
| 564 | + 'path' => $editor['library path'].'/plugins/xhtmlxtras', |
|
| 565 | 565 | 'buttons' => array('cite' => t('Citation'), 'del' => t('Deleted'), 'abbr' => t('Abbreviation'), 'acronym' => t('Acronym'), 'ins' => t('Inserted'), 'attribs' => t('HTML attributes')), |
| 566 | 566 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', |
| 567 | 567 | 'internal' => TRUE, |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | if (version_compare($editor['installed version'], '3', '>')) { |
| 572 | 572 | $plugins['bbcode'] = array( |
| 573 | - 'path' => $editor['library path'] . '/plugins/bbcode', |
|
| 573 | + 'path' => $editor['library path'].'/plugins/bbcode', |
|
| 574 | 574 | 'extensions' => array('bbcode' => t('BBCode')), |
| 575 | 575 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', |
| 576 | 576 | 'internal' => TRUE, |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | ); |
| 579 | 579 | if (version_compare($editor['installed version'], '3.3', '<')) { |
| 580 | 580 | $plugins['safari'] = array( |
| 581 | - 'path' => $editor['library path'] . '/plugins/safari', |
|
| 581 | + 'path' => $editor['library path'].'/plugins/safari', |
|
| 582 | 582 | 'extensions' => array('safari' => t('Safari compatibility')), |
| 583 | 583 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', |
| 584 | 584 | 'internal' => TRUE, |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | } |
| 589 | 589 | if (version_compare($editor['installed version'], '3.2.5', '>=')) { |
| 590 | 590 | $plugins['autoresize'] = array( |
| 591 | - 'path' => $editor['library path'] . '/plugins/autoresize', |
|
| 591 | + 'path' => $editor['library path'].'/plugins/autoresize', |
|
| 592 | 592 | 'extensions' => array('autoresize' => t('Auto resize')), |
| 593 | 593 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize', |
| 594 | 594 | 'internal' => TRUE, |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | if (version_compare($editor['installed version'], '3.3', '>=')) { |
| 599 | 599 | $plugins['advlist'] = array( |
| 600 | - 'path' => $editor['library path'] . '/plugins/advlist', |
|
| 600 | + 'path' => $editor['library path'].'/plugins/advlist', |
|
| 601 | 601 | 'extensions' => array('advlist' => t('Advanced list')), |
| 602 | 602 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist', |
| 603 | 603 | 'internal' => TRUE, |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | if (version_compare($editor['installed version'], '3.2.6', '>=')) { |
| 608 | 608 | $plugins['wordcount'] = array( |
| 609 | - 'path' => $editor['library path'] . '/plugins/wordcount', |
|
| 609 | + 'path' => $editor['library path'].'/plugins/wordcount', |
|
| 610 | 610 | 'extensions' => array('wordcount' => t('Word count')), |
| 611 | 611 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', |
| 612 | 612 | 'internal' => TRUE, |
@@ -188,8 +188,7 @@ discard block |
||
| 188 | 188 | if (isset($config['css_setting'])) { |
| 189 | 189 | if ($config['css_setting'] == 'theme') { |
| 190 | 190 | $settings['content_css'] = implode(',', wysiwyg_get_css()); |
| 191 | - } |
|
| 192 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 191 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 193 | 192 | $settings['content_css'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 194 | 193 | } |
| 195 | 194 | } |
@@ -367,8 +366,7 @@ discard block |
||
| 367 | 366 | return '-' . $name; |
| 368 | 367 | } |
| 369 | 368 | return $name; |
| 370 | - } |
|
| 371 | - else if ($op == 'remove') { |
|
| 369 | + } else if ($op == 'remove') { |
|
| 372 | 370 | if (strpos($name, '-') === 0) { |
| 373 | 371 | return substr($name, 1); |
| 374 | 372 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | 'plugin settings callback' => 'wysiwyg_tinymce_plugin_settings', |
| 34 | 34 | 'proxy plugin' => array( |
| 35 | 35 | 'drupal' => array( |
| 36 | - 'load' => TRUE, |
|
| 37 | - 'proxy' => TRUE, |
|
| 36 | + 'load' => true, |
|
| 37 | + 'proxy' => true, |
|
| 38 | 38 | ), |
| 39 | 39 | ), |
| 40 | 40 | 'proxy plugin settings callback' => 'wysiwyg_tinymce_proxy_plugin_settings', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | '' => array( |
| 53 | 53 | 'title' => 'Minified', |
| 54 | 54 | 'files' => array( |
| 55 | - 'tiny_mce.js' => array('preprocess' => FALSE), |
|
| 55 | + 'tiny_mce.js' => array('preprocess' => false), |
|
| 56 | 56 | ), |
| 57 | 57 | ), |
| 58 | 58 | 'jquery' => array( |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function wysiwyg_tinymce_settings($editor, $config, $theme) { |
| 143 | 143 | $settings = array( |
| 144 | - 'button_tile_map' => TRUE, // @todo Add a setting for this. |
|
| 144 | + 'button_tile_map' => true, // @todo Add a setting for this. |
|
| 145 | 145 | 'document_base_url' => base_path(), |
| 146 | 146 | 'mode' => 'none', |
| 147 | 147 | 'plugins' => array(), |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | 'width' => '100%', |
| 150 | 150 | // Strict loading mode must be enabled; otherwise TinyMCE would use |
| 151 | 151 | // document.write() in IE and Chrome. |
| 152 | - 'strict_loading_mode' => TRUE, |
|
| 152 | + 'strict_loading_mode' => true, |
|
| 153 | 153 | // TinyMCE's URL conversion magic breaks Drupal modules that use a special |
| 154 | 154 | // syntax for paths. This makes 'relative_urls' obsolete. |
| 155 | - 'convert_urls' => FALSE, |
|
| 155 | + 'convert_urls' => false, |
|
| 156 | 156 | // The default entity_encoding ('named') converts too many characters in |
| 157 | 157 | // languages (like Greek). Since Drupal supports Unicode, we only convert |
| 158 | 158 | // HTML control characters and invisible characters. TinyMCE always converts |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | switch ($theme) { |
| 264 | 264 | case 'advanced': |
| 265 | 265 | $settings += array( |
| 266 | - 'theme_advanced_resize_horizontal' => FALSE, |
|
| 267 | - 'theme_advanced_resizing_use_cookie' => FALSE, |
|
| 266 | + 'theme_advanced_resize_horizontal' => false, |
|
| 267 | + 'theme_advanced_resizing_use_cookie' => false, |
|
| 268 | 268 | 'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom', |
| 269 | 269 | 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
| 270 | 270 | 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
@@ -403,73 +403,73 @@ discard block |
||
| 403 | 403 | 'charmap' => t('Character map'), |
| 404 | 404 | 'help' => t('Help'), |
| 405 | 405 | ), |
| 406 | - 'internal' => TRUE, |
|
| 406 | + 'internal' => true, |
|
| 407 | 407 | ), |
| 408 | 408 | 'advhr' => array( |
| 409 | 409 | 'path' => $editor['library path'] . '/plugins/advhr', |
| 410 | 410 | 'buttons' => array('advhr' => t('Advanced horizontal rule')), |
| 411 | 411 | 'extended_valid_elements' => array('hr[class|width|size|noshade]'), |
| 412 | 412 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', |
| 413 | - 'internal' => TRUE, |
|
| 414 | - 'load' => TRUE, |
|
| 413 | + 'internal' => true, |
|
| 414 | + 'load' => true, |
|
| 415 | 415 | ), |
| 416 | 416 | 'advimage' => array( |
| 417 | 417 | 'path' => $editor['library path'] . '/plugins/advimage', |
| 418 | 418 | 'extensions' => array('advimage' => t('Advanced image')), |
| 419 | 419 | 'extended_valid_elements' => array('img[src|alt|title|align|width|height|usemap|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), |
| 420 | 420 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', |
| 421 | - 'internal' => TRUE, |
|
| 422 | - 'load' => TRUE, |
|
| 421 | + 'internal' => true, |
|
| 422 | + 'load' => true, |
|
| 423 | 423 | ), |
| 424 | 424 | 'advlink' => array( |
| 425 | 425 | 'path' => $editor['library path'] . '/plugins/advlink', |
| 426 | 426 | 'extensions' => array('advlink' => t('Advanced link')), |
| 427 | 427 | 'extended_valid_elements' => array('a[name|href|target|title|class|onfocus|onblur|onclick|ondlbclick|onmousedown|onmouseup|onmouseover|onmouseout|onkeypress|onkeydown|onkeyup|id|style|rel]'), |
| 428 | 428 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', |
| 429 | - 'internal' => TRUE, |
|
| 430 | - 'load' => TRUE, |
|
| 429 | + 'internal' => true, |
|
| 430 | + 'load' => true, |
|
| 431 | 431 | ), |
| 432 | 432 | 'autosave' => array( |
| 433 | 433 | 'path' => $editor['library path'] . '/plugins/autosave', |
| 434 | 434 | 'extensions' => array('autosave' => t('Auto save')), |
| 435 | 435 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', |
| 436 | - 'internal' => TRUE, |
|
| 437 | - 'load' => TRUE, |
|
| 436 | + 'internal' => true, |
|
| 437 | + 'load' => true, |
|
| 438 | 438 | ), |
| 439 | 439 | 'contextmenu' => array( |
| 440 | 440 | 'path' => $editor['library path'] . '/plugins/contextmenu', |
| 441 | 441 | 'extensions' => array('contextmenu' => t('Context menu')), |
| 442 | 442 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', |
| 443 | - 'internal' => TRUE, |
|
| 444 | - 'load' => TRUE, |
|
| 443 | + 'internal' => true, |
|
| 444 | + 'load' => true, |
|
| 445 | 445 | ), |
| 446 | 446 | 'directionality' => array( |
| 447 | 447 | 'path' => $editor['library path'] . '/plugins/directionality', |
| 448 | 448 | 'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')), |
| 449 | 449 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', |
| 450 | - 'internal' => TRUE, |
|
| 451 | - 'load' => TRUE, |
|
| 450 | + 'internal' => true, |
|
| 451 | + 'load' => true, |
|
| 452 | 452 | ), |
| 453 | 453 | 'emotions' => array( |
| 454 | 454 | 'path' => $editor['library path'] . '/plugins/emotions', |
| 455 | 455 | 'buttons' => array('emotions' => t('Emotions')), |
| 456 | 456 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', |
| 457 | - 'internal' => TRUE, |
|
| 458 | - 'load' => TRUE, |
|
| 457 | + 'internal' => true, |
|
| 458 | + 'load' => true, |
|
| 459 | 459 | ), |
| 460 | 460 | 'font' => array( |
| 461 | 461 | 'path' => $editor['library path'] . '/plugins/font', |
| 462 | 462 | 'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')), |
| 463 | 463 | 'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'), |
| 464 | 464 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font', |
| 465 | - 'internal' => TRUE, |
|
| 465 | + 'internal' => true, |
|
| 466 | 466 | ), |
| 467 | 467 | 'fullscreen' => array( |
| 468 | 468 | 'path' => $editor['library path'] . '/plugins/fullscreen', |
| 469 | 469 | 'buttons' => array('fullscreen' => t('Fullscreen')), |
| 470 | 470 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', |
| 471 | - 'internal' => TRUE, |
|
| 472 | - 'load' => TRUE, |
|
| 471 | + 'internal' => true, |
|
| 472 | + 'load' => true, |
|
| 473 | 473 | ), |
| 474 | 474 | 'inlinepopups' => array( |
| 475 | 475 | 'path' => $editor['library path'] . '/plugins/inlinepopups', |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | 'dialog_type' => array('modal'), |
| 479 | 479 | ), |
| 480 | 480 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', |
| 481 | - 'internal' => TRUE, |
|
| 482 | - 'load' => TRUE, |
|
| 481 | + 'internal' => true, |
|
| 482 | + 'load' => true, |
|
| 483 | 483 | ), |
| 484 | 484 | 'insertdatetime' => array( |
| 485 | 485 | 'path' => $editor['library path'] . '/plugins/insertdatetime', |
@@ -489,57 +489,57 @@ discard block |
||
| 489 | 489 | 'plugin_insertdate_timeFormat' => '%H:%M:%S', |
| 490 | 490 | ), |
| 491 | 491 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime', |
| 492 | - 'internal' => TRUE, |
|
| 493 | - 'load' => TRUE, |
|
| 492 | + 'internal' => true, |
|
| 493 | + 'load' => true, |
|
| 494 | 494 | ), |
| 495 | 495 | 'layer' => array( |
| 496 | 496 | 'path' => $editor['library path'] . '/plugins/layer', |
| 497 | 497 | 'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')), |
| 498 | 498 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer', |
| 499 | - 'internal' => TRUE, |
|
| 500 | - 'load' => TRUE, |
|
| 499 | + 'internal' => true, |
|
| 500 | + 'load' => true, |
|
| 501 | 501 | ), |
| 502 | 502 | 'paste' => array( |
| 503 | 503 | 'path' => $editor['library path'] . '/plugins/paste', |
| 504 | 504 | 'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')), |
| 505 | 505 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', |
| 506 | - 'internal' => TRUE, |
|
| 507 | - 'load' => TRUE, |
|
| 506 | + 'internal' => true, |
|
| 507 | + 'load' => true, |
|
| 508 | 508 | ), |
| 509 | 509 | 'preview' => array( |
| 510 | 510 | 'path' => $editor['library path'] . '/plugins/preview', |
| 511 | 511 | 'buttons' => array('preview' => t('Preview')), |
| 512 | 512 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', |
| 513 | - 'internal' => TRUE, |
|
| 514 | - 'load' => TRUE, |
|
| 513 | + 'internal' => true, |
|
| 514 | + 'load' => true, |
|
| 515 | 515 | ), |
| 516 | 516 | 'print' => array( |
| 517 | 517 | 'path' => $editor['library path'] . '/plugins/print', |
| 518 | 518 | 'buttons' => array('print' => t('Print')), |
| 519 | 519 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
| 520 | - 'internal' => TRUE, |
|
| 521 | - 'load' => TRUE, |
|
| 520 | + 'internal' => true, |
|
| 521 | + 'load' => true, |
|
| 522 | 522 | ), |
| 523 | 523 | 'searchreplace' => array( |
| 524 | 524 | 'path' => $editor['library path'] . '/plugins/searchreplace', |
| 525 | 525 | 'buttons' => array('search' => t('Search'), 'replace' => t('Replace')), |
| 526 | 526 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', |
| 527 | - 'internal' => TRUE, |
|
| 528 | - 'load' => TRUE, |
|
| 527 | + 'internal' => true, |
|
| 528 | + 'load' => true, |
|
| 529 | 529 | ), |
| 530 | 530 | 'style' => array( |
| 531 | 531 | 'path' => $editor['library path'] . '/plugins/style', |
| 532 | 532 | 'buttons' => array('styleprops' => t('Style properties')), |
| 533 | 533 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', |
| 534 | - 'internal' => TRUE, |
|
| 535 | - 'load' => TRUE, |
|
| 534 | + 'internal' => true, |
|
| 535 | + 'load' => true, |
|
| 536 | 536 | ), |
| 537 | 537 | 'table' => array( |
| 538 | 538 | 'path' => $editor['library path'] . '/plugins/table', |
| 539 | 539 | 'buttons' => array('tablecontrols' => t('Table')), |
| 540 | 540 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', |
| 541 | - 'internal' => TRUE, |
|
| 542 | - 'load' => TRUE, |
|
| 541 | + 'internal' => true, |
|
| 542 | + 'load' => true, |
|
| 543 | 543 | ), |
| 544 | 544 | ); |
| 545 | 545 | if (version_compare($editor['installed version'], '3', '<')) { |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | 'buttons' => array('flash' => t('Flash')), |
| 549 | 549 | 'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'), |
| 550 | 550 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash', |
| 551 | - 'internal' => TRUE, |
|
| 552 | - 'load' => TRUE, |
|
| 551 | + 'internal' => true, |
|
| 552 | + 'load' => true, |
|
| 553 | 553 | ); |
| 554 | 554 | } |
| 555 | 555 | if (version_compare($editor['installed version'], '2.0.6', '>')) { |
@@ -557,15 +557,15 @@ discard block |
||
| 557 | 557 | 'path' => $editor['library path'] . '/plugins/media', |
| 558 | 558 | 'buttons' => array('media' => t('Media')), |
| 559 | 559 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
| 560 | - 'internal' => TRUE, |
|
| 561 | - 'load' => TRUE, |
|
| 560 | + 'internal' => true, |
|
| 561 | + 'load' => true, |
|
| 562 | 562 | ); |
| 563 | 563 | $plugins['xhtmlxtras'] = array( |
| 564 | 564 | 'path' => $editor['library path'] . '/plugins/xhtmlxtras', |
| 565 | 565 | 'buttons' => array('cite' => t('Citation'), 'del' => t('Deleted'), 'abbr' => t('Abbreviation'), 'acronym' => t('Acronym'), 'ins' => t('Inserted'), 'attribs' => t('HTML attributes')), |
| 566 | 566 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', |
| 567 | - 'internal' => TRUE, |
|
| 568 | - 'load' => TRUE, |
|
| 567 | + 'internal' => true, |
|
| 568 | + 'load' => true, |
|
| 569 | 569 | ); |
| 570 | 570 | } |
| 571 | 571 | if (version_compare($editor['installed version'], '3', '>')) { |
@@ -573,16 +573,16 @@ discard block |
||
| 573 | 573 | 'path' => $editor['library path'] . '/plugins/bbcode', |
| 574 | 574 | 'extensions' => array('bbcode' => t('BBCode')), |
| 575 | 575 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', |
| 576 | - 'internal' => TRUE, |
|
| 577 | - 'load' => TRUE, |
|
| 576 | + 'internal' => true, |
|
| 577 | + 'load' => true, |
|
| 578 | 578 | ); |
| 579 | 579 | if (version_compare($editor['installed version'], '3.3', '<')) { |
| 580 | 580 | $plugins['safari'] = array( |
| 581 | 581 | 'path' => $editor['library path'] . '/plugins/safari', |
| 582 | 582 | 'extensions' => array('safari' => t('Safari compatibility')), |
| 583 | 583 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', |
| 584 | - 'internal' => TRUE, |
|
| 585 | - 'load' => TRUE, |
|
| 584 | + 'internal' => true, |
|
| 585 | + 'load' => true, |
|
| 586 | 586 | ); |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | 'path' => $editor['library path'] . '/plugins/autoresize', |
| 592 | 592 | 'extensions' => array('autoresize' => t('Auto resize')), |
| 593 | 593 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize', |
| 594 | - 'internal' => TRUE, |
|
| 595 | - 'load' => TRUE, |
|
| 594 | + 'internal' => true, |
|
| 595 | + 'load' => true, |
|
| 596 | 596 | ); |
| 597 | 597 | } |
| 598 | 598 | if (version_compare($editor['installed version'], '3.3', '>=')) { |
@@ -600,8 +600,8 @@ discard block |
||
| 600 | 600 | 'path' => $editor['library path'] . '/plugins/advlist', |
| 601 | 601 | 'extensions' => array('advlist' => t('Advanced list')), |
| 602 | 602 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist', |
| 603 | - 'internal' => TRUE, |
|
| 604 | - 'load' => TRUE, |
|
| 603 | + 'internal' => true, |
|
| 604 | + 'load' => true, |
|
| 605 | 605 | ); |
| 606 | 606 | } |
| 607 | 607 | if (version_compare($editor['installed version'], '3.2.6', '>=')) { |
@@ -609,8 +609,8 @@ discard block |
||
| 609 | 609 | 'path' => $editor['library path'] . '/plugins/wordcount', |
| 610 | 610 | 'extensions' => array('wordcount' => t('Word count')), |
| 611 | 611 | 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', |
| 612 | - 'internal' => TRUE, |
|
| 613 | - 'load' => TRUE, |
|
| 612 | + 'internal' => true, |
|
| 613 | + 'load' => true, |
|
| 614 | 614 | ); |
| 615 | 615 | } |
| 616 | 616 | return $plugins; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * An array containing editor properties as returned from hook_editor(). |
| 45 | 45 | * |
| 46 | 46 | * @return |
| 47 | - * The installed editor version. |
|
| 47 | + null|string The installed editor version. |
|
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_whizzywig_version($editor) { |
| 50 | 50 | $script = $editor['library path'] . '/whizzywig.js'; |
@@ -9,32 +9,32 @@ discard block |
||
| 9 | 9 | * Plugin implementation of hook_editor(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_whizzywig_editor() { |
| 12 | - $editor['whizzywig'] = array( |
|
| 12 | + $editor['whizzywig'] = array( |
|
| 13 | 13 | 'title' => 'Whizzywig', |
| 14 | 14 | 'vendor url' => 'http://www.unverse.net', |
| 15 | 15 | 'download url' => 'http://www.unverse.net/whizzywig-download.html', |
| 16 | 16 | 'libraries' => array( |
| 17 | - '' => array( |
|
| 17 | + '' => array( |
|
| 18 | 18 | 'title' => 'Default', |
| 19 | 19 | 'files' => array('whizzywig.js', 'xhtml.js'), |
| 20 | - ), |
|
| 20 | + ), |
|
| 21 | 21 | ), |
| 22 | 22 | 'version callback' => 'wysiwyg_whizzywig_version', |
| 23 | 23 | 'settings callback' => 'wysiwyg_whizzywig_settings', |
| 24 | 24 | 'plugin callback' => 'wysiwyg_whizzywig_plugins', |
| 25 | 25 | 'versions' => array( |
| 26 | - '55' => array( |
|
| 26 | + '55' => array( |
|
| 27 | 27 | 'js files' => array('whizzywig.js'), |
| 28 | - ), |
|
| 29 | - '56' => array( |
|
| 28 | + ), |
|
| 29 | + '56' => array( |
|
| 30 | 30 | 'js files' => array('whizzywig-56.js'), |
| 31 | - ), |
|
| 32 | - '60' => array( |
|
| 31 | + ), |
|
| 32 | + '60' => array( |
|
| 33 | 33 | 'js files' => array('whizzywig-60.js'), |
| 34 | - ), |
|
| 34 | + ), |
|
| 35 | 35 | ), |
| 36 | - ); |
|
| 37 | - return $editor; |
|
| 36 | + ); |
|
| 37 | + return $editor; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -47,19 +47,19 @@ discard block |
||
| 47 | 47 | * The installed editor version. |
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_whizzywig_version($editor) { |
| 50 | - $script = $editor['library path'] . '/whizzywig.js'; |
|
| 51 | - if (!file_exists($script)) { |
|
| 50 | + $script = $editor['library path'] . '/whizzywig.js'; |
|
| 51 | + if (!file_exists($script)) { |
|
| 52 | 52 | return; |
| 53 | - } |
|
| 54 | - $script = fopen($script, 'r'); |
|
| 55 | - $line = fgets($script, 43); |
|
| 56 | - // 55: Whizzywig v55i |
|
| 57 | - // 60: Whizzywig 60 |
|
| 58 | - if (preg_match('@Whizzywig v?([0-9]+)@', $line, $version)) { |
|
| 53 | + } |
|
| 54 | + $script = fopen($script, 'r'); |
|
| 55 | + $line = fgets($script, 43); |
|
| 56 | + // 55: Whizzywig v55i |
|
| 57 | + // 60: Whizzywig 60 |
|
| 58 | + if (preg_match('@Whizzywig v?([0-9]+)@', $line, $version)) { |
|
| 59 | 59 | fclose($script); |
| 60 | 60 | return $version[1]; |
| 61 | - } |
|
| 62 | - fclose($script); |
|
| 61 | + } |
|
| 62 | + fclose($script); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -77,53 +77,53 @@ discard block |
||
| 77 | 77 | * Drupal.settings.wysiwyg.configs.{editor} |
| 78 | 78 | */ |
| 79 | 79 | function wysiwyg_whizzywig_settings($editor, $config, $theme) { |
| 80 | - $settings = array(); |
|
| 80 | + $settings = array(); |
|
| 81 | 81 | |
| 82 | - // Add path to button images, if available. |
|
| 83 | - if (is_dir($editor['library path'] . '/btn')) { |
|
| 82 | + // Add path to button images, if available. |
|
| 83 | + if (is_dir($editor['library path'] . '/btn')) { |
|
| 84 | 84 | $settings['buttonPath'] = base_path() . $editor['library path'] . '/btn/'; |
| 85 | - } |
|
| 86 | - if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) { |
|
| 85 | + } |
|
| 86 | + if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) { |
|
| 87 | 87 | $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/WhizzywigToolbar.png'; |
| 88 | - } |
|
| 89 | - // Filename changed in version 60. |
|
| 90 | - elseif (file_exists($editor['library path'] . '/icons.png')) { |
|
| 88 | + } |
|
| 89 | + // Filename changed in version 60. |
|
| 90 | + elseif (file_exists($editor['library path'] . '/icons.png')) { |
|
| 91 | 91 | $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/icons.png'; |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - // Add configured buttons or all available. |
|
| 95 | - $settings['buttons'] = array(); |
|
| 96 | - if (!empty($config['buttons'])) { |
|
| 94 | + // Add configured buttons or all available. |
|
| 95 | + $settings['buttons'] = array(); |
|
| 96 | + if (!empty($config['buttons'])) { |
|
| 97 | 97 | $buttons = array(); |
| 98 | 98 | foreach ($config['buttons'] as $plugin) { |
| 99 | - $buttons = array_merge($buttons, $plugin); |
|
| 99 | + $buttons = array_merge($buttons, $plugin); |
|
| 100 | 100 | } |
| 101 | 101 | $settings['buttons'] = implode(' ', array_keys($buttons)); |
| 102 | - } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - // Add editor content stylesheet. |
|
| 105 | - if (isset($config['css_setting'])) { |
|
| 104 | + // Add editor content stylesheet. |
|
| 105 | + if (isset($config['css_setting'])) { |
|
| 106 | 106 | if ($config['css_setting'] == 'theme') { |
| 107 | - $css = path_to_theme() . '/style.css'; |
|
| 108 | - if (file_exists($css)) { |
|
| 107 | + $css = path_to_theme() . '/style.css'; |
|
| 108 | + if (file_exists($css)) { |
|
| 109 | 109 | $settings['externalCSS'] = base_path() . $css; |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | } |
| 112 | 112 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
| 113 | - $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 113 | + $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
|
| 114 | + } |
|
| 114 | 115 | } |
| 115 | - } |
|
| 116 | 116 | |
| 117 | - return $settings; |
|
| 117 | + return $settings; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin(). |
| 122 | 122 | */ |
| 123 | 123 | function wysiwyg_whizzywig_plugins($editor) { |
| 124 | - return array( |
|
| 124 | + return array( |
|
| 125 | 125 | 'default' => array( |
| 126 | - 'buttons' => array( |
|
| 126 | + 'buttons' => array( |
|
| 127 | 127 | 'formatblock' => t('HTML block format'), 'fontname' => t('Font'), 'fontsize' => t('Font size'), |
| 128 | 128 | 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), |
| 129 | 129 | 'left' => t('Align left'), 'center' => t('Align center'), 'right' => t('Align right'), |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | 'clean' => t('Clean-up'), |
| 140 | 140 | 'html' => t('Source code'), |
| 141 | 141 | 'spellcheck' => t('Spell check'), |
| 142 | - ), |
|
| 143 | - 'internal' => TRUE, |
|
| 142 | + ), |
|
| 143 | + 'internal' => TRUE, |
|
| 144 | 144 | ), |
| 145 | - ); |
|
| 145 | + ); |
|
| 146 | 146 | } |
| 147 | 147 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * The installed editor version. |
| 48 | 48 | */ |
| 49 | 49 | function wysiwyg_whizzywig_version($editor) { |
| 50 | - $script = $editor['library path'] . '/whizzywig.js'; |
|
| 50 | + $script = $editor['library path'].'/whizzywig.js'; |
|
| 51 | 51 | if (!file_exists($script)) { |
| 52 | 52 | return; |
| 53 | 53 | } |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | $settings = array(); |
| 81 | 81 | |
| 82 | 82 | // Add path to button images, if available. |
| 83 | - if (is_dir($editor['library path'] . '/btn')) { |
|
| 84 | - $settings['buttonPath'] = base_path() . $editor['library path'] . '/btn/'; |
|
| 83 | + if (is_dir($editor['library path'].'/btn')) { |
|
| 84 | + $settings['buttonPath'] = base_path().$editor['library path'].'/btn/'; |
|
| 85 | 85 | } |
| 86 | - if (file_exists($editor['library path'] . '/WhizzywigToolbar.png')) { |
|
| 87 | - $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/WhizzywigToolbar.png'; |
|
| 86 | + if (file_exists($editor['library path'].'/WhizzywigToolbar.png')) { |
|
| 87 | + $settings['toolbarImagePath'] = base_path().$editor['library path'].'/WhizzywigToolbar.png'; |
|
| 88 | 88 | } |
| 89 | 89 | // Filename changed in version 60. |
| 90 | - elseif (file_exists($editor['library path'] . '/icons.png')) { |
|
| 91 | - $settings['toolbarImagePath'] = base_path() . $editor['library path'] . '/icons.png'; |
|
| 90 | + elseif (file_exists($editor['library path'].'/icons.png')) { |
|
| 91 | + $settings['toolbarImagePath'] = base_path().$editor['library path'].'/icons.png'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Add configured buttons or all available. |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | // Add editor content stylesheet. |
| 105 | 105 | if (isset($config['css_setting'])) { |
| 106 | 106 | if ($config['css_setting'] == 'theme') { |
| 107 | - $css = path_to_theme() . '/style.css'; |
|
| 107 | + $css = path_to_theme().'/style.css'; |
|
| 108 | 108 | if (file_exists($css)) { |
| 109 | - $settings['externalCSS'] = base_path() . $css; |
|
| 109 | + $settings['externalCSS'] = base_path().$css; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | if (file_exists($css)) { |
| 109 | 109 | $settings['externalCSS'] = base_path() . $css; |
| 110 | 110 | } |
| 111 | - } |
|
| 112 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 111 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
| 113 | 112 | $settings['externalCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
| 114 | 113 | } |
| 115 | 114 | } |
@@ -140,7 +140,7 @@ |
||
| 140 | 140 | 'html' => t('Source code'), |
| 141 | 141 | 'spellcheck' => t('Spell check'), |
| 142 | 142 | ), |
| 143 | - 'internal' => TRUE, |
|
| 143 | + 'internal' => true, |
|
| 144 | 144 | ), |
| 145 | 145 | ); |
| 146 | 146 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * An array containing editor properties as returned from hook_editor(). |
| 49 | 49 | * |
| 50 | 50 | * @return |
| 51 | - * The installed editor version. |
|
| 51 | + null|string The installed editor version. |
|
| 52 | 52 | */ |
| 53 | 53 | function wysiwyg_wymeditor_version($editor) { |
| 54 | 54 | $script = $editor['library path'] . '/jquery.wymeditor.js'; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * A wysiwyg editor profile. |
| 75 | 75 | * |
| 76 | 76 | * @return |
| 77 | - * An array of theme names. The first returned name should be the default |
|
| 77 | + string[] An array of theme names. The first returned name should be the default |
|
| 78 | 78 | * theme name. |
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_wymeditor_themes($editor, $profile) { |
@@ -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; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * An array containing editor properties as returned from hook_editor(). |
| 62 | 62 | * |
| 63 | 63 | * @return |
| 64 | - * The installed editor version. |
|
| 64 | + null|string The installed editor version. |
|
| 65 | 65 | */ |
| 66 | 66 | function wysiwyg_yui_version($editor) { |
| 67 | 67 | $library = $editor['library path'] . '/editor/editor.js'; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * A wysiwyg editor profile. |
| 90 | 90 | * |
| 91 | 91 | * @return |
| 92 | - * An array of theme names. The first returned name should be the default |
|
| 92 | + string[] An array of theme names. The first returned name should be the default |
|
| 93 | 93 | * theme name. |
| 94 | 94 | */ |
| 95 | 95 | function wysiwyg_yui_themes($editor, $profile) { |
@@ -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 | } |
@@ -674,6 +674,7 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | 676 | * Remove a profile from the database. |
| 677 | + * @param stdClass $wysiwyg |
|
| 677 | 678 | */ |
| 678 | 679 | function wysiwyg_profile_delete($wysiwyg) { |
| 679 | 680 | if (!isset($wysiwyg->format)) { |
@@ -922,7 +923,7 @@ discard block |
||
| 922 | 923 | * Whether to prefix the resulting path with base_path(). |
| 923 | 924 | * |
| 924 | 925 | * @return |
| 925 | - * The path to the specified library. |
|
| 926 | + string The path to the specified library. |
|
| 926 | 927 | * |
| 927 | 928 | * @ingroup libraries |
| 928 | 929 | */ |
@@ -1014,7 +1015,7 @@ discard block |
||
| 1014 | 1015 | /** |
| 1015 | 1016 | * Return a list of directories by modules implementing wysiwyg_include_directory(). |
| 1016 | 1017 | * |
| 1017 | - * @param $plugintype |
|
| 1018 | + * @param string $plugintype |
|
| 1018 | 1019 | * The type of a plugin; can be 'editors'. |
| 1019 | 1020 | * |
| 1020 | 1021 | * @return |
@@ -1039,10 +1040,11 @@ discard block |
||
| 1039 | 1040 | * |
| 1040 | 1041 | * @param $module |
| 1041 | 1042 | * The module that owns the hook. |
| 1042 | - * @param $identifier |
|
| 1043 | + * @param string $identifier |
|
| 1043 | 1044 | * Either the module or 'wysiwyg_' . $file->name |
| 1044 | - * @param $hook |
|
| 1045 | + * @param string $hook |
|
| 1045 | 1046 | * The name of the hook being invoked. |
| 1047 | + * @param string $path |
|
| 1046 | 1048 | */ |
| 1047 | 1049 | function _wysiwyg_process_include($module, $identifier, $path, $hook) { |
| 1048 | 1050 | $function = $identifier . '_' . $hook; |
@@ -9,19 +9,19 @@ discard block |
||
| 9 | 9 | * Implementation of hook_menu(). |
| 10 | 10 | */ |
| 11 | 11 | function wysiwyg_menu() { |
| 12 | - $items['admin/settings/wysiwyg'] = array( |
|
| 12 | + $items['admin/settings/wysiwyg'] = array( |
|
| 13 | 13 | 'title' => 'Wysiwyg profiles', |
| 14 | 14 | 'page callback' => 'drupal_get_form', |
| 15 | 15 | 'page arguments' => array('wysiwyg_profile_overview'), |
| 16 | 16 | 'description' => 'Configure client-side editors.', |
| 17 | 17 | 'access arguments' => array('administer filters'), |
| 18 | 18 | 'file' => 'wysiwyg.admin.inc', |
| 19 | - ); |
|
| 20 | - $items['admin/settings/wysiwyg/profile'] = array( |
|
| 19 | + ); |
|
| 20 | + $items['admin/settings/wysiwyg/profile'] = array( |
|
| 21 | 21 | 'title' => 'List', |
| 22 | 22 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 23 | - ); |
|
| 24 | - $items['admin/settings/wysiwyg/profile/%wysiwyg_profile/edit'] = array( |
|
| 23 | + ); |
|
| 24 | + $items['admin/settings/wysiwyg/profile/%wysiwyg_profile/edit'] = array( |
|
| 25 | 25 | 'title' => 'Edit', |
| 26 | 26 | 'page callback' => 'drupal_get_form', |
| 27 | 27 | 'page arguments' => array('wysiwyg_profile_form', 4), |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | 'tab_root' => 'admin/settings/wysiwyg/profile', |
| 31 | 31 | 'tab_parent' => 'admin/settings/wysiwyg/profile/%wysiwyg_profile', |
| 32 | 32 | 'type' => MENU_LOCAL_TASK, |
| 33 | - ); |
|
| 34 | - $items['admin/settings/wysiwyg/profile/%wysiwyg_profile/delete'] = array( |
|
| 33 | + ); |
|
| 34 | + $items['admin/settings/wysiwyg/profile/%wysiwyg_profile/delete'] = array( |
|
| 35 | 35 | 'title' => 'Remove', |
| 36 | 36 | 'page callback' => 'drupal_get_form', |
| 37 | 37 | 'page arguments' => array('wysiwyg_profile_delete_confirm', 4), |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | 'tab_parent' => 'admin/settings/wysiwyg/profile/%wysiwyg_profile', |
| 42 | 42 | 'type' => MENU_LOCAL_TASK, |
| 43 | 43 | 'weight' => 10, |
| 44 | - ); |
|
| 45 | - $items['wysiwyg/%'] = array( |
|
| 44 | + ); |
|
| 45 | + $items['wysiwyg/%'] = array( |
|
| 46 | 46 | 'page callback' => 'wysiwyg_dialog', |
| 47 | 47 | 'page arguments' => array(1), |
| 48 | 48 | 'access arguments' => array('access content'), |
| 49 | 49 | 'type' => MENU_CALLBACK, |
| 50 | 50 | 'file' => 'wysiwyg.dialog.inc', |
| 51 | - ); |
|
| 52 | - return $items; |
|
| 51 | + ); |
|
| 52 | + return $items; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -59,37 +59,37 @@ discard block |
||
| 59 | 59 | * @see template_preprocess_page(), theme.inc |
| 60 | 60 | */ |
| 61 | 61 | function wysiwyg_theme() { |
| 62 | - return array( |
|
| 62 | + return array( |
|
| 63 | 63 | 'wysiwyg_profile_overview' => array( |
| 64 | - 'arguments' => array('form' => NULL), |
|
| 64 | + 'arguments' => array('form' => NULL), |
|
| 65 | 65 | ), |
| 66 | 66 | 'wysiwyg_admin_button_table' => array( |
| 67 | - 'arguments' => array('form' => NULL), |
|
| 67 | + 'arguments' => array('form' => NULL), |
|
| 68 | 68 | ), |
| 69 | 69 | 'wysiwyg_dialog_page' => array( |
| 70 | - 'arguments' => array('content' => NULL, 'show_messages' => TRUE), |
|
| 71 | - 'file' => 'wysiwyg.dialog.inc', |
|
| 72 | - 'template' => 'wysiwyg-dialog-page', |
|
| 70 | + 'arguments' => array('content' => NULL, 'show_messages' => TRUE), |
|
| 71 | + 'file' => 'wysiwyg.dialog.inc', |
|
| 72 | + 'template' => 'wysiwyg-dialog-page', |
|
| 73 | 73 | ), |
| 74 | - ); |
|
| 74 | + ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Implementation of hook_help(). |
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_help($path, $arg) { |
| 81 | - switch ($path) { |
|
| 81 | + switch ($path) { |
|
| 82 | 82 | case 'admin/settings/wysiwyg': |
| 83 | 83 | $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
| 84 | - return $output; |
|
| 85 | - } |
|
| 84 | + return $output; |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Clear wysiwyg cache on admin/build/modules form. |
| 90 | 90 | */ |
| 91 | 91 | function wysiwyg_form_system_modules_alter(&$form, $form_state) { |
| 92 | - wysiwyg_profile_load_all(TRUE); |
|
| 92 | + wysiwyg_profile_load_all(TRUE); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | * @see wysiwyg_process_form() |
| 105 | 105 | */ |
| 106 | 106 | function wysiwyg_form_alter(&$form, &$form_state) { |
| 107 | - $form['#after_build'][] = 'wysiwyg_process_form'; |
|
| 108 | - // Teaser splitter is unconditionally removed and NOT supported. |
|
| 109 | - if (isset($form['body_field'])) { |
|
| 107 | + $form['#after_build'][] = 'wysiwyg_process_form'; |
|
| 108 | + // Teaser splitter is unconditionally removed and NOT supported. |
|
| 109 | + if (isset($form['body_field'])) { |
|
| 110 | 110 | unset($form['body_field']['teaser_js']); |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -123,53 +123,53 @@ discard block |
||
| 123 | 123 | * @see wysiwyg_elements(), filter_form() |
| 124 | 124 | */ |
| 125 | 125 | function wysiwyg_process_form(&$form) { |
| 126 | - // Iterate over element children; resetting array keys to access last index. |
|
| 127 | - if ($children = array_values(element_children($form))) { |
|
| 126 | + // Iterate over element children; resetting array keys to access last index. |
|
| 127 | + if ($children = array_values(element_children($form))) { |
|
| 128 | 128 | foreach ($children as $index => $item) { |
| 129 | - $element = &$form[$item]; |
|
| 129 | + $element = &$form[$item]; |
|
| 130 | 130 | |
| 131 | - // filter_form() always uses the key 'format'. We need a type-agnostic |
|
| 132 | - // match to prevent false positives. Also, there must have been at least |
|
| 133 | - // one element on this level. |
|
| 134 | - if (($item === 'format' || $item === 'signature_format') && $index > 0) { |
|
| 131 | + // filter_form() always uses the key 'format'. We need a type-agnostic |
|
| 132 | + // match to prevent false positives. Also, there must have been at least |
|
| 133 | + // one element on this level. |
|
| 134 | + if (($item === 'format' || $item === 'signature_format') && $index > 0) { |
|
| 135 | 135 | // Make sure we either match a input format selector or input format |
| 136 | 136 | // guidelines (displayed if user has access to one input format only). |
| 137 | 137 | if ((isset($element['#type']) && $element['#type'] == 'fieldset') || isset($element['format']['guidelines'])) { |
| 138 | - // The element before this element is the target form field. |
|
| 139 | - $field = &$form[$children[$index - 1]]; |
|
| 138 | + // The element before this element is the target form field. |
|
| 139 | + $field = &$form[$children[$index - 1]]; |
|
| 140 | 140 | |
| 141 | - // Allow modules to programmatically enforce no client-side editor by |
|
| 142 | - // setting the #wysiwyg property to FALSE. |
|
| 143 | - if (isset($field['#wysiwyg']) && !$field['#wysiwyg']) { |
|
| 141 | + // Allow modules to programmatically enforce no client-side editor by |
|
| 142 | + // setting the #wysiwyg property to FALSE. |
|
| 143 | + if (isset($field['#wysiwyg']) && !$field['#wysiwyg']) { |
|
| 144 | 144 | // A 'format' element should not have any child elements that may |
| 145 | 145 | // need processing, so it should be safe to skip the recursion that |
| 146 | 146 | // happens at the end of this function, and move on to the next |
| 147 | 147 | // element on the same level. |
| 148 | 148 | continue; |
| 149 | - } |
|
| 150 | - |
|
| 151 | - // If this textarea is #resizable and we will load at least one |
|
| 152 | - // editor, then only load the behavior and let the 'none' editor |
|
| 153 | - // attach/detach it to avoid hi-jacking the UI. Due to our CSS class |
|
| 154 | - // parsing, we can add arbitrary parameters for each input format. |
|
| 155 | - // The #resizable property will be removed below, if at least one |
|
| 156 | - // profile has been loaded. |
|
| 157 | - $extra_class = ''; |
|
| 158 | - if (!empty($field['#resizable'])) { |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + // If this textarea is #resizable and we will load at least one |
|
| 152 | + // editor, then only load the behavior and let the 'none' editor |
|
| 153 | + // attach/detach it to avoid hi-jacking the UI. Due to our CSS class |
|
| 154 | + // parsing, we can add arbitrary parameters for each input format. |
|
| 155 | + // The #resizable property will be removed below, if at least one |
|
| 156 | + // profile has been loaded. |
|
| 157 | + $extra_class = ''; |
|
| 158 | + if (!empty($field['#resizable'])) { |
|
| 159 | 159 | $extra_class = ' wysiwyg-resizable-1'; |
| 160 | 160 | drupal_add_js('misc/textarea.js'); |
| 161 | - } |
|
| 162 | - |
|
| 163 | - // Determine the available input formats. The last child element is a |
|
| 164 | - // link to "More information about formatting options". When only one |
|
| 165 | - // input format is displayed, we also have to remove formatting |
|
| 166 | - // guidelines, stored in the child 'format'. |
|
| 167 | - $formats = element_children($element); |
|
| 168 | - array_pop($formats); |
|
| 169 | - if (($key = array_search('format', $formats)) !== FALSE) { |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + // Determine the available input formats. The last child element is a |
|
| 164 | + // link to "More information about formatting options". When only one |
|
| 165 | + // input format is displayed, we also have to remove formatting |
|
| 166 | + // guidelines, stored in the child 'format'. |
|
| 167 | + $formats = element_children($element); |
|
| 168 | + array_pop($formats); |
|
| 169 | + if (($key = array_search('format', $formats)) !== FALSE) { |
|
| 170 | 170 | unset($formats[$key]); |
| 171 | - } |
|
| 172 | - foreach ($formats as $format) { |
|
| 171 | + } |
|
| 172 | + foreach ($formats as $format) { |
|
| 173 | 173 | // Default to 'none' editor (Drupal's default behaviors). |
| 174 | 174 | $editor = 'none'; |
| 175 | 175 | $status = 1; |
@@ -177,51 +177,51 @@ discard block |
||
| 177 | 177 | // Fetch the profile associated to this input format. |
| 178 | 178 | $profile = wysiwyg_get_profile($format); |
| 179 | 179 | if ($profile) { |
| 180 | - $loaded = TRUE; |
|
| 181 | - $editor = $profile->editor; |
|
| 182 | - $status = (int) wysiwyg_user_get_status($profile); |
|
| 183 | - if (isset($profile->settings['show_toggle'])) { |
|
| 180 | + $loaded = TRUE; |
|
| 181 | + $editor = $profile->editor; |
|
| 182 | + $status = (int) wysiwyg_user_get_status($profile); |
|
| 183 | + if (isset($profile->settings['show_toggle'])) { |
|
| 184 | 184 | $toggle = (int) $profile->settings['show_toggle']; |
| 185 | - } |
|
| 186 | - // Check editor theme (and reset it if not/no longer available). |
|
| 187 | - $theme = wysiwyg_get_editor_themes($profile, (isset($profile->settings['theme']) ? $profile->settings['theme'] : '')); |
|
| 188 | - |
|
| 189 | - // Add plugin settings (first) for this input format. |
|
| 190 | - wysiwyg_add_plugin_settings($profile); |
|
| 191 | - // Add profile settings for this input format. |
|
| 192 | - wysiwyg_add_editor_settings($profile, $theme); |
|
| 185 | + } |
|
| 186 | + // Check editor theme (and reset it if not/no longer available). |
|
| 187 | + $theme = wysiwyg_get_editor_themes($profile, (isset($profile->settings['theme']) ? $profile->settings['theme'] : '')); |
|
| 188 | + |
|
| 189 | + // Add plugin settings (first) for this input format. |
|
| 190 | + wysiwyg_add_plugin_settings($profile); |
|
| 191 | + // Add profile settings for this input format. |
|
| 192 | + wysiwyg_add_editor_settings($profile, $theme); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // Use a prefix/suffix for a single input format, or attach to input |
| 196 | 196 | // format selector radio buttons. |
| 197 | 197 | if (isset($element['format']['guidelines'])) { |
| 198 | - $element['format']['guidelines']['#prefix'] = '<div class="wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class . '">'; |
|
| 199 | - $element['format']['guidelines']['#suffix'] = '</div>'; |
|
| 200 | - // Edge-case: Default format contains no input filters. |
|
| 201 | - if (empty($element['format']['guidelines']['#value'])) { |
|
| 198 | + $element['format']['guidelines']['#prefix'] = '<div class="wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class . '">'; |
|
| 199 | + $element['format']['guidelines']['#suffix'] = '</div>'; |
|
| 200 | + // Edge-case: Default format contains no input filters. |
|
| 201 | + if (empty($element['format']['guidelines']['#value'])) { |
|
| 202 | 202 | $element['format']['guidelines']['#value'] = ' '; |
| 203 | - } |
|
| 203 | + } |
|
| 204 | 204 | } |
| 205 | 205 | else { |
| 206 | - $element[$format]['#attributes']['class'] = (isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'] . ' ' : ''); |
|
| 207 | - $element[$format]['#attributes']['class'] .= 'wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class; |
|
| 206 | + $element[$format]['#attributes']['class'] = (isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'] . ' ' : ''); |
|
| 207 | + $element[$format]['#attributes']['class'] .= 'wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class; |
|
| 208 | + } |
|
| 208 | 209 | } |
| 209 | - } |
|
| 210 | 210 | |
| 211 | - // If we loaded at least one editor, then the 'none' editor will |
|
| 212 | - // handle resizable textareas instead of core. |
|
| 213 | - if (isset($loaded) && !empty($field['#resizable'])) { |
|
| 211 | + // If we loaded at least one editor, then the 'none' editor will |
|
| 212 | + // handle resizable textareas instead of core. |
|
| 213 | + if (isset($loaded) && !empty($field['#resizable'])) { |
|
| 214 | 214 | $field['#resizable'] = FALSE; |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | // If this element is 'format', do not recurse further. |
| 218 | 218 | continue; |
| 219 | - } |
|
| 220 | - // Recurse into children. |
|
| 221 | - wysiwyg_process_form($element); |
|
| 219 | + } |
|
| 220 | + // Recurse into children. |
|
| 221 | + wysiwyg_process_form($element); |
|
| 222 | + } |
|
| 222 | 223 | } |
| 223 | - } |
|
| 224 | - return $form; |
|
| 224 | + return $form; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -239,12 +239,12 @@ discard block |
||
| 239 | 239 | * @see wysiwyg_load_editor(), wysiwyg_get_editor() |
| 240 | 240 | */ |
| 241 | 241 | function wysiwyg_get_profile($format) { |
| 242 | - if ($profile = wysiwyg_profile_load($format)) { |
|
| 242 | + if ($profile = wysiwyg_profile_load($format)) { |
|
| 243 | 243 | if (wysiwyg_load_editor($profile)) { |
| 244 | - return $profile; |
|
| 244 | + return $profile; |
|
| 245 | + } |
|
| 245 | 246 | } |
| 246 | - } |
|
| 247 | - return FALSE; |
|
| 247 | + return FALSE; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -259,82 +259,82 @@ discard block |
||
| 259 | 259 | * @see wysiwyg_get_profile() |
| 260 | 260 | */ |
| 261 | 261 | function wysiwyg_load_editor($profile) { |
| 262 | - static $settings_added; |
|
| 263 | - static $loaded = array(); |
|
| 262 | + static $settings_added; |
|
| 263 | + static $loaded = array(); |
|
| 264 | 264 | |
| 265 | - $name = $profile->editor; |
|
| 266 | - // Library files must be loaded only once. |
|
| 267 | - if (!isset($loaded[$name])) { |
|
| 265 | + $name = $profile->editor; |
|
| 266 | + // Library files must be loaded only once. |
|
| 267 | + if (!isset($loaded[$name])) { |
|
| 268 | 268 | // Load editor. |
| 269 | 269 | $editor = wysiwyg_get_editor($name); |
| 270 | 270 | if ($editor) { |
| 271 | - // Determine library files to load. |
|
| 272 | - // @todo Allow to configure the library/execMode to use. |
|
| 273 | - if (isset($profile->settings['library']) && isset($editor['libraries'][$profile->settings['library']])) { |
|
| 271 | + // Determine library files to load. |
|
| 272 | + // @todo Allow to configure the library/execMode to use. |
|
| 273 | + if (isset($profile->settings['library']) && isset($editor['libraries'][$profile->settings['library']])) { |
|
| 274 | 274 | $library = $profile->settings['library']; |
| 275 | 275 | $files = $editor['libraries'][$library]['files']; |
| 276 | - } |
|
| 277 | - else { |
|
| 276 | + } |
|
| 277 | + else { |
|
| 278 | 278 | // Fallback to the first defined library by default (external libraries can change). |
| 279 | 279 | $library = key($editor['libraries']); |
| 280 | 280 | $files = array_shift($editor['libraries']); |
| 281 | 281 | $files = $files['files']; |
| 282 | - } |
|
| 283 | - foreach ($files as $file => $options) { |
|
| 282 | + } |
|
| 283 | + foreach ($files as $file => $options) { |
|
| 284 | 284 | if (is_array($options)) { |
| 285 | - $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); |
|
| 286 | - drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
|
| 285 | + $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); |
|
| 286 | + drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
|
| 287 | 287 | } |
| 288 | 288 | else { |
| 289 | - drupal_add_js($editor['library path'] . '/' . $options); |
|
| 289 | + drupal_add_js($editor['library path'] . '/' . $options); |
|
| 290 | 290 | } |
| 291 | - } |
|
| 292 | - // If editor defines an additional load callback, invoke it. |
|
| 293 | - // @todo Isn't the settings callback sufficient? |
|
| 294 | - if (isset($editor['load callback']) && function_exists($editor['load callback'])) { |
|
| 291 | + } |
|
| 292 | + // If editor defines an additional load callback, invoke it. |
|
| 293 | + // @todo Isn't the settings callback sufficient? |
|
| 294 | + if (isset($editor['load callback']) && function_exists($editor['load callback'])) { |
|
| 295 | 295 | $editor['load callback']($editor, $library); |
| 296 | - } |
|
| 297 | - // Load JavaScript integration files for this editor. |
|
| 298 | - $files = array(); |
|
| 299 | - if (isset($editor['js files'])) { |
|
| 296 | + } |
|
| 297 | + // Load JavaScript integration files for this editor. |
|
| 298 | + $files = array(); |
|
| 299 | + if (isset($editor['js files'])) { |
|
| 300 | 300 | $files = $editor['js files']; |
| 301 | - } |
|
| 302 | - foreach ($files as $file) { |
|
| 301 | + } |
|
| 302 | + foreach ($files as $file) { |
|
| 303 | 303 | drupal_add_js($editor['js path'] . '/' . $file); |
| 304 | - } |
|
| 305 | - // Load CSS stylesheets for this editor. |
|
| 306 | - $files = array(); |
|
| 307 | - if (isset($editor['css files'])) { |
|
| 304 | + } |
|
| 305 | + // Load CSS stylesheets for this editor. |
|
| 306 | + $files = array(); |
|
| 307 | + if (isset($editor['css files'])) { |
|
| 308 | 308 | $files = $editor['css files']; |
| 309 | - } |
|
| 310 | - foreach ($files as $file) { |
|
| 309 | + } |
|
| 310 | + foreach ($files as $file) { |
|
| 311 | 311 | drupal_add_css($editor['css path'] . '/' . $file); |
| 312 | - } |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - drupal_add_js(array('wysiwyg' => array( |
|
| 314 | + drupal_add_js(array('wysiwyg' => array( |
|
| 315 | 315 | 'configs' => array($editor['name'] => array('global' => array( |
| 316 | - // @todo Move into (global) editor settings. |
|
| 317 | - // If JS compression is enabled, at least TinyMCE is unable to determine |
|
| 318 | - // its own base path and exec mode since it can't find the script name. |
|
| 319 | - 'editorBasePath' => base_path() . $editor['library path'], |
|
| 320 | - 'execMode' => $library, |
|
| 316 | + // @todo Move into (global) editor settings. |
|
| 317 | + // If JS compression is enabled, at least TinyMCE is unable to determine |
|
| 318 | + // its own base path and exec mode since it can't find the script name. |
|
| 319 | + 'editorBasePath' => base_path() . $editor['library path'], |
|
| 320 | + 'execMode' => $library, |
|
| 321 | 321 | ))), |
| 322 | - )), 'setting'); |
|
| 322 | + )), 'setting'); |
|
| 323 | 323 | |
| 324 | - $loaded[$name] = TRUE; |
|
| 324 | + $loaded[$name] = TRUE; |
|
| 325 | 325 | } |
| 326 | 326 | else { |
| 327 | - $loaded[$name] = FALSE; |
|
| 327 | + $loaded[$name] = FALSE; |
|
| 328 | + } |
|
| 328 | 329 | } |
| 329 | - } |
|
| 330 | 330 | |
| 331 | - // Add basic Wysiwyg settings if any editor has been added. |
|
| 332 | - if (!isset($settings_added) && $loaded[$name]) { |
|
| 331 | + // Add basic Wysiwyg settings if any editor has been added. |
|
| 332 | + if (!isset($settings_added) && $loaded[$name]) { |
|
| 333 | 333 | drupal_add_js(array('wysiwyg' => array( |
| 334 | - 'configs' => array(), |
|
| 335 | - 'plugins' => array(), |
|
| 336 | - 'disable' => t('Disable rich-text'), |
|
| 337 | - 'enable' => t('Enable rich-text'), |
|
| 334 | + 'configs' => array(), |
|
| 335 | + 'plugins' => array(), |
|
| 336 | + 'disable' => t('Disable rich-text'), |
|
| 337 | + 'enable' => t('Enable rich-text'), |
|
| 338 | 338 | )), 'setting'); |
| 339 | 339 | |
| 340 | 340 | $path = drupal_get_path('module', 'wysiwyg'); |
@@ -355,26 +355,26 @@ discard block |
||
| 355 | 355 | drupal_add_js($path . '/wysiwyg.js', 'module', 'footer'); |
| 356 | 356 | |
| 357 | 357 | $settings_added = TRUE; |
| 358 | - } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | - return $loaded[$name]; |
|
| 360 | + return $loaded[$name]; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | 364 | * Add editor settings for a given input format. |
| 365 | 365 | */ |
| 366 | 366 | function wysiwyg_add_editor_settings($profile, $theme) { |
| 367 | - static $formats = array(); |
|
| 367 | + static $formats = array(); |
|
| 368 | 368 | |
| 369 | - if (!isset($formats[$profile->format])) { |
|
| 369 | + if (!isset($formats[$profile->format])) { |
|
| 370 | 370 | $config = wysiwyg_get_editor_config($profile, $theme); |
| 371 | 371 | // drupal_to_js() does not properly convert numeric array keys, so we need |
| 372 | 372 | // to use a string instead of the format id. |
| 373 | 373 | if ($config) { |
| 374 | - drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); |
|
| 374 | + drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); |
|
| 375 | 375 | } |
| 376 | 376 | $formats[$profile->format] = TRUE; |
| 377 | - } |
|
| 377 | + } |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -402,86 +402,86 @@ discard block |
||
| 402 | 402 | * and simplify this entire function. |
| 403 | 403 | */ |
| 404 | 404 | function wysiwyg_add_plugin_settings($profile) { |
| 405 | - static $plugins = array(); |
|
| 406 | - static $processed_plugins = array(); |
|
| 407 | - static $processed_formats = array(); |
|
| 405 | + static $plugins = array(); |
|
| 406 | + static $processed_plugins = array(); |
|
| 407 | + static $processed_formats = array(); |
|
| 408 | 408 | |
| 409 | - // Each input format must only processed once. |
|
| 410 | - // @todo ...as long as we do not have multiple profiles per format. |
|
| 411 | - if (isset($processed_formats[$profile->format])) { |
|
| 409 | + // Each input format must only processed once. |
|
| 410 | + // @todo ...as long as we do not have multiple profiles per format. |
|
| 411 | + if (isset($processed_formats[$profile->format])) { |
|
| 412 | 412 | return; |
| 413 | - } |
|
| 414 | - $processed_formats[$profile->format] = TRUE; |
|
| 413 | + } |
|
| 414 | + $processed_formats[$profile->format] = TRUE; |
|
| 415 | 415 | |
| 416 | - $editor = wysiwyg_get_editor($profile->editor); |
|
| 416 | + $editor = wysiwyg_get_editor($profile->editor); |
|
| 417 | 417 | |
| 418 | - // Collect native plugins for this editor provided via hook_wysiwyg_plugin() |
|
| 419 | - // and Drupal plugins provided via hook_wysiwyg_include_directory(). |
|
| 420 | - if (!array_key_exists($editor['name'], $plugins)) { |
|
| 418 | + // Collect native plugins for this editor provided via hook_wysiwyg_plugin() |
|
| 419 | + // and Drupal plugins provided via hook_wysiwyg_include_directory(). |
|
| 420 | + if (!array_key_exists($editor['name'], $plugins)) { |
|
| 421 | 421 | $plugins[$editor['name']] = wysiwyg_get_plugins($editor['name']); |
| 422 | - } |
|
| 422 | + } |
|
| 423 | 423 | |
| 424 | - // Nothing to do, if there are no plugins. |
|
| 425 | - if (empty($plugins[$editor['name']])) { |
|
| 424 | + // Nothing to do, if there are no plugins. |
|
| 425 | + if (empty($plugins[$editor['name']])) { |
|
| 426 | 426 | return; |
| 427 | - } |
|
| 427 | + } |
|
| 428 | 428 | |
| 429 | - // Determine name of proxy plugin for Drupal plugins. |
|
| 430 | - $proxy = (isset($editor['proxy plugin']) ? key($editor['proxy plugin']) : ''); |
|
| 429 | + // Determine name of proxy plugin for Drupal plugins. |
|
| 430 | + $proxy = (isset($editor['proxy plugin']) ? key($editor['proxy plugin']) : ''); |
|
| 431 | 431 | |
| 432 | - // Process native editor plugins. |
|
| 433 | - if (isset($editor['plugin settings callback'])) { |
|
| 432 | + // Process native editor plugins. |
|
| 433 | + if (isset($editor['plugin settings callback'])) { |
|
| 434 | 434 | // @todo Require PHP 5.1 in 3.x and use array_intersect_key(). |
| 435 | 435 | $profile_plugins_native = array(); |
| 436 | 436 | foreach ($plugins[$editor['name']] as $plugin => $meta) { |
| 437 | - // Skip Drupal plugins (handled below). |
|
| 438 | - if ($plugin === $proxy) { |
|
| 437 | + // Skip Drupal plugins (handled below). |
|
| 438 | + if ($plugin === $proxy) { |
|
| 439 | 439 | continue; |
| 440 | - } |
|
| 441 | - // Only keep native plugins that are enabled in this profile. |
|
| 442 | - if (isset($profile->settings['buttons'][$plugin])) { |
|
| 440 | + } |
|
| 441 | + // Only keep native plugins that are enabled in this profile. |
|
| 442 | + if (isset($profile->settings['buttons'][$plugin])) { |
|
| 443 | 443 | $profile_plugins_native[$plugin] = $meta; |
| 444 | - } |
|
| 444 | + } |
|
| 445 | 445 | } |
| 446 | 446 | // Invoke the editor's plugin settings callback, so it can populate the |
| 447 | 447 | // settings for native external plugins with required values. |
| 448 | 448 | $settings_native = call_user_func($editor['plugin settings callback'], $editor, $profile, $profile_plugins_native); |
| 449 | 449 | |
| 450 | 450 | if ($settings_native) { |
| 451 | - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting'); |
|
| 451 | + drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting'); |
|
| 452 | + } |
|
| 452 | 453 | } |
| 453 | - } |
|
| 454 | 454 | |
| 455 | - // Process Drupal plugins. |
|
| 456 | - if ($proxy && isset($editor['proxy plugin settings callback'])) { |
|
| 455 | + // Process Drupal plugins. |
|
| 456 | + if ($proxy && isset($editor['proxy plugin settings callback'])) { |
|
| 457 | 457 | $profile_plugins_drupal = array(); |
| 458 | 458 | foreach (wysiwyg_get_all_plugins() as $plugin => $meta) { |
| 459 | - if (isset($profile->settings['buttons'][$proxy][$plugin])) { |
|
| 459 | + if (isset($profile->settings['buttons'][$proxy][$plugin])) { |
|
| 460 | 460 | // JavaScript and plugin-specific settings for Drupal plugins must be |
| 461 | 461 | // loaded and processed only once. Plugin information is cached |
| 462 | 462 | // statically to pass it to the editor's proxy plugin settings callback. |
| 463 | 463 | if (!isset($processed_plugins[$proxy][$plugin])) { |
| 464 | - $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin] = $meta; |
|
| 465 | - // Load the Drupal plugin's JavaScript. |
|
| 466 | - drupal_add_js($meta['js path'] . '/' . $meta['js file']); |
|
| 467 | - // Add plugin-specific settings. |
|
| 468 | - if (isset($meta['settings'])) { |
|
| 464 | + $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin] = $meta; |
|
| 465 | + // Load the Drupal plugin's JavaScript. |
|
| 466 | + drupal_add_js($meta['js path'] . '/' . $meta['js file']); |
|
| 467 | + // Add plugin-specific settings. |
|
| 468 | + if (isset($meta['settings'])) { |
|
| 469 | 469 | drupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting'); |
| 470 | - } |
|
| 470 | + } |
|
| 471 | 471 | } |
| 472 | 472 | else { |
| 473 | - $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin]; |
|
| 473 | + $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin]; |
|
| 474 | + } |
|
| 474 | 475 | } |
| 475 | - } |
|
| 476 | 476 | } |
| 477 | 477 | // Invoke the editor's proxy plugin settings callback, so it can populate |
| 478 | 478 | // the settings for Drupal plugins with custom, required values. |
| 479 | 479 | $settings_drupal = call_user_func($editor['proxy plugin settings callback'], $editor, $profile, $profile_plugins_drupal); |
| 480 | 480 | |
| 481 | 481 | if ($settings_drupal) { |
| 482 | - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting'); |
|
| 482 | + drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting'); |
|
| 483 | + } |
|
| 483 | 484 | } |
| 484 | - } |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | /** |
@@ -499,28 +499,28 @@ discard block |
||
| 499 | 499 | * was given. |
| 500 | 500 | */ |
| 501 | 501 | function wysiwyg_get_editor_themes(&$profile, $selected_theme = NULL) { |
| 502 | - static $themes = array(); |
|
| 502 | + static $themes = array(); |
|
| 503 | 503 | |
| 504 | - if (!isset($themes[$profile->editor])) { |
|
| 504 | + if (!isset($themes[$profile->editor])) { |
|
| 505 | 505 | $editor = wysiwyg_get_editor($profile->editor); |
| 506 | 506 | if (isset($editor['themes callback']) && function_exists($editor['themes callback'])) { |
| 507 | - $themes[$editor['name']] = $editor['themes callback']($editor, $profile); |
|
| 507 | + $themes[$editor['name']] = $editor['themes callback']($editor, $profile); |
|
| 508 | 508 | } |
| 509 | 509 | // Fallback to 'default' otherwise. |
| 510 | 510 | else { |
| 511 | - $themes[$editor['name']] = array('default'); |
|
| 511 | + $themes[$editor['name']] = array('default'); |
|
| 512 | + } |
|
| 512 | 513 | } |
| 513 | - } |
|
| 514 | 514 | |
| 515 | - // Check optional $selected_theme argument, if given. |
|
| 516 | - if (isset($selected_theme)) { |
|
| 515 | + // Check optional $selected_theme argument, if given. |
|
| 516 | + if (isset($selected_theme)) { |
|
| 517 | 517 | // If the passed theme name does not exist, use the first available. |
| 518 | 518 | if (!in_array($selected_theme, $themes[$profile->editor])) { |
| 519 | - $selected_theme = $profile->settings['theme'] = $themes[$profile->editor][0]; |
|
| 519 | + $selected_theme = $profile->settings['theme'] = $themes[$profile->editor][0]; |
|
| 520 | + } |
|
| 520 | 521 | } |
| 521 | - } |
|
| 522 | 522 | |
| 523 | - return isset($selected_theme) ? $selected_theme : $themes[$profile->editor]; |
|
| 523 | + return isset($selected_theme) ? $selected_theme : $themes[$profile->editor]; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
@@ -533,42 +533,42 @@ discard block |
||
| 533 | 533 | * An array for each plugin. |
| 534 | 534 | */ |
| 535 | 535 | function wysiwyg_get_plugins($editor_name) { |
| 536 | - $plugins = array(); |
|
| 537 | - if (!empty($editor_name)) { |
|
| 536 | + $plugins = array(); |
|
| 537 | + if (!empty($editor_name)) { |
|
| 538 | 538 | $editor = wysiwyg_get_editor($editor_name); |
| 539 | 539 | // Add internal editor plugins. |
| 540 | 540 | if (isset($editor['plugin callback']) && function_exists($editor['plugin callback'])) { |
| 541 | - $plugins = $editor['plugin callback']($editor); |
|
| 541 | + $plugins = $editor['plugin callback']($editor); |
|
| 542 | 542 | } |
| 543 | 543 | // Add editor plugins provided via hook_wysiwyg_plugin(). |
| 544 | 544 | $plugins = array_merge($plugins, module_invoke_all('wysiwyg_plugin', $editor['name'], $editor['installed version'])); |
| 545 | 545 | // Add API plugins provided by Drupal modules. |
| 546 | 546 | // @todo We need to pass the filepath to the plugin icon for Drupal plugins. |
| 547 | 547 | if (isset($editor['proxy plugin'])) { |
| 548 | - $plugins += $editor['proxy plugin']; |
|
| 549 | - $proxy = key($editor['proxy plugin']); |
|
| 550 | - foreach (wysiwyg_get_all_plugins() as $plugin_name => $info) { |
|
| 548 | + $plugins += $editor['proxy plugin']; |
|
| 549 | + $proxy = key($editor['proxy plugin']); |
|
| 550 | + foreach (wysiwyg_get_all_plugins() as $plugin_name => $info) { |
|
| 551 | 551 | $plugins[$proxy]['buttons'][$plugin_name] = $info['title']; |
| 552 | - } |
|
| 552 | + } |
|
| 553 | + } |
|
| 553 | 554 | } |
| 554 | - } |
|
| 555 | - return $plugins; |
|
| 555 | + return $plugins; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
| 559 | 559 | * Return an array of initial editor settings for a Wysiwyg profile. |
| 560 | 560 | */ |
| 561 | 561 | function wysiwyg_get_editor_config($profile, $theme) { |
| 562 | - $editor = wysiwyg_get_editor($profile->editor); |
|
| 563 | - $settings = array(); |
|
| 564 | - if (!empty($editor['settings callback']) && function_exists($editor['settings callback'])) { |
|
| 562 | + $editor = wysiwyg_get_editor($profile->editor); |
|
| 563 | + $settings = array(); |
|
| 564 | + if (!empty($editor['settings callback']) && function_exists($editor['settings callback'])) { |
|
| 565 | 565 | $settings = $editor['settings callback']($editor, $profile->settings, $theme); |
| 566 | 566 | |
| 567 | 567 | // Allow other modules to alter the editor settings for this format. |
| 568 | 568 | $context = array('editor' => $editor, 'profile' => $profile, 'theme' => $theme); |
| 569 | 569 | drupal_alter('wysiwyg_editor_settings', $settings, $context); |
| 570 | - } |
|
| 571 | - return $settings; |
|
| 570 | + } |
|
| 571 | + return $settings; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -581,106 +581,106 @@ discard block |
||
| 581 | 581 | * An array containing CSS files, including proper base path. |
| 582 | 582 | */ |
| 583 | 583 | function wysiwyg_get_css() { |
| 584 | - static $files; |
|
| 584 | + static $files; |
|
| 585 | 585 | |
| 586 | - if (isset($files)) { |
|
| 586 | + if (isset($files)) { |
|
| 587 | 587 | return $files; |
| 588 | - } |
|
| 589 | - // In node form previews, the theme has not been initialized yet. |
|
| 590 | - if (!empty($_POST)) { |
|
| 588 | + } |
|
| 589 | + // In node form previews, the theme has not been initialized yet. |
|
| 590 | + if (!empty($_POST)) { |
|
| 591 | 591 | init_theme(); |
| 592 | - } |
|
| 592 | + } |
|
| 593 | 593 | |
| 594 | - $files = array(); |
|
| 595 | - foreach (drupal_add_css() as $media => $css) { |
|
| 594 | + $files = array(); |
|
| 595 | + foreach (drupal_add_css() as $media => $css) { |
|
| 596 | 596 | if ($media != 'print') { |
| 597 | - foreach ($css['theme'] as $filepath => $preprocess) { |
|
| 597 | + foreach ($css['theme'] as $filepath => $preprocess) { |
|
| 598 | 598 | if (file_exists($filepath)) { |
| 599 | - $files[] = base_path() . $filepath; |
|
| 599 | + $files[] = base_path() . $filepath; |
|
| 600 | + } |
|
| 600 | 601 | } |
| 601 | - } |
|
| 602 | 602 | } |
| 603 | - } |
|
| 604 | - return $files; |
|
| 603 | + } |
|
| 604 | + return $files; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | /** |
| 608 | 608 | * Load profile for a given input format. |
| 609 | 609 | */ |
| 610 | 610 | function wysiwyg_profile_load($format) { |
| 611 | - static $profiles; |
|
| 611 | + static $profiles; |
|
| 612 | 612 | |
| 613 | - if (!isset($profiles) || !array_key_exists($format, $profiles)) { |
|
| 613 | + if (!isset($profiles) || !array_key_exists($format, $profiles)) { |
|
| 614 | 614 | $profiles = wysiwyg_profile_load_all(); |
| 615 | - } |
|
| 615 | + } |
|
| 616 | 616 | |
| 617 | - return (isset($profiles[$format]) ? $profiles[$format] : FALSE); |
|
| 617 | + return (isset($profiles[$format]) ? $profiles[$format] : FALSE); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /** |
| 621 | 621 | * Load all profiles. |
| 622 | 622 | */ |
| 623 | 623 | function wysiwyg_profile_load_all($reset = FALSE) { |
| 624 | - static $profiles; |
|
| 624 | + static $profiles; |
|
| 625 | 625 | |
| 626 | - if ($reset || !isset($profiles)) { |
|
| 626 | + if ($reset || !isset($profiles)) { |
|
| 627 | 627 | $profiles = array(); |
| 628 | 628 | if (!$reset && ($cache = cache_get('wysiwyg:profiles', 'cache')) && is_array($cache->data)) { |
| 629 | - $profiles = $cache->data; |
|
| 630 | - return $profiles; |
|
| 629 | + $profiles = $cache->data; |
|
| 630 | + return $profiles; |
|
| 631 | 631 | } |
| 632 | 632 | // If Exportables and CTools are installed, use their API to load both |
| 633 | 633 | // wysiwyg profiles from code and from the database |
| 634 | 634 | if (module_exists('ctools') && module_exists('exportables')) { |
| 635 | - if (exportables_api_version('2.0') && ctools_api_version('1.7')) { |
|
| 635 | + if (exportables_api_version('2.0') && ctools_api_version('1.7')) { |
|
| 636 | 636 | $input_formats = exportables_load_all('input_formats'); |
| 637 | 637 | ctools_include('export'); |
| 638 | 638 | $ctools_profiles = ctools_export_load_object('wysiwyg'); |
| 639 | 639 | // Wysiwyg module still use numeric ids as keys |
| 640 | 640 | foreach ($ctools_profiles as $machine_name => $profile) { |
| 641 | - $profile->format = $input_formats[$machine_name]; |
|
| 642 | - $profiles[$profile->format] = $profile; |
|
| 641 | + $profile->format = $input_formats[$machine_name]; |
|
| 642 | + $profiles[$profile->format] = $profile; |
|
| 643 | + } |
|
| 643 | 644 | } |
| 644 | - } |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | // DB profiles will always override Features profiles from flat files. |
| 648 | 648 | $result = db_query('SELECT format, editor, settings FROM {wysiwyg}'); |
| 649 | 649 | while ($profile = db_fetch_object($result)) { |
| 650 | - if (!isset($profiles[$profile->format])) { |
|
| 650 | + if (!isset($profiles[$profile->format])) { |
|
| 651 | 651 | $profile->settings = unserialize($profile->settings); |
| 652 | 652 | $profiles[$profile->format] = $profile; |
| 653 | - } |
|
| 653 | + } |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | drupal_alter('wysiwyg_load_profiles', $profiles); |
| 657 | 657 | cache_set('wysiwyg:profiles', $profiles); |
| 658 | - } |
|
| 658 | + } |
|
| 659 | 659 | |
| 660 | - return $profiles; |
|
| 660 | + return $profiles; |
|
| 661 | 661 | } |
| 662 | - /** |
|
| 663 | - * Wysiwyg profiles list callback. |
|
| 664 | - */ |
|
| 662 | + /** |
|
| 663 | + * Wysiwyg profiles list callback. |
|
| 664 | + */ |
|
| 665 | 665 | function wysiwyg_profile_list() { |
| 666 | - $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 667 | - $filter_formats = filter_formats(); |
|
| 668 | - $list = array(); |
|
| 669 | - foreach ($profiles as $profile) { |
|
| 666 | + $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 667 | + $filter_formats = filter_formats(); |
|
| 668 | + $list = array(); |
|
| 669 | + foreach ($profiles as $profile) { |
|
| 670 | 670 | $list[$profile->machine] = t('@format (@editor)', array('@editor' => $profile->editor, '@format' => $filter_formats[$profile->format]->name)); |
| 671 | - } |
|
| 672 | - return $list; |
|
| 671 | + } |
|
| 672 | + return $list; |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | 676 | * Remove a profile from the database. |
| 677 | 677 | */ |
| 678 | 678 | function wysiwyg_profile_delete($wysiwyg) { |
| 679 | - if (!isset($wysiwyg->format)) { |
|
| 679 | + if (!isset($wysiwyg->format)) { |
|
| 680 | 680 | $input_formats = exportables_load_all('input_formats'); |
| 681 | 681 | $wysiwyg->format = $input_formats[$wysiwyg->machine]; |
| 682 | - } |
|
| 683 | - db_query("DELETE FROM {wysiwyg} WHERE format = %d", $wysiwyg->format); |
|
| 682 | + } |
|
| 683 | + db_query("DELETE FROM {wysiwyg} WHERE format = %d", $wysiwyg->format); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | |
@@ -689,68 +689,68 @@ discard block |
||
| 689 | 689 | * Implementation of hook_user(). |
| 690 | 690 | */ |
| 691 | 691 | function wysiwyg_user($op, &$edit, $account, $category = NULL) { |
| 692 | - if ($op == 'form' && $category == 'account') { |
|
| 692 | + if ($op == 'form' && $category == 'account') { |
|
| 693 | 693 | $user_formats = filter_formats(); |
| 694 | 694 | $options = array(); |
| 695 | 695 | $options_default = array(); |
| 696 | 696 | foreach (wysiwyg_profile_load_all() as $format => $profile) { |
| 697 | - // Only show profiles that have user_choose enabled. |
|
| 698 | - if (!empty($profile->settings['user_choose']) && isset($user_formats[$format])) { |
|
| 697 | + // Only show profiles that have user_choose enabled. |
|
| 698 | + if (!empty($profile->settings['user_choose']) && isset($user_formats[$format])) { |
|
| 699 | 699 | $options[$format] = check_plain($user_formats[$format]->name); |
| 700 | 700 | if (wysiwyg_user_get_status($profile, $account)) { |
| 701 | - $options_default[] = $format; |
|
| 701 | + $options_default[] = $format; |
|
| 702 | + } |
|
| 702 | 703 | } |
| 703 | - } |
|
| 704 | 704 | } |
| 705 | 705 | if (!empty($options)) { |
| 706 | - $form['wysiwyg']['wysiwyg_status'] = array( |
|
| 706 | + $form['wysiwyg']['wysiwyg_status'] = array( |
|
| 707 | 707 | '#type' => 'checkboxes', |
| 708 | 708 | '#title' => t('Text formats enabled for rich-text editing'), |
| 709 | 709 | '#options' => $options, |
| 710 | 710 | '#default_value' => $options_default, |
| 711 | - ); |
|
| 712 | - return $form; |
|
| 711 | + ); |
|
| 712 | + return $form; |
|
| 713 | 713 | } |
| 714 | - } |
|
| 715 | - elseif ($op == 'insert' || $op == 'update') { |
|
| 714 | + } |
|
| 715 | + elseif ($op == 'insert' || $op == 'update') { |
|
| 716 | 716 | if (isset($edit['wysiwyg_status'])) { |
| 717 | - db_query("DELETE FROM {wysiwyg_user} WHERE uid = %d", $account->uid); |
|
| 718 | - foreach ($edit['wysiwyg_status'] as $format => $status) { |
|
| 717 | + db_query("DELETE FROM {wysiwyg_user} WHERE uid = %d", $account->uid); |
|
| 718 | + foreach ($edit['wysiwyg_status'] as $format => $status) { |
|
| 719 | 719 | db_query("INSERT INTO {wysiwyg_user} (uid, format, status) VALUES (%d, %d, %d)", array( |
| 720 | - $account->uid, |
|
| 721 | - $format, |
|
| 722 | - (int) (bool) $status, |
|
| 720 | + $account->uid, |
|
| 721 | + $format, |
|
| 722 | + (int) (bool) $status, |
|
| 723 | 723 | )); |
| 724 | - } |
|
| 724 | + } |
|
| 725 | + } |
|
| 725 | 726 | } |
| 726 | - } |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | function wysiwyg_user_get_status($profile, $account = NULL) { |
| 730 | - global $user; |
|
| 730 | + global $user; |
|
| 731 | 731 | |
| 732 | - if (!isset($account)) { |
|
| 732 | + if (!isset($account)) { |
|
| 733 | 733 | $account = $user; |
| 734 | - } |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | - // Default wysiwyg editor status information is only required on forms, so we |
|
| 737 | - // do not pre-emptively load and attach this information on every user_load(). |
|
| 738 | - if (!isset($account->wysiwyg_status)) { |
|
| 736 | + // Default wysiwyg editor status information is only required on forms, so we |
|
| 737 | + // do not pre-emptively load and attach this information on every user_load(). |
|
| 738 | + if (!isset($account->wysiwyg_status)) { |
|
| 739 | 739 | $account->wysiwyg_status = array(); |
| 740 | 740 | $result = db_query("SELECT format, status FROM {wysiwyg_user} WHERE uid = %d", $account->uid); |
| 741 | 741 | while ($row = db_fetch_object($result)) { |
| 742 | - $account->wysiwyg_status[$row->format] = $row->status; |
|
| 742 | + $account->wysiwyg_status[$row->format] = $row->status; |
|
| 743 | + } |
|
| 743 | 744 | } |
| 744 | - } |
|
| 745 | 745 | |
| 746 | - if (!empty($profile->settings['user_choose']) && isset($account->wysiwyg_status[$profile->format])) { |
|
| 746 | + if (!empty($profile->settings['user_choose']) && isset($account->wysiwyg_status[$profile->format])) { |
|
| 747 | 747 | $status = $account->wysiwyg_status[$profile->format]; |
| 748 | - } |
|
| 749 | - else { |
|
| 748 | + } |
|
| 749 | + else { |
|
| 750 | 750 | $status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE; |
| 751 | - } |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | - return (bool) $status; |
|
| 753 | + return (bool) $status; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
@@ -772,110 +772,110 @@ discard block |
||
| 772 | 772 | * installed properly. |
| 773 | 773 | */ |
| 774 | 774 | function wysiwyg_get_editor($name) { |
| 775 | - $editors = wysiwyg_get_all_editors(); |
|
| 776 | - return isset($editors[$name]) && $editors[$name]['installed'] ? $editors[$name] : FALSE; |
|
| 775 | + $editors = wysiwyg_get_all_editors(); |
|
| 776 | + return isset($editors[$name]) && $editors[$name]['installed'] ? $editors[$name] : FALSE; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
| 780 | 780 | * Compile a list holding all supported editors including installed editor version information. |
| 781 | 781 | */ |
| 782 | 782 | function wysiwyg_get_all_editors() { |
| 783 | - static $editors; |
|
| 783 | + static $editors; |
|
| 784 | 784 | |
| 785 | - if (isset($editors)) { |
|
| 785 | + if (isset($editors)) { |
|
| 786 | 786 | return $editors; |
| 787 | - } |
|
| 787 | + } |
|
| 788 | 788 | |
| 789 | - $editors = wysiwyg_load_includes('editors', 'editor'); |
|
| 790 | - foreach ($editors as $editor => $properties) { |
|
| 789 | + $editors = wysiwyg_load_includes('editors', 'editor'); |
|
| 790 | + foreach ($editors as $editor => $properties) { |
|
| 791 | 791 | // Fill in required properties. |
| 792 | 792 | $editors[$editor] += array( |
| 793 | - 'title' => '', |
|
| 794 | - 'vendor url' => '', |
|
| 795 | - 'download url' => '', |
|
| 796 | - 'editor path' => wysiwyg_get_path($editors[$editor]['name']), |
|
| 797 | - 'library path' => wysiwyg_get_path($editors[$editor]['name']), |
|
| 798 | - 'libraries' => array(), |
|
| 799 | - 'version callback' => NULL, |
|
| 800 | - 'themes callback' => NULL, |
|
| 801 | - 'settings callback' => NULL, |
|
| 802 | - 'plugin callback' => NULL, |
|
| 803 | - 'plugin settings callback' => NULL, |
|
| 804 | - 'versions' => array(), |
|
| 805 | - 'js path' => $editors[$editor]['path'] . '/js', |
|
| 806 | - 'css path' => $editors[$editor]['path'] . '/css', |
|
| 793 | + 'title' => '', |
|
| 794 | + 'vendor url' => '', |
|
| 795 | + 'download url' => '', |
|
| 796 | + 'editor path' => wysiwyg_get_path($editors[$editor]['name']), |
|
| 797 | + 'library path' => wysiwyg_get_path($editors[$editor]['name']), |
|
| 798 | + 'libraries' => array(), |
|
| 799 | + 'version callback' => NULL, |
|
| 800 | + 'themes callback' => NULL, |
|
| 801 | + 'settings callback' => NULL, |
|
| 802 | + 'plugin callback' => NULL, |
|
| 803 | + 'plugin settings callback' => NULL, |
|
| 804 | + 'versions' => array(), |
|
| 805 | + 'js path' => $editors[$editor]['path'] . '/js', |
|
| 806 | + 'css path' => $editors[$editor]['path'] . '/css', |
|
| 807 | 807 | ); |
| 808 | 808 | // Check whether library is present. |
| 809 | 809 | if (!($editors[$editor]['installed'] = file_exists($editors[$editor]['library path']))) { |
| 810 | - continue; |
|
| 810 | + continue; |
|
| 811 | 811 | } |
| 812 | 812 | // Detect library version. |
| 813 | 813 | if (function_exists($editors[$editor]['version callback'])) { |
| 814 | - $editors[$editor]['installed version'] = $editors[$editor]['version callback']($editors[$editor]); |
|
| 814 | + $editors[$editor]['installed version'] = $editors[$editor]['version callback']($editors[$editor]); |
|
| 815 | 815 | } |
| 816 | 816 | if (empty($editors[$editor]['installed version'])) { |
| 817 | - $editors[$editor]['error'] = t('The version of %editor could not be detected.', array('%editor' => $properties['title'])); |
|
| 818 | - $editors[$editor]['installed'] = FALSE; |
|
| 819 | - continue; |
|
| 817 | + $editors[$editor]['error'] = t('The version of %editor could not be detected.', array('%editor' => $properties['title'])); |
|
| 818 | + $editors[$editor]['installed'] = FALSE; |
|
| 819 | + continue; |
|
| 820 | 820 | } |
| 821 | 821 | // Determine to which supported version the installed version maps. |
| 822 | 822 | ksort($editors[$editor]['versions']); |
| 823 | 823 | $version = 0; |
| 824 | 824 | foreach ($editors[$editor]['versions'] as $supported_version => $version_properties) { |
| 825 | - if (version_compare($editors[$editor]['installed version'], $supported_version, '>=')) { |
|
| 825 | + if (version_compare($editors[$editor]['installed version'], $supported_version, '>=')) { |
|
| 826 | 826 | $version = $supported_version; |
| 827 | - } |
|
| 827 | + } |
|
| 828 | 828 | } |
| 829 | 829 | if (!$version) { |
| 830 | - $editors[$editor]['error'] = t('The installed version %version of %editor is not supported.', array('%version' => $editors[$editor]['installed version'], '%editor' => $editors[$editor]['title'])); |
|
| 831 | - $editors[$editor]['installed'] = FALSE; |
|
| 832 | - continue; |
|
| 830 | + $editors[$editor]['error'] = t('The installed version %version of %editor is not supported.', array('%version' => $editors[$editor]['installed version'], '%editor' => $editors[$editor]['title'])); |
|
| 831 | + $editors[$editor]['installed'] = FALSE; |
|
| 832 | + continue; |
|
| 833 | 833 | } |
| 834 | 834 | // Apply library version specific definitions and overrides. |
| 835 | 835 | $editors[$editor] = array_merge($editors[$editor], $editors[$editor]['versions'][$version]); |
| 836 | 836 | unset($editors[$editor]['versions']); |
| 837 | - } |
|
| 838 | - return $editors; |
|
| 837 | + } |
|
| 838 | + return $editors; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | /** |
| 842 | 842 | * Invoke hook_wysiwyg_plugin() in all modules. |
| 843 | 843 | */ |
| 844 | 844 | function wysiwyg_get_all_plugins() { |
| 845 | - static $plugins; |
|
| 845 | + static $plugins; |
|
| 846 | 846 | |
| 847 | - if (isset($plugins)) { |
|
| 847 | + if (isset($plugins)) { |
|
| 848 | 848 | return $plugins; |
| 849 | - } |
|
| 849 | + } |
|
| 850 | 850 | |
| 851 | - $plugins = wysiwyg_load_includes('plugins', 'plugin'); |
|
| 852 | - foreach ($plugins as $name => $properties) { |
|
| 851 | + $plugins = wysiwyg_load_includes('plugins', 'plugin'); |
|
| 852 | + foreach ($plugins as $name => $properties) { |
|
| 853 | 853 | $plugin = &$plugins[$name]; |
| 854 | 854 | // Fill in required/default properties. |
| 855 | 855 | $plugin += array( |
| 856 | - 'title' => $plugin['name'], |
|
| 857 | - 'vendor url' => '', |
|
| 858 | - 'js path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 859 | - 'js file' => $plugin['name'] . '.js', |
|
| 860 | - 'css path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 861 | - 'css file' => $plugin['name'] . '.css', |
|
| 862 | - 'icon path' => $plugin['path'] . '/' . $plugin['name'] . '/images', |
|
| 863 | - 'icon file' => $plugin['name'] . '.png', |
|
| 864 | - 'dialog path' => $plugin['name'], |
|
| 865 | - 'dialog settings' => array(), |
|
| 866 | - 'settings callback' => NULL, |
|
| 867 | - 'settings form callback' => NULL, |
|
| 856 | + 'title' => $plugin['name'], |
|
| 857 | + 'vendor url' => '', |
|
| 858 | + 'js path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 859 | + 'js file' => $plugin['name'] . '.js', |
|
| 860 | + 'css path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 861 | + 'css file' => $plugin['name'] . '.css', |
|
| 862 | + 'icon path' => $plugin['path'] . '/' . $plugin['name'] . '/images', |
|
| 863 | + 'icon file' => $plugin['name'] . '.png', |
|
| 864 | + 'dialog path' => $plugin['name'], |
|
| 865 | + 'dialog settings' => array(), |
|
| 866 | + 'settings callback' => NULL, |
|
| 867 | + 'settings form callback' => NULL, |
|
| 868 | 868 | ); |
| 869 | 869 | // Fill in default settings. |
| 870 | 870 | $plugin['settings'] += array( |
| 871 | - 'path' => base_path() . $plugin['path'] . '/' . $plugin['name'], |
|
| 871 | + 'path' => base_path() . $plugin['path'] . '/' . $plugin['name'], |
|
| 872 | 872 | ); |
| 873 | 873 | // Check whether library is present. |
| 874 | 874 | if (!($plugin['installed'] = file_exists($plugin['js path'] . '/' . $plugin['js file']))) { |
| 875 | - continue; |
|
| 875 | + continue; |
|
| 876 | + } |
|
| 876 | 877 | } |
| 877 | - } |
|
| 878 | - return $plugins; |
|
| 878 | + return $plugins; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
@@ -891,26 +891,26 @@ discard block |
||
| 891 | 891 | * @see wysiwyg_get_directories(), _wysiwyg_process_include() |
| 892 | 892 | */ |
| 893 | 893 | function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = NULL) { |
| 894 | - // Determine implementations. |
|
| 895 | - $directories = wysiwyg_get_directories($type); |
|
| 896 | - $directories['wysiwyg'] = drupal_get_path('module', 'wysiwyg') . '/' . $type; |
|
| 897 | - $file_list = array(); |
|
| 898 | - foreach ($directories as $module => $path) { |
|
| 894 | + // Determine implementations. |
|
| 895 | + $directories = wysiwyg_get_directories($type); |
|
| 896 | + $directories['wysiwyg'] = drupal_get_path('module', 'wysiwyg') . '/' . $type; |
|
| 897 | + $file_list = array(); |
|
| 898 | + foreach ($directories as $module => $path) { |
|
| 899 | 899 | $file_list[$module] = drupal_system_listing("$file" . '.inc$', $path, 'name', 0); |
| 900 | - } |
|
| 900 | + } |
|
| 901 | 901 | |
| 902 | - // Load implementations. |
|
| 903 | - $info = array(); |
|
| 904 | - foreach (array_filter($file_list) as $module => $files) { |
|
| 902 | + // Load implementations. |
|
| 903 | + $info = array(); |
|
| 904 | + foreach (array_filter($file_list) as $module => $files) { |
|
| 905 | 905 | foreach ($files as $file) { |
| 906 | - include_once './' . $file->filename; |
|
| 907 | - $result = _wysiwyg_process_include($module, $module . '_' . $file->name, dirname($file->filename), $hook); |
|
| 908 | - if (is_array($result)) { |
|
| 906 | + include_once './' . $file->filename; |
|
| 907 | + $result = _wysiwyg_process_include($module, $module . '_' . $file->name, dirname($file->filename), $hook); |
|
| 908 | + if (is_array($result)) { |
|
| 909 | 909 | $info = array_merge($info, $result); |
| 910 | - } |
|
| 910 | + } |
|
| 911 | 911 | } |
| 912 | - } |
|
| 913 | - return $info; |
|
| 912 | + } |
|
| 913 | + return $info; |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
@@ -927,20 +927,20 @@ discard block |
||
| 927 | 927 | * @ingroup libraries |
| 928 | 928 | */ |
| 929 | 929 | function wysiwyg_get_path($library, $base_path = FALSE) { |
| 930 | - static $libraries; |
|
| 930 | + static $libraries; |
|
| 931 | 931 | |
| 932 | - if (!isset($libraries)) { |
|
| 932 | + if (!isset($libraries)) { |
|
| 933 | 933 | $libraries = wysiwyg_get_libraries(); |
| 934 | - } |
|
| 935 | - if (!isset($libraries[$library])) { |
|
| 934 | + } |
|
| 935 | + if (!isset($libraries[$library])) { |
|
| 936 | 936 | // Most often, external libraries can be shared across multiple sites. |
| 937 | 937 | return 'sites/all/libraries/' . $library; |
| 938 | - } |
|
| 938 | + } |
|
| 939 | 939 | |
| 940 | - $path = ($base_path ? base_path() : ''); |
|
| 941 | - $path .= $libraries[$library]; |
|
| 940 | + $path = ($base_path ? base_path() : ''); |
|
| 941 | + $path .= $libraries[$library]; |
|
| 942 | 942 | |
| 943 | - return $path; |
|
| 943 | + return $path; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | /** |
@@ -960,55 +960,55 @@ discard block |
||
| 960 | 960 | * @ingroup libraries |
| 961 | 961 | */ |
| 962 | 962 | function wysiwyg_get_libraries() { |
| 963 | - global $profile; |
|
| 964 | - |
|
| 965 | - // When this function is called during Drupal's initial installation process, |
|
| 966 | - // the name of the profile that is about to be installed is stored in the |
|
| 967 | - // global $profile variable. At all other times, the regular system variable |
|
| 968 | - // contains the name of the current profile, and we can call variable_get() |
|
| 969 | - // to determine the profile. |
|
| 970 | - if (!isset($profile)) { |
|
| 963 | + global $profile; |
|
| 964 | + |
|
| 965 | + // When this function is called during Drupal's initial installation process, |
|
| 966 | + // the name of the profile that is about to be installed is stored in the |
|
| 967 | + // global $profile variable. At all other times, the regular system variable |
|
| 968 | + // contains the name of the current profile, and we can call variable_get() |
|
| 969 | + // to determine the profile. |
|
| 970 | + if (!isset($profile)) { |
|
| 971 | 971 | $profile = variable_get('install_profile', 'default'); |
| 972 | - } |
|
| 972 | + } |
|
| 973 | 973 | |
| 974 | - $directory = 'libraries'; |
|
| 975 | - $searchdir = array(); |
|
| 976 | - $config = conf_path(); |
|
| 974 | + $directory = 'libraries'; |
|
| 975 | + $searchdir = array(); |
|
| 976 | + $config = conf_path(); |
|
| 977 | 977 | |
| 978 | - // The 'profiles' directory contains pristine collections of modules and |
|
| 979 | - // themes as organized by a distribution. It is pristine in the same way |
|
| 980 | - // that /modules is pristine for core; users should avoid changing anything |
|
| 981 | - // there in favor of sites/all or sites/<domain> directories. |
|
| 982 | - if (file_exists("profiles/$profile/$directory")) { |
|
| 978 | + // The 'profiles' directory contains pristine collections of modules and |
|
| 979 | + // themes as organized by a distribution. It is pristine in the same way |
|
| 980 | + // that /modules is pristine for core; users should avoid changing anything |
|
| 981 | + // there in favor of sites/all or sites/<domain> directories. |
|
| 982 | + if (file_exists("profiles/$profile/$directory")) { |
|
| 983 | 983 | $searchdir[] = "profiles/$profile/$directory"; |
| 984 | - } |
|
| 984 | + } |
|
| 985 | 985 | |
| 986 | - // Always search sites/all/*. |
|
| 987 | - $searchdir[] = 'sites/all/' . $directory; |
|
| 986 | + // Always search sites/all/*. |
|
| 987 | + $searchdir[] = 'sites/all/' . $directory; |
|
| 988 | 988 | |
| 989 | - // Also search sites/<domain>/*. |
|
| 990 | - if (file_exists("$config/$directory")) { |
|
| 989 | + // Also search sites/<domain>/*. |
|
| 990 | + if (file_exists("$config/$directory")) { |
|
| 991 | 991 | $searchdir[] = "$config/$directory"; |
| 992 | - } |
|
| 992 | + } |
|
| 993 | 993 | |
| 994 | - // Retrieve list of directories. |
|
| 995 | - // @todo Core: Allow to scan for directories. |
|
| 996 | - $directories = array(); |
|
| 997 | - $nomask = array('CVS'); |
|
| 998 | - foreach ($searchdir as $dir) { |
|
| 994 | + // Retrieve list of directories. |
|
| 995 | + // @todo Core: Allow to scan for directories. |
|
| 996 | + $directories = array(); |
|
| 997 | + $nomask = array('CVS'); |
|
| 998 | + foreach ($searchdir as $dir) { |
|
| 999 | 999 | if (is_dir($dir) && $handle = opendir($dir)) { |
| 1000 | - while (FALSE !== ($file = readdir($handle))) { |
|
| 1000 | + while (FALSE !== ($file = readdir($handle))) { |
|
| 1001 | 1001 | if (!in_array($file, $nomask) && $file[0] != '.') { |
| 1002 | - if (is_dir("$dir/$file")) { |
|
| 1002 | + if (is_dir("$dir/$file")) { |
|
| 1003 | 1003 | $directories[$file] = "$dir/$file"; |
| 1004 | - } |
|
| 1004 | + } |
|
| 1005 | + } |
|
| 1005 | 1006 | } |
| 1006 | - } |
|
| 1007 | - closedir($handle); |
|
| 1007 | + closedir($handle); |
|
| 1008 | + } |
|
| 1008 | 1009 | } |
| 1009 | - } |
|
| 1010 | 1010 | |
| 1011 | - return $directories; |
|
| 1011 | + return $directories; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | /** |
@@ -1024,14 +1024,14 @@ discard block |
||
| 1024 | 1024 | * @see wysiwyg_load_includes(), _wysiwyg_process_include() |
| 1025 | 1025 | */ |
| 1026 | 1026 | function wysiwyg_get_directories($plugintype) { |
| 1027 | - $directories = array(); |
|
| 1028 | - foreach (module_implements('wysiwyg_include_directory') as $module) { |
|
| 1027 | + $directories = array(); |
|
| 1028 | + foreach (module_implements('wysiwyg_include_directory') as $module) { |
|
| 1029 | 1029 | $result = module_invoke($module, 'wysiwyg_include_directory', $plugintype); |
| 1030 | 1030 | if (isset($result) && is_string($result)) { |
| 1031 | - $directories[$module] = drupal_get_path('module', $module) . '/' . $result; |
|
| 1031 | + $directories[$module] = drupal_get_path('module', $module) . '/' . $result; |
|
| 1032 | 1032 | } |
| 1033 | - } |
|
| 1034 | - return $directories; |
|
| 1033 | + } |
|
| 1034 | + return $directories; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | /** |
@@ -1045,22 +1045,22 @@ discard block |
||
| 1045 | 1045 | * The name of the hook being invoked. |
| 1046 | 1046 | */ |
| 1047 | 1047 | function _wysiwyg_process_include($module, $identifier, $path, $hook) { |
| 1048 | - $function = $identifier . '_' . $hook; |
|
| 1049 | - if (!function_exists($function)) { |
|
| 1048 | + $function = $identifier . '_' . $hook; |
|
| 1049 | + if (!function_exists($function)) { |
|
| 1050 | 1050 | return NULL; |
| 1051 | - } |
|
| 1052 | - $result = $function(); |
|
| 1053 | - if (!isset($result) || !is_array($result)) { |
|
| 1051 | + } |
|
| 1052 | + $result = $function(); |
|
| 1053 | + if (!isset($result) || !is_array($result)) { |
|
| 1054 | 1054 | return NULL; |
| 1055 | - } |
|
| 1055 | + } |
|
| 1056 | 1056 | |
| 1057 | - // Fill in defaults. |
|
| 1058 | - foreach ($result as $editor => $properties) { |
|
| 1057 | + // Fill in defaults. |
|
| 1058 | + foreach ($result as $editor => $properties) { |
|
| 1059 | 1059 | $result[$editor]['module'] = $module; |
| 1060 | 1060 | $result[$editor]['name'] = $editor; |
| 1061 | 1061 | $result[$editor]['path'] = $path; |
| 1062 | - } |
|
| 1063 | - return $result; |
|
| 1062 | + } |
|
| 1063 | + return $result; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | /** |
@@ -1079,12 +1079,12 @@ discard block |
||
| 1079 | 1079 | * installed. |
| 1080 | 1080 | */ |
| 1081 | 1081 | function wysiwyg_features_api() { |
| 1082 | - $return = array(); |
|
| 1083 | - if (module_exists('exportables') && module_exists('ctools')) { |
|
| 1082 | + $return = array(); |
|
| 1083 | + if (module_exists('exportables') && module_exists('ctools')) { |
|
| 1084 | 1084 | module_load_include('inc', 'features', 'includes/features.ctools'); |
| 1085 | 1085 | $return = ctools_component_features_api('wysiwyg'); |
| 1086 | - } |
|
| 1087 | - return $return; |
|
| 1086 | + } |
|
| 1087 | + return $return; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | /** |
@@ -1094,10 +1094,10 @@ discard block |
||
| 1094 | 1094 | */ |
| 1095 | 1095 | function wysiwyg_features_export($data, &$export, $module_name = '') { |
| 1096 | 1096 | |
| 1097 | - $return = ctools_component_features_export('wysiwyg', $data, $export, $module_name); |
|
| 1098 | - $export['dependencies']['exportables'] = 'exportables'; |
|
| 1097 | + $return = ctools_component_features_export('wysiwyg', $data, $export, $module_name); |
|
| 1098 | + $export['dependencies']['exportables'] = 'exportables'; |
|
| 1099 | 1099 | |
| 1100 | - return $return; |
|
| 1100 | + return $return; |
|
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | /** |
@@ -79,9 +79,9 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_help($path, $arg) { |
| 81 | 81 | switch ($path) { |
| 82 | - case 'admin/settings/wysiwyg': |
|
| 83 | - $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
|
| 84 | - return $output; |
|
| 82 | + case 'admin/settings/wysiwyg': |
|
| 83 | + $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
|
| 84 | + return $output; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | function wysiwyg_help($path, $arg) { |
| 81 | 81 | switch ($path) { |
| 82 | 82 | case 'admin/settings/wysiwyg': |
| 83 | - $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
|
| 83 | + $output = '<p>'.t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.').'</p>'; |
|
| 84 | 84 | return $output; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | if ($profile) { |
| 180 | 180 | $loaded = TRUE; |
| 181 | 181 | $editor = $profile->editor; |
| 182 | - $status = (int) wysiwyg_user_get_status($profile); |
|
| 182 | + $status = (int)wysiwyg_user_get_status($profile); |
|
| 183 | 183 | if (isset($profile->settings['show_toggle'])) { |
| 184 | - $toggle = (int) $profile->settings['show_toggle']; |
|
| 184 | + $toggle = (int)$profile->settings['show_toggle']; |
|
| 185 | 185 | } |
| 186 | 186 | // Check editor theme (and reset it if not/no longer available). |
| 187 | 187 | $theme = wysiwyg_get_editor_themes($profile, (isset($profile->settings['theme']) ? $profile->settings['theme'] : '')); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | // Use a prefix/suffix for a single input format, or attach to input |
| 196 | 196 | // format selector radio buttons. |
| 197 | 197 | if (isset($element['format']['guidelines'])) { |
| 198 | - $element['format']['guidelines']['#prefix'] = '<div class="wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class . '">'; |
|
| 198 | + $element['format']['guidelines']['#prefix'] = '<div class="wysiwyg wysiwyg-format-'.$format.' wysiwyg-editor-'.$editor.' wysiwyg-field-'.$field['#id'].' wysiwyg-status-'.$status.' wysiwyg-toggle-'.$toggle.$extra_class.'">'; |
|
| 199 | 199 | $element['format']['guidelines']['#suffix'] = '</div>'; |
| 200 | 200 | // Edge-case: Default format contains no input filters. |
| 201 | 201 | if (empty($element['format']['guidelines']['#value'])) { |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | else { |
| 206 | - $element[$format]['#attributes']['class'] = (isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'] . ' ' : ''); |
|
| 207 | - $element[$format]['#attributes']['class'] .= 'wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class; |
|
| 206 | + $element[$format]['#attributes']['class'] = (isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'].' ' : ''); |
|
| 207 | + $element[$format]['#attributes']['class'] .= 'wysiwyg wysiwyg-format-'.$format.' wysiwyg-editor-'.$editor.' wysiwyg-field-'.$field['#id'].' wysiwyg-status-'.$status.' wysiwyg-toggle-'.$toggle.$extra_class; |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | foreach ($files as $file => $options) { |
| 284 | 284 | if (is_array($options)) { |
| 285 | 285 | $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); |
| 286 | - drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
|
| 286 | + drupal_add_js($editor['library path'].'/'.$file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
|
| 287 | 287 | } |
| 288 | 288 | else { |
| 289 | - drupal_add_js($editor['library path'] . '/' . $options); |
|
| 289 | + drupal_add_js($editor['library path'].'/'.$options); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | // If editor defines an additional load callback, invoke it. |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $files = $editor['js files']; |
| 301 | 301 | } |
| 302 | 302 | foreach ($files as $file) { |
| 303 | - drupal_add_js($editor['js path'] . '/' . $file); |
|
| 303 | + drupal_add_js($editor['js path'].'/'.$file); |
|
| 304 | 304 | } |
| 305 | 305 | // Load CSS stylesheets for this editor. |
| 306 | 306 | $files = array(); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $files = $editor['css files']; |
| 309 | 309 | } |
| 310 | 310 | foreach ($files as $file) { |
| 311 | - drupal_add_css($editor['css path'] . '/' . $file); |
|
| 311 | + drupal_add_css($editor['css path'].'/'.$file); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | drupal_add_js(array('wysiwyg' => array( |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | // @todo Move into (global) editor settings. |
| 317 | 317 | // If JS compression is enabled, at least TinyMCE is unable to determine |
| 318 | 318 | // its own base path and exec mode since it can't find the script name. |
| 319 | - 'editorBasePath' => base_path() . $editor['library path'], |
|
| 319 | + 'editorBasePath' => base_path().$editor['library path'], |
|
| 320 | 320 | 'execMode' => $library, |
| 321 | 321 | ))), |
| 322 | 322 | )), 'setting'); |
@@ -340,11 +340,11 @@ discard block |
||
| 340 | 340 | $path = drupal_get_path('module', 'wysiwyg'); |
| 341 | 341 | // Initialize our namespaces in the *header* to do not force editor |
| 342 | 342 | // integration scripts to check and define Drupal.wysiwyg on its own. |
| 343 | - drupal_add_js($path . '/wysiwyg.init.js', 'core'); |
|
| 343 | + drupal_add_js($path.'/wysiwyg.init.js', 'core'); |
|
| 344 | 344 | |
| 345 | 345 | // The 'none' editor is a special editor implementation, allowing us to |
| 346 | 346 | // attach and detach regular Drupal behaviors just like any other editor. |
| 347 | - drupal_add_js($path . '/editors/js/none.js'); |
|
| 347 | + drupal_add_js($path.'/editors/js/none.js'); |
|
| 348 | 348 | |
| 349 | 349 | // Add wysiwyg.js to the footer to ensure it's executed after the |
| 350 | 350 | // Drupal.settings array has been rendered and populated. Also, since editor |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // and Drupal.wysiwygInit() must be executed AFTER editors registered |
| 353 | 353 | // their callbacks and BEFORE Drupal.behaviors are applied, this must come |
| 354 | 354 | // last. |
| 355 | - drupal_add_js($path . '/wysiwyg.js', 'module', 'footer'); |
|
| 355 | + drupal_add_js($path.'/wysiwyg.js', 'module', 'footer'); |
|
| 356 | 356 | |
| 357 | 357 | $settings_added = TRUE; |
| 358 | 358 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | // drupal_to_js() does not properly convert numeric array keys, so we need |
| 372 | 372 | // to use a string instead of the format id. |
| 373 | 373 | if ($config) { |
| 374 | - drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); |
|
| 374 | + drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format'.$profile->format => $config)))), 'setting'); |
|
| 375 | 375 | } |
| 376 | 376 | $formats[$profile->format] = TRUE; |
| 377 | 377 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $settings_native = call_user_func($editor['plugin settings callback'], $editor, $profile, $profile_plugins_native); |
| 449 | 449 | |
| 450 | 450 | if ($settings_native) { |
| 451 | - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting'); |
|
| 451 | + drupal_add_js(array('wysiwyg' => array('plugins' => array('format'.$profile->format => array('native' => $settings_native)))), 'setting'); |
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | if (!isset($processed_plugins[$proxy][$plugin])) { |
| 464 | 464 | $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin] = $meta; |
| 465 | 465 | // Load the Drupal plugin's JavaScript. |
| 466 | - drupal_add_js($meta['js path'] . '/' . $meta['js file']); |
|
| 466 | + drupal_add_js($meta['js path'].'/'.$meta['js file']); |
|
| 467 | 467 | // Add plugin-specific settings. |
| 468 | 468 | if (isset($meta['settings'])) { |
| 469 | 469 | drupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting'); |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $settings_drupal = call_user_func($editor['proxy plugin settings callback'], $editor, $profile, $profile_plugins_drupal); |
| 480 | 480 | |
| 481 | 481 | if ($settings_drupal) { |
| 482 | - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting'); |
|
| 482 | + drupal_add_js(array('wysiwyg' => array('plugins' => array('format'.$profile->format => array('drupal' => $settings_drupal)))), 'setting'); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | if ($media != 'print') { |
| 597 | 597 | foreach ($css['theme'] as $filepath => $preprocess) { |
| 598 | 598 | if (file_exists($filepath)) { |
| 599 | - $files[] = base_path() . $filepath; |
|
| 599 | + $files[] = base_path().$filepath; |
|
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | db_query("INSERT INTO {wysiwyg_user} (uid, format, status) VALUES (%d, %d, %d)", array( |
| 720 | 720 | $account->uid, |
| 721 | 721 | $format, |
| 722 | - (int) (bool) $status, |
|
| 722 | + (int)(bool)$status, |
|
| 723 | 723 | )); |
| 724 | 724 | } |
| 725 | 725 | } |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | $status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - return (bool) $status; |
|
| 753 | + return (bool)$status; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | 'plugin callback' => NULL, |
| 803 | 803 | 'plugin settings callback' => NULL, |
| 804 | 804 | 'versions' => array(), |
| 805 | - 'js path' => $editors[$editor]['path'] . '/js', |
|
| 806 | - 'css path' => $editors[$editor]['path'] . '/css', |
|
| 805 | + 'js path' => $editors[$editor]['path'].'/js', |
|
| 806 | + 'css path' => $editors[$editor]['path'].'/css', |
|
| 807 | 807 | ); |
| 808 | 808 | // Check whether library is present. |
| 809 | 809 | if (!($editors[$editor]['installed'] = file_exists($editors[$editor]['library path']))) { |
@@ -855,12 +855,12 @@ discard block |
||
| 855 | 855 | $plugin += array( |
| 856 | 856 | 'title' => $plugin['name'], |
| 857 | 857 | 'vendor url' => '', |
| 858 | - 'js path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 859 | - 'js file' => $plugin['name'] . '.js', |
|
| 860 | - 'css path' => $plugin['path'] . '/' . $plugin['name'], |
|
| 861 | - 'css file' => $plugin['name'] . '.css', |
|
| 862 | - 'icon path' => $plugin['path'] . '/' . $plugin['name'] . '/images', |
|
| 863 | - 'icon file' => $plugin['name'] . '.png', |
|
| 858 | + 'js path' => $plugin['path'].'/'.$plugin['name'], |
|
| 859 | + 'js file' => $plugin['name'].'.js', |
|
| 860 | + 'css path' => $plugin['path'].'/'.$plugin['name'], |
|
| 861 | + 'css file' => $plugin['name'].'.css', |
|
| 862 | + 'icon path' => $plugin['path'].'/'.$plugin['name'].'/images', |
|
| 863 | + 'icon file' => $plugin['name'].'.png', |
|
| 864 | 864 | 'dialog path' => $plugin['name'], |
| 865 | 865 | 'dialog settings' => array(), |
| 866 | 866 | 'settings callback' => NULL, |
@@ -868,10 +868,10 @@ discard block |
||
| 868 | 868 | ); |
| 869 | 869 | // Fill in default settings. |
| 870 | 870 | $plugin['settings'] += array( |
| 871 | - 'path' => base_path() . $plugin['path'] . '/' . $plugin['name'], |
|
| 871 | + 'path' => base_path().$plugin['path'].'/'.$plugin['name'], |
|
| 872 | 872 | ); |
| 873 | 873 | // Check whether library is present. |
| 874 | - if (!($plugin['installed'] = file_exists($plugin['js path'] . '/' . $plugin['js file']))) { |
|
| 874 | + if (!($plugin['installed'] = file_exists($plugin['js path'].'/'.$plugin['js file']))) { |
|
| 875 | 875 | continue; |
| 876 | 876 | } |
| 877 | 877 | } |
@@ -893,18 +893,18 @@ discard block |
||
| 893 | 893 | function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = NULL) { |
| 894 | 894 | // Determine implementations. |
| 895 | 895 | $directories = wysiwyg_get_directories($type); |
| 896 | - $directories['wysiwyg'] = drupal_get_path('module', 'wysiwyg') . '/' . $type; |
|
| 896 | + $directories['wysiwyg'] = drupal_get_path('module', 'wysiwyg').'/'.$type; |
|
| 897 | 897 | $file_list = array(); |
| 898 | 898 | foreach ($directories as $module => $path) { |
| 899 | - $file_list[$module] = drupal_system_listing("$file" . '.inc$', $path, 'name', 0); |
|
| 899 | + $file_list[$module] = drupal_system_listing("$file".'.inc$', $path, 'name', 0); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | // Load implementations. |
| 903 | 903 | $info = array(); |
| 904 | 904 | foreach (array_filter($file_list) as $module => $files) { |
| 905 | 905 | foreach ($files as $file) { |
| 906 | - include_once './' . $file->filename; |
|
| 907 | - $result = _wysiwyg_process_include($module, $module . '_' . $file->name, dirname($file->filename), $hook); |
|
| 906 | + include_once './'.$file->filename; |
|
| 907 | + $result = _wysiwyg_process_include($module, $module.'_'.$file->name, dirname($file->filename), $hook); |
|
| 908 | 908 | if (is_array($result)) { |
| 909 | 909 | $info = array_merge($info, $result); |
| 910 | 910 | } |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | } |
| 935 | 935 | if (!isset($libraries[$library])) { |
| 936 | 936 | // Most often, external libraries can be shared across multiple sites. |
| 937 | - return 'sites/all/libraries/' . $library; |
|
| 937 | + return 'sites/all/libraries/'.$library; |
|
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | $path = ($base_path ? base_path() : ''); |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | // Always search sites/all/*. |
| 987 | - $searchdir[] = 'sites/all/' . $directory; |
|
| 987 | + $searchdir[] = 'sites/all/'.$directory; |
|
| 988 | 988 | |
| 989 | 989 | // Also search sites/<domain>/*. |
| 990 | 990 | if (file_exists("$config/$directory")) { |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | foreach (module_implements('wysiwyg_include_directory') as $module) { |
| 1029 | 1029 | $result = module_invoke($module, 'wysiwyg_include_directory', $plugintype); |
| 1030 | 1030 | if (isset($result) && is_string($result)) { |
| 1031 | - $directories[$module] = drupal_get_path('module', $module) . '/' . $result; |
|
| 1031 | + $directories[$module] = drupal_get_path('module', $module).'/'.$result; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | return $directories; |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | * The name of the hook being invoked. |
| 1046 | 1046 | */ |
| 1047 | 1047 | function _wysiwyg_process_include($module, $identifier, $path, $hook) { |
| 1048 | - $function = $identifier . '_' . $hook; |
|
| 1048 | + $function = $identifier.'_'.$hook; |
|
| 1049 | 1049 | if (!function_exists($function)) { |
| 1050 | 1050 | return NULL; |
| 1051 | 1051 | } |
@@ -201,8 +201,7 @@ discard block |
||
| 201 | 201 | if (empty($element['format']['guidelines']['#value'])) { |
| 202 | 202 | $element['format']['guidelines']['#value'] = ' '; |
| 203 | 203 | } |
| 204 | - } |
|
| 205 | - else { |
|
| 204 | + } else { |
|
| 206 | 205 | $element[$format]['#attributes']['class'] = (isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'] . ' ' : ''); |
| 207 | 206 | $element[$format]['#attributes']['class'] .= 'wysiwyg wysiwyg-format-' . $format . ' wysiwyg-editor-' . $editor . ' wysiwyg-field-' . $field['#id'] . ' wysiwyg-status-' . $status . ' wysiwyg-toggle-' . $toggle . $extra_class; |
| 208 | 207 | } |
@@ -273,8 +272,7 @@ discard block |
||
| 273 | 272 | if (isset($profile->settings['library']) && isset($editor['libraries'][$profile->settings['library']])) { |
| 274 | 273 | $library = $profile->settings['library']; |
| 275 | 274 | $files = $editor['libraries'][$library]['files']; |
| 276 | - } |
|
| 277 | - else { |
|
| 275 | + } else { |
|
| 278 | 276 | // Fallback to the first defined library by default (external libraries can change). |
| 279 | 277 | $library = key($editor['libraries']); |
| 280 | 278 | $files = array_shift($editor['libraries']); |
@@ -284,8 +282,7 @@ discard block |
||
| 284 | 282 | if (is_array($options)) { |
| 285 | 283 | $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); |
| 286 | 284 | drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
| 287 | - } |
|
| 288 | - else { |
|
| 285 | + } else { |
|
| 289 | 286 | drupal_add_js($editor['library path'] . '/' . $options); |
| 290 | 287 | } |
| 291 | 288 | } |
@@ -322,8 +319,7 @@ discard block |
||
| 322 | 319 | )), 'setting'); |
| 323 | 320 | |
| 324 | 321 | $loaded[$name] = TRUE; |
| 325 | - } |
|
| 326 | - else { |
|
| 322 | + } else { |
|
| 327 | 323 | $loaded[$name] = FALSE; |
| 328 | 324 | } |
| 329 | 325 | } |
@@ -468,8 +464,7 @@ discard block |
||
| 468 | 464 | if (isset($meta['settings'])) { |
| 469 | 465 | drupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting'); |
| 470 | 466 | } |
| 471 | - } |
|
| 472 | - else { |
|
| 467 | + } else { |
|
| 473 | 468 | $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin]; |
| 474 | 469 | } |
| 475 | 470 | } |
@@ -711,8 +706,7 @@ discard block |
||
| 711 | 706 | ); |
| 712 | 707 | return $form; |
| 713 | 708 | } |
| 714 | - } |
|
| 715 | - elseif ($op == 'insert' || $op == 'update') { |
|
| 709 | + } elseif ($op == 'insert' || $op == 'update') { |
|
| 716 | 710 | if (isset($edit['wysiwyg_status'])) { |
| 717 | 711 | db_query("DELETE FROM {wysiwyg_user} WHERE uid = %d", $account->uid); |
| 718 | 712 | foreach ($edit['wysiwyg_status'] as $format => $status) { |
@@ -745,8 +739,7 @@ discard block |
||
| 745 | 739 | |
| 746 | 740 | if (!empty($profile->settings['user_choose']) && isset($account->wysiwyg_status[$profile->format])) { |
| 747 | 741 | $status = $account->wysiwyg_status[$profile->format]; |
| 748 | - } |
|
| 749 | - else { |
|
| 742 | + } else { |
|
| 750 | 743 | $status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE; |
| 751 | 744 | } |
| 752 | 745 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | function wysiwyg_theme() { |
| 62 | 62 | return array( |
| 63 | 63 | 'wysiwyg_profile_overview' => array( |
| 64 | - 'arguments' => array('form' => NULL), |
|
| 64 | + 'arguments' => array('form' => null), |
|
| 65 | 65 | ), |
| 66 | 66 | 'wysiwyg_admin_button_table' => array( |
| 67 | - 'arguments' => array('form' => NULL), |
|
| 67 | + 'arguments' => array('form' => null), |
|
| 68 | 68 | ), |
| 69 | 69 | 'wysiwyg_dialog_page' => array( |
| 70 | - 'arguments' => array('content' => NULL, 'show_messages' => TRUE), |
|
| 70 | + 'arguments' => array('content' => null, 'show_messages' => true), |
|
| 71 | 71 | 'file' => 'wysiwyg.dialog.inc', |
| 72 | 72 | 'template' => 'wysiwyg-dialog-page', |
| 73 | 73 | ), |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * Clear wysiwyg cache on admin/build/modules form. |
| 90 | 90 | */ |
| 91 | 91 | function wysiwyg_form_system_modules_alter(&$form, $form_state) { |
| 92 | - wysiwyg_profile_load_all(TRUE); |
|
| 92 | + wysiwyg_profile_load_all(true); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | // guidelines, stored in the child 'format'. |
| 167 | 167 | $formats = element_children($element); |
| 168 | 168 | array_pop($formats); |
| 169 | - if (($key = array_search('format', $formats)) !== FALSE) { |
|
| 169 | + if (($key = array_search('format', $formats)) !== false) { |
|
| 170 | 170 | unset($formats[$key]); |
| 171 | 171 | } |
| 172 | 172 | foreach ($formats as $format) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // Fetch the profile associated to this input format. |
| 178 | 178 | $profile = wysiwyg_get_profile($format); |
| 179 | 179 | if ($profile) { |
| 180 | - $loaded = TRUE; |
|
| 180 | + $loaded = true; |
|
| 181 | 181 | $editor = $profile->editor; |
| 182 | 182 | $status = (int) wysiwyg_user_get_status($profile); |
| 183 | 183 | if (isset($profile->settings['show_toggle'])) { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // If we loaded at least one editor, then the 'none' editor will |
| 212 | 212 | // handle resizable textareas instead of core. |
| 213 | 213 | if (isset($loaded) && !empty($field['#resizable'])) { |
| 214 | - $field['#resizable'] = FALSE; |
|
| 214 | + $field['#resizable'] = false; |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | // If this element is 'format', do not recurse further. |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | return $profile; |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | - return FALSE; |
|
| 247 | + return false; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | foreach ($files as $file => $options) { |
| 284 | 284 | if (is_array($options)) { |
| 285 | - $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); |
|
| 285 | + $options += array('type' => 'module', 'scope' => 'header', 'defer' => false, 'cache' => true, 'preprocess' => true); |
|
| 286 | 286 | drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); |
| 287 | 287 | } |
| 288 | 288 | else { |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | ))), |
| 322 | 322 | )), 'setting'); |
| 323 | 323 | |
| 324 | - $loaded[$name] = TRUE; |
|
| 324 | + $loaded[$name] = true; |
|
| 325 | 325 | } |
| 326 | 326 | else { |
| 327 | - $loaded[$name] = FALSE; |
|
| 327 | + $loaded[$name] = false; |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | // last. |
| 355 | 355 | drupal_add_js($path . '/wysiwyg.js', 'module', 'footer'); |
| 356 | 356 | |
| 357 | - $settings_added = TRUE; |
|
| 357 | + $settings_added = true; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | return $loaded[$name]; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | if ($config) { |
| 374 | 374 | drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); |
| 375 | 375 | } |
| 376 | - $formats[$profile->format] = TRUE; |
|
| 376 | + $formats[$profile->format] = true; |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | if (isset($processed_formats[$profile->format])) { |
| 412 | 412 | return; |
| 413 | 413 | } |
| 414 | - $processed_formats[$profile->format] = TRUE; |
|
| 414 | + $processed_formats[$profile->format] = true; |
|
| 415 | 415 | |
| 416 | 416 | $editor = wysiwyg_get_editor($profile->editor); |
| 417 | 417 | |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | * An array of theme names, or a single, checked theme name if $selected_theme |
| 499 | 499 | * was given. |
| 500 | 500 | */ |
| 501 | -function wysiwyg_get_editor_themes(&$profile, $selected_theme = NULL) { |
|
| 501 | +function wysiwyg_get_editor_themes(&$profile, $selected_theme = null) { |
|
| 502 | 502 | static $themes = array(); |
| 503 | 503 | |
| 504 | 504 | if (!isset($themes[$profile->editor])) { |
@@ -614,13 +614,13 @@ discard block |
||
| 614 | 614 | $profiles = wysiwyg_profile_load_all(); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - return (isset($profiles[$format]) ? $profiles[$format] : FALSE); |
|
| 617 | + return (isset($profiles[$format]) ? $profiles[$format] : false); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /** |
| 621 | 621 | * Load all profiles. |
| 622 | 622 | */ |
| 623 | -function wysiwyg_profile_load_all($reset = FALSE) { |
|
| 623 | +function wysiwyg_profile_load_all($reset = false) { |
|
| 624 | 624 | static $profiles; |
| 625 | 625 | |
| 626 | 626 | if ($reset || !isset($profiles)) { |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | * Wysiwyg profiles list callback. |
| 664 | 664 | */ |
| 665 | 665 | function wysiwyg_profile_list() { |
| 666 | - $profiles = wysiwyg_profile_load_all(TRUE); |
|
| 666 | + $profiles = wysiwyg_profile_load_all(true); |
|
| 667 | 667 | $filter_formats = filter_formats(); |
| 668 | 668 | $list = array(); |
| 669 | 669 | foreach ($profiles as $profile) { |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | /** |
| 689 | 689 | * Implementation of hook_user(). |
| 690 | 690 | */ |
| 691 | -function wysiwyg_user($op, &$edit, $account, $category = NULL) { |
|
| 691 | +function wysiwyg_user($op, &$edit, $account, $category = null) { |
|
| 692 | 692 | if ($op == 'form' && $category == 'account') { |
| 693 | 693 | $user_formats = filter_formats(); |
| 694 | 694 | $options = array(); |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | -function wysiwyg_user_get_status($profile, $account = NULL) { |
|
| 729 | +function wysiwyg_user_get_status($profile, $account = null) { |
|
| 730 | 730 | global $user; |
| 731 | 731 | |
| 732 | 732 | if (!isset($account)) { |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $status = $account->wysiwyg_status[$profile->format]; |
| 748 | 748 | } |
| 749 | 749 | else { |
| 750 | - $status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE; |
|
| 750 | + $status = isset($profile->settings['default']) ? $profile->settings['default'] : true; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | return (bool) $status; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | */ |
| 774 | 774 | function wysiwyg_get_editor($name) { |
| 775 | 775 | $editors = wysiwyg_get_all_editors(); |
| 776 | - return isset($editors[$name]) && $editors[$name]['installed'] ? $editors[$name] : FALSE; |
|
| 776 | + return isset($editors[$name]) && $editors[$name]['installed'] ? $editors[$name] : false; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
@@ -796,11 +796,11 @@ discard block |
||
| 796 | 796 | 'editor path' => wysiwyg_get_path($editors[$editor]['name']), |
| 797 | 797 | 'library path' => wysiwyg_get_path($editors[$editor]['name']), |
| 798 | 798 | 'libraries' => array(), |
| 799 | - 'version callback' => NULL, |
|
| 800 | - 'themes callback' => NULL, |
|
| 801 | - 'settings callback' => NULL, |
|
| 802 | - 'plugin callback' => NULL, |
|
| 803 | - 'plugin settings callback' => NULL, |
|
| 799 | + 'version callback' => null, |
|
| 800 | + 'themes callback' => null, |
|
| 801 | + 'settings callback' => null, |
|
| 802 | + 'plugin callback' => null, |
|
| 803 | + 'plugin settings callback' => null, |
|
| 804 | 804 | 'versions' => array(), |
| 805 | 805 | 'js path' => $editors[$editor]['path'] . '/js', |
| 806 | 806 | 'css path' => $editors[$editor]['path'] . '/css', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | } |
| 816 | 816 | if (empty($editors[$editor]['installed version'])) { |
| 817 | 817 | $editors[$editor]['error'] = t('The version of %editor could not be detected.', array('%editor' => $properties['title'])); |
| 818 | - $editors[$editor]['installed'] = FALSE; |
|
| 818 | + $editors[$editor]['installed'] = false; |
|
| 819 | 819 | continue; |
| 820 | 820 | } |
| 821 | 821 | // Determine to which supported version the installed version maps. |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | } |
| 829 | 829 | if (!$version) { |
| 830 | 830 | $editors[$editor]['error'] = t('The installed version %version of %editor is not supported.', array('%version' => $editors[$editor]['installed version'], '%editor' => $editors[$editor]['title'])); |
| 831 | - $editors[$editor]['installed'] = FALSE; |
|
| 831 | + $editors[$editor]['installed'] = false; |
|
| 832 | 832 | continue; |
| 833 | 833 | } |
| 834 | 834 | // Apply library version specific definitions and overrides. |
@@ -863,8 +863,8 @@ discard block |
||
| 863 | 863 | 'icon file' => $plugin['name'] . '.png', |
| 864 | 864 | 'dialog path' => $plugin['name'], |
| 865 | 865 | 'dialog settings' => array(), |
| 866 | - 'settings callback' => NULL, |
|
| 867 | - 'settings form callback' => NULL, |
|
| 866 | + 'settings callback' => null, |
|
| 867 | + 'settings form callback' => null, |
|
| 868 | 868 | ); |
| 869 | 869 | // Fill in default settings. |
| 870 | 870 | $plugin['settings'] += array( |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * |
| 891 | 891 | * @see wysiwyg_get_directories(), _wysiwyg_process_include() |
| 892 | 892 | */ |
| 893 | -function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = NULL) { |
|
| 893 | +function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = null) { |
|
| 894 | 894 | // Determine implementations. |
| 895 | 895 | $directories = wysiwyg_get_directories($type); |
| 896 | 896 | $directories['wysiwyg'] = drupal_get_path('module', 'wysiwyg') . '/' . $type; |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | * |
| 927 | 927 | * @ingroup libraries |
| 928 | 928 | */ |
| 929 | -function wysiwyg_get_path($library, $base_path = FALSE) { |
|
| 929 | +function wysiwyg_get_path($library, $base_path = false) { |
|
| 930 | 930 | static $libraries; |
| 931 | 931 | |
| 932 | 932 | if (!isset($libraries)) { |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | $nomask = array('CVS'); |
| 998 | 998 | foreach ($searchdir as $dir) { |
| 999 | 999 | if (is_dir($dir) && $handle = opendir($dir)) { |
| 1000 | - while (FALSE !== ($file = readdir($handle))) { |
|
| 1000 | + while (false !== ($file = readdir($handle))) { |
|
| 1001 | 1001 | if (!in_array($file, $nomask) && $file[0] != '.') { |
| 1002 | 1002 | if (is_dir("$dir/$file")) { |
| 1003 | 1003 | $directories[$file] = "$dir/$file"; |
@@ -1047,11 +1047,11 @@ discard block |
||
| 1047 | 1047 | function _wysiwyg_process_include($module, $identifier, $path, $hook) { |
| 1048 | 1048 | $function = $identifier . '_' . $hook; |
| 1049 | 1049 | if (!function_exists($function)) { |
| 1050 | - return NULL; |
|
| 1050 | + return null; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | $result = $function(); |
| 1053 | 1053 | if (!isset($result) || !is_array($result)) { |
| 1054 | - return NULL; |
|
| 1054 | + return null; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | // Fill in defaults. |
@@ -52,6 +52,9 @@ |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | +/** |
|
| 56 | + * @param string $path |
|
| 57 | + */ |
|
| 55 | 58 | function akismet_request($request, $host, $path, $port = 80) { |
| 56 | 59 | $http_request = "POST $path HTTP/1.0\r\n"; |
| 57 | 60 | $http_request .= "Host: $host\r\n"; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $master_url_enc = urlencode($master_url); |
| 28 | 28 | $response = akismet_request("key=$key&blog=$master_url_enc", "rest.akismet.com", "/1.1/verify-key"); |
| 29 | - if ("valid" == $response[1] ) { |
|
| 29 | + if ("valid" == $response[1]) { |
|
| 30 | 30 | $post = urlencode($post); |
| 31 | 31 | $ip = urlencode($_SERVER['REMOTE_ADDR']); |
| 32 | 32 | $referrer = urlencode($_SERVER['HTTP_REFERER']); |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | $http_request = "POST $path HTTP/1.0\r\n"; |
| 57 | 57 | $http_request .= "Host: $host\r\n"; |
| 58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
| 59 | - $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |
|
| 59 | + $http_request .= "Content-Length: ".strlen($request)."\r\n"; |
|
| 60 | 60 | $http_request .= "User-Agent: BOINC | Akismet 1.1\r\n"; |
| 61 | 61 | $http_request .= "\r\n"; |
| 62 | 62 | $http_request .= $request; |
| 63 | 63 | |
| 64 | 64 | $response = ''; |
| 65 | - if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
|
| 65 | + if (false !== ($fs = @fsockopen($host, $port, $errno, $errstr, 3))) { |
|
| 66 | 66 | fwrite($fs, $http_request); |
| 67 | - while ( !feof($fs) ) |
|
| 67 | + while (!feof($fs)) |
|
| 68 | 68 | $response .= fgets($fs, 1160); // One TCP-IP packet |
| 69 | 69 | fclose($fs); |
| 70 | 70 | $response = explode("\r\n\r\n", $response, 2); |
@@ -42,7 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $response = akismet_request($request, "$key.rest.akismet.com", "/1.1/comment-check"); |
| 44 | 44 | |
| 45 | - if ("true" == $response[1]) { // Akismet says it's spam |
|
| 45 | + if ("true" == $response[1]) { |
|
| 46 | +// Akismet says it's spam |
|
| 46 | 47 | return false; |
| 47 | 48 | } else { |
| 48 | 49 | return true; |
@@ -64,8 +65,10 @@ discard block |
||
| 64 | 65 | $response = ''; |
| 65 | 66 | if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
| 66 | 67 | fwrite($fs, $http_request); |
| 67 | - while ( !feof($fs) ) |
|
| 68 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
| 68 | + while ( !feof($fs) ) { |
|
| 69 | + $response .= fgets($fs, 1160); |
|
| 70 | + } |
|
| 71 | + // One TCP-IP packet |
|
| 69 | 72 | fclose($fs); |
| 70 | 73 | $response = explode("\r\n\r\n", $response, 2); |
| 71 | 74 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | function akismet_request($request, $host, $path, $port = 80) { |
| 56 | - $http_request = "POST $path HTTP/1.0\r\n"; |
|
| 56 | + $http_request = "post $path HTTP/1.0\r\n"; |
|
| 57 | 57 | $http_request .= "Host: $host\r\n"; |
| 58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
| 59 | 59 | $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |
@@ -246,6 +246,9 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | +/** |
|
| 250 | + * @param string $n |
|
| 251 | + */ |
|
| 249 | 252 | function name($n) { |
| 250 | 253 | return array('name', $n); |
| 251 | 254 | } |
@@ -254,10 +257,16 @@ discard block |
||
| 254 | 257 | return array('title', $n); |
| 255 | 258 | } |
| 256 | 259 | |
| 260 | +/** |
|
| 261 | + * @param integer $n |
|
| 262 | + */ |
|
| 257 | 263 | function number($n) { |
| 258 | 264 | return array('number', $n); |
| 259 | 265 | } |
| 260 | 266 | |
| 267 | +/** |
|
| 268 | + * @param string $n |
|
| 269 | + */ |
|
| 261 | 270 | function filename($n) { |
| 262 | 271 | return array('filename', $n); |
| 263 | 272 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | public $title; |
| 31 | 31 | // Optional; used when showing course history outline. |
| 32 | 32 | public $is_item; |
| 33 | - public $attrs; // course-defined |
|
| 33 | + public $attrs; // course-defined |
|
| 34 | 34 | |
| 35 | 35 | abstract function walk(&$iter, $incr, &$frac_done); |
| 36 | 36 | // multi-purpose function for traversing a course. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->query_string = null; |
| 56 | 56 | } else { |
| 57 | 57 | $this->filename = substr($filename, 0, $p); |
| 58 | - $this->query_string = substr($filename, $p+1); |
|
| 58 | + $this->query_string = substr($filename, $p + 1); |
|
| 59 | 59 | } |
| 60 | 60 | $this->name = $filename; |
| 61 | 61 | $this->title = $title; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // look up unit by name |
| 163 | 163 | // |
| 164 | 164 | $child = null; |
| 165 | - for ($i=0; $i<$n; $i++) { |
|
| 165 | + for ($i = 0; $i < $n; $i++) { |
|
| 166 | 166 | $c = $this->units[$i]; |
| 167 | 167 | if ($c->name == $child_name) { |
| 168 | 168 | $child = $c; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if ($i >= $n) { |
| 178 | 178 | // and if index is too big, use last unit |
| 179 | 179 | // |
| 180 | - $i = $n-1; |
|
| 180 | + $i = $n - 1; |
|
| 181 | 181 | } |
| 182 | 182 | $child = $this->units[$i]; |
| 183 | 183 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $this->finished($iter); |
| 198 | 198 | return true; |
| 199 | 199 | } else { |
| 200 | - $i = ($i+1)%$n; |
|
| 200 | + $i = ($i + 1)%$n; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | if (array_key_exists($this->name, $state)) { |
| 236 | 236 | $state_rec = $state[$this->name]; |
| 237 | 237 | $child_name = $state_rec['child_name']; |
| 238 | - foreach($this->units as $c) { |
|
| 238 | + foreach ($this->units as $c) { |
|
| 239 | 239 | if ($c->name == $child_name) { |
| 240 | 240 | return $c; |
| 241 | 241 | } |