Projet

Général

Profil

Révision 6135231a

Ajouté par Assos Assos il y a plus de 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/lightbox2/.gitignore
1 1
#ignore the folder from PhpStorm IDE
2
.idea
2
.idea
3

  
4
#ignore files used by eclipse
5
.buildpath
6
.project
7
.settings
drupal7/sites/all/modules/lightbox2/README.txt
52 52
INSTALLATION
53 53
------------
54 54
1. Copy lightbox2 folder to modules directory.
55
2. At admin/build/modules enable the lightbox2 module.
56
3. Enable permissions at admin/user/permissions.
57
4. Configure the module at admin/settings/lightbox2.
55
2. At admin/modules enable the lightbox2 module.
56
3. Enable permissions at admin/people/permissions.
57
4. Configure the module at admin/config/user-interface/lightbox2.
58 58
5. Modify your image links to open in a lightbox where necessary, see "Adding
59 59
   Lightbox Functionality to your Images' section below.
60 60
6. If you need to play flv files, then you may need to install a FLV player.
drupal7/sites/all/modules/lightbox2/js/lightbox.js
191 191
    if (Lightbox.alternative_layout) {
192 192
      $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'});
193 193
    }
194
    else if (Lightbox.rtl == 1 && $.browser.msie) {
194
    else if (Lightbox.rtl == 1 && Drupal.settings.lightbox2.useragent.search('MSIE') !== -1) {
195 195
      $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'});
196 196
    }
197 197

  
......
517 517
        $('#frameContainer').html('<iframe id="lightboxFrame" style="display: none;" src="'+src+'"></iframe>');
518 518

  
519 519
        // Enable swf support in Gecko browsers.
520
        if ($.browser.mozilla && src.indexOf('.swf') != -1) {
520
        if (Drupal.settings.lightbox2.useragent.search('Mozilla') !== -1 && src.indexOf('.swf') != -1) {
521 521
          setTimeout(function () {
522 522
            document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
523 523
          }, 1000);
......
605 605
    // If new and old image are same size and no scaling transition is necessary
606 606
    // do a quick pause to prevent image flicker.
607 607
    if ((hDiff === 0) && (wDiff === 0)) {
608
      if ($.browser.msie) {
608
      if (Drupal.settings.lightbox2.useragent.search('MSIE') !== -1) {
609 609
        Lightbox.pause(250);
610 610
      }
611 611
      else {
......
629 629
      Lightbox.updateDetails();
630 630
      if (Lightbox.isLightframe) {
631 631
        $('#frameContainer').show();
632
        if ($.browser.safari || Lightbox.fadeInSpeed === 0) {
632
        if (Drupal.settings.lightbox2.useragent.search('Safari') !== -1 || Lightbox.fadeInSpeed === 0) {
633 633
          $('#lightboxFrame').css({'zIndex': '10500'}).show();
634 634
        }
635 635
        else {
......
660 660
    // Handle display of image content.
661 661
    else {
662 662
      $('#imageContainer').show();
663
      if ($.browser.safari || Lightbox.fadeInSpeed === 0) {
663
      if (Drupal.settings.lightbox2.useragent.search('Safari') !== -1 || Lightbox.fadeInSpeed === 0) {
664 664
        $('#lightboxImage').css({'zIndex': '10500'}).show();
665 665
      }
666 666
      else {
......
705 705

  
706 706
    // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as
707 707
    // expected.
708
    if ($.browser.mozilla) {
708
    if (Drupal.settings.lightbox2.useragent.search('Mozilla') !== -1) {
709 709
      if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) {
710 710
        setTimeout(function () {
711 711
          document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
......
927 927
    $("#lightbox2-overlay").fadeOut();
928 928
    Lightbox.isPaused = true;
929 929
    Lightbox.inprogress = false;
930
    Lightbox.imageArray = [];
931
    Lightbox.imageNum = 0;
930 932
    // Replaces calls to showSelectBoxes() and showFlash() in original
931 933
    // lightbox2.
932 934
    Lightbox.toggleSelectsFlash('visible');
......
1160 1162

  
1161 1163
  filterXSS: function(str, allowed_tags) {
1162 1164
    var output = "";
1165
    var prefix = Drupal.settings.pathPrefix;
1166
    if (!prefix) prefix = '';
1163 1167
    $.ajax({
1164
      url: Drupal.settings.basePath + 'system/lightbox2/filter-xss',
1168
      url: Drupal.settings.basePath + prefix + '?q=system/lightbox2/filter-xss',
1165 1169
      data: {
1166 1170
        'string' : str,
1167 1171
        'allowed_tags' : allowed_tags
drupal7/sites/all/modules/lightbox2/js/lightbox_video.js
86 86
      var results = pattern.exec(href);
87 87
      if (results !== null) {
88 88
        Lightbox.videoId = results[1];
89
        var href = "http://www.youtube.com/v/"+Lightbox.videoId;
89
        var href = "//www.youtube.com/embed/"+Lightbox.videoId;
90 90
        var variables = 'fs=1';
91 91
        if (Lightbox.flvFlashvars.length) {
92 92
          variables = variables + '&' + Lightbox.flvFlashvars;
93 93
          href = href + '&' + variables;
94 94
        }
95
        Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
95
        var id = 'flvvideo';
96
        Lightbox.modalHTML = '<iframe ' +
97
          'src="' + href + '" ' +
98
          'id="' + id + '" name="' + id + '" ' +
99
          'height="' + Lightbox.modalHeight + '" ' +
100
          'width="' + Lightbox.modalWidth + '" ' +
101
          'frameborder="0" allowfullscreen' +
102
          '></iframe>';
96 103
        return true;
97 104
      }
98 105
    }
......
102 109
  // checkGoogleVideo()
103 110
  checkGoogleVideo: function(href) {
104 111
    var patterns = [
105
      'http://video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)',
106
      'http://video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&',
107
      'http://video.google.[a-z]{2,4}/videoplay\\?docid=(.*)'
112
      '//video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)',
113
      '//video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&',
114
      '//video.google.[a-z]{2,4}/videoplay\\?docid=(.*)'
108 115
      ];
109 116

  
110 117
    for (var i = 0; i < patterns.length; i++) {
......
112 119
      var results = pattern.exec(href);
113 120
      if (results !== null) {
114 121
        Lightbox.videoId = results[1];
115
        var href = "http://video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en";
122
        var href = "//video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en";
116 123
        var variables = 'fs=true';
117 124
        if (Lightbox.flvFlashvars.length) {
118 125
          variables = variables + '&' + Lightbox.flvFlashvars;
......
138 145
      var results = pattern.exec(href);
139 146
      if (results !== null) {
140 147
        Lightbox.videoId = results[1];
141
        Lightvideo.createEmbed("http://www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff");
148
        Lightvideo.createEmbed("//www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff");
142 149
        return true;
143 150
      }
144 151
    }
......
159 166
      var results = pattern.exec(href);
160 167
      if (results !== null) {
161 168
        Lightbox.videoId = results[1];
162
        Lightvideo.createEmbed("http://www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&amp;");
169
        Lightvideo.createEmbed("//www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&amp;");
163 170
        return true;
164 171
      }
165 172
    }
......
180 187
      var results = pattern.exec(href);
181 188
      if (results !== null) {
182 189
        Lightbox.videoId = results[1];
183
        Lightvideo.createEmbed("http://lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId);
190
        Lightvideo.createEmbed("//lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId);
184 191
        return true;
185 192
      }
186 193
    }
......
200 207
      var results = pattern.exec(href);
201 208
      if (results !== null) {
202 209
        Lightbox.videoId = results[1];
203
        Lightvideo.createEmbed("http://www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff");
210
        Lightvideo.createEmbed("//www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff");
204 211
        return true;
205 212
      }
206 213
    }
......
210 217
};
211 218

  
212 219
//End jQuery block
213
}(jQuery));
220
}(jQuery));
drupal7/sites/all/modules/lightbox2/lightbox2.formatter.inc
27 27
  $image_style = $variables['image_style'];
28 28
  $node_id = $variables['node_id'];
29 29
  $field_name = $variables['field_name'];
30
  $caption = $variables['caption'];
30 31

  
31 32
  if (!$variables["lightbox_style"]) {
32 33
    $path['path'] = file_create_url($item['uri']);
......
66 67
  $rel .= ']';
67 68

  
68 69
  // Title Start
69
  $rel .= '[' . $item['title'];
70
  $rel .= '[';
71

  
72
  switch($caption) {
73
    case 'hidden':
74
        break;
75
    case 'filename':
76
        $rel .= $item['filename'];
77
        break;
78
    case 'title':
79
        $rel .= $item['title'];
80
        break;
81
    default:
82
        $caption_display = array(
83
            'label' => 'hidden',
84
            );
85
        $entity = entity_load('file', array($item['fid']));
86
        $entity = $entity[$item['fid']];
87
        $renderable_field = field_view_field('file', $entity, $caption, $caption_display);
88
        $rel .= drupal_render($renderable_field);
89
        break;
90
  }
70 91

  
71 92
  // Download Link
72 93
  if (user_access('download original image')) {
73
    $rel .= '<p><a href="' . file_create_url($item['uri']) . '">' . variable_get('lightbox2_download_link_text', 'Download Original') . '</a></p>';
94
    $url_download = file_create_url($item['uri']);
95
    $download_original_text = t(variable_get('lightbox2_download_link_text', 'Download Original'));
96
    $options_download = array();
97
    $options_download['attributes']['title'] = $download_original_text;
98
    $options_download['attributes']['download'] = '';
99
    $rel .= '<p>' . l($download_original_text, $url_download, $options_download) . '</p>';
74 100
  }
75 101
  
76 102
  // Title End
......
260 286
    if (!empty($target)) {
261 287
      $attributes['target'] = $target;
262 288
    }
263
    $node_link_text = variable_get('lightbox2_node_link_text', 'View Image Details');
289
    $node_link_text = t(variable_get('lightbox2_node_link_text', 'View Image Details'));
264 290
    if (!$on_image_node && !empty($node_link_text)) {
265 291
      $node_links[] = l($node_link_text, 'node/'. $item['nid'], array('attributes' => $attributes));
266 292
    }
267
    $download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
293
    $download_link_text = check_plain(t(variable_get('lightbox2_download_link_text', 'Download Original')));
268 294
    if (!empty($download_link_text) && user_access('download original image')) {
269 295
      $node_links[] = l($download_link_text, file_create_url($item['filepath']), array('attributes' => array('target' => '_blank', 'id' => 'lightbox2-download-link-text')));
270 296
    }
......
324 350
  }
325 351
  elseif ($view_preset == 'link') {
326 352
    // Not actually an image, just a text link.
327
    $image = variable_get('lightbox2_view_image_text', 'View image');
353
    $image = t(variable_get('lightbox2_view_image_text', 'View image'));
328 354
  }
329 355
  else {
330 356
     $image = theme('imagecache', array( 'style_name' => $view_preset, 'path' => $item['filepath'], 'alt' => $image_tag_alt, 'title' => $image_tag_title, 'attributes' => $attributes ) );
drupal7/sites/all/modules/lightbox2/lightbox2.info
4 4
core = 7.x
5 5
package = User interface
6 6

  
7
dependencies[] = entity
8

  
7 9
files[] = lightbox2.install
8 10
files[] = lightbox2.module
9 11
files[] = lightbox2.formatter.inc
10 12
files[] = lightbox2.admin.inc
13
files[] = lightbox2_handler_field_lightbox2.inc
11 14

  
12 15
configure = admin/config/user-interface/lightbox2
13 16

  
......
18 21

  
19 22

  
20 23

  
21
; Information added by drupal.org packaging script on 2011-10-17
22
version = "7.x-1.0-beta1"
24
; Information added by Drupal.org packaging script on 2018-10-11
25
version = "7.x-1.0-beta2"
23 26
core = "7.x"
24 27
project = "lightbox2"
25
datestamp = "1318819001"
26

  
28
datestamp = "1539260286"
drupal7/sites/all/modules/lightbox2/lightbox2.insert.inc
58 58
  $vars['linkurl'] = insert_create_url($linkpath);
59 59

  
60 60
  $vars['download_link'] = '';
61
  $download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
61
  $download_link_text = check_plain(t(variable_get('lightbox2_download_link_text', 'Download Original')));
62 62
  if (!empty($download_link_text) && user_access('download original image')) {
63 63
    $vars['download_link'] = '<br /><br />' . l($download_link_text, $vars['linkurl'], array('attributes' => array('target' => '_blank', 'id' => 'lightbox2-download-link-text')));
64 64
  }
drupal7/sites/all/modules/lightbox2/lightbox2.module
708 708
    'force_show_nav' => variable_get('lightbox2_force_show_nav', FALSE),
709 709
    'show_caption' => variable_get('lightbox2_show_caption', TRUE),
710 710
    'loop_items' => variable_get('lightbox2_loop_items', FALSE),
711
    'node_link_text' => check_plain(variable_get('lightbox2_node_link_text', 'View Image Details')),
711
    'node_link_text' => check_plain(t(variable_get('lightbox2_node_link_text', 'View Image Details'))),
712 712
    'node_link_target' => variable_get('lightbox2_node_link_target', FALSE),
713
    'image_count' => check_plain(variable_get('lightbox2_image_count_str', 'Image !current of !total')),
714
    'video_count' => check_plain(variable_get('lightbox2_video_count_str', 'Video !current of !total')),
715
    'page_count' => check_plain(variable_get('lightbox2_page_count_str', 'Page !current of !total')),
713
    'image_count' => check_plain(t(variable_get('lightbox2_image_count_str', 'Image !current of !total'))),
714
    'video_count' => check_plain(t(variable_get('lightbox2_video_count_str', 'Video !current of !total'))),
715
    'page_count' => check_plain(t(variable_get('lightbox2_page_count_str', 'Page !current of !total'))),
716 716
    'lite_press_x_close' => t('press !x to close', array('!x' => '<a href="#" onclick="hideLightbox(); return FALSE;"><kbd>x</kbd></a>')),
717 717
    'download_link_text' => '',
718 718
    'enable_login' => $enable_login,
......
749 749
    'iframe_border' => (int)variable_get('lightbox2_frame_border', 1),
750 750
    // Video settings.
751 751
    'enable_video' => $enable_video,
752
    'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
752 753
  );
753 754
  if ($enable_video) {
754 755
    $js_settings['flvPlayer'] = url(check_plain(trim(variable_get('lightbox2_flv_player_path', 'flvplayer.swf'), '/')));
......
757 758

  
758 759
  // Only supply these if the user has the correct permissions.
759 760
  if (user_access('download original image') && user_access('view original images')) {
760
    $js_settings['download_link_text'] = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
761
    $js_settings['download_link_text'] = check_plain(t(variable_get('lightbox2_download_link_text', 'Download Original')));
761 762
  }
762 763

  
763 764
  drupal_add_js(array('lightbox2' => $js_settings), array( 'type' => 'setting' ) );
......
786 787
    }
787 788
    //drupal_add_js($path .'/js/prototype.js', array( 'scope' => $js_location, 'cache' => false ) );
788 789
    //drupal_add_js($path .'/js/scriptaculous.js', array( 'scope' => $js_location, 'cache' => false ) );
789
    drupal_add_js($path . '/js/lightbox.js', array( 'scope' => $js_location , 'cache' => FALSE) );
790
    drupal_add_js($path . '/js/lightbox.js', array( 'scope' => $js_location));
790 791

  
791 792
  }
792 793
  // Lightbox Lite.
......
797 798
  }
798 799
}
799 800

  
801
/**
802
 * Helper function for image styles.
803
 */
804
function lightbox2_image_styles() {
805
  $image_styles=array('0'=>'original');
806
  $tmp=image_styles();
807
  foreach($tmp as $style) {
808
    $image_styles[$style['name']] = $style['name'];
809
  }
810
  return $image_styles;
811
}
812

  
813
/**
814
 * Helper function for possible fields to display as the caption.
815
 */
816
function lightbox2_image_fields() {
817
  $fields = array(
818
    'hidden' => t('Hidden'),
819
    'title' => t('File title'),
820
    'filename' => t('Filename'),
821
  );
822
  foreach(field_info_instances("file", "image") as $field) {
823
    $fields[$field['field_name']] = $field['label'];
824
  }
825
  return $fields;
826
}
827

  
828
/**
829
 * Helper function for possible lightbox styles.
830
 */
831
function lightbox2_lightbox_types() {
832
    return array(
833
      'lightbox' => t('Single lightbox'),
834
      'lightshow' => t('Lightshow'),
835
    );
836
}
837

  
838
/**
839
 * Implements hook_field_formatter_settings_form().
840
 */
841
function lightbox2_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
842
  $display = $instance['display'][$view_mode];
843
  $settings = $display['settings'];
844

  
845
  $form = array();
846

  
847
  $form['type'] = array(
848
    '#title' => t('Lightbox type'),
849
    '#type' => 'select',
850
    '#options' => lightbox2_lightbox_types(),
851
    '#default_value' => $settings['type'],
852
  );
853
  $form['image_style'] = array(
854
    '#title' => t('Image style'),
855
    '#description' => t('The thumbnail to display as a link for the lightbox.'),
856
    '#type' => 'select',
857
    '#options' => lightbox2_image_styles(),
858
    '#default_value' => $settings['image_style'],
859
  );
860
  $form['lightbox_style'] = array(
861
    '#title' => t('Lightbox style'),
862
    '#description' => t('The image style to show inside the lightbox.'),
863
    '#type' => 'select',
864
    '#options' => lightbox2_image_styles(),
865
    '#default_value' => $settings['lightbox_style'],
866
  );
867

  
868
  $form['caption'] = array(
869
    '#title' => t('Caption field'),
870
    '#description' => t('The field to use as a caption.'),
871
    '#type' => 'select',
872
    '#options' => lightbox2_image_fields(),
873
    '#default_value' => $settings['caption'],
874
  );
875

  
876
  return $form;
877
}
878
/**
879
 * Implements hook_field_formatter_settings_summary().
880
 */
881
function lightbox2_field_formatter_settings_summary($field, $instance, $view_mode) {
882
  $display = $instance['display'][$view_mode];
883
  $settings = $display['settings'];
884

  
885
  $image_styles = lightbox2_image_styles();
886
  $fields = lightbox2_image_fields();
887
  $types = lightbox2_lightbox_types();
888

  
889
  $summary = '';
890

  
891
  if(isset($settings['caption']) && isset($settings['type']) && isset($settings['image_style']) && isset($settings['lightbox_style'])) {
892
    $summary .= '<strong>'.t('Caption field') . '</strong>: ' . $fields[$settings['caption']] . '<br/>';
893
    $summary .= '<strong>'.t('Display') . '</strong>: ' ;
894
    $summary .= $types[$settings['type']];
895
    $summary .= ': ';
896
    $summary .= $image_styles[$settings['image_style']];
897
    $summary .= ' => ';
898
    $summary .= $image_styles[$settings['lightbox_style']];
899
  } else {
900
    $summary = 'Title - Lightbox: original => original';
901
  }
902

  
903

  
904
  return $summary;
905
}
906

  
800 907
/**
801 908
 * Implementation of hook_field_formatter_info().
802 909
 *
......
807 914
function lightbox2_field_formatter_info() {
808 915
  $formatters = array();
809 916
  if (module_exists('image')) {
810
    $image = $lightbox = image_styles();
811
    $types = array('lightbox', 'lightshow');
812
    foreach ($types as $type) {
813
      foreach ($image as $image_key => $image_value ) {
814
        $formatters['lightbox2__' . $type . '__' . $image_key . '__original'] = array(
815
          'label' => 'Lightbox2: ' . $type . ': ' . $image_key . '->original',
816
          'field types' => array('image'),
817
        );
818
        foreach ($lightbox as $lightbox_key => $lightbox_value ) {
819
          $formatters['lightbox2__' . $type . '__' . $image_key . "__" . $lightbox_key] = array(
820
            'label' => 'Lightbox2: ' . $type . ': ' . $image_key . '->' . $lightbox_key,
821
            'field types' => array('image'),
822
          );
823
        }
824
      }
825
    }
917
    $formatters['lightbox2'] = array(
918
      'label' => 'Lightbox2',
919
      'field types' => array('image'),
920
      'settings' => array(
921
          'type' => 'lightbox',
922
          'image_style' => 'original',
923
          'lightbox_style' => 'original',
924
          'caption' => 'hidden',
925
      ),
926
    );
826 927
  }
827 928
  return $formatters;
828 929
  /*
......
946 1047
 */
947 1048
function lightbox2_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
948 1049
  $element = array();
949
  $pieces = explode('__', $display['type']);
950
  $lightbox_type = $pieces[1];
951
  $image_style = $pieces[2];
952
  $lightbox_style = $pieces[3];
1050
  $settings = $display["settings"];
1051
  $lightbox_type = $settings['type'];
1052
  $image_style = $settings['image_style'];
1053
  $lightbox_style = $settings['lightbox_style'];
953 1054

  
954 1055
  if ($image_style == 'original') {
955 1056
    $image_style = NULL;
......
958 1059
    $lightbox_style = NULL;
959 1060
  }
960 1061

  
961
  if ($entity_type == 'node') {
962
    $node_id = $entity->nid;
963
  }
1062
  $wrapper = entity_metadata_wrapper($entity_type, $entity);
964 1063

  
965 1064
  foreach ($items as $delta => $item) {
966 1065
    $uri = array(
......
974 1073
      '#image_style' => $image_style,
975 1074
      '#lightbox_style' => $lightbox_style,
976 1075
      '#path' => $uri,
977
      '#node_id' => $node_id,
1076
      '#node_id' => $wrapper->getIdentifier(),
978 1077
      '#field_name' => $field['field_name'],
1078
      '#caption' => $settings['caption'],
979 1079
    );
980 1080
  }
981 1081
  return ($element);
......
1026 1126
      'lightbox_style' => NULL,
1027 1127
      'node_id' => NULL,
1028 1128
      'field_name' => NULL,
1129
      'caption' => NULL,
1029 1130
     ),
1030 1131
    //'variables' => array(),
1031 1132
  );
......
1309 1410
  return array(
1310 1411
    'lightbox2_iframe' => array(
1311 1412
      'suitability callback' => 'lightbox2_check_filefield_extension',
1312
      'title' => t('Lightbox2 iframe'),
1413
      'label' => t('Lightbox2 iframe'),
1313 1414
      'description' => t('Displays all kinds of files in a popup lightbox in an iframe.'),
1314 1415
    ),
1315 1416
    'lightbox2_image' => array(
1316 1417
      'suitability callback' => 'lightbox2_check_filefield_image_extension',
1317
      'title' => t('Lightbox2 image'),
1418
      'label' => t('Lightbox2 image'),
1318 1419
      'description' => t('Displays image files in a popup lightbox.'),
1319 1420
    ),
1320 1421
  );
drupal7/sites/all/modules/lightbox2/lightbox2.views.inc
27 27
  );
28 28

  
29 29
  return $data;
30
}
31

  
32
/**
33
 * Implementation of hook_views_handlers() to register all of the basic handlers
34
 * views uses.
35
 */
36
function lightbox2_views_handlers() {
37
  return array(
38
    'info' => array(
39
      'path' => drupal_get_path('module', 'lightbox2'),
40
    ),
41
    'handlers' => array(
42
      'lightbox2_handler_field_lightbox2' => array(
43
        'parent' => 'views_handler_field',
44
      ),
45
    ),
46
  );
47
}
30
}
drupal7/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc
124 124
      // We don't actually use the link, but we need it there for lightbox to function.
125 125
      if (empty($link)) {
126 126
        // Get the path name.
127
        $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
128
        $link = url($path, array('absolute' => TRUE));
127
        $url = isset($_GET['q']) ? $_GET : '<front>';
128
        $path = '';
129
        $params = array();
130

  
131
        //Get the path and any parameters from the URL
132
        foreach ($url as $key => $value) {
133
          if ($key === 'q') {
134
            $path = $value;
135
          } else {
136
            $params[$key] = $value;
137
          }
138
        }
139

  
140
        $link = url($path, array('absolute' => TRUE, 'query' => $params));
129 141
      }
130 142

  
131 143
      // Get the token information and generate the value for the popup and the
......
142 154
      // div is hidden it won't show up as a lightbox.  We also specify a group
143 155
      // in the rel attribute in order to link the whole View together for paging.
144 156
      $group_name = !empty($this->options['custom_group']) ? $this->options['custom_group'] : ($this->options['rel_group'] ? 'lightbox-popup-' . $this->view->name . '-' . implode('/', $this->view->args) : '');
145
      return "<a href='$link #lightbox-popup-{$i}'  rel='lightmodal[{$group_name}|width:" . ($this->options['width'] ? $this->options['width'] : '600px') . ';height:' . ($this->options['height'] ? $this->options['height'] : '600px') . "][" . $caption . "]'>" . $tokens["[{$this->options['trigger_field']}]"] . "</a>
157
      $group_name = check_plain($group_name);
158
      $width = $this->options['width'] ? check_plain($this->options['width']) : '600px';
159
      $height = $this->options['height'] ? check_plain($this->options['height']) : '600px';
160
      $trigger_field = filter_xss_admin($this->options['trigger_field']);
161

  
162
      return "<a href='$link #lightbox-popup-{$i}'  rel='lightmodal[{$group_name}|width:" . $width . ';height:' . $height . "][" . $caption . "]'>" . $tokens["[{$trigger_field}]"] . "</a>
146 163
                <div style='display: none;'><div id='lightbox-popup-{$i}' class='lightbox-popup'>$popup</div></div>";
147 164
    }
148 165
    else {

Formats disponibles : Unified diff