function tinymce_init

7.x tinymce.module tinymce_init()
6.x tinymce.module tinymce_init()
4.x tinymce.module tinymce_init()
5.x tinymce.module tinymce_init()

File

modules/tinymce/tinymce.module, line 9
The TinyMCE module will init TinyMCE (the editor) on appropriate pages. This module is primarily for managing what those pages are.

Code

function tinymce_init() {

  $bool_activate = FALSE;

  $include_paths = explode("\n", variable_get("tinymce_include_on_paths", ""));
  $include_paths = array_map("trim", $include_paths);

  // Wildcards are allowed at the END of the path.
  // So, "content/edit*"  would be OK.  We need to go through
  // our paths and look at this.
  foreach ($include_paths as $ipath) {

    if ($ipath == "") {
      continue;
    }

    if ($ipath == @$_REQUEST ["q"]) {
      $bool_activate = TRUE;
      break;
    }

    // Contains a wildcard!  So, is the ipath partially in the request?
    if (strstr($ipath, "*")) {
      $ipath = str_replace("*", "", $ipath);
      if (substr(@$_REQUEST ["q"], 0, strlen($ipath)) == $ipath) {
        $bool_activate = TRUE;
        break;
      }
    }

  }



  if ($bool_activate) {
    fp_add_js(array("tinymceModulePath" => fp_get_module_path("tinymce")), "setting");

    $toolbar = variable_get("tinymce_toolbar", "bold italic underline | cut copy paste | undo redo | alignleft aligncenter | bullist numlist outdent indent | link unlink | removeformat");

    fp_add_js(array("tinymceToolbar" => $toolbar), "setting");

    fp_add_js(fp_get_module_path("tinymce") . "/lib/tinymce/js/tinymce/tinymce.min.js");

    fp_add_js(fp_get_module_path("tinymce") . "/js/tinymce_module.js");

    // Set to TRUE for pages where tinymce is in use.
    $GLOBALS ["tinymce_active"] = TRUE;
  }

}