You are here

function tinybrowser_wysiwyg_plugin in TinyBrowser 7

Implements hook_wysiwyg_plugin().

File

./tinybrowser.module, line 102

Code

function tinybrowser_wysiwyg_plugin($editor, $version) {
  static $integrated = array();
  switch ($editor) {
    case 'tinymce':
      if (!tinybrowser_access()) {
        return;
      }
      if (!isset($integrated[$editor])) {
        $integrated[$editor] = TRUE;
        tinybrowser_set_js_variables();
        drupal_add_js(drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tb_tinymce.js');
        $_SESSION['tinybrowser_module'] = TRUE;
      }
      return array(
        'tinybrowser' => array(
          'extensions' => array(
            'tinybrowser' => t('TinyBrowser'),
          ),
          'url' => 'http://www.lunarvis.com/products/tinymcefilebrowserwithupload.php',
          'options' => array(
            'file_browser_callback' => 'tinyBrowser',
            'inline_styles' => TRUE,
            'accessibility_warnings' => FALSE,
          ),
          'load' => FALSE,
        ),
      );
      break;
    case 'fckeditor':
      if (!tinybrowser_access()) {
        return;
      }
      if (!isset($integrated[$editor])) {
        $integrated[$editor] = TRUE;
        tinybrowser_set_js_variables();
        drupal_add_js(drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tb_tinymce.js');
        $_SESSION['tinybrowser_module'] = TRUE;
      }
      $win_width = tinybrowser_get_window_width();
      $win_height = tinybrowser_get_window_height();
      return array(
        'tinybrowser' => array(
          'extensions' => array(
            'tinybrowser' => t('TinyBrowser'),
          ),
          'url' => 'http://www.lunarvis.com/products/tinymcefilebrowserwithupload.php',
          'options' => array(
            'LinkBrowser' => TRUE,
            'ImageBrowser' => TRUE,
            'FlashBrowser' => TRUE,
            'LinkBrowserURL' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=file',
            'ImageBrowserURL' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=image',
            'FlashBrowserURL' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=media',
            'LinkBrowserWindowWidth' => $win_width,
            'LinkBrowserWindowHeight' => $win_height,
            'ImageBrowserWindowWidth' => $win_width,
            'ImageBrowserWindowHeight' => $win_height,
            'FlashBrowserWindowWidth' => $win_width,
            'FlashBrowserWindowHeight' => $win_height,
          ),
          'load' => FALSE,
        ),
      );
      break;
    case 'ckeditor':
      if (!tinybrowser_access()) {
        return;
      }
      if (!isset($integrated[$editor])) {
        $integrated[$editor] = TRUE;
        tinybrowser_set_js_variables();
        drupal_add_js(drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tb_tinymce.js');
        $_SESSION['tinybrowser_module'] = TRUE;
      }
      $win_width = tinybrowser_get_window_width();
      $win_height = tinybrowser_get_window_height();
      return array(
        'tinybrowser' => array(
          'extensions' => array(
            'tinybrowser' => t('TinyBrowser'),
          ),
          'url' => 'http://www.lunarvis.com/products/tinymcefilebrowserwithupload.php',
          'options' => array(
            'filebrowserBrowseUrl' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=file',
            'filebrowserImageBrowseUrl' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=image',
            'filebrowserFlashBrowseUrl' => base_path() . drupal_get_path('module', 'tinybrowser') . '/tinybrowser/tinybrowser.php?type=media',
            'filebrowserWindowWidth' => $win_width + 15,
            'filebrowserWindowHeight' => $win_height + 15,
            'filebrowserImageWindowWidth' => $win_width + 15,
            'filebrowserImageWindowHeight' => $win_height + 15,
            'filebrowserFlashWindowWidth' => $win_width + 15,
            'filebrowserFlashWindowHeight' => $win_height + 15,
          ),
          'load' => FALSE,
        ),
      );
      break;
  }
}