rtMedia for WordPress, BuddyPress and bbPress - Version 3.4.2

Version Description

  • Bug fixes
Download this release

Release Info

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

Code changes from version 3.4.1 to 3.4.2

app/admin/RTMediaFormHandler.php CHANGED
@@ -168,6 +168,31 @@ class RTMediaFormHandler {
168
echo $numObj->get_number($args);
169
}
170
171
static function extract_settings($section_name,$options) {
172
$section = array();
173
foreach ($options as $key => $value) {
@@ -325,7 +350,7 @@ class RTMediaFormHandler {
325
$render = array();
326
$allowed_media_type = $rtmedia->allowed_types;
327
$allowed_media_type = apply_filters("rtmedia_allowed_types", $allowed_media_type);
328
-
329
foreach ($options as $key => $value) {
330
$data = explode('_', $key);
331
if(!isset($render[$data[1]])) {
@@ -465,16 +490,16 @@ class RTMediaFormHandler {
465
466
echo '</div>';
467
}
468
-
469
public static function custom_css_content() {
470
-
471
global $rtmedia;
472
$options = self::extract_settings('styles', $rtmedia->options);
473
$render_data = self::custom_css_render_options($options);
474
-
475
echo '<div class="large-12">';
476
foreach ($render_data as $option) { ?>
477
-
478
<div class="row section">
479
<?php if( $option['args']['key'] == "styles_custom"){ ?>
480
<div class="columns large-12 rtm-custom-css">
@@ -493,12 +518,12 @@ class RTMediaFormHandler {
493
</div>
494
<?php }
495
echo '</div>';
496
-
497
}
498
-
499
static function custom_css_render_options($options) {
500
global $rtmedia;
501
-
502
$render = array(
503
'disable_styles' => array(
504
'title' => __("rtMedia default styles","rtmedia"),
@@ -506,7 +531,7 @@ class RTMediaFormHandler {
506
'args' => array(
507
'id' => 'rtmedia-disable-styles',
508
'key' => 'styles_enabled',
509
- 'value' => $options['styles_enabled']
510
)
511
),
512
'custom_styles' => array(
@@ -515,11 +540,11 @@ class RTMediaFormHandler {
515
'args' => array(
516
'id' => 'rtmedia-custom-css',
517
'key' => 'styles_custom',
518
- 'value' => $options['styles_custom']
519
)
520
)
521
);
522
-
523
return $render;
524
}
525
168
echo $numObj->get_number($args);
169
}
170
171
+ public static function textbox($args) {
172
+ global $rtmedia;
173
+ $options = $rtmedia->options;
174
+ $defaults = array(
175
+ 'key' => '',
176
+ 'desc' => ''
177
+ );
178
+ $args = wp_parse_args($args, $defaults);
179
+ extract($args);
180
+
181
+ if (!isset($value)) {
182
+ trigger_error(__('Please provide "value" in the argument.', 'rtmedia'));
183
+ return;
184
+ }
185
+
186
+ if (!empty($key)) {
187
+ $args['name'] = 'rtmedia-options[' . $key . ']';
188
+ }
189
+
190
+ $args['value'] = $value;
191
+
192
+ $numObj = new rtForm();
193
+ echo $numObj->get_textbox($args);
194
+ }
195
+
196
static function extract_settings($section_name,$options) {
197
$section = array();
198
foreach ($options as $key => $value) {
350
$render = array();
351
$allowed_media_type = $rtmedia->allowed_types;
352
$allowed_media_type = apply_filters("rtmedia_allowed_types", $allowed_media_type);
353
+
354
foreach ($options as $key => $value) {
355
$data = explode('_', $key);
356
if(!isset($render[$data[1]])) {
490
491
echo '</div>';
492
}
493
+
494
public static function custom_css_content() {
495
+
496
global $rtmedia;
497
$options = self::extract_settings('styles', $rtmedia->options);
498
$render_data = self::custom_css_render_options($options);
499
+
500
echo '<div class="large-12">';
501
foreach ($render_data as $option) { ?>
502
+
503
<div class="row section">
504
<?php if( $option['args']['key'] == "styles_custom"){ ?>
505
<div class="columns large-12 rtm-custom-css">
518
</div>
519
<?php }
520
echo '</div>';
521
+
522
}
523
+
524
static function custom_css_render_options($options) {
525
global $rtmedia;
526
+
527
$render = array(
528
'disable_styles' => array(
529
'title' => __("rtMedia default styles","rtmedia"),
531
'args' => array(
532
'id' => 'rtmedia-disable-styles',
533
'key' => 'styles_enabled',
534
+ 'value' => $options['styles_enabled']
535
)
536
),
537
'custom_styles' => array(
540
'args' => array(
541
'id' => 'rtmedia-custom-css',
542
'key' => 'styles_custom',
543
+ 'value' => $options['styles_custom']
544
)
545
)
546
);
547
+
548
return $render;
549
}
550
app/assets/js/rtMedia.js CHANGED
@@ -17,7 +17,7 @@ function apply_rtMagnificPopup(selector){
17
gallery: {
18
enabled: true,
19
navigateByImgClick: true,
20
- arrowMarkup: '',// disabled default arrows
21
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
22
},
23
image: {
@@ -34,7 +34,7 @@ function apply_rtMagnificPopup(selector){
34
},
35
callbacks: {
36
ajaxContentAdded: function() {
37
-
38
// When last second media is encountered in lightbox, load more medias if available
39
var mfp = jQuery.magnificPopup.instance;
40
var current_media = mfp.currItem.el;
@@ -56,13 +56,13 @@ function apply_rtMagnificPopup(selector){
56
//mfp.updateItemHTML();
57
}
58
}
59
-
60
var items = mfp.items.length;
61
if(mfp.index == (items -1) && !(li.is(":last-child"))){
62
current_media.click();
63
return;
64
}
65
-
66
$container = this.content.find('.tagcontainer');
67
if ($container.length > 0) {
68
$context = $container.find('img');
@@ -76,7 +76,7 @@ function apply_rtMagnificPopup(selector){
76
var settings = {};
77
78
if (typeof _wpmejsSettings !== 'undefined')
79
- settings.pluginPath = _wpmejsSettings.pluginPath;
80
$('.mfp-content .wp-audio-shortcode,.mfp-content .wp-video-shortcode,.mfp-content .bp_media_content video').mediaelementplayer({
81
// if the <video width> is not specified, this is the default
82
defaultVideoWidth: 480,
@@ -134,9 +134,10 @@ var rtMediaHook = {
134
}
135
}
136
jQuery('document').ready(function($) {
137
-
138
- $('.rtmedia-single-container').foundation(); //for foundation Section(tabs) single media edit.
139
-
140
$("#rt_media_comment_form").submit(function(e) {
141
if ($.trim($("#comment_content").val()) == "") {
142
alert( rtmedia_empty_comment_msg );
@@ -155,7 +156,7 @@ jQuery('document').ready(function($) {
155
if (typeof(rtmedia_lightbox_enabled) != 'undefined' && rtmedia_lightbox_enabled == "1") {
156
apply_rtMagnificPopup('.rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.widget-item-listing,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container');
157
}
158
-
159
jQuery('.rtmedia-container').on('click', '.select-all', function(e) {
160
e.preventDefault();
161
jQuery(this).toggleClass('unselect-all').toggleClass('select-all');
@@ -269,7 +270,7 @@ jQuery('document').ready(function($) {
269
}else{
270
alert(rtmedia_no_media_selected);
271
}
272
-
273
});
274
275
function rtmedia_media_view_counts() {
@@ -303,11 +304,11 @@ jQuery('document').ready(function($) {
303
e.preventDefault();
304
jQuery('#comment_content').focus();
305
});
306
-
307
- jQuery(".rtm-more").shorten({ // shorten the media description to 100 characters
308
"showChars" : 130
309
});
310
-
311
//show gallery title in lightbox at bottom
312
var gal_title = $('.rtm-gallery-title'), title = "";
313
if(! $.isEmptyObject(gal_title) ){
@@ -318,19 +319,19 @@ jQuery('document').ready(function($) {
318
if( title != ""){
319
$('.rtm-ltb-gallery-title .ltb-title').html(title);
320
}
321
-
322
//show the index of the current image
323
// var index = jQuery.magnificPopup.instance.index;
324
// $('.media-index').html(index+1);
325
-
326
//show image counts
327
var counts = $('#subnav.item-list-tabs li.selected span').html();
328
$('li.total').html(counts);
329
-
330
return true;
331
}
332
);
333
-
334
function rtmedia_init_popup_navigation() {
335
var rtm_mfp = jQuery.magnificPopup.instance;
336
jQuery('.mfp-arrow-right').on('click', function(e) {
@@ -411,7 +412,7 @@ jQuery('document').ready(function($) {
411
// jQuery(document).on('click', '#rtm_show_upload_ui', function(){
412
// jQuery('#rtm-media-gallery-uploader').slideToggle();
413
// });
414
-
415
//drop-down js
416
function init_action_dropdown() {
417
$('.click-nav > span').toggleClass('no-js js');
@@ -428,16 +429,18 @@ jQuery('document').ready(function($) {
428
$('.click-nav ul', this).hide();
429
}
430
});
431
-
432
//get focus on comment textarea when comment-link is clicked
433
jQuery('.rtmedia-comment-link').on('click', function(e){
434
e.preventDefault();
435
jQuery('#comment_content').focus();
436
});
437
-
438
- $(".rtm-more").shorten({ // shorten the media description to 100 characters
439
- "showChars" : 200
440
- });
441
});
442
443
@@ -447,29 +450,29 @@ function bp_media_create_element(id) {
447
return false;
448
}
449
450
- /*
451
* To change this license header, choose License Headers in Project Properties.
452
* To change this template file, choose Tools | Templates
453
* and open the template in the editor.
454
*/
455
(function($) {
456
$.fn.shorten = function (settings) {
457
-
458
var config = {
459
showChars: 100,
460
ellipsesText: "...",
461
moreText: "more",
462
lessText: "less"
463
};
464
-
465
if (settings) {
466
$.extend(config, settings);
467
}
468
-
469
$(document).off("click", '.morelink');
470
-
471
$(document).on({click: function () {
472
-
473
var $this = $(this);
474
if ($this.hasClass('less')) {
475
$this.removeClass('less');
@@ -483,11 +486,11 @@ function bp_media_create_element(id) {
483
return false;
484
}
485
}, '.morelink');
486
-
487
return this.each(function () {
488
var $this = $(this);
489
if($this.hasClass("shortened")) return;
490
-
491
$this.addClass("shortened");
492
var content = $this.html();
493
if (content.length > config.showChars) {
@@ -498,7 +501,7 @@ function bp_media_create_element(id) {
498
$(".morecontent span").hide();
499
}
500
});
501
-
502
};
503
-
504
- })(jQuery);
17
gallery: {
18
enabled: true,
19
navigateByImgClick: true,
20
+ arrowMarkup: '',// disabled default arrows
21
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
22
},
23
image: {
34
},
35
callbacks: {
36
ajaxContentAdded: function() {
37
+
38
// When last second media is encountered in lightbox, load more medias if available
39
var mfp = jQuery.magnificPopup.instance;
40
var current_media = mfp.currItem.el;
56
//mfp.updateItemHTML();
57
}
58
}
59
+
60
var items = mfp.items.length;
61
if(mfp.index == (items -1) && !(li.is(":last-child"))){
62
current_media.click();
63
return;
64
}
65
+
66
$container = this.content.find('.tagcontainer');
67
if ($container.length > 0) {
68
$context = $container.find('img');
76
var settings = {};
77
78
if (typeof _wpmejsSettings !== 'undefined')
79
+ settings.pluginPath = _wpmejsSettings.pluginPath;
80
$('.mfp-content .wp-audio-shortcode,.mfp-content .wp-video-shortcode,.mfp-content .bp_media_content video').mediaelementplayer({
81
// if the <video width> is not specified, this is the default
82
defaultVideoWidth: 480,
134
}
135
}
136
jQuery('document').ready(function($) {
137
+ if( jQuery('.rtmedia-single-container').length > 0 ){
138
+ $('.rtmedia-single-container').foundation(); //for foundation Section(tabs) single media edit.
139
+ }
140
+
141
$("#rt_media_comment_form").submit(function(e) {
142
if ($.trim($("#comment_content").val()) == "") {
143
alert( rtmedia_empty_comment_msg );
156
if (typeof(rtmedia_lightbox_enabled) != 'undefined' && rtmedia_lightbox_enabled == "1") {
157
apply_rtMagnificPopup('.rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.widget-item-listing,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container');
158
}
159
+
160
jQuery('.rtmedia-container').on('click', '.select-all', function(e) {
161
e.preventDefault();
162
jQuery(this).toggleClass('unselect-all').toggleClass('select-all');
270
}else{
271
alert(rtmedia_no_media_selected);
272
}
273
+
274
});
275
276
function rtmedia_media_view_counts() {
304
e.preventDefault();
305
jQuery('#comment_content').focus();
306
});
307
+
308
+ jQuery(".rtm-more").shorten({ // shorten the media description to 100 characters
309
"showChars" : 130
310
});
311
+
312
//show gallery title in lightbox at bottom
313
var gal_title = $('.rtm-gallery-title'), title = "";
314
if(! $.isEmptyObject(gal_title) ){
319
if( title != ""){
320
$('.rtm-ltb-gallery-title .ltb-title').html(title);
321
}
322
+
323
//show the index of the current image
324
// var index = jQuery.magnificPopup.instance.index;
325
// $('.media-index').html(index+1);
326
+
327
//show image counts
328
var counts = $('#subnav.item-list-tabs li.selected span').html();
329
$('li.total').html(counts);
330
+
331
return true;
332
}
333
);
334
+
335
function rtmedia_init_popup_navigation() {
336
var rtm_mfp = jQuery.magnificPopup.instance;
337
jQuery('.mfp-arrow-right').on('click', function(e) {
412
// jQuery(document).on('click', '#rtm_show_upload_ui', function(){
413
// jQuery('#rtm-media-gallery-uploader').slideToggle();
414
// });
415
+
416
//drop-down js
417
function init_action_dropdown() {
418
$('.click-nav > span').toggleClass('no-js js');
429
$('.click-nav ul', this).hide();
430
}
431
});
432
+
433
//get focus on comment textarea when comment-link is clicked
434
jQuery('.rtmedia-comment-link').on('click', function(e){
435
e.preventDefault();
436
jQuery('#comment_content').focus();
437
});
438
+
439
+ if( jQuery('.rtm-more').length > 0 ){
440
+ $(".rtm-more").shorten({ // shorten the media description to 100 characters
441
+ "showChars" : 200
442
+ });
443
+ }
444
});
445
446
450
return false;
451
}
452
453
+ /*
454
* To change this license header, choose License Headers in Project Properties.
455
* To change this template file, choose Tools | Templates
456
* and open the template in the editor.
457
*/
458
(function($) {
459
$.fn.shorten = function (settings) {
460
+
461
var config = {
462
showChars: 100,
463
ellipsesText: "...",
464
moreText: "more",
465
lessText: "less"
466
};
467
+
468
if (settings) {
469
$.extend(config, settings);
470
}
471
+
472
$(document).off("click", '.morelink');
473
+
474
$(document).on({click: function () {
475
+
476
var $this = $(this);
477
if ($this.hasClass('less')) {
478
$this.removeClass('less');
486
return false;
487
}
488
}, '.morelink');
489
+
490
return this.each(function () {
491
var $this = $(this);
492
if($this.hasClass("shortened")) return;
493
+
494
$this.addClass("shortened");
495
var content = $this.html();
496
if (content.length > config.showChars) {
501
$(".morecontent span").hide();
502
}
503
});
504
+
505
};
506
+
507
+ })(jQuery);
app/helper/RTMediaSettings.php CHANGED
@@ -11,8 +11,12 @@ if (!class_exists('RTMediaSettings')) {
11
class RTMediaSettings {
12
13
public function __construct() {
14
- if (!(defined('DOING_AJAX') && DOING_AJAX))
15
- add_action('admin_init', array($this, 'settings'));
16
// if (is_multisite()) {
17
// add_action('network_admin_notices', array($this, 'privacy_notice'));
18
// } else {
@@ -111,12 +115,14 @@ if (!class_exists('RTMediaSettings')) {
111
$options = $this->sanitize_before_save_options($options);
112
$options = apply_filters("rtmedia_pro_options_save_settings", $options);
113
rtmedia_update_site_option('rtmedia-options', $options);
114
global $rtmedia;
115
$rtmedia->options = $options;
116
}
117
$rtmedia_addon = new RTMediaAddon();
118
add_settings_section('rtm-addons', __('BuddyPress Media Addons for Photos', 'rtmedia'), array($rtmedia_addon, 'get_addons'), 'rtmedia-addons');
119
- $rtmedia_support = new RTMediaSupport(false);
120
add_settings_section('rtm-support', __('Support', 'rtmedia'), array($rtmedia_support, 'get_support_content'), 'rtmedia-support');
121
122
// if (!BPMediaPrivacy::is_installed()) {
@@ -129,7 +135,7 @@ if (!class_exists('RTMediaSettings')) {
129
//register_setting('rtmedia', 'rtmedia_options', array($this, 'sanitize'));
130
}
131
132
- public function network_notices() {
133
$flag = 1;
134
if (rtmedia_get_site_option('rtm-media-enable', false)) {
135
echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . rtmedia_get_site_option('rtm-media-enable') . '</strong></p></div>';
11
class RTMediaSettings {
12
13
public function __construct() {
14
+ if (!(defined('DOING_AJAX') && DOING_AJAX)) {
15
+ add_action('admin_init', array($this, 'settings'));
16
+ if (isset($_POST['rtmedia-options-save'])) {
17
+ add_action('init', array($this, 'settings'));
18
+ }
19
+ }
20
// if (is_multisite()) {
21
// add_action('network_admin_notices', array($this, 'privacy_notice'));
22
// } else {
115
$options = $this->sanitize_before_save_options($options);
116
$options = apply_filters("rtmedia_pro_options_save_settings", $options);
117
rtmedia_update_site_option('rtmedia-options', $options);
118
+ flush_rewrite_rules(false);
119
+ wp_redirect($_SERVER['HTTP_REFERER']);
120
global $rtmedia;
121
$rtmedia->options = $options;
122
}
123
$rtmedia_addon = new RTMediaAddon();
124
add_settings_section('rtm-addons', __('BuddyPress Media Addons for Photos', 'rtmedia'), array($rtmedia_addon, 'get_addons'), 'rtmedia-addons');
125
+ $rtmedia_support = new RTMediaSupport(false);
126
add_settings_section('rtm-support', __('Support', 'rtmedia'), array($rtmedia_support, 'get_support_content'), 'rtmedia-support');
127
128
// if (!BPMediaPrivacy::is_installed()) {
135
//register_setting('rtmedia', 'rtmedia_options', array($this, 'sanitize'));
136
}
137
138
+ public function network_notices() {
139
$flag = 1;
140
if (rtmedia_get_site_option('rtm-media-enable', false)) {
141
echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . rtmedia_get_site_option('rtm-media-enable') . '</strong></p></div>';
app/main/controllers/media/RTMediaAlbum.php CHANGED
@@ -26,9 +26,23 @@ class RTMediaAlbum {
26
*/
27
public function __construct () {
28
add_action ( 'init', array( &$this, 'register_post_types' ), 12 );
29
$this->media = new RTMediaMedia();
30
}
31
32
/**
33
* Register Custom Post Types required by rtMedia
34
*/
@@ -47,10 +61,19 @@ class RTMediaAlbum {
47
'search_items' => __ ( 'Search Albums', 'rtmedia' ),
48
'not_found' => __ ( 'No album found', 'rtmedia' ),
49
'not_found_in_trash' => __ ( 'No album found in Trash', 'rtmedia' ),
50
- 'parent_item_colon' => '',
51
'menu_name' => __ ( 'Albums', 'rtmedia' )
52
);
53
54
/* Set up Album post type arguments */
55
$album_args = array(
56
'labels' => $album_labels,
@@ -58,12 +81,12 @@ class RTMediaAlbum {
58
'publicly_queryable' => false,
59
'show_ui' => false,
60
'show_in_menu' => false,
61
- 'query_var' => false,
62
'capability_type' => 'post',
63
'has_archive' => false,
64
- 'hierarchical' => false,
65
'menu_position' => null,
66
- 'rewrite' => false,
67
'supports' => array(
68
'title',
69
'author',
@@ -72,6 +95,7 @@ class RTMediaAlbum {
72
'comments'
73
)
74
);
75
76
/* register Album post type */
77
register_post_type ( 'rtmedia_album', $album_args );
@@ -127,7 +151,7 @@ class RTMediaAlbum {
127
'post_title' => (empty ( $title )) ? __( 'Untitled Album', 'rtmedia' ) : $title,
128
'post_type' => 'rtmedia_album',
129
'post_author' => $author_id,
130
- 'post_status' => 'publish'
131
);
132
133
/* Check whether to create a new album in wp_post table
26
*/
27
public function __construct () {
28
add_action ( 'init', array( &$this, 'register_post_types' ), 12 );
29
+ add_action( 'init', array(&$this,'rtmedia_album_custom_post_status', 13 ));
30
$this->media = new RTMediaMedia();
31
}
32
33
+ function rtmedia_album_custom_post_status() {
34
+ $args = array(
35
+ 'label' => _x( 'hidden', 'Status General Name', 'rtmedia' ),
36
+ 'label_count' => _n_noop( 'Hidden (%s)', 'Hidden (%s)', 'rtmedia' ),
37
+ 'public' => false,
38
+ 'show_in_admin_all_list' => false,
39
+ 'show_in_admin_status_list' => false,
40
+ 'exclude_from_search' => true,
41
+ );
42
+ register_post_status( 'hidden', $args );
43
+ }
44
+
45
+
46
/**
47
* Register Custom Post Types required by rtMedia
48
*/
61
'search_items' => __ ( 'Search Albums', 'rtmedia' ),
62
'not_found' => __ ( 'No album found', 'rtmedia' ),
63
'not_found_in_trash' => __ ( 'No album found in Trash', 'rtmedia' ),
64
+ 'parent_item_colon' => __('Parent','rtmedia'),
65
'menu_name' => __ ( 'Albums', 'rtmedia' )
66
);
67
68
+ $album_slug = apply_filters('rtmedia_album_rewrite_slug','rtmedia-album');
69
+
70
+ $rewrite = array(
71
+ 'slug' => $album_slug,
72
+ 'with_front' => false,
73
+ 'pages' => false,
74
+ 'feeds' => false,
75
+ );
76
+
77
/* Set up Album post type arguments */
78
$album_args = array(
79
'labels' => $album_labels,
81
'publicly_queryable' => false,
82
'show_ui' => false,
83
'show_in_menu' => false,
84
+ 'query_var' => "rtmedia_album",
85
'capability_type' => 'post',
86
'has_archive' => false,
87
+ 'hierarchical' => true,
88
'menu_position' => null,
89
+ 'rewrite' => $rewrite,
90
'supports' => array(
91
'title',
92
'author',
95
'comments'
96
)
97
);
98
+ $album_args = apply_filters('rtmedia_albums_args',$album_args);
99
100
/* register Album post type */
101
register_post_type ( 'rtmedia_album', $album_args );
151
'post_title' => (empty ( $title )) ? __( 'Untitled Album', 'rtmedia' ) : $title,
152
'post_type' => 'rtmedia_album',
153
'post_author' => $author_id,
154
+ 'post_status' => 'hidden'
155
);
156
157
/* Check whether to create a new album in wp_post table
app/main/controllers/media/RTMediaComment.php CHANGED
@@ -84,13 +84,21 @@ class RTMediaComment {
84
$comment = get_comment( $id );
85
}
86
87
- if(!is_rt_admin() && isset( $comment->user_id ) && $comment->user_id != get_current_user_id() )
88
- return;
89
-
90
- $comment_deleted = $this->rtmedia_comment_model->delete($id);
91
-
92
- do_action('rtmedia_after_remove_comment', $id);
93
-
94
- return $comment_deleted;
95
}
96
}
84
$comment = get_comment( $id );
85
}
86
87
+ if(isset($comment->comment_post_ID) && isset( $comment->user_id )){
88
+ $model = new RTMediaModel();
89
+ //get the current media from the comment_post_ID
90
+ $media = $model->get(array('media_id' => $comment->comment_post_ID));
91
+ $media_author = $media[0]->media_author;
92
+ // if user is comment creator, or media uploader or admin, allow to delete
93
+ if( isset( $media[0]->media_author ) && ( is_rt_admin() || $comment->user_id == get_current_user_id() || $media[0]->media_author = get_current_user_id()) ) {
94
+
95
+ $comment_deleted = $this->rtmedia_comment_model->delete($id);
96
+
97
+ do_action('rtmedia_after_remove_comment', $id);
98
+
99
+ return $comment_deleted;
100
+ }
101
+ }
102
+ return false;
103
}
104
}
app/main/controllers/template/rt-template-functions.php CHANGED
@@ -51,7 +51,7 @@ function rtmedia_title () {
51
52
function get_rtmedia_gallery_title () {
53
global $rtmedia_query;
54
- $title = '';
55
if( isset( $rtmedia_query->media_query['media_type'] ) && !is_array( $rtmedia_query->media_query['media_type']) && $rtmedia_query->media_query['media_type'] != "") {
56
57
if($rtmedia_query->media_query['media_type'] == "music") {
@@ -66,7 +66,8 @@ function get_rtmedia_gallery_title () {
66
$id = $rtmedia_query->media_query['album_id'];
67
return get_rtmedia_title($id);
68
}
69
- return false;
70
}
71
72
function get_rtmedia_title($id) {
@@ -399,6 +400,10 @@ function rtmedia_delete_allowed () {
399
400
$flag = $rtmedia_media->media_author == get_current_user_id ();
401
402
if(!$flag)
403
$flag = is_super_admin ();
404
@@ -668,7 +673,9 @@ function rmedia_single_comment ( $comment ) {
668
$html .= '<span class ="rtmedia-comment-author">'
669
. '' . $user_name . '</span>';
670
$html .= '<span class="rtmedia-comment-content">' . $comment[ 'comment_content' ] . '</span>';
671
- if(isset( $comment['user_id'] ) && ( is_rt_admin() || ( get_current_user_id() == $comment['user_id'] )) ){ // show delete button for comment author and admins
672
$html .= '<i data-id="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment rtmicon-times" title="' . __('Delete Comment') .'"></i>';
673
}
674
@@ -1940,6 +1947,23 @@ function rtmedia_delete_uploaded_media() {
1940
1941
}
1942
1943
//update the group media privacy according to the group privacy settings when group settings are changed
1944
add_action( 'groups_settings_updated', 'update_group_media_privacy', 99,1);
1945
function update_group_media_privacy( $group_id ) {
@@ -1964,4 +1988,4 @@ function update_group_media_privacy( $group_id ) {
1964
}
1965
1966
}
1967
- }
51
52
function get_rtmedia_gallery_title () {
53
global $rtmedia_query;
54
+ $title = false;
55
if( isset( $rtmedia_query->media_query['media_type'] ) && !is_array( $rtmedia_query->media_query['media_type']) && $rtmedia_query->media_query['media_type'] != "") {
56
57
if($rtmedia_query->media_query['media_type'] == "music") {
66
$id = $rtmedia_query->media_query['album_id'];
67
return get_rtmedia_title($id);
68
}
69
+ $title = apply_filters('rtmedia_gallery_title',$title);
70
+ return $title;
71
}
72
73
function get_rtmedia_title($id) {
400
401
$flag = $rtmedia_media->media_author == get_current_user_id ();
402
403
+ if( isset($rtmedia_media->context) && $rtmedia_media->context == 'group' && function_exists('bp_group_is_admin')){
404
+ $flag = ( bp_group_is_admin() || bp_group_is_mod());
405
+ }
406
+
407
if(!$flag)
408
$flag = is_super_admin ();
409
673
$html .= '<span class ="rtmedia-comment-author">'
674
. '' . $user_name . '</span>';
675
$html .= '<span class="rtmedia-comment-content">' . $comment[ 'comment_content' ] . '</span>';
676
+
677
+ global $rtmedia_media;
678
+ if(isset( $comment['user_id'] ) && isset( $rtmedia_media->media_author) && ( is_rt_admin() || ( get_current_user_id() == $comment['user_id'] || $rtmedia_media->media_author == get_current_user_id() )) ){ // show delete button for comment author and admins
679
$html .= '<i data-id="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment rtmicon-times" title="' . __('Delete Comment') .'"></i>';
680
}
681
1947
1948
}
1949
1950
+ function rtmedia_is_edit_page($new_edit = null){
1951
+ global $pagenow;
1952
+ //make sure we are on the backend
1953
+ if (!is_admin()) {
1954
+ return false;
1955
+ }
1956
+ if($new_edit == "edit") {
1957
+ return in_array( $pagenow, array( 'post.php', ) );
1958
+ }
1959
+ elseif($new_edit == "new") { //check for new post page
1960
+ return in_array( $pagenow, array( 'post-new.php' ) );
1961
+ }
1962
+ else { //check for either new or edit
1963
+ return in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
1964
+ }
1965
+ }
1966
+
1967
//update the group media privacy according to the group privacy settings when group settings are changed
1968
add_action( 'groups_settings_updated', 'update_group_media_privacy', 99,1);
1969
function update_group_media_privacy( $group_id ) {
1988
}
1989
1990
}
1991
+ }
app/main/controllers/upload/RTMediaUploadEndpoint.php CHANGED
@@ -30,18 +30,19 @@ class RTMediaUploadEndpoint {
30
}
31
$rtupload = false;
32
$activity_id = -1;
33
if ( wp_verify_nonce ( $nonce, 'rtmedia_upload_nonce' ) ) {
34
$model = new RTMediaUploadModel();
35
$this->upload = $model->set_post_object ();
36
if ( isset ( $_POST[ 'activity_id' ] ) && $_POST[ 'activity_id' ] != -1 ) {
37
$this->upload[ 'activity_id' ] = $_POST[ 'activity_id' ];
38
$activity_id = $_POST[ 'activity_id' ];
39
-
40
}
41
-
42
// ////if media upload is being made for a group, identify the group privacy and set media privacy accordingly
43
if( isset( $this->upload[ 'context' ] ) && isset( $this->upload[ 'context_id' ] ) && $this->upload[ 'context' ] == 'group' && function_exists('groups_get_group') ){
44
-
45
$group = groups_get_group( array( 'group_id' => $this->upload[ 'context_id' ] ) );
46
if( isset($group->status) && $group->status != 'public'){
47
// if group is not public, then set media privacy as 20, so only the group members can see the images
@@ -50,9 +51,9 @@ class RTMediaUploadEndpoint {
50
// if group is public, then set media privacy as 0
51
$this->upload[ 'privacy' ] = '0';
52
}
53
-
54
}
55
-
56
$rtupload = new RTMediaUpload ( $this->upload );
57
$mediaObj = new RTMediaMedia();
58
$media = $mediaObj->model->get ( array( 'id' => $rtupload->media_ids[ 0 ] ) );
@@ -95,42 +96,42 @@ class RTMediaUploadEndpoint {
95
}
96
}
97
98
- }
99
- if(isset($this->upload['rtmedia_simple_file_upload']) && $this->upload['rtmedia_simple_file_upload'] == true ) {
100
$redirect_url = "";
101
- if ( isset ( $_POST[ "redirect" ] ) ) {
102
- if ( intval ( $_POST[ "redirect" ] ) > 1 ) {
103
- //bulkurl
104
- if ( $media[ 0 ]->context == "group" ) {
105
- $redirect_url = trailingslashit ( get_rtmedia_group_link ( $media[ 0 ]->context_id ) ) . RTMEDIA_MEDIA_SLUG;
106
- } else {
107
- $redirect_url = trailingslashit ( get_rtmedia_user_link ( $media[ 0 ]->media_author ) ) . RTMEDIA_MEDIA_SLUG;
108
- }
109
- } else {
110
- $redirect_url = get_rtmedia_permalink ( $media[ 0 ]->id );
111
- }
112
- $redirect_url = apply_filters("rtmedia_simple_file_upload_redirect_url_filter",$redirect_url);
113
- wp_safe_redirect($redirect_url);
114
- die();
115
}
116
- return $media;
117
}
118
}
119
120
- $redirect_url = "";
121
- if ( isset ( $_POST[ "redirect" ] ) && is_numeric ( $_POST[ "redirect" ] ) ) {
122
- if ( intval ( $_POST[ "redirect" ] ) > 1 ) {
123
- //bulkurl
124
- if ( $media[ 0 ]->context == "group" ) {
125
- $redirect_url = trailingslashit ( get_rtmedia_group_link ( $media[ 0 ]->context_id ) ) . RTMEDIA_MEDIA_SLUG;
126
- } else {
127
- $redirect_url = trailingslashit ( get_rtmedia_user_link ( $media[ 0 ]->media_author ) ) . RTMEDIA_MEDIA_SLUG;
128
- }
129
- } else {
130
- $redirect_url = get_rtmedia_permalink ( $media[ 0 ]->id );
131
- }
132
- }
133
-
134
135
// Ha ha ha
136
ob_end_clean ();
30
}
31
$rtupload = false;
32
$activity_id = -1;
33
+ $redirect_url = "";
34
if ( wp_verify_nonce ( $nonce, 'rtmedia_upload_nonce' ) ) {
35
$model = new RTMediaUploadModel();
36
$this->upload = $model->set_post_object ();
37
if ( isset ( $_POST[ 'activity_id' ] ) && $_POST[ 'activity_id' ] != -1 ) {
38
$this->upload[ 'activity_id' ] = $_POST[ 'activity_id' ];
39
$activity_id = $_POST[ 'activity_id' ];
40
+
41
}
42
+
43
// ////if media upload is being made for a group, identify the group privacy and set media privacy accordingly
44
if( isset( $this->upload[ 'context' ] ) && isset( $this->upload[ 'context_id' ] ) && $this->upload[ 'context' ] == 'group' && function_exists('groups_get_group') ){
45
+
46
$group = groups_get_group( array( 'group_id' => $this->upload[ 'context_id' ] ) );
47
if( isset($group->status) && $group->status != 'public'){
48
// if group is not public, then set media privacy as 20, so only the group members can see the images
51
// if group is public, then set media privacy as 0
52
$this->upload[ 'privacy' ] = '0';
53
}
54
+
55
}
56
+
57
$rtupload = new RTMediaUpload ( $this->upload );
58
$mediaObj = new RTMediaMedia();
59
$media = $mediaObj->model->get ( array( 'id' => $rtupload->media_ids[ 0 ] ) );
96
}
97
}
98
99
+ if(isset($this->upload['rtmedia_simple_file_upload']) && $this->upload['rtmedia_simple_file_upload'] == true ) {
100
+
101
+ if ( isset ( $_POST[ "redirect" ] ) ) {
102
+ if ( intval ( $_POST[ "redirect" ] ) > 1 ) {
103
+ //bulkurl
104
+ if ( $media[ 0 ]->context == "group" ) {
105
+ $redirect_url = trailingslashit ( get_rtmedia_group_link ( $media[ 0 ]->context_id ) ) . RTMEDIA_MEDIA_SLUG;
106
+ } else {
107
+ $redirect_url = trailingslashit ( get_rtmedia_user_link ( $media[ 0 ]->media_author ) ) . RTMEDIA_MEDIA_SLUG;
108
+ }
109
+ } else {
110
+ $redirect_url = get_rtmedia_permalink ( $media[ 0 ]->id );
111
+ }
112
+ $redirect_url = apply_filters("rtmedia_simple_file_upload_redirect_url_filter",$redirect_url);
113
+ wp_safe_redirect($redirect_url);
114
+ die();
115
+ }
116
+ return $media;
117
+ }
118
+
119
$redirect_url = "";
120
+ if ( isset ( $_POST[ "redirect" ] ) && is_numeric ( $_POST[ "redirect" ] ) ) {
121
+ if ( intval ( $_POST[ "redirect" ] ) > 1 ) {
122
+ //bulkurl
123
+ if ( $media[ 0 ]->context == "group" ) {
124
+ $redirect_url = trailingslashit ( get_rtmedia_group_link ( $media[ 0 ]->context_id ) ) . RTMEDIA_MEDIA_SLUG;
125
+ } else {
126
+ $redirect_url = trailingslashit ( get_rtmedia_user_link ( $media[ 0 ]->media_author ) ) . RTMEDIA_MEDIA_SLUG;
127
+ }
128
+ } else {
129
+ $redirect_url = get_rtmedia_permalink ( $media[ 0 ]->id );
130
+ }
131
}
132
}
133
}
134
135
136
// Ha ha ha
137
ob_end_clean ();
app/main/routers/RTMediaRouter.php CHANGED
@@ -73,6 +73,7 @@ class RTMediaRouter {
73
global $wp_query;
74
75
$return = isset ( $wp_query->query_vars[ $this->slug ] );
76
if ( $return ) {
77
if ( isset ( $wp_query->query_vars[ 'action' ] ) && $wp_query->query_vars[ 'action' ] == 'bp_avatar_upload' )
78
$return = false;
@@ -160,16 +161,22 @@ class RTMediaRouter {
160
*/
161
function rt_replace_the_content( $content = '' ) {
162
// Do we have new content to replace the old content?
163
- global $new_rt_template;
164
- load_template($new_rt_template);
165
- return '';
166
- $new_content = apply_filters( 'bp_replace_the_content', $content );
167
168
// Juggle the content around and try to prevent unsightly comments
169
- if ( !empty( $new_content ) && ( $new_content !== $content ) ) {
170
171
// Set the content to be the new content
172
- $content = $new_content;
173
174
// Clean up after ourselves
175
unset( $new_content );
@@ -331,8 +338,10 @@ function rt_theme_compat_reset_post( $args = array() ) {
331
function set_query_vars () {
332
333
global $wp_query;
334
- $query_vars_array = explode ( '/', $wp_query->query_vars[ $this->slug ] );
335
-
336
$this->query_vars = apply_filters ( 'rtmedia_query_vars', $query_vars_array );
337
}
338
73
global $wp_query;
74
75
$return = isset ( $wp_query->query_vars[ $this->slug ] );
76
+ $return = apply_filters('rtmedia_return_is_template',$return,$this->slug);
77
if ( $return ) {
78
if ( isset ( $wp_query->query_vars[ 'action' ] ) && $wp_query->query_vars[ 'action' ] == 'bp_avatar_upload' )
79
$return = false;
161
*/
162
function rt_replace_the_content( $content = '' ) {
163
// Do we have new content to replace the old content?
164
+ global $new_rt_template, $rt_template_content;
165
+ //var_dump($new_rt_template);
166
+ if( !isset( $rt_template_content ) ) {
167
+ ob_start();
168
+ load_template($new_rt_template);
169
+ $rt_template_content = ob_get_contents ();
170
+ ob_end_clean();
171
+ }
172
+ return $rt_template_content;
173
+ $new_content = apply_filters( 'bp_replace_the_content', $rt_template_content );
174
175
// Juggle the content around and try to prevent unsightly comments
176
+ if ( !empty( $new_content ) && ( $new_content !== $rt_template_content ) ) {
177
178
// Set the content to be the new content
179
+ $rt_template_content = $new_content;
180
181
// Clean up after ourselves
182
unset( $new_content );
338
function set_query_vars () {
339
340
global $wp_query;
341
+ $query_vars_array = "";
342
+ if( isset( $wp_query->query_vars[ $this->slug ] ) ) {
343
+ $query_vars_array = explode ( '/', $wp_query->query_vars[ $this->slug ] );
344
+ }
345
$this->query_vars = apply_filters ( 'rtmedia_query_vars', $query_vars_array );
346
}
347
index.php CHANGED
@@ -4,7 +4,7 @@
4
Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
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!
7
- Version: 3.4.1
8
Author: rtCamp
9
Text Domain: rtmedia
10
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
4
Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
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!
7
+ Version: 3.4.2
8
Author: rtCamp
9
Text Domain: rtmedia
10
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.6
8
Tested up to: WordPress 3.7 + BuddyPress 1.8.1
9
- Stable tag: 3.4.1
10
11
Add albums, photo, audio/video encoding, privacy, sharing, front-end uploads & more. All this works mobile/tablets devices.
12
@@ -133,6 +133,9 @@ http://www.youtube.com/watch?v=dJrykKQGDcs
133
134
Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
135
136
= 3.4.1 =
137
* Bug fixes related to media privacy
138
@@ -650,8 +653,8 @@ Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_sou
650
651
== Upgrade Notice ==
652
653
- = 3.4.1 =
654
- Requires BuddyPress 1.7 or higher, if using BuddyPress. Bug fixes related to media privacy.
655
656
== Sponsors ==
657
6
License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Requires at least: WordPress 3.6
8
Tested up to: WordPress 3.7 + BuddyPress 1.8.1
9
+ Stable tag: 3.4.2
10
11
Add albums, photo, audio/video encoding, privacy, sharing, front-end uploads & more. All this works mobile/tablets devices.
12
133
134
Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
135
136
+ = 3.4.2 =
137
+ * Bug fixes
138
+
139
= 3.4.1 =
140
* Bug fixes related to media privacy
141
653
654
== Upgrade Notice ==
655
656
+ = 3.4.2 =
657
+ Requires BuddyPress 1.7 or higher, if using BuddyPress. Bug fixes.
658
659
== Sponsors ==
660