rtMedia for WordPress, BuddyPress and bbPress - Version 2.7.3

Version Description

  • Added option to toggle lightbox functionality to prevent theme conflicts
  • Minor code revision
Download this release

Release Info

Developer saurabhshukla
Plugin Icon 128x128 rtMedia for WordPress, BuddyPress and bbPress
Version 2.7.3
Comparing to
See all releases

Code changes from version 2.7.2 to 2.7.3

app/assets/css/main.css CHANGED
@@ -230,6 +230,7 @@ ul#activity-stream li.media.album_updated ul{}
230
ul#activity-stream li.media.album_updated ul li,ul.bp-media-list-media li{float: left;margin-right:2%}
231
232
233
.media ul#bp-media-upload-set-privacy li input[type="radio"]{float:left;}
234
/* Privacy settings */
235
#bp-media-upload-set-privacy li{margin: 10px 0;overflow: hidden;}
230
ul#activity-stream li.media.album_updated ul li,ul.bp-media-list-media li{float: left;margin-right:2%}
231
232
233
+ body.media {overflow:auto;}
234
.media ul#bp-media-upload-set-privacy li input[type="radio"]{float:left;}
235
/* Privacy settings */
236
#bp-media-upload-set-privacy li{margin: 10px 0;overflow: hidden;}
app/assets/js/main.js CHANGED
@@ -3,553 +3,553 @@
3
*/
4
//Legacy media element for old activities
5
function bp_media_create_element(id){
6
- return false;
7
}
8
var $current;
9
jQuery(document).ready(function(){
10
11
- jQuery('ul#activity-stream').on('mediapreview','video,audio', function(){
12
- jQuery(this).mediaelementplayer({
13
- enableKeyboard: false,
14
- startVolume: 1,
15
- success: function(mediaElement,domElement){
16
- var $thisMediaElement = (mediaElement.id) ? jQuery("#"+mediaElement.id) : jQuery(mediaElement);
17
- $thisMediaElement.parents('.mejs-container').find(".mejs-volume-current").css("top","8px");
18
- $thisMediaElement.parents('.mejs-container').find(".mejs-volume-handle").css("top","5px");
19
- }
20
- });
21
- });
22
- jQuery('ul#activity-stream audio,ul#activity-stream video').trigger('mediapreview');
23
-
24
- jQuery('ul#activity-stream').on('DOMNodeInserted', function(){
25
- jQuery('ul#activity-stream audio,ul#activity-stream video').trigger('mediapreview');
26
- })
27
-
28
-
29
- jQuery('#item-body').on('click','#bp-media-upload-button', function(){
30
- jQuery(this).next().slideToggle();
31
- });
32
-
33
- jQuery('#bp-media-upload-ui').bind('dragover', function(e){
34
- jQuery(this).addClass('hover');
35
- return 0;
36
- });
37
- jQuery('#bp-media-upload-ui').bind('dragleave', function(e){
38
- jQuery(this).removeClass('hover');
39
- return 0;
40
- });
41
-
42
- var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
43
- if(bp_media_recent_tabs.length>0){
44
- jQuery(bp_media_recent_tabs).tabs();
45
- }
46
-
47
- var tallest = 0;
48
- jQuery('#recent-media-tabs .bp-media-tab-panel').each(function() {
49
-
50
- var thisHeight = jQuery(this).height();
51
- if(thisHeight > tallest) {
52
- tallest = thisHeight;
53
- }
54
- }).height(tallest);
55
-
56
-
57
- jQuery('#bp-media-show-more').click(function(e){
58
- e.preventDefault();
59
- var data = load_more_data();
60
- jQuery.get(bp_media_vars.ajaxurl, data, function(response) {
61
- if(response.length==0)
62
- jQuery('#bp-media-show-more').parent().remove();
63
- else
64
- jQuery('.bp-media-gallery').append(response);
65
- });
66
- });
67
- setTimeout(function(){
68
- jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
69
- if(confirm('Are you sure you want to delete this activity and associated media?')){
70
- return true;
71
- }
72
- else{
73
- return false;
74
- }
75
- });
76
-
77
- },1000);
78
-
79
- /* Add Featured Image */
80
- jQuery('.activity-meta').on('click','.bp-media-featured',function(e){
81
- e.preventDefault();
82
- var post_id = jQuery(this).attr('data-post-id');
83
- var album_id = jQuery(this).attr('data-album-id');
84
- var curr_obj = jQuery(this);
85
- var data = {
86
- action: 'bp_media_set_album_cover',
87
- post_id:post_id,
88
- album_id:album_id
89
- };
90
- jQuery.get(bp_media_vars.ajaxurl,data,function( response )
91
- {
92
- curr_obj.text(response);
93
- curr_obj.attr('title',response);
94
- }
95
- );
96
- });
97
-
98
-
99
- jQuery('#bp-media-list').on('click','li a',function(e){
100
- e.preventDefault();
101
- $current = jQuery(this);
102
- load_media($current);
103
- });
104
- jQuery('ul#activity-stream').on('click',
105
- 'li.media.album_updated ul li a, ul.bp-media-list-media li a, li.activity-item div.activity-content div.activity-inner div.bp_media_content a',function(e){
106
- e.preventDefault();
107
- $current = jQuery(this);
108
- load_media($current);
109
- });
110
- jQuery('body').on('click','a.modal-next', function(e){
111
- e.preventDefault();
112
- if(!$current.parent().hasClass('bp_media_content')){
113
- $next_current = $current.closest('li').next().find('a');
114
- console.log(jQuery('#bp-media-show-more').length);
115
- if($next_current.length<1){
116
- if(jQuery('#bp-media-show-more').length>0){
117
- var args = load_more_data();
118
- var request = jQuery.get(bp_media_vars.ajaxurl, args);
119
- chained = request.then(function( data ) {
120
- if(data.length==0){
121
- jQuery('#bp-media-show-more').parent().remove();
122
- return false;
123
- }else{
124
- jQuery('#bp-media-list').append(data);
125
- return true;
126
- }
127
- });
128
-
129
- chained.done(function( truth ) {
130
- if(truth!=false){
131
- $next_current = $current.closest('li').next().find('a');
132
- $current = $next_current;
133
- transit_media($current);
134
- }
135
- });
136
- }
137
- }else{
138
- $current = $next_current;
139
- transit_media($next_current);
140
- }
141
- }
142
-
143
-
144
- });
145
- jQuery('body').on('click','a.modal-prev', function(e){
146
- e.preventDefault();
147
- if(!$current.parent().hasClass('bp_media_content')){
148
- if($current.closest('li').prev().length>0 && $current.closest('li').prev().find('#bp-media-upload-ui').length<1 ){
149
- $current = $current.closest('li').prev().find('a');
150
-
151
- transit_media($current);
152
- }
153
- }
154
- });
155
- jQuery(document.documentElement).keyup(function (event) {
156
- if (event.keyCode == 37) {
157
- jQuery('a.modal-prev').trigger('click');
158
- } else if (event.keyCode == 39) {
159
- jQuery('a.modal-next').trigger('click');
160
- }
161
- });
162
-
163
- function load_media($current){
164
- jQuery.get($current.attr('href'),function(response){
165
- $mediacontent = jQuery(response).find('.bp-media-single');
166
- $medialoaded = jQuery('<div class="bp-media-ajax-single"></div>');
167
- $medialoaded.append($mediacontent);
168
- jQuery.modal($medialoaded,{
169
- 'zIndex':99999,
170
- 'autoResize':true,
171
- 'opacity': 90
172
- });
173
- do_fixes($medialoaded);
174
- });
175
- }
176
- function transit_media($current){
177
- $medialoaded = jQuery('.bp-media-ajax-single');
178
- $medialoaded.empty();
179
- $medialoaded.append( jQuery('<div class="lightbox-spinner" />'));
180
- jQuery.get($current.attr('href'),function(response){
181
- $mediacontent = jQuery(response).find('.bp-media-single');
182
- $medialoaded = jQuery('.bp-media-ajax-single');
183
- $medialoaded.empty();
184
- $medialoaded.append($mediacontent);
185
- do_fixes($medialoaded);
186
- });
187
- }
188
-
189
- function do_fixes($medialoaded){
190
- $medialoaded.find('.bp-media-content-wrap').append('<a class="modal-prev modal-ctrl"><span class="img-icon"></span></a><a class="modal-next modal-ctrl"><span class="img-icon"></span></a>');
191
- $medialoaded.find('.bp_media_description').remove();
192
- $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content img');
193
- if($image.length<1){
194
- $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content video');
195
- $dimensions = adjust_dimensions($image);
196
- adjust_comment_div($dimensions[0]);
197
- jQuery.modal.update($dimensions[0],$dimensions[1]);
198
- }
199
- $form = $medialoaded.find('form.ac-form');
200
- if($form.length>0){
201
- $form.find('.ac-reply-avatar').remove();
202
- $form.html($form.html().replace('&nbsp; or press esc to cancel.',''));
203
- }
204
- $image.load(function(){
205
- $dimensions = adjust_dimensions($image);
206
- adjust_comment_div($dimensions[0]);
207
- jQuery.modal.update($dimensions[0],$dimensions[1]);
208
- })
209
- }
210
-
211
- function adjust_dimensions($image){
212
- $height = ($image.height()>480)?$image.height():480;
213
- $width = ($image.width()>640)?$image.width():640;
214
- $width = $width +280;
215
- $image.hide();
216
- $image.show();
217
- return [$height,$width];
218
-
219
- }
220
-
221
- function adjust_comment_div($height){
222
- $medialoaded.find('.bp-media-meta-content-wrap').css({
223
- 'height': $height,
224
- 'overflow':'auto'
225
- });
226
- }
227
- function load_more_data(){
228
- var data = {
229
- action: 'bp_media_load_more',
230
- page:++bp_media_vars.page,
231
- current_action : bp_media_vars.current_action,
232
- action_variables : bp_media_vars.action_variables,
233
- displayed_user : bp_media_vars.displayed_user,
234
- loggedin_user : bp_media_vars.loggedin_user,
235
- current_group : bp_media_vars.current_group
236
- };
237
- return data;
238
- }
239
-
240
- /**** Activity Comments *******************************************************/
241
-
242
- /* Hide all activity comment forms */
243
- jQuery('form.ac-form').hide();
244
-
245
- /* Hide excess comments */
246
- // if ( jQuery('.activity-comments').length )
247
- // bp_legacy_theme_hide_comments();
248
-
249
- /* Activity list event delegation */
250
- jQuery('body').on( 'click', '.bp-media-ajax-single div.activity',function(event) {
251
- var target = jQuery(event.target);
252
- if ( target.hasClass('bp-media-featured') ) {
253
- var post_id = target.attr('data-post-id');
254
- var album_id = target.attr('data-album-id');
255
- var data = {
256
- action: 'bp_media_set_album_cover',
257
- post_id:post_id,
258
- album_id:album_id
259
- };
260
- target.addClass('loading');
261
- jQuery.get(bp_media_vars.ajaxurl,data,function( response )
262
- {
263
- target.removeClass('loading');
264
- target.fadeOut( 200, function() {
265
- jQuery(this).html(response);
266
- jQuery(this).attr('title',response);
267
- jQuery(this).fadeIn(200);
268
- });
269
-
270
- }
271
- );
272
- }
273
-
274
-
275
- /* Favoriting activity stream items */
276
- if ( target.hasClass('fav') || target.hasClass('unfav') ) {
277
- console.log('hua');
278
- event.preventDefault();
279
- var type = target.hasClass('fav') ? 'fav' : 'unfav';
280
- var parent = target.closest('.activity_update');
281
- var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
282
-
283
- target.addClass('loading');
284
-
285
- jQuery.post( ajaxurl, {
286
- action: 'activity_mark_' + type,
287
- 'cookie': encodeURIComponent(document.cookie),
288
- 'id': parent_id
289
- },
290
- function(response) {
291
- target.removeClass('loading');
292
-
293
- target.fadeOut( 200, function() {
294
- jQuery(this).html(response);
295
- jQuery(this).attr('title', 'fav' == type ? BP_DTheme.remove_fav : BP_DTheme.mark_as_fav);
296
- jQuery(this).fadeIn(200);
297
- });
298
-
299
- if ( 'fav' == type ) {
300
- if ( !jQuery('.item-list-tabs #activity-favorites').length )
301
- jQuery('.item-list-tabs ul #activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>');
302
-
303
- target.removeClass('fav');
304
- target.addClass('unfav');
305
-
306
- jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) + 1 );
307
- } else {
308
- target.removeClass('unfav');
309
- target.addClass('fav');
310
-
311
- jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) - 1 );
312
-
313
- if ( !Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) ) {
314
- if ( jQuery('.item-list-tabs ul #activity-favorites').hasClass('selected') )
315
- bp_activity_request( null, null );
316
-
317
- jQuery('.item-list-tabs ul #activity-favorites').remove();
318
- }
319
- }
320
-
321
- if ( 'activity-favorites' == jQuery( '.item-list-tabs li.selected').attr('id') )
322
- target.parent().parent().parent().slideUp(100);
323
- });
324
-
325
- return false;
326
- }
327
- /* Comment / comment reply links */
328
- if ( target.hasClass('acomment-reply') || target.parent().hasClass('acomment-reply') ) {
329
- if ( target.parent().hasClass('acomment-reply') )
330
- target = target.parent();
331
-
332
- var id = target.attr('id');
333
- ids = id.split('-');
334
-
335
- var a_id = ids[2]
336
- var c_id = target.attr('href').substr( 10, target.attr('href').length );
337
- var form = jQuery( '#ac-form-' + a_id );
338
-
339
- form.css( 'display', 'none' );
340
- form.removeClass('root');
341
- jQuery('.ac-form').hide();
342
-
343
- /* Hide any error messages */
344
- form.children('div').each( function() {
345
- if ( jQuery(this).hasClass( 'error' ) )
346
- jQuery(this).hide();
347
- });
348
-
349
- if ( ids[1] != 'comment' ) {
350
- jQuery('#acomment-' + c_id).append( form );
351
- } else {
352
- jQuery('#activity-' + a_id + ' .activity-comments').append( form );
353
- }
354
-
355
- if ( form.parent().hasClass( 'activity-comments' ) )
356
- form.addClass('root');
357
-
358
- form.slideDown( 200 );
359
- jQuery.scrollTo( form, 500, {
360
- offset:-100,
361
- easing:'easeOutQuad'
362
- } );
363
- jQuery('#ac-form-' + ids[2] + ' textarea').focus();
364
-
365
- return false;
366
- }
367
-
368
- /* Activity comment posting */
369
- if ( target.attr('name') == 'ac_form_submit' ) {
370
- var form = target.parents( 'form' );
371
- var form_parent = form.parent();
372
- var form_id = form.attr('id').split('-');
373
-
374
- if ( !form_parent.hasClass('activity-comments') ) {
375
- var tmp_id = form_parent.attr('id').split('-');
376
- var comment_id = tmp_id[1];
377
- } else {
378
- var comment_id = form_id[2];
379
- }
380
-
381
- var content = jQuery( '#' + form.attr('id') + ' textarea' );
382
-
383
- /* Hide any error messages */
384
- jQuery( '#' + form.attr('id') + ' div.error').hide();
385
- target.addClass('loading').prop('disabled', true);
386
- content.addClass('loading').prop('disabled', true);
387
-
388
- var ajaxdata = {
389
- action: 'new_activity_comment',
390
- 'cookie': encodeURIComponent(document.cookie),
391
- '_wpnonce_new_activity_comment': jQuery("#_wpnonce_new_activity_comment").val(),
392
- 'comment_id': comment_id,
393
- 'form_id': form_id[2],
394
- 'content': content.val()
395
- };
396
-
397
- // Akismet
398
- var ak_nonce = jQuery('#_bp_as_nonce_' + comment_id).val();
399
- if ( ak_nonce ) {
400
- ajaxdata['_bp_as_nonce_' + comment_id] = ak_nonce;
401
- }
402
-
403
- jQuery.post( ajaxurl, ajaxdata, function(response) {
404
- target.removeClass('loading');
405
- content.removeClass('loading');
406
-
407
- /* Check for errors and append if found. */
408
- if ( response[0] + response[1] == '-1' ) {
409
- form.append( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
410
- } else {
411
- form.fadeOut( 200, function() {
412
- if ( 0 == form.parent().children('ul').length ) {
413
- if ( form.parent().hasClass('activity-comments') ) {
414
- form.parent().prepend('<ul></ul>');
415
- } else {
416
- form.parent().append('<ul></ul>');
417
- }
418
- }
419
-
420
- /* Preceeding whitespace breaks output with jQuery 1.9.0 */
421
- var the_comment = jQuery.trim( response );
422
-
423
- form.parent().children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
424
- form.children('textarea').val('');
425
- form.parent().parent().addClass('has-comments');
426
- } );
427
- jQuery( '#' + form.attr('id') + ' textarea').val('');
428
-
429
- /* Increase the "Reply (X)" button count */
430
- jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
431
- }
432
-
433
- jQuery(target).prop("disabled", false);
434
- jQuery(content).prop("disabled", false);
435
- });
436
-
437
- return false;
438
- }
439
-
440
- /* Deleting an activity comment */
441
- if ( target.hasClass('acomment-delete') ) {
442
- var link_href = target.attr('href');
443
- var comment_li = target.parent().parent();
444
- var form = comment_li.parents('div.activity-comments').children('form');
445
-
446
- var nonce = link_href.split('_wpnonce=');
447
- nonce = nonce[1];
448
-
449
- var comment_id = link_href.split('cid=');
450
- comment_id = comment_id[1].split('&');
451
- comment_id = comment_id[0];
452
-
453
- target.addClass('loading');
454
-
455
- /* Remove any error messages */
456
- jQuery('.activity-comments ul .error').remove();
457
-
458
- /* Reset the form position */
459
- comment_li.parents('.activity-comments').append(form);
460
-
461
- jQuery.post( ajaxurl, {
462
- action: 'delete_activity_comment',
463
- 'cookie': encodeURIComponent(document.cookie),
464
- '_wpnonce': nonce,
465
- 'id': comment_id
466
- },
467
- function(response) {
468
- /* Check for errors and append if found. */
469
- if ( response[0] + response[1] == '-1' ) {
470
- comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
471
- } else {
472
- var children = jQuery( '#' + comment_li.attr('id') + ' ul' ).children('li');
473
- var child_count = 0;
474
- jQuery(children).each( function() {
475
- if ( !jQuery(this).is(':hidden') )
476
- child_count++;
477
- });
478
- comment_li.fadeOut(200);
479
-
480
- /* Decrease the "Reply (X)" button count */
481
- var count_span = jQuery('#' + comment_li.parents('#activity-stream > li').attr('id') + ' a.acomment-reply span');
482
- var new_count = count_span.html() - ( 1 + child_count );
483
- count_span.html(new_count);
484
-
485
- /* If that was the last comment for the item, remove the has-comments class to clean up the styling */
486
- if ( 0 == new_count ) {
487
- jQuery(comment_li.parents('#activity-stream > li')).removeClass('has-comments');
488
- }
489
- }
490
- });
491
-
492
- return false;
493
- }
494
-
495
- // Spam an activity stream comment
496
- if ( target.hasClass( 'spam-activity-comment' ) ) {
497
- var link_href = target.attr( 'href' );
498
- var comment_li = target.parent().parent();
499
-
500
- target.addClass('loading');
501
-
502
- // Remove any error messages
503
- jQuery( '.activity-comments ul div.error' ).remove();
504
-
505
- // Reset the form position
506
- comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) );
507
-
508
- jQuery.post( ajaxurl, {
509
- action: 'bp_spam_activity_comment',
510
- 'cookie': encodeURIComponent( document.cookie ),
511
- '_wpnonce': link_href.split( '_wpnonce=' )[1],
512
- 'id': link_href.split( 'cid=' )[1].split( '&' )[0]
513
- },
514
-
515
- function ( response ) {
516
- // Check for errors and append if found.
517
- if ( response[0] + response[1] == '-1' ) {
518
- comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
519
-
520
- } else {
521
- var children = jQuery( '#' + comment_li.attr( 'id' ) + ' ul' ).children( 'li' );
522
- var child_count = 0;
523
- jQuery(children).each( function() {
524
- if ( !jQuery( this ).is( ':hidden' ) ) {
525
- child_count++;
526
- }
527
- });
528
- comment_li.fadeOut( 200 );
529
-
530
- // Decrease the "Reply (X)" button count
531
- var parent_li = comment_li.parents( '#activity-stream > li' );
532
- jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html( jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html() - ( 1 + child_count ) );
533
- }
534
- });
535
-
536
- return false;
537
- }
538
-
539
- /* Showing hidden comments - pause for half a second */
540
- if ( target.parent().hasClass('show-all') ) {
541
- target.parent().addClass('loading');
542
-
543
- setTimeout( function() {
544
- target.parent().parent().children('li').fadeIn(200, function() {
545
- target.parent().remove();
546
- });
547
- }, 600 );
548
-
549
- return false;
550
- }
551
- });
552
-
553
-
554
555
});
3
*/
4
//Legacy media element for old activities
5
function bp_media_create_element(id){
6
+ return false;
7
}
8
var $current;
9
jQuery(document).ready(function(){
10
11
+ jQuery('ul#activity-stream').on('mediapreview','video,audio', function(){
12
+ jQuery(this).mediaelementplayer({
13
+ enableKeyboard: false,
14
+ startVolume: 1,
15
+ success: function(mediaElement,domElement){
16
+ var $thisMediaElement = (mediaElement.id) ? jQuery("#"+mediaElement.id) : jQuery(mediaElement);
17
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-current").css("top","8px");
18
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-handle").css("top","5px");
19
+ }
20
+ });
21
+ });
22
+ jQuery('ul#activity-stream audio,ul#activity-stream video').trigger('mediapreview');
23
+
24
+ jQuery('ul#activity-stream').on('DOMNodeInserted', function(){
25
+ jQuery('ul#activity-stream audio,ul#activity-stream video').trigger('mediapreview');
26
+ })
27
+
28
+
29
+ jQuery('#item-body').on('click','#bp-media-upload-button', function(){
30
+ jQuery(this).next().slideToggle();
31
+ });
32
+
33
+ jQuery('#bp-media-upload-ui').bind('dragover', function(e){
34
+ jQuery(this).addClass('hover');
35
+ return 0;
36
+ });
37
+ jQuery('#bp-media-upload-ui').bind('dragleave', function(e){
38
+ jQuery(this).removeClass('hover');
39
+ return 0;
40
+ });
41
+
42
+ var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
43
+ if(bp_media_recent_tabs.length>0){
44
+ jQuery(bp_media_recent_tabs).tabs();
45
+ }
46
+
47
+ var tallest = 0;
48
+ jQuery('#recent-media-tabs .bp-media-tab-panel').each(function() {
49
+
50
+ var thisHeight = jQuery(this).height();
51
+ if(thisHeight > tallest) {
52
+ tallest = thisHeight;
53
+ }
54
+ }).height(tallest);
55
+
56
+
57
+ jQuery('#bp-media-show-more').click(function(e){
58
+ e.preventDefault();
59
+ var data = load_more_data();
60
+ jQuery.get(bp_media_vars.ajaxurl, data, function(response) {
61
+ if(response.length==0)
62
+ jQuery('#bp-media-show-more').parent().remove();
63
+ else
64
+ jQuery('.bp-media-gallery').append(response);
65
+ });
66
+ });
67
+ setTimeout(function(){
68
+ jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
69
+ if(confirm('Are you sure you want to delete this activity and associated media?')){
70
+ return true;
71
+ }
72
+ else{
73
+ return false;
74
+ }
75
+ });
76
+
77
+ },1000);
78
+
79
+ /* Add Featured Image */
80
+ jQuery('.activity-meta').on('click','.bp-media-featured',function(e){
81
+ e.preventDefault();
82
+ var post_id = jQuery(this).attr('data-post-id');
83
+ var album_id = jQuery(this).attr('data-album-id');
84
+ var curr_obj = jQuery(this);
85
+ var data = {
86
+ action: 'bp_media_set_album_cover',
87
+ post_id:post_id,
88
+ album_id:album_id
89
+ };
90
+ jQuery.get(bp_media_vars.ajaxurl,data,function( response )
91
+ {
92
+ curr_obj.text(response);
93
+ curr_obj.attr('title',response);
94
+ }
95
+ );
96
+ });
97
+
98
+ if ( bp_media_vars.lightbox > 0 ) {
99
+ jQuery('#bp-media-list').on('click','li a',function(e){
100
+ e.preventDefault();
101
+ $current = jQuery(this);
102
+ load_media($current);
103
+ });
104
+ jQuery('ul#activity-stream').on('click',
105
+ 'li.media.album_updated ul li a, ul.bp-media-list-media li a, li.activity-item div.activity-content div.activity-inner div.bp_media_content a',function(e){
106
+ e.preventDefault();
107
+ $current = jQuery(this);
108
+ load_media($current);
109
+ });
110
+ jQuery('body').on('click','a.modal-next', function(e){
111
+ e.preventDefault();
112
+ if(!$current.parent().hasClass('bp_media_content')){
113
+ $next_current = $current.closest('li').next().find('a');
114
+ console.log(jQuery('#bp-media-show-more').length);
115
+ if($next_current.length<1){
116
+ if(jQuery('#bp-media-show-more').length>0){
117
+ var args = load_more_data();
118
+ var request = jQuery.get(bp_media_vars.ajaxurl, args);
119
+ chained = request.then(function( data ) {
120
+ if(data.length==0){
121
+ jQuery('#bp-media-show-more').parent().remove();
122
+ return false;
123
+ }else{
124
+ jQuery('#bp-media-list').append(data);
125
+ return true;
126
+ }
127
+ });
128
+
129
+ chained.done(function( truth ) {
130
+ if(truth!=false){
131
+ $next_current = $current.closest('li').next().find('a');
132
+ $current = $next_current;
133
+ transit_media($current);
134
+ }
135
+ });
136
+ }
137
+ }else{
138
+ $current = $next_current;
139
+ transit_media($next_current);
140
+ }
141
+ }
142
+
143
+
144
+ });
145
+ jQuery('body').on('click','a.modal-prev', function(e){
146
+ e.preventDefault();
147
+ if(!$current.parent().hasClass('bp_media_content')){
148
+ if($current.closest('li').prev().length>0 && $current.closest('li').prev().find('#bp-media-upload-ui').length<1 ){
149
+ $current = $current.closest('li').prev().find('a');
150
+
151
+ transit_media($current);
152
+ }
153
+ }
154
+ });
155
+ jQuery(document.documentElement).keyup(function (event) {
156
+ if (event.keyCode == 37) {
157
+ jQuery('a.modal-prev').trigger('click');
158
+ } else if (event.keyCode == 39) {
159
+ jQuery('a.modal-next').trigger('click');
160
+ }
161
+ });
162
+
163
+ function load_media($current){
164
+ jQuery.get($current.attr('href'),function(response){
165
+ $mediacontent = jQuery(response).find('.bp-media-single');
166
+ $medialoaded = jQuery('<div class="bp-media-ajax-single"></div>');
167
+ $medialoaded.append($mediacontent);
168
+ jQuery.modal($medialoaded,{
169
+ 'zIndex':99999,
170
+ 'autoResize':true,
171
+ 'opacity': 90
172
+ });
173
+ do_fixes($medialoaded);
174
+ });
175
+ }
176
+ function transit_media($current){
177
+ $medialoaded = jQuery('.bp-media-ajax-single');
178
+ $medialoaded.empty();
179
+ $medialoaded.append( jQuery('<div class="lightbox-spinner" />'));
180
+ jQuery.get($current.attr('href'),function(response){
181
+ $mediacontent = jQuery(response).find('.bp-media-single');
182
+ $medialoaded = jQuery('.bp-media-ajax-single');
183
+ $medialoaded.empty();
184
+ $medialoaded.append($mediacontent);
185
+ do_fixes($medialoaded);
186
+ });
187
+ }
188
+
189
+ function do_fixes($medialoaded){
190
+ $medialoaded.find('.bp-media-content-wrap').append('<a class="modal-prev modal-ctrl"><span class="img-icon"></span></a><a class="modal-next modal-ctrl"><span class="img-icon"></span></a>');
191
+ $medialoaded.find('.bp_media_description').remove();
192
+ $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content img');
193
+ if($image.length<1){
194
+ $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content video');
195
+ $dimensions = adjust_dimensions($image);
196
+ adjust_comment_div($dimensions[0]);
197
+ jQuery.modal.update($dimensions[0],$dimensions[1]);
198
+ }
199
+ $form = $medialoaded.find('form.ac-form');
200
+ if($form.length>0){
201
+ $form.find('.ac-reply-avatar').remove();
202
+ $form.html($form.html().replace('&nbsp; or press esc to cancel.',''));
203
+ }
204
+ $image.load(function(){
205
+ $dimensions = adjust_dimensions($image);
206
+ adjust_comment_div($dimensions[0]);
207
+ jQuery.modal.update($dimensions[0],$dimensions[1]);
208
+ })
209
+ }
210
+
211
+ function adjust_dimensions($image){
212
+ $height = ($image.height()>480)?$image.height():480;
213
+ $width = ($image.width()>640)?$image.width():640;
214
+ $width = $width +280;
215
+ $image.hide();
216
+ $image.show();
217
+ return [$height,$width];
218
+
219
+ }
220
+
221
+ function adjust_comment_div($height){
222
+ $medialoaded.find('.bp-media-meta-content-wrap').css({
223
+ 'height': $height,
224
+ 'overflow':'auto'
225
+ });
226
+ }
227
+ function load_more_data(){
228
+ var data = {
229
+ action: 'bp_media_load_more',
230
+ page:++bp_media_vars.page,
231
+ current_action : bp_media_vars.current_action,
232
+ action_variables : bp_media_vars.action_variables,
233
+ displayed_user : bp_media_vars.displayed_user,
234
+ loggedin_user : bp_media_vars.loggedin_user,
235
+ current_group : bp_media_vars.current_group
236
+ };
237
+ return data;
238
+ }
239
+
240
+ /**** Activity Comments *******************************************************/
241
+
242
+ /* Hide all activity comment forms */
243
+ jQuery('form.ac-form').hide();
244
+
245
+ /* Hide excess comments */
246
+ // if ( jQuery('.activity-comments').length )
247
+ // bp_legacy_theme_hide_comments();
248
+
249
+ /* Activity list event delegation */
250
+ jQuery('body').on( 'click', '.bp-media-ajax-single div.activity',function(event) {
251
+ var target = jQuery(event.target);
252
+ if ( target.hasClass('bp-media-featured') ) {
253
+ var post_id = target.attr('data-post-id');
254
+ var album_id = target.attr('data-album-id');
255
+ var data = {
256
+ action: 'bp_media_set_album_cover',
257
+ post_id:post_id,
258
+ album_id:album_id
259
+ };
260
+ target.addClass('loading');
261
+ jQuery.get(bp_media_vars.ajaxurl,data,function( response )
262
+ {
263
+ target.removeClass('loading');
264
+ target.fadeOut( 200, function() {
265
+ jQuery(this).html(response);
266
+ jQuery(this).attr('title',response);
267
+ jQuery(this).fadeIn(200);
268
+ });
269
+
270
+ }
271
+ );
272
+ }
273
+
274
+
275
+ /* Favoriting activity stream items */
276
+ if ( target.hasClass('fav') || target.hasClass('unfav') ) {
277
+ console.log('hua');
278
+ event.preventDefault();
279
+ var type = target.hasClass('fav') ? 'fav' : 'unfav';
280
+ var parent = target.closest('.activity_update');
281
+ var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
282
+
283
+ target.addClass('loading');
284
+
285
+ jQuery.post( ajaxurl, {
286
+ action: 'activity_mark_' + type,
287
+ 'cookie': encodeURIComponent(document.cookie),
288
+ 'id': parent_id
289
+ },
290
+ function(response) {
291
+ target.removeClass('loading');
292
+
293
+ target.fadeOut( 200, function() {
294
+ jQuery(this).html(response);
295
+ jQuery(this).attr('title', 'fav' == type ? BP_DTheme.remove_fav : BP_DTheme.mark_as_fav);
296
+ jQuery(this).fadeIn(200);
297
+ });
298
+
299
+ if ( 'fav' == type ) {
300
+ if ( !jQuery('.item-list-tabs #activity-favorites').length )
301
+ jQuery('.item-list-tabs ul #activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>');
302
+
303
+ target.removeClass('fav');
304
+ target.addClass('unfav');
305
+
306
+ jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) + 1 );
307
+ } else {
308
+ target.removeClass('unfav');
309
+ target.addClass('fav');
310
+
311
+ jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) - 1 );
312
+
313
+ if ( !Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) ) {
314
+ if ( jQuery('.item-list-tabs ul #activity-favorites').hasClass('selected') )
315
+ bp_activity_request( null, null );
316
+
317
+ jQuery('.item-list-tabs ul #activity-favorites').remove();
318
+ }
319
+ }
320
+
321
+ if ( 'activity-favorites' == jQuery( '.item-list-tabs li.selected').attr('id') )
322
+ target.parent().parent().parent().slideUp(100);
323
+ });
324
+
325
+ return false;
326
+ }
327
+ /* Comment / comment reply links */
328
+ if ( target.hasClass('acomment-reply') || target.parent().hasClass('acomment-reply') ) {
329
+ if ( target.parent().hasClass('acomment-reply') )
330
+ target = target.parent();
331
+
332
+ var id = target.attr('id');
333
+ ids = id.split('-');
334
+
335
+ var a_id = ids[2]
336
+ var c_id = target.attr('href').substr( 10, target.attr('href').length );
337
+ var form = jQuery( '#ac-form-' + a_id );
338
+
339
+ form.css( 'display', 'none' );
340
+ form.removeClass('root');
341
+ jQuery('.ac-form').hide();
342
+
343
+ /* Hide any error messages */
344
+ form.children('div').each( function() {
345
+ if ( jQuery(this).hasClass( 'error' ) )
346
+ jQuery(this).hide();
347
+ });
348
+
349
+ if ( ids[1] != 'comment' ) {
350
+ jQuery('#acomment-' + c_id).append( form );
351
+ } else {
352
+ jQuery('#activity-' + a_id + ' .activity-comments').append( form );
353
+ }
354
+
355
+ if ( form.parent().hasClass( 'activity-comments' ) )
356
+ form.addClass('root');
357
+
358
+ form.slideDown( 200 );
359
+ jQuery.scrollTo( form, 500, {
360
+ offset:-100,
361
+ easing:'easeOutQuad'
362
+ } );
363
+ jQuery('#ac-form-' + ids[2] + ' textarea').focus();
364
+
365
+ return false;
366
+ }
367
+
368
+ /* Activity comment posting */
369
+ if ( target.attr('name') == 'ac_form_submit' ) {
370
+ var form = target.parents( 'form' );
371
+ var form_parent = form.parent();
372
+ var form_id = form.attr('id').split('-');
373
+
374
+ if ( !form_parent.hasClass('activity-comments') ) {
375
+ var tmp_id = form_parent.attr('id').split('-');
376
+ var comment_id = tmp_id[1];
377
+ } else {
378
+ var comment_id = form_id[2];
379
+ }
380
+
381
+ var content = jQuery( '#' + form.attr('id') + ' textarea' );
382
+
383
+ /* Hide any error messages */
384
+ jQuery( '#' + form.attr('id') + ' div.error').hide();
385
+ target.addClass('loading').prop('disabled', true);
386
+ content.addClass('loading').prop('disabled', true);
387
+
388
+ var ajaxdata = {
389
+ action: 'new_activity_comment',
390
+ 'cookie': encodeURIComponent(document.cookie),
391
+ '_wpnonce_new_activity_comment': jQuery("#_wpnonce_new_activity_comment").val(),
392
+ 'comment_id': comment_id,
393
+ 'form_id': form_id[2],
394
+ 'content': content.val()
395
+ };
396
+
397
+ // Akismet
398
+ var ak_nonce = jQuery('#_bp_as_nonce_' + comment_id).val();
399
+ if ( ak_nonce ) {
400
+ ajaxdata['_bp_as_nonce_' + comment_id] = ak_nonce;
401
+ }
402
+
403
+ jQuery.post( ajaxurl, ajaxdata, function(response) {
404
+ target.removeClass('loading');
405
+ content.removeClass('loading');
406
+
407
+ /* Check for errors and append if found. */
408
+ if ( response[0] + response[1] == '-1' ) {
409
+ form.append( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
410
+ } else {
411
+ form.fadeOut( 200, function() {
412
+ if ( 0 == form.parent().children('ul').length ) {
413
+ if ( form.parent().hasClass('activity-comments') ) {
414
+ form.parent().prepend('<ul></ul>');
415
+ } else {
416
+ form.parent().append('<ul></ul>');
417
+ }
418
+ }
419
+
420
+ /* Preceeding whitespace breaks output with jQuery 1.9.0 */
421
+ var the_comment = jQuery.trim( response );
422
+
423
+ form.parent().children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
424
+ form.children('textarea').val('');
425
+ form.parent().parent().addClass('has-comments');
426
+ } );
427
+ jQuery( '#' + form.attr('id') + ' textarea').val('');
428
+
429
+ /* Increase the "Reply (X)" button count */
430
+ jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
431
+ }
432
+
433
+ jQuery(target).prop("disabled", false);
434
+ jQuery(content).prop("disabled", false);
435
+ });
436
+
437
+ return false;
438
+ }
439
+
440
+ /* Deleting an activity comment */
441
+ if ( target.hasClass('acomment-delete') ) {
442
+ var link_href = target.attr('href');
443
+ var comment_li = target.parent().parent();
444
+ var form = comment_li.parents('div.activity-comments').children('form');
445
+
446
+ var nonce = link_href.split('_wpnonce=');
447
+ nonce = nonce[1];
448
+
449
+ var comment_id = link_href.split('cid=');
450
+ comment_id = comment_id[1].split('&');
451
+ comment_id = comment_id[0];
452
+
453
+ target.addClass('loading');
454
+
455
+ /* Remove any error messages */
456
+ jQuery('.activity-comments ul .error').remove();
457
+
458
+ /* Reset the form position */
459
+ comment_li.parents('.activity-comments').append(form);
460
+
461
+ jQuery.post( ajaxurl, {
462
+ action: 'delete_activity_comment',
463
+ 'cookie': encodeURIComponent(document.cookie),
464
+ '_wpnonce': nonce,
465
+ 'id': comment_id
466
+ },
467
+ function(response) {
468
+ /* Check for errors and append if found. */
469
+ if ( response[0] + response[1] == '-1' ) {
470
+ comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
471
+ } else {
472
+ var children = jQuery( '#' + comment_li.attr('id') + ' ul' ).children('li');
473
+ var child_count = 0;
474
+ jQuery(children).each( function() {
475
+ if ( !jQuery(this).is(':hidden') )
476
+ child_count++;
477
+ });
478
+ comment_li.fadeOut(200);
479
+
480
+ /* Decrease the "Reply (X)" button count */
481
+ var count_span = jQuery('#' + comment_li.parents('#activity-stream > li').attr('id') + ' a.acomment-reply span');
482
+ var new_count = count_span.html() - ( 1 + child_count );
483
+ count_span.html(new_count);
484
+
485
+ /* If that was the last comment for the item, remove the has-comments class to clean up the styling */
486
+ if ( 0 == new_count ) {
487
+ jQuery(comment_li.parents('#activity-stream > li')).removeClass('has-comments');
488
+ }
489
+ }
490
+ });
491
+
492
+ return false;
493
+ }
494
+
495
+ // Spam an activity stream comment
496
+ if ( target.hasClass( 'spam-activity-comment' ) ) {
497
+ var link_href = target.attr( 'href' );
498
+ var comment_li = target.parent().parent();
499
+
500
+ target.addClass('loading');
501
+
502
+ // Remove any error messages
503
+ jQuery( '.activity-comments ul div.error' ).remove();
504
+
505
+ // Reset the form position
506
+ comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) );
507
+
508
+ jQuery.post( ajaxurl, {
509
+ action: 'bp_spam_activity_comment',
510
+ 'cookie': encodeURIComponent( document.cookie ),
511
+ '_wpnonce': link_href.split( '_wpnonce=' )[1],
512
+ 'id': link_href.split( 'cid=' )[1].split( '&' )[0]
513
+ },
514
+
515
+ function ( response ) {
516
+ // Check for errors and append if found.
517
+ if ( response[0] + response[1] == '-1' ) {
518
+ comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
519
+
520
+ } else {
521
+ var children = jQuery( '#' + comment_li.attr( 'id' ) + ' ul' ).children( 'li' );
522
+ var child_count = 0;
523
+ jQuery(children).each( function() {
524
+ if ( !jQuery( this ).is( ':hidden' ) ) {
525
+ child_count++;
526
+ }
527
+ });
528
+ comment_li.fadeOut( 200 );
529
+
530
+ // Decrease the "Reply (X)" button count
531
+ var parent_li = comment_li.parents( '#activity-stream > li' );
532
+ jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html( jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html() - ( 1 + child_count ) );
533
+ }
534
+ });
535
+
536
+ return false;
537
+ }
538
+
539
+ /* Showing hidden comments - pause for half a second */
540
+ if ( target.parent().hasClass('show-all') ) {
541
+ target.parent().addClass('loading');
542
+
543
+ setTimeout( function() {
544
+ target.parent().parent().children('li').fadeIn(200, function() {
545
+ target.parent().remove();
546
+ });
547
+ }, 600 );
548
+
549
+ return false;
550
+ }
551
+ });
552
+
553
+ }
554
555
});
app/helper/BPMediaAddon.php CHANGED
@@ -25,6 +25,16 @@ if (!class_exists('BPMediaAddon')) {
25
26
public function get_addons() {
27
$addons = array(
28
array(
29
'title' => __('BuddyPress-Media Kaltura Add-on', BP_MEDIA_TXT_DOMAIN),
30
'img_src' => 'http://cdn.rtcamp.com/files/2012/10/new-buddypress-media-kaltura-logo-240x184.png',
25
26
public function get_addons() {
27
$addons = array(
28
+ array(
29
+ 'title' => __('BuddyPress-Media Instagram', BP_MEDIA_TXT_DOMAIN),
30
+ 'img_src' => 'http://cdn.rtcamp.com/wp-content/uploads/2013/03/BuddyPressMedia-Instagram.png',
31
+ 'product_link' => 'http://rtcamp.com/store/buddypress-media-instagram/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media',
32
+ 'desc' => '<p>' . __('BuddyPress Media Instagram adds Instagram like filters to images uploaded with BuddyPress Media.', BP_MEDIA_TXT_DOMAIN) . '</p>
33
+ <p><strong>' . __('Important', BP_MEDIA_TXT_DOMAIN) . ':</strong> ' . __('You need to have ImageMagick installed on your server for this addon to work.', BP_MEDIA_TXT_DOMAIN) . '</p>',
34
+ 'price' => '$19',
35
+ 'demo_link' => 'http://demo.rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media',
36
+ 'buy_now' => 'http://rtcamp.com/store/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media&add-to-cart=34379'
37
+ ),
38
array(
39
'title' => __('BuddyPress-Media Kaltura Add-on', BP_MEDIA_TXT_DOMAIN),
40
'img_src' => 'http://cdn.rtcamp.com/files/2012/10/new-buddypress-media-kaltura-logo-240x184.png',
app/helper/BPMediaSettings.php CHANGED
@@ -55,7 +55,15 @@ if (!class_exists('BPMediaSettings')) {
55
)
56
);
57
}
58
-
59
if (bp_is_active('groups')) {
60
add_settings_section('bpm-media-type', __('Groups Integration', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
61
// add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
55
)
56
);
57
}
58
+
59
+ add_settings_section('bpm-media-lightbox', __('Lightbox Integration', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
60
+ add_settings_field('bpm-media-lightbox-option', __('Lightbox', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-lightbox', array(
61
+ 'setting' => 'bp_media_options',
62
+ 'option' => 'enable_lightbox',
63
+ 'desc' => __('Enable Lighbox on Media', BP_MEDIA_TXT_DOMAIN)
64
+ )
65
+ );
66
+
67
if (bp_is_active('groups')) {
68
add_settings_section('bpm-media-type', __('Groups Integration', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
69
// add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
app/main/BuddyPressMedia.php CHANGED
@@ -172,6 +172,7 @@ class BuddyPressMedia {
172
if (!$options) {
173
$options = array(
174
'enable_on_group' => 1,
175
'videos_enabled' => 1,
176
'audio_enabled' => 1,
177
'images_enabled' => 1,
@@ -180,6 +181,12 @@ class BuddyPressMedia {
180
);
181
bp_update_option('bp_media_options', $options);
182
}
183
$this->options = $options;
184
}
185
172
if (!$options) {
173
$options = array(
174
'enable_on_group' => 1,
175
+ 'enable_lightbox' => 1,
176
'videos_enabled' => 1,
177
'audio_enabled' => 1,
178
'images_enabled' => 1,
181
);
182
bp_update_option('bp_media_options', $options);
183
}
184
+ $lightbox = bp_get_option('bp_media_lightbox', false);
185
+ if ( !$lightbox ) {
186
+ $options['enable_lightbox'] = 1;
187
+ bp_update_option('bp_media_options', $options);
188
+ bp_update_option('bp_media_lightbox', 1);
189
+ }
190
$this->options = $options;
191
}
192
app/main/includes/BPMediaActions.php CHANGED
@@ -146,12 +146,13 @@ class BPMediaActions {
146
* @global type $bp
147
*/
148
function enqueue_scripts_styles() {
149
-
150
wp_enqueue_script('jquery-ui-tabs');
151
wp_enqueue_script('bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js', '', BP_MEDIA_VERSION);
152
wp_enqueue_script('bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js', '', BP_MEDIA_VERSION);
153
- wp_enqueue_script('bp-media-modal', BP_MEDIA_URL . 'lib/simplemodal/jquery.simplemodal-1.4.4.js', '', BP_MEDIA_VERSION);
154
- global $bp;
155
$cur_group_id = NULL;
156
if (bp_is_active("groups"))
157
$cur_group_id = bp_get_current_group_id();
@@ -168,6 +169,7 @@ class BPMediaActions {
168
'displayed_user' => bp_displayed_user_id(),
169
'loggedin_user' => bp_loggedin_user_id(),
170
'current_group' => $cur_group_id,
171
);
172
173
wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
146
* @global type $bp
147
*/
148
function enqueue_scripts_styles() {
149
+ global $bp_media, $bp;
150
wp_enqueue_script('jquery-ui-tabs');
151
wp_enqueue_script('bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js', '', BP_MEDIA_VERSION);
152
wp_enqueue_script('bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js', '', BP_MEDIA_VERSION);
153
+ $lightbox = isset($bp_media->options['enable_lightbox'])?$bp_media->options['enable_lightbox']:0;
154
+ if ( $lightbox )
155
+ wp_enqueue_script('bp-media-modal', BP_MEDIA_URL . 'lib/simplemodal/jquery.simplemodal-1.4.4.js', '', BP_MEDIA_VERSION);
156
$cur_group_id = NULL;
157
if (bp_is_active("groups"))
158
$cur_group_id = bp_get_current_group_id();
169
'displayed_user' => bp_displayed_user_id(),
170
'loggedin_user' => bp_loggedin_user_id(),
171
'current_group' => $cur_group_id,
172
+ 'lightbox' => $lightbox,
173
);
174
175
wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
index.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: BuddyPress Media
4
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.7.2
7
Author: rtCamp
8
Text Domain: buddypress-media
9
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
3
Plugin Name: BuddyPress Media
4
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.7.3
7
Author: rtCamp
8
Text Domain: buddypress-media
9
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
readme.txt CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
6
License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Requires at least: WordPress 3.5 + BuddyPress 1.6
8
Tested up to: WordPress 3.5 + BuddyPress 1.6
9
- Stable tag: 2.7.2
10
11
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
@@ -121,6 +121,10 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
121
122
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
123
124
= 2.7.2 =
125
* Fixes warning related to scalar variables
126
* Improves Group Wall Post handling
@@ -329,5 +333,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
329
* HTML5 Video Tag Support (with fallback)
330
331
== Upgrade Notice ==
332
- = 2.7.2 =
333
- Activity Uploader and lightbox, Bug fixes
6
License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Requires at least: WordPress 3.5 + BuddyPress 1.6
8
Tested up to: WordPress 3.5 + BuddyPress 1.6
9
+ Stable tag: 2.7.3
10
11
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
121
122
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
123
124
+ = 2.7.3 =
125
+ * Added option to toggle lightbox functionality to prevent theme conflicts
126
+ * Minor code revision
127
+
128
= 2.7.2 =
129
* Fixes warning related to scalar variables
130
* Improves Group Wall Post handling
333
* HTML5 Video Tag Support (with fallback)
334
335
== Upgrade Notice ==
336
+ = 2.7.3 =
337
+ Lightbox toggle added