Version Description
- Fixes errors due to absence of EXIF
- Fixes duplicate comment box on lightbox
- Fixes multimedia display on single media view
- Rewrites activity uploader to fix a lot of issues with themes
Download this release
Release Info
Developer | saurabhshukla |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 2.7.6 |
Comparing to | |
See all releases |
Code changes from version 2.7.5 to 2.7.6
- app/admin/BPMediaAdmin.php +15 -0
- app/assets/js/admin.js +226 -147
- app/assets/js/bp-media-activity-uploader.js +216 -138
- app/assets/js/main.js +10 -5
- app/helper/BPMediaSettings.php +9 -1
- app/importers/BPMediaAlbumimporter.php +221 -0
- app/importers/BPMediaImporter.php +137 -92
- app/main/BuddyPressMedia.php +5 -4
- app/main/activity/BPMediaActivity.php +1 -2
- app/main/includes/BPMediaActions.php +2 -2
- app/main/includes/BPMediaFunction.php +1 -6
- app/main/includes/BPMediaHostWordpress.php +1008 -1001
- index.php +2 -5
- readme.txt +9 -3
app/admin/BPMediaAdmin.php
CHANGED
@@ -27,6 +27,8 @@ if (!class_exists('BPMediaAdmin')) {
|
|
27 |
add_action('wp_ajax_bp_media_submit_request', array($this->bp_media_support, 'submit_request'), 1);
|
28 |
add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
|
29 |
add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
|
|
|
|
|
30 |
add_action('wp_ajax_bp_media_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
|
31 |
add_filter('plugin_row_meta', array($this, 'plugin_meta_premium_addon_link'), 1, 4);
|
32 |
if (is_admin()) {
|
@@ -57,6 +59,9 @@ if (!class_exists('BPMediaAdmin')) {
|
|
57 |
wp_localize_script('bp-media-admin', 'settings_url', add_query_arg(
|
58 |
array('page' => 'bp-media-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
59 |
) . '#privacy_enabled');
|
|
|
|
|
|
|
60 |
wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
|
61 |
}
|
62 |
|
@@ -66,11 +71,17 @@ if (!class_exists('BPMediaAdmin')) {
|
|
66 |
* @global string BP_MEDIA_TXT_DOMAIN
|
67 |
*/
|
68 |
public function menu() {
|
|
|
69 |
add_menu_page(__('BuddyPress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
|
70 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), __('Settings', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
|
71 |
if (!BPMediaPrivacy::is_installed()) {
|
72 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Database Update', BP_MEDIA_TXT_DOMAIN), __('Update Database', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-privacy', array($this, 'privacy_page'));
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
74 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
|
75 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
|
76 |
if (bp_get_option('bp-media-survey', true)) {
|
@@ -89,6 +100,10 @@ if (!class_exists('BPMediaAdmin')) {
|
|
89 |
$this->render_page('bp-media-privacy');
|
90 |
}
|
91 |
|
|
|
|
|
|
|
|
|
92 |
public function convert_videos_page() {
|
93 |
$this->render_page('bp-media-convert-videos');
|
94 |
}
|
27 |
add_action('wp_ajax_bp_media_submit_request', array($this->bp_media_support, 'submit_request'), 1);
|
28 |
add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
|
29 |
add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
|
30 |
+
// add_action('wp_ajax_bp_media_bp_album_import', 'BPMediaAlbumimporter::bpmedia_ajax_import_callback', 1);
|
31 |
+
// add_action('wp_ajax_bp_media_bp_album_cleanup', 'BPMediaAlbumimporter::cleanup_after_install');
|
32 |
add_action('wp_ajax_bp_media_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
|
33 |
add_filter('plugin_row_meta', array($this, 'plugin_meta_premium_addon_link'), 1, 4);
|
34 |
if (is_admin()) {
|
59 |
wp_localize_script('bp-media-admin', 'settings_url', add_query_arg(
|
60 |
array('page' => 'bp-media-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
61 |
) . '#privacy_enabled');
|
62 |
+
wp_localize_script('bp-media-admin', 'settings_bp_album_import_url', add_query_arg(
|
63 |
+
array('page' => 'bp-media-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
64 |
+
));
|
65 |
wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
|
66 |
}
|
67 |
|
71 |
* @global string BP_MEDIA_TXT_DOMAIN
|
72 |
*/
|
73 |
public function menu() {
|
74 |
+
global $wpdb;
|
75 |
add_menu_page(__('BuddyPress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
|
76 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), __('Settings', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
|
77 |
if (!BPMediaPrivacy::is_installed()) {
|
78 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Database Update', BP_MEDIA_TXT_DOMAIN), __('Update Database', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-privacy', array($this, 'privacy_page'));
|
79 |
}
|
80 |
+
$bp_album_active = BPMediaImporter::_active('bp-album/loader.php');
|
81 |
+
$table = "{$wpdb->base_prefix}bp_album";
|
82 |
+
if (BPMediaImporter::table_exists($table) && $bp_album_active!=-1) {
|
83 |
+
add_submenu_page('bp-media-settings', __('BP Album Import', BP_MEDIA_TXT_DOMAIN), __('BP Album Importer', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-bp-album-importer', array($this, 'bp_album_importer_page'));
|
84 |
+
}
|
85 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
|
86 |
add_submenu_page('bp-media-settings', __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
|
87 |
if (bp_get_option('bp-media-survey', true)) {
|
100 |
$this->render_page('bp-media-privacy');
|
101 |
}
|
102 |
|
103 |
+
public function bp_album_importer_page() {
|
104 |
+
$this->render_page('bp-media-bp-album-importer');
|
105 |
+
}
|
106 |
+
|
107 |
public function convert_videos_page() {
|
108 |
$this->render_page('bp-media-convert-videos');
|
109 |
}
|
app/assets/js/admin.js
CHANGED
@@ -1,159 +1,238 @@
|
|
1 |
jQuery(document).ready(function(){
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
/* Select Request */
|
25 |
-
jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
|
26 |
-
if(jQuery(this).val()){
|
27 |
-
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
28 |
-
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
|
29 |
-
var data = {
|
30 |
-
action: 'bp_media_select_request',
|
31 |
-
form: jQuery(this).val()
|
32 |
-
};
|
33 |
-
|
34 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
35 |
-
jQuery.post(ajaxurl, data, function(response) {
|
36 |
-
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
37 |
-
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
|
38 |
-
});
|
39 |
-
}
|
40 |
-
});
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
function
|
75 |
-
return jQuery.post(ajaxurl, data, function(response){
|
76 |
-
if(response != 0){
|
77 |
-
var redirect = false;
|
78 |
-
var progw = Math.ceil((((parseInt(response)*20)+parseInt(data.values['finished']))/parseInt(data.values['total'])) *100);
|
79 |
-
console.log(progw);
|
80 |
-
if(progw>100){progw=100;redirect=true};
|
81 |
-
jQuery('#rtprogressbar>div').css('width',progw+'%');
|
82 |
-
finished = jQuery('#rtprivacyinstaller span.finished').html();
|
83 |
-
jQuery('#rtprivacyinstaller span.finished').html(parseInt(finished)+data.count);
|
84 |
-
if ( redirect ) {
|
85 |
-
jQuery.post(ajaxurl, { action: 'bp_media_privacy_redirect' }, function(response){
|
86 |
-
window.location = settings_url;
|
87 |
-
});
|
88 |
-
}
|
89 |
-
} else {
|
90 |
-
jQuery('#map_progress_msgs').html('<div class="map_mapping_failure">Row '+response+' failed.</div>');
|
91 |
-
}
|
92 |
-
});
|
93 |
-
}
|
94 |
-
|
95 |
-
jQuery('#rtprivacyinstall').click(function(e){
|
96 |
e.preventDefault();
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$values [jQuery(this).attr('name')]=[jQuery(this).val()];
|
105 |
-
|
106 |
-
});
|
107 |
-
$data = {};
|
108 |
-
for(var i=1;i<=$values['steps'][0];i++ ){
|
109 |
-
$count=20;
|
110 |
-
if(i==$values['steps'][0]){
|
111 |
-
$count=parseInt($values['laststep'][0]);
|
112 |
-
if($count==0){$count=20};
|
113 |
-
}
|
114 |
-
newvals = {
|
115 |
-
'page':i,
|
116 |
-
'action':'bp_media_privacy_install',
|
117 |
-
'count':$count,
|
118 |
-
'values':$values
|
119 |
-
}
|
120 |
-
$data[i] = newvals;
|
121 |
-
}
|
122 |
-
var $startingpoint = jQuery.Deferred();
|
123 |
-
$startingpoint.resolve();
|
124 |
-
jQuery.each($data, function(i, v){
|
125 |
-
$startingpoint = $startingpoint.pipe( function() {
|
126 |
-
return fireRequest(v);
|
127 |
-
});
|
128 |
-
});
|
129 |
-
|
130 |
-
|
131 |
-
}
|
132 |
});
|
133 |
-
});
|
134 |
|
135 |
-
jQuery('#
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
jQuery(
|
140 |
-
|
141 |
-
|
142 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
-
jQuery('#video-transcoding-main-container').on('click','.video-transcoding-survey',function(e){
|
145 |
-
e.preventDefault();
|
146 |
-
var data = {
|
147 |
-
action: 'bp_media_convert_videos_form',
|
148 |
-
email: jQuery('.email').val(),
|
149 |
-
url: jQuery('.url').val(),
|
150 |
-
choice: jQuery('input[name="choice"]:checked').val(),
|
151 |
-
interested: jQuery('input[name="interested"]:checked').val()
|
152 |
-
}
|
153 |
-
jQuery.post(ajaxurl, data, function(response){
|
154 |
-
jQuery('#video-transcoding-main-container').html('<p><strong>'+response+'</strong></p>');
|
155 |
});
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
});
|
1 |
jQuery(document).ready(function(){
|
2 |
|
3 |
+
/* Linkback */
|
4 |
+
jQuery('#spread-the-word').on('click','#bp-media-add-linkback',function(){
|
5 |
+
var data = {
|
6 |
+
action: 'bp_media_linkback',
|
7 |
+
linkback: jQuery('#bp-media-add-linkback:checked').length
|
8 |
+
};
|
9 |
+
jQuery.post(bp_media_admin_ajax,data,function(response){
|
10 |
+
});
|
11 |
+
})
|
12 |
+
|
13 |
+
/* Fetch Feed */
|
14 |
+
var bp_media_news_section = jQuery('#latest-news');
|
15 |
+
if(bp_media_news_section.length>0){
|
16 |
+
var data = {
|
17 |
+
action: 'bp_media_fetch_feed'
|
18 |
+
};
|
19 |
+
jQuery.post(bp_media_admin_ajax,data,function(response){
|
20 |
+
bp_media_news_section.find('.inside').html(response);
|
21 |
+
});
|
22 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
/* Select Request */
|
25 |
+
jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
|
26 |
+
if(jQuery(this).val()){
|
27 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
28 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
|
29 |
+
var data = {
|
30 |
+
action: 'bp_media_select_request',
|
31 |
+
form: jQuery(this).val()
|
32 |
+
};
|
33 |
+
|
34 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
35 |
+
jQuery.post(ajaxurl, data, function(response) {
|
36 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
37 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
|
38 |
+
});
|
39 |
+
}
|
40 |
+
});
|
41 |
|
42 |
+
/* Cancel Request */
|
43 |
+
jQuery('#bp-media-settings-boxes').on('click', '#cancel-request', function(){
|
44 |
+
if(jQuery(this).val()){
|
45 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
46 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
|
47 |
+
var data = {
|
48 |
+
action: 'bp_media_cancel_request'
|
49 |
+
};
|
50 |
+
|
51 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
52 |
+
jQuery.post(ajaxurl, data, function(response) {
|
53 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
54 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
|
55 |
+
});
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
/* Submit Request */
|
60 |
+
jQuery('.bp-media-support').on('submit', '#bp_media_settings_form', function(e){
|
61 |
+
e.preventDefault();
|
62 |
+
var data = {
|
63 |
+
action: 'bp_media_submit_request',
|
64 |
+
form_data: jQuery('form').serialize()
|
65 |
+
};
|
66 |
+
|
67 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
68 |
+
jQuery.post(ajaxurl, data, function(response) {
|
69 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
|
70 |
+
jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
|
71 |
+
});
|
72 |
+
});
|
73 |
+
|
74 |
+
function fireRequest(data) {
|
75 |
+
return jQuery.post(ajaxurl, data, function(response){
|
76 |
+
if(response != 0){
|
77 |
+
var redirect = false;
|
78 |
+
var progw = Math.ceil((((parseInt(response)*20)+parseInt(data.values['finished']))/parseInt(data.values['total'])) *100);
|
79 |
+
console.log(progw);
|
80 |
+
if(progw>100){
|
81 |
+
progw=100;
|
82 |
+
redirect=true
|
83 |
+
};
|
84 |
+
jQuery('#rtprogressbar>div').css('width',progw+'%');
|
85 |
+
finished = jQuery('#rtprivacyinstaller span.finished').html();
|
86 |
+
jQuery('#rtprivacyinstaller span.finished').html(parseInt(finished)+data.count);
|
87 |
+
if ( redirect ) {
|
88 |
+
jQuery.post(ajaxurl, {
|
89 |
+
action: 'bp_media_privacy_redirect'
|
90 |
+
}, function(response){
|
91 |
+
window.location = settings_url;
|
92 |
+
});
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
jQuery('#map_progress_msgs').html('<div class="map_mapping_failure">Row '+response+' failed.</div>');
|
96 |
+
}
|
97 |
+
});
|
98 |
+
}
|
99 |
+
|
100 |
+
jQuery('#rtprivacyinstall').click(function(e){
|
101 |
+
e.preventDefault();
|
102 |
+
$progress_parent = jQuery('#rtprivacyinstaller');
|
103 |
+
$progress_parent.find('.rtprivacytype').each(function(){
|
104 |
+
$type=jQuery(this).attr('id');
|
105 |
+
if($type=='total'){
|
106 |
+
$values=[];
|
107 |
+
jQuery(this).find('input').each(function(){
|
108 |
+
|
109 |
+
$values [jQuery(this).attr('name')]=[jQuery(this).val()];
|
110 |
+
|
111 |
+
});
|
112 |
+
$data = {};
|
113 |
+
for(var i=1;i<=$values['steps'][0];i++ ){
|
114 |
+
$count=20;
|
115 |
+
if(i==$values['steps'][0]){
|
116 |
+
$count=parseInt($values['laststep'][0]);
|
117 |
+
if($count==0){
|
118 |
+
$count=20
|
119 |
+
};
|
120 |
+
}
|
121 |
+
newvals = {
|
122 |
+
'page':i,
|
123 |
+
'action':'bp_media_privacy_install',
|
124 |
+
'count':$count,
|
125 |
+
'values':$values
|
126 |
+
}
|
127 |
+
$data[i] = newvals;
|
128 |
+
}
|
129 |
+
var $startingpoint = jQuery.Deferred();
|
130 |
+
$startingpoint.resolve();
|
131 |
+
jQuery.each($data, function(i, v){
|
132 |
+
$startingpoint = $startingpoint.pipe( function() {
|
133 |
+
return fireRequest(v);
|
134 |
+
});
|
135 |
+
});
|
136 |
+
|
137 |
+
|
138 |
+
}
|
139 |
+
});
|
140 |
+
});
|
141 |
+
|
142 |
+
function fireimportRequest(data) {
|
143 |
+
return jQuery.post(ajaxurl, data, function(response){
|
144 |
+
cleanup = false;
|
145 |
+
if(response != 0){
|
146 |
+
var redirect = false;
|
147 |
+
var progw = Math.ceil((((parseInt(response)*20)+parseInt(data.values['finished']))/parseInt(data.values['total'])) *100);
|
148 |
+
if(progw>100){
|
149 |
+
progw=100;
|
150 |
+
cleanup=true
|
151 |
+
};
|
152 |
+
jQuery('#rtprogressbar>div').css('width',progw+'%');
|
153 |
+
finished = jQuery('#bpmedia-bpalbumimport span.finished').html();
|
154 |
+
jQuery('#bpmedia-bpalbumimport span.finished').html(parseInt(finished)+data.count);
|
155 |
+
if ( cleanup ) {
|
156 |
+
window.location = document.URL;
|
157 |
+
}
|
158 |
+
} else {
|
159 |
+
jQuery('#map_progress_msgs').html('<div class="map_mapping_failure">Row '+response+' failed.</div>');
|
160 |
+
}
|
161 |
+
});
|
162 |
+
}
|
163 |
|
164 |
+
jQuery('#bpmedia-bpalbumimport-cleanup').click(function(e){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
e.preventDefault();
|
166 |
+
jQuery.post(ajaxurl, {
|
167 |
+
action: 'bp_media_bp_album_cleanup'
|
168 |
+
}, function(response){
|
169 |
+
window.location = settings_bp_album_import_url;
|
170 |
+
});
|
171 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
});
|
|
|
173 |
|
174 |
+
jQuery('#bpmedia-bpalbumimport').click(function(e){
|
175 |
+
e.preventDefault();
|
176 |
+
$progress_parent = jQuery('#bpmedia-bpalbumimport');
|
177 |
+
$values=[];
|
178 |
+
jQuery(this).parent().find('input').each(function(){
|
179 |
+
$values [jQuery(this).attr('name')]=[jQuery(this).val()];
|
180 |
+
|
181 |
+
});
|
182 |
+
console.log($values);
|
183 |
+
|
184 |
+
$data = {};
|
185 |
+
for(var i=1;i<=$values['steps'][0];i++ ){
|
186 |
+
$count=20;
|
187 |
+
if(i==$values['steps'][0]){
|
188 |
+
$count=parseInt($values['laststep'][0]);
|
189 |
+
if($count==0){
|
190 |
+
$count=20
|
191 |
+
};
|
192 |
+
}
|
193 |
+
newvals = {
|
194 |
+
'page':i,
|
195 |
+
'action':'bp_media_bp_album_import',
|
196 |
+
'count':$count,
|
197 |
+
'values':$values
|
198 |
+
}
|
199 |
+
$data[i] = newvals;
|
200 |
+
}
|
201 |
+
console.log($data);
|
202 |
+
var $startingpoint = jQuery.Deferred();
|
203 |
+
$startingpoint.resolve();
|
204 |
+
jQuery.each($data, function(i, v){
|
205 |
+
$startingpoint = $startingpoint.pipe( function() {
|
206 |
+
return fireimportRequest(v);
|
207 |
+
});
|
208 |
+
});
|
209 |
+
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
});
|
212 |
+
|
213 |
+
jQuery('#bp-media-settings-boxes').on('click','.interested',function(){
|
214 |
+
jQuery('.interested-container').removeClass('hidden');
|
215 |
+
jQuery('.choice-free').attr('required','required');
|
216 |
+
});
|
217 |
+
jQuery('#bp-media-settings-boxes').on('click','.not-interested',function(){
|
218 |
+
jQuery('.interested-container').addClass('hidden');
|
219 |
+
jQuery('.choice-free').removeAttr('required');
|
220 |
+
});
|
221 |
+
|
222 |
+
jQuery('#video-transcoding-main-container').on('click','.video-transcoding-survey',function(e){
|
223 |
+
e.preventDefault();
|
224 |
+
var data = {
|
225 |
+
action: 'bp_media_convert_videos_form',
|
226 |
+
email: jQuery('.email').val(),
|
227 |
+
url: jQuery('.url').val(),
|
228 |
+
choice: jQuery('input[name="choice"]:checked').val(),
|
229 |
+
interested: jQuery('input[name="interested"]:checked').val()
|
230 |
+
}
|
231 |
+
jQuery.post(ajaxurl, data, function(response){
|
232 |
+
jQuery('#video-transcoding-main-container').html('<p><strong>'+response+'</strong></p>');
|
233 |
+
});
|
234 |
+
return false;
|
235 |
+
});
|
236 |
+
|
237 |
|
238 |
});
|
app/assets/js/bp-media-activity-uploader.js
CHANGED
@@ -4,142 +4,220 @@
|
|
4 |
*/
|
5 |
|
6 |
jQuery(document).ready(function(){
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
});
|
4 |
*/
|
5 |
|
6 |
jQuery(document).ready(function(){
|
7 |
+
if ( jQuery('#bp-media-activity-upload-ui').length > 0 ) {
|
8 |
+
|
9 |
+
jQuery('#whats-new').off('focus');
|
10 |
+
jQuery('#whats-new').on('focus', function(){
|
11 |
+
jQuery("#whats-new-options").css('height','auto');
|
12 |
+
jQuery("form#whats-new-form textarea").animate({
|
13 |
+
height:'50px'
|
14 |
+
});
|
15 |
+
jQuery("#aw-whats-new-submit").prop("disabled", false);
|
16 |
+
});
|
17 |
+
|
18 |
+
jQuery("input#aw-whats-new-submit").off('click');
|
19 |
+
jQuery("input#aw-whats-new-submit").on('click',function() {
|
20 |
+
var button = jQuery(this);
|
21 |
+
var form = button.parent().parent().parent().parent();
|
22 |
+
|
23 |
+
form.children().each( function() {
|
24 |
+
if ( jQuery.nodeName(this, "textarea") || jQuery.nodeName(this, "input") )
|
25 |
+
jQuery(this).prop( 'disabled', true );
|
26 |
+
});
|
27 |
+
|
28 |
+
/* Remove any errors */
|
29 |
+
jQuery('div.error').remove();
|
30 |
+
button.addClass('loading');
|
31 |
+
button.prop('disabled', true);
|
32 |
+
|
33 |
+
/* Default POST values */
|
34 |
+
var object = '';
|
35 |
+
var item_id = jQuery("#whats-new-post-in").val();
|
36 |
+
var content = jQuery("#bp-media-dummy-update").val();
|
37 |
+
|
38 |
+
/* Set object for non-profile posts */
|
39 |
+
if ( item_id > 0 ) {
|
40 |
+
object = jQuery("#whats-new-post-object").val();
|
41 |
+
}
|
42 |
+
|
43 |
+
jQuery.post( ajaxurl, {
|
44 |
+
action: 'post_update',
|
45 |
+
'cookie': encodeURIComponent(document.cookie),
|
46 |
+
'_wpnonce_post_update': jQuery("input#_wpnonce_post_update").val(),
|
47 |
+
'content': content,
|
48 |
+
'object': object,
|
49 |
+
'item_id': item_id,
|
50 |
+
'_bp_as_nonce': jQuery('#_bp_as_nonce').val() || ''
|
51 |
+
},
|
52 |
+
function(response) {
|
53 |
+
|
54 |
+
form.children().each( function() {
|
55 |
+
if ( jQuery.nodeName(this, "textarea") || jQuery.nodeName(this, "input") ) {
|
56 |
+
jQuery(this).prop( 'disabled', false );
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
/* Check for errors and append if found. */
|
61 |
+
if ( response[0] + response[1] == '-1' ) {
|
62 |
+
form.prepend( response.substr( 2, response.length ) );
|
63 |
+
jQuery( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
|
64 |
+
} else {
|
65 |
+
if ( 0 == jQuery("ul.activity-list").length ) {
|
66 |
+
jQuery("div.error").slideUp(100).remove();
|
67 |
+
jQuery("div#message").slideUp(100).remove();
|
68 |
+
jQuery("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
|
69 |
+
}
|
70 |
+
|
71 |
+
jQuery("ul#activity-stream").prepend(response);
|
72 |
+
jQuery("ul#activity-stream li:first").addClass('new-update');
|
73 |
+
|
74 |
+
if ( 0 != jQuery("#latest-update").length ) {
|
75 |
+
var l = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").html();
|
76 |
+
var v = jQuery("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href');
|
77 |
+
|
78 |
+
var ltext = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").text();
|
79 |
+
|
80 |
+
var u = '';
|
81 |
+
if ( ltext != '' )
|
82 |
+
u = l + ' ';
|
83 |
+
|
84 |
+
u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>';
|
85 |
+
|
86 |
+
jQuery("#latest-update").slideUp(300,function(){
|
87 |
+
jQuery("#latest-update").html( u );
|
88 |
+
jQuery("#latest-update").slideDown(300);
|
89 |
+
});
|
90 |
+
}
|
91 |
+
|
92 |
+
jQuery("li.new-update").hide().slideDown( 300 );
|
93 |
+
jQuery("li.new-update").removeClass( 'new-update' );
|
94 |
+
jQuery("textarea#whats-new").val('');
|
95 |
+
}
|
96 |
+
|
97 |
+
jQuery("#whats-new-options").animate({
|
98 |
+
height:'0px'
|
99 |
+
});
|
100 |
+
jQuery("form#whats-new-form textarea").animate({
|
101 |
+
height:'20px'
|
102 |
+
});
|
103 |
+
jQuery("#aw-whats-new-submit").prop("disabled", true).removeClass('loading');
|
104 |
+
});
|
105 |
+
|
106 |
+
return false;
|
107 |
+
});
|
108 |
+
|
109 |
+
$dummy_update_box = jQuery('<input id="bp-media-dummy-update" type="hidden" name="whats-new" />');
|
110 |
+
$update_container = jQuery('#whats-new-textarea');
|
111 |
+
$update_container.append($dummy_update_box);
|
112 |
+
|
113 |
+
jQuery('#whats-new').on('keyup',function(){
|
114 |
+
$this = jQuery(this);
|
115 |
+
$that = jQuery('#bp-media-update-text');
|
116 |
+
$that.val($this.val()).change();
|
117 |
+
});
|
118 |
+
jQuery('#bp-media-update-text').on('change',function(){
|
119 |
+
bp_media_overwrite();
|
120 |
+
});
|
121 |
+
jQuery('#bp-media-update-json').on('change',function(){
|
122 |
+
bp_media_overwrite();
|
123 |
+
});
|
124 |
+
|
125 |
+
$bp_media_activity_is_multiple_upload = false;
|
126 |
+
$bp_media_activity_uploader=new plupload.Uploader(bp_media_uploader_params);
|
127 |
+
$bp_media_activity_album_selected = false;
|
128 |
+
$bp_media_activity_uploader.init();
|
129 |
+
|
130 |
+
$bp_media_activity_uploader.bind('FilesAdded', function(up, files) {
|
131 |
+
//bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
|
132 |
+
$bp_media_activity_is_multiple_upload = files.length>1;
|
133 |
+
jQuery.each(files, function(i, file) {
|
134 |
+
$bp_media_activity_extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
|
135 |
+
jQuery('#bp-media-activity-uploaded-files').append('<div id="bp-media-activity-progress-'+file.id+'" class="bp-media-progressbar"><div class="bp-media-progress-text">' + file.name + ' (' + plupload.formatSize(file.size) + ')(<b>0%</b>)</div><div class="bp-media-progress-completed"></div></div>');
|
136 |
+
});
|
137 |
+
// bp_media_activity_album_selected = jQuery('#bp-media-activity-selected-album').val();
|
138 |
+
$bp_media_activity_album_selected = default_album;
|
139 |
+
$bp_media_activity_uploader.start();
|
140 |
+
do_bp_jazz();
|
141 |
+
up.refresh(); // Reposition Flash/Silverlight
|
142 |
+
});
|
143 |
+
$bp_media_activity_uploader.bind('UploadProgress', function(up, file) {
|
144 |
+
jQuery('input#aw-whats-new-submit').prop('disabled',true).addClass('loading');
|
145 |
+
jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
|
146 |
+
jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
|
147 |
+
});
|
148 |
+
|
149 |
+
$bp_media_activity_uploader.bind('Error', function(up, err) {
|
150 |
+
jQuery('#bp-media-activity-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
|
151 |
+
', Message: ' + err.message +
|
152 |
+
(err.file ? ', File: ' + err.file.name : '') +
|
153 |
+
'</p></div>'
|
154 |
+
);
|
155 |
+
up.refresh();
|
156 |
+
});
|
157 |
+
$bp_media_activity_uploader.bind('FileUploaded', function(up, file,response) {
|
158 |
+
jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html("100%");
|
159 |
+
$album_arr = [];
|
160 |
+
$val = jQuery('#bp-media-update-json').val();
|
161 |
+
if($val!=''){
|
162 |
+
$album_arr= JSON.parse($val);
|
163 |
+
}
|
164 |
+
$album_arr.push(parseInt(response.response));
|
165 |
+
$album_json =JSON.stringify($album_arr);
|
166 |
+
jQuery('#bp-media-update-json').val($album_json).change();
|
167 |
+
jQuery('#aw-whats-new-submit').prop('disabled',false).removeClass('loading');
|
168 |
+
|
169 |
+
});
|
170 |
+
$bp_media_activity_uploader.bind('BeforeUpload',function(up){
|
171 |
+
up.settings.multipart_params.is_multiple_upload = $bp_media_activity_is_multiple_upload;
|
172 |
+
up.settings.multipart_params.bp_media_album_id = $bp_media_activity_album_selected;
|
173 |
+
up.settings.multipart_params.is_activity = true;
|
174 |
+
});
|
175 |
+
//jQuery("#aw-whats-new-submit").off( 'click');
|
176 |
+
|
177 |
+
jQuery("#aw-whats-new-submit").on( 'click', function() {
|
178 |
+
$latest = '';
|
179 |
+
$val = bp_media_stringify();
|
180 |
+
jQuery("#bp-media-dummy-update").val('');
|
181 |
+
jQuery("#bp-media-update-json").val('');
|
182 |
+
jQuery("#bp-media-update-txt").val('');
|
183 |
+
jQuery("#bp-media-activity-uploaded-files").empty();
|
184 |
+
setTimeout(function(){
|
185 |
+
if($val!=''){
|
186 |
+
$album_arr= JSON.parse($val);
|
187 |
+
$lastid = parseInt($album_arr.length) - 1;
|
188 |
+
$media_id = $album_arr[parseInt($lastid)];
|
189 |
+
$activity = (jQuery('#activity-stream').find('li').first().attr('id')).split('-');
|
190 |
+
$activity_id = $activity[1];
|
191 |
+
var data = {
|
192 |
+
action: 'bp_media_get_latest_activity',
|
193 |
+
content : $val,
|
194 |
+
id: $activity_id
|
195 |
+
};
|
196 |
+
jQuery.get(ajaxurl,data,function(response){
|
197 |
+
$latest = response;
|
198 |
+
jQuery('#latest-update').html($latest);
|
199 |
+
});
|
200 |
+
}
|
201 |
+
},1000);
|
202 |
+
});
|
203 |
+
|
204 |
+
$bp_media_activity_uploader.bind('UploadComplete',function(response){
|
205 |
+
|
206 |
+
});
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
function bp_media_stringify(){
|
211 |
+
$album_json = jQuery('#bp-media-update-json').val();
|
212 |
+
$update_txt = jQuery('#bp-media-update-text').val();
|
213 |
+
$activity = {
|
214 |
+
'media':$album_json,
|
215 |
+
'update_txt':encodeURIComponent($update_txt)
|
216 |
+
};
|
217 |
+
return JSON.stringify($activity);
|
218 |
+
}
|
219 |
+
|
220 |
+
function bp_media_overwrite(){
|
221 |
+
jQuery('#bp-media-dummy-update').val(bp_media_stringify());
|
222 |
+
}
|
223 |
});
|
app/assets/js/main.js
CHANGED
@@ -6,9 +6,12 @@ function bp_media_create_element(id){
|
|
6 |
return false;
|
7 |
}
|
8 |
var $current;
|
|
|
|
|
|
|
9 |
jQuery(document).ready(function(){
|
10 |
|
11 |
-
jQuery('
|
12 |
jQuery(this).mediaelementplayer({
|
13 |
enableKeyboard: false,
|
14 |
startVolume: 1,
|
@@ -19,10 +22,10 @@ jQuery(document).ready(function(){
|
|
19 |
}
|
20 |
});
|
21 |
});
|
22 |
-
jQuery('
|
23 |
|
24 |
jQuery('ul#activity-stream').on('DOMNodeInserted', function(){
|
25 |
-
jQuery('ul#activity-stream
|
26 |
})
|
27 |
|
28 |
|
@@ -94,7 +97,7 @@ jQuery(document).ready(function(){
|
|
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();
|
@@ -171,6 +174,7 @@ jQuery(document).ready(function(){
|
|
171 |
'opacity': 90
|
172 |
});
|
173 |
do_fixes($medialoaded);
|
|
|
174 |
});
|
175 |
}
|
176 |
function transit_media($current){
|
@@ -183,6 +187,7 @@ jQuery(document).ready(function(){
|
|
183 |
$medialoaded.empty();
|
184 |
$medialoaded.append($mediacontent);
|
185 |
do_fixes($medialoaded);
|
|
|
186 |
});
|
187 |
}
|
188 |
|
@@ -334,7 +339,7 @@ jQuery(document).ready(function(){
|
|
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');
|
6 |
return false;
|
7 |
}
|
8 |
var $current;
|
9 |
+
|
10 |
+
//window.onbeforeunload= function() { return "Custom message here"; };
|
11 |
+
|
12 |
jQuery(document).ready(function(){
|
13 |
|
14 |
+
jQuery('body').on('mediapreview','.bp_media_content video,.bp_media_content audio', function(){
|
15 |
jQuery(this).mediaelementplayer({
|
16 |
enableKeyboard: false,
|
17 |
startVolume: 1,
|
22 |
}
|
23 |
});
|
24 |
});
|
25 |
+
jQuery('.bp_media_content video,.bp_media_content audio').trigger('mediapreview');
|
26 |
|
27 |
jQuery('ul#activity-stream').on('DOMNodeInserted', function(){
|
28 |
+
jQuery('ul#activity-stream .bp_media_content video,ul#activity-stream .bp_media_content audio').trigger('mediapreview');
|
29 |
})
|
30 |
|
31 |
|
97 |
}
|
98 |
);
|
99 |
});
|
100 |
+
|
101 |
if ( bp_media_vars.lightbox > 0 ) {
|
102 |
jQuery('#bp-media-list').on('click','li a',function(e){
|
103 |
e.preventDefault();
|
174 |
'opacity': 90
|
175 |
});
|
176 |
do_fixes($medialoaded);
|
177 |
+
jQuery('.bp_media_content video,.bp_media_content audio').trigger('mediapreview');
|
178 |
});
|
179 |
}
|
180 |
function transit_media($current){
|
187 |
$medialoaded.empty();
|
188 |
$medialoaded.append($mediacontent);
|
189 |
do_fixes($medialoaded);
|
190 |
+
jQuery('.bp_media_content video,.bp_media_content audio').trigger('mediapreview');
|
191 |
});
|
192 |
}
|
193 |
|
339 |
|
340 |
var a_id = ids[2]
|
341 |
var c_id = target.attr('href').substr( 10, target.attr('href').length );
|
342 |
+
var form = jQuery( '.bp-media-ajax-single #ac-form-' + a_id );
|
343 |
|
344 |
form.css( 'display', 'none' );
|
345 |
form.removeClass('root');
|
app/helper/BPMediaSettings.php
CHANGED
@@ -29,7 +29,7 @@ if (!class_exists('BPMediaSettings')) {
|
|
29 |
* @global BPMediaAddon $bp_media_addon
|
30 |
*/
|
31 |
public function settings() {
|
32 |
-
global $bp_media, $bp_media_addon;
|
33 |
add_settings_section('bpm-settings', __('Enabled Media Types', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
|
34 |
add_settings_field('bpm-image', __('Photos', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
|
35 |
'setting' => 'bp_media_options',
|
@@ -151,6 +151,14 @@ if (!class_exists('BPMediaSettings')) {
|
|
151 |
add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
|
152 |
add_settings_section('bpm-privacy', __('Update Database', BP_MEDIA_TXT_DOMAIN), array($bp_media_privacy, 'init'), 'bp-media-privacy');
|
153 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
add_settings_section('bpm-convert-videos', '', array($this, 'convert_videos_form'), 'bp-media-convert-videos');
|
156 |
|
29 |
* @global BPMediaAddon $bp_media_addon
|
30 |
*/
|
31 |
public function settings() {
|
32 |
+
global $bp_media, $bp_media_addon, $wpdb;
|
33 |
add_settings_section('bpm-settings', __('Enabled Media Types', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
|
34 |
add_settings_field('bpm-image', __('Photos', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
|
35 |
'setting' => 'bp_media_options',
|
151 |
add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
|
152 |
add_settings_section('bpm-privacy', __('Update Database', BP_MEDIA_TXT_DOMAIN), array($bp_media_privacy, 'init'), 'bp-media-privacy');
|
153 |
}
|
154 |
+
|
155 |
+
$bp_album_active = BPMediaImporter::_active('bp-album/loader.php');
|
156 |
+
$table = "{$wpdb->base_prefix}bp_album";
|
157 |
+
if (BPMediaImporter::table_exists($table) && $bp_album_active!=-1) {
|
158 |
+
$bp_media_album_importer = new BPMediaAlbumimporter();
|
159 |
+
add_filter('bp_media_add_sub_tabs', array($bp_media_album_importer, 'tab'), 99, 2);
|
160 |
+
add_settings_section('bpm-bp-album-importer', __('BP Album Importer', BP_MEDIA_TXT_DOMAIN), array($bp_media_album_importer, 'ui'), 'bp-media-bp-album-importer');
|
161 |
+
}
|
162 |
|
163 |
add_settings_section('bpm-convert-videos', '', array($this, 'convert_videos_form'), 'bp-media-convert-videos');
|
164 |
|
app/importers/BPMediaAlbumimporter.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of BPMediaBPAlbumImporter
|
10 |
+
*
|
11 |
+
* @author saurabh
|
12 |
+
*/
|
13 |
+
class BPMediaAlbumimporter extends BPMediaImporter {
|
14 |
+
|
15 |
+
function __construct() {
|
16 |
+
global $wpdb;
|
17 |
+
parent::__construct();
|
18 |
+
$this->path = 'bp-album/loader.php';
|
19 |
+
$this->active = $this->_active($this->path);
|
20 |
+
$table = "{$wpdb->base_prefix}bp_album";
|
21 |
+
if (BPMediaImporter::table_exists($table) && $this->active != -1 && !$this->column_exists('import_status')) {
|
22 |
+
$this->update_table();
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
function update_table() {
|
27 |
+
if ($this->column_exists('import_status'))
|
28 |
+
return;
|
29 |
+
global $wpdb;
|
30 |
+
return $wpdb->query(
|
31 |
+
"ALTER TABLE {$wpdb->base_prefix}bp_album ADD COLUMN
|
32 |
+
import_status TINYINT (1) NOT NULL DEFAULT 0"
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
function column_exists($column) {
|
37 |
+
global $wpdb;
|
38 |
+
return $wpdb->query(
|
39 |
+
"SHOW COLUMNS FROM {$wpdb->base_prefix}bp_album LIKE '$column'"
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
function tab($tabs, $tab) {
|
44 |
+
$idle_class = 'nav-tab';
|
45 |
+
$active_class = 'nav-tab nav-tab-active';
|
46 |
+
$tabs[] = array(
|
47 |
+
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-bp-album-importer'), 'admin.php')),
|
48 |
+
'title' => __('Import BP-Album', BP_MEDIA_TXT_DOMAIN),
|
49 |
+
'name' => __('Import BP-Album', BP_MEDIA_TXT_DOMAIN),
|
50 |
+
'class' => ($tab == 'bp-media-bp-album-importer') ? $active_class : $idle_class
|
51 |
+
);
|
52 |
+
return $tabs;
|
53 |
+
}
|
54 |
+
|
55 |
+
function ui() {
|
56 |
+
$this->progress = new rtProgress();
|
57 |
+
$total = $this->get_total_count();
|
58 |
+
$finished = $this->get_completed_count();
|
59 |
+
|
60 |
+
|
61 |
+
//(isset($total) && isset($finished) && is_array($total) && is_array($finished)){
|
62 |
+
echo '<div id="bpmedia-bpalbumimporter">';
|
63 |
+
if ($finished != $total) {
|
64 |
+
if (!$total) {
|
65 |
+
echo '<p><strong>' . __('You have nothing to import') . '</strong></p>';
|
66 |
+
} elseif ($this->active != 1) {
|
67 |
+
echo '<div id="setting-error-bp-album-importer" class="error settings-error below-h2">
|
68 |
+
<p><strong>' . __('This process is irreversible. Please take a backup of your database and files, before proceeding.', BP_MEDIA_TXT_DOMAIN) . '</strong></p></div>';
|
69 |
+
echo '<strong>';
|
70 |
+
echo '<span class="finished">' . $finished . '</span> / <span class="total">' . $total . '</span>';
|
71 |
+
echo '</strong>';
|
72 |
+
$progress = 100;
|
73 |
+
if ($total != 0) {
|
74 |
+
$todo = $total - $finished;
|
75 |
+
$steps = ceil($todo / 20);
|
76 |
+
$laststep = $todo % 20;
|
77 |
+
$progress = $this->progress->progress($finished, $total);
|
78 |
+
echo '<input type="hidden" value="' . $finished . '" name="finished"/>';
|
79 |
+
echo '<input type="hidden" value="' . $total . '" name="total"/>';
|
80 |
+
echo '<input type="hidden" value="' . $todo . '" name="todo"/>';
|
81 |
+
echo '<input type="hidden" value="' . $steps . '" name="steps"/>';
|
82 |
+
echo '<input type="hidden" value="' . $laststep . '" name="laststep"/>';
|
83 |
+
$this->progress->progress_ui($progress);
|
84 |
+
echo "<br>";
|
85 |
+
}
|
86 |
+
echo '<button id="bpmedia-bpalbumimport" class="button button-primary">';
|
87 |
+
_e('Start', BP_MEDIA_TXT_DOMAIN);
|
88 |
+
echo '</button>';
|
89 |
+
} else {
|
90 |
+
$install_link = wp_nonce_url(admin_url('plugins.php?action=deactivate&plugin=' . urlencode($this->path)), 'deactivate-plugin_' . $this->path);
|
91 |
+
echo '<p><strong>' . sprintf(__('Please <a href="%s">deactivate</a> BP-Album first', BP_MEDIA_TXT_DOMAIN), $install_link) . '</strong></p>';
|
92 |
+
}
|
93 |
+
} else {
|
94 |
+
echo '<p class="info">';
|
95 |
+
_e('All media from BP Album has been imported. However, there are a lot of extra files and a database table eating up your resources. Would you like to delete them now?', BP_MEDIA_TXT_DOMAIN);
|
96 |
+
echo '</p>';
|
97 |
+
echo '<div id="setting-error-bp-album-importer" class="error settings-error below-h2">
|
98 |
+
<p><strong>' . __('This process is irreversible. Please take a backup of your database and files, before proceeding.', BP_MEDIA_TXT_DOMAIN) . '</strong></p></div>';
|
99 |
+
echo '<button id="bpmedia-bpalbumimport-cleanup" class="button button-primary">';
|
100 |
+
_e('Clean Up', BP_MEDIA_TXT_DOMAIN);
|
101 |
+
echo '</button>';
|
102 |
+
}
|
103 |
+
echo '</div>';
|
104 |
+
}
|
105 |
+
|
106 |
+
function create_album($author_id, $album_name = 'BP Album') {
|
107 |
+
global $bp_media, $wpdb;
|
108 |
+
|
109 |
+
if (array_key_exists('bp_album_import_name', $bp_media->options)) {
|
110 |
+
if ($bp_media->options['bp_album_import_name'] != '') {
|
111 |
+
$album_name = $bp_media->options['bp_album_import_name'];
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
$query = "SELECT ID from $wpdb->posts WHERE post_type='bp_media_album' AND post_status = 'publish' AND post_author = $author_id AND post_title LIKE '{$album_name}'";
|
116 |
+
$result = $wpdb->get_results($query);
|
117 |
+
if (count($result) < 1) {
|
118 |
+
$album = new BPMediaAlbum();
|
119 |
+
$album->add_album($album_name, $author_id);
|
120 |
+
$album_id = $album->get_id();
|
121 |
+
} else {
|
122 |
+
$album_id = $result[0]->ID;
|
123 |
+
}
|
124 |
+
$wpdb->update($wpdb->prefix . 'bp_activity', array('secondary_item_id' => -999), array('id' => get_post_meta($album_id, 'bp_media_child_activity', true)));
|
125 |
+
|
126 |
+
return $album_id;
|
127 |
+
}
|
128 |
+
|
129 |
+
function get_total_count() {
|
130 |
+
global $wpdb;
|
131 |
+
$table = $wpdb->base_prefix . 'bp_album';
|
132 |
+
if ($this->table_exists($table) && $this->active != -1) {
|
133 |
+
return $wpdb->query("SELECT * FROM $table");
|
134 |
+
}
|
135 |
+
return 0;
|
136 |
+
}
|
137 |
+
|
138 |
+
function get_completed_count() {
|
139 |
+
global $wpdb;
|
140 |
+
$table = $wpdb->base_prefix . 'bp_album';
|
141 |
+
if ($this->table_exists($table) && $this->active != -1) {
|
142 |
+
return $wpdb->query("SELECT * FROM $table WHERE import_status!=0");
|
143 |
+
}
|
144 |
+
return 0;
|
145 |
+
}
|
146 |
+
|
147 |
+
static function batch_import($offset = 0, $count = 20) {
|
148 |
+
global $wpdb;
|
149 |
+
$table = $wpdb->base_prefix . 'bp_album';
|
150 |
+
$bp_album_data = $wpdb->get_results("SELECT * FROM $table WHERE import_status=0 LIMIT $count OFFSET $offset");
|
151 |
+
return $bp_album_data;
|
152 |
+
}
|
153 |
+
|
154 |
+
static function bpmedia_ajax_import_callback() {
|
155 |
+
|
156 |
+
$page = isset($_GET['page']) ? $_GET['page'] : 1;
|
157 |
+
$count = isset($_GET['count']) ? $_GET['count'] : 20;
|
158 |
+
$offset = ($page > 1) ? (($page - 1) * 20 + $count) : 0;
|
159 |
+
|
160 |
+
$bp_album_data = BPMediaAlbumimporter::batch_import($offset, $count);
|
161 |
+
global $wpdb;
|
162 |
+
$table = $wpdb->base_prefix . 'bp_album';
|
163 |
+
|
164 |
+
foreach ($bp_album_data as &$bp_album_item) {
|
165 |
+
|
166 |
+
if (get_site_option('bp_media_bp_album_importer_base_path') == '') {
|
167 |
+
$base_path = pathinfo($bp_album_item->pic_org_path);
|
168 |
+
update_site_option('bp_media_bp_album_importer_base_path', $base_path['dirname']);
|
169 |
+
}
|
170 |
+
$album_id = BPMediaAlbumimporter::create_album($bp_album_item->owner_id, 'BP Album');
|
171 |
+
$imported_media_id = BPMediaImporter::add_media(
|
172 |
+
$album_id, $bp_album_item->title, $bp_album_item->description, $bp_album_item->pic_org_path, $bp_album_item->privacy, $bp_album_item->owner_id
|
173 |
+
);
|
174 |
+
$wpdb->update($table, array('import_status' => $imported_media_id), array('id' => $bp_album_item->id), array('%d'), array('%d'));
|
175 |
+
BPMediaAlbumimporter::update_recorded_time_and_comments($imported_media_id, $bp_album_item->id, "{$wpdb->base_prefix}bp_album");
|
176 |
+
}
|
177 |
+
|
178 |
+
echo $page;
|
179 |
+
die();
|
180 |
+
}
|
181 |
+
|
182 |
+
static function cleanup_after_install() {
|
183 |
+
global $wpdb;
|
184 |
+
$table = $wpdb->base_prefix . 'bp_album';
|
185 |
+
$dir = get_site_option('bp_media_bp_album_importer_base_path');
|
186 |
+
BPMediaImporter::cleanup($table, $dir);
|
187 |
+
die();
|
188 |
+
}
|
189 |
+
|
190 |
+
static function update_recorded_time_and_comments($media, $bp_album_id, $table) {
|
191 |
+
global $wpdb;
|
192 |
+
if (function_exists('bp_activity_add')) {
|
193 |
+
if (!is_object($media)) {
|
194 |
+
try {
|
195 |
+
$media = new BPMediaHostWordpress($media);
|
196 |
+
} catch (exception $e) {
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
$activity_id = get_post_meta($media->get_id(), 'bp_media_child_activity', true);
|
201 |
+
|
202 |
+
if ($activity_id) {
|
203 |
+
$date_uploaded = $wpdb->get_var("SELECT date_uploaded from $table WHERE id = $bp_album_id");
|
204 |
+
$old_activity_id = $wpdb->get_var("SELECT id from {$wpdb->prefix}bp_activity WHERE component = 'album' AND type = 'bp_album_picture' AND item_id = $bp_album_id");
|
205 |
+
$comments = $wpdb->get_results("SELECT id,secondary_item_id from {$wpdb->prefix}bp_activity WHERE component = 'activity' AND type = 'activity_comment' AND item_id = $old_activity_id");
|
206 |
+
foreach ($comments as $comment) {
|
207 |
+
$update = array('item_id' => $activity_id);
|
208 |
+
if ($comment->secondary_item_id == $old_activity_id) {
|
209 |
+
$update['secondary_item_id'] = $activity_id;
|
210 |
+
}
|
211 |
+
$wpdb->update($wpdb->prefix . 'bp_activity', $update, array('id' => $comment->id));
|
212 |
+
BP_Activity_Activity::rebuild_activity_comment_tree($activity_id);
|
213 |
+
}
|
214 |
+
$wpdb->update($wpdb->prefix . 'bp_activity', array('date_recorded' => $date_uploaded), array('id' => $activity_id));
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
?>
|
app/importers/BPMediaImporter.php
CHANGED
@@ -12,104 +12,149 @@
|
|
12 |
*/
|
13 |
class BPMediaImporter {
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
var $import_steps;
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
function table_exists($table){
|
27 |
-
global $wpdb;
|
28 |
-
|
29 |
-
if($wpdb->query("SHOW TABLES LIKE '".$table."'")==1){
|
30 |
-
return true;
|
31 |
-
}
|
32 |
|
|
|
33 |
return false;
|
34 |
-
}
|
35 |
-
|
36 |
-
static function _active($path) {
|
37 |
-
if ( ! function_exists( 'is_plugin_inactive' ) ) {
|
38 |
-
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
39 |
-
}
|
40 |
-
global $wpdb;
|
41 |
-
$plugin_name = $path;
|
42 |
-
$is_active = is_plugin_active( $plugin_name );
|
43 |
-
if ( $is_active == true )
|
44 |
-
return 1;
|
45 |
-
$is_inactive = is_plugin_inactive( $plugin_name );
|
46 |
-
if ( $is_inactive == true )
|
47 |
-
return 0;
|
48 |
-
if ( ! $is_active && ! $is_inactive )
|
49 |
-
return -1;
|
50 |
-
}
|
51 |
-
|
52 |
-
static function file_array($filepath){
|
53 |
-
|
54 |
-
$path_info = pathinfo($filepath);
|
55 |
-
|
56 |
-
$file['error'] = '';
|
57 |
-
$file['name'] = $path_info['basename'];
|
58 |
-
$file['type'] = mime_content_type($filepath);
|
59 |
-
$file['tmp_name'] = $filepath;
|
60 |
-
$file['size'] = filesize( $filepath);
|
61 |
-
|
62 |
-
return $file;
|
63 |
-
|
64 |
-
}
|
65 |
-
|
66 |
-
function create_album($album_name = '',$author_id=1){
|
67 |
-
|
68 |
-
global $bp_media;
|
69 |
-
|
70 |
-
if(array_key_exists('bp_album_import_name',$bp_media->options)){
|
71 |
-
if($bp_media->options['bp_album_import_name']!=''){
|
72 |
-
$album_name = $bp_media->options['bp_album_import_name'];
|
73 |
-
}
|
74 |
-
}
|
75 |
-
$found_album = BuddyPressMedia::get_wall_album();
|
76 |
-
|
77 |
-
if(count($found_album)< 1){
|
78 |
-
$album = new BPMediaAlbum();
|
79 |
-
$album->add_album($album_name,$author_id);
|
80 |
-
$album_id = $album->get_id();
|
81 |
-
}else{
|
82 |
-
$album_id = $found_album[0]->ID;
|
83 |
-
}
|
84 |
-
return $album_id;
|
85 |
-
}
|
86 |
-
|
87 |
-
static function add_media($album_id, $title='',$description='',$filepath='',$privacy=0,$author_id=false){
|
88 |
-
|
89 |
-
|
90 |
-
$files = BPMediaImporter::file_array($filepath);
|
91 |
-
|
92 |
-
|
93 |
-
$bp_imported_media =new BPMediaHostWordpress();
|
94 |
-
|
95 |
-
$imported_media_id = $bp_imported_media->add_media($title, $description, $album_id, 0, false, false, $files);
|
96 |
-
|
97 |
-
wp_update_post($args=array('ID'=>$imported_media_id,'post_author'=> $author_id));
|
98 |
-
|
99 |
-
$bp_album_privacy = $privacy;
|
100 |
-
if($bp_album_privacy == 10)
|
101 |
-
$bp_album_privacy = 6;
|
102 |
-
|
103 |
-
$privacy = new BPMediaPrivacy();
|
104 |
-
$privacy->save($bp_album_privacy,$imported_media_id);
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
function cleanup(){
|
109 |
-
return;
|
110 |
-
|
111 |
-
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
}
|
115 |
|
12 |
*/
|
13 |
class BPMediaImporter {
|
14 |
|
15 |
+
/**
|
16 |
+
*
|
17 |
+
*/
|
18 |
+
var $active;
|
19 |
+
var $import_steps;
|
20 |
|
21 |
+
function __construct() {
|
|
|
22 |
|
23 |
+
}
|
24 |
|
25 |
+
function table_exists($table) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
//for 2.7.6 please remove for 2.8
|
28 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
global $wpdb;
|
31 |
+
|
32 |
+
if ($wpdb->query("SHOW TABLES LIKE '" . $table . "'") == 1) {
|
33 |
+
return true;
|
34 |
+
}
|
35 |
+
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
static function _active($path) {
|
40 |
+
|
41 |
+
//for 2.7.6 please remove for 2.8
|
42 |
+
return -1;
|
43 |
+
|
44 |
+
if (!function_exists('is_plugin_inactive')) {
|
45 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
46 |
+
}
|
47 |
+
if (is_plugin_active($path))
|
48 |
+
return 1;
|
49 |
+
$plugins = get_plugins();
|
50 |
+
if (array_key_exists($path, $plugins)) {
|
51 |
+
return 0;
|
52 |
+
} else {
|
53 |
+
return -1;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
static function file_array($filepath) {
|
58 |
+
|
59 |
+
$path_info = pathinfo($filepath);
|
60 |
+
|
61 |
+
$file['error'] = '';
|
62 |
+
$file['name'] = $path_info['basename'];
|
63 |
+
$file['type'] = mime_content_type($filepath);
|
64 |
+
$file['tmp_name'] = $filepath;
|
65 |
+
$file['size'] = filesize($filepath);
|
66 |
+
|
67 |
+
return $file;
|
68 |
+
}
|
69 |
+
|
70 |
+
static function make_copy($filepath) {
|
71 |
+
$upload_dir = wp_upload_dir();
|
72 |
+
$path_info = pathinfo($filepath);
|
73 |
+
$tmp_dir = trailingslashit($upload_dir['basedir']) . 'bp-album-importer';
|
74 |
+
$newpath = trailingslashit($tmp_dir) . $path_info['basename'];
|
75 |
+
if (!is_dir($tmp_dir)) {
|
76 |
+
wp_mkdir_p($tmp_dir);
|
77 |
+
}
|
78 |
+
if (copy($filepath, $newpath)) {
|
79 |
+
return BPMediaImporter::file_array($newpath);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
function create_album($album_name = '', $author_id = 1) {
|
84 |
+
|
85 |
+
global $bp_media;
|
86 |
+
|
87 |
+
if (array_key_exists('bp_album_import_name', $bp_media->options)) {
|
88 |
+
if ($bp_media->options['bp_album_import_name'] != '') {
|
89 |
+
$album_name = $bp_media->options['bp_album_import_name'];
|
90 |
+
}
|
91 |
+
}
|
92 |
+
$found_album = BuddyPressMedia::get_wall_album();
|
93 |
+
|
94 |
+
if (count($found_album) < 1) {
|
95 |
+
$album = new BPMediaAlbum();
|
96 |
+
$album->add_album($album_name, $author_id);
|
97 |
+
$album_id = $album->get_id();
|
98 |
+
} else {
|
99 |
+
$album_id = $found_album[0]->ID;
|
100 |
+
}
|
101 |
+
return $album_id;
|
102 |
+
}
|
103 |
+
|
104 |
+
static function add_media($album_id, $title = '', $description = '', $filepath = '', $privacy = 0, $author_id = false) {
|
105 |
+
|
106 |
+
|
107 |
+
$files = BPMediaImporter::make_copy($filepath);
|
108 |
+
if ($files) {
|
109 |
+
|
110 |
+
$bp_imported_media = new BPMediaHostWordpress();
|
111 |
+
// add_filter('bp_media_force_hide_activity', create_function('', 'return true;'));
|
112 |
+
$imported_media_id = $bp_imported_media->add_media($title, $description, $album_id, 0, false, false, $files);
|
113 |
+
|
114 |
+
wp_update_post($args = array('ID' => $imported_media_id, 'post_author' => $author_id));
|
115 |
+
|
116 |
+
$bp_album_privacy = $privacy;
|
117 |
+
if ($bp_album_privacy == 10)
|
118 |
+
$bp_album_privacy = 6;
|
119 |
+
|
120 |
+
$privacy = new BPMediaPrivacy();
|
121 |
+
$privacy->save($bp_album_privacy, $imported_media_id);
|
122 |
+
return $imported_media_id;
|
123 |
+
}
|
124 |
+
return 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
static function cleanup($table, $directory) {
|
128 |
+
global $wpdb;
|
129 |
+
$wpdb->query("DROP TABLE IF EXISTS $table");
|
130 |
+
$wpdb->query(
|
131 |
+
$wpdb->prepare(
|
132 |
+
"
|
133 |
+
DELETE FROM {$wpdb->base_prefix}bp_activity
|
134 |
+
WHERE component = %s
|
135 |
+
", 'album'
|
136 |
+
)
|
137 |
+
);
|
138 |
+
if (is_dir($directory)) {
|
139 |
+
BPMediaImporter::delete($directory);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
static function delete($path) {
|
144 |
+
if (is_dir($path) === true) {
|
145 |
+
$files = array_diff(scandir($path), array('.', '..'));
|
146 |
+
|
147 |
+
foreach ($files as $file) {
|
148 |
+
BPMediaImporter::delete(realpath($path) . '/' . $file);
|
149 |
+
}
|
150 |
+
|
151 |
+
return rmdir($path);
|
152 |
+
} else if (is_file($path) === true) {
|
153 |
+
return unlink($path);
|
154 |
+
}
|
155 |
+
|
156 |
+
return false;
|
157 |
+
}
|
158 |
|
159 |
}
|
160 |
|
app/main/BuddyPressMedia.php
CHANGED
@@ -356,11 +356,12 @@ class BuddyPressMedia {
|
|
356 |
// new BPMediaActivity();
|
357 |
$class_construct = array(
|
358 |
'activity' => false,
|
359 |
-
'filters'
|
360 |
-
'actions'
|
361 |
'function' => false,
|
362 |
-
'privacy'
|
363 |
-
|
|
|
364 |
);
|
365 |
$class_construct = apply_filters('bpmedia_class_construct', $class_construct);
|
366 |
|
356 |
// new BPMediaActivity();
|
357 |
$class_construct = array(
|
358 |
'activity' => false,
|
359 |
+
'filters' => false,
|
360 |
+
'actions' => false,
|
361 |
'function' => false,
|
362 |
+
'privacy' => false,
|
363 |
+
'download' => false,
|
364 |
+
'albumimporter' => false
|
365 |
);
|
366 |
$class_construct = apply_filters('bpmedia_class_construct', $class_construct);
|
367 |
|
app/main/activity/BPMediaActivity.php
CHANGED
@@ -35,7 +35,6 @@ if ( ! class_exists( 'BPMediaActivity' ) ) {
|
|
35 |
|
36 |
public function scripts() {
|
37 |
wp_enqueue_script( 'json2' );
|
38 |
-
wp_enqueue_script( 'bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array( 'plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers' ), BP_MEDIA_VERSION );
|
39 |
}
|
40 |
|
41 |
public function activity_uploader() {
|
@@ -64,7 +63,7 @@ if ( ! class_exists( 'BPMediaActivity' ) ) {
|
|
64 |
|
65 |
public function get_text( $content ) {
|
66 |
$activity_json = $this->decode( $content );
|
67 |
-
$activity_text = $activity_json[ 'update_txt' ];
|
68 |
return $activity_text;
|
69 |
}
|
70 |
|
35 |
|
36 |
public function scripts() {
|
37 |
wp_enqueue_script( 'json2' );
|
|
|
38 |
}
|
39 |
|
40 |
public function activity_uploader() {
|
63 |
|
64 |
public function get_text( $content ) {
|
65 |
$activity_json = $this->decode( $content );
|
66 |
+
$activity_text = rawurldecode($activity_json[ 'update_txt' ]);
|
67 |
return $activity_text;
|
68 |
}
|
69 |
|
app/main/includes/BPMediaActions.php
CHANGED
@@ -478,7 +478,7 @@ class BPMediaActions {
|
|
478 |
'multi_selection' => true,
|
479 |
'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
|
480 |
);
|
481 |
-
wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
|
482 |
wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
|
483 |
wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
|
484 |
if (bp_is_active('groups') && bp_get_current_group_id())
|
@@ -503,7 +503,7 @@ class BPMediaActions {
|
|
503 |
'multi_selection' => true,
|
504 |
'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
|
505 |
);
|
506 |
-
wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
|
507 |
wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
|
508 |
}
|
509 |
}
|
478 |
'multi_selection' => true,
|
479 |
'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
|
480 |
);
|
481 |
+
wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION, true);
|
482 |
wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
|
483 |
wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
|
484 |
if (bp_is_active('groups') && bp_get_current_group_id())
|
503 |
'multi_selection' => true,
|
504 |
'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
|
505 |
);
|
506 |
+
wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION, true);
|
507 |
wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
|
508 |
}
|
509 |
}
|
app/main/includes/BPMediaFunction.php
CHANGED
@@ -97,12 +97,7 @@ class BPMediaFunction {
|
|
97 |
* @return type
|
98 |
*/
|
99 |
function conditional_override_allowed_tags($content, $activity = null) {
|
100 |
-
|
101 |
-
|
102 |
-
if ($activity != null && in_array($activity->type, $bp_media->activity_types)) {
|
103 |
-
add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags', 1);
|
104 |
-
}
|
105 |
-
|
106 |
return $content;
|
107 |
}
|
108 |
|
97 |
* @return type
|
98 |
*/
|
99 |
function conditional_override_allowed_tags($content, $activity = null) {
|
100 |
+
add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags', 1);
|
|
|
|
|
|
|
|
|
|
|
101 |
return $content;
|
102 |
}
|
103 |
|
app/main/includes/BPMediaHostWordpress.php
CHANGED
@@ -2,1018 +2,1025 @@
|
|
2 |
|
3 |
class BPMediaHostWordpress {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
$attachment = array( );
|
139 |
-
$url = $file[ 'url' ];
|
140 |
-
$file = $file[ 'file' ];
|
141 |
-
$title = $name;
|
142 |
-
$content = $description;
|
143 |
-
$attachment = array(
|
144 |
-
'post_mime_type' => $type,
|
145 |
-
'guid' => $url,
|
146 |
-
'post_title' => $title,
|
147 |
-
'post_content' => $content,
|
148 |
-
'post_parent' => $post_id,
|
149 |
-
);
|
150 |
-
switch ( $type ) {
|
151 |
-
case 'video/mp4' :
|
152 |
-
case 'video/quicktime' :
|
153 |
-
$type = 'video';
|
154 |
-
include_once(trailingslashit( BP_MEDIA_PATH ) . 'lib/getid3/getid3.php');
|
155 |
-
try {
|
156 |
-
$getID3 = new getID3;
|
157 |
-
$vid_info = $getID3->analyze( $file );
|
158 |
-
} catch ( Exception $e ) {
|
159 |
-
unlink( $file );
|
160 |
-
$activity_content = false;
|
161 |
-
throw new Exception( __( 'MP4 file you have uploaded is corrupt.', BP_MEDIA_TXT_DOMAIN ) );
|
162 |
-
}
|
163 |
-
if ( is_array( $vid_info ) ) {
|
164 |
-
if ( ! array_key_exists( 'error', $vid_info ) && array_key_exists( 'fileformat', $vid_info ) && array_key_exists( 'video', $vid_info ) && array_key_exists( 'fourcc', $vid_info[ 'video' ] ) ) {
|
165 |
-
if ( ! ($vid_info[ 'fileformat' ] == 'mp4' && $vid_info[ 'video' ][ 'fourcc' ] == 'avc1') ) {
|
166 |
-
unlink( $file );
|
167 |
-
$activity_content = false;
|
168 |
-
throw new Exception( __( 'The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', BP_MEDIA_TXT_DOMAIN ) );
|
169 |
-
}
|
170 |
-
} else {
|
171 |
-
unlink( $file );
|
172 |
-
$activity_content = false;
|
173 |
-
throw new Exception( __( 'The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', BP_MEDIA_TXT_DOMAIN ) );
|
174 |
-
}
|
175 |
-
} else {
|
176 |
-
unlink( $file );
|
177 |
-
$activity_content = false;
|
178 |
-
throw new Exception( __( 'The MP4 file you have uploaded is not a video file.', BP_MEDIA_TXT_DOMAIN ) );
|
179 |
-
}
|
180 |
-
break;
|
181 |
-
case 'audio/mpeg' :
|
182 |
-
include_once(trailingslashit( BP_MEDIA_PATH ) . 'lib/getid3/getid3.php');
|
183 |
-
try {
|
184 |
-
$getID3 = new getID3;
|
185 |
-
$file_info = $getID3->analyze( $file );
|
186 |
-
} catch ( Exception $e ) {
|
187 |
-
unlink( $file );
|
188 |
-
$activity_content = false;
|
189 |
-
throw new Exception( __( 'MP3 file you have uploaded is currupt.', BP_MEDIA_TXT_DOMAIN ) );
|
190 |
-
}
|
191 |
-
if ( is_array( $file_info ) ) {
|
192 |
-
if ( ! array_key_exists( 'error', $file_info ) && array_key_exists( 'fileformat', $file_info ) && array_key_exists( 'audio', $file_info ) && array_key_exists( 'dataformat', $file_info[ 'audio' ] ) ) {
|
193 |
-
if ( ! ($file_info[ 'fileformat' ] == 'mp3' && $file_info[ 'audio' ][ 'dataformat' ] == 'mp3') ) {
|
194 |
-
unlink( $file );
|
195 |
-
$activity_content = false;
|
196 |
-
throw new Exception( __( 'The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', BP_MEDIA_TXT_DOMAIN ) );
|
197 |
-
}
|
198 |
-
} else {
|
199 |
-
unlink( $file );
|
200 |
-
$activity_content = false;
|
201 |
-
throw new Exception( __( 'The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', BP_MEDIA_TXT_DOMAIN ) );
|
202 |
-
}
|
203 |
-
} else {
|
204 |
-
unlink( $file );
|
205 |
-
$activity_content = false;
|
206 |
-
throw new Exception( __( 'The MP3 file you have uploaded is not an audio file.', BP_MEDIA_TXT_DOMAIN ) );
|
207 |
-
}
|
208 |
-
$type = 'audio';
|
209 |
-
break;
|
210 |
-
case 'image/gif' :
|
211 |
-
case 'image/jpeg' :
|
212 |
-
case 'image/png' :
|
213 |
-
$type = 'image';
|
214 |
-
break;
|
215 |
-
default :
|
216 |
-
unlink( $file );
|
217 |
-
$activity_content = false;
|
218 |
-
throw new Exception( __( 'Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4.', BP_MEDIA_TXT_DOMAIN ) );
|
219 |
-
}
|
220 |
-
echo $attachment_id = wp_insert_attachment( $attachment, $file, $post_id );
|
221 |
-
if ( ! is_wp_error( $attachment_id ) ) {
|
222 |
-
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
|
223 |
-
} else {
|
224 |
-
unlink( $file );
|
225 |
-
throw new Exception( __( 'Error creating attachment for the media file, please try again', BP_MEDIA_TXT_DOMAIN ) );
|
226 |
-
}
|
227 |
-
$this->id = $attachment_id;
|
228 |
-
$this->name = $name;
|
229 |
-
$this->description = $description;
|
230 |
-
$this->type = $type;
|
231 |
-
$this->owner = get_current_user_id();
|
232 |
-
$this->album_id = $post_id;
|
233 |
-
$this->group_id = $group;
|
234 |
-
$this->set_permalinks();
|
235 |
-
if ( $group == 0 ) {
|
236 |
-
update_post_meta( $attachment_id, 'bp-media-key', get_current_user_id() );
|
237 |
-
} else {
|
238 |
-
update_post_meta( $attachment_id, 'bp-media-key', (-$group ) );
|
239 |
-
}
|
240 |
-
do_action( 'bp_media_after_add_media', $this, $is_multiple, $is_activity, $group );
|
241 |
-
return $attachment_id;
|
242 |
-
}
|
243 |
-
|
244 |
-
function get_media_thumbnail( $size = 'thumbnail' ) {
|
245 |
-
$thumb = '';
|
246 |
-
if ( in_array( $this->type, array( 'image', 'video', 'audio' ) ) ) {
|
247 |
-
if ( $this->thumbnail_id ) {
|
248 |
-
$medium_array = image_downsize( $this->thumbnail_id, $size );
|
249 |
-
$thumb_url = $medium_array[ 0 ];
|
250 |
-
} else {
|
251 |
-
$thumb_url = BP_MEDIA_URL . 'app/assets/img/' . $this->type . '_thumb.png';
|
252 |
}
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
// $this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
FROM $wpdb->posts
|
987 |
WHERE
|
988 |
post_title = $post_wall
|
989 |
AND post_author = '" . get_current_user_id() . "'
|
990 |
AND post_type='bp_media_album'"
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
FROM $wpdb->posts
|
996 |
INNER JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id
|
997 |
AND $wpdb->postmeta.meta_key = 'bp-media-key'
|
998 |
AND $wpdb->postmeta.meta_value = -$group
|
999 |
-
AND $wpdb->posts.post_title = '$current_user->display_name\'s Album'"
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
|
1018 |
}
|
1019 |
?>
|
2 |
|
3 |
class BPMediaHostWordpress {
|
4 |
|
5 |
+
/**
|
6 |
+
* Private variables not to be accessible outside this class' member functions
|
7 |
+
*/
|
8 |
+
protected $id, //id of the entry
|
9 |
+
$name, //Name of the entry
|
10 |
+
$description, //Description of the entry
|
11 |
+
$url, //URL of the entry
|
12 |
+
$type, //Type of the entry (Video, Image or Audio)
|
13 |
+
$owner, //Owner of the entry
|
14 |
+
$delete_url, //The delete url for the media
|
15 |
+
$thumbnail_id, //The thumbnail's id
|
16 |
+
$album_id, //The album id to which the media belongs
|
17 |
+
$edit_url, //The edit page's url for the media
|
18 |
+
$group_id; //The group id of the current media file if it belongs to a group
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Constructs a new BP_Media_Host_Wordpress element
|
22 |
+
*
|
23 |
+
* @param mixed $media_id optional Media ID of the element to be initialized if not defined, returns an empty element.
|
24 |
+
*
|
25 |
+
* @since BuddyPress Media 2.0
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* @param type $media_id
|
31 |
+
*/
|
32 |
+
function __construct($media_id = '') {
|
33 |
+
if ($media_id != '') {
|
34 |
+
$this->init($media_id);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Initializes the object with the variables from the post
|
40 |
+
*
|
41 |
+
* @param mixed $media_id Media ID of the element to be initialized. Can be the ID or the object of the Media
|
42 |
+
*
|
43 |
+
* @since BuddyPress Media 2.0
|
44 |
+
*/
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @param type $media_id
|
49 |
+
* @return boolean
|
50 |
+
* @throws Exception
|
51 |
+
*/
|
52 |
+
function init($media_id = '') {
|
53 |
+
if (is_object($media_id)) {
|
54 |
+
$media = $media_id;
|
55 |
+
} else {
|
56 |
+
$media = &get_post($media_id);
|
57 |
+
}
|
58 |
+
if (empty($media->ID))
|
59 |
+
throw new Exception(__('Sorry, the requested media does not exist.', BP_MEDIA_TXT_DOMAIN));
|
60 |
+
if (!'bp_media_album' == $media->post_type || !empty($media->post_mime_type))
|
61 |
+
preg_match_all('/audio|video|image/i', $media->post_mime_type, $result);
|
62 |
+
else
|
63 |
+
$result[0][0] = 'album';
|
64 |
+
if (isset($result[0][0]))
|
65 |
+
$this->type = $result[0][0];
|
66 |
+
else
|
67 |
+
return false;
|
68 |
+
|
69 |
+
|
70 |
+
global $bp;
|
71 |
+
$this->id = $media->ID;
|
72 |
+
$meta_key = get_post_meta($this->id, 'bp-media-key', true);
|
73 |
+
|
74 |
+
/**
|
75 |
+
* We use bp-media-key to distinguish if the entry belongs to a group or not
|
76 |
+
* if the value is less than 0 it means it the group id to which the media belongs
|
77 |
+
* and if its greater than 0 then it means its the author id of the uploader
|
78 |
+
* But for use in the class, we use group_id as positive integer even though
|
79 |
+
* we use it as negative value in the bp-media-key meta key
|
80 |
+
*/
|
81 |
+
$this->group_id = $meta_key < 0 ? -$meta_key : 0;
|
82 |
+
|
83 |
+
$this->description = $media->post_content;
|
84 |
+
$this->name = $media->post_title;
|
85 |
+
$this->owner = $media->post_author;
|
86 |
+
$this->album_id = $media->post_parent;
|
87 |
+
$this->mime_type = $media->post_mime_type;
|
88 |
+
|
89 |
+
|
90 |
+
$this->set_permalinks();
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Handles the uploaded media file and creates attachment post for the file.
|
95 |
+
*
|
96 |
+
* @since BuddyPress Media 2.0
|
97 |
+
*/
|
98 |
+
|
99 |
+
/**
|
100 |
+
*
|
101 |
+
* @global type $bp
|
102 |
+
* @global type $wpdb
|
103 |
+
* @global type $bp_media_count
|
104 |
+
* @global type $bp_media
|
105 |
+
* @param type $name
|
106 |
+
* @param type $description
|
107 |
+
* @param type $album_id
|
108 |
+
* @param type $group
|
109 |
+
* @param type $is_multiple
|
110 |
+
* @throws Exception
|
111 |
+
* @uses global var $_FILES
|
112 |
+
*/
|
113 |
+
function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false) {
|
114 |
+
do_action('bp_media_before_add_media');
|
115 |
+
|
116 |
+
global $bp, $wpdb, $bp_media;
|
117 |
+
include_once(ABSPATH . 'wp-admin/includes/file.php');
|
118 |
+
include_once(ABSPATH . 'wp-admin/includes/image.php');
|
119 |
+
|
120 |
+
$post_id = $this->check_and_create_album($album_id, $group);
|
121 |
+
|
122 |
+
if (!$files) {
|
123 |
+
$files = $_FILES['bp_media_file'];
|
124 |
+
$file = wp_handle_upload($files);
|
125 |
+
} else {
|
126 |
+
$file = wp_handle_sideload($files, array('test_form' => false));
|
127 |
+
}
|
128 |
+
|
129 |
+
if (isset($file['error']) || $file === null) {
|
130 |
+
throw new Exception(__('Error Uploading File', BP_MEDIA_TXT_DOMAIN));
|
131 |
+
}
|
132 |
+
|
133 |
+
$type = $file['type'];
|
134 |
+
if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
|
135 |
+
if (function_exists('read_exif_data')){
|
136 |
+
$file = $this->exif($file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
$attachment = array();
|
142 |
+
$url = $file['url'];
|
143 |
+
$file = $file['file'];
|
144 |
+
$title = $name;
|
145 |
+
$content = $description;
|
146 |
+
$attachment = array(
|
147 |
+
'post_mime_type' => $type,
|
148 |
+
'guid' => $url,
|
149 |
+
'post_title' => $title,
|
150 |
+
'post_content' => $content,
|
151 |
+
'post_parent' => $post_id,
|
152 |
+
);
|
153 |
+
switch ($type) {
|
154 |
+
case 'video/mp4' :
|
155 |
+
case 'video/quicktime' :
|
156 |
+
$type = 'video';
|
157 |
+
include_once(trailingslashit(BP_MEDIA_PATH) . 'lib/getid3/getid3.php');
|
158 |
+
try {
|
159 |
+
$getID3 = new getID3;
|
160 |
+
$vid_info = $getID3->analyze($file);
|
161 |
+
} catch (Exception $e) {
|
162 |
+
unlink($file);
|
163 |
+
$activity_content = false;
|
164 |
+
throw new Exception(__('MP4 file you have uploaded is corrupt.', BP_MEDIA_TXT_DOMAIN));
|
165 |
+
}
|
166 |
+
if (is_array($vid_info)) {
|
167 |
+
if (!array_key_exists('error', $vid_info) && array_key_exists('fileformat', $vid_info) && array_key_exists('video', $vid_info) && array_key_exists('fourcc', $vid_info['video'])) {
|
168 |
+
if (!($vid_info['fileformat'] == 'mp4' && $vid_info['video']['fourcc'] == 'avc1')) {
|
169 |
+
unlink($file);
|
170 |
+
$activity_content = false;
|
171 |
+
throw new Exception(__('The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', BP_MEDIA_TXT_DOMAIN));
|
172 |
+
}
|
173 |
+
} else {
|
174 |
+
unlink($file);
|
175 |
+
$activity_content = false;
|
176 |
+
throw new Exception(__('The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', BP_MEDIA_TXT_DOMAIN));
|
177 |
+
}
|
178 |
+
} else {
|
179 |
+
unlink($file);
|
180 |
+
$activity_content = false;
|
181 |
+
throw new Exception(__('The MP4 file you have uploaded is not a video file.', BP_MEDIA_TXT_DOMAIN));
|
182 |
+
}
|
183 |
+
break;
|
184 |
+
case 'audio/mpeg' :
|
185 |
+
include_once(trailingslashit(BP_MEDIA_PATH) . 'lib/getid3/getid3.php');
|
186 |
+
try {
|
187 |
+
$getID3 = new getID3;
|
188 |
+
$file_info = $getID3->analyze($file);
|
189 |
+
} catch (Exception $e) {
|
190 |
+
unlink($file);
|
191 |
+
$activity_content = false;
|
192 |
+
throw new Exception(__('MP3 file you have uploaded is currupt.', BP_MEDIA_TXT_DOMAIN));
|
193 |
+
}
|
194 |
+
if (is_array($file_info)) {
|
195 |
+
if (!array_key_exists('error', $file_info) && array_key_exists('fileformat', $file_info) && array_key_exists('audio', $file_info) && array_key_exists('dataformat', $file_info['audio'])) {
|
196 |
+
if (!($file_info['fileformat'] == 'mp3' && $file_info['audio']['dataformat'] == 'mp3')) {
|
197 |
+
unlink($file);
|
198 |
+
$activity_content = false;
|
199 |
+
throw new Exception(__('The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', BP_MEDIA_TXT_DOMAIN));
|
200 |
+
}
|
201 |
+
} else {
|
202 |
+
unlink($file);
|
203 |
+
$activity_content = false;
|
204 |
+
throw new Exception(__('The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', BP_MEDIA_TXT_DOMAIN));
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
unlink($file);
|
208 |
+
$activity_content = false;
|
209 |
+
throw new Exception(__('The MP3 file you have uploaded is not an audio file.', BP_MEDIA_TXT_DOMAIN));
|
210 |
+
}
|
211 |
+
$type = 'audio';
|
212 |
+
break;
|
213 |
+
case 'image/gif' :
|
214 |
+
case 'image/jpeg' :
|
215 |
+
case 'image/png' :
|
216 |
+
$type = 'image';
|
217 |
+
break;
|
218 |
+
default :
|
219 |
+
unlink($file);
|
220 |
+
$activity_content = false;
|
221 |
+
throw new Exception(__('Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4.', BP_MEDIA_TXT_DOMAIN));
|
222 |
+
}
|
223 |
+
echo $attachment_id = wp_insert_attachment($attachment, $file, $post_id);
|
224 |
+
if (!is_wp_error($attachment_id)) {
|
225 |
+
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
|
226 |
+
} else {
|
227 |
+
unlink($file);
|
228 |
+
throw new Exception(__('Error creating attachment for the media file, please try again', BP_MEDIA_TXT_DOMAIN));
|
229 |
+
}
|
230 |
+
$this->id = $attachment_id;
|
231 |
+
$this->name = $name;
|
232 |
+
$this->description = $description;
|
233 |
+
$this->type = $type;
|
234 |
+
$this->owner = get_current_user_id();
|
235 |
+
$this->album_id = $post_id;
|
236 |
+
$this->group_id = $group;
|
237 |
+
$this->set_permalinks();
|
238 |
+
if ($group == 0) {
|
239 |
+
update_post_meta($attachment_id, 'bp-media-key', get_current_user_id());
|
240 |
+
} else {
|
241 |
+
update_post_meta($attachment_id, 'bp-media-key', (-$group));
|
242 |
+
}
|
243 |
+
do_action('bp_media_after_add_media', $this, $is_multiple, $is_activity, $group);
|
244 |
+
return $attachment_id;
|
245 |
+
}
|
246 |
+
|
247 |
+
function get_media_thumbnail($size = 'thumbnail') {
|
248 |
+
$thumb = '';
|
249 |
+
if (in_array($this->type, array('image', 'video', 'audio'))) {
|
250 |
+
if ($this->thumbnail_id) {
|
251 |
+
$medium_array = image_downsize($this->thumbnail_id, $size);
|
252 |
+
$thumb_url = $medium_array[0];
|
253 |
+
} else {
|
254 |
+
$thumb_url = BP_MEDIA_URL . 'app/assets/img/' . $this->type . '_thumb.png';
|
255 |
+
}
|
256 |
+
$thumb = apply_filters('bp_media_video_thumb', $thumb_url, $this->thumbnail_id, $this->type);
|
257 |
+
return $thumb;
|
258 |
+
}
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Fetches the content of the activity of media upload based on its type
|
264 |
+
*
|
265 |
+
*/
|
266 |
+
|
267 |
+
/**
|
268 |
+
*
|
269 |
+
* @global type $bp_media_counter
|
270 |
+
* @global type $bp_media_default_excerpts
|
271 |
+
* @global type $bp_media
|
272 |
+
* @return boolean|string
|
273 |
+
*/
|
274 |
+
function get_media_activity_content() {
|
275 |
+
global $bp_media_counter, $bp_media_default_excerpts, $bp_media;
|
276 |
+
$attachment_id = $this->id;
|
277 |
+
$activity_content = apply_filters('bp_media_single_activity_title', '<div class="bp_media_title"><a href="' . $this->url . '" title="' . __($this->description, BP_MEDIA_TXT_DOMAIN) . '">' . __(wp_html_excerpt($this->name, $bp_media_default_excerpts['activity_entry_title']), BP_MEDIA_TXT_DOMAIN) . '</a></div>');
|
278 |
+
$activity_content .='<div class="bp_media_content">';
|
279 |
+
switch ($this->type) {
|
280 |
+
case 'video' :
|
281 |
+
if ($this->thumbnail_id) {
|
282 |
+
$image_array = image_downsize($this->thumbnail_id, 'bp_media_activity_image');
|
283 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($attachment_id) . '" width="320" height="240" type="video/mp4" id="bp_media_video_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none"></video></span>', $this, true);
|
284 |
+
} else {
|
285 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<video src="' . wp_get_attachment_url($attachment_id) . '" width="320" height="240" type="video/mp4" id="bp_media_video_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none"></video></span>', $this, true);
|
286 |
+
}
|
287 |
+
break;
|
288 |
+
case 'audio' :
|
289 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<audio src="' . wp_get_attachment_url($attachment_id) . '" width="320" type="audio/mp3" id="bp_media_audio_' . $this->id . '_' . $bp_media_counter . '" controls="controls" preload="none" ></audio></span>', $this, true);
|
290 |
+
$type = 'audio';
|
291 |
+
break;
|
292 |
+
case 'image' :
|
293 |
+
$image_array = image_downsize($attachment_id, 'bp_media_activity_image');
|
294 |
+
$activity_content.=apply_filters('bp_media_single_activity_filter', '<a href="' . $this->url . '" title="' . __($this->name, BP_MEDIA_TXT_DOMAIN) . '"><img src="' . $image_array[0] . '" id="bp_media_image_' . $this->id . '_' . $bp_media_counter++ . '" alt="' . __($this->name, BP_MEDIA_TXT_DOMAIN) . '" /></a>', $this, true);
|
295 |
+
$type = 'image';
|
296 |
+
break;
|
297 |
+
default :
|
298 |
+
return false;
|
299 |
+
}
|
300 |
+
$activity_content .= '</div>';
|
301 |
+
$activity_content .= apply_filters('bp_media_single_activity_description', '<div class="bp_media_description">' . wp_html_excerpt($this->description, $bp_media_default_excerpts['activity_entry_description']) . '</div>');
|
302 |
+
return $activity_content;
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Returns the single media entry's URL
|
307 |
+
*/
|
308 |
+
|
309 |
+
/**
|
310 |
+
*
|
311 |
+
* @return boolean
|
312 |
+
*/
|
313 |
+
function get_media_activity_url() {
|
314 |
+
if (!bp_is_activity_component())
|
315 |
+
return false;
|
316 |
+
$activity_url = $this->url;
|
317 |
+
return $activity_url;
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Returns the media activity's action text
|
322 |
+
*/
|
323 |
+
|
324 |
+
/**
|
325 |
+
*
|
326 |
+
* @global type $bp_media
|
327 |
+
* @return boolean
|
328 |
+
*/
|
329 |
+
function get_media_activity_action() {
|
330 |
+
global $bp_media;
|
331 |
+
if (!bp_is_activity_component())
|
332 |
+
return false;
|
333 |
+
$activity_action = sprintf(__("%s uploaded a media.", BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($this->owner));
|
334 |
+
return $activity_action;
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Returns the HTML for content of the single entry page of the Media Entry
|
339 |
+
*/
|
340 |
+
|
341 |
+
/**
|
342 |
+
*
|
343 |
+
* @global type $bp_media_default_excerpts
|
344 |
+
* @global type $bp_media
|
345 |
+
* @return boolean|string
|
346 |
+
*/
|
347 |
+
function get_media_single_content() {
|
348 |
+
global $bp_media_default_excerpts, $bp_media;
|
349 |
+
|
350 |
+
$default_sizes = $bp_media->media_sizes();
|
351 |
+
$content = '';
|
352 |
+
if ($this->group_id > 0) {
|
353 |
+
|
354 |
+
$content .= '<div class="bp_media_author">' . __("Uploaded by ", BP_MEDIA_TXT_DOMAIN) . bp_core_get_userlink($this->owner) . '</div>';
|
355 |
+
}
|
356 |
+
$content .= '<div class="bp_media_content">';
|
357 |
+
switch ($this->type) {
|
358 |
+
case 'video' :
|
359 |
+
if ($this->thumbnail_id) {
|
360 |
+
$image_array = image_downsize($this->thumbnail_id, 'bp_media_single_image');
|
361 |
+
$content.=apply_filters('bp_media_single_content_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($this->id) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $this->id . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $this->id . '");</script>', $this);
|
362 |
+
} else {
|
363 |
+
$content.=apply_filters('bp_media_single_content_filter', '<video src="' . wp_get_attachment_url($this->id) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $this->id . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $this->id . '");</script>', $this);
|
364 |
+
}
|
365 |
+
break;
|
366 |
+
case 'audio' :
|
367 |
+
$content.=apply_filters('bp_media_single_content_filter', '<audio src="' . wp_get_attachment_url($this->id) . '" width="' . $default_sizes['single_audio']['width'] . '" type="audio/mp3" id="bp_media_audio_' . $this->id . '" controls="controls" preload="none" ></audio><script>bp_media_create_element("bp_media_audio_' . $this->id . '");</script>', $this);
|
368 |
+
break;
|
369 |
+
case 'image' :
|
370 |
+
$image_array = image_downsize($this->id, 'bp_media_single_image');
|
371 |
+
$content.=apply_filters('bp_media_single_content_filter', '<img src="' . $image_array[0] . '" id="bp_media_image_' . $this->id . '" />', $this);
|
372 |
+
break;
|
373 |
+
default :
|
374 |
+
return false;
|
375 |
+
}
|
376 |
+
$content .= '</div>';
|
377 |
+
$content .= '<div class="bp_media_description">' . nl2br($this->description) . '</div>';
|
378 |
+
return $content;
|
379 |
+
}
|
380 |
+
|
381 |
+
public function exif($file) {
|
382 |
+
|
383 |
+
$file_parts = pathinfo($file['file']);
|
384 |
+
if (in_array(strtolower($file_parts['extension']), array('jpg', 'jpeg', 'tiff'))) {
|
385 |
+
$exif = read_exif_data($file['file']);
|
386 |
+
$exif_orient = isset($exif['Orientation']) ? $exif['Orientation'] : 0;
|
387 |
+
$rotateImage = 0;
|
388 |
+
|
389 |
+
if (6 == $exif_orient) {
|
390 |
+
$rotateImage = 90;
|
391 |
+
$imageOrientation = 1;
|
392 |
+
} elseif (3 == $exif_orient) {
|
393 |
+
$rotateImage = 180;
|
394 |
+
$imageOrientation = 1;
|
395 |
+
} elseif (8 == $exif_orient) {
|
396 |
+
$rotateImage = 270;
|
397 |
+
$imageOrientation = 1;
|
398 |
+
}
|
399 |
+
|
400 |
+
if ($rotateImage) {
|
401 |
+
if (class_exists('Imagick')) {
|
402 |
+
$imagick = new Imagick();
|
403 |
+
$imagick->readImage($file['file']);
|
404 |
+
$imagick->rotateImage(new ImagickPixel(), $rotateImage);
|
405 |
+
$imagick->setImageOrientation($imageOrientation);
|
406 |
+
$imagick->writeImage($file['file']);
|
407 |
+
$imagick->clear();
|
408 |
+
$imagick->destroy();
|
409 |
+
} else {
|
410 |
+
$rotateImage = -$rotateImage;
|
411 |
+
|
412 |
+
switch ($file['type']) {
|
413 |
+
case 'image/jpeg':
|
414 |
+
$source = imagecreatefromjpeg($file['file']);
|
415 |
+
$rotate = imagerotate($source, $rotateImage, 0);
|
416 |
+
imagejpeg($rotate, $file['file']);
|
417 |
+
break;
|
418 |
+
case 'image/png':
|
419 |
+
$source = imagecreatefrompng($file['file']);
|
420 |
+
$rotate = imagerotate($source, $rotateImage, 0);
|
421 |
+
imagepng($rotate, $file['file']);
|
422 |
+
break;
|
423 |
+
case 'image/gif':
|
424 |
+
$source = imagecreatefromgif($file['file']);
|
425 |
+
$rotate = imagerotate($source, $rotateImage, 0);
|
426 |
+
imagegif($rotate, $file['file']);
|
427 |
+
break;
|
428 |
+
default:
|
429 |
+
break;
|
430 |
+
}
|
431 |
+
}
|
432 |
+
}
|
433 |
+
}
|
434 |
+
return $file;
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Returns the HTML for title of the single entry page of the Media Entry
|
439 |
+
*/
|
440 |
+
|
441 |
+
/**
|
442 |
+
*
|
443 |
+
* @global type $bp_media_default_excerpts
|
444 |
+
* @global type $bp_media
|
445 |
+
* @return string
|
446 |
+
*/
|
447 |
+
function get_media_single_title() {
|
448 |
+
global $bp_media_default_excerpts, $bp_media;
|
449 |
+
$content = wp_html_excerpt($this->name, $bp_media_default_excerpts['single_entry_title']);
|
450 |
+
return $content;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Returns the HTML for a media entry to be shown in the listing/gallery page
|
455 |
+
*/
|
456 |
+
|
457 |
+
/**
|
458 |
+
*
|
459 |
+
* @global type $bp_media
|
460 |
+
* @return boolean
|
461 |
+
*/
|
462 |
+
function get_media_gallery_content() {
|
463 |
+
$attachment = $this->id;
|
464 |
+
switch ($this->type) {
|
465 |
+
case 'video' :
|
466 |
+
if ($this->thumbnail_id) {
|
467 |
+
$medium_array = image_downsize($this->thumbnail_id, 'thumbnail');
|
468 |
+
$thumb_url = $medium_array[0];
|
469 |
+
} else {
|
470 |
+
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
471 |
+
}
|
472 |
+
?>
|
473 |
+
<li id="bp-media-item-<?php echo $this->id ?>">
|
474 |
+
<a href="<?php echo $this->url ?>" title="<?php _e($this->description, BP_MEDIA_TXT_DOMAIN); ?>">
|
475 |
+
<img src="<?php echo apply_filters('bp_media_video_thumb', $thumb_url, $attachment, $this->type); ?>" />
|
476 |
+
</a>
|
477 |
+
<h3 title="<?php echo $this->name; ?>"><a href="<?php echo $this->url ?>" title="<?php _e($this->description, BP_MEDIA_TXT_DOMAIN); ?>"><?php echo $this->name; ?></a></h3>
|
478 |
+
</li>
|
479 |
+
<?php
|
480 |
+
break;
|
481 |
+
case 'audio' :
|
482 |
+
if ($this->thumbnail_id) {
|
483 |
+
$medium_array = image_downsize($this->thumbnail_id, 'thumbnail');
|
484 |
+
$thumb_url = $medium_array[0];
|
485 |
+
} else {
|
486 |
+
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
487 |
+
}
|
488 |
+
?>
|
489 |
+
<li id="bp-media-item-<?php echo $this->id ?>">
|
490 |
+
<a href="<?php echo $this->url ?>" title="<?php _e($this->description, BP_MEDIA_TXT_DOMAIN); ?>">
|
491 |
+
<img src="<?php echo $thumb_url ?>" />
|
492 |
+
</a>
|
493 |
+
<h3 title="<?php echo $this->name; ?>"><a href="<?php echo $this->url ?>" title="<?php _e($this->description, BP_MEDIA_TXT_DOMAIN); ?>"><?php echo $this->name ?></a></h3>
|
494 |
+
<div class="bp-media-ajax-preloader"></div>
|
495 |
+
</li>
|
496 |
+
<?php
|
497 |
+
break;
|
498 |
+
case 'image' :
|
499 |
+
$medium_array = image_downsize($attachment, 'thumbnail');
|
500 |
+
$medium_path = $medium_array[0];
|
501 |
+
?>
|
502 |
+
<li id="bp-media-item-<?php echo $this->id ?>">
|
503 |
+
<a href="<?php echo $this->url ?>" title="<?php echo $this->description ?>">
|
504 |
+
<img src="<?php echo $medium_path ?>" />
|
505 |
+
</a>
|
506 |
+
<h3 title="<?php echo $this->name ?>"><a href="<?php echo $this->url ?>" title="<?php _e($this->description, BP_MEDIA_TXT_DOMAIN); ?>"><?php echo $this->name ?></a></h3>
|
507 |
+
<div class="bp-media-ajax-preloader"></div>
|
508 |
+
</li>
|
509 |
+
<?php
|
510 |
+
break;
|
511 |
+
default :
|
512 |
+
return false;
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
function show_comment_form_wordpress() {
|
517 |
+
query_posts('attachment_id=' . $this->id);
|
518 |
+
while (have_posts()): the_post();
|
519 |
+
add_action('comment_form', 'BPMediaFunction::wp_comment_form_mod');
|
520 |
+
comments_template();
|
521 |
+
endwhile;
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* Outputs the comments and comment form in the single media entry page
|
526 |
+
*/
|
527 |
+
|
528 |
+
/**
|
529 |
+
*
|
530 |
+
* @global type $bp_media
|
531 |
+
* @return boolean
|
532 |
+
*/
|
533 |
+
function show_comment_form() {
|
534 |
+
global $bp_media;
|
535 |
+
$activity_id = get_post_meta($this->id, 'bp_media_child_activity', true);
|
536 |
+
if (!$activity_id || !function_exists('bp_has_activities'))
|
537 |
+
return false;
|
538 |
+
if (bp_has_activities(array(
|
539 |
+
'display_comments' => 'stream',
|
540 |
+
'include' => $activity_id,
|
541 |
+
'max' => 1
|
542 |
+
))) {
|
543 |
+
while (bp_activities()) {
|
544 |
+
bp_the_activity();
|
545 |
+
do_action('bp_before_activity_entry');
|
546 |
+
?>
|
547 |
+
<div class="activity">
|
548 |
+
<ul id="activity-stream" class="activity-list item-list">
|
549 |
+
<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
|
550 |
+
<div class="activity-content">
|
551 |
+
<?php do_action('bp_activity_entry_content'); ?>
|
552 |
+
<?php if (is_user_logged_in()) : ?>
|
553 |
+
<div class="activity-meta no-ajax">
|
554 |
+
<?php if (bp_activity_can_comment()) : ?>
|
555 |
+
<a href="<?php bp_get_activity_comment_link(); ?>" class="button acomment-reply bp-primary-action" id="acomment-comment-<?php bp_activity_id(); ?>"><?php printf(__('Comment <span>%s</span>', BP_MEDIA_TXT_DOMAIN), bp_activity_get_comment_count()); ?></a>
|
556 |
+
<?php endif; ?>
|
557 |
+
<?php if (bp_activity_can_favorite()) : ?>
|
558 |
+
<?php if (!bp_get_activity_is_favorite()) : ?>
|
559 |
+
<a href="<?php bp_activity_favorite_link(); ?>" class="button fav bp-secondary-action" title="<?php esc_attr_e('Mark as Favorite', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('Favorite', BP_MEDIA_TXT_DOMAIN) ?></a>
|
560 |
+
<?php else : ?>
|
561 |
+
<a href="<?php bp_activity_unfavorite_link(); ?>" class="button unfav bp-secondary-action" title="<?php esc_attr_e('Remove Favorite', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('Remove Favorite', BP_MEDIA_TXT_DOMAIN) ?></a>
|
562 |
+
<?php endif; ?>
|
563 |
+
<?php endif; ?>
|
564 |
+
<?php do_action('bp_activity_entry_meta'); ?>
|
565 |
+
<?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?>
|
566 |
+
</div>
|
567 |
+
<?php endif; ?>
|
568 |
+
</div>
|
569 |
+
<?php do_action('bp_before_activity_entry_comments'); ?>
|
570 |
+
<?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?>
|
571 |
+
<div class="activity-comments">
|
572 |
+
<?php bp_activity_comments(); ?>
|
573 |
+
<?php if (is_user_logged_in()) : ?>
|
574 |
+
<form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>>
|
575 |
+
<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div>
|
576 |
+
<div class="ac-reply-content">
|
577 |
+
<div class="ac-textarea">
|
578 |
+
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
|
579 |
+
</div>
|
580 |
+
<input type="submit" name="ac_form_submit" value="<?php _e('Post', BP_MEDIA_TXT_DOMAIN); ?>" /> <?php _e('or press esc to cancel.', BP_MEDIA_TXT_DOMAIN); ?>
|
581 |
+
<input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
|
582 |
+
</div>
|
583 |
+
<?php do_action('bp_activity_entry_comments'); ?>
|
584 |
+
<?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
|
585 |
+
</form>
|
586 |
+
<?php endif; ?>
|
587 |
+
</div>
|
588 |
+
<?php endif; ?>
|
589 |
+
<?php do_action('bp_after_activity_entry_comments'); ?>
|
590 |
+
</li>
|
591 |
+
</ul>
|
592 |
+
</div>
|
593 |
+
<?php
|
594 |
+
}
|
595 |
+
}
|
596 |
+
else {
|
597 |
+
?>
|
598 |
+
<div class="activity">
|
599 |
+
<ul id="activity-stream" class="activity-list item-list">
|
600 |
+
<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
|
601 |
+
<div class="activity-content">
|
602 |
+
<?php do_action('bp_activity_entry_content'); ?>
|
603 |
+
<?php if (is_user_logged_in()) : ?>
|
604 |
+
<div class="activity-meta no-ajax">
|
605 |
+
<a href="<?php echo $this->get_delete_url(); ?>" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow"><?php _e("Delete", BP_MEDIA_TXT_DOMAIN); ?></a>
|
606 |
+
</div>
|
607 |
+
<?php endif; ?>
|
608 |
+
</div>
|
609 |
+
</li>
|
610 |
+
</ul>
|
611 |
+
</div>
|
612 |
+
<?php
|
613 |
+
}
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Returns the URL of the single media entry page
|
618 |
+
*/
|
619 |
+
|
620 |
+
/**
|
621 |
+
*
|
622 |
+
* @return type
|
623 |
+
*/
|
624 |
+
function get_url() {
|
625 |
+
return $this->url;
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Returns the URL of the attached media file
|
630 |
+
*/
|
631 |
+
|
632 |
+
/**
|
633 |
+
*
|
634 |
+
* @return type
|
635 |
+
*/
|
636 |
+
function get_attachment_url() {
|
637 |
+
return wp_get_attachment_url($this->id);
|
638 |
+
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Updates the media entry
|
642 |
+
*
|
643 |
+
* @param array $args Array with the following keys:<br/>
|
644 |
+
* 'name' <br/>
|
645 |
+
* 'description'<br/>
|
646 |
+
* 'owner'
|
647 |
+
*
|
648 |
+
* @return bool True when the update is successful, False when the update fails
|
649 |
+
*/
|
650 |
+
|
651 |
+
/**
|
652 |
+
*
|
653 |
+
* @param type $args
|
654 |
+
* @return type
|
655 |
+
*/
|
656 |
+
function update_media($args = array()) {
|
657 |
+
$defaults = array(
|
658 |
+
'name' => $this->name,
|
659 |
+
'description' => $this->description,
|
660 |
+
'owner' => $this->owner
|
661 |
+
);
|
662 |
+
$args = wp_parse_args($args, $defaults);
|
663 |
+
$post = get_post($this->id, ARRAY_A);
|
664 |
+
$post['post_title'] = esc_html($args['name']);
|
665 |
+
$post['post_content'] = esc_html($args['description']);
|
666 |
+
$post['post_author'] = $args['owner'];
|
667 |
+
$result = wp_update_post($post);
|
668 |
+
$this->init($this->id);
|
669 |
+
do_action('bp_media_after_update_media', $this);
|
670 |
+
return $result;
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* Updates activity content's title and description sync with the editing of Media
|
675 |
+
*
|
676 |
+
*/
|
677 |
+
|
678 |
+
/**
|
679 |
+
*
|
680 |
+
* @global type $wpdb
|
681 |
+
* @global type $bp
|
682 |
+
* @global type $current_user
|
683 |
+
* @global type $bp_media
|
684 |
+
*/
|
685 |
+
function update_media_activity() {
|
686 |
+
global $wpdb, $bp, $current_user, $bp_media;
|
687 |
+
$q = $wpdb->prepare("SELECT id FROM {$bp->activity->table_name} WHERE type = %s AND item_id = %d", 'media_upload', $this->id);
|
688 |
+
$activities = $wpdb->get_results($q);
|
689 |
+
if (isset($activities) && count($activities) > 0) {
|
690 |
+
$activities_template = new BP_Activity_Template(array(
|
691 |
+
'max' => TRUE,
|
692 |
+
'user_id' => $current_user,
|
693 |
+
'in' => $activities[0]->id
|
694 |
+
));
|
695 |
+
foreach ($activities_template->activities as $activity) {
|
696 |
+
if (isset($_POST['bp_media_group_id'])) {
|
697 |
+
$component = $bp->groups->id;
|
698 |
+
$item_id = $_POST['bp_media_group_id'];
|
699 |
+
} else {
|
700 |
+
$component = $bp->activity->id;
|
701 |
+
$item_id = $this->get_id();
|
702 |
+
}
|
703 |
+
$args = array(
|
704 |
+
'content' => $this->get_media_activity_content(),
|
705 |
+
'id' => $activity->id,
|
706 |
+
'type' => $component,
|
707 |
+
'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($this->get_author()), '<a href="' . $this->get_url() . '">' . $this->get_media_activity_type() . '</a>')),
|
708 |
+
'primary_link' => $this->get_url(),
|
709 |
+
'item_id' => $item_id,
|
710 |
+
'recorded_time' => $activity->date_recorded,
|
711 |
+
'user_id' => $this->get_author()
|
712 |
+
);
|
713 |
+
$activity_id = BPMediaFunction::record_activity($args);
|
714 |
+
}
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
+
/**
|
719 |
+
* Deletes the Media Entry
|
720 |
+
*/
|
721 |
+
|
722 |
+
/**
|
723 |
+
*
|
724 |
+
* @global type $bp_media_count
|
725 |
+
*/
|
726 |
+
function delete_media() {
|
727 |
+
do_action('bp_media_before_delete_media', $this->id);
|
728 |
+
wp_delete_attachment($this->id, true);
|
729 |
+
do_action('bp_media_after_delete_media', $this->id);
|
730 |
+
}
|
731 |
+
|
732 |
+
/**
|
733 |
+
* Function to return the content to be placed in the activity of album
|
734 |
+
*/
|
735 |
+
|
736 |
+
/**
|
737 |
+
*
|
738 |
+
* @return boolean|string
|
739 |
+
*/
|
740 |
+
function get_album_activity_content() {
|
741 |
+
$attachment = $this->id;
|
742 |
+
switch ($this->type) {
|
743 |
+
case 'video' :
|
744 |
+
if ($this->thumbnail_id) {
|
745 |
+
$medium_array = image_downsize($this->thumbnail_id, 'thumbnail');
|
746 |
+
$thumb_url = $medium_array[0];
|
747 |
+
} else {
|
748 |
+
$thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
|
749 |
+
}
|
750 |
+
break;
|
751 |
+
case 'audio' :
|
752 |
+
if ($this->thumbnail_id) {
|
753 |
+
$medium_array = image_downsize($this->thumbnail_id, 'thumbnail');
|
754 |
+
$thumb_url = $medium_array[0];
|
755 |
+
} else {
|
756 |
+
$thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
|
757 |
+
}
|
758 |
+
break;
|
759 |
+
case 'image' :
|
760 |
+
$medium_array = image_downsize($attachment, 'thumbnail');
|
761 |
+
$thumb_url = $medium_array[0];
|
762 |
+
break;
|
763 |
+
default :
|
764 |
+
return false;
|
765 |
+
}
|
766 |
+
$content = '<li>';
|
767 |
+
$content .= '<a href="' . $this->url . '" title="' . $this->name . '">';
|
768 |
+
$content .= '<img src="' . $thumb_url . '" />';
|
769 |
+
$content .= '</a>';
|
770 |
+
$content .= '</li>';
|
771 |
+
return $content;
|
772 |
+
}
|
773 |
+
|
774 |
+
/**
|
775 |
+
* Returns the description of the Media Entry
|
776 |
+
*/
|
777 |
+
|
778 |
+
/**
|
779 |
+
*
|
780 |
+
* @return type
|
781 |
+
*/
|
782 |
+
function get_content() {
|
783 |
+
return $this->description;
|
784 |
+
}
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Returns the owner id of the Media Entry
|
788 |
+
*/
|
789 |
+
|
790 |
+
/**
|
791 |
+
*
|
792 |
+
* @return type
|
793 |
+
*/
|
794 |
+
function get_author() {
|
795 |
+
return $this->owner;
|
796 |
+
}
|
797 |
+
|
798 |
+
/**
|
799 |
+
* Returns the id of the Media Entry
|
800 |
+
*/
|
801 |
+
|
802 |
+
/**
|
803 |
+
*
|
804 |
+
* @return type
|
805 |
+
*/
|
806 |
+
function get_id() {
|
807 |
+
return $this->id;
|
808 |
+
}
|
809 |
+
|
810 |
+
/**
|
811 |
+
* Returns the edit url of the Media Entry
|
812 |
+
*/
|
813 |
+
|
814 |
+
/**
|
815 |
+
*
|
816 |
+
* @return type
|
817 |
+
*/
|
818 |
+
function get_edit_url() {
|
819 |
+
return $this->edit_url;
|
820 |
+
}
|
821 |
+
|
822 |
+
/**
|
823 |
+
* Returns the delete url of the Media Entry
|
824 |
+
*/
|
825 |
+
|
826 |
+
/**
|
827 |
+
*
|
828 |
+
* @return type
|
829 |
+
*/
|
830 |
+
function get_delete_url() {
|
831 |
+
return $this->delete_url;
|
832 |
+
}
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Returns the type of activity
|
836 |
+
*/
|
837 |
+
|
838 |
+
/**
|
839 |
+
*
|
840 |
+
* @return string
|
841 |
+
*/
|
842 |
+
function get_media_activity_type() {
|
843 |
+
switch ($this->type) {
|
844 |
+
case 'image':
|
845 |
+
return BP_MEDIA_IMAGES_LABEL_SINGULAR;
|
846 |
+
case 'video':
|
847 |
+
return BP_MEDIA_VIDEOS_LABEL_SINGULAR;
|
848 |
+
case 'audio':
|
849 |
+
return BP_MEDIA_AUDIO_LABEL_SINGULAR;
|
850 |
+
default:
|
851 |
+
return 'Media';
|
852 |
+
}
|
853 |
+
}
|
854 |
+
|
855 |
+
/**
|
856 |
+
* Returns the album id
|
857 |
+
*/
|
858 |
+
|
859 |
+
/**
|
860 |
+
*
|
861 |
+
* @return type
|
862 |
+
*/
|
863 |
+
function get_album_id() {
|
864 |
+
return $this->album_id;
|
865 |
+
}
|
866 |
+
|
867 |
+
/**
|
868 |
+
* Returns the title of the media
|
869 |
+
*/
|
870 |
+
|
871 |
+
/**
|
872 |
+
*
|
873 |
+
* @return type
|
874 |
+
*/
|
875 |
+
function get_title() {
|
876 |
+
return $this->name;
|
877 |
+
}
|
878 |
+
|
879 |
+
/**
|
880 |
+
* Returns the type of media
|
881 |
+
*/
|
882 |
+
|
883 |
+
/**
|
884 |
+
*
|
885 |
+
* @return type
|
886 |
+
*/
|
887 |
+
function get_type() {
|
888 |
+
return $this->type;
|
889 |
+
}
|
890 |
+
|
891 |
+
/**
|
892 |
+
* Returns the thumbnail id
|
893 |
+
*/
|
894 |
+
function get_thumbnail_id() {
|
895 |
+
return $this->thumbnail_id;
|
896 |
+
}
|
897 |
+
|
898 |
+
/**
|
899 |
+
* Returns the group id of the media, 0 if it does not belong to a group
|
900 |
+
*/
|
901 |
+
|
902 |
+
/**
|
903 |
+
*
|
904 |
+
* @return type
|
905 |
+
*/
|
906 |
+
function get_group_id() {
|
907 |
+
return $this->group_id;
|
908 |
+
}
|
909 |
+
|
910 |
+
/**
|
911 |
+
* Sets the permalinks of the media depending upon whether its in member directory
|
912 |
+
* or group and acording to the media type
|
913 |
+
*/
|
914 |
+
|
915 |
+
/**
|
916 |
+
*
|
917 |
+
* @return boolean
|
918 |
+
*/
|
919 |
+
protected function set_permalinks() {
|
920 |
+
|
921 |
+
if (bp_is_active('groups') && class_exists('BP_Group_Extension')) {
|
922 |
+
if ($this->group_id > 0) {
|
923 |
+
$current_group = new BP_Groups_Group($this->group_id);
|
924 |
+
$pre_url = bp_get_group_permalink($current_group);
|
925 |
+
} else {
|
926 |
+
$pre_url = bp_core_get_user_domain($this->owner);
|
927 |
+
}
|
928 |
+
} else {
|
929 |
+
$pre_url = bp_core_get_user_domain($this->owner);
|
930 |
+
}
|
931 |
+
switch ($this->type) {
|
932 |
+
case 'video' :
|
933 |
+
$this->url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . $this->id);
|
934 |
+
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_EDIT_SLUG . '/' . $this->id);
|
935 |
+
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
936 |
+
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
|
937 |
+
break;
|
938 |
+
case 'audio' :
|
939 |
+
$this->url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . $this->id);
|
940 |
+
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_EDIT_SLUG . '/' . $this->id);
|
941 |
+
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
942 |
+
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
|
943 |
+
break;
|
944 |
+
case 'image' :
|
945 |
+
$this->url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . $this->id);
|
946 |
+
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
|
947 |
+
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
948 |
+
$image_array = image_downsize($this->id, 'bp_media_single_image');
|
949 |
+
$this->thumbnail_id = $this->id;
|
950 |
+
break;
|
951 |
+
case 'album' :
|
952 |
+
$this->url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
|
953 |
+
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
|
954 |
+
$this->delete_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
|
955 |
// $this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
|
956 |
+
break;
|
957 |
+
default :
|
958 |
+
return false;
|
959 |
+
}
|
960 |
+
return true;
|
961 |
+
}
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Checks if the album given exists if not, creates a new one according to context
|
965 |
+
*/
|
966 |
+
|
967 |
+
/**
|
968 |
+
*
|
969 |
+
* @global type $wpdb
|
970 |
+
* @param type $album_id
|
971 |
+
* @param type $group
|
972 |
+
* @return type
|
973 |
+
*/
|
974 |
+
function check_and_create_album($album_id, $group) {
|
975 |
+
global $wpdb;
|
976 |
+
$post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN);
|
977 |
+
$create_new_album_flag = false;
|
978 |
+
if ($album_id != 0) {
|
979 |
+
$album = get_post($album_id);
|
980 |
+
if ($album->post_author != get_current_user_id() && $group == 0) {
|
981 |
+
$create_new_album_flag = true;
|
982 |
+
} else {
|
983 |
+
$post_id = $album->ID;
|
984 |
+
}
|
985 |
+
} else {
|
986 |
+
$create_new_album_flag = true;
|
987 |
+
}
|
988 |
+
$current_user = wp_get_current_user();
|
989 |
+
if ($create_new_album_flag) {
|
990 |
+
if ($group == 0) {
|
991 |
+
$post_id = $wpdb->get_var(
|
992 |
+
"SELECT ID
|
993 |
FROM $wpdb->posts
|
994 |
WHERE
|
995 |
post_title = $post_wall
|
996 |
AND post_author = '" . get_current_user_id() . "'
|
997 |
AND post_type='bp_media_album'"
|
998 |
+
);
|
999 |
+
} else {
|
1000 |
+
$post_id = $wpdb->get_var(
|
1001 |
+
"SELECT wp_posts.ID
|
1002 |
FROM $wpdb->posts
|
1003 |
INNER JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id
|
1004 |
AND $wpdb->postmeta.meta_key = 'bp-media-key'
|
1005 |
AND $wpdb->postmeta.meta_value = -$group
|
1006 |
+
AND $wpdb->posts.post_title = '$current_user->display_name\'s Album'");
|
1007 |
+
}
|
1008 |
+
if ($post_id == null) {
|
1009 |
+
$album = new BPMediaAlbum();
|
1010 |
+
if ($group == 0)
|
1011 |
+
$album->add_album($post_wall, get_current_user_id(), $group);
|
1012 |
+
else {
|
1013 |
+
$album->add_album($current_user->display_name . '\'s Album', get_current_user_id(), $group);
|
1014 |
+
}
|
1015 |
+
$post_id = $album->get_id();
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
return $post_id;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
function get_description() {
|
1022 |
+
return $this->description;
|
1023 |
+
}
|
1024 |
|
1025 |
}
|
1026 |
?>
|
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.
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
@@ -50,7 +50,7 @@ function buddypress_media_autoloader( $class_name ) {
|
|
50 |
'app/main/profile/' . $class_name . '.php',
|
51 |
'app/main/group/' . $class_name . '.php',
|
52 |
'app/main/query/' . $class_name . '.php',
|
53 |
-
|
54 |
'app/main/group/dummy/' . $class_name . '.php',
|
55 |
'app/main/includes/' . $class_name . '.php',
|
56 |
'app/main/widgets/' . $class_name . '.php',
|
@@ -77,9 +77,6 @@ spl_autoload_register( 'buddypress_media_autoloader' );
|
|
77 |
global $bp_media;
|
78 |
$bp_media = new BuddyPressMedia();
|
79 |
|
80 |
-
//add_action('init','BPMediaBPAlbumImporter');
|
81 |
-
|
82 |
-
//BPMediaBPAlbumImporter::bpmedia_ajax_import_callback();
|
83 |
/*
|
84 |
* Look Ma! Very few includes! Next File: /app/main/BuddyPressMedia.php
|
85 |
*/
|
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.6
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
50 |
'app/main/profile/' . $class_name . '.php',
|
51 |
'app/main/group/' . $class_name . '.php',
|
52 |
'app/main/query/' . $class_name . '.php',
|
53 |
+
'app/main/privacy/' . $class_name . '.php',
|
54 |
'app/main/group/dummy/' . $class_name . '.php',
|
55 |
'app/main/includes/' . $class_name . '.php',
|
56 |
'app/main/widgets/' . $class_name . '.php',
|
77 |
global $bp_media;
|
78 |
$bp_media = new BuddyPressMedia();
|
79 |
|
|
|
|
|
|
|
80 |
/*
|
81 |
* Look Ma! Very few includes! Next File: /app/main/BuddyPressMedia.php
|
82 |
*/
|
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.
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
@@ -122,6 +122,12 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
|
|
122 |
|
123 |
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.
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
= 2.7.5 =
|
126 |
* Fixes image rotation for PHP < 5.3 that caused upload failure
|
127 |
|
@@ -342,5 +348,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
|
|
342 |
* HTML5 Video Tag Support (with fallback)
|
343 |
|
344 |
== Upgrade Notice ==
|
345 |
-
= 2.7.
|
346 |
-
|
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.6
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
122 |
|
123 |
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.
|
124 |
|
125 |
+
= 2.7.6 =
|
126 |
+
* Fixes errors due to absence of EXIF
|
127 |
+
* Fixes duplicate comment box on lightbox
|
128 |
+
* Fixes multimedia display on single media view
|
129 |
+
* Rewrites activity uploader to fix a lot of issues with themes
|
130 |
+
|
131 |
= 2.7.5 =
|
132 |
* Fixes image rotation for PHP < 5.3 that caused upload failure
|
133 |
|
348 |
* HTML5 Video Tag Support (with fallback)
|
349 |
|
350 |
== Upgrade Notice ==
|
351 |
+
= 2.7.6 =
|
352 |
+
Fixes bugs and improves activity uploader
|