Fix for jwysiwyg.inc

Rob Loach's picture
  1. <?php
  2. // $Id$
  3.  
  4.  
  5. /**
  6.  * Plugin implementation of hook_editor().
  7.  */
  8. function wysiwyg_jwysiwyg_editor() {
  9.   $editor = array();
  10.   $editor['jwysiwyg'] = array(
  11.     // Required properties
  12.     'title' => 'jWYSIWYG',
  13.     'vendor url' => 'http://plugins.jquery.com/project/jwysiwyg',
  14.     'download url' => 'http://code.google.com/p/jwysiwyg/downloads/list',
  15.     'library path' => wysiwyg_get_path('jwysiwyg'),
  16.     /*'libraries' => array( // We cannot assume that all editors need just one js library.
  17.       '' => array( // Key may be used in wysiwyg_tinymce_settings() for exec mode.
  18.         'title' => 'Packed',
  19.         'files' => array('jquery.wysiwyg.pack.js'),
  20.       ),
  21.       'src' => array(
  22.         'title' => 'Source',
  23.         'files' => array('jquery.wysiwyg.js'),
  24.       ),
  25.     ),*/
  26.     'version callback' => 'wysiwyg_jwysiwyg_version',
  27.     //'themes callback' => 'wysiwyg_jwysiwyg_themes',
  28.     //'settings callback' => 'wysiwyg_jwysiwyg_settings',
  29.     //'plugin callback' => 'wysiwyg_jwysiwyg_plugins',
  30.     //'plugin settings callback' => 'wysiwyg_jwysiwyg_plugin_settings',
  31.     'versions' => array( // Each version can override global editor properties.
  32.       '0.4' => array(
  33.         'download url' => 'http://code.google.com/p/jwysiwyg/downloads/detail?name=jwysiwyg-0.4.zip&can=2&q=',
  34.         // 'include files' => array('tinymce-3.inc'),
  35.         'js files' => array('jquery.wysiwyg.pack.js'),
  36.         'css files' => array('jquery.jwysiwyg.css'),
  37.         // 'plugin callback' => 'wysiwyg_tinymce_3_plugins',
  38.         'libraries' => array(
  39.           '' => array(
  40.             'title' => 'Packed',
  41.             'files' => array('jquery.jwysiwyg.pack.js'),
  42.           ),
  43.           'src' => array(
  44.             'title' => 'jQuery',
  45.             'files' => array('jquery.jwysiwyg.js'),
  46.           ),
  47.         ),
  48.       ),
  49.     ),
  50.     // Optional properties
  51.     //'editor path' => wysiwyg_get_path('aaa'), // Assumed by default.
  52.     //'js path' => wysiwyg_get_path('jwysiwyg'), // Assumed by default.
  53.     //'css path' => wysiwyg_get_path('editors/jwysiwyg'), // Assumed by default.
  54.   );
  55.   return $editor;
  56. }
  57.  
  58. /**
  59.  * Detect editor version.
  60.  *
  61.  * @param $editor
  62.  *   An array containing editor properties as returned from hook_editor().
  63.  *
  64.  * @return
  65.  *   The installed editor version.
  66.  */
  67. function wysiwyg_jwysiwyg_version($editor) {
  68.   $data = file_get_contents(wysiwyg_get_path('jwysiwyg/jquery.wysiwyg.js'), FILE_USE_INCLUDE_PATH, NULL, 0, 100);
  69.   if (preg_match('/plugin\s*([0-9\.]+)/', $data, $version)) {
  70.     return $version[1];
  71.   }
  72. }
  73.  
  74. /**
  75.  * Return runtime editor settings for a given wysiwyg profile.
  76.  *
  77.  * @param $editor
  78.  *   A processed hook_editor() array of editor properties.
  79.  * @param $config
  80.  *   An array containing wysiwyg editor profile settings.
  81.  * @param $theme
  82.  *   The name of a theme/GUI/skin to use.
  83.  *
  84.  * @return
  85.  *   A settings array to be populated in
  86.  *   Drupal.settings.wysiwyg.configs.{editor}
  87.  */
  88. //function wysiwyg_jwysiwyg_settings($editor, $config, $theme) {
  89. //  return array();
  90. //}
  91.  
  92. /**
  93.  * Determine available editor themes or check/reset a given one.
  94.  *
  95.  * @param $editor
  96.  *   A processed hook_editor() array of editor properties.
  97.  * @param $profile
  98.  *   A wysiwyg editor profile.
  99.  *
  100.  * @return
  101.  *   An array of theme names. The first returned name should be the default
  102.  *   theme name.
  103.  */
  104. /*function wysiwyg_tinymce_themes($editor, $profile) {
  105.   return array();
  106. }*/
  107.  
  108. /**
  109.  * Build a JS settings array of external plugins that need to be loaded separately.
  110.  */
  111. /*function wysiwyg_tinymce_plugin_settings($editor, $profile, $plugins) {
  112.   return array();
  113. }*/

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.