tinymce.module

  1. 7.x modules/tinymce/tinymce.module
  2. 6.x modules/tinymce/tinymce.module
  3. 4.x modules/tinymce/tinymce.module
  4. 5.x modules/tinymce/tinymce.module

The TinyMCE module will init TinyMCE (the editor) on appropriate pages. This module is primarily for managing what those pages are.

File

modules/tinymce/tinymce.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * The TinyMCE module will init TinyMCE (the editor) on appropriate pages. This module
  5. * is primarily for managing what those pages are.
  6. */
  7. function tinymce_init() {
  8. $bool_activate = FALSE;
  9. $include_paths = explode("\n", variable_get("tinymce_include_on_paths", ""));
  10. $include_paths = array_map("trim", $include_paths);
  11. // Wildcards are allowed at the END of the path.
  12. // So, "content/edit*" would be OK. We need to go through
  13. // our paths and look at this.
  14. foreach($include_paths as $ipath) {
  15. if ($ipath == "") continue;
  16. if ($ipath == $_REQUEST["q"]) {
  17. $bool_activate = TRUE;
  18. break;
  19. }
  20. // Contains a wildcard! So, is the ipath partially in the request?
  21. if (strstr($ipath, "*")) {
  22. $ipath = str_replace("*", "", $ipath);
  23. if (substr($_REQUEST["q"], 0, strlen($ipath)) == $ipath) {
  24. $bool_activate = TRUE;
  25. break;
  26. }
  27. }
  28. }
  29. if ($bool_activate) {
  30. fp_add_js(array("tinymceModulePath" => fp_get_module_path("tinymce")), "setting");
  31. fp_add_js(fp_get_module_path("tinymce") . "/inc/tiny_mce/tiny_mce.js");
  32. fp_add_js(fp_get_module_path("tinymce") . "/js/tinymce_module.js");
  33. // Set to TRUE for pages where tinymce is in use.
  34. $GLOBALS["tinymce_active"] = TRUE;
  35. }
  36. }
  37. /**
  38. * Implementation of hook_menu
  39. */
  40. function tinymce_menu() {
  41. $items = array();
  42. $items["admin/config/tinymce"] = array(
  43. "title" => "TinyMCE Settings",
  44. "description" => "Administer settings for the TinyMCE WYSIWYG editor",
  45. "page_callback" => "fp_render_form",
  46. "page_arguments" => array("tinymce_config_form", "system_settings"),
  47. "access_arguments" => array("administer_tinymce"),
  48. "page_settings" => array(
  49. "page_has_search" => FALSE,
  50. "page_banner_is_link" => TRUE,
  51. "page_hide_report_error" => TRUE,
  52. "menu_links" => array(
  53. 0 => array(
  54. "text" => "Back to main menu",
  55. "path" => "admin-tools/admin",
  56. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  57. ),
  58. ),
  59. ),
  60. "type" => MENU_TYPE_NORMAL_ITEM,
  61. "tab_parent" => "admin-tools/admin",
  62. );
  63. return $items;
  64. }
  65. function tinymce_config_form() {
  66. $form = array();
  67. $form["tinymce_include_on_paths"] = array(
  68. "label" => t("Include on paths:"),
  69. "type" => "textarea",
  70. "value" => variable_get("tinymce_include_on_paths", ""),
  71. "description" => t("Enter FlightPath paths, one per line, where
  72. the TinyMCE plugin should be included.
  73. Ex: comments
  74. <br>
  75. Wildcards are also allowed at the END of the path only.
  76. Ex: content/* "),
  77. );
  78. return $form;
  79. }
  80. function tinymce_perm() {
  81. return array(
  82. "administer_tinymce" => array(
  83. "title" => t("Administer TinyMCE"),
  84. "description" => t("Configure the TinyMCE module."),
  85. ),
  86. );
  87. }
  88. /**
  89. * Implementation of hook_form_alter
  90. */
  91. function tinymce_form_alter(&$form, $form_id) {
  92. // if tinymce is active, add instrcutions under the textareas.
  93. if ($GLOBALS["tinymce_active"]) {
  94. fp_add_css(fp_get_module_path("tinymce") . "/css/tinymce.css");
  95. foreach($form as $key=>$val) {
  96. if ($form[$key]["type"] == "textarea") {
  97. $form[$key]["description"] .= "<div class='tinymce-extra-instructions'>
  98. " . t("Trouble with Copy/Paste? Try keyboard
  99. shortcuts CTRL-C and CTRL-V. To single-space, press CTRL-ENTER.") . "</div>";
  100. }
  101. }
  102. }
  103. }

Functions

Namesort descending Description
tinymce_config_form
tinymce_form_alter Implementation of hook_form_alter
tinymce_init
tinymce_menu Implementation of hook_menu
tinymce_perm