You are here

function lightbox2_menu in Lightbox2 5.2

Same name and namespace in other branches
  1. 8 lightbox2.module \lightbox2_menu()
  2. 5 lightbox2.module \lightbox2_menu()
  3. 6 lightbox2.module \lightbox2_menu()
  4. 7.2 lightbox2.module \lightbox2_menu()
  5. 7 lightbox2.module \lightbox2_menu()

Implementation of hook_menu().

File

./lightbox2.module, line 210
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'system/lightbox2/filter-xss',
      'title' => t('Filter XSS'),
      'callback' => 'lightbox2_filter_xss',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/lightbox2',
      'title' => t('Lightbox2'),
      'callback' => 'lightbox2_settings_page',
      'access' => user_access('administer lightbox2'),
      'description' => t('Allows the user to configure the lightbox2 settings'),
    );
    $items[] = array(
      'path' => 'admin/settings/lightbox2/general',
      'title' => t('General'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'lightbox2_general_settings_form',
      ),
      'access' => user_access('administer lightbox2'),
      'description' => t('Allows the user to configure the lightbox2 settings'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/settings/lightbox2/slideshow',
      'title' => t('Slideshow'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'lightbox2_slideshow_settings_form',
      ),
      'access' => user_access('administer lightbox2'),
      'description' => t('Allows the user to configure the lightbox2 slideshow functionality.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/settings/lightbox2/html_content',
      'title' => t('HTML Content'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'lightbox2_iframe_settings_form',
      ),
      'access' => user_access('administer lightbox2'),
      'description' => t('Allows the user to configure the lightbox2 HTML content functionality.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/settings/lightbox2/automatic',
      'title' => t('Automatic image handling'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'lightbox2_auto_image_handling_settings_form',
      ),
      'access' => user_access('administer lightbox2'),
      'description' => t('Allows the user to configure the lightbox2 automatic image handling settings'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 3,
    );
    if (module_exists('emfield') && module_exists('video_cck') && arg(0) == 'video-cck' && arg(1) == 'lightbox2' && is_numeric(arg(2))) {
      $node = node_load(arg(2));
      if ($node->nid) {
        $items[] = array(
          'path' => 'video-cck/lightbox2/' . arg(2),
          'callback' => 'lightbox2_video_cck',
          'callback arguments' => array(
            $node,
          ),
          'access' => node_access('view', $node),
          'type' => MENU_CALLBACK,
        );
      }
    }
    $items[] = array(
      'path' => 'user/login/lightbox2',
      'title' => t('Login'),
      'callback' => 'lightbox2_login',
      'access' => !$user->uid,
      'type' => MENU_CALLBACK,
    );
    $items['contact/lightbox2'] = array(
      'title' => 'Contact',
      'callback' => 'lightbox2_contact',
      'access' => user_access('access site-wide contact form'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (lightbox2_exclude_these_paths() != 1) {
      lightbox2_add_files();
    }
    if (module_exists('acidfree') && module_exists('video')) {
      if (arg(0) == 'node' && arg(2) == 'lightframevideo' && is_numeric(arg(1))) {
        $node = node_load(arg(1));
        if ($node->nid) {
          $items[] = array(
            'path' => 'node/' . arg(1) . '/lightframevideo',
            'callback' => 'lightbox2_acidfree_video',
            'callback arguments' => array(
              $node,
            ),
            'access' => user_access('play video') && node_access('view', $node),
            'type' => MENU_CALLBACK,
          );
        }
      }
    }
  }
  return $items;
}