ckeditor.api.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * CKEditor - The text editor for the Internet - http://ckeditor.com
  4. * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses of your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * @file
  23. * CKEditor Module for Drupal 7.x
  24. *
  25. * This module allows Drupal to replace textarea fields with CKEditor.
  26. *
  27. * CKEditor is an online rich text editor that can be embedded inside web pages.
  28. * It is a WYSIWYG (What You See Is What You Get) editor which means that the
  29. * text edited in it looks as similar as possible to the results end users will
  30. * see after the document gets published. It brings to the Web popular editing
  31. * features found in desktop word processors such as Microsoft Word and
  32. * OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
  33. * kind of installation on the client computer.
  34. */
  35. /**
  36. * Hook to register the CKEditor plugin - it would appear in the plugins list on the profile setting page.
  37. */
  38. function hook_ckeditor_plugin() {
  39. return array(
  40. 'plugin_name' => array(
  41. // Name of the plugin used to write it.
  42. 'name' => 'plugin_name',
  43. // Description of the plugin - it would be displayed in the plugins management section of profile settings.
  44. 'desc' => t('Plugin description'),
  45. // The full path to the CKEditor plugins directory, with the trailing slash.
  46. 'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
  47. 'buttons' => array(
  48. 'button_name' => array(
  49. 'icon' => 'path to button icon',
  50. 'label' => 'Button Label',
  51. )
  52. )
  53. )
  54. );
  55. }
  56. /**
  57. * Hook to register the CKEditor security filter - it would appear in the security filters list on the profile setting page.
  58. */
  59. function hook_ckeditor_security_filter() {
  60. return array(
  61. 'security_filter_name' => array(
  62. // Title of the security filter - it would be displayed in the security filters section of profile settings.
  63. 'title' => t('Security filter title'),
  64. // Description of the security filter - it would be displayed in the security filters section of profile settings.
  65. 'description' => t('Security filter description'),
  66. )
  67. );
  68. }
  69. /**
  70. * Hook to alter CKEditor security filters.
  71. */
  72. function hook_ckeditor_security_filter_alter(&$security_filters) {
  73. // Modify a $security_filter.
  74. }
  75. /**
  76. * Hook to extend/change the ckeditor settings.
  77. *
  78. * This hook is invoked from ckeditor_profile_settings_compile(). The settings
  79. * may be customized or enhanced; typically with options that cannot be
  80. * controlled though the administrative UI from the ckeditor module.
  81. *
  82. * @param $settings
  83. * An associative array of settings.
  84. * @param $conf
  85. * An associative array with access to raw profile settings that might be helpful to alter the real $settings.
  86. */
  87. function hook_ckeditor_settings_alter(&$settings, $conf) {
  88. // Change the ckeditor config path.
  89. $settings['customConfig'] = drupal_get_path('module', 'ckeditor') . '/ckeditor.config.js';
  90. }
  91. /**
  92. * Hook that allows to alter the user default settings.
  93. *
  94. * @param $settings
  95. * An associative array of settings.
  96. */
  97. function hook_ckeditor_default_settings_alter(&$settings) {
  98. $settings['show_toggle'] = 'f';
  99. }
  100. /**
  101. * Hook to extend CKEditor security allowed tags list.
  102. *
  103. * This hook is invoked from ckeditor_filter_xss() where text is filtered from potentially insecure tags.
  104. */
  105. function hook_ckeditor_filter_xss_allowed_tags() {
  106. // Return an array of additional allowed tags
  107. }