[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/yui_editor/plugins/ -> img_browser.inc (source)

   1  <?php
   2  /**
   3   * YUI Editor Image Browser Plugin - using IMCE
   4   *
   5   * @author Dave Hall <info@davehall.com.au>
   6   * @license GNU General Public License v2 (or later) http://www.gnu.org/licenses/gpl-2.0.html
   7   */
   8  
   9  /**
  10   * Rendering hook
  11   *
  12   * @internal just adds some JS to the template - if IMCE is installed and available to the user
  13   *
  14   * @param array $profile Current user's profile data
  15   *
  16   * @return void
  17   */
  18  function yui_editor_img_browser_render(&$profile) {
  19    $has_access = module_exists('imce') && function_exists('imce_access') && imce_access();
  20    $profile['img_browser'] = ($has_access ? $profile['img_browser'] : 0);
  21    if ($profile['img_browser'] == 1) {
  22      drupal_add_js(drupal_get_path("module", "yui_editor")."/plugins/img_browser.js", 'module', 'footer');
  23    }
  24  }
  25  
  26  /**
  27   * Settings hook to allow the inclusion IMCE
  28   *
  29   * @internal only rendered if IMCE is installed
  30   *
  31   * @param object $form the form being editted
  32   * @param object $profile The current user's profile data
  33   *
  34   * @return void
  35   */
  36  function yui_editor_img_browser_settings(&$form, &$profile) {
  37    if ( !module_exists('imce') ) {
  38      return;
  39    }
  40  
  41    $form['plugins']['img_browser'] = array(
  42      '#type' => 'checkbox',
  43      '#title' => t('Image Browser'),
  44      '#default_value' => $profile['img_browser'],
  45      '#description' => t('Allow users to browse images directly from the editor for insertion into the editor. Note: IMCE module must be installed and configured for this to work. Works only with YUI 2.5.x at present.'));
  46  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7