rtMedia for WordPress, BuddyPress and bbPress - Version 2.5.4

Version Description

  • Added option to enable/disable BuddyPress Media on Groups. (Profile toggle, coming soon)
  • Added Polish language.
  • Media tabs display now responds to admin settings
  • Improved Uploader UI.
  • Improved settings screen.
  • More code comments and documentation added.
  • Fixed gallery responsiveness.
  • A few bug fixes.
Download this release

Release Info

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

Code changes from version 2.5.3 to 2.5.4

Files changed (52) hide show
  1. app/admin/BPMediaAdmin.php +195 -164
  2. app/assets/css/main.css +75 -39
  3. app/assets/img/drag-drop-bg.png +0 -0
  4. app/assets/js/admin.js +10 -6
  5. app/assets/js/bp-media-activity-uploader.js +239 -0
  6. app/assets/js/bp-media-uploader.js +109 -102
  7. app/helper/BPMediaSettings.php +61 -26
  8. app/{main/importers → importers}/BPMediaBPActivityPlusImporter.php +0 -0
  9. app/importers/BPMediaBPAlbumImporter.php +87 -0
  10. app/importers/BPMediaImporter.php +116 -0
  11. app/main/BPMediaComponent.php +538 -0
  12. app/main/BPMediaGroupLoader.php +312 -0
  13. app/main/BPMediaLoader.php +152 -110
  14. app/main/BuddyPressMedia.php +616 -320
  15. app/main/activity/BPMediaActivity.php +163 -0
  16. app/main/group/BPMediaGroup.php +0 -270
  17. app/main/group/BPMediaGroupAction.php +29 -8
  18. app/main/group/BPMediaGroupElementExtension.php +7 -7
  19. app/main/group/dummy/{BPMediaGroupAlbum.php → BPMediaGroupAlbums.php} +2 -2
  20. app/main/group/dummy/{BPMediaGroupMusic.php → BPMediaGroupAudio.php} +2 -2
  21. app/main/group/dummy/{BPMediaGroupImage.php → BPMediaGroupImages.php} +2 -2
  22. app/main/group/dummy/{BPMediaGroupVideo.php → BPMediaGroupVideos.php} +2 -2
  23. app/main/importers/BPMediaBPAlbumImporter.php +0 -21
  24. app/main/importers/BPMediaImporter.php +0 -45
  25. app/main/includes/BPMediaActions.php +151 -58
  26. app/main/includes/BPMediaComponent.php +0 -381
  27. app/main/includes/BPMediaFilters.php +14 -0
  28. app/main/includes/BPMediaFunction.php +0 -18
  29. app/main/includes/BPMediaHostWordpress.php +70 -61
  30. app/main/includes/BPMediaUtils.php +0 -806
  31. app/main/includes/bp-media-upload-handler.php +2 -4
  32. app/main/privacy/BPMediaPrivacy.php +11 -31
  33. app/main/profile/BPMediaAlbum.php +44 -16
  34. app/main/profile/BPMediaAlbumScreen.php +42 -16
  35. app/main/profile/BPMediaScreen.php +16 -12
  36. app/main/profile/BPMediaTemplate.php +67 -57
  37. app/main/profile/BPMediaUploadScreen.php +3 -3
  38. app/main/query/BPMediaQuery.php +24 -0
  39. app/main/widgets/BPMediaPopularMedia.php +0 -124
  40. app/main/widgets/BPMediaRecentMedia.php +0 -236
  41. app/main/widgets/BPMediaWidget.php +302 -289
  42. index.php +8 -3
  43. lang/buddypress-media.po +0 -1009
  44. languages/buddypress-media-de.mo +0 -0
  45. languages/buddypress-media-es.mo +0 -0
  46. languages/buddypress-media-fr.mo +0 -0
  47. languages/buddypress-media-it.mo +0 -0
  48. languages/buddypress-media-ja.mo +0 -0
  49. languages/buddypress-media-nl.mo +0 -0
  50. languages/buddypress-media-pl.mo +0 -0
  51. languages/buddypress-media-pt_BR.mo +0 -0
  52. readme.txt +13 -3
app/admin/BPMediaAdmin.php CHANGED
@@ -24,6 +24,7 @@ if (!class_exists('BPMediaAdmin')) {
24
  add_action('wp_ajax_bp_media_cancel_request', create_function('', 'do_settings_sections("bp-media-support"); die();'), 1);
25
  add_action('wp_ajax_bp_media_submit_request', array($bp_media_support, 'submit_request'), 1);
26
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
 
27
  if (is_admin()) {
28
  add_action('admin_enqueue_scripts', array($this, 'ui'));
29
  add_action(bp_core_admin_hook(), array($this, 'menu'));
@@ -114,7 +115,7 @@ if (!class_exists('BPMediaAdmin')) {
114
  <?php settings_errors(); ?>
115
  <div class="columns-2">
116
  <h3 class="bp-media-settings-tabs"><?php
117
- $this->sub_tabs();
118
  ?>
119
  </h3>
120
 
@@ -132,6 +133,7 @@ if (!class_exists('BPMediaAdmin')) {
132
  do_settings_sections($page);
133
  }
134
  ?>
 
135
  </div>
136
 
137
  </form>
@@ -141,90 +143,90 @@ if (!class_exists('BPMediaAdmin')) {
141
  </div>
142
  </div><!-- .metabox-holder -->
143
  </div><!-- .bp-media-admin --><?php
144
- }
145
-
146
- /**
147
- * Adds a tab for Media settings in the BuddyPress settings page
148
- *
149
- * @global type $bp_media
150
- */
151
- public function tab() {
152
-
153
- $tabs_html = '';
154
- $idle_class = 'nav-tab';
155
- $active_class = 'nav-tab nav-tab-active';
156
- $tabs = array();
157
-
158
- // Check to see which tab we are on
159
- $tab = $this->get_current_tab();
160
- /* BuddyPress Media */
161
- $tabs[] = array(
162
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
163
- 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
164
- 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
165
- 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
166
- );
167
-
168
- foreach ($tabs as $tab) {
169
- $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
170
- }
171
- echo $tabs_html;
172
- }
173
-
174
- /**
175
- * Adds a sub tabs to the BuddyPress Media settings page
176
- *
177
- * @global type $bp_media
178
- */
179
- public function sub_tabs() {
180
- $tabs_html = '';
181
- $idle_class = 'nav-tab';
182
- $active_class = 'nav-tab nav-tab-active';
183
- $tabs = array();
184
-
185
- // Check to see which tab we are on
186
- $tab = $this->get_current_tab();
187
- /* BuddyPress Media */
188
- $tabs[] = array(
189
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
190
- 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
191
- 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
192
- 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
193
- );
194
-
195
- $tabs[] = array(
196
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
197
- 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
198
- 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
199
- 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
200
- );
201
-
202
- $tabs[] = array(
203
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
204
- 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
205
- 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
206
- 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
207
- );
208
- $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
209
- foreach ($tabs as $tab) {
210
- $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
211
- }
212
- echo $tabs_html;
213
- }
214
-
215
- /*
216
- * Updates the media count of all users.
217
- */
218
-
219
- /**
220
- *
221
- * @global type $wpdb
222
- * @return boolean
223
- */
224
- public function update_count() {
225
- global $wpdb;
226
- $query =
227
- "SELECT
228
  post_author,
229
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
230
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
@@ -238,90 +240,119 @@ if (!class_exists('BPMediaAdmin')) {
238
  `meta_value` > 0 AND
239
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
240
  GROUP BY post_author";
241
- $result = $wpdb->get_results($query);
242
- if (!is_array($result))
243
- return false;
244
-
245
- foreach ($result as $obj) {
246
-
247
- $count = array(
248
- 'images' => isset($obj->Images) ? $obj->Images : 0,
249
- 'videos' => isset($obj->Videos) ? $obj->Videos : 0,
250
- 'audio' => isset($obj->Audio) ? $obj->Audio : 0,
251
- 'albums' => isset($obj->Albums) ? $obj->Albums : 0
252
- );
253
- bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
254
- }
255
- return true;
256
- }
257
-
258
- /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
259
-
260
- /**
261
- *
262
- * @global type $bp_media_admin
263
- */
264
- public function save_multisite_options() {
265
- global $bp_media_admin;
266
- if (isset($_POST['refresh-count'])) {
267
- $bp_media_admin->update_count();
268
- }
269
- do_action('bp_media_sanitize_settings', $_POST);
270
-
271
- if (isset($_POST['bp_media_options'])) {
272
- bp_update_option('bp_media_options', $_POST['bp_media_options']);
273
-
274
- // redirect to settings page in network
275
- wp_redirect(
276
- add_query_arg(
277
- array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
278
- )
279
- );
280
- exit;
281
- }
282
- }
283
-
284
- /* Admin Sidebar */
285
-
286
- /**
287
- *
288
- * @global type $bp_media
289
- */
290
- public function admin_sidebar() {
291
- global $bp_media;
292
- $branding = '<a href="http://rtcamp.com" title="' . __('Empowering The Web With WordPress', BP_MEDIA_TXT_DOMAIN) . '" id="logo"><img src="' . BP_MEDIA_URL . 'app/assets/img/rtcamp-logo.png" alt="' . __('rtCamp', BP_MEDIA_TXT_DOMAIN) . '" /></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  <ul id="social">
294
  <li><a href="' . sprintf('%s', 'http://www.facebook.com/rtCamp.solutions/') . '" title="' . __('Become a fan on Facebook', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-facebook bp-media-social">' . __('Facebook', BP_MEDIA_TXT_DOMAIN) . '</a></li>
295
  <li><a href="' . sprintf('%s', 'https://twitter.com/rtcamp/') . '" title="' . __('Follow us on Twitter', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-twitter bp-media-social">' . __('Twitter', BP_MEDIA_TXT_DOMAIN) . '</a></li>
296
  <li><a href="' . sprintf('%s', 'http://feeds.feedburner.com/rtcamp/') . '" title="' . __('Subscribe to our feeds', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-rss bp-media-social">' . __('RSS Feed', BP_MEDIA_TXT_DOMAIN) . '</a></li>
297
  </ul>';
298
- new BPMediaAdminWidget('branding', '', $branding);
299
-
300
- $support = '<p><ul>
301
- <li>' . sprintf('<a href="%s">' . __("Read FAQ", BP_MEDIA_TXT_DOMAIN) . '</a>', 'http://rtcamp.com/buddypress-media/faq/') . '</li>
302
- <li>' . sprintf('<a href="%s">' . __("Free Support Forum", BP_MEDIA_TXT_DOMAIN) . '</a>', $bp_media->support_url) . '</li>
303
- <li>' . sprintf('<a href="%s">' . __("Github Issue Tracker", BP_MEDIA_TXT_DOMAIN) . '</a>', 'https://github.com/rtCamp/buddypress-media/issues/') . '</li>
304
- <li>' . sprintf('<a href="%s">' . __("Hire Us!", BP_MEDIA_TXT_DOMAIN) . '</a> ' . __("To get professional customisation/setup service.", BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/buddypress-media/hire/') . '</li>
305
- </ul></p>';
306
- new BPMediaAdminWidget('support', __('Need Help?', BP_MEDIA_TXT_DOMAIN), $support);
307
-
308
- $donate = '<span><a href="http://rtcamp.com/donate/" title="' . __('Help the development keep going.', BP_MEDIA_TXT_DOMAIN) . '"><img class="bp-media-donation-image" src ="' . BP_MEDIA_URL . 'app/assets/img/donate.gif" /></a></span>
309
- <p>' . sprintf(__('Help us release more amazing features faster. Consider making a donation to our consistent efforts.', BP_MEDIA_TXT_DOMAIN)) . '</p>';
310
- new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
311
-
312
- $addons = '<ul>
313
- <li><a href="http://rtcamp.com/store/buddypress-media-kaltura/" title="' . __('BuddyPress Media Kaltura', BP_MEDIA_TXT_DOMAIN) . '">' . __('BPM-Kaltura', BP_MEDIA_TXT_DOMAIN) . '</a> - ' . __('Add support for Kaltura.com/Kaltura-CE based video conversion support', BP_MEDIA_TXT_DOMAIN) . '</li>
314
- <li><a href="http://rtcamp.com/store/buddy-press-media-ffmpeg/" title="' . __('BuddyPress Media FFMPEG', BP_MEDIA_TXT_DOMAIN) . '">' . __('BPM-FFMPEG', BP_MEDIA_TXT_DOMAIN) . '</a> - ' . __('Add FFMEG-based audio/video conversion support', BP_MEDIA_TXT_DOMAIN) . '</li>
315
- </ul>
316
- <h4>' . sprintf(__('Are you a developer?', BP_MEDIA_TXT_DOMAIN)) . '</h4>
317
- <p>' . sprintf(__('If you are developing a BuddyPress Media addon we would like to include it in above list. We can also help you sell them. <a href="%s">More info!</a>', BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/contact/') . '</p></h4>';
318
- new BPMediaAdminWidget('premium-addons', __('Premium Addons', BP_MEDIA_TXT_DOMAIN), $addons);
319
-
320
- $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
321
- new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
322
- }
323
-
324
- }
325
 
 
 
 
 
 
326
  }
 
 
 
 
 
 
327
  ?>
24
  add_action('wp_ajax_bp_media_cancel_request', create_function('', 'do_settings_sections("bp-media-support"); die();'), 1);
25
  add_action('wp_ajax_bp_media_submit_request', array($bp_media_support, 'submit_request'), 1);
26
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
27
+ add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
28
  if (is_admin()) {
29
  add_action('admin_enqueue_scripts', array($this, 'ui'));
30
  add_action(bp_core_admin_hook(), array($this, 'menu'));
115
  <?php settings_errors(); ?>
116
  <div class="columns-2">
117
  <h3 class="bp-media-settings-tabs"><?php
118
+ $this->sub_tabs();
119
  ?>
120
  </h3>
121
 
133
  do_settings_sections($page);
134
  }
135
  ?>
136
+ <div class="rt-link alignright"><?php _e('By', BP_MEDIA_TXT_DOMAIN); ?> <a href="http://rtcamp.com" title="<?php _e('Empowering The Web With WordPress', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('rtCamp', BP_MEDIA_TXT_DOMAIN); ?></a></div>
137
  </div>
138
 
139
  </form>
143
  </div>
144
  </div><!-- .metabox-holder -->
145
  </div><!-- .bp-media-admin --><?php
146
+ }
147
+
148
+ /**
149
+ * Adds a tab for Media settings in the BuddyPress settings page
150
+ *
151
+ * @global type $bp_media
152
+ */
153
+ public function tab() {
154
+
155
+ $tabs_html = '';
156
+ $idle_class = 'nav-tab';
157
+ $active_class = 'nav-tab nav-tab-active';
158
+ $tabs = array();
159
+
160
+ // Check to see which tab we are on
161
+ $tab = $this->get_current_tab();
162
+ /* BuddyPress Media */
163
+ $tabs[] = array(
164
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
165
+ 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
166
+ 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
167
+ 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
168
+ );
169
+
170
+ foreach ($tabs as $tab) {
171
+ $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
172
+ }
173
+ echo $tabs_html;
174
+ }
175
+
176
+ /**
177
+ * Adds a sub tabs to the BuddyPress Media settings page
178
+ *
179
+ * @global type $bp_media
180
+ */
181
+ public function sub_tabs() {
182
+ $tabs_html = '';
183
+ $idle_class = 'nav-tab';
184
+ $active_class = 'nav-tab nav-tab-active';
185
+ $tabs = array();
186
+
187
+ // Check to see which tab we are on
188
+ $tab = $this->get_current_tab();
189
+ /* BuddyPress Media */
190
+ $tabs[] = array(
191
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
192
+ 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
193
+ 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
194
+ 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
195
+ );
196
+
197
+ $tabs[] = array(
198
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
199
+ 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
200
+ 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
201
+ 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
202
+ );
203
+
204
+ $tabs[] = array(
205
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
206
+ 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
207
+ 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
208
+ 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
209
+ );
210
+ $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
211
+ foreach ($tabs as $tab) {
212
+ $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
213
+ }
214
+ echo $tabs_html;
215
+ }
216
+
217
+ /*
218
+ * Updates the media count of all users.
219
+ */
220
+
221
+ /**
222
+ *
223
+ * @global type $wpdb
224
+ * @return boolean
225
+ */
226
+ public function update_count() {
227
+ global $wpdb;
228
+ $query =
229
+ "SELECT
230
  post_author,
231
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
232
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
240
  `meta_value` > 0 AND
241
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
242
  GROUP BY post_author";
243
+ $result = $wpdb->get_results($query);
244
+ if (!is_array($result))
245
+ return false;
246
+
247
+ foreach ($result as $obj) {
248
+
249
+ $count = array(
250
+ 'images' => isset($obj->Images) ? $obj->Images : 0,
251
+ 'videos' => isset($obj->Videos) ? $obj->Videos : 0,
252
+ 'audio' => isset($obj->Audio) ? $obj->Audio : 0,
253
+ 'albums' => isset($obj->Albums) ? $obj->Albums : 0
254
+ );
255
+ bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
256
+ }
257
+ return true;
258
+ }
259
+
260
+ /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
261
+
262
+ /**
263
+ *
264
+ * @global type $bp_media_admin
265
+ */
266
+ public function save_multisite_options() {
267
+ global $bp_media_admin;
268
+ if (isset($_POST['refresh-count'])) {
269
+ $bp_media_admin->update_count();
270
+ }
271
+ do_action('bp_media_sanitize_settings', $_POST);
272
+
273
+ if (isset($_POST['bp_media_options'])) {
274
+ bp_update_option('bp_media_options', $_POST['bp_media_options']);
275
+
276
+ // redirect to settings page in network
277
+ wp_redirect(
278
+ add_query_arg(
279
+ array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
280
+ )
281
+ );
282
+ exit;
283
+ }
284
+ }
285
+
286
+ /* Admin Sidebar */
287
+
288
+ /**
289
+ *
290
+ * @global type $bp_media
291
+ */
292
+ public function admin_sidebar() {
293
+ $current_user = wp_get_current_user();
294
+
295
+ $message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', BP_MEDIA_TXT_DOMAIN),home_url());
296
+ $addons = '<label for="bp-media-add-linkback"><input' . checked(bp_get_option('bp_media_add_linkback', false), true, false) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __('Add link to footer', BP_MEDIA_TXT_DOMAIN) . '</label>
297
+ <ul>
298
+ <li><a href="http://twitter.com/home/?status=' . $message . '" target= "_blank"><input type="button" value="' . __('Tweet', BP_MEDIA_TXT_DOMAIN) . '" class="button button-tweet"></a></li>
299
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" target= "_blank"><input type="button" value="' . __('Rate on WordPress.org', BP_MEDIA_TXT_DOMAIN) . '" class="button button-rating"></a></li>
300
+ </ul>';
301
+ new BPMediaAdminWidget('spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), $addons);
302
+
303
+ $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
304
+ <!-- Identify your business so that you can collect the payments. -->
305
+ <input type="hidden" name="business"
306
+ value="paypal@rtcamp.com">
307
+ <!-- Specify a Donate button. -->
308
+ <input type="hidden" name="cmd" value="_donations">
309
+ <!-- Specify details about the contribution -->
310
+ <input type="hidden" name="item_name" value="BuddyPress Media">
311
+ <input type="text" name="amount" size="3">
312
+ <label><b>' . __('USD', BP_MEDIA_TXT_DOMAIN) . '</b></label> <br/>
313
+ <input type="hidden" name="currency_code" value="USD">
314
+ <!-- Display the payment button. -->
315
+ <input type="hidden" name="cpp_header_image" value="' . BP_MEDIA_URL . 'app/assets/img/rtcamp-logo.png">
316
+ <input type="image" name="submit" border="0"
317
+ src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif"
318
+ alt="PayPal - The safer, easier way to pay online">
319
+ <img alt="" border="0" width="1" height="1"
320
+ src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
321
+ </form>';
322
+ new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
323
+
324
+ $branding = '<form action="http://rtcamp.us1.list-manage1.com/subscribe/post?u=85b65c9c71e2ba3fab8cb1950&amp;id=9e8ded4470" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
325
+ <div class="mc-field-group">
326
+ <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
327
+ <input style="display:none;" type="checkbox" checked="checked" value="1" name="group[1721][1]" id="mce-group[1721]-1721-0"><label for="mce-group[1721]-1721-0">
328
+ <div id="mce-responses" class="clear">
329
+ <div class="response" id="mce-error-response" style="display:none"></div>
330
+ <div class="response" id="mce-success-response" style="display:none"></div>
331
+ </div>
332
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
333
+ </div>
334
+ </form>
335
  <ul id="social">
336
  <li><a href="' . sprintf('%s', 'http://www.facebook.com/rtCamp.solutions/') . '" title="' . __('Become a fan on Facebook', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-facebook bp-media-social">' . __('Facebook', BP_MEDIA_TXT_DOMAIN) . '</a></li>
337
  <li><a href="' . sprintf('%s', 'https://twitter.com/rtcamp/') . '" title="' . __('Follow us on Twitter', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-twitter bp-media-social">' . __('Twitter', BP_MEDIA_TXT_DOMAIN) . '</a></li>
338
  <li><a href="' . sprintf('%s', 'http://feeds.feedburner.com/rtcamp/') . '" title="' . __('Subscribe to our feeds', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-rss bp-media-social">' . __('RSS Feed', BP_MEDIA_TXT_DOMAIN) . '</a></li>
339
  </ul>';
340
+ new BPMediaAdminWidget('branding', __('Subscribe', BP_MEDIA_TXT_DOMAIN), $branding);
341
+
342
+ $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
343
+ new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
344
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
 
346
+ public function linkback() {
347
+ if (isset($_POST['linkback']) && $_POST['linkback']) {
348
+ return bp_update_option('bp_media_add_linkback', true);
349
+ } else {
350
+ return bp_update_option('bp_media_add_linkback', false);
351
  }
352
+ die;
353
+ }
354
+
355
+ }
356
+
357
+ }
358
  ?>
app/assets/css/main.css CHANGED
@@ -24,7 +24,6 @@ div.bp_media_title{margin-bottom:10px;}
24
  #wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
25
  #wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
26
 
27
-
28
  #wpbody-content .wrap div.bp-media-metabox-holder{padding-top: 0}
29
  .bp-media-social{background: url('../img/bp_media_social.png');height: 35px;width: 35px;display: inline-block;font-size: 0px;margin-right:5px;}
30
  .bp-media-facebook{background-position: 0px 0px;}
@@ -34,28 +33,39 @@ div.bp_media_title{margin-bottom:10px;}
34
  .bp-media-rss{background-position: 35px 0px;}
35
  .bp-media-rss:hover{background-position: 35px 36px;}
36
  /*#bp-media-upload-ui{position: relative;}*/
37
-
38
-
39
- #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;height: 150px;width: 150px;}
40
- .upload #bp-media-upload-ui #drag-drop-area{height: auto; width: 100%;}
41
- #bp-media-upload-ui .drag-drop-inside{margin:auto;width: 100%;}
42
- #bp-media-album-prompt{margin: 0;position: absolute;right: 0;text-align: right;top: 2px;min-width: 200px;}
43
- #bp-media-album-prompt span{float: left;line-height: 25px;margin-right: 15px;}
44
- #bp-media-album-prompt .bp-media-album-content{float: left;}
45
- #bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
46
- #bp-media-album-prompt div.hide{display: none;position: absolute;right: 0;top: 0;z-index: 100;position: relative;}
47
- #bp-media-album-prompt #bp_media_album_new {width: 160px;}
48
- #bp-media-album-prompt input.button{height: 25px;margin-left: 5px;padding: 0 10px;position: relative;top: -1px;}
49
- div.bp-media-area-allocate{display: block;height: 15px;}
50
- div.bp_media_create_album{text-align: right}
51
- #bp_media_album_name{margin-bottom: 6px;}
52
  #item-body:after,ul.bp-media-gallery.item-list:after{content: " ";clear: both;display: block;text-indent: -9999em;}
53
  #item-body{position: relative;}
54
 
55
- #bp-media-upload-ui .drag-drop-inside p{display: block;text-align: center;color: #AAA;margin: 12px 0;}
56
- #bp-media-upload-ui .drag-drop-info{font-size: 20px;}
57
- #bp-media-upload-ui .drag-drop-buttons input{border-color: #BBB;color: #464646;text-decoration: none;font-size: 12px!important;line-height: 13px;padding: 3px 8px;cursor: pointer;border-width: 1px;border-style: solid;-webkit-border-radius: 11px;border-radius: 11px;-moz-box-sizing: content-box;-webkit-box-sizing: content-box;box-sizing: content-box;}
58
- #bp-media-uploaded-files{background: none repeat scroll 0 0 #DDDDDD;left: 0;margin-top: 5px;position: absolute;top: 155px;width: 100%;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  #bp-media-uploaded-files .error{padding: 5px;text-align: center;}
60
  .bp-media-progressbar{height: 28px;margin: 6px 10px 0 0;line-height: 2em;padding: 0;overflow: hidden;margin-bottom: 2px;border: 1px solid #D1D1D1;background: white;background-image: linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -o-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -moz-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -webkit-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -ms-linear-gradient(bottom,white 0,#F7F7F7 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1)}
61
  .bp-media-progress-text{z-index: 10;position: relative;width: 100%;padding: 0 8px;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);color: rgba(0, 0, 0, 0.6);font-size:16px;line-height: 28px;height: 28px;}
@@ -94,10 +104,19 @@ div.bp_media_create_album{text-align: right}
94
  #bp-media-settings-boxes{border:1px solid #CCC; overflow: hidden; padding: 10px; -webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px; float: left; width: 98%;}
95
  .nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
96
  .nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -32px;}
97
- .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/rtCamp-bullet.png') left top no-repeat; padding-left: 19px;}
98
  #branding #logo{text-align:center;padding: 10px 0;display:block;}
99
- ul#social{display:block;text-align:center;margin:0;}
 
 
 
 
100
  ul#social li{display:inline;}
 
 
 
 
 
101
  #bp-media-show-more{width: 200px;margin-left: auto;margin-right: auto;display: block;height: 30px;line-height: 30px;font-size: 20px;}
102
  #bp-media-upload-ui.activity-component{margin-left: 74px;margin-top: 10px;}
103
  ul#activity-stream li.media.album_updated ul{}
@@ -172,20 +191,37 @@ background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7
172
  .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
173
  .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
174
  img.bp-media-donation-image{display:block;margin: 10px auto;}
175
-
176
- /* BuddyPress Media Image Uploader album selection */
177
- /*#bp-media-album-prompt, #bp-media-album-new { background: none repeat scroll 0 0 #FFFFFF;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;display: none;padding: 3px;z-index: 110000;left: 40%;position: fixed;top: 35%;width: 300px; }
178
- #bp-media-album-new { z-index: 120000; }
179
- .bp-media-album-title { background: url("../img/Popup-title-bg.png") repeat-x scroll 50% 50% #CCCCCC;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;color: #222222;display: block;font-weight: bold;padding: 0;margin-bottom: 10px; }
180
- .bp-media-album-title span { background: none repeat scroll 0 0 transparent;display: block;font-size: 16px;padding: 10px; }
181
- #bp-media-create-album-close, #bp-media-create-album-close:active, #bp-media-close, #bp-media-close:active { border-radius: 3px 3px 3px 3px;cursor: pointer;display: block;padding: 0 7px 2px;position: absolute;right: 8px;top: 11px;z-index: 10; }
182
- #bp-media-create-album-close:hover, #bp-media-create-album-close:focus, #bp-media-close:hover, #bp-media-close:focus { background: none repeat scroll 0 0 #545454;color: #CFCFCF; }
183
- .bp-media-album-content { display: block;padding: 5px; }
184
- .bp-media-album-content label { display: block;font-size: 14px;margin: 0 0 0 3px; }
185
- #bp-media-album-prompt select { min-width: 140px; }
186
- .select-btn-div { border-top: 1px solid #AAAAAA;margin: 15px 0 0;padding: 5px 5px 5px 30px;text-align: right; }
187
- .select-btn-div .btn { float: right;font-size: 14px;margin: 5px;padding: 10px 25px; }
188
- #bp-media-album-new > label { font-size: 14px; }
189
- #bp-media-album-new input[type="text"] { width: 98%; }
190
- #custom-overlay { background: none repeat scroll 0 0 #000000;bottom: 0;left: 0;min-height: 360px;opacity: 0.7;position: fixed;right: 0;top: 0;z-index: 105000; }
191
- div.error{margin: 5px 0 15px; background-color: #ffebe8; border-color: #c00;padding: 0 .6em;-webkit-border-radius: 3px;border-radius: 3px;border-width: 1px;border-style: solid;}*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  #wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
25
  #wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
26
 
 
27
  #wpbody-content .wrap div.bp-media-metabox-holder{padding-top: 0}
28
  .bp-media-social{background: url('../img/bp_media_social.png');height: 35px;width: 35px;display: inline-block;font-size: 0px;margin-right:5px;}
29
  .bp-media-facebook{background-position: 0px 0px;}
33
  .bp-media-rss{background-position: 35px 0px;}
34
  .bp-media-rss:hover{background-position: 35px 36px;}
35
  /*#bp-media-upload-ui{position: relative;}*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  #item-body:after,ul.bp-media-gallery.item-list:after{content: " ";clear: both;display: block;text-indent: -9999em;}
37
  #item-body{position: relative;}
38
 
39
+ .bp-media-area-allocate{height: 10px;width: 100%;display: block;}
40
+ li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
41
+ #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;text-align: center;background: url('../img/drag-drop-bg.png') repeat scroll 0 0 transparent;overflow: hidden;padding: 20px 0 0;}
42
+ li #bp-media-upload-ui #drag-drop-area{max-width: 150px;min-height: auto;padding-top: 15px;}
43
+ .albums li #bp-media-upload-ui #drag-drop-area{padding: 20px 0 10px;}
44
+ #bp-media-upload-ui .drag-drop-inside{float: left;margin: 0 auto 10px;width: 48%;}
45
+ .albums #bp-media-upload-ui .drag-drop-inside{float: none;width: auto;}
46
+ li #bp-media-upload-ui .drag-drop-inside,li #bp-media-upload-ui #bp-media-album-prompt{float: none;margin: 0 auto 18px;max-width: 100%;width: auto;}
47
+ li #bp-media-upload-ui #bp-media-album-prompt{margin: 8px auto 0;max-width: 144px;}
48
+ #bp-media-upload-ui #bp-media-album-prompt{float: right;margin: 12px auto 0;width: 47%;}
49
+ #bp-media-upload-ui .drag-drop-inside p.drag-drop-info{font-size: 20px;line-height: 100%;}
50
+ #bp-media-upload-ui .drag-drop-buttons input,#bp-media-album-prompt input.button{-moz-box-sizing: content-box;border-color: #BBBBBB;border-radius: 15px;border-style: solid;border-width: 1px;color: #464646;cursor: pointer;font-size: 13px !important;line-height: 13px;padding: 5px 10px;text-decoration: none;}
51
+ li #bp-media-album-prompt input.button{font-size: 12px !important;padding: 3px 8px;text-decoration: none;margin-top: 5px;}
52
+ #bp-media-selected-album{max-width: 140px;font-size: 14px;width: 100%;margin: 10px 0;}
53
+ li #bp-media-album-prompt > p,li #bp-media-upload-ui #drag-drop-area p{display: none;}
54
+ .albums li #bp-media-album-prompt > p,.albums li #bp-media-upload-ui #drag-drop-area p{display: block;}
55
+ li #bp-media-upload-ui #drag-drop-area p.drag-drop-buttons{display: block;}
56
+ #bp-media-album-prompt div.hide{display: none;margin: 0;}
57
+ #bp-media-album-prompt > p{font-size: 20px;}
58
+ #bp-media-upload-ui .drag-drop-inside p,#bp-media-album-prompt #bp_media_album_new{margin-bottom: 12px;font-size: 14px;}
59
+ #bp-media-album-prompt #bp_media_album_new{max-width: 90%;}
60
+ li #bp-media-album-prompt #bp_media_album_new{margin: 0;max-width: 134px;width: 94%;}
61
+ #bp-media-upload-ui .drag-drop-to{width: 22px;line-height: 22px;margin: 40px auto 0;float: left;}
62
+ li #bp-media-upload-ui .drag-drop-to{width: 100%;line-height: 22px;margin: 0;float: none;}
63
+ #bp-media-album-in{background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: left;font-size: 14px;line-height: 22px;margin: 30px auto 0;width: 22px;}
64
+ li #bp-media-album-in{background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: none;font-size: 14px;line-height: 22px;margin: 0 auto;width: 22px;}
65
+ #bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
66
+
67
+ #bp-media-uploaded-files{background: none repeat scroll 0 0 #DDDDDD;margin-top: 5px;width: 100%;}
68
+ li #bp-media-uploaded-files{left: 0;position: absolute;top: 155px;}
69
  #bp-media-uploaded-files .error{padding: 5px;text-align: center;}
70
  .bp-media-progressbar{height: 28px;margin: 6px 10px 0 0;line-height: 2em;padding: 0;overflow: hidden;margin-bottom: 2px;border: 1px solid #D1D1D1;background: white;background-image: linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -o-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -moz-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -webkit-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -ms-linear-gradient(bottom,white 0,#F7F7F7 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1)}
71
  .bp-media-progress-text{z-index: 10;position: relative;width: 100%;padding: 0 8px;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);color: rgba(0, 0, 0, 0.6);font-size:16px;line-height: 28px;height: 28px;}
104
  #bp-media-settings-boxes{border:1px solid #CCC; overflow: hidden; padding: 10px; -webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px; float: left; width: 98%;}
105
  .nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
106
  .nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -32px;}
107
+ .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/rtCamp-bullet.png') left 4px no-repeat; padding-left: 26px;}
108
  #branding #logo{text-align:center;padding: 10px 0;display:block;}
109
+ ul#social{display:block;text-align:center;margin:0;clear: both;}
110
+ #branding #mc-embedded-subscribe-form{float: left;width: 100%;}
111
+ #branding label{float: right;}
112
+ #branding #mc-embedded-subscribe{float: right;padding: 0 3px;}
113
+ #branding #mce-EMAIL{float: left;}
114
  ul#social li{display:inline;}
115
+ #spread-the-word .inside{text-align: center;}
116
+ .wp-admin .button-tweet{background: #33ACE6; border-color: #3399DD #3399DD #2288CC; color: #FFFFFF !important; text-shadow: -1px -1px 0 #3399DD;}
117
+ .wp-admin .button-tweet:hover{background: #3399DD;border-color: #2288CC;box-shadow: 0 0 4px rgba(82, 168, 236, 0.75);}
118
+ .wp-admin .button-rating{background: #8A8A8A; border-color: #222; color: #FFFFFF !important; text-shadow: -1px -1px 0 #444;}
119
+ .wp-admin .button-rating:hover{background: #7E7E7E;border-color: #444;box-shadow: 0 0 4px rgba(128,128,128, 0.75);}
120
  #bp-media-show-more{width: 200px;margin-left: auto;margin-right: auto;display: block;height: 30px;line-height: 30px;font-size: 20px;}
121
  #bp-media-upload-ui.activity-component{margin-left: 74px;margin-top: 10px;}
122
  ul#activity-stream li.media.album_updated ul{}
191
  .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
192
  .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
193
  img.bp-media-donation-image{display:block;margin: 10px auto;}
194
+ #donate form{text-align: center;}
195
+
196
+ @media (min-width: 981px) and (max-width: 1096px) {
197
+ #bp-media-upload-ui .drag-drop-area{padding-top: 12px;}
198
+ li #bp-media-upload-ui .drag-drop-inside{margin: 0 auto 10px;}
199
+ li #bp-media-upload-ui #bp-media-album-prompt{margin-top: 0;}
200
+ li #bp-media-album-prompt input.button{padding: 3px;}
201
+ .albums li #bp-media-upload-ui #drag-drop-area{padding: 10px 0 0;}
202
+ }
203
+ @media (max-width: 980px) {
204
+ #item-body ul.bp-media-gallery li{width: 23%;}
205
+ li #bp-media-upload-ui #drag-drop-area{min-height: auto;}
206
+ }
207
+ @media (max-width: 850px) {
208
+ #item-body ul.bp-media-gallery li{width: 31%;}
209
+ #bp-media-upload-ui .drag-drop-inside{width: 47%;}
210
+ #bp-media-upload-ui #bp-media-album-prompt{width: 46%;}
211
+ }
212
+ @media (max-width: 480px) {
213
+ #item-body ul.bp-media-gallery li{width: 48%;}
214
+ li #bp-media-upload-ui{max-width: 170px;}
215
+ ul.bp-media-gallery li img,li #bp-media-upload-ui #drag-drop-area{max-width: 170px;width: 100%;}
216
+ li #bp-media-upload-ui #drag-drop-area{max-width: 162px;}
217
+ #bp-media-upload-ui .drag-drop-area{padding: 23px 0 10px;}
218
+ li #bp-media-upload-ui .drag-drop-inside{margin: 0 auto 23px;}
219
+ }
220
+ @media (max-width: 379px) {
221
+ #bp-media-upload-ui{min-height: 190px;}
222
+ #item-body ul.bp-media-gallery li{width: 95%;}
223
+ #bp-media-upload-ui .drag-drop-inside{float: none;width: 100%;}
224
+ #bp-media-album-in{float: none;margin: 0 auto;}
225
+ #bp-media-upload-ui #bp-media-album-prompt{margin: 15px auto 15px;float: none;width: 100%}
226
+ #bp-media-upload-ui .drag-drop-inside p,#bp-media-album-prompt #bp_media_album_new{margin-bottom: 5px;}
227
+ }
app/assets/img/drag-drop-bg.png ADDED
Binary file
app/assets/js/admin.js CHANGED
@@ -1,5 +1,15 @@
1
  jQuery(document).ready(function(){
2
 
 
 
 
 
 
 
 
 
 
 
3
  /* Fetch Feed */
4
  var bp_media_news_section = jQuery('#latest-news');
5
  if(bp_media_news_section.length>0){
@@ -11,12 +21,6 @@ jQuery(document).ready(function(){
11
  });
12
  }
13
 
14
- // /* Add more attachment link */
15
- // jQuery( '.add-more-attachment-btn' ).live('click', function(event){
16
- // event.preventDefault();
17
- // jQuery(this).prev().after('<div class="more-attachment"><input class="bp-media-input" type="file" name="attachment[]" /></div>');
18
- // });
19
-
20
  /* Select Request */
21
  jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
22
  if(jQuery(this).val()){
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){
21
  });
22
  }
23
 
 
 
 
 
 
 
24
  /* Select Request */
25
  jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
26
  if(jQuery(this).val()){
app/assets/js/bp-media-activity-uploader.js ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+ jQuery(document).ready(function(){
7
+ if ( jQuery('#bp-media-activity-upload-ui').length > 0 ) {
8
+ //Activity Uploader
9
+ var bp_media_activity_is_multiple_upload = false;
10
+ var bp_media_activity_uploader=new plupload.Uploader(bp_media_uploader_params);
11
+ var bp_media_activity_album_selected = false;
12
+ bp_media_activity_uploader.init();
13
+
14
+ bp_media_activity_uploader.bind('FilesAdded', function(up, files) {
15
+ //bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
16
+ bp_media_activity_is_multiple_upload = files.length>1;
17
+ jQuery.each(files, function(i, file) {
18
+ var bp_media_activity_extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
19
+ 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>');
20
+ });
21
+ // bp_media_activity_album_selected = jQuery('#bp-media-activity-selected-album').val();
22
+ bp_media_activity_album_selected = '535';
23
+ bp_media_activity_uploader.start();
24
+ up.refresh(); // Reposition Flash/Silverlight
25
+ });
26
+ bp_media_activity_uploader.bind('UploadProgress', function(up, file) {
27
+ jQuery('input#aw-whats-new-submit').prop('disabled',true);
28
+ jQuery('input#bp-media-aw-whats-new-submit').prop('disabled',true);
29
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
30
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
31
+ });
32
+
33
+ bp_media_activity_uploader.bind('Error', function(up, err) {
34
+ jQuery('#bp-media-activity-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
35
+ ', Message: ' + err.message +
36
+ (err.file ? ', File: ' + err.file.name : '') +
37
+ '</p></div>'
38
+ );
39
+ up.refresh();
40
+ });
41
+
42
+ bp_media_activity_uploader.bind('FileUploaded', function(up, file,response) {
43
+ jQuery('input#aw-whats-new-submit').after('<input type="submit" name="bp-media-aw-whats-new-submit" id="bp-media-aw-whats-new-submit" value="Post Media Update">').remove()
44
+ jQuery('#bp-media-aw-whats-new-submit').prop('disabled',true);
45
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html("100%");
46
+ jQuery('#bp-media-activity-post-update-append').append('<span>'+response.response+'</span>');
47
+ jQuery('#bp-media-aw-whats-new-submit').prop('disabled',false);
48
+ });
49
+ bp_media_activity_uploader.bind('BeforeUpload',function(up){
50
+ up.settings.multipart_params.is_multiple_upload = bp_media_activity_is_multiple_upload;
51
+ up.settings.multipart_params.bp_media_album_id = bp_media_activity_album_selected;
52
+ up.settings.multipart_params.is_activity = true;
53
+ });
54
+ bp_media_activity_uploader.bind('UploadComplete',function(response){
55
+ });
56
+
57
+ /* New posts */
58
+ jQuery('#whats-new-submit').on('click', 'input#aw-whats-new-submit', function() {
59
+ var button = jQuery(this);
60
+ var form = button.parent().parent().parent().parent();
61
+
62
+ form.children().each( function() {
63
+ if ( jQuery.nodeName(this, "textarea") || jQuery.nodeName(this, "input") )
64
+ jQuery(this).prop( 'disabled', true );
65
+ });
66
+
67
+ /* Remove any errors */
68
+ jQuery('div.error').remove();
69
+ button.addClass('loading');
70
+ button.prop('disabled', true);
71
+
72
+ /* Default POST values */
73
+ var object = '';
74
+ var item_id = jQuery("#whats-new-post-in").val();
75
+ var content = jQuery("textarea#whats-new").val();
76
+
77
+ /* Set object for non-profile posts */
78
+ if ( item_id > 0 ) {
79
+ object = jQuery("#whats-new-post-object").val();
80
+ }
81
+
82
+ jQuery.post( ajaxurl, {
83
+ action: 'post_update',
84
+ 'cookie': encodeURIComponent(document.cookie),
85
+ '_wpnonce_post_update': jQuery("input#_wpnonce_post_update").val(),
86
+ 'content': content,
87
+ 'object': object,
88
+ 'item_id': item_id,
89
+ '_bp_as_nonce': jQuery('#_bp_as_nonce').val() || ''
90
+ },
91
+ function(response) {
92
+
93
+ form.children().each( function() {
94
+ if ( jQuery.nodeName(this, "textarea") || jQuery.nodeName(this, "input") ) {
95
+ jQuery(this).prop( 'disabled', false );
96
+ }
97
+ });
98
+
99
+ /* Check for errors and append if found. */
100
+ if ( response[0] + response[1] == '-1' ) {
101
+ form.prepend( response.substr( 2, response.length ) );
102
+ jQuery( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
103
+ } else {
104
+ if ( 0 == jQuery("ul.activity-list").length ) {
105
+ jQuery("div.error").slideUp(100).remove();
106
+ jQuery("div#message").slideUp(100).remove();
107
+ jQuery("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
108
+ }
109
+
110
+ jQuery("ul#activity-stream").prepend(response);
111
+ jQuery("ul#activity-stream li:first").addClass('new-update');
112
+
113
+ if ( 0 != jQuery("#latest-update").length ) {
114
+ var l = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").html();
115
+ var v = jQuery("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href');
116
+
117
+ var ltext = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").text();
118
+
119
+ var u = '';
120
+ if ( ltext != '' )
121
+ u = l + ' ';
122
+
123
+ u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>';
124
+
125
+ jQuery("#latest-update").slideUp(300,function(){
126
+ jQuery("#latest-update").html( u );
127
+ jQuery("#latest-update").slideDown(300);
128
+ });
129
+ }
130
+
131
+ jQuery("li.new-update").hide().slideDown( 300 );
132
+ jQuery("li.new-update").removeClass( 'new-update' );
133
+ jQuery("textarea#whats-new").val('');
134
+ }
135
+
136
+ jQuery("#whats-new-options").animate({
137
+ height:'0px'
138
+ });
139
+ jQuery("form#whats-new-form textarea").animate({
140
+ height:'20px'
141
+ });
142
+ jQuery("#aw-whats-new-submit").prop("disabled", true).removeClass('loading');
143
+ });
144
+
145
+ return false;
146
+ });
147
+
148
+ jQuery('#whats-new-submit').on('click', '#bp-media-aw-whats-new-submit', function(e){
149
+ var button = jQuery(this);
150
+ button.addClass('loading');
151
+ var form = button.parent().parent().parent().parent();
152
+ /* Default POST values */
153
+ var object = '';
154
+ var item_id = jQuery("#whats-new-post-in").val();
155
+
156
+ /* Set object for non-profile posts */
157
+ if ( item_id > 0 ) {
158
+ object = jQuery("#whats-new-post-object").val();
159
+ }
160
+ var media_id = false;
161
+ var multiple = 0;
162
+ jQuery('#bp-media-activity-post-update-append span').each(function(){
163
+ if (media_id){
164
+ media_id=media_id+'-'+jQuery(this).text();
165
+ multiple = 1;
166
+ }else{
167
+ media_id=jQuery(this).text();
168
+ }
169
+ });
170
+ var data = {
171
+ action: 'bp_media_post_update',
172
+ '_wpnonce_post_update': jQuery("input#_wpnonce_post_update").val(),
173
+ 'content': jQuery('#whats-new').val(),
174
+ 'object': object,
175
+ 'item_id': item_id,
176
+ 'media_id': media_id,
177
+ 'multiple': multiple,
178
+ '_bp_as_nonce': jQuery('#_bp_as_nonce').val() || ''
179
+ };
180
+ jQuery.post(activity_ajax_url,data, function (response) {
181
+ jQuery('#bp-media-activity-uploaded-files').html('');
182
+ jQuery('#bp-media-activity-post-update-append').html('');
183
+ jQuery('#bp-media-aw-whats-new-submit').after('<input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="Post Update">').remove();
184
+ form.children().each( function() {
185
+ if ( jQuery.nodeName(this, "textarea") || jQuery.nodeName(this, "input") ) {
186
+ jQuery(this).prop( 'disabled', false );
187
+ }
188
+ });
189
+
190
+ /* Check for errors and append if found. */
191
+ if ( response[0] + response[1] == '-1' ) {
192
+ form.prepend( response.substr( 2, response.length ) );
193
+ jQuery( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
194
+ } else {
195
+ if ( 0 == jQuery("ul.activity-list").length ) {
196
+ jQuery("div.error").slideUp(100).remove();
197
+ jQuery("div#message").slideUp(100).remove();
198
+ jQuery("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
199
+ }
200
+
201
+ jQuery("ul#activity-stream").prepend(response);
202
+ jQuery("ul#activity-stream li:first").addClass('new-update');
203
+
204
+ if ( 0 != jQuery("#latest-update").length ) {
205
+ var l = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").html();
206
+ var v = jQuery("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href');
207
+
208
+ var ltext = jQuery("ul#activity-stream li.new-update .activity-content .activity-inner p").text();
209
+
210
+ var u = '';
211
+ if ( ltext != '' )
212
+ u = l + ' ';
213
+
214
+ u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>';
215
+
216
+ jQuery("#latest-update").slideUp(300,function(){
217
+ jQuery("#latest-update").html( u );
218
+ jQuery("#latest-update").slideDown(300);
219
+ });
220
+ }
221
+
222
+ jQuery("li.new-update").hide().slideDown( 300 );
223
+ jQuery("li.new-update").removeClass( 'new-update' );
224
+ jQuery("textarea#whats-new").val('');
225
+ }
226
+
227
+ jQuery("#whats-new-options").animate({
228
+ height:'0px'
229
+ });
230
+ jQuery("form#whats-new-form textarea").animate({
231
+ height:'20px'
232
+ });
233
+ jQuery("#aw-whats-new-submit").prop("disabled", true).removeClass('loading');
234
+ jQuery("input#aw-whats-new-submit").bind('click');
235
+ });
236
+ e.preventDefault();
237
+ });
238
+ }
239
+ });
app/assets/js/bp-media-uploader.js CHANGED
@@ -4,110 +4,117 @@
4
  */
5
 
6
  jQuery(document).ready(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- var selected = jQuery('#bp-media-album-prompt select').val();
9
- if(jQuery('#'+bp_media_uploader_params.container).length==0)
10
- return false;
11
- jQuery('#bp-media-album-prompt select').change(function() {
12
-
13
- if ( jQuery(this).val() == 'create_new' ) {
14
- jQuery('#bp_media_album_new').css({'width':jQuery('#bp-media-album-prompt select').width()+20});
15
- jQuery('#bp-media-album-prompt select').hide();
16
- jQuery('#bp-media-album-prompt span').hide();
17
- jQuery('#bp-media-album-prompt div.hide').show();
18
- } else
19
- selected = jQuery(this).val();
20
- });
21
- var new_album_flag = 0;
22
- jQuery('#btn-create-new').click(function(){
23
- if ( new_album_flag == 1 ) {
24
- return false;
25
- }
26
- var new_album_name = jQuery('#bp_media_album_new').val();
27
- if(new_album_name.length==0){
28
- alert('You have not filled the album name');
29
- return false;
30
- } else {
31
- new_album_flag = 1;
32
- jQuery(this).val('Wait');
33
- var data = {
34
- action: 'bp_media_add_album',
35
- bp_media_album_name : new_album_name,
36
- bp_media_group_id : bp_media_uploader_params.multipart_params.bp_media_group_id
37
- };
38
- jQuery.post(bp_media_vars.ajaxurl,data,function(response){
39
- var album = parseInt(response);
40
- if(album == 0){
41
- alert('Sorry you cannot create albums in this group');
42
- }
43
- else {
44
- jQuery('#bp-media-album-prompt select option').removeAttr('selected');
45
- jQuery('#bp-media-selected-album').prepend('<option value='+album+' selected="selected">'+new_album_name+'</option>');
46
- jQuery('#bp-media-album-prompt div.hide').hide();
47
- jQuery('#bp-media-album-prompt select').show();
48
- jQuery('#bp-media-album-prompt span').show();
49
- }
50
- });
51
- }
52
  });
53
- jQuery('#btn-create-cancel').click(function(){
54
- jQuery('#bp-media-album-prompt div.hide').hide();
55
- jQuery('#bp-media-album-prompt select option').removeAttr('selected');
56
- jQuery('#bp-media-album-prompt select option[value=' + selected + ']').attr('selected', 'selected');
57
- jQuery('#bp-media-album-prompt select').show();
58
- jQuery('#bp-media-album-prompt span').show();
59
- });
60
- var bp_media_is_multiple_upload = false;
61
- var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
62
- var bp_media_album_selected = false;
63
- bp_media_uploader.init();
64
-
65
- bp_media_uploader.bind('FilesAdded', function(up, files) {
66
- if ( jQuery('#bp-media-selected-album').val() == 'create_new' ) {
67
- alert("Please Select an Album !!");
68
- return false;
69
- }
70
- //bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
71
- bp_media_is_multiple_upload = files.length>1;
72
- jQuery.each(files, function(i, file) {
73
- var extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
74
- jQuery('#bp-media-uploaded-files').append('<div id="bp-media-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>');
75
- });
76
- bp_media_album_selected = jQuery('#bp-media-selected-album').val();
77
- bp_media_uploader.start();
78
- up.refresh(); // Reposition Flash/Silverlight
79
- });
80
- bp_media_uploader.bind('UploadProgress', function(up, file) {
81
- jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
82
- jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
83
- });
84
 
85
- bp_media_uploader.bind('Error', function(up, err) {
86
- jQuery('#bp-media-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
87
- ', Message: ' + err.message +
88
- (err.file ? ', File: ' + err.file.name : '') +
89
- '</p></div>'
90
- );
91
- up.refresh();
92
- });
93
 
94
- bp_media_uploader.bind('FileUploaded', function(up, file) {
95
- jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html("100%");
96
- });
97
- bp_media_uploader.bind('BeforeUpload',function(up){
98
- up.settings.multipart_params.is_multiple_upload = bp_media_is_multiple_upload;
99
- up.settings.multipart_params.bp_media_album_id = bp_media_album_selected;
100
- });
101
- bp_media_uploader.bind('UploadComplete',function(){
102
- var new_location = window.location.href;
103
- if(new_location.search('/upload/')>0){
104
- new_location = new_location.replace('/upload/','/albums/');
105
- if(bp_media_album_selected>0)
106
- new_location = new_location.concat(bp_media_album_selected);
107
- else
108
- new_location = new_location.concat('0/');
109
- window.location.replace(new_location);
110
- } else
111
- location.reload(true);
112
- });
 
 
113
  });
4
  */
5
 
6
  jQuery(document).ready(function(){
7
+
8
+ var selected = jQuery('#bp-media-album-prompt select').val();
9
+ var in_list = 0;
10
+ if(jQuery('#'+bp_media_uploader_params.container).length==0)
11
+ return false;
12
+ if ( jQuery('#bp-media-album-prompt p').css('display') == 'none' )
13
+ in_list = 1;
14
+ jQuery('#bp-media-album-prompt select').change(function() {
15
+ if ( jQuery(this).val() == 'create_new' ) {
16
+ jQuery('#bp-media-album-prompt select').hide();
17
+ jQuery('#bp-media-album-prompt p').hide();
18
+ jQuery('#bp-media-album-prompt div.hide').show();
19
+ } else
20
+ selected = jQuery(this).val();
21
+ });
22
+ var new_album_flag = 0;
23
+ jQuery('#btn-create-new').click(function(){
24
+ if ( new_album_flag == 1 ) {
25
+ return false;
26
+ }
27
+ var new_album_name = jQuery('#bp_media_album_new').val();
28
+ if(new_album_name.length==0){
29
+ alert('You have not filled the album name');
30
+ return false;
31
+ } else {
32
+ new_album_flag = 1;
33
+ jQuery(this).val('Wait');
34
+ var data = {
35
+ action: 'bp_media_add_album',
36
+ bp_media_album_name : new_album_name,
37
+ bp_media_group_id : bp_media_uploader_params.multipart_params.bp_media_group_id
38
+ };
39
+ jQuery.post(bp_media_vars.ajaxurl,data,function(response){
40
+ var album = parseInt(response);
41
+ if(album == 0){
42
+ alert('Sorry you cannot create albums in this group');
43
+ }
44
+ else {
45
+ jQuery('#bp-media-album-prompt select option').removeAttr('selected');
46
+ jQuery('#bp-media-selected-album').prepend('<option value='+album+' selected="selected">'+new_album_name+'</option>');
47
+ jQuery('#bp-media-album-prompt div.hide').hide();
48
+ jQuery('#bp-media-album-prompt select').show();
49
+ if ( in_list == 0 )
50
+ jQuery('#bp-media-album-prompt p').show();
51
+ }
52
+ });
53
+ }
54
+ });
55
+ jQuery('#btn-create-cancel').click(function(){
56
+ jQuery('#bp-media-album-prompt div.hide').hide();
57
+ jQuery('#bp-media-album-prompt select option').removeAttr('selected');
58
+ jQuery('#bp-media-album-prompt select option[value=' + selected + ']').attr('selected', 'selected');
59
+ jQuery('#bp-media-album-prompt select').show();
60
+ if ( in_list == 0 )
61
+ jQuery('#bp-media-album-prompt p').show();
62
+ });
63
+
64
+ //Normal Uplaoder
65
+ var bp_media_is_multiple_upload = false;
66
+ var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
67
+ var bp_media_album_selected = false;
68
+ bp_media_uploader.init();
69
 
70
+ bp_media_uploader.bind('FilesAdded', function(up, files) {
71
+ if ( jQuery('#bp-media-selected-album').val() == 'create_new' ) {
72
+ alert("Please Select an Album !!");
73
+ return false;
74
+ }
75
+ //bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
76
+ bp_media_is_multiple_upload = files.length>1;
77
+ jQuery.each(files, function(i, file) {
78
+ var extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
79
+ jQuery('#bp-media-uploaded-files').append('<div id="bp-media-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>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  });
81
+ bp_media_album_selected = jQuery('#bp-media-selected-album').val();
82
+ bp_media_uploader.start();
83
+ up.refresh(); // Reposition Flash/Silverlight
84
+ });
85
+ bp_media_uploader.bind('UploadProgress', function(up, file) {
86
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
87
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
88
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
+ bp_media_uploader.bind('Error', function(up, err) {
91
+ jQuery('#bp-media-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
92
+ ', Message: ' + err.message +
93
+ (err.file ? ', File: ' + err.file.name : '') +
94
+ '</p></div>'
95
+ );
96
+ up.refresh();
97
+ });
98
 
99
+ bp_media_uploader.bind('FileUploaded', function(up, file) {
100
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html("100%");
101
+ });
102
+ bp_media_uploader.bind('BeforeUpload',function(up){
103
+ up.settings.multipart_params.is_multiple_upload = bp_media_is_multiple_upload;
104
+ up.settings.multipart_params.bp_media_album_id = bp_media_album_selected;
105
+ });
106
+ bp_media_uploader.bind('UploadComplete',function(){
107
+ var new_location = window.location.href;
108
+ if(new_location.search('/upload/')>0){
109
+ new_location = new_location.replace('/upload/','/albums/');
110
+ if(bp_media_album_selected>0)
111
+ new_location = new_location.concat(bp_media_album_selected);
112
+ else
113
+ new_location = new_location.concat('0/');
114
+ window.location.replace(new_location);
115
+ } else
116
+ location.reload(true);
117
+ });
118
+
119
+
120
  });
app/helper/BPMediaSettings.php CHANGED
@@ -25,7 +25,21 @@ if (!class_exists('BPMediaSettings')) {
25
  */
26
  public function settings() {
27
  global $bp_media_addon;
28
- add_settings_section('bpm-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
30
  'setting' => 'bp_media_options',
31
  'option' => 'videos_enabled',
@@ -41,34 +55,25 @@ if (!class_exists('BPMediaSettings')) {
41
  'option' => 'images_enabled',
42
  'desc' => __('Check to enable images upload functionality', BP_MEDIA_TXT_DOMAIN)
43
  ));
44
- add_settings_field('bpm-download', __('Download', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
 
 
45
  'setting' => 'bp_media_options',
46
  'option' => 'download_enabled',
47
  'desc' => __('Check to enable download functionality', BP_MEDIA_TXT_DOMAIN)
48
  ));
49
- add_settings_field('bpm-admin-bar-menu', __('Admin bar menu', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
50
  'setting' => 'bp_media_options',
51
  'option' => 'show_admin_menu',
52
  'desc' => __('Check to enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN)
53
- )
54
- );
55
- add_settings_section('bpm-spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
56
- add_settings_field('bpm-spread-the-word-settings', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), array($this, 'radio'), 'bp-media-settings', 'bpm-spread-the-word', array(
57
- 'setting' => 'bp_media_options',
58
- 'option' => 'remove_linkback',
59
- 'radios' => array(
60
- 2 => __('Yes, I support BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
61
- 1 => __('No, I don\'t want to support BuddyPress Media', BP_MEDIA_TXT_DOMAIN)),
62
- 'default' => 2)
63
  );
64
- add_settings_section('bpm-other', __('BuddyPress Media Other Options', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
65
- add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-other', array(
66
  'option' => 'refresh-count',
67
  'name' => __('Re-Count', BP_MEDIA_TXT_DOMAIN),
68
  'desc' => __('It will re-count all media entries of all users and correct any discrepancies.', BP_MEDIA_TXT_DOMAIN)
69
  ));
70
 
71
-
72
  $bp_media_addon = new BPMediaAddon();
73
  add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
74
  add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
@@ -82,13 +87,29 @@ if (!class_exists('BPMediaSettings')) {
82
  }
83
 
84
  public function network_notices() {
 
 
 
 
 
 
 
 
 
 
 
 
85
  if (get_site_option('bpm-recount-success', false)) {
86
  echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option('bpm-recount-success') . '</strong></p></div>';
87
  delete_site_option('bpm-recount-success');
 
88
  } elseif (get_site_option('bpm-recount-fail', false)) {
89
  echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option('bpm-recount-fail') . '</strong></p></div>';
90
  delete_site_option('bpm-recount-fail');
91
- } elseif (get_site_option('bpm-settings-saved')) {
 
 
 
92
  echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option('bpm-settings-saved') . '</strong></p></div>';
93
  }
94
  delete_site_option('bpm-settings-saved');
@@ -119,6 +140,20 @@ if (!class_exists('BPMediaSettings')) {
119
  add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
120
  }
121
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  if (is_multisite())
123
  update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_FFMPEG_TXT_DOMAIN));
124
  do_action('bp_media_sanitize_settings', $_POST, $input);
@@ -164,7 +199,7 @@ if (!class_exists('BPMediaSettings')) {
164
  ?>
165
  <label for="<?php echo $option; ?>">
166
  <input<?php checked($options[$option]); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
167
- <?php echo $desc; ?>
168
  </label><?php
169
  }
170
 
@@ -211,7 +246,7 @@ if (!class_exists('BPMediaSettings')) {
211
  }
212
 
213
  foreach ($radios as $value => $desc) {
214
- ?>
215
  <label for="<?php echo sanitize_title($desc); ?>"><input<?php checked($options[$option], $value); ?> value="<?php echo $value; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($desc); ?>" type="radio" /><?php echo $desc; ?></label><br /><?php
216
  }
217
  }
@@ -254,12 +289,12 @@ if (!class_exists('BPMediaSettings')) {
254
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
255
  $options[$option] = '';
256
  }
257
- ?>
258
  <label for="<?php echo sanitize_title($option); ?>"><input value="<?php echo $options[$option]; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($option); ?>" type="<?php echo $password ? 'password' : 'text'; ?>" /><?php
259
  if (!empty($desc)) {
260
  echo '<br /><span class="description">' . $desc . '</span>';
261
  }
262
- ?></label><br /><?php
263
  }
264
 
265
  /**
@@ -300,14 +335,14 @@ if (!class_exists('BPMediaSettings')) {
300
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
301
  $options[$option] = '';
302
  }
303
- ?>
304
  <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
305
  <option><?php __e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
306
  }
307
  foreach ($values as $value => $text) {
308
- ?>
309
  <option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
310
- ?>
311
  </select><?php
312
  }
313
 
@@ -342,7 +377,7 @@ if (!class_exists('BPMediaSettings')) {
342
  $button = $option;
343
  submit_button($name, '', $button, false);
344
  if (!empty($desc)) {
345
- ?>
346
  <span class="description"><?php echo $desc; ?></a><?php
347
  }
348
  }
@@ -350,4 +385,4 @@ if (!class_exists('BPMediaSettings')) {
350
  }
351
 
352
  }
353
- ?>
25
  */
26
  public function settings() {
27
  global $bp_media_addon;
28
+ add_settings_section('bpm-media-type', __('Enable BuddyPress Media on', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
29
+ // add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
30
+ // 'setting' => 'bp_media_options',
31
+ // 'option' => 'enable_on_profile',
32
+ // 'desc' => __('Check to enable BuddyPress Media on User profiles', BP_MEDIA_TXT_DOMAIN)
33
+ // )
34
+ // );
35
+ add_settings_field('bpm-admin-group', __('Groups', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
36
+ 'setting' => 'bp_media_options',
37
+ 'option' => 'enable_on_group',
38
+ 'desc' => __('Check to enable BuddyPress Media in Groups', BP_MEDIA_TXT_DOMAIN)
39
+ )
40
+ );
41
+
42
+ add_settings_section('bpm-settings', __('Enable Media Types on', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
43
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
44
  'setting' => 'bp_media_options',
45
  'option' => 'videos_enabled',
55
  'option' => 'images_enabled',
56
  'desc' => __('Check to enable images upload functionality', BP_MEDIA_TXT_DOMAIN)
57
  ));
58
+
59
+ add_settings_section('bpm-miscellaneous', __('Miscellaneous Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
60
+ add_settings_field('bpm-download', __('Download', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
61
  'setting' => 'bp_media_options',
62
  'option' => 'download_enabled',
63
  'desc' => __('Check to enable download functionality', BP_MEDIA_TXT_DOMAIN)
64
  ));
65
+ add_settings_field('bpm-admin-bar-menu', __('Admin bar menu', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
66
  'setting' => 'bp_media_options',
67
  'option' => 'show_admin_menu',
68
  'desc' => __('Check to enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN)
69
+ )
 
 
 
 
 
 
 
 
 
70
  );
71
+ add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
 
72
  'option' => 'refresh-count',
73
  'name' => __('Re-Count', BP_MEDIA_TXT_DOMAIN),
74
  'desc' => __('It will re-count all media entries of all users and correct any discrepancies.', BP_MEDIA_TXT_DOMAIN)
75
  ));
76
 
 
77
  $bp_media_addon = new BPMediaAddon();
78
  add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
79
  add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
87
  }
88
 
89
  public function network_notices() {
90
+ $flag = 1;
91
+ if (get_site_option('bpm-media-enable', false)) {
92
+ echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . get_site_option('bpm-media-enable') . '</strong></p></div>';
93
+ delete_site_option('bpm-media-enable');
94
+ $flag = 0;
95
+ }
96
+ if (get_site_option('bpm-media-type', false)) {
97
+ echo '<div id="setting-error-bpm-media-type" class="error"><p><strong>' . get_site_option('bpm-media-type') . '</strong></p></div>';
98
+ delete_site_option('bpm-media-type');
99
+ $flag = 0;
100
+ }
101
+
102
  if (get_site_option('bpm-recount-success', false)) {
103
  echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option('bpm-recount-success') . '</strong></p></div>';
104
  delete_site_option('bpm-recount-success');
105
+ $flag = 0;
106
  } elseif (get_site_option('bpm-recount-fail', false)) {
107
  echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option('bpm-recount-fail') . '</strong></p></div>';
108
  delete_site_option('bpm-recount-fail');
109
+ $flag = 0;
110
+ }
111
+
112
+ if (get_site_option('bpm-settings-saved') && $flag) {
113
  echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option('bpm-settings-saved') . '</strong></p></div>';
114
  }
115
  delete_site_option('bpm-settings-saved');
140
  add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
141
  }
142
  }
143
+ if (!isset($_POST['bp_media_options']['enable_on_profile']) && !isset($_POST['bp_media_options']['enable_on_group'])) {
144
+ if (is_multisite())
145
+ update_site_option('bpm-media-enable', __('Enable BuddyPress Media on either User Profiles or Groups or both. Atleast one should be selected.', BP_MEDIA_TXT_DOMAIN));
146
+ else
147
+ add_settings_error(__('Enable BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'bpm-media-enable', __('Enable BuddyPress Media on either User Profiles or Groups or both. Atleast one should be selected.', BP_MEDIA_TXT_DOMAIN));
148
+ $input['enable_on_profile'] = 1;
149
+ }
150
+ if (!isset($_POST['bp_media_options']['videos_enabled']) && !isset($_POST['bp_media_options']['audio_enabled']) && !isset($_POST['bp_media_options']['images_enabled'])) {
151
+ if (is_multisite())
152
+ update_site_option('bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
153
+ else
154
+ add_settings_error(__('Media Type', BP_MEDIA_TXT_DOMAIN), 'bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
155
+ $input['images_enabled'] = 1;
156
+ }
157
  if (is_multisite())
158
  update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_FFMPEG_TXT_DOMAIN));
159
  do_action('bp_media_sanitize_settings', $_POST, $input);
199
  ?>
200
  <label for="<?php echo $option; ?>">
201
  <input<?php checked($options[$option]); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
202
+ <?php echo $desc; ?>
203
  </label><?php
204
  }
205
 
246
  }
247
 
248
  foreach ($radios as $value => $desc) {
249
+ ?>
250
  <label for="<?php echo sanitize_title($desc); ?>"><input<?php checked($options[$option], $value); ?> value="<?php echo $value; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($desc); ?>" type="radio" /><?php echo $desc; ?></label><br /><?php
251
  }
252
  }
289
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
290
  $options[$option] = '';
291
  }
292
+ ?>
293
  <label for="<?php echo sanitize_title($option); ?>"><input value="<?php echo $options[$option]; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($option); ?>" type="<?php echo $password ? 'password' : 'text'; ?>" /><?php
294
  if (!empty($desc)) {
295
  echo '<br /><span class="description">' . $desc . '</span>';
296
  }
297
+ ?></label><br /><?php
298
  }
299
 
300
  /**
335
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
336
  $options[$option] = '';
337
  }
338
+ ?>
339
  <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
340
  <option><?php __e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
341
  }
342
  foreach ($values as $value => $text) {
343
+ ?>
344
  <option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
345
+ ?>
346
  </select><?php
347
  }
348
 
377
  $button = $option;
378
  submit_button($name, '', $button, false);
379
  if (!empty($desc)) {
380
+ ?>
381
  <span class="description"><?php echo $desc; ?></a><?php
382
  }
383
  }
385
  }
386
 
387
  }
388
+ ?>
app/{main/importers → importers}/BPMediaBPActivityPlusImporter.php RENAMED
File without changes
app/importers/BPMediaBPAlbumImporter.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 BPMediaBPAlbumImporter extends BPMediaImporter {
14
+
15
+
16
+ function __construct() {
17
+ parent::__construct();
18
+ $this->active = $this->_active( 'bp-album/loader.php' );
19
+
20
+ if($this->active!=-1){
21
+ $this->update_table();
22
+ $this->set_total_count();
23
+ }
24
+ }
25
+
26
+ function update_table() {
27
+ global $wpdb;
28
+ $wpdb->query(
29
+ "ALTER TABLE {$wpdb->base_prefix}bp_album ADD COLUMN
30
+ import_status TINYINT (1) NOT NULL DEFAULT 0"
31
+ );
32
+ }
33
+
34
+ function create_album($album_name = 'BP Album'){
35
+ parent::create_album($album_name);
36
+ }
37
+
38
+ function get_total_count() {
39
+ global $wpdb;
40
+ $table = $wpdb->base_prefix . 'bp_album';
41
+ if ( $this->table_exists( $table ) && $this->active != -1 ) {
42
+ return $wpdb->query( "SELECT * FROM {$table}" );
43
+ }
44
+ }
45
+
46
+ function set_total_count(){
47
+ $total_count = $this->get_total_count();
48
+ update_site_option('bp_album_import_total_count',$total_count);
49
+ $this->import_steps = ceil( floatval( $total_count ) / 10 );
50
+ update_site_option('bp_album_import_total_count',$total_count);
51
+
52
+ }
53
+
54
+ static function batch_import($offset=0){
55
+ global $wpdb;
56
+ $table = $wpdb->base_prefix . 'bp_album';
57
+ $bp_album_data = $wpdb->get_results(
58
+ "SELECT * FROM {$table} WHERE import_status='0'
59
+ LIMIT 10 OFFSET {$offset}"
60
+ );
61
+
62
+ return $bp_album_data;
63
+
64
+ }
65
+
66
+ static function bpmedia_ajax_import_callback(){
67
+
68
+ $offset = 0;//$_GET['offset'];
69
+
70
+ $bp_album_data = BPMediaBPAlbumImporter::batch_import($offset);
71
+
72
+ foreach ($bp_album_data as &$bp_album_item){
73
+ $album_id=BPMediaBPAlbumImporter::create_album('',$bp_album_item->owner_id);
74
+ BPMediaImporter::add_media(
75
+ $album_id,
76
+ $bp_album_item->title,
77
+ $bp_album_item->description,
78
+ $bp_album_item->pic_org_path,
79
+ $bp_album_item->privacy,
80
+ $bp_album_item->owner_id
81
+ );
82
+ }
83
+ }
84
+
85
+ }
86
+
87
+ ?>
app/importers/BPMediaImporter.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 BPMediaImporter
10
+ *
11
+ * @author saurabh
12
+ */
13
+ class BPMediaImporter {
14
+
15
+ /**
16
+ *
17
+ */
18
+
19
+ var $active;
20
+ var $import_steps;
21
+
22
+ function __construct() {
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
+
116
+ ?>
app/main/BPMediaComponent.php ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Don't load this file directly!
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) )
6
+ exit;
7
+
8
+ /**
9
+ * Add BuddyPress Media as a component of BuddyPress
10
+ *
11
+ * @author Saurabh Shukla <saurabh.shukla@rtcamp.com>
12
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
13
+ */
14
+ class BPMediaComponent extends BP_Component {
15
+
16
+ /**
17
+ * Hold the messages that are generated during initialization process
18
+ * and will be shown on the screen functions
19
+ *
20
+ * @var array
21
+ */
22
+ var $messages = array(
23
+ 'error' => array(),
24
+ 'info' => array(),
25
+ 'updated' => array()
26
+ );
27
+
28
+ /**
29
+ * Initialise the component with appropriate parameters.
30
+ * Add hook for plugins, themes, extensions to hook on to
31
+ * Activates the component
32
+ * Registers necessary post types
33
+ *
34
+ * @global object $bp The global BuddyPress object
35
+ */
36
+ function __construct() {
37
+ global $bp;
38
+ parent::start(BP_MEDIA_SLUG, BP_MEDIA_LABEL, BP_MEDIA_PATH);
39
+ do_action('bp_media_init');
40
+ $bp->active_components[$this->id] = '1';
41
+ add_action('init', array(&$this, 'register_post_types'), 10);
42
+ }
43
+
44
+ /**
45
+ * Initialise the global variables of the BuddyPress Media
46
+ * and its parent class.
47
+ * Add necessary slugs and search functionality
48
+ *
49
+ * @global object $bp The global BuddyPress object
50
+ */
51
+ function setup_globals() {
52
+ global $bp;
53
+ $globals = array(
54
+ 'slug' => BP_MEDIA_SLUG,
55
+ 'root_slug' => isset(
56
+ $bp->pages->{$this->id}->slug) ?
57
+ $bp->pages->{$this->id}->slug
58
+ : BP_MEDIA_SLUG,
59
+ // 'has_directory' => true, // Set to false if not required
60
+ 'search_string' => __('Search Media...', BP_MEDIA_TXT_DOMAIN),
61
+ );
62
+ parent::setup_globals($globals);
63
+ }
64
+
65
+ /**
66
+ * Sets up BuddyPress Media navigation and tabs on profile
67
+ *
68
+ * @global object $bp The global BuddyPress object
69
+ */
70
+ function setup_nav() {
71
+ global $bp, $bp_media;
72
+
73
+ $enabled = $bp_media->enabled();
74
+ $default_tab = $bp_media->default_tab();
75
+ $defaults_tab = $bp_media->defaults_tab();
76
+
77
+ /* Upload Screen */
78
+
79
+
80
+ /* Media Screens */
81
+ foreach ($enabled as $tab=>$active){
82
+ if($active==true){
83
+ $tabs = $tab;
84
+ if($tabs!='audio'&&$tabs!='upload'){
85
+ $tabs .= 's';
86
+ }
87
+ if($tab=='upload'){
88
+ ${'bp_media_'.$tab} = new BPMediaUploadScreen(
89
+ $tab,
90
+ constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
91
+ );
92
+ }elseif($tab=='album'){
93
+ $bp_media_album = new BPMediaAlbumScreen(
94
+ $tab,
95
+ constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
96
+ );
97
+ }else{
98
+ ${'bp_media_'.$tab} = new BPMediaScreen(
99
+ $tab,
100
+ constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
101
+ );
102
+ }
103
+ }
104
+ }
105
+
106
+ /* Switch between different screens depending on context */
107
+ switch ($bp->current_component) {
108
+ case BP_MEDIA_IMAGES_SLUG:
109
+ if ( $enabled['image'] && is_numeric($bp->current_action)) {
110
+ $bp->action_variables[0] = $bp->current_action;
111
+ $bp->current_action = BP_MEDIA_IMAGES_ENTRY_SLUG;
112
+ }
113
+ break;
114
+ case BP_MEDIA_AUDIO_SLUG:
115
+ if ($enabled['audio'] && is_numeric($bp->current_action)) {
116
+ $bp->action_variables[0] = $bp->current_action;
117
+ $bp->current_action = BP_MEDIA_AUDIO_ENTRY_SLUG;
118
+ }
119
+ break;
120
+ case BP_MEDIA_VIDEOS_SLUG:
121
+ if ($enabled['video'] && is_numeric($bp->current_action)) {
122
+ $bp->action_variables[0] = $bp->current_action;
123
+ $bp->current_action = BP_MEDIA_VIDEOS_ENTRY_SLUG;
124
+ }
125
+ break;
126
+ case BP_MEDIA_ALBUMS_SLUG:
127
+ if (is_numeric($bp->current_action)) {
128
+ $bp->action_variables[0] = $bp->current_action;
129
+ $bp->current_action = BP_MEDIA_ALBUMS_ENTRY_SLUG;
130
+ }
131
+ break;
132
+ }
133
+
134
+ /* Create the main navigation on profile */
135
+ $main_nav = array(
136
+ 'name' => __(BP_MEDIA_LABEL, BP_MEDIA_TXT_DOMAIN),
137
+ 'slug' => BP_MEDIA_SLUG,
138
+ 'position' => 80,
139
+ 'screen_function' => array(${'bp_media_'.$default_tab}, 'screen'),
140
+ 'default_subnav_slug' => constant('BP_MEDIA_'.strtoupper($defaults_tab).'_SLUG')
141
+ );
142
+
143
+ /* Create an empty sub navigation */
144
+ $sub_nav[] = array();
145
+
146
+ /* Set up navigation */
147
+ parent::setup_nav($main_nav, $sub_nav);
148
+
149
+ /* Set up individual screens for each nav/sub nav */
150
+ if($enabled['image']){
151
+ bp_core_new_nav_item(array(
152
+ 'name' => __(BP_MEDIA_IMAGES_LABEL, BP_MEDIA_TXT_DOMAIN),
153
+ 'slug' => BP_MEDIA_IMAGES_SLUG,
154
+ 'screen_function' => array($bp_media_image, 'screen'),
155
+ ));
156
+
157
+
158
+
159
+ bp_core_new_subnav_item(array(
160
+ 'name' => 'View',
161
+ /* Display name for the nav item(It won't be shown anywhere) */
162
+ 'slug' => BP_MEDIA_IMAGES_ENTRY_SLUG,
163
+ /* URL slug for the nav item */
164
+ 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
165
+ /* URL slug of the parent nav item */
166
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
167
+ . BP_MEDIA_IMAGES_SLUG),
168
+ /* URL of the parent item */
169
+ 'position' => 90,
170
+ /* Index of where this nav item should be positioned */
171
+ 'screen_function' => array($bp_media_image, 'screen'),
172
+ /* The name of the function to run when clicked */
173
+ ));
174
+
175
+ bp_core_new_subnav_item(array(
176
+ 'name' => 'Edit',
177
+ /* Display name for the nav item(It won't be shown anywhere) */
178
+ 'slug' => BP_MEDIA_IMAGES_EDIT_SLUG,
179
+ /* URL slug for the nav item */
180
+ 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
181
+ /* URL slug of the parent nav item */
182
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
183
+ . BP_MEDIA_IMAGES_SLUG),
184
+ /* URL of the parent item */
185
+ 'position' => 90,
186
+ /* Index of where this nav item should be positioned */
187
+ 'screen_function' => array($bp_media_image, 'edit_screen'),
188
+ /* The name of the function to run when clicked */
189
+ ));
190
+
191
+ bp_core_new_subnav_item(array(
192
+ 'name' => 'Delete',
193
+ /* Display name for the nav item(It won't be shown anywhere) */
194
+ 'slug' => BP_MEDIA_DELETE_SLUG,
195
+ /* URL slug for the nav item */
196
+ 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
197
+ /* URL slug of the parent nav item */
198
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
199
+ . BP_MEDIA_IMAGES_SLUG),
200
+ /* URL of the parent item */
201
+ 'position' => 90,
202
+ /* Index of where this nav item should be positioned */
203
+ 'screen_function' => array($bp_media_image, 'screen'),
204
+ /* The name of the function to run when clicked */
205
+ ));
206
+
207
+ bp_core_new_subnav_item(array(
208
+ 'name' => 'Page',
209
+ /* Display name for the nav item(It won't be shown anywhere) */
210
+ 'slug' => 'page',
211
+ /* URL slug for the nav item */
212
+ 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
213
+ /* URL slug of the parent nav item */
214
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
215
+ . BP_MEDIA_IMAGES_SLUG),
216
+ /* URL of the parent item */
217
+ 'position' => 90,
218
+ /* Index of where this nav item should be positioned */
219
+ 'screen_function' => array($bp_media_image, 'screen'),
220
+ /* The name of the function to run when clicked */
221
+ ));
222
+ }
223
+
224
+ if($enabled['video']){
225
+ bp_core_new_nav_item(array(
226
+ 'name' => __(BP_MEDIA_VIDEOS_LABEL, BP_MEDIA_TXT_DOMAIN),
227
+ 'slug' => BP_MEDIA_VIDEOS_SLUG,
228
+ 'screen_function' => array($bp_media_video, 'screen')
229
+ ));
230
+
231
+ bp_core_new_subnav_item(array(
232
+ 'name' => 'Watch',
233
+ /* Display name for the nav item(It won't be shown anywhere) */
234
+ 'slug' => BP_MEDIA_VIDEOS_ENTRY_SLUG,
235
+ /* URL slug for the nav item */
236
+ 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
237
+ /* URL slug of the parent nav item */
238
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
239
+ . BP_MEDIA_VIDEOS_SLUG),
240
+ /* URL of the parent item */
241
+ 'position' => 90,
242
+ /* Index of where this nav item should be positioned */
243
+ 'screen_function' => array($bp_media_video, 'screen'),
244
+ /* The name of the function to run when clicked */
245
+ ));
246
+
247
+ bp_core_new_subnav_item(array(
248
+ 'name' => 'Edit',
249
+ /* Display name for the nav item(It won't be shown anywhere) */
250
+ 'slug' => BP_MEDIA_VIDEOS_EDIT_SLUG,
251
+ /* URL slug for the nav item */
252
+ 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
253
+ /* URL slug of the parent nav item */
254
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
255
+ . BP_MEDIA_VIDEOS_SLUG),
256
+ /* URL of the parent item */
257
+ 'position' => 90,
258
+ /* Index of where this nav item should be positioned */
259
+ 'screen_function' => array($bp_media_video, 'edit_screen'),
260
+ /* The name of the function to run when clicked */
261
+ ));
262
+
263
+ bp_core_new_subnav_item(array(
264
+ 'name' => 'Delete',
265
+ /* Display name for the nav item(It won't be shown anywhere) */
266
+ 'slug' => BP_MEDIA_DELETE_SLUG,
267
+ /* URL slug for the nav item */
268
+ 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
269
+ /* URL slug of the parent nav item */
270
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
271
+ . BP_MEDIA_VIDEOS_SLUG),
272
+ /* URL of the parent item */
273
+ 'position' => 90,
274
+ /* Index of where this nav item should be positioned */
275
+ 'screen_function' => array($bp_media_video, 'screen'),
276
+ /* The name of the function to run when clicked */
277
+ ));
278
+
279
+ bp_core_new_subnav_item(array(
280
+ 'name' => 'Page',
281
+ /* Display name for the nav item(It won't be shown anywhere) */
282
+ 'slug' => 'page',
283
+ /* URL slug for the nav item */
284
+ 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
285
+ /* URL slug of the parent nav item */
286
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
287
+ . BP_MEDIA_VIDEOS_SLUG),
288
+ /* URL of the parent item */
289
+ 'position' => 90,
290
+ /* Index of where this nav item should be positioned */
291
+ 'screen_function' => array($bp_media_video, 'screen'),
292
+ /* The name of the function to run when clicked */
293
+ ));
294
+ }
295
+
296
+ if($enabled['audio']){
297
+ bp_core_new_nav_item(array(
298
+ 'name' => __(BP_MEDIA_AUDIO_LABEL, BP_MEDIA_TXT_DOMAIN),
299
+ 'slug' => BP_MEDIA_AUDIO_SLUG,
300
+ 'screen_function' => array($bp_media_audio, 'screen')
301
+ ));
302
+
303
+ bp_core_new_subnav_item(array(
304
+ 'name' => 'Listen',
305
+ /* Display name for the nav item(It won't be shown anywhere) */
306
+ 'slug' => BP_MEDIA_AUDIO_ENTRY_SLUG,
307
+ /* URL slug for the nav item */
308
+ 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
309
+ /* URL slug of the parent nav item */
310
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
311
+ . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
312
+ 'position' => 90,
313
+ /* Index of where this nav item should be positioned */
314
+ 'screen_function' => array($bp_media_audio, 'screen'),
315
+ /* The name of the function to run when clicked */
316
+ ));
317
+
318
+ bp_core_new_subnav_item(array(
319
+ 'name' => 'Edit',
320
+ /* Display name for the nav item(It won't be shown anywhere) */
321
+ 'slug' => BP_MEDIA_AUDIO_EDIT_SLUG,
322
+ /* URL slug for the nav item */
323
+ 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
324
+ /* URL slug of the parent nav item */
325
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
326
+ . BP_MEDIA_AUDIO_SLUG),
327
+ /* URL of the parent item */
328
+ 'position' => 90,
329
+ /* Index of where this nav item should be positioned */
330
+ 'screen_function' => array($bp_media_audio, 'edit_screen'),
331
+ /* The name of the function to run when clicked */
332
+ ));
333
+
334
+ bp_core_new_subnav_item(array(
335
+ 'name' => 'Delete',
336
+ /* Display name for the nav item(It won't be shown anywhere) */
337
+ 'slug' => BP_MEDIA_DELETE_SLUG,
338
+ /* URL slug for the nav item */
339
+ 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
340
+ /* URL slug of the parent nav item */
341
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
342
+ . BP_MEDIA_AUDIO_SLUG),
343
+ /* URL of the parent item */
344
+ 'position' => 90,
345
+ /* Index of where this nav item should be positioned */
346
+ 'screen_function' => array($bp_media_audio, 'screen'),
347
+ /* The name of the function to run when clicked */
348
+ ));
349
+
350
+ bp_core_new_subnav_item(array(
351
+ 'name' => 'Page',
352
+ /* Display name for the nav item(It won't be shown anywhere) */
353
+ 'slug' => 'page',
354
+ /* URL slug for the nav item */
355
+ 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
356
+ /* URL slug of the parent nav item */
357
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
358
+ . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
359
+ 'position' => 90,
360
+ /* Index of where this nav item should be positioned */
361
+ 'screen_function' => array($bp_media_audio, 'screen'),
362
+ /* The name of the function to run when clicked */
363
+ ));
364
+ }
365
+
366
+ bp_core_new_nav_item(array(
367
+ 'name' => __(BP_MEDIA_ALBUMS_LABEL, BP_MEDIA_TXT_DOMAIN),
368
+ 'slug' => BP_MEDIA_ALBUMS_SLUG,
369
+ 'screen_function' => array($bp_media_album, 'screen'),
370
+ ));
371
+
372
+ bp_core_new_subnav_item(array(
373
+ 'name' => 'View',
374
+ /* Display name for the nav item(It won't be shown anywhere) */
375
+ 'slug' => BP_MEDIA_ALBUMS_ENTRY_SLUG,
376
+ /* URL slug for the nav item */
377
+ 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
378
+ /* URL slug of the parent nav item */
379
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
380
+ . BP_MEDIA_ALBUMS_SLUG),
381
+ /* URL of the parent item */
382
+ 'position' => 90,
383
+ /* Index of where this nav item should be positioned */
384
+ 'screen_function' => array($bp_media_album, 'screen'),
385
+ /* The name of the function to run when clicked */
386
+ ));
387
+
388
+ bp_core_new_subnav_item(array(
389
+ 'name' => 'Edit',
390
+ /* Display name for the nav item(It won't be shown anywhere) */
391
+ 'slug' => BP_MEDIA_ALBUMS_EDIT_SLUG,
392
+ /* URL slug for the nav item */
393
+ 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
394
+ /* URL slug of the parent nav item */
395
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
396
+ . BP_MEDIA_ALBUMS_SLUG),
397
+ /* URL of the parent item */
398
+ 'position' => 90,
399
+ /* Index of where this nav item should be positioned */
400
+ 'screen_function' => array($bp_media_album, 'edit_screen'),
401
+ /* The name of the function to run when clicked */
402
+ ));
403
+
404
+ bp_core_new_subnav_item(array(
405
+ 'name' => 'Delete',
406
+ /* Display name for the nav item(It won't be shown anywhere) */
407
+ 'slug' => BP_MEDIA_DELETE_SLUG,
408
+ /* URL slug for the nav item */
409
+ 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
410
+ /* URL slug of the parent nav item */
411
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
412
+ . BP_MEDIA_ALBUMS_SLUG),
413
+ /* URL of the parent item */
414
+ 'position' => 90,
415
+ /* Index of where this nav item should be positioned */
416
+ 'screen_function' => array($bp_media_album, 'screen'),
417
+ /* The name of the function to run when clicked */
418
+ ));
419
+
420
+ bp_core_new_subnav_item(array(
421
+ 'name' => 'Page',
422
+ /* Display name for the nav item(It won't be shown anywhere) */
423
+ 'slug' => 'page',
424
+ /* URL slug for the nav item */
425
+ 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
426
+ /* URL slug of the parent nav item */
427
+ 'parent_url' => trailingslashit(bp_loggedin_user_domain()
428
+ . BP_MEDIA_ALBUMS_SLUG),
429
+ /* URL of the parent item */
430
+ 'position' => 90,
431
+ /* Index of where this nav item should be positioned */
432
+ 'screen_function' => array($bp_media_album, 'screen'),
433
+ /* The name of the function to run when clicked */
434
+ ));
435
+ bp_core_new_nav_item(array(
436
+ 'name' => __(BP_MEDIA_UPLOAD_LABEL, BP_MEDIA_TXT_DOMAIN),
437
+ 'slug' => BP_MEDIA_UPLOAD_SLUG,
438
+ 'screen_function' => array($bp_media_upload, 'upload_screen'),
439
+ 'user_has_access' => bp_is_my_profile()
440
+ ));
441
+ }
442
+
443
+ /**
444
+ * Register Custom Post Types required by BuddyPress Media
445
+ */
446
+ function register_post_types() {
447
+
448
+ /* Set up Album labels */
449
+ $album_labels = array(
450
+ 'name' => __('Albums',
451
+ BP_MEDIA_TXT_DOMAIN),
452
+ 'singular_name' => __('Album',
453
+ BP_MEDIA_TXT_DOMAIN),
454
+ 'add_new' => __('Create',
455
+ BP_MEDIA_TXT_DOMAIN),
456
+ 'add_new_item' => __('Create Album',
457
+ BP_MEDIA_TXT_DOMAIN),
458
+ 'edit_item' => __('Edit Album',
459
+ BP_MEDIA_TXT_DOMAIN),
460
+ 'new_item' => __('New Album',
461
+ BP_MEDIA_TXT_DOMAIN),
462
+ 'all_items' => __('All Albums',
463
+ BP_MEDIA_TXT_DOMAIN),
464
+ 'view_item' => __('View Album',
465
+ BP_MEDIA_TXT_DOMAIN),
466
+ 'search_items' => __('Search Albums',
467
+ BP_MEDIA_TXT_DOMAIN),
468
+ 'not_found' => __('No album found',
469
+ BP_MEDIA_TXT_DOMAIN),
470
+ 'not_found_in_trash' => __('No album found in Trash',
471
+ BP_MEDIA_TXT_DOMAIN),
472
+ 'parent_item_colon' => '',
473
+ 'menu_name' => __('Albums',
474
+ BP_MEDIA_TXT_DOMAIN)
475
+ );
476
+
477
+ /* Set up Album post type arguments */
478
+ $album_args = array(
479
+ 'labels' => $album_labels,
480
+ 'public' => true,
481
+ 'publicly_queryable' => true,
482
+ 'show_ui' => false,
483
+ 'show_in_menu' => false,
484
+ 'query_var' => true,
485
+ 'capability_type' => 'post',
486
+ 'has_archive' => true,
487
+ 'hierarchical' => false,
488
+ 'menu_position' => null,
489
+ 'supports' => array(
490
+ 'title',
491
+ 'author',
492
+ 'thumbnail',
493
+ 'excerpt',
494
+ 'comments'
495
+ )
496
+ );
497
+
498
+ /* register Album post type */
499
+ register_post_type('bp_media_album', $album_args);
500
+
501
+
502
+ /* Set up labels for Media post type */
503
+ $labels = array(
504
+ 'name' => __('Media', BP_MEDIA_TXT_DOMAIN),
505
+ 'singular' => __('Media', BP_MEDIA_TXT_DOMAIN),
506
+ 'add_new' => __('Add New Media', BP_MEDIA_TXT_DOMAIN)
507
+ );
508
+
509
+ /* Set up the arguments for Media post type */
510
+ $args = array(
511
+ 'label' => __('Media', BP_MEDIA_TXT_DOMAIN),
512
+ 'labels' => $labels,
513
+ 'description' => __(
514
+ 'BuddyPress Media\'s Media Files',
515
+ BP_MEDIA_TXT_DOMAIN
516
+ ),
517
+ 'public' => true,
518
+ 'show_ui' => false,
519
+ 'supports' => array(
520
+ 'title',
521
+ 'editor',
522
+ 'excerpt',
523
+ 'author',
524
+ 'thumbnail',
525
+ 'custom-fields'
526
+ )
527
+ );
528
+
529
+ /* Register Media post type */
530
+ register_post_type('bp_media', $args);
531
+
532
+ /* Register parent's post types */
533
+ parent::register_post_types();
534
+ }
535
+
536
+ }
537
+
538
+ ?>
app/main/BPMediaGroupLoader.php ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Don't load this file directly!
4
+ */
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
+ /**
9
+ * Loads Group Media functionality
10
+ *
11
+ * @author Faishal Saiyed <faishal.saiyed@rtcamp.com>
12
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
13
+ */
14
+ class BPMediaGroupLoader {
15
+
16
+ /**
17
+ * Constructs all the group functionality
18
+ * Loads dummy classes
19
+ * Adds necessary navigation and tabs
20
+ *
21
+ */
22
+ function __construct() {
23
+ global $bp_media;
24
+ $enabled = $bp_media->enabled();
25
+
26
+
27
+ if (class_exists('BPMediaGroupsExtension')) :
28
+ bp_register_group_extension('BPMediaGroupsExtension');
29
+ foreach (array('image','video', 'audio', 'album', 'upload') as $type){
30
+ if($enabled[$type]){
31
+ $types = $type;
32
+ if($types!='audio'&&$types!='upload'){
33
+ $types .= 's';
34
+ }
35
+ $grp_class = 'BPMediaGroup'.ucfirst($types);
36
+ new $grp_class();
37
+ }
38
+ }
39
+ endif;
40
+ add_action('bp_actions', array($this, 'custom_nav'), 999);
41
+ add_filter('bp_media_multipart_params_filter',
42
+ array($this, 'multipart_params_handler')
43
+ );
44
+ }
45
+
46
+ /**
47
+ * Handles the custom navigation structure of the BuddyPress Group Extension Media
48
+ *
49
+ * @uses global $bp
50
+ *
51
+ * @since BuddyPress Media 2.3
52
+ */
53
+
54
+ /**
55
+ *
56
+ * @global type $bp
57
+ * @return type
58
+ */
59
+ function custom_nav() {
60
+ global $bp;
61
+ $current_group = isset($bp->groups->current_group->slug) ?
62
+ $bp->groups->current_group->slug : null;
63
+ if (!$current_group)
64
+ return;
65
+ if (!(isset($bp->bp_options_nav[$current_group])
66
+ && is_array($bp->bp_options_nav[$current_group])))
67
+ return;
68
+
69
+ /** This line might break a thing or two in custom themes and widgets */
70
+ remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
71
+ // add_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::group_activity_query_filter', 10);
72
+
73
+ foreach ($bp->bp_options_nav[$current_group] as $key => $nav_item) {
74
+ switch ($nav_item['slug']) {
75
+ case BP_MEDIA_IMAGES_SLUG:
76
+ case BP_MEDIA_VIDEOS_SLUG:
77
+ case BP_MEDIA_AUDIO_SLUG:
78
+ case BP_MEDIA_ALBUMS_SLUG:
79
+ case BP_MEDIA_UPLOAD_SLUG:
80
+ unset($bp->bp_options_nav[$current_group][$key]);
81
+ }
82
+ switch ($bp->current_action) {
83
+ case BP_MEDIA_IMAGES_SLUG:
84
+
85
+ case BP_MEDIA_VIDEOS_SLUG:
86
+ case BP_MEDIA_AUDIO_SLUG:
87
+ case BP_MEDIA_ALBUMS_SLUG:
88
+ case BP_MEDIA_UPLOAD_SLUG:
89
+ $count = count($bp->action_variables);
90
+ for ($i = $count; $i > 0; $i--) {
91
+ $bp->action_variables[$i] = $bp->action_variables[$i - 1];
92
+ }
93
+ $bp->action_variables[0] = $bp->current_action;
94
+ $bp->current_action = BP_MEDIA_SLUG;
95
+ }
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Adds the current group id as parameter for plupload
101
+ *
102
+ * @param Array $multipart_params Array of Multipart Parameters to be passed on to plupload script
103
+ *
104
+ * @since BuddyPress Media 2.3
105
+ */
106
+
107
+ /**
108
+ *
109
+ * @global type $bp
110
+ * @param type $multipart_params
111
+ * @return type
112
+ */
113
+ function multipart_params_handler($multipart_params) {
114
+ if (is_array($multipart_params)) {
115
+ global $bp;
116
+ if (isset($bp->current_action) && ( ($bp->current_action == BP_MEDIA_SLUG) || bp_is_group_home() )
117
+ && isset($bp->action_variables)
118
+ && isset($bp->current_component)
119
+ && $bp->current_component == 'groups'
120
+ && isset($bp->groups->current_group->id)) {
121
+ $multipart_params['bp_media_group_id'] = $bp->groups->current_group->id;
122
+ }
123
+ }
124
+ return $multipart_params;
125
+ }
126
+
127
+ /**
128
+ * Displays the navigation available to the group media tab for the
129
+ * logged in user.
130
+ *
131
+ * @uses $bp Global Variable set by BuddyPress
132
+ *
133
+ * @since BuddyPress Media 2.3
134
+ */
135
+
136
+ /**
137
+ *
138
+ * @global type $bp
139
+ * @return boolean
140
+ */
141
+ static function navigation_menu() {
142
+ global $bp,$bp_media;
143
+ $enabled = $bp_media->enabled();
144
+ $default_tab = $bp_media->default_tab();
145
+ $defaults_tab = $bp_media->defaults_tab();
146
+ $default_const = 'BP_MEDIA_'.strtoupper($defaults_tab).'_SLUG';
147
+
148
+ if (!isset($bp->current_action) || $bp->current_action != BP_MEDIA_SLUG)
149
+ return false;
150
+ ${'bp_media_'.$default_tab} = new BPMediaScreen($defaults_tab, constant($default_const));
151
+
152
+
153
+ if (isset($bp->action_variables[0])) {
154
+ $current_tab = $bp->action_variables[0];
155
+ }else{
156
+ $current_tab = constant($default_const);
157
+ }
158
+
159
+ // if (BPMediaGroup::can_upload()) {
160
+ $bp_media_nav[constant($default_const)] = array(
161
+ 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . BP_MEDIA_SLUG,
162
+ 'label' => constant('BP_MEDIA_'.strtoupper($defaults_tab).'_LABEL'),
163
+ 'screen_function' => array(${'bp_media_'.$default_tab}, 'screen')
164
+ );
165
+ // } else {
166
+ // $bp_media_nav = array();
167
+ // }
168
+
169
+ foreach (array('IMAGES','VIDEOS', 'AUDIO', 'ALBUMS', 'UPLOAD') as $types) {
170
+ if ($types == 'UPLOAD') {
171
+
172
+ if (BPMediaGroupLoader::can_upload()) {
173
+ $bp_media_nav[constant('BP_MEDIA_' . $types . '_SLUG')] = array(
174
+ 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $types . '_SLUG'),
175
+ 'label' => constant('BP_MEDIA_' . $types . '_LABEL'),
176
+ // 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
177
+ 'user_has_access' => BPMediaGroupLoader::can_upload()
178
+ );
179
+ }
180
+ } else {
181
+ $type = $types;
182
+ if($types!='AUDIO'){
183
+ $type = substr($types, 0, -1);
184
+ }
185
+ if($enabled[strtolower($type)] && $default_tab!=strtolower($type)){
186
+ $bp_media_nav[constant('BP_MEDIA_' . $types . '_SLUG')] = array(
187
+ 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $types . '_SLUG'),
188
+ 'label' => constant('BP_MEDIA_' . $types . '_LABEL'),
189
+ );
190
+ }
191
+ }
192
+ }
193
+
194
+ /** This variable will be used to display the tabs in group component */
195
+ $bp_media_group_tabs = apply_filters('bp_media_group_tabs', $bp_media_nav, $current_tab);
196
+ ?>
197
+ <div class="item-list-tabs no-ajax bp-media-group-navigation" id="subnav">
198
+ <ul>
199
+ <?php
200
+ foreach ($bp_media_group_tabs as $tab_slug => $tab_info) {
201
+ echo '<li id="' . $tab_slug . '-group-li" ' . ($current_tab == $tab_slug ? 'class="current selected"' : '') . '><a id="' . $tab_slug . '" href="' . $tab_info['url'] . '" title="' . __($tab_info['label'], BP_MEDIA_TXT_DOMAIN) . '">' . __($tab_info['label'], BP_MEDIA_TXT_DOMAIN) . '</a></li>';
202
+ }
203
+ ?>
204
+ </ul>
205
+ </div>
206
+ <?php
207
+ }
208
+
209
+ /**
210
+ * Checks whether the current logged in user has the ability to upload on
211
+ * the given group or not
212
+ *
213
+ * @since BuddyPress Media 2.3
214
+ */
215
+
216
+ /**
217
+ *
218
+ * @global type $bp
219
+ * @return boolean
220
+ */
221
+ static function can_upload() {
222
+ /** @todo Implementation Pending */
223
+ global $bp;
224
+ if (isset($bp->loggedin_user->id) && is_numeric($bp->loggedin_user->id) && class_exists('BP_Group_Extension')) {
225
+ return groups_is_user_member($bp->loggedin_user->id, bp_get_current_group_id());
226
+ } else {
227
+ return false;
228
+ }
229
+
230
+ return true;
231
+ }
232
+
233
+ /**
234
+ * Adds the Media Settings menu for groups in the admin bar
235
+ *
236
+ * @uses global $bp,$wp_admin_bar
237
+ *
238
+ * @since BuddyPress Media 2.3
239
+ */
240
+
241
+ /**
242
+ *
243
+ * @global type $wp_admin_bar
244
+ * @global type $bp
245
+ */
246
+ function admin_bar() {
247
+ global $wp_admin_bar, $bp;
248
+ $wp_admin_bar->add_menu(array(
249
+ 'parent' => $bp->group_admin_menu_id,
250
+ 'id' => 'bp-media-group',
251
+ 'title' => __('Media Settings', BP_MEDIA_TXT_DOMAIN),
252
+ 'href' => bp_get_groups_action_link('admin/media')
253
+ ));
254
+ }
255
+
256
+ //add_action('admin_bar_menu','admin_bar',99);
257
+ /* This will need some handling for checking if its a single group page or not, also whether the person can
258
+ * edit media settings or not
259
+ */
260
+
261
+ /**
262
+ * Checks whether a user can create an album in the given group or not
263
+ *
264
+ * @param string $group_id The group id to check against
265
+ * @param string $user_id The user to be checked for permission
266
+ *
267
+ * @return boolean True if the user can create an album in the group, false if not
268
+ */
269
+
270
+ /**
271
+ *
272
+ * @param type $group_id
273
+ * @param type $user_id
274
+ * @return boolean
275
+ */
276
+ static function user_can_create_album($group_id, $user_id = 0) {
277
+ if ($user_id == 0)
278
+ $user_id = get_current_user_id();
279
+ $current_level = groups_get_groupmeta($group_id, 'bp_media_group_control_level');
280
+ switch ($current_level) {
281
+ case 'all':
282
+ return groups_is_user_member($user_id, $group_id) || groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id);
283
+ break;
284
+ case 'moderators':
285
+ return groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id);
286
+ break;
287
+ case 'admin':
288
+ return groups_is_user_admin($user_id, $group_id);
289
+ break;
290
+ default :
291
+ return groups_is_user_admin($user_id, $group_id);
292
+ }
293
+ return false;
294
+ }
295
+
296
+ /**
297
+ *
298
+ * @param type $errorMessage
299
+ */
300
+ static function bp_media_display_error($errorMessage) {
301
+ ?>
302
+ <div id="message" class="error">
303
+ <p>
304
+ <?php _e($errorMessage, BP_MEDIA_TXT_DOMAIN); ?>
305
+ </p>
306
+ </div>
307
+ <?php
308
+ }
309
+
310
+ }
311
+
312
+
app/main/BPMediaLoader.php CHANGED
@@ -1,9 +1,15 @@
1
  <?php
 
 
 
 
 
2
 
3
  /**
4
  * BuddyPress Media Loader
5
- *
6
- * Hooks BuddyPress Media properly into BuddyPress, so we can load BuddyPress Media
 
7
  *
8
  * @package BuddyPressMedia
9
  * @subpackage Main
@@ -13,122 +19,158 @@
13
  */
14
  class BPMediaLoader {
15
 
16
- /**
17
- * Hooks into BuddyPress
18
- *
19
- * Hooks into bp_loaded to load itself
20
- * Hooks into bp_setup_nav to add tabs to the profile and group navigation
21
- * Hooks into after_setup_theme to add its thumbnail sizes
22
- *
23
- * @uses bp_loaded
24
- * @uses bp_setup_nav
25
- * @uses after_setup_theme
26
- */
27
- public function __construct() {
28
- add_action('bp_loaded', array($this, 'load_component'));
29
- add_action('bp_setup_nav', array($this, 'custom_nav'), 999);
30
- add_action('after_setup_theme', array($this, 'thumbnail'));
31
- }
 
 
 
 
 
 
 
 
 
32
 
33
- /**
34
- * BuddyPress Media Loader
35
- *
36
- * Loads and adds it to the BuddyPress global object
37
- *
38
- * @global object $bp BuddyPress object
39
- */
40
 
41
- /**
42
- *
43
- * @global object $bp
44
- */
45
- public function load_component() {
46
- global $bp;
47
- $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
48
- }
49
 
50
- /**
51
- * Navigation Loader
52
- *
53
- * Loads BuddyPress Media's navigation
54
- *
55
- * @global object $bp BuddyPress object
56
- */
 
57
 
58
- /**
59
- *
60
- * @global object $bp
61
- */
62
- public function custom_nav() {
63
- global $bp;
64
- foreach ($bp->bp_nav as $key => $nav_item) {
65
- switch ($nav_item['slug']) {
66
- case BP_MEDIA_IMAGES_SLUG:
67
- case BP_MEDIA_VIDEOS_SLUG:
68
- case BP_MEDIA_AUDIO_SLUG:
69
- case BP_MEDIA_ALBUMS_SLUG:
70
- $bp->bp_options_nav[BP_MEDIA_SLUG][] = array(
71
- 'name' => $nav_item['name'],
72
- 'link' => (isset($bp->displayed_user->domain) ? $bp->displayed_user->domain : (isset($bp->loggedin_user->domain) ? $bp->loggedin_user->domain : '')) . $nav_item['slug'] . '/',
73
- 'slug' => $nav_item['slug'],
74
- 'css_id' => $nav_item['css_id'],
75
- 'position' => $nav_item['position'],
76
- 'screen_function' => $nav_item['screen_function'],
77
- 'user_has_access' => true,
78
- 'parent_url' => trailingslashit(bp_displayed_user_domain())
79
- );
80
- unset($bp->bp_nav[$key]);
81
- break;
82
- case BP_MEDIA_UPLOAD_SLUG:
83
- $bp->bp_options_nav[BP_MEDIA_SLUG][] = array(
84
- 'name' => $nav_item['name'],
85
- 'link' => (isset($bp->displayed_user->domain) ? $bp->displayed_user->domain : (isset($bp->loggedin_user->domain) ? $bp->loggedin_user->domain : '')) . $nav_item['slug'] . '/',
86
- 'slug' => $nav_item['slug'],
87
- 'css_id' => $nav_item['css_id'],
88
- 'position' => $nav_item['position'],
89
- 'screen_function' => $nav_item['screen_function'],
90
- 'user_has_access' => bp_is_my_profile(),
91
- 'parent_url' => trailingslashit(bp_displayed_user_domain())
92
- );
93
- unset($bp->bp_nav[$key]);
94
- }
95
- switch ($bp->current_component) {
96
- case BP_MEDIA_IMAGES_SLUG:
97
- case BP_MEDIA_VIDEOS_SLUG:
98
- case BP_MEDIA_AUDIO_SLUG:
99
- case BP_MEDIA_ALBUMS_SLUG:
100
- case BP_MEDIA_UPLOAD_SLUG:
101
- $count = count($bp->action_variables);
102
- for ($i = $count; $i > 0; $i--) {
103
- $bp->action_variables[$i] = $bp->action_variables[$i - 1];
104
- }
105
- $bp->action_variables[0] = $bp->current_action;
106
- $bp->current_action = $bp->current_component;
107
- $bp->current_component = BP_MEDIA_SLUG;
108
- }
109
- }
110
- }
111
 
112
- /**
113
- * Custom Thumbnail Sizes
114
- *
115
- * Adds image sizes required by the plugin to existing WordPress sizes
116
- *
117
- * @global object $bp_media
118
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
- /**
121
- *
122
- * @global type $bp_media
123
- */
124
- public function thumbnail() {
125
- global $bp_media;
 
 
126
 
127
- $default_sizes = $bp_media->media_sizes();
128
 
129
- add_image_size('bp_media_activity_image', $default_sizes['activity_image']['width'], $default_sizes['activity_image']['height'], true);
130
- add_image_size('bp_media_single_image', $default_sizes['single_image']['width'], $default_sizes['single_image']['height'], true);
131
- }
 
 
 
 
 
 
 
 
 
 
132
 
133
  }
134
 
1
  <?php
2
+ /**
3
+ * Don't load this file directly!
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) )
6
+ exit;
7
 
8
  /**
9
  * BuddyPress Media Loader
10
+ *
11
+ * Hook into BuddyPress, so we can load BuddyPress Media.
12
+ * Called by BuddyPressMedia on intialisation.
13
  *
14
  * @package BuddyPressMedia
15
  * @subpackage Main
19
  */
20
  class BPMediaLoader {
21
 
22
+ /**
23
+ * Initialises BuddyPress Media's functionality. Hooks into BuddyPress
24
+ *
25
+ * Hooks into bp_loaded to load itself
26
+ * Hooks into bp_setup_nav to add tabs to the profile and group navigation
27
+ * Hooks into after_setup_theme to add its thumbnail sizes
28
+ *
29
+ * @uses bp_loaded
30
+ * @uses bp_setup_nav
31
+ * @uses after_setup_theme
32
+ * @global object $bp_media
33
+ */
34
+ public function __construct() {
35
+ global $bp_media;
36
+ //$options = $bp_media->options;
37
+
38
+ add_action( 'bp_loaded', array( $this, 'load_component' ) );
39
+ add_action( 'bp_setup_nav', array( $this, 'custom_nav' ), 999 );
40
+ //if ( array_key_exists( 'enable_on_profile', $options ) ) {
41
+ // if ( $options[ 'enable_on_profile' ] ) {
42
+ // This is where the add actions should move
43
+ // after some refactoring,
44
+ // so it is loaded on profiles, only when the admin specifies
45
+ // }
46
+ //}
47
 
48
+ add_action( 'after_setup_theme', array( $this, 'thumbnail' ) );
49
+ }
 
 
 
 
 
50
 
51
+ /**
52
+ * Load the BPMedia Component as an component of BuddyPress
53
+ * Add it to the BuddyPress global object
54
+ *
55
+ * @global object $bp BuddyPress object
56
+ */
 
 
57
 
58
+ /**
59
+ *
60
+ * @global object $bp
61
+ */
62
+ public function load_component() {
63
+ global $bp;
64
+ $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
65
+ }
66
 
67
+ /**
68
+ * Navigation Loader
69
+ *
70
+ * Loads BuddyPress Media's navigation
71
+ *
72
+ * @global object $bp BuddyPress object
73
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ public function custom_nav() {
76
+ global $bp;
77
+ foreach ( $bp->bp_nav as $key => $nav_item ) {
78
+ switch ( $nav_item[ 'slug' ] ) {
79
+ case BP_MEDIA_IMAGES_SLUG:
80
+ case BP_MEDIA_VIDEOS_SLUG:
81
+ case BP_MEDIA_AUDIO_SLUG:
82
+ case BP_MEDIA_ALBUMS_SLUG:
83
+ $bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
84
+ 'name' => $nav_item[ 'name' ],
85
+ 'link' => (
86
+ isset( $bp->displayed_user->domain ) ?
87
+ $bp->displayed_user->domain
88
+ : (
89
+ isset( $bp->loggedin_user->domain ) ?
90
+ $bp->loggedin_user->domain
91
+ : ''
92
+ )
93
+ )
94
+ . $nav_item[ 'slug' ]
95
+ . '/',
96
+ 'slug' => $nav_item[ 'slug' ],
97
+ 'css_id' => $nav_item[ 'css_id' ],
98
+ 'position' => $nav_item[ 'position' ],
99
+ 'screen_function' => $nav_item[ 'screen_function' ],
100
+ 'user_has_access' => true,
101
+ 'parent_url' => trailingslashit(
102
+ bp_displayed_user_domain()
103
+ )
104
+ );
105
+ unset( $bp->bp_nav[ $key ] );
106
+ break;
107
+ case BP_MEDIA_UPLOAD_SLUG:
108
+ $bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
109
+ 'name' => $nav_item[ 'name' ],
110
+ 'link' => (
111
+ isset( $bp->displayed_user->domain ) ?
112
+ $bp->displayed_user->domain
113
+ : (
114
+ isset( $bp->loggedin_user->domain ) ?
115
+ $bp->loggedin_user->domain
116
+ : ''
117
+ )
118
+ )
119
+ . $nav_item[ 'slug' ]
120
+ . '/',
121
+ 'slug' => $nav_item[ 'slug' ],
122
+ 'css_id' => $nav_item[ 'css_id' ],
123
+ 'position' => $nav_item[ 'position' ],
124
+ 'screen_function' => $nav_item[ 'screen_function' ],
125
+ 'user_has_access' => bp_is_my_profile(),
126
+ 'parent_url' => trailingslashit(
127
+ bp_displayed_user_domain()
128
+ )
129
+ );
130
+ unset( $bp->bp_nav[ $key ] );
131
+ }
132
+ switch ( $bp->current_component ) {
133
+ case BP_MEDIA_IMAGES_SLUG:
134
+ case BP_MEDIA_VIDEOS_SLUG:
135
+ case BP_MEDIA_AUDIO_SLUG:
136
+ case BP_MEDIA_ALBUMS_SLUG:
137
+ case BP_MEDIA_UPLOAD_SLUG:
138
+ $count = count( $bp->action_variables );
139
+ for ( $i = $count; $i > 0; $i -- ) {
140
+ $bp->action_variables[ $i ]
141
+ = $bp->action_variables[ $i - 1 ];
142
+ }
143
+ $bp->action_variables[ 0 ] = $bp->current_action;
144
+ $bp->current_action = $bp->current_component;
145
+ $bp->current_component = BP_MEDIA_SLUG;
146
+ }
147
+ }
148
+ }
149
 
150
+ /**
151
+ * Add image sizes required by the plugin to existing WordPress sizes.
152
+ * This can be filtered
153
+ *
154
+ * @global object $bp_media
155
+ */
156
+ public function thumbnail() {
157
+ global $bp_media;
158
 
159
+ $default_sizes = $bp_media->media_sizes();
160
 
161
+ add_image_size(
162
+ 'bp_media_activity_image',
163
+ $default_sizes[ 'activity_image' ][ 'width' ],
164
+ $default_sizes[ 'activity_image' ][ 'height' ],
165
+ true
166
+ );
167
+ add_image_size(
168
+ 'bp_media_single_image',
169
+ $default_sizes[ 'single_image' ][ 'width' ],
170
+ $default_sizes[ 'single_image' ][ 'height' ],
171
+ true
172
+ );
173
+ }
174
 
175
  }
176
 
app/main/BuddyPressMedia.php CHANGED
@@ -1,5 +1,11 @@
1
  <?php
2
 
 
 
 
 
 
 
3
  /**
4
  * BuddyPress Media
5
  *
@@ -12,341 +18,631 @@
12
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
13
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
14
  */
15
- if (!defined('ABSPATH'))
16
- exit;
17
-
18
  class BuddyPressMedia {
19
 
20
- public $text_domain = 'buddypress-media';
21
- public $options;
22
- public $support_email = 'support@rtcamp.com';
23
- public $support_url = 'http://rtcamp.com/support/forum/buddypress-media/';
24
- public $query;
25
- public $albums_query;
26
- public $count = null;
27
- public $posts_per_page = 10;
28
- public $activity_types = array(
29
- 'media_upload',
30
- 'album_updated',
31
- 'album_created'
32
- );
33
- public $hidden_activity_cache = array();
34
- public $loader;
35
- public $group_loader;
36
-
37
- public function __construct() {
38
- $this->constants();
39
- $this->excerpt_lengths();
40
- add_action('admin_notices', array($this, 'bp_exists'));
41
- /**
42
- * Activating the plugin!
43
- */
44
- register_activation_hook(__FILE__, array($this, 'activate'));
45
-
46
- /**
47
- * And hooking it to BuddyPress
48
- */
49
- add_action('bp_include', array($this, 'init'));
50
- add_action('widgets_init', array($this, 'widgets_init'), 1);
51
- add_action('plugins_loaded', array($this, 'load_translation'));
52
- global $bp_media_counter;
53
- $bp_media_counter = 0;
54
- }
55
-
56
- public function bp_exists() {
57
- if (!class_exists('BuddyPress')) {
58
- echo '<div class="error">
59
- <p><strong>' . __('BuddyPress is not installed.', $this->text_domain) . '</strong></p>
60
- <p>' . sprintf(__('To use BuddyPress Media, <a href="%s" target="_blank">BuddyPress</a> must be installed first.', $this->text_domain), 'http://wordpress.org/extend/plugins/buddypress/') . '</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </div>';
62
- }
63
- }
64
-
65
- public function get_option() {
66
- $this->options = bp_get_option('bp_media_options');
67
- }
68
-
69
- public function constants() {
70
- /* Text domain */
71
- if (!defined('BP_MEDIA_TXT_DOMAIN'))
72
- define('BP_MEDIA_TXT_DOMAIN', $this->text_domain);
73
-
74
- /* If the plugin is installed. */
75
- if (!defined('BP_MEDIA_IS_INSTALLED'))
76
- define('BP_MEDIA_IS_INSTALLED', 1);
77
-
78
- /* Current Version. */
79
- if (!defined('BP_MEDIA_VERSION'))
80
- define('BP_MEDIA_VERSION', '2.4');
81
-
82
- /* Required Version */
83
- if (!defined('BP_MEDIA_REQUIRED_BP'))
84
- define('BP_MEDIA_REQUIRED_BP', '1.6.2');
85
-
86
- /* Database Version */
87
- if (!defined('BP_MEDIA_DB_VERSION'))
88
- define('BP_MEDIA_DB_VERSION', '2.1');
89
-
90
- /**
91
- /* A constant to Active Collab API Assignee ID
92
- if ( ! defined( 'BP_MEDIA_AC_API_ASSIGNEE_ID' ) )
93
- define( 'BP_MEDIA_AC_API_ASSIGNEE_ID', '5' );
94
-
95
- /* A constant to Active Collab API Assignee ID
96
- if ( ! defined( 'BP_MEDIA_AC_API_LABEL_ID' ) )
97
- define( 'BP_MEDIA_AC_API_LABEL_ID', '1' );
98
-
99
- /* A constant to Active Collab API priority
100
- if ( ! defined( 'BP_MEDIA_AC_API_PRIORITY' ) )
101
- define( 'BP_MEDIA_AC_API_PRIORITY', '2' );
102
-
103
- /* A constant to Active Collab API priority
104
- if ( ! defined( 'BP_MEDIA_AC_API_CATEGORY_ID' ) )
105
- define( 'BP_MEDIA_AC_API_CATEGORY_ID', '224' );
106
- */
107
- /* Slug Constants */
108
- if (!defined('BP_MEDIA_SLUG'))
109
- define('BP_MEDIA_SLUG', 'media');
110
 
111
- if (!defined('BP_MEDIA_UPLOAD_SLUG'))
112
- define('BP_MEDIA_UPLOAD_SLUG', 'upload');
 
 
 
 
 
 
113
 
114
- if (!defined('BP_MEDIA_DELETE_SLUG'))
115
- define('BP_MEDIA_DELETE_SLUG', 'delete');
 
116
 
117
- if (!defined('BP_MEDIA_IMAGES_SLUG'))
118
- define('BP_MEDIA_IMAGES_SLUG', 'photos');
 
119
 
120
- if (!defined('BP_MEDIA_IMAGES_ENTRY_SLUG'))
121
- define('BP_MEDIA_IMAGES_ENTRY_SLUG', 'view');
 
122
 
123
- if (!defined('BP_MEDIA_IMAGES_EDIT_SLUG'))
124
- define('BP_MEDIA_IMAGES_EDIT_SLUG', 'edit');
 
125
 
126
- if (!defined('BP_MEDIA_VIDEOS_SLUG'))
127
- define('BP_MEDIA_VIDEOS_SLUG', 'videos');
128
 
129
- if (!defined('BP_MEDIA_VIDEOS_ENTRY_SLUG'))
130
- define('BP_MEDIA_VIDEOS_ENTRY_SLUG', 'watch');
 
131
 
132
- if (!defined('BP_MEDIA_VIDEOS_EDIT_SLUG'))
133
- define('BP_MEDIA_VIDEOS_EDIT_SLUG', 'edit');
 
134
 
135
- if (!defined('BP_MEDIA_AUDIO_SLUG'))
136
- define('BP_MEDIA_AUDIO_SLUG', 'music');
 
137
 
138
- if (!defined('BP_MEDIA_AUDIO_ENTRY_SLUG'))
139
- define('BP_MEDIA_AUDIO_ENTRY_SLUG', 'listen');
 
140
 
141
- if (!defined('BP_MEDIA_AUDIO_EDIT_SLUG'))
142
- define('BP_MEDIA_AUDIO_EDIT_SLUG', 'edit');
143
-
144
- if (!defined('BP_MEDIA_ALBUMS_SLUG'))
145
- define('BP_MEDIA_ALBUMS_SLUG', 'albums');
146
-
147
- if (!defined('BP_MEDIA_ALBUMS_ENTRY_SLUG'))
148
- define('BP_MEDIA_ALBUMS_ENTRY_SLUG', 'list');
149
-
150
- if (!defined('BP_MEDIA_ALBUMS_EDIT_SLUG'))
151
- define('BP_MEDIA_ALBUMS_EDIT_SLUG', 'edit');
152
-
153
- /* Labels loaded via text domain, can be translated */
154
- if (!defined('BP_MEDIA_LABEL'))
155
- define('BP_MEDIA_LABEL', __('Media', $this->text_domain));
156
-
157
- if (!defined('BP_MEDIA_LABEL_SINGULAR'))
158
- define('BP_MEDIA_LABEL_SINGULAR', __('Media', $this->text_domain));
159
-
160
- if (!defined('BP_MEDIA_IMAGES_LABEL'))
161
- define('BP_MEDIA_IMAGES_LABEL', __('Photos', $this->text_domain));
162
-
163
- if (!defined('BP_MEDIA_IMAGES_LABEL_SINGULAR'))
164
- define('BP_MEDIA_IMAGES_LABEL_SINGULAR', __('Photo', $this->text_domain));
165
-
166
- if (!defined('BP_MEDIA_VIDEOS_LABEL'))
167
- define('BP_MEDIA_VIDEOS_LABEL', __('Videos', $this->text_domain));
168
-
169
- if (!defined('BP_MEDIA_VIDEOS_LABEL_SINGULAR'))
170
- define('BP_MEDIA_VIDEOS_LABEL_SINGULAR', __('Video', $this->text_domain));
171
-
172
- if (!defined('BP_MEDIA_AUDIO_LABEL'))
173
- define('BP_MEDIA_AUDIO_LABEL', __('Music', $this->text_domain));
174
-
175
- if (!defined('BP_MEDIA_AUDIO_LABEL_SINGULAR'))
176
- define('BP_MEDIA_AUDIO_LABEL_SINGULAR', __('Music', $this->text_domain));
177
-
178
- if (!defined('BP_MEDIA_ALBUMS_LABEL'))
179
- define('BP_MEDIA_ALBUMS_LABEL', __('Albums', $this->text_domain));
180
-
181
- if (!defined('BP_MEDIA_ALBUMS_LABEL_SINGULAR'))
182
- define('BP_MEDIA_ALBUMS_LABEL_SINGULAR', __('Album', $this->text_domain));
183
-
184
- if (!defined('BP_MEDIAUPLOAD_LABEL'))
185
- define('BP_MEDIA_UPLOAD_LABEL', __('Upload', $this->text_domain));
186
-
187
- if (!defined('BP_MEDIA_TMP_DIR'))
188
- define('BP_MEDIA_TMP_DIR', WP_CONTENT_DIR . '/bp-media-temp');
189
-
190
- if (!defined('BP_MEDIA_SUPPORT_EMAIL'))
191
- define('BP_MEDIA_SUPPORT_EMAIL', $this->support_email);
192
- }
193
-
194
- /**
195
- *
196
- * @global BPMediaAdmin $bp_media_admin
197
- */
198
- function init() {
199
- $this->get_option();
200
-
201
- if (defined('BP_VERSION') && version_compare(BP_VERSION, BP_MEDIA_REQUIRED_BP, '>=')) {
202
- add_filter('plugin_action_links', array($this, 'settings_link'), 10, 2);
203
- $this->loader = new BPMediaLoader();
204
- $this->group_loader = new BPMediaGroup();
205
- new BPMediaFilters();
206
- new BPMediaActions();
207
- new BPMediaFunction();
208
- }
209
-
210
-
211
- add_action('admin_notices', array($this, 'admin_notice'));
212
- global $bp_media_admin;
213
- $bp_media_admin = new BPMediaAdmin();
214
- }
215
-
216
- static function load_translation() {
217
- load_plugin_textdomain(BP_MEDIA_TXT_DOMAIN, false, basename(BP_MEDIA_PATH) . '/languages/');
218
- }
219
-
220
- /**
221
- *
222
- * @param type $links
223
- * @param type $file
224
- * @return type
225
- */
226
- function settings_link($links, $file) {
227
- /* create link */
228
- $plugin_name = plugin_basename(BP_MEDIA_PATH . 'index.php');
229
- $admin_link = $this->get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php'));
230
- if ($file == $plugin_name) {
231
- array_unshift(
232
- $links, sprintf('<a href="%s">%s</a>', $admin_link, __('Settings', $this->text_domain))
233
- );
234
- }
235
- return $links;
236
- }
237
-
238
- /**
239
- *
240
- * @return type
241
- */
242
- function media_sizes() {
243
- $def_sizes = array(
244
- 'activity_image' => array(
245
- 'width' => 320,
246
- 'height' => 240
247
- ),
248
- 'activity_video' => array(
249
- 'width' => 320,
250
- 'height' => 240
251
- ),
252
- 'activity_audio' => array(
253
- 'width' => 320,
254
- ),
255
- 'single_image' => array(
256
- 'width' => 800,
257
- 'height' => 0
258
- ),
259
- 'single_video' => array(
260
- 'width' => 640,
261
- 'height' => 480
262
- ),
263
- 'single_audio' => array(
264
- 'width' => 640,
265
- ),
266
- );
267
-
268
- return apply_filters('bpm_media_sizes', $def_sizes);
269
- }
270
-
271
- /**
272
- *
273
- * @global type $bp_media_default_excerpts
274
- */
275
- function excerpt_lengths() {
276
- global $bp_media_default_excerpts;
277
- $def_excerpt = array(
278
- 'single_entry_title' => 100,
279
- 'single_entry_description' => 500,
280
- 'activity_entry_title' => 50,
281
- 'activity_entry_description' => 500
282
- );
283
-
284
- $bp_media_default_excerpts = apply_filters('bpm_excerpt_lengths', $def_excerpt);
285
- }
286
-
287
- /**
288
- *
289
- * @global type $current_user
290
- */
291
- public function admin_notice() {
292
- global $current_user;
293
- $user_id = $current_user->ID;
294
- if (isset($_GET['bp_media_nag_ignore']) && '0' == $_GET['bp_media_nag_ignore']) {
295
- add_user_meta($user_id, 'bp_media_ignore_notice', 'true', true);
296
- }
297
- /* Check that the user hasn't already clicked to ignore the message */
298
- if (!get_user_meta($user_id, 'bp_media_ignore_notice')) {
299
- if (defined('BP_VERSION')) {
300
- if (version_compare(BP_VERSION, BP_MEDIA_REQUIRED_BP, '<')) {
301
- echo '<div class="error"><p>';
302
- printf(__('The BuddyPress version installed is an older version and is not supported, please update BuddyPress to use BuddyPress Media Plugin.<a class="alignright" href="%1$s">X</a>', $this->text_domain), '?bp_media_nag_ignore=0');
303
- echo "</p></div>";
304
- }
305
- } else {
306
- echo '<div class="error"><p>';
307
- printf(__('You have not installed BuddyPress. Please install latest version of BuddyPress to use BuddyPress Media plugin.<a class="alignright" href="%1$s">X</a>', $this->text_domain), '?bp_media_nag_ignore=0');
308
- echo "</p></div>";
309
- }
310
- }
311
- }
312
-
313
- public function activate() {
314
- $bpmquery = new WP_Query(array('post_type' => 'bp_media', 'posts_per_page' => 1));
315
- if ($bpmquery->found_posts > 0) {
316
- update_site_option('bp_media_db_version', '1.0');
317
- } else {
318
- switch (get_site_option('bp_media_db_version', false, false)) {
319
- case '2.0':
320
- break;
321
- default:
322
- update_site_option('bp_media_db_version', BP_MEDIA_DB_VERSION);
323
- }
324
- }
325
- }
326
-
327
- /**
328
- *
329
- * @param type $path
330
- * @param type $scheme
331
- * @return type
332
- */
333
- function get_admin_url($path = '', $scheme = 'admin') {
334
-
335
- // Links belong in network admin
336
- if (is_multisite())
337
- $url = network_admin_url($path, $scheme);
338
-
339
- // Links belong in site admin
340
- else
341
- $url = admin_url($path, $scheme);
342
-
343
- return $url;
344
- }
345
-
346
- function widgets_init() {
347
- register_widget('BPMediaWidget');
348
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
  }
351
 
 
 
 
 
 
 
 
 
 
 
 
352
  ?>
1
  <?php
2
 
3
+ /**
4
+ * Don't load this file directly!
5
+ */
6
+ if ( ! defined( 'ABSPATH' ) )
7
+ exit;
8
+
9
  /**
10
  * BuddyPress Media
11
  *
18
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
19
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
20
  */
 
 
 
21
  class BuddyPressMedia {
22
 
23
+ /**
24
+ *
25
+ * @var string The text domain for loading translations
26
+ */
27
+ public $text_domain = 'buddypress-media';
28
+
29
+ /**
30
+ *
31
+ * @var array BuddyPress Media settings
32
+ */
33
+ public $options = array( );
34
+
35
+ /**
36
+ *
37
+ * @var string Email address the admin support form should send to
38
+ */
39
+ public $support_email = 'support@rtcamp.com';
40
+
41
+ /**
42
+ *
43
+ * @var string Support forum url
44
+ */
45
+ public $support_url = 'http://rtcamp.com/support/forum/buddypress-media/';
46
+
47
+ /**
48
+ *
49
+ * @var object/array The query that fetches media (photos, video and audio)
50
+ */
51
+ public $query;
52
+
53
+ /**
54
+ *
55
+ * @var object/array The query that fetches albums
56
+ */
57
+ public $albums_query;
58
+
59
+ /**
60
+ *
61
+ * @var int Count
62
+ */
63
+ public $count = null;
64
+
65
+ /**
66
+ *
67
+ * @var int Number of media items to show in one view.
68
+ */
69
+ public $posts_per_page = 10;
70
+
71
+ /**
72
+ *
73
+ * @var array The types of activity BuddyPress Media creates
74
+ */
75
+ public $activity_types = array(
76
+ 'media_upload',
77
+ 'album_updated',
78
+ 'album_created'
79
+ );
80
+
81
+ /**
82
+ *
83
+ * @var array A cache for activities that are hidden by BuddyPress Media
84
+ */
85
+ public $hidden_activity_cache = array( );
86
+
87
+ /**
88
+ *
89
+ * @var type
90
+ */
91
+ public $loader;
92
+
93
+ /**
94
+ *
95
+ * @var type
96
+ */
97
+ public $group_loader;
98
+
99
+ /**
100
+ * Constructs the class
101
+ * Defines constants and excerpt lengths, initiates admin notices,
102
+ * loads and initiates the plugin, loads translations.
103
+ * Initialises media counter
104
+ *
105
+ * @global int $bp_media_counter Media counter
106
+ */
107
+ public function __construct() {
108
+ /**
109
+ * Define constants
110
+ */
111
+ $this->constants();
112
+ /**
113
+ * Define excerpt lengths
114
+ */
115
+ $this->excerpt_lengths();
116
+ /**
117
+ * Add admin notice for BuddyPress dependance
118
+ */
119
+ add_action( 'admin_notices', array( $this, 'bp_exists' ) );
120
+ /**
121
+ * Activate the plugin!
122
+ */
123
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
124
+
125
+ /**
126
+ * Hook it to BuddyPress
127
+ */
128
+ add_action( 'bp_include', array( $this, 'init' ) );
129
+ /**
130
+ * Add the widget
131
+ */
132
+ add_action( 'widgets_init', array( $this, 'widgets_init' ), 1 );
133
+ /**
134
+ * Load translations
135
+ */
136
+ add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
137
+ /**
138
+ * Initialise media counter
139
+ */
140
+ global $bp_media_counter;
141
+ $bp_media_counter = 0;
142
+ }
143
+
144
+ /**
145
+ * Checks if BuddyPress is installed!
146
+ */
147
+ public function bp_exists() {
148
+ if ( ! class_exists( 'BuddyPress' ) ) {
149
+ echo '<div class="error">
150
+ <p><strong>' . __(
151
+ 'BuddyPress is not installed.', $this->text_domain
152
+ )
153
+ . '</strong></p>
154
+ <p>'
155
+ . sprintf(
156
+ __(
157
+ 'To use BuddyPress Media,
158
+ <a href="%s" target="_blank">BuddyPress</a>
159
+ must be installed first.', $this->text_domain
160
+ ), 'http://wordpress.org/extend/plugins/buddypress/'
161
+ )
162
+ . '</p>
163
  </div>';
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Populates $options with saved settings
169
+ */
170
+ public function get_option() {
171
+ $options = bp_get_option( 'bp_media_options', false );
172
+ if ( !$options ) {
173
+ $options = array(
174
+ 'enable_on_group' => 1,
175
+ 'videos_enabled' => 1,
176
+ 'audio_enabled' => 1,
177
+ 'images_enabled' => 1,
178
+ 'download_enabled' => 1,
179
+ 'show_admin_menu' => 1
180
+ );
181
+ bp_update_option( 'bp_media_options', $options );
182
+ }
183
+ $this->options = $options;
184
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
+ /**
187
+ * Defines all the constants if undefined. Can be overridden by
188
+ * defining them elsewhere, say wp-config.php
189
+ */
190
+ public function constants() {
191
+ /* Text domain */
192
+ if ( ! defined( 'BP_MEDIA_TXT_DOMAIN' ) )
193
+ define( 'BP_MEDIA_TXT_DOMAIN', $this->text_domain );
194
 
195
+ /* If the plugin is installed. */
196
+ if ( ! defined( 'BP_MEDIA_IS_INSTALLED' ) )
197
+ define( 'BP_MEDIA_IS_INSTALLED', 1 );
198
 
199
+ /* Current Version. */
200
+ if ( ! defined( 'BP_MEDIA_VERSION' ) )
201
+ define( 'BP_MEDIA_VERSION', '2.4' );
202
 
203
+ /* Required Version */
204
+ if ( ! defined( 'BP_MEDIA_REQUIRED_BP' ) )
205
+ define( 'BP_MEDIA_REQUIRED_BP', '1.6.2' );
206
 
207
+ /* Database Version */
208
+ if ( ! defined( 'BP_MEDIA_DB_VERSION' ) )
209
+ define( 'BP_MEDIA_DB_VERSION', '2.1' );
210
 
211
+ /* Slug Constants for building urls */
 
212
 
213
+ /* Media slug */
214
+ if ( ! defined( 'BP_MEDIA_SLUG' ) )
215
+ define( 'BP_MEDIA_SLUG', 'media' );
216
 
217
+ /* Upload slug */
218
+ if ( ! defined( 'BP_MEDIA_UPLOAD_SLUG' ) )
219
+ define( 'BP_MEDIA_UPLOAD_SLUG', 'upload' );
220
 
221
+ /* Delete slug */
222
+ if ( ! defined( 'BP_MEDIA_DELETE_SLUG' ) )
223
+ define( 'BP_MEDIA_DELETE_SLUG', 'delete' );
224
 
225
+ /* Photos slug */
226
+ if ( ! defined( 'BP_MEDIA_IMAGES_SLUG' ) )
227
+ define( 'BP_MEDIA_IMAGES_SLUG', 'photos' );
228
 
229
+ if ( ! defined( 'BP_MEDIA_IMAGES_ENTRY_SLUG' ) )
230
+ define( 'BP_MEDIA_IMAGES_ENTRY_SLUG', 'view' );
231
+
232
+ if ( ! defined( 'BP_MEDIA_IMAGES_EDIT_SLUG' ) )
233
+ define( 'BP_MEDIA_IMAGES_EDIT_SLUG', 'edit' );
234
+
235
+ /* Videos slug */
236
+ if ( ! defined( 'BP_MEDIA_VIDEOS_SLUG' ) )
237
+ define( 'BP_MEDIA_VIDEOS_SLUG', 'videos' );
238
+
239
+ if ( ! defined( 'BP_MEDIA_VIDEOS_ENTRY_SLUG' ) )
240
+ define( 'BP_MEDIA_VIDEOS_ENTRY_SLUG', 'watch' );
241
+
242
+ if ( ! defined( 'BP_MEDIA_VIDEOS_EDIT_SLUG' ) )
243
+ define( 'BP_MEDIA_VIDEOS_EDIT_SLUG', 'edit' );
244
+
245
+ /* Audio slug */
246
+ if ( ! defined( 'BP_MEDIA_AUDIO_SLUG' ) )
247
+ define( 'BP_MEDIA_AUDIO_SLUG', 'music' );
248
+
249
+ if ( ! defined( 'BP_MEDIA_AUDIO_ENTRY_SLUG' ) )
250
+ define( 'BP_MEDIA_AUDIO_ENTRY_SLUG', 'listen' );
251
+
252
+ if ( ! defined( 'BP_MEDIA_AUDIO_EDIT_SLUG' ) )
253
+ define( 'BP_MEDIA_AUDIO_EDIT_SLUG', 'edit' );
254
+
255
+ /* Albums slug */
256
+ if ( ! defined( 'BP_MEDIA_ALBUMS_SLUG' ) )
257
+ define( 'BP_MEDIA_ALBUMS_SLUG', 'albums' );
258
+
259
+ if ( ! defined( 'BP_MEDIA_ALBUMS_ENTRY_SLUG' ) )
260
+ define( 'BP_MEDIA_ALBUMS_ENTRY_SLUG', 'list' );
261
+
262
+ if ( ! defined( 'BP_MEDIA_ALBUMS_EDIT_SLUG' ) )
263
+ define( 'BP_MEDIA_ALBUMS_EDIT_SLUG', 'edit' );
264
+
265
+ /* UI Labels loaded via text domain, can be translated */
266
+ if ( ! defined( 'BP_MEDIA_LABEL' ) )
267
+ define( 'BP_MEDIA_LABEL', __( 'Media',
268
+ $this->text_domain ) );
269
+
270
+ if ( ! defined( 'BP_MEDIA_LABEL_SINGULAR' ) )
271
+ define( 'BP_MEDIA_LABEL_SINGULAR', __( 'Media',
272
+ $this->text_domain ) );
273
+
274
+ if ( ! defined( 'BP_MEDIA_IMAGES_LABEL' ) )
275
+ define( 'BP_MEDIA_IMAGES_LABEL', __( 'Photos', $this->text_domain ) );
276
+
277
+ if ( ! defined( 'BP_MEDIA_IMAGES_LABEL_SINGULAR' ) )
278
+ define( 'BP_MEDIA_IMAGES_LABEL_SINGULAR', __( 'Photo', $this->text_domain ) );
279
+
280
+ if ( ! defined( 'BP_MEDIA_VIDEOS_LABEL' ) )
281
+ define( 'BP_MEDIA_VIDEOS_LABEL', __( 'Videos', $this->text_domain ) );
282
+
283
+ if ( ! defined( 'BP_MEDIA_VIDEOS_LABEL_SINGULAR' ) )
284
+ define( 'BP_MEDIA_VIDEOS_LABEL_SINGULAR', __( 'Video', $this->text_domain ) );
285
+
286
+ if ( ! defined( 'BP_MEDIA_AUDIO_LABEL' ) )
287
+ define( 'BP_MEDIA_AUDIO_LABEL', __( 'Music', $this->text_domain ) );
288
+
289
+ if ( ! defined( 'BP_MEDIA_AUDIO_LABEL_SINGULAR' ) )
290
+ define( 'BP_MEDIA_AUDIO_LABEL_SINGULAR', __( 'Music', $this->text_domain ) );
291
+
292
+ if ( ! defined( 'BP_MEDIA_ALBUMS_LABEL' ) )
293
+ define( 'BP_MEDIA_ALBUMS_LABEL', __( 'Albums', $this->text_domain ) );
294
+
295
+ if ( ! defined( 'BP_MEDIA_ALBUMS_LABEL_SINGULAR' ) )
296
+ define( 'BP_MEDIA_ALBUMS_LABEL_SINGULAR', __( 'Album', $this->text_domain ) );
297
+
298
+ if ( ! defined( 'BP_MEDIAUPLOAD_LABEL' ) )
299
+ define( 'BP_MEDIA_UPLOAD_LABEL', __( 'Upload', $this->text_domain ) );
300
+
301
+ /* Support Email constant */
302
+ if ( ! defined( 'BP_MEDIA_SUPPORT_EMAIL' ) )
303
+ define( 'BP_MEDIA_SUPPORT_EMAIL', $this->support_email );
304
+ }
305
+
306
+ /**
307
+ * Hooks the plugin into BuddyPress via 'bp_include' action.
308
+ * Initialises the plugin's functionalities, options,
309
+ * loads media for Profiles and Groups.
310
+ * Creates Admin panels
311
+ * Loads accessory functions
312
+ *
313
+ * @global BPMediaAdmin $bp_media_admin
314
+ */
315
+ function init() {
316
+
317
+ /**
318
+ * Load options/settings
319
+ */
320
+ $this->get_option();
321
+
322
+ if ( defined( 'BP_VERSION' ) &&
323
+ version_compare( BP_VERSION, BP_MEDIA_REQUIRED_BP, '>=' ) ) {
324
+ /**
325
+ * Add a settings link to the Plugin list screen
326
+ */
327
+ add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 );
328
+ /**
329
+ * Load BuddyPress Media for profiles
330
+ */
331
+ $this->loader = new BPMediaLoader();
332
+ /**
333
+ * Load BuddyPress Media for groups
334
+ */
335
+ if ( array_key_exists( 'enable_on_group', $this->options ) ) {
336
+ if ( $this->options[ 'enable_on_group' ] ) {
337
+ $this->group_loader = new BPMediaGroupLoader();
338
+ }
339
+ }
340
+
341
+
342
+ /**
343
+ * Load accessory functions
344
+ */
345
+ // new BPMediaActivity();
346
+ new BPMediaFilters();
347
+ new BPMediaActions();
348
+ new BPMediaFunction();
349
+ }
350
+
351
+ /**
352
+ * Add admin notices
353
+ */
354
+ add_action( 'admin_notices', array( $this, 'admin_notice' ) );
355
+ /**
356
+ * Initialise Admin Panels
357
+ */
358
+ global $bp_media_admin;
359
+ $bp_media_admin = new BPMediaAdmin();
360
+ }
361
+
362
+ /**
363
+ * Loads translations
364
+ */
365
+ static function load_translation() {
366
+ load_plugin_textdomain( BP_MEDIA_TXT_DOMAIN, false, basename( BP_MEDIA_PATH ) . '/languages/' );
367
+ }
368
+
369
+ /**
370
+ * Add a settings link to the BuddyPress Media entry
371
+ * in the list of active plugins screen
372
+ *
373
+ * @param array $links
374
+ * @param string $file
375
+ * @return array
376
+ */
377
+ function settings_link( $links, $file ) {
378
+ /* create link */
379
+ $plugin_name = plugin_basename( BP_MEDIA_PATH . 'index.php' );
380
+ $admin_link = $this->get_admin_url(
381
+ add_query_arg(
382
+ array(
383
+ 'page' => 'bp-media-settings' ), 'admin.php'
384
+ )
385
+ );
386
+ if ( $file == $plugin_name ) {
387
+ array_unshift(
388
+ $links, sprintf(
389
+ '<a href="%s">%s</a>', $admin_link, __( 'Settings', $this->text_domain )
390
+ )
391
+ );
392
+ }
393
+ return $links;
394
+ }
395
+
396
+ /**
397
+ * Default media sizes
398
+ *
399
+ * @return array
400
+ */
401
+ function media_sizes() {
402
+ $def_sizes = array(
403
+ 'activity_image' => array(
404
+ 'width' => 320,
405
+ 'height' => 240
406
+ ),
407
+ 'activity_video' => array(
408
+ 'width' => 320,
409
+ 'height' => 240
410
+ ),
411
+ 'activity_audio' => array(
412
+ 'width' => 320,
413
+ ),
414
+ 'single_image' => array(
415
+ 'width' => 800,
416
+ 'height' => 0
417
+ ),
418
+ 'single_video' => array(
419
+ 'width' => 640,
420
+ 'height' => 480
421
+ ),
422
+ 'single_audio' => array(
423
+ 'width' => 640,
424
+ ),
425
+ );
426
+
427
+ /** Can be filtered by a theme or an extension/plugin */
428
+ return apply_filters( 'bpmedia_media_sizes', $def_sizes );
429
+ }
430
+
431
+ /**
432
+ * Defines default length of strings and excerpts displayed in activities
433
+ * and media tabs
434
+ *
435
+ * @global array $bp_media_default_excerpts
436
+ */
437
+ function excerpt_lengths() {
438
+ global $bp_media_default_excerpts;
439
+ $def_excerpt = array(
440
+ 'single_entry_title' => 100,
441
+ 'single_entry_description' => 500,
442
+ 'activity_entry_title' => 50,
443
+ 'activity_entry_description' => 500
444
+ );
445
+
446
+ $bp_media_default_excerpts = apply_filters(
447
+ 'bpmedia_excerpt_lengths', $def_excerpt
448
+ );
449
+ }
450
+
451
+ /**
452
+ * Admin notices for dependencies and compatibility
453
+ *
454
+ * @global object/array $current_user
455
+ */
456
+ public function admin_notice() {
457
+ global $current_user;
458
+ $user_id = $current_user->ID;
459
+ if ( isset( $_GET[ 'bp_media_nag_ignore' ] )
460
+ && '0' == $_GET[ 'bp_media_nag_ignore' ] ) {
461
+ add_user_meta( $user_id, 'bp_media_ignore_notice', 'true', true );
462
+ }
463
+ /* Check that the user hasn't already clicked to ignore the message */
464
+ if ( ! get_user_meta( $user_id, 'bp_media_ignore_notice' ) ) {
465
+ if ( defined( 'BP_VERSION' ) ) {
466
+ if ( version_compare( BP_VERSION, BP_MEDIA_REQUIRED_BP, '<' ) ) {
467
+ echo '<div class="error"><p>';
468
+ printf(
469
+ __(
470
+ 'The BuddyPress version installed is an
471
+ older version and is not supported,
472
+ please update BuddyPress to use
473
+ BuddyPress Media Plugin.
474
+ <a class="alignright" href="%1$s">X</a>', $this->text_domain
475
+ ), '?bp_media_nag_ignore=0'
476
+ );
477
+ echo "</p></div>";
478
+ }
479
+ } else {
480
+ echo '<div class="error"><p>';
481
+ printf(
482
+ __(
483
+ 'You have not installed BuddyPress.
484
+ Please install latest version of BuddyPress
485
+ to use BuddyPress Media plugin.
486
+ <a class="alignright" href="%1$s">X</a>', $this->text_domain
487
+ ), '?bp_media_nag_ignore=0'
488
+ );
489
+ echo "</p></div>";
490
+ }
491
+ }
492
+ }
493
+
494
+ /**
495
+ * Plugin activation, checks for old database and updates it.
496
+ *
497
+ */
498
+ public function activate() {
499
+ $bpmquery = new WP_Query(
500
+ array(
501
+ 'post_type' => 'bp_media',
502
+ 'posts_per_page' => 1
503
+ )
504
+ );
505
+ if ( $bpmquery->found_posts > 0 ) {
506
+ update_site_option( 'bp_media_db_version', '1.0' );
507
+ } else {
508
+ switch ( get_site_option( 'bp_media_db_version', false, false ) ) {
509
+ case '2.0':
510
+ break;
511
+ default:
512
+ update_site_option(
513
+ 'bp_media_db_version', BP_MEDIA_DB_VERSION
514
+ );
515
+ }
516
+ }
517
+ }
518
+
519
+ /**
520
+ * Provides the right admin url to work with
521
+ *
522
+ * @param string $path
523
+ * @param string $scheme
524
+ * @return string The proper admin url for single/multisite installs
525
+ */
526
+ function get_admin_url( $path = '', $scheme = 'admin' ) {
527
+
528
+ // Links belong in network admin
529
+ if ( is_multisite() )
530
+ $url = network_admin_url( $path, $scheme );
531
+
532
+ // Links belong in site admin
533
+ else
534
+ $url = admin_url( $path, $scheme );
535
+
536
+ return $url;
537
+ }
538
+
539
+ /**
540
+ * Registers and activates the BuddyPress Media Widgets
541
+ */
542
+ function widgets_init() {
543
+ register_widget( 'BPMediaWidget' );
544
+ }
545
+
546
+ /**
547
+ *
548
+ */
549
+ function enabled() {
550
+ $options = $this->options;
551
+ $enabled = array(
552
+ 'image' => false,
553
+ 'video' => false,
554
+ 'audio' => false,
555
+ 'album' => true,
556
+ 'upload' => true
557
+ );
558
+ if ( array_key_exists( 'images_enabled', $options ) ) {
559
+ if ( $options[ 'images_enabled' ] == 1 )
560
+ $enabled[ 'image' ] = true;
561
+ }
562
+ if ( array_key_exists( 'videos_enabled', $options ) ) {
563
+ if ( $options[ 'videos_enabled' ] == 1 )
564
+ $enabled[ 'video' ] = true;
565
+ }
566
+ if ( array_key_exists( 'audio_enabled', $options ) ) {
567
+ if ( $options[ 'audio_enabled' ] == 1 )
568
+ $enabled[ 'audio' ] = true;
569
+ }
570
+
571
+ return $enabled;
572
+ }
573
+
574
+ function default_tab(){
575
+ $enabled = $this->enabled();
576
+ unset($enabled['upload']);
577
+ unset($enabled['album']);
578
+ foreach($enabled as $tab=>$value){
579
+ if($value==true){
580
+ return $tab;
581
+ }
582
+ }
583
+ }
584
+
585
+ function defaults_tab(){
586
+ $defaults_tab = $this->default_tab();
587
+ if($defaults_tab!='audio'){
588
+ $defaults_tab .= 's';
589
+ }
590
+ return $defaults_tab;
591
+ }
592
+
593
+ static function get_wall_album( $group_id = false ) {
594
+ global $wpdb;
595
+ $group_id = ( ! $group_id) ? '1' : $group_id;
596
+ $album_name = __( 'Wall Posts', BP_MEDIA_TXT_DOMAIN );
597
+ $query = "SELECT ID FROM {$wpdb->prefix}posts ps LEFT JOIN
598
+ {$wpdb->prefix}postmeta pm ON ps.ID= pm.post_id WHERE ps.post_title
599
+ LIKE '{$album_name}' AND ps.post_type='bp_media_album' AND
600
+ pm.meta_key='bp-media-key' AND pm.meta_value ='{$group_id}'";
601
+ $wall_albums = $wpdb->get_results( $query, ARRAY_A );
602
+
603
+ if ( count( $wall_albums ) > 1 ) {
604
+ return BuddyPressMedia::merge_duplicate_wall_albums( $wall_albums );
605
+ } elseif($wall_albums) {
606
+ return $wall_albums[ 0 ][ 'ID' ];
607
+ }
608
+ }
609
+
610
+ static function merge_duplicate_wall_albums( $wall_albums ) {
611
+ global $wpdb;
612
+ $album_id = $wall_albums[ 0 ][ 'ID' ];
613
+ unset( $wall_albums[ 0 ] );
614
+ foreach ( $wall_albums as $album ) {
615
+ $query = "SELECT ID FROM {$wpdb->prefix}posts WHERE
616
+ post_parent={$album[ 'ID' ]} AND post_type='attachment'";
617
+ $media = $wpdb->get_results( $query, ARRAY_A );
618
+ foreach ( $media as $file ) {
619
+ $wpdb->update(
620
+ $wpdb->prefix . 'posts',
621
+ array(
622
+ ' post_parent' => $album_id
623
+ ),
624
+ array( 'ID' => $file['ID'] ),
625
+ array( '%d' ),
626
+ array( '%d' )
627
+ );
628
+ }
629
+
630
+ wp_delete_post($album['ID'],true);
631
+ }
632
+
633
+ }
634
 
635
  }
636
 
637
+ /**
638
+ * This wraps up the main BuddyPress Media class. Three important notes:
639
+ *
640
+ * 1. All the constants can be overridden.
641
+ * So, you could use, 'portfolio' instead of 'media'
642
+ * 2. The default thumbnail and display sizes can be filtered
643
+ * using 'bpmedia_media_sizes' hook
644
+ * 3. The excerpts and string sizes can be filtered
645
+ * using 'bpmedia_excerpt_lengths' hook
646
+ *
647
+ */
648
  ?>
app/main/activity/BPMediaActivity.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Description of BPMediaActivity
4
+ *
5
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
6
+ */
7
+ if (!class_exists('BPMediaActivity')) {
8
+
9
+ class BPMediaActivity {
10
+
11
+ var $default_album_id;
12
+ var $attachment_id = 0;
13
+ var $content = '';
14
+ var $media_count = 1;
15
+
16
+ public function __construct() {
17
+ add_action('bp_after_activity_post_form', array($this, 'activity_uploader'));
18
+ add_action('wp_ajax_bp_media_post_update', array($this, 'post_update'));
19
+ }
20
+
21
+ public function activity_uploader() {
22
+ ?>
23
+ <div id="bp-media-activity-upload-ui" class="hide-if-no-js drag-drop">
24
+ <input id="bp-media-activity-upload-browse-button" type="button" value="<?php _e('Insert Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" />
25
+ <div id="bp-media-activity-uploaded-files"></div>
26
+ </div>
27
+ <div id="bp-media-activity-post-update-append" style="display:none"></div><?php
28
+ }
29
+
30
+ public function post_update() {
31
+ // Bail if not a POST action
32
+ if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD']))
33
+ return;
34
+
35
+ // Check the nonce
36
+ check_admin_referer('post_update', '_wpnonce_post_update');
37
+
38
+ if (!is_user_logged_in())
39
+ exit('-1');
40
+
41
+ $multiple = isset($_POST['multiple']) ? $_POST['multiple'] : 0;
42
+ $media_id = isset($_POST['media_id']) ? $_POST['media_id'] : 0;
43
+ $this->content = isset($_POST['content']) ? $_POST['content'] : '';
44
+ $group_id = (isset($_POST['group_id']) && ('groups' == $_POST['group_id']) && isset($_POST['item_id'])) ? $_POST['item_id'] : false;
45
+
46
+ if ($media_id) {
47
+
48
+ if (strpos($media_id, '-')) {
49
+ $media_ids = explode('-', $media_id);
50
+ } else {
51
+ $media_ids = array($media_id);
52
+ }
53
+
54
+ $this->media_count = count($media_ids);
55
+
56
+ add_filter('bp_media_single_activity_title', array($this, 'activity_content'));
57
+ add_filter('bp_media_single_activity_description', create_function('', 'return "";'));
58
+ foreach ($media_ids as $id) {
59
+ wp_update_post(array('ID' => $id, 'post_content' => $this->content));
60
+ remove_action('bp_media_album_updated', 'BPMediaActions::album_activity_update');
61
+ add_action('bp_media_album_updated', array($this, 'update_album_activity_upload'));
62
+ BPMediaActions::activity_create_after_add_media($id, $multiple, false);
63
+ }
64
+
65
+ if ($multiple) {
66
+ $activity_id = get_post_meta(get_post_field('post_parent', $media_id), 'bp_media_child_activity', true);
67
+ } else {
68
+ $activity_id = get_post_meta($media_id, 'bp_media_child_activity', true);
69
+ }
70
+
71
+ if (empty($activity_id))
72
+ exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>');
73
+ //
74
+ if (bp_has_activities('include=' . $activity_id)) {
75
+ while (bp_activities()) {
76
+ bp_the_activity();
77
+ locate_template(array('activity/entry.php'), true);
78
+ }
79
+ }
80
+ }
81
+
82
+
83
+
84
+
85
+ // $activity_id = 0;
86
+ // if (empty($_POST['object']) && bp_is_active('activity')) {
87
+ // $activity_id = bp_activity_post_update(array('content' => $_POST['content']));
88
+ // } elseif ($_POST['object'] == 'groups') {
89
+ // if (!empty($_POST['item_id']) && bp_is_active('groups'))
90
+ // $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
91
+ // } else {
92
+ // $activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
93
+ // }
94
+ //
95
+
96
+
97
+ exit;
98
+ }
99
+
100
+ public function activity_content() {
101
+ return '<p class="bp-media-album-activity-upload-content">' . $this->content . '</p>';
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @param BPMediaAlbum $album
107
+ * @param type $current_time
108
+ * @param type $delete_media_id
109
+ */
110
+ function update_album_activity_upload($album, $current_time = true, $delete_media_id = null) {
111
+ if (!is_object($album)) {
112
+ $album = new BPMediaAlbum($album);
113
+ }
114
+ $args = array(
115
+ 'post_parent' => $album->get_id(),
116
+ 'numberposts' => $this->media_count,
117
+ 'post_type' => 'attachment',
118
+ );
119
+ if ($delete_media_id)
120
+ $args['exclude'] = $delete_media_id;
121
+ $attachments = get_posts($args);
122
+ if (is_array($attachments)) {
123
+ $content = NULL;
124
+ if ($this->content)
125
+ $content .= '<p class="bp-media-album-activity-upload-content">' . $this->content . '</p>';
126
+ $content .= '<ul>';
127
+ foreach ($attachments as $media) {
128
+ $bp_media = new BPMediaHostWordpress($media->ID);
129
+ $content .= $bp_media->get_album_activity_content();
130
+ }
131
+
132
+ $content .= '</ul>';
133
+ $activity_id = get_post_meta($album->get_id(), 'bp_media_child_activity');
134
+ if ($activity_id) {
135
+ $args = array(
136
+ 'in' => $activity_id,
137
+ );
138
+
139
+ $activity = @bp_activity_get($args);
140
+ if (isset($activity['activities'][0]->id)) {
141
+ $args = array(
142
+ 'content' => $content,
143
+ 'id' => $activity_id,
144
+ 'type' => 'album_updated',
145
+ 'user_id' => $activity['activities'][0]->user_id,
146
+ 'action' => apply_filters('bp_media_filter_album_updated', sprintf(__('%1$s added new media in album %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($activity['activities'][0]->user_id), '<a href="' . $album->get_url() . '">' . $album->get_title() . '</a>')),
147
+ 'component' => BP_MEDIA_SLUG, // The name/ID of the component e.g. groups, profile, mycomponent
148
+ 'primary_link' => $activity['activities'][0]->primary_link,
149
+ 'item_id' => $activity['activities'][0]->item_id,
150
+ 'secondary_item_id' => $activity['activities'][0]->secondary_item_id,
151
+ 'recorded_time' => $current_time ? bp_core_current_time() : $activity['activities'][0]->date_recorded,
152
+ 'hide_sitewide' => $activity['activities'][0]->hide_sitewide
153
+ );
154
+ BPMediaFunction::record_activity($args);
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ }
161
+
162
+ }
163
+ ?>
app/main/group/BPMediaGroup.php DELETED
@@ -1,270 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Description of BPMediaGroup
5
- *
6
- * @author faishal
7
- */
8
- class BPMediaGroup {
9
-
10
- function __construct($initFlag = true) {
11
- if ($initFlag) {
12
- if (class_exists('BPMediaGroupsExtension')) :
13
- bp_register_group_extension('BPMediaGroupsExtension');
14
- new BPMediaGroupImage ();
15
- new BPMediaGroupAlbum();
16
- new BPMediaGroupMusic();
17
- new BPMediaGroupVideo();
18
- new BPMediaGroupUpload();
19
- endif;
20
- add_action('bp_actions', array($this, 'custom_nav'), 999);
21
- add_filter('bp_media_multipart_params_filter', array($this, 'multipart_params_handler'));
22
- }
23
- }
24
-
25
- /**
26
- * Handles the custom navigation structure of the BuddyPress Group Extension Media
27
- *
28
- * @uses global $bp
29
- *
30
- * @since BuddyPress Media 2.3
31
- */
32
-
33
- /**
34
- *
35
- * @global type $bp
36
- * @return type
37
- */
38
- function custom_nav() {
39
- global $bp;
40
- $current_group = isset($bp->groups->current_group->slug) ? $bp->groups->current_group->slug : null;
41
- if (!$current_group)
42
- return;
43
- if (!(isset($bp->bp_options_nav[$current_group]) && is_array($bp->bp_options_nav[$current_group])))
44
- return;
45
-
46
- /** This line might break a thing or two in custom themes and widgets */
47
- remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
48
-
49
- foreach ($bp->bp_options_nav[$current_group] as $key => $nav_item) {
50
- switch ($nav_item['slug']) {
51
- case BP_MEDIA_IMAGES_SLUG:
52
- case BP_MEDIA_VIDEOS_SLUG:
53
- case BP_MEDIA_AUDIO_SLUG:
54
- case BP_MEDIA_ALBUMS_SLUG:
55
- case BP_MEDIA_UPLOAD_SLUG:
56
- unset($bp->bp_options_nav[$current_group][$key]);
57
- }
58
- switch ($bp->current_action) {
59
- case BP_MEDIA_IMAGES_SLUG:
60
- case BP_MEDIA_VIDEOS_SLUG:
61
- case BP_MEDIA_AUDIO_SLUG:
62
- case BP_MEDIA_ALBUMS_SLUG:
63
- case BP_MEDIA_UPLOAD_SLUG:
64
- $count = count($bp->action_variables);
65
- for ($i = $count; $i > 0; $i--) {
66
- $bp->action_variables[$i] = $bp->action_variables[$i - 1];
67
- }
68
- $bp->action_variables[0] = $bp->current_action;
69
- $bp->current_action = BP_MEDIA_SLUG;
70
- }
71
- }
72
- }
73
-
74
- /**
75
- * Adds the current group id as parameter for plupload
76
- *
77
- * @param Array $multipart_params Array of Multipart Parameters to be passed on to plupload script
78
- *
79
- * @since BuddyPress Media 2.3
80
- */
81
-
82
- /**
83
- *
84
- * @global type $bp
85
- * @param type $multipart_params
86
- * @return type
87
- */
88
- function multipart_params_handler($multipart_params) {
89
- if (is_array($multipart_params)) {
90
- global $bp;
91
- if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG
92
- && isset($bp->action_variables) && isset($bp->current_component) && $bp->current_component == 'groups'
93
- && isset($bp->groups->current_group->id)) {
94
- $multipart_params['bp_media_group_id'] = $bp->groups->current_group->id;
95
- }
96
- }
97
- return $multipart_params;
98
- }
99
-
100
- /**
101
- * Displays the navigation available to the group media tab for the
102
- * logged in user.
103
- *
104
- * @uses $bp Global Variable set by BuddyPress
105
- *
106
- * @since BuddyPress Media 2.3
107
- */
108
-
109
- /**
110
- *
111
- * @global type $bp
112
- * @return boolean
113
- */
114
- static function navigation_menu() {
115
- global $bp;
116
- if (!isset($bp->current_action) || $bp->current_action != BP_MEDIA_SLUG)
117
- return false;
118
- $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
119
- $bp_media_image = new BPMediaScreen('image', BP_MEDIA_IMAGES_SLUG);
120
- $current_tab = BP_MEDIA_IMAGES_SLUG;
121
-
122
- if (isset($bp->action_variables[0])) {
123
- $current_tab = $bp->action_variables[0];
124
- }
125
-
126
- // if (BPMediaGroup::can_upload()) {
127
- $bp_media_nav[BP_MEDIA_IMAGES_SLUG] = array(
128
- 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . BP_MEDIA_SLUG,
129
- 'label' => BP_MEDIA_IMAGES_LABEL,
130
- 'screen_function' => array($bp_media_image, 'screen')
131
- );
132
- // } else {
133
- // $bp_media_nav = array();
134
- // }
135
-
136
- foreach (array('VIDEOS', 'AUDIO', 'ALBUMS', 'UPLOAD') as $type) {
137
- if ($type == 'UPLOAD') {
138
- if (BPMediaGroup::can_upload()) {
139
- $bp_media_nav[constant('BP_MEDIA_' . $type . '_SLUG')] = array(
140
- 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $type . '_SLUG'),
141
- 'label' => constant('BP_MEDIA_' . $type . '_LABEL'),
142
- // 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
143
- 'user_has_access' => BPMediaGroup::can_upload()
144
- );
145
- }
146
- } else {
147
- $bp_media_nav[constant('BP_MEDIA_' . $type . '_SLUG')] = array(
148
- 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $type . '_SLUG'),
149
- 'label' => constant('BP_MEDIA_' . $type . '_LABEL'),
150
- );
151
- }
152
- }
153
-
154
- /** This variable will be used to display the tabs in group component */
155
- $bp_media_group_tabs = apply_filters('bp_media_group_tabs', $bp_media_nav, $current_tab);
156
- ?>
157
- <div class="item-list-tabs no-ajax bp-media-group-navigation" id="subnav">
158
- <ul>
159
- <?php
160
- foreach ($bp_media_group_tabs as $tab_slug => $tab_info) {
161
- echo '<li id="' . $tab_slug . '-group-li" ' . ($current_tab == $tab_slug ? 'class="current selected"' : '') . '><a id="' . $tab_slug . '" href="' . $tab_info['url'] . '" title="' . __($tab_info['label'], BP_MEDIA_TXT_DOMAIN) . '">' . __($tab_info['label'], BP_MEDIA_TXT_DOMAIN) . '</a></li>';
162
- }
163
- ?>
164
- </ul>
165
- </div>
166
- <?php
167
- }
168
-
169
- /**
170
- * Checks whether the current logged in user has the ability to upload on
171
- * the given group or not
172
- *
173
- * @since BuddyPress Media 2.3
174
- */
175
-
176
- /**
177
- *
178
- * @global type $bp
179
- * @return boolean
180
- */
181
- static function can_upload() {
182
- /** @todo Implementation Pending */
183
- global $bp;
184
- if (isset($bp->loggedin_user->id) && is_numeric($bp->loggedin_user->id) && class_exists( 'BP_Group_Extension' )) {
185
- return groups_is_user_member($bp->loggedin_user->id, bp_get_current_group_id());
186
- } else {
187
- return false;
188
- }
189
-
190
- return true;
191
- }
192
-
193
- /**
194
- * Adds the Media Settings menu for groups in the admin bar
195
- *
196
- * @uses global $bp,$wp_admin_bar
197
- *
198
- * @since BuddyPress Media 2.3
199
- */
200
-
201
- /**
202
- *
203
- * @global type $wp_admin_bar
204
- * @global type $bp
205
- */
206
- function admin_bar() {
207
- global $wp_admin_bar, $bp;
208
- $wp_admin_bar->add_menu(array(
209
- 'parent' => $bp->group_admin_menu_id,
210
- 'id' => 'bp-media-group',
211
- 'title' => __('Media Settings', BP_MEDIA_TXT_DOMAIN),
212
- 'href' => bp_get_groups_action_link('admin/media')
213
- ));
214
- }
215
-
216
- //add_action('admin_bar_menu','admin_bar',99);
217
- /* This will need some handling for checking if its a single group page or not, also whether the person can
218
- * edit media settings or not
219
- */
220
-
221
- /**
222
- * Checks whether a user can create an album in the given group or not
223
- *
224
- * @param string $group_id The group id to check against
225
- * @param string $user_id The user to be checked for permission
226
- *
227
- * @return boolean True if the user can create an album in the group, false if not
228
- */
229
-
230
- /**
231
- *
232
- * @param type $group_id
233
- * @param type $user_id
234
- * @return boolean
235
- */
236
- static function user_can_create_album($group_id, $user_id = 0) {
237
- if ($user_id == 0)
238
- $user_id = get_current_user_id();
239
- $current_level = groups_get_groupmeta($group_id, 'bp_media_group_control_level');
240
- switch ($current_level) {
241
- case 'all':
242
- return groups_is_user_member($user_id, $group_id) || groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id);
243
- break;
244
- case 'moderators':
245
- return groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id);
246
- break;
247
- case 'admin':
248
- return groups_is_user_admin($user_id, $group_id);
249
- break;
250
- default :
251
- return groups_is_user_admin($user_id, $group_id);
252
- }
253
- return false;
254
- }
255
-
256
- /**
257
- *
258
- * @param type $errorMessage
259
- */
260
- static function bp_media_display_error($errorMessage) {
261
- ?>
262
- <div id="message" class="error">
263
- <p>
264
- <?php _e($errorMessage, BP_MEDIA_TXT_DOMAIN); ?>
265
- </p>
266
- </div>
267
- <?php
268
- }
269
-
270
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/group/BPMediaGroupAction.php CHANGED
@@ -15,15 +15,20 @@ class BPMediaGroupAction {
15
  */
16
 
17
  /**
18
- *
19
  * @global type $bp
20
  * @global WP_Query $bp_media_query
21
  * @global type $bp_media_posts_per_page
22
  */
23
  static function bp_media_groups_set_query() {
24
- global $bp, $bp_media_query, $bp_media_posts_per_page;
 
 
 
 
 
25
  if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG) {
26
- $current_tab = BP_MEDIA_IMAGES_SLUG;
27
  if (isset($bp->action_variables[0])) {
28
  $current_tab = $bp->action_variables[0];
29
  }
@@ -63,6 +68,22 @@ class BPMediaGroupAction {
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * Called on bp_init by screen functions
68
  * Initializes the albums query for groups
@@ -73,7 +94,7 @@ class BPMediaGroupAction {
73
  */
74
 
75
  /**
76
- *
77
  * @global type $bp
78
  * @global WP_Query $bp_media_albums_query
79
  */
@@ -98,7 +119,7 @@ class BPMediaGroupAction {
98
  }
99
 
100
  /**
101
- *
102
  * @param BPMediaHostWordpress $media
103
  * @param type $hidden
104
  * @return boolean
@@ -132,12 +153,12 @@ class BPMediaGroupAction {
132
 
133
  //add_action('bp_media_groups_after_add_media','bp_media_groups_activity_create_after_add_media',10,2);
134
  /**
135
- *
136
  * @global type $bp
137
  */
138
 
139
  /**
140
- *
141
  * @global type $bp
142
  */
143
  static function bp_media_groups_redirection_handler() {
@@ -150,7 +171,7 @@ class BPMediaGroupAction {
150
 
151
  //add_action('bp_media_init','bp_media_groups_redirection_handler');
152
  /**
153
- *
154
  * @return boolean
155
  */
156
  static function bp_media_groups_force_hide_activity() {
15
  */
16
 
17
  /**
18
+ *
19
  * @global type $bp
20
  * @global WP_Query $bp_media_query
21
  * @global type $bp_media_posts_per_page
22
  */
23
  static function bp_media_groups_set_query() {
24
+ global $bp, $bp_media, $bp_media_query, $bp_media_posts_per_page;
25
+ $enabled = $bp_media->enabled();
26
+ $default_tab = $bp_media->default_tab();
27
+ $defaults_tab= $default_tab;
28
+ if($default_tab!='audio') $defaults_tab.='s';
29
+
30
  if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG) {
31
+ $current_tab = constant('BP_MEDIA_'.strtoupper($defaults_tab).'_SLUG');
32
  if (isset($bp->action_variables[0])) {
33
  $current_tab = $bp->action_variables[0];
34
  }
68
  }
69
  }
70
 
71
+ static function filter_entries(){
72
+ global $bp_media;
73
+ $enabled = $bp_media->enabled();
74
+ if(isset($enabled['upload'])) unset($enabled['upload']);
75
+ if(isset($enabled['album'])) unset($enabled['album']);
76
+ foreach($enabled as $type=>$active){
77
+ if($active==true){
78
+ $filters[] = $type;
79
+ }
80
+
81
+ }
82
+
83
+ if(count($filters)==1) $filters = $filters[0];
84
+ return $filters;
85
+ }
86
+
87
  /**
88
  * Called on bp_init by screen functions
89
  * Initializes the albums query for groups
94
  */
95
 
96
  /**
97
+ *
98
  * @global type $bp
99
  * @global WP_Query $bp_media_albums_query
100
  */
119
  }
120
 
121
  /**
122
+ *
123
  * @param BPMediaHostWordpress $media
124
  * @param type $hidden
125
  * @return boolean
153
 
154
  //add_action('bp_media_groups_after_add_media','bp_media_groups_activity_create_after_add_media',10,2);
155
  /**
156
+ *
157
  * @global type $bp
158
  */
159
 
160
  /**
161
+ *
162
  * @global type $bp
163
  */
164
  static function bp_media_groups_redirection_handler() {
171
 
172
  //add_action('bp_media_init','bp_media_groups_redirection_handler');
173
  /**
174
+ *
175
  * @return boolean
176
  */
177
  static function bp_media_groups_force_hide_activity() {
app/main/group/BPMediaGroupElementExtension.php CHANGED
@@ -12,7 +12,7 @@ if (class_exists('BP_Group_Extension')) :
12
  var $enable_create_step = false;
13
 
14
  /**
15
- *
16
  * @param type $name
17
  * @param type $slug
18
  */
@@ -22,7 +22,7 @@ if (class_exists('BP_Group_Extension')) :
22
  }
23
 
24
  /**
25
- *
26
  * @global type $bp
27
  * @global BPMediaHostWordpress $bp_media_current_entry
28
  * @return type
@@ -35,7 +35,7 @@ if (class_exists('BP_Group_Extension')) :
35
  if (isset($bp->action_variables[0])) {
36
  $current_tab = $bp->action_variables[0];
37
  }
38
- BPMediaGroup::navigation_menu();
39
  $media_type = "";
40
  $slug = "";
41
  switch ($current_tab) {
@@ -80,7 +80,7 @@ if (class_exists('BP_Group_Extension')) :
80
  throw new Exception(__('Sorry, the requested media does not belong to the group', BP_MEDIA_TXT_DOMAIN));
81
  } catch (Exception $e) {
82
  /** Error Handling when media not present or not belong to the group */
83
- bp_media_display_error($e->getMessage());
84
  return;
85
  }
86
  if ($media_type == "album") {
@@ -103,7 +103,7 @@ if (class_exists('BP_Group_Extension')) :
103
  $bp_media_content = new BPMediaAlbumScreen($media_type, $slug);
104
  $bp_media_content->screen_content();
105
  } else if ($media_type == 'upload') {
106
- if (BPMediaGroup::can_upload()) {
107
  $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
108
  $bp_media_upload->upload_screen_content();
109
  }
@@ -116,11 +116,11 @@ if (class_exists('BP_Group_Extension')) :
116
  }
117
 
118
  function widget_display() {
119
-
120
  }
121
 
122
  /**
123
- *
124
  * @param type $errorMessage
125
  */
126
  function bp_media_display_error($errorMessage) {
12
  var $enable_create_step = false;
13
 
14
  /**
15
+ *
16
  * @param type $name
17
  * @param type $slug
18
  */
22
  }
23
 
24
  /**
25
+ *
26
  * @global type $bp
27
  * @global BPMediaHostWordpress $bp_media_current_entry
28
  * @return type
35
  if (isset($bp->action_variables[0])) {
36
  $current_tab = $bp->action_variables[0];
37
  }
38
+ BPMediaGroupLoader::navigation_menu();
39
  $media_type = "";
40
  $slug = "";
41
  switch ($current_tab) {
80
  throw new Exception(__('Sorry, the requested media does not belong to the group', BP_MEDIA_TXT_DOMAIN));
81
  } catch (Exception $e) {
82
  /** Error Handling when media not present or not belong to the group */
83
+ $this->bp_media_display_error($e->getMessage());
84
  return;
85
  }
86
  if ($media_type == "album") {
103
  $bp_media_content = new BPMediaAlbumScreen($media_type, $slug);
104
  $bp_media_content->screen_content();
105
  } else if ($media_type == 'upload') {
106
+ if (BPMediaGroupLoader::can_upload()) {
107
  $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
108
  $bp_media_upload->upload_screen_content();
109
  }
116
  }
117
 
118
  function widget_display() {
119
+
120
  }
121
 
122
  /**
123
+ *
124
  * @param type $errorMessage
125
  */
126
  function bp_media_display_error($errorMessage) {
app/main/group/dummy/{BPMediaGroupAlbum.php → BPMediaGroupAlbums.php} RENAMED
@@ -7,11 +7,11 @@
7
  */
8
  if (class_exists('BP_Group_Extension')) :
9
 
10
- class BPMediaGroupAlbum extends BPMediaGroupElementExtension {
11
 
12
  function __construct() {
13
  parent::__construct(BP_MEDIA_ALBUMS_LABEL, BP_MEDIA_ALBUMS_SLUG);
14
- bp_register_group_extension("BPMediaGroupAlbum");
15
  }
16
 
17
  }
7
  */
8
  if (class_exists('BP_Group_Extension')) :
9
 
10
+ class BPMediaGroupAlbums extends BPMediaGroupElementExtension {
11
 
12
  function __construct() {
13
  parent::__construct(BP_MEDIA_ALBUMS_LABEL, BP_MEDIA_ALBUMS_SLUG);
14
+ bp_register_group_extension("BPMediaGroupAlbums");
15
  }
16
 
17
  }
app/main/group/dummy/{BPMediaGroupMusic.php → BPMediaGroupAudio.php} RENAMED
@@ -5,11 +5,11 @@
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
- class BPMediaGroupMusic extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_AUDIO_LABEL, BP_MEDIA_AUDIO_SLUG);
12
- bp_register_group_extension("BPMediaGroupMusic");
13
  }
14
 
15
  }
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
+ class BPMediaGroupAudio extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_AUDIO_LABEL, BP_MEDIA_AUDIO_SLUG);
12
+ bp_register_group_extension("BPMediaGroupAudio");
13
  }
14
 
15
  }
app/main/group/dummy/{BPMediaGroupImage.php → BPMediaGroupImages.php} RENAMED
@@ -5,11 +5,11 @@
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
- class BPMediaGroupImage extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_IMAGES_LABEL, BP_MEDIA_IMAGES_SLUG);
12
- bp_register_group_extension("BPMediaGroupImage");
13
  }
14
 
15
  }
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
+ class BPMediaGroupImages extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_IMAGES_LABEL, BP_MEDIA_IMAGES_SLUG);
12
+ bp_register_group_extension("BPMediaGroupImages");
13
  }
14
 
15
  }
app/main/group/dummy/{BPMediaGroupVideo.php → BPMediaGroupVideos.php} RENAMED
@@ -5,11 +5,11 @@
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
- class BPMediaGroupVideo extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_VIDEOS_LABEL, BP_MEDIA_VIDEOS_SLUG);
12
- bp_register_group_extension("BPMediaGroupVideo");
13
  }
14
 
15
  }
5
  * @author faishal
6
  */
7
  if ( class_exists( 'BP_Group_Extension' ) ) :
8
+ class BPMediaGroupVideos extends BPMediaGroupElementExtension {
9
 
10
  function __construct() {
11
  parent::__construct(BP_MEDIA_VIDEOS_LABEL, BP_MEDIA_VIDEOS_SLUG);
12
+ bp_register_group_extension("BPMediaGroupVideos");
13
  }
14
 
15
  }
app/main/importers/BPMediaBPAlbumImporter.php DELETED
@@ -1,21 +0,0 @@
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 BPMediaBPAlbumImporter extends BPMediaImporter {
14
-
15
- function __construct() {
16
- parent::__construct();
17
- }
18
-
19
- }
20
-
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/importers/BPMediaImporter.php DELETED
@@ -1,45 +0,0 @@
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 BPMediaImporter
10
- *
11
- * @author saurabh
12
- */
13
- class BPMediaImporter {
14
-
15
- /**
16
- *
17
- */
18
- function __construct() {
19
-
20
- }
21
-
22
- function import(){
23
-
24
- $this->process_media();
25
-
26
- }
27
-
28
- function process_media(){
29
-
30
- $this->import_privacy();
31
- $this->cleanup();
32
-
33
- }
34
-
35
- function cleanup(){
36
-
37
- }
38
-
39
- function import_privacy(){
40
-
41
- }
42
-
43
- }
44
-
45
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/includes/BPMediaActions.php CHANGED
@@ -8,7 +8,7 @@
8
  class BPMediaActions {
9
 
10
  /**
11
- *
12
  * @global type $bp_media_options
13
  */
14
  function __construct() {
@@ -20,16 +20,17 @@ class BPMediaActions {
20
  add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
21
  add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
22
  add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
23
- add_action('bp_media_album_updated', array($this, 'album_activity_update'));
24
  add_action('bp_media_after_delete_media', array($this, 'album_activity_sync'));
25
- add_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 2);
26
  add_action('wp_ajax_bp_media_load_more', array($this, 'load_more'));
 
27
  add_action('wp_ajax_nopriv_bp_media_load_more', array($this, 'load_more'));
28
  add_action('delete_attachment', array($this, 'delete_attachment_handler'));
29
  add_action('wp_ajax_bp_media_add_album', array($this, 'add_album'));
30
  add_action('wp_ajax_nopriv_bp_media_add_album', array($this, 'add_album'));
31
- global $bp_media_options;
32
- if (isset($bp_media_options['remove_linkback']) && $bp_media_options['remove_linkback'] != '1')
33
  add_action('bp_footer', array($this, 'footer'));
34
  }
35
 
@@ -40,7 +41,7 @@ class BPMediaActions {
40
  */
41
 
42
  /**
43
- *
44
  * @global type $bp
45
  * @global type $bp_media_options
46
  * @return type
@@ -54,11 +55,11 @@ class BPMediaActions {
54
  ));
55
  if (isset($_POST['action']) && $_POST['action'] == 'wp_handle_upload') {
56
  /** This section can help in the group activity handling */
57
- if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id'])) {
58
- remove_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 2);
59
- add_action('bp_media_after_add_media', 'BPMediaGroupAction::bp_media_groups_activity_create_after_add_media', 10, 2);
60
- add_filter('bp_media_force_hide_activity', 'BPMediaGroupAction::bp_media_groups_force_hide_activity');
61
- }
62
  /* @var $bp_media_entry BPMediaHostWordpress */
63
  if (isset($_FILES) && is_array($_FILES) && array_key_exists('bp_media_file', $_FILES) && $_FILES['bp_media_file']['name'] != '') {
64
  if (!preg_match('/audio|video|image/i', $_FILES['bp_media_file']['type'], $result) || !isset($result[0])) {
@@ -95,9 +96,10 @@ class BPMediaActions {
95
  $title = isset($_POST['bp_media_title']) ? ($_POST['bp_media_title'] != "") ? $_POST['bp_media_title'] : pathinfo($_FILES['bp_media_file']['name'], PATHINFO_FILENAME) : pathinfo($_FILES['bp_media_file']['name'], PATHINFO_FILENAME);
96
  $album_id = isset($_POST['bp_media_album_id']) ? intval($_POST['bp_media_album_id']) : 0;
97
  $is_multiple = isset($_POST['is_multiple_upload']) ? ($_POST['is_multiple_upload'] == 'true' ? true : false) : false;
 
98
  $description = isset($_POST['bp_media_description']) ? $_POST['bp_media_description'] : '';
99
  $group_id = isset($_POST['bp_media_group_id']) ? intval($_POST['bp_media_group_id']) : 0;
100
- $entry = $bp_media_entry->add_media($title, $description, $album_id, $group_id, $is_multiple);
101
  if (!isset($bp->{BP_MEDIA_SLUG}->messages['updated'][0]))
102
  $bp->{BP_MEDIA_SLUG}->messages['updated'][0] = __('Upload Successful', BP_MEDIA_TXT_DOMAIN);
103
  } catch (Exception $e) {
@@ -118,7 +120,7 @@ class BPMediaActions {
118
  */
119
 
120
  /**
121
- *
122
  * @global type $bp
123
  */
124
  static function show_messages() {
@@ -140,7 +142,7 @@ class BPMediaActions {
140
  */
141
 
142
  /**
143
- *
144
  * @global type $bp
145
  */
146
  function enqueue_scripts_styles() {
@@ -171,13 +173,14 @@ class BPMediaActions {
171
  }
172
 
173
  /**
174
- *
175
- * @global type $bp_media_count
176
- * @global type $wpdb
177
- * @param type $args
178
  * @return boolean
179
  */
180
  static function delete_activity_handler($args) {
 
181
  remove_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
182
  global $bp_media_count, $wpdb;
183
  if (!array_key_exists('id', $args))
@@ -213,7 +216,7 @@ class BPMediaActions {
213
  }
214
 
215
  /**
216
- *
217
  * @param type $media_id
218
  * @return boolean
219
  */
@@ -235,7 +238,7 @@ class BPMediaActions {
235
  */
236
 
237
  /**
238
- *
239
  * @global type $bp
240
  * @global WP_Query $bp_media_query
241
  * @global type $bp_media_posts_per_page
@@ -285,7 +288,7 @@ class BPMediaActions {
285
  */
286
 
287
  /**
288
- *
289
  * @global type $bp_media_current_entry
290
  * @global type $bp_media_options
291
  * @return boolean
@@ -331,7 +334,7 @@ class BPMediaActions {
331
  */
332
 
333
  /**
334
- *
335
  * @global type $bp_media_count
336
  * @param type $user
337
  * @return boolean
@@ -374,27 +377,52 @@ class BPMediaActions {
374
  }
375
 
376
  function upload_enqueue() {
377
- $params = array(
378
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
379
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
380
- 'browse_button' => 'bp-media-upload-browse-button',
381
- 'container' => 'bp-media-upload-ui',
382
- 'drop_element' => 'drag-drop-area',
383
- 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
384
- 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
385
- 'multipart' => true,
386
- 'urlstream_upload' => true,
387
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
388
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
389
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
390
- 'multi_selection' => true,
391
- 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
392
- );
393
- 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'));
394
- wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css');
396
- // wp_enqueue_style("wp-jquery-ui-dialog"); //Its not styling the Dialog box as it should so using different styling
397
- //wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
398
  }
399
 
400
  //This is used only on the uploads page so its added as action in the screens function of upload page.
@@ -408,7 +436,7 @@ class BPMediaActions {
408
  */
409
 
410
  /**
411
- *
412
  * @global type $bp
413
  * @global WP_Query $bp_media_albums_query
414
  */
@@ -432,12 +460,30 @@ class BPMediaActions {
432
  }
433
  }
434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  /**
436
  * Function to return the media for the ajax requests
437
  */
438
 
439
  /**
440
- *
441
  * @global type $bp
442
  * @global WP_Query $bp_media_query
443
  * @global type $bp_media_posts_per_page
@@ -451,9 +497,20 @@ class BPMediaActions {
451
  $displayed_user = isset($_POST['displayed_user']) ? $_POST['displayed_user'] : null;
452
  $loggedin_user = isset($_POST['loggedin_user']) ? $_POST['loggedin_user'] : null;
453
  $current_group = isset($_POST['current_group']) ? $_POST['current_group'] : null;
 
 
 
 
 
 
 
 
454
  if ((!$displayed_user || intval($displayed_user) == 0) && (!$current_group || intval($current_group) == 0)) {
455
  die();
456
  }
 
 
 
457
  switch ($current_action) {
458
  case BP_MEDIA_IMAGES_SLUG:
459
  $args = array(
@@ -461,8 +518,10 @@ class BPMediaActions {
461
  'post_status' => 'any',
462
  'post_mime_type' => 'image',
463
  'meta_key' => 'bp-media-key',
464
- 'meta_value' => $current_group > 0 ? -$current_group : $bp->displayed_user->id,
465
  'meta_compare' => '=',
 
 
466
  'paged' => $page,
467
  'posts_per_page' => $bp_media_posts_per_page
468
  );
@@ -474,8 +533,10 @@ class BPMediaActions {
474
  'post_mime_type' => 'audio',
475
  'author' => $bp->displayed_user->id,
476
  'meta_key' => 'bp-media-key',
477
- 'meta_value' => $current_group > 0 ? -$current_group : $bp->displayed_user->id,
478
  'meta_compare' => '=',
 
 
479
  'paged' => $page,
480
  'posts_per_page' => $bp_media_posts_per_page
481
  );
@@ -487,8 +548,10 @@ class BPMediaActions {
487
  'post_mime_type' => 'video',
488
  'author' => $bp->displayed_user->id,
489
  'meta_key' => 'bp-media-key',
490
- 'meta_value' => $current_group > 0 ? -$current_group : $bp->displayed_user->id,
491
  'meta_compare' => '=',
 
 
492
  'paged' => $page,
493
  'posts_per_page' => $bp_media_posts_per_page
494
  );
@@ -500,15 +563,21 @@ class BPMediaActions {
500
  'post_status' => 'any',
501
  'author' => $displayed_user,
502
  'post_parent' => $action_variables[1],
 
 
503
  'paged' => $page,
504
- 'posts_per_page' => $bp_media_posts_per_page
 
505
  );
506
  } else {
507
  $args = array(
508
  'post_type' => 'bp_media_album',
509
  'author' => $displayed_user,
 
 
510
  'paged' => $page,
511
- 'posts_per_page' => $bp_media_posts_per_page
 
512
  );
513
  }
514
  break;
@@ -530,7 +599,7 @@ class BPMediaActions {
530
  }
531
 
532
  /**
533
- *
534
  * @global type $bp_media_count
535
  * @param type $attachment_id
536
  * @return boolean
@@ -574,7 +643,7 @@ class BPMediaActions {
574
  $album = new BPMediaAlbum();
575
  if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id']) > 0) {
576
  $group_id = intval($_POST['bp_media_group_id']);
577
- if (BPMediaGroup::user_can_create_album($group_id, get_current_user_id())) {
578
  try {
579
  $album->add_album($_POST['bp_media_album_name'], 0, $group_id);
580
  echo $album->get_id();
@@ -605,7 +674,7 @@ class BPMediaActions {
605
  //add_action('bp_after_activity_post_form','add_new_from_activity');
606
 
607
  /**
608
- *
609
  * @param type $album
610
  */
611
  function album_create_activity($album) {
@@ -623,7 +692,7 @@ class BPMediaActions {
623
  }
624
 
625
  /**
626
- *
627
  * @param type $album_id
628
  */
629
  function album_activity_update($album_id) {
@@ -631,7 +700,7 @@ class BPMediaActions {
631
  }
632
 
633
  /**
634
- *
635
  * @param type $media_id
636
  */
637
  function album_activity_sync($media_id) {
@@ -640,12 +709,12 @@ class BPMediaActions {
640
  }
641
 
642
  /**
643
- *
644
  * @param BPMediaHostWordpress $media
645
  * @param type $hidden
646
  * @return boolean
647
  */
648
- static function activity_create_after_add_media($media, $hidden = false) {
649
  if (function_exists('bp_activity_add')) {
650
  if (!is_object($media)) {
651
  try {
@@ -664,13 +733,37 @@ class BPMediaActions {
664
  'type' => 'media_upload',
665
  'user_id' => $media->get_author()
666
  );
 
667
  $hidden = apply_filters('bp_media_force_hide_activity', $hidden);
668
- if ($hidden) {
 
669
  $args['secondary_item_id'] = -999;
 
 
 
 
 
 
 
 
 
670
  do_action('bp_media_album_updated', $media->get_album_id());
671
  }
 
 
 
 
 
 
 
 
672
  $activity_id = BPMediaFunction::record_activity($args);
673
- add_post_meta($media->get_id(), 'bp_media_child_activity', $activity_id);
 
 
 
 
 
674
  }
675
  }
676
 
8
  class BPMediaActions {
9
 
10
  /**
11
+ *
12
  * @global type $bp_media_options
13
  */
14
  function __construct() {
20
  add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
21
  add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
22
  add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
23
+ add_action('bp_media_album_updated', 'BPMediaActions::album_activity_update');
24
  add_action('bp_media_after_delete_media', array($this, 'album_activity_sync'));
25
+ add_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 4);
26
  add_action('wp_ajax_bp_media_load_more', array($this, 'load_more'));
27
+ // add_action('wp_ajax_bp_media_get_attachment_html', array($this, 'fetch_feed'), 1);
28
  add_action('wp_ajax_nopriv_bp_media_load_more', array($this, 'load_more'));
29
  add_action('delete_attachment', array($this, 'delete_attachment_handler'));
30
  add_action('wp_ajax_bp_media_add_album', array($this, 'add_album'));
31
  add_action('wp_ajax_nopriv_bp_media_add_album', array($this, 'add_album'));
32
+ $linkback = bp_get_option('bp_media_add_linkback', false);
33
+ if ($linkback)
34
  add_action('bp_footer', array($this, 'footer'));
35
  }
36
 
41
  */
42
 
43
  /**
44
+ *
45
  * @global type $bp
46
  * @global type $bp_media_options
47
  * @return type
55
  ));
56
  if (isset($_POST['action']) && $_POST['action'] == 'wp_handle_upload') {
57
  /** This section can help in the group activity handling */
58
+ // if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id'])) {
59
+ // remove_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 3);
60
+ // add_action('bp_media_after_add_media', 'BPMediaGroupAction::bp_media_groups_activity_create_after_add_media', 10, 2);
61
+ //// add_filter('bp_media_force_hide_activity', 'BPMediaGroupAction::bp_media_groups_force_hide_activity');
62
+ // }
63
  /* @var $bp_media_entry BPMediaHostWordpress */
64
  if (isset($_FILES) && is_array($_FILES) && array_key_exists('bp_media_file', $_FILES) && $_FILES['bp_media_file']['name'] != '') {
65
  if (!preg_match('/audio|video|image/i', $_FILES['bp_media_file']['type'], $result) || !isset($result[0])) {
96
  $title = isset($_POST['bp_media_title']) ? ($_POST['bp_media_title'] != "") ? $_POST['bp_media_title'] : pathinfo($_FILES['bp_media_file']['name'], PATHINFO_FILENAME) : pathinfo($_FILES['bp_media_file']['name'], PATHINFO_FILENAME);
97
  $album_id = isset($_POST['bp_media_album_id']) ? intval($_POST['bp_media_album_id']) : 0;
98
  $is_multiple = isset($_POST['is_multiple_upload']) ? ($_POST['is_multiple_upload'] == 'true' ? true : false) : false;
99
+ $is_activity = isset($_POST['is_activity']) ? ($_POST['is_activity'] == 'true' ? true : false) : false;
100
  $description = isset($_POST['bp_media_description']) ? $_POST['bp_media_description'] : '';
101
  $group_id = isset($_POST['bp_media_group_id']) ? intval($_POST['bp_media_group_id']) : 0;
102
+ $entry = $bp_media_entry->add_media($title, $description, $album_id, $group_id, $is_multiple, $is_activity);
103
  if (!isset($bp->{BP_MEDIA_SLUG}->messages['updated'][0]))
104
  $bp->{BP_MEDIA_SLUG}->messages['updated'][0] = __('Upload Successful', BP_MEDIA_TXT_DOMAIN);
105
  } catch (Exception $e) {
120
  */
121
 
122
  /**
123
+ *
124
  * @global type $bp
125
  */
126
  static function show_messages() {
142
  */
143
 
144
  /**
145
+ *
146
  * @global type $bp
147
  */
148
  function enqueue_scripts_styles() {
173
  }
174
 
175
  /**
176
+ *
177
+ * @global integer $bp_media_count
178
+ * @global object $wpdb
179
+ * @param array $args
180
  * @return boolean
181
  */
182
  static function delete_activity_handler($args) {
183
+ error_log('Delete delete :)');
184
  remove_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
185
  global $bp_media_count, $wpdb;
186
  if (!array_key_exists('id', $args))
216
  }
217
 
218
  /**
219
+ *
220
  * @param type $media_id
221
  * @return boolean
222
  */
238
  */
239
 
240
  /**
241
+ *
242
  * @global type $bp
243
  * @global WP_Query $bp_media_query
244
  * @global type $bp_media_posts_per_page
288
  */
289
 
290
  /**
291
+ *
292
  * @global type $bp_media_current_entry
293
  * @global type $bp_media_options
294
  * @return boolean
334
  */
335
 
336
  /**
337
+ *
338
  * @global type $bp_media_count
339
  * @param type $user
340
  * @return boolean
377
  }
378
 
379
  function upload_enqueue() {
380
+ // echo 'action=' . bp_current_action();
381
+ // echo '<br />';
382
+ // echo 'activity=' . bp_is_activity_component();
383
+ // echo '<br />';
384
+ // echo 'group=' . bp_is_group_home();
385
+ if (bp_is_activity_component() || bp_is_group_home()) {
386
+ $params = array(
387
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
388
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
389
+ 'browse_button' => 'bp-media-activity-upload-browse-button',
390
+ 'container' => 'bp-media-activity-upload-ui',
391
+ 'drop_element' => 'drag-drop-area',
392
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
393
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
394
+ 'multipart' => true,
395
+ 'urlstream_upload' => true,
396
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
397
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
398
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
399
+ 'multi_selection' => true,
400
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
401
+ );
402
+ 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'));
403
+ wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
404
+ wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
405
+ } elseif (in_array(bp_current_action(), array(BP_MEDIA_IMAGES_SLUG, BP_MEDIA_VIDEOS_SLUG, BP_MEDIA_AUDIO_SLUG, BP_MEDIA_SLUG, BP_MEDIA_ALBUMS_SLUG))) {
406
+ $params = array(
407
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
408
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
409
+ 'browse_button' => 'bp-media-upload-browse-button',
410
+ 'container' => 'bp-media-upload-ui',
411
+ 'drop_element' => 'drag-drop-area',
412
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
413
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
414
+ 'multipart' => true,
415
+ 'urlstream_upload' => true,
416
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
417
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
418
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
419
+ 'multi_selection' => true,
420
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
421
+ );
422
+ 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'));
423
+ wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
424
+ }
425
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css');
 
 
426
  }
427
 
428
  //This is used only on the uploads page so its added as action in the screens function of upload page.
436
  */
437
 
438
  /**
439
+ *
440
  * @global type $bp
441
  * @global WP_Query $bp_media_albums_query
442
  */
460
  }
461
  }
462
 
463
+ function filter_entries() {
464
+ global $bp_media;
465
+ $enabled = $bp_media->enabled();
466
+ if (isset($enabled['upload']))
467
+ unset($enabled['upload']);
468
+ if (isset($enabled['album']))
469
+ unset($enabled['album']);
470
+ foreach ($enabled as $type => $active) {
471
+ if ($active == true) {
472
+ $filters[] = $type;
473
+ }
474
+ }
475
+
476
+ if (count($filters) == 1)
477
+ $filters = $filters[0];
478
+ return $filters;
479
+ }
480
+
481
  /**
482
  * Function to return the media for the ajax requests
483
  */
484
 
485
  /**
486
+ *
487
  * @global type $bp
488
  * @global WP_Query $bp_media_query
489
  * @global type $bp_media_posts_per_page
497
  $displayed_user = isset($_POST['displayed_user']) ? $_POST['displayed_user'] : null;
498
  $loggedin_user = isset($_POST['loggedin_user']) ? $_POST['loggedin_user'] : null;
499
  $current_group = isset($_POST['current_group']) ? $_POST['current_group'] : null;
500
+ $limit = 10;
501
+ if ( bp_is_my_profile() || groups_is_user_member($loggedin_user, $current_group)) {
502
+ $limit = get_option('posts_per_page');
503
+ $offset = $limit*($page-1)-1;
504
+ } else {
505
+ $limit = get_option('posts_per_page');
506
+ $offset = $limit*($page-1);
507
+ }
508
  if ((!$displayed_user || intval($displayed_user) == 0) && (!$current_group || intval($current_group) == 0)) {
509
  die();
510
  }
511
+ global $bp_media;
512
+ $enabled = $bp_media->enabled();
513
+
514
  switch ($current_action) {
515
  case BP_MEDIA_IMAGES_SLUG:
516
  $args = array(
518
  'post_status' => 'any',
519
  'post_mime_type' => 'image',
520
  'meta_key' => 'bp-media-key',
521
+ 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
522
  'meta_compare' => '=',
523
+ 'offset' => $offset,
524
+ 'limit' => $limit,
525
  'paged' => $page,
526
  'posts_per_page' => $bp_media_posts_per_page
527
  );
533
  'post_mime_type' => 'audio',
534
  'author' => $bp->displayed_user->id,
535
  'meta_key' => 'bp-media-key',
536
+ 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
537
  'meta_compare' => '=',
538
+ 'offset' => $offset,
539
+ 'limit' => $limit,
540
  'paged' => $page,
541
  'posts_per_page' => $bp_media_posts_per_page
542
  );
548
  'post_mime_type' => 'video',
549
  'author' => $bp->displayed_user->id,
550
  'meta_key' => 'bp-media-key',
551
+ 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
552
  'meta_compare' => '=',
553
+ 'offset' => $offset,
554
+ 'limit' => $limit,
555
  'paged' => $page,
556
  'posts_per_page' => $bp_media_posts_per_page
557
  );
563
  'post_status' => 'any',
564
  'author' => $displayed_user,
565
  'post_parent' => $action_variables[1],
566
+ 'offset' => $offset,
567
+ 'limit' => $limit,
568
  'paged' => $page,
569
+ 'posts_per_page' => $bp_media_posts_per_page,
570
+ 'post_mime_type' => $this->filter_entries(),
571
  );
572
  } else {
573
  $args = array(
574
  'post_type' => 'bp_media_album',
575
  'author' => $displayed_user,
576
+ 'offset' => $offset,
577
+ 'limit' => $limit,
578
  'paged' => $page,
579
+ 'posts_per_page' => $bp_media_posts_per_page,
580
+ 'post_mime_type' => $this->filter_entries(),
581
  );
582
  }
583
  break;
599
  }
600
 
601
  /**
602
+ *
603
  * @global type $bp_media_count
604
  * @param type $attachment_id
605
  * @return boolean
643
  $album = new BPMediaAlbum();
644
  if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id']) > 0) {
645
  $group_id = intval($_POST['bp_media_group_id']);
646
+ if (BPMediaGroupLoader::user_can_create_album($group_id, get_current_user_id())) {
647
  try {
648
  $album->add_album($_POST['bp_media_album_name'], 0, $group_id);
649
  echo $album->get_id();
674
  //add_action('bp_after_activity_post_form','add_new_from_activity');
675
 
676
  /**
677
+ *
678
  * @param type $album
679
  */
680
  function album_create_activity($album) {
692
  }
693
 
694
  /**
695
+ *
696
  * @param type $album_id
697
  */
698
  function album_activity_update($album_id) {
700
  }
701
 
702
  /**
703
+ *
704
  * @param type $media_id
705
  */
706
  function album_activity_sync($media_id) {
709
  }
710
 
711
  /**
712
+ *
713
  * @param BPMediaHostWordpress $media
714
  * @param type $hidden
715
  * @return boolean
716
  */
717
+ static function activity_create_after_add_media($media, $hidden = false, $activity = false, $group = false) {
718
  if (function_exists('bp_activity_add')) {
719
  if (!is_object($media)) {
720
  try {
733
  'type' => 'media_upload',
734
  'user_id' => $media->get_author()
735
  );
736
+
737
  $hidden = apply_filters('bp_media_force_hide_activity', $hidden);
738
+
739
+ if ($activity || $hidden) {
740
  $args['secondary_item_id'] = -999;
741
+ } else {
742
+ $update_activity_id = get_post_meta($media->get_id(), 'bp_media_child_activity', true);
743
+ if ($update_activity_id) {
744
+ $args['id'] = $update_activity_id;
745
+ $args['secondary_item_id'] = false;
746
+ }
747
+ }
748
+
749
+ if ($hidden) {
750
  do_action('bp_media_album_updated', $media->get_album_id());
751
  }
752
+
753
+ if ($group) {
754
+ $group_info = groups_get_group(array('group_id' => $group));
755
+ if ('public' != $group_info->status) {
756
+ $args['hide_sitewide'] = 1;
757
+ }
758
+ }
759
+
760
  $activity_id = BPMediaFunction::record_activity($args);
761
+
762
+ if ($group)
763
+ bp_activity_update_meta($activity_id, 'group_id', $group);
764
+
765
+ if (!$update_activity_id)
766
+ add_post_meta($media->get_id(), 'bp_media_child_activity', $activity_id);
767
  }
768
  }
769
 
app/main/includes/BPMediaComponent.php DELETED
@@ -1,381 +0,0 @@
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 BPMediaComponent
10
- *
11
- * @author saurabh
12
- */
13
- class BPMediaComponent extends BP_Component {
14
-
15
- /**
16
- * Hold the messages generated during initialization process and will be shown on the screen functions
17
- *
18
- * @since BuddyPress Media 2.0
19
- */
20
- var $messages = array(
21
- 'error' => array(),
22
- 'info' => array(),
23
- 'updated' => array()
24
- );
25
-
26
- /**
27
- * Constructor for the BuddyPress Media
28
- *
29
- * @since BuddyPress Media 2.0
30
- */
31
-
32
- /**
33
- *
34
- * @global type $bp
35
- */
36
- function __construct() {
37
- global $bp;
38
- parent::start(BP_MEDIA_SLUG, BP_MEDIA_LABEL, BP_MEDIA_PATH);
39
- $this->includes();
40
- $bp->active_components[$this->id] = '1';
41
- add_action('init', array(&$this, 'register_post_types'), 10);
42
- }
43
-
44
- /**
45
- * Includes the files required for the BuddyPress Media and calls the parent class' includes function
46
- *
47
- * @since BuddyPress Media 2.0
48
- */
49
- function includes() {
50
- $inc_path_prefix = 'app/main/includes/';
51
- $includes = array(
52
- $inc_path_prefix . 'bp-media-functions.php',
53
- $inc_path_prefix . 'bp-media-template-functions.php',
54
- $inc_path_prefix . 'bp-media-interface.php',
55
- $inc_path_prefix . 'bp-media-shortcodes.php',
56
- $inc_path_prefix . 'bp-media-widgets.php'
57
- //$inc_path_prefix . 'BPMediaFilter.php',
58
- );
59
- parent::includes($includes);
60
- do_action('bp_media_init');
61
- }
62
-
63
- /**
64
- * Initializes the global variables of the BuddyPress Media and its parent class.
65
- */
66
-
67
- /**
68
- *
69
- * @global type $bp
70
- */
71
- function setup_globals() {
72
- global $bp;
73
- $globals = array(
74
- 'slug' => BP_MEDIA_SLUG,
75
- 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : BP_MEDIA_SLUG,
76
- /* 'has_directory' => true, /* Set to false if not required */
77
- 'search_string' => __('Search Media...', BP_MEDIA_TXT_DOMAIN),
78
- );
79
- parent::setup_globals($globals);
80
- }
81
-
82
- /**
83
- *
84
- * @global type $bp
85
- */
86
- function setup_nav() {
87
- /* Add 'Media' to the main navigation */
88
- global $bp;
89
- $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
90
-
91
- $bp_media_image = new BPMediaScreen('image', BP_MEDIA_IMAGES_SLUG);
92
- $bp_media_video = new BPMediaScreen('video', BP_MEDIA_VIDEOS_SLUG);
93
- $bp_media_audio = new BPMediaScreen('audio', BP_MEDIA_AUDIO_SLUG);
94
-
95
- $bp_media_album = new BPMediaAlbumScreen('album', BP_MEDIA_ALBUMS_SLUG);
96
- switch ($bp->current_component) {
97
- case BP_MEDIA_IMAGES_SLUG:
98
- if (is_numeric($bp->current_action)) {
99
- $bp->action_variables[0] = $bp->current_action;
100
- $bp->current_action = BP_MEDIA_IMAGES_ENTRY_SLUG;
101
- }
102
- break;
103
- case BP_MEDIA_AUDIO_SLUG:
104
- if (is_numeric($bp->current_action)) {
105
- $bp->action_variables[0] = $bp->current_action;
106
- $bp->current_action = BP_MEDIA_AUDIO_ENTRY_SLUG;
107
- }
108
- break;
109
- case BP_MEDIA_VIDEOS_SLUG:
110
- if (is_numeric($bp->current_action)) {
111
- $bp->action_variables[0] = $bp->current_action;
112
- $bp->current_action = BP_MEDIA_VIDEOS_ENTRY_SLUG;
113
- }
114
- break;
115
- case BP_MEDIA_ALBUMS_SLUG:
116
- if (is_numeric($bp->current_action)) {
117
- $bp->action_variables[0] = $bp->current_action;
118
- $bp->current_action = BP_MEDIA_ALBUMS_ENTRY_SLUG;
119
- }
120
- break;
121
- }
122
-
123
-
124
-
125
- // -------------- Removed Upload as default tab ------------- //
126
- // if ( bp_is_my_profile() ) {
127
- // $main_nav = array(
128
- // 'name' => BP_MEDIA_LABEL,
129
- // 'slug' => BP_MEDIA_SLUG,
130
- // 'position' => 80,
131
- // 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
132
- // 'default_subnav_slug' => BP_MEDIA_UPLOAD_SLUG
133
- // );
134
- // } else {
135
- $main_nav = array(
136
- 'name' => __(BP_MEDIA_LABEL, BP_MEDIA_TXT_DOMAIN),
137
- 'slug' => BP_MEDIA_SLUG,
138
- 'position' => 80,
139
- 'screen_function' => array($bp_media_image, 'screen'),
140
- 'default_subnav_slug' => BP_MEDIA_IMAGES_SLUG
141
- );
142
- // }
143
- $sub_nav[] = array();
144
- parent::setup_nav($main_nav, $sub_nav);
145
- bp_core_new_nav_item(array(
146
- 'name' => __(BP_MEDIA_IMAGES_LABEL, BP_MEDIA_TXT_DOMAIN),
147
- 'slug' => BP_MEDIA_IMAGES_SLUG,
148
- 'screen_function' => array($bp_media_image, 'screen'),
149
- ));
150
-
151
-
152
- bp_core_new_subnav_item(array(
153
- 'name' => 'View', /* Display name for the nav item(It won't be shown anywhere) */
154
- 'slug' => BP_MEDIA_IMAGES_ENTRY_SLUG, /* URL slug for the nav item */
155
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG, /* URL slug of the parent nav item */
156
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_IMAGES_SLUG), /* URL of the parent item */
157
- 'position' => 90, /* Index of where this nav item should be positioned */
158
- 'screen_function' => array($bp_media_image, 'screen'), /* The name of the function to run when clicked */
159
- ));
160
-
161
- bp_core_new_subnav_item(array(
162
- 'name' => 'Edit', /* Display name for the nav item(It won't be shown anywhere) */
163
- 'slug' => BP_MEDIA_IMAGES_EDIT_SLUG, /* URL slug for the nav item */
164
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG, /* URL slug of the parent nav item */
165
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_IMAGES_SLUG), /* URL of the parent item */
166
- 'position' => 90, /* Index of where this nav item should be positioned */
167
- 'screen_function' => array($bp_media_image, 'edit_screen'), /* The name of the function to run when clicked */
168
- ));
169
-
170
- bp_core_new_subnav_item(array(
171
- 'name' => 'Delete', /* Display name for the nav item(It won't be shown anywhere) */
172
- 'slug' => BP_MEDIA_DELETE_SLUG, /* URL slug for the nav item */
173
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG, /* URL slug of the parent nav item */
174
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_IMAGES_SLUG), /* URL of the parent item */
175
- 'position' => 90, /* Index of where this nav item should be positioned */
176
- 'screen_function' => array($bp_media_image, 'screen'), /* The name of the function to run when clicked */
177
- ));
178
-
179
- bp_core_new_subnav_item(array(
180
- 'name' => 'Page', /* Display name for the nav item(It won't be shown anywhere) */
181
- 'slug' => 'page', /* URL slug for the nav item */
182
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG, /* URL slug of the parent nav item */
183
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_IMAGES_SLUG), /* URL of the parent item */
184
- 'position' => 90, /* Index of where this nav item should be positioned */
185
- 'screen_function' => array($bp_media_image, 'screen'), /* The name of the function to run when clicked */
186
- ));
187
-
188
-
189
- bp_core_new_nav_item(array(
190
- 'name' => __(BP_MEDIA_VIDEOS_LABEL, BP_MEDIA_TXT_DOMAIN),
191
- 'slug' => BP_MEDIA_VIDEOS_SLUG,
192
- 'screen_function' => array($bp_media_video, 'screen')
193
- ));
194
-
195
- bp_core_new_subnav_item(array(
196
- 'name' => 'Watch', /* Display name for the nav item(It won't be shown anywhere) */
197
- 'slug' => BP_MEDIA_VIDEOS_ENTRY_SLUG, /* URL slug for the nav item */
198
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG, /* URL slug of the parent nav item */
199
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_VIDEOS_SLUG), /* URL of the parent item */
200
- 'position' => 90, /* Index of where this nav item should be positioned */
201
- 'screen_function' => array($bp_media_video, 'screen'), /* The name of the function to run when clicked */
202
- ));
203
-
204
- bp_core_new_subnav_item(array(
205
- 'name' => 'Edit', /* Display name for the nav item(It won't be shown anywhere) */
206
- 'slug' => BP_MEDIA_VIDEOS_EDIT_SLUG, /* URL slug for the nav item */
207
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG, /* URL slug of the parent nav item */
208
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_VIDEOS_SLUG), /* URL of the parent item */
209
- 'position' => 90, /* Index of where this nav item should be positioned */
210
- 'screen_function' => array($bp_media_video, 'edit_screen'), /* The name of the function to run when clicked */
211
- ));
212
-
213
- bp_core_new_subnav_item(array(
214
- 'name' => 'Delete', /* Display name for the nav item(It won't be shown anywhere) */
215
- 'slug' => BP_MEDIA_DELETE_SLUG, /* URL slug for the nav item */
216
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG, /* URL slug of the parent nav item */
217
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_VIDEOS_SLUG), /* URL of the parent item */
218
- 'position' => 90, /* Index of where this nav item should be positioned */
219
- 'screen_function' => array($bp_media_video, 'screen'), /* The name of the function to run when clicked */
220
- ));
221
-
222
- bp_core_new_subnav_item(array(
223
- 'name' => 'Page', /* Display name for the nav item(It won't be shown anywhere) */
224
- 'slug' => 'page', /* URL slug for the nav item */
225
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG, /* URL slug of the parent nav item */
226
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_VIDEOS_SLUG), /* URL of the parent item */
227
- 'position' => 90, /* Index of where this nav item should be positioned */
228
- 'screen_function' => array($bp_media_video, 'screen'), /* The name of the function to run when clicked */
229
- ));
230
-
231
-
232
- bp_core_new_nav_item(array(
233
- 'name' => __(BP_MEDIA_AUDIO_LABEL, BP_MEDIA_TXT_DOMAIN),
234
- 'slug' => BP_MEDIA_AUDIO_SLUG,
235
- 'screen_function' => array($bp_media_audio, 'screen')
236
- ));
237
-
238
- bp_core_new_subnav_item(array(
239
- 'name' => 'Listen', /* Display name for the nav item(It won't be shown anywhere) */
240
- 'slug' => BP_MEDIA_AUDIO_ENTRY_SLUG, /* URL slug for the nav item */
241
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG, /* URL slug of the parent nav item */
242
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
243
- 'position' => 90, /* Index of where this nav item should be positioned */
244
- 'screen_function' => array($bp_media_audio, 'screen'), /* The name of the function to run when clicked */
245
- ));
246
-
247
- bp_core_new_subnav_item(array(
248
- 'name' => 'Edit', /* Display name for the nav item(It won't be shown anywhere) */
249
- 'slug' => BP_MEDIA_AUDIO_EDIT_SLUG, /* URL slug for the nav item */
250
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG, /* URL slug of the parent nav item */
251
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
252
- 'position' => 90, /* Index of where this nav item should be positioned */
253
- 'screen_function' => array($bp_media_audio, 'edit_screen'), /* The name of the function to run when clicked */
254
- ));
255
-
256
- bp_core_new_subnav_item(array(
257
- 'name' => 'Delete', /* Display name for the nav item(It won't be shown anywhere) */
258
- 'slug' => BP_MEDIA_DELETE_SLUG, /* URL slug for the nav item */
259
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG, /* URL slug of the parent nav item */
260
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
261
- 'position' => 90, /* Index of where this nav item should be positioned */
262
- 'screen_function' => array($bp_media_audio, 'screen'), /* The name of the function to run when clicked */
263
- ));
264
-
265
- bp_core_new_subnav_item(array(
266
- 'name' => 'Page', /* Display name for the nav item(It won't be shown anywhere) */
267
- 'slug' => 'page', /* URL slug for the nav item */
268
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG, /* URL slug of the parent nav item */
269
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
270
- 'position' => 90, /* Index of where this nav item should be positioned */
271
- 'screen_function' => array($bp_media_audio, 'screen'), /* The name of the function to run when clicked */
272
- ));
273
-
274
-
275
- bp_core_new_nav_item(array(
276
- 'name' => __(BP_MEDIA_ALBUMS_LABEL, BP_MEDIA_TXT_DOMAIN),
277
- 'slug' => BP_MEDIA_ALBUMS_SLUG,
278
- 'screen_function' => array($bp_media_album, 'screen'),
279
- ));
280
-
281
- bp_core_new_subnav_item(array(
282
- 'name' => 'View', /* Display name for the nav item(It won't be shown anywhere) */
283
- 'slug' => BP_MEDIA_ALBUMS_ENTRY_SLUG, /* URL slug for the nav item */
284
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG, /* URL slug of the parent nav item */
285
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_ALBUMS_SLUG), /* URL of the parent item */
286
- 'position' => 90, /* Index of where this nav item should be positioned */
287
- 'screen_function' => array($bp_media_album, 'screen'), /* The name of the function to run when clicked */
288
- ));
289
-
290
- bp_core_new_subnav_item(array(
291
- 'name' => 'Edit', /* Display name for the nav item(It won't be shown anywhere) */
292
- 'slug' => BP_MEDIA_ALBUMS_EDIT_SLUG, /* URL slug for the nav item */
293
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG, /* URL slug of the parent nav item */
294
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_ALBUMS_SLUG), /* URL of the parent item */
295
- 'position' => 90, /* Index of where this nav item should be positioned */
296
- 'screen_function' => array($bp_media_album, 'edit_screen'), /* The name of the function to run when clicked */
297
- ));
298
-
299
- bp_core_new_subnav_item(array(
300
- 'name' => 'Delete', /* Display name for the nav item(It won't be shown anywhere) */
301
- 'slug' => BP_MEDIA_DELETE_SLUG, /* URL slug for the nav item */
302
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG, /* URL slug of the parent nav item */
303
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_ALBUMS_SLUG), /* URL of the parent item */
304
- 'position' => 90, /* Index of where this nav item should be positioned */
305
- 'screen_function' => array($bp_media_album, 'screen'), /* The name of the function to run when clicked */
306
- ));
307
-
308
- bp_core_new_subnav_item(array(
309
- 'name' => 'Page', /* Display name for the nav item(It won't be shown anywhere) */
310
- 'slug' => 'page', /* URL slug for the nav item */
311
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG, /* URL slug of the parent nav item */
312
- 'parent_url' => trailingslashit(bp_loggedin_user_domain() . BP_MEDIA_ALBUMS_SLUG), /* URL of the parent item */
313
- 'position' => 90, /* Index of where this nav item should be positioned */
314
- 'screen_function' => array($bp_media_album, 'screen'), /* The name of the function to run when clicked */
315
- ));
316
- bp_core_new_nav_item(array(
317
- 'name' => __(BP_MEDIA_UPLOAD_LABEL, BP_MEDIA_TXT_DOMAIN),
318
- 'slug' => BP_MEDIA_UPLOAD_SLUG,
319
- 'screen_function' => array($bp_media_upload, 'upload_screen'),
320
- 'user_has_access' => bp_is_my_profile()
321
- ));
322
- }
323
-
324
- /**
325
- * Creating a custom post type album for BuddyPress Media
326
- */
327
- function register_post_types() {
328
- $labels = array(
329
- 'name' => __('Albums', BP_MEDIA_TXT_DOMAIN),
330
- 'singular_name' => __('Album', BP_MEDIA_TXT_DOMAIN),
331
- 'add_new' => __('Create', BP_MEDIA_TXT_DOMAIN),
332
- 'add_new_item' => __('Create Album', BP_MEDIA_TXT_DOMAIN),
333
- 'edit_item' => __('Edit Album', BP_MEDIA_TXT_DOMAIN),
334
- 'new_item' => __('New Album', BP_MEDIA_TXT_DOMAIN),
335
- 'all_items' => __('All Albums', BP_MEDIA_TXT_DOMAIN),
336
- 'view_item' => __('View Album', BP_MEDIA_TXT_DOMAIN),
337
- 'search_items' => __('Search Albums', BP_MEDIA_TXT_DOMAIN),
338
- 'not_found' => __('No album found', BP_MEDIA_TXT_DOMAIN),
339
- 'not_found_in_trash' => __('No album found in Trash', BP_MEDIA_TXT_DOMAIN),
340
- 'parent_item_colon' => '',
341
- 'menu_name' => __('Albums', BP_MEDIA_TXT_DOMAIN)
342
- );
343
-
344
- $args = array(
345
- 'labels' => $labels,
346
- 'public' => true,
347
- 'publicly_queryable' => true,
348
- 'show_ui' => false,
349
- 'show_in_menu' => false,
350
- 'query_var' => true,
351
- 'capability_type' => 'post',
352
- 'has_archive' => true,
353
- 'hierarchical' => false,
354
- 'menu_position' => null,
355
- 'supports' => array('title', 'author', 'thumbnail', 'excerpt', 'comments')
356
- );
357
- register_post_type('bp_media_album', $args);
358
- global $bp_media;
359
- /* Set up labels for the post type */
360
- $labels = array(
361
- 'name' => __('Media', BP_MEDIA_TXT_DOMAIN),
362
- 'singular' => __('Media', BP_MEDIA_TXT_DOMAIN),
363
- 'add_new' => __('Add New Media', BP_MEDIA_TXT_DOMAIN)
364
- );
365
-
366
- /* Set up the argument array for register_post_type() */
367
- $args = array(
368
- 'label' => __('Media', BP_MEDIA_TXT_DOMAIN),
369
- 'labels' => $labels,
370
- 'description' => __('BuddyPress Media\'s Media Files', BP_MEDIA_TXT_DOMAIN),
371
- 'public' => true,
372
- 'show_ui' => false,
373
- 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields')
374
- );
375
- register_post_type('bp_media', $args);
376
- parent::register_post_types();
377
- }
378
-
379
- }
380
-
381
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/includes/BPMediaFilters.php CHANGED
@@ -191,6 +191,20 @@ class BPMediaFilters {
191
  $query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
192
  return $query;
193
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
  /**
196
  * Added menu under buddypress menu 'my account' in admin bar
191
  $query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
192
  return $query;
193
  }
194
+
195
+ /**
196
+ *
197
+ * @global type $wpdb
198
+ * @param type $query
199
+ * @return type
200
+ */
201
+ static function group_activity_query_filter($query) {
202
+ global $wpdb,$bp;
203
+ $activity_meta_table = $bp->activity->table_name_meta;
204
+ $query = preg_replace("/LEFT JOIN/i", "LEFT JOIN $activity_meta_table am ON a.id = am.activity_id LEFT JOIN", $query);
205
+ $query = preg_replace("/a.component IN \( 'groups' \) AND a.item_id IN \((.*)\)/i", "( ( a.component IN ( 'groups' ) AND a.item_id IN ( $1 ) ) OR ( a.component IN ( 'media' ) AND am.meta_key = 'group_id' AND am.meta_value IN ( $1 ) ) )", $query);
206
+ return $query;
207
+ }
208
 
209
  /**
210
  * Added menu under buddypress menu 'my account' in admin bar
app/main/includes/BPMediaFunction.php CHANGED
@@ -5,7 +5,6 @@
5
  class BPMediaFunction {
6
 
7
  function __construct() {
8
- //add_action('bp_init', array($this,'swap_filters'));
9
  add_filter('bp_get_activity_action', array($this, 'conditional_override_allowed_tags'), 1, 2);
10
  add_action('wp_ajax_my_featured_action', array($this, 'implement_featured_ajax'));
11
  add_action('wp_ajax_nopriv_my_featured_action', array($this, 'implement_featured_ajax'));
@@ -90,16 +89,6 @@ class BPMediaFunction {
90
  echo '</div>';
91
  }
92
 
93
- /*
94
- function remove_kses_filter(){
95
- global $bp_media;
96
- if ($activity != null && in_array($activity->type, $bp_media->activity_types)) {
97
- remove_filter('bp_get_activity_content_body', 'bp_activity_filter_kses', 1);
98
- }
99
- }
100
- *
101
- */
102
-
103
  /**
104
  *
105
  * @global type $bp_media
@@ -117,15 +106,8 @@ class BPMediaFunction {
117
  return $content;
118
  }
119
 
120
- function swap_filters() {
121
- //add_filter('bp_get_activity_content_body', 'BPMediaFunction::conditional_override_allowed_tags', 2, 2);
122
- }
123
-
124
  /**
125
  * Updates the media count of all users.
126
- */
127
-
128
- /**
129
  *
130
  * @global type $wpdb
131
  * @return boolean
5
  class BPMediaFunction {
6
 
7
  function __construct() {
 
8
  add_filter('bp_get_activity_action', array($this, 'conditional_override_allowed_tags'), 1, 2);
9
  add_action('wp_ajax_my_featured_action', array($this, 'implement_featured_ajax'));
10
  add_action('wp_ajax_nopriv_my_featured_action', array($this, 'implement_featured_ajax'));
89
  echo '</div>';
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
92
  /**
93
  *
94
  * @global type $bp_media
106
  return $content;
107
  }
108
 
 
 
 
 
109
  /**
110
  * Updates the media count of all users.
 
 
 
111
  *
112
  * @global type $wpdb
113
  * @return boolean
app/main/includes/BPMediaHostWordpress.php CHANGED
@@ -26,7 +26,7 @@ class BPMediaHostWordpress {
26
  */
27
 
28
  /**
29
- *
30
  * @param type $media_id
31
  */
32
  function __construct($media_id = '') {
@@ -44,7 +44,7 @@ class BPMediaHostWordpress {
44
  */
45
 
46
  /**
47
- *
48
  * @param type $media_id
49
  * @return boolean
50
  * @throws Exception
@@ -89,7 +89,7 @@ class BPMediaHostWordpress {
89
  */
90
 
91
  /**
92
- *
93
  * @global type $bp
94
  * @global type $wpdb
95
  * @global type $bp_media_count
@@ -100,16 +100,24 @@ class BPMediaHostWordpress {
100
  * @param type $group
101
  * @param type $is_multiple
102
  * @throws Exception
 
103
  */
104
- function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false) {
105
  do_action('bp_media_before_add_media');
 
106
  global $bp, $wpdb, $bp_media_count, $bp_media;
107
  include_once(ABSPATH . 'wp-admin/includes/file.php');
108
  include_once(ABSPATH . 'wp-admin/includes/image.php');
109
 
110
  $post_id = $this->check_and_create_album($album_id, $group);
111
 
112
- $file = wp_handle_upload($_FILES['bp_media_file']);
 
 
 
 
 
 
113
  if (isset($file['error']) || $file === null) {
114
  throw new Exception(__('Error Uploading File', BP_MEDIA_TXT_DOMAIN));
115
  }
@@ -201,7 +209,7 @@ class BPMediaHostWordpress {
201
  $activity_content = false;
202
  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));
203
  }
204
- $attachment_id = wp_insert_attachment($attachment, $file, $post_id);
205
  if (!is_wp_error($attachment_id)) {
206
  wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
207
  } else {
@@ -222,7 +230,8 @@ class BPMediaHostWordpress {
222
  } else {
223
  update_post_meta($attachment_id, 'bp-media-key', (-$group));
224
  }
225
- do_action('bp_media_after_add_media', $this, $is_multiple);
 
226
  }
227
 
228
  /**
@@ -231,7 +240,7 @@ class BPMediaHostWordpress {
231
  */
232
 
233
  /**
234
- *
235
  * @global type $bp_media_counter
236
  * @global type $bp_media_default_excerpts
237
  * @global type $bp_media
@@ -240,7 +249,7 @@ class BPMediaHostWordpress {
240
  function get_media_activity_content() {
241
  global $bp_media_counter, $bp_media_default_excerpts, $bp_media;
242
  $attachment_id = $this->id;
243
- $activity_content = '<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>';
244
  $activity_content .='<div class="bp_media_content">';
245
  switch ($this->type) {
246
  case 'video' :
@@ -264,7 +273,7 @@ class BPMediaHostWordpress {
264
  return false;
265
  }
266
  $activity_content .= '</div>';
267
- $activity_content .= '<div class="bp_media_description">' . wp_html_excerpt($this->description, $bp_media_default_excerpts['activity_entry_description']) . '</div>';
268
  return $activity_content;
269
  }
270
 
@@ -273,7 +282,7 @@ class BPMediaHostWordpress {
273
  */
274
 
275
  /**
276
- *
277
  * @return boolean
278
  */
279
  function get_media_activity_url() {
@@ -288,7 +297,7 @@ class BPMediaHostWordpress {
288
  */
289
 
290
  /**
291
- *
292
  * @global type $bp_media
293
  * @return boolean
294
  */
@@ -305,7 +314,7 @@ class BPMediaHostWordpress {
305
  */
306
 
307
  /**
308
- *
309
  * @global type $bp_media_default_excerpts
310
  * @global type $bp_media
311
  * @return boolean|string
@@ -349,7 +358,7 @@ class BPMediaHostWordpress {
349
  */
350
 
351
  /**
352
- *
353
  * @global type $bp_media_default_excerpts
354
  * @global type $bp_media
355
  * @return string
@@ -365,7 +374,7 @@ class BPMediaHostWordpress {
365
  */
366
 
367
  /**
368
- *
369
  * @global type $bp_media
370
  * @return boolean
371
  */
@@ -435,7 +444,7 @@ class BPMediaHostWordpress {
435
  */
436
 
437
  /**
438
- *
439
  * @global type $bp_media
440
  * @return boolean
441
  */
@@ -457,29 +466,29 @@ class BPMediaHostWordpress {
457
  <ul id="activity-stream" class="activity-list item-list">
458
  <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
459
  <div class="activity-content">
460
- <?php do_action('bp_activity_entry_content'); ?>
461
- <?php if (is_user_logged_in()) : ?>
462
  <div class="activity-meta no-ajax">
463
  <?php if (bp_activity_can_comment()) : ?>
464
  <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>
465
- <?php endif; ?>
466
- <?php if (bp_activity_can_favorite()) : ?>
467
- <?php if (!bp_get_activity_is_favorite()) : ?>
468
  <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>
469
- <?php else : ?>
470
  <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>
 
471
  <?php endif; ?>
472
- <?php endif; ?>
473
- <?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?>
474
- <?php do_action('bp_activity_entry_meta'); ?>
475
  </div>
476
- <?php endif; ?>
477
  </div>
478
- <?php do_action('bp_before_activity_entry_comments'); ?>
479
- <?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?>
480
  <div class="activity-comments">
481
- <?php bp_activity_comments(); ?>
482
- <?php if (is_user_logged_in()) : ?>
483
  <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(); ?>>
484
  <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div>
485
  <div class="ac-reply-content">
@@ -489,31 +498,31 @@ class BPMediaHostWordpress {
489
  <input type="submit" name="ac_form_submit" value="<?php _e('Post', BP_MEDIA_TXT_DOMAIN); ?>" /> &nbsp; <?php _e('or press esc to cancel.', BP_MEDIA_TXT_DOMAIN); ?>
490
  <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
491
  </div>
492
- <?php do_action('bp_activity_entry_comments'); ?>
493
- <?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
494
  </form>
495
- <?php endif; ?>
496
  </div>
497
- <?php endif; ?>
498
- <?php do_action('bp_after_activity_entry_comments'); ?>
499
  </li>
500
  </ul>
501
  </div>
502
- <?php
503
- }
504
- }
505
- else {
506
- ?>
507
  <div class="activity">
508
  <ul id="activity-stream" class="activity-list item-list">
509
  <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
510
  <div class="activity-content">
511
- <?php do_action('bp_activity_entry_content'); ?>
512
- <?php if (is_user_logged_in()) : ?>
513
  <div class="activity-meta no-ajax">
514
  <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>
515
  </div>
516
- <?php endif; ?>
517
  </div>
518
  </li>
519
  </ul>
@@ -527,7 +536,7 @@ class BPMediaHostWordpress {
527
  */
528
 
529
  /**
530
- *
531
  * @return type
532
  */
533
  function get_url() {
@@ -539,7 +548,7 @@ class BPMediaHostWordpress {
539
  */
540
 
541
  /**
542
- *
543
  * @return type
544
  */
545
  function get_attachment_url() {
@@ -558,7 +567,7 @@ class BPMediaHostWordpress {
558
  */
559
 
560
  /**
561
- *
562
  * @param type $args
563
  * @return type
564
  */
@@ -585,7 +594,7 @@ class BPMediaHostWordpress {
585
  */
586
 
587
  /**
588
- *
589
  * @global type $wpdb
590
  * @global type $bp
591
  * @global type $current_user
@@ -622,7 +631,7 @@ class BPMediaHostWordpress {
622
  */
623
 
624
  /**
625
- *
626
  * @global type $bp_media_count
627
  */
628
  function delete_media() {
@@ -650,7 +659,7 @@ class BPMediaHostWordpress {
650
  */
651
 
652
  /**
653
- *
654
  * @return boolean|string
655
  */
656
  function get_album_activity_content() {
@@ -692,7 +701,7 @@ class BPMediaHostWordpress {
692
  */
693
 
694
  /**
695
- *
696
  * @return type
697
  */
698
  function get_content() {
@@ -704,7 +713,7 @@ class BPMediaHostWordpress {
704
  */
705
 
706
  /**
707
- *
708
  * @return type
709
  */
710
  function get_author() {
@@ -716,7 +725,7 @@ class BPMediaHostWordpress {
716
  */
717
 
718
  /**
719
- *
720
  * @return type
721
  */
722
  function get_id() {
@@ -728,7 +737,7 @@ class BPMediaHostWordpress {
728
  */
729
 
730
  /**
731
- *
732
  * @return type
733
  */
734
  function get_edit_url() {
@@ -740,7 +749,7 @@ class BPMediaHostWordpress {
740
  */
741
 
742
  /**
743
- *
744
  * @return type
745
  */
746
  function get_delete_url() {
@@ -752,7 +761,7 @@ class BPMediaHostWordpress {
752
  */
753
 
754
  /**
755
- *
756
  * @return string
757
  */
758
  function get_media_activity_type() {
@@ -773,7 +782,7 @@ class BPMediaHostWordpress {
773
  */
774
 
775
  /**
776
- *
777
  * @return type
778
  */
779
  function get_album_id() {
@@ -785,7 +794,7 @@ class BPMediaHostWordpress {
785
  */
786
 
787
  /**
788
- *
789
  * @return type
790
  */
791
  function get_title() {
@@ -797,7 +806,7 @@ class BPMediaHostWordpress {
797
  */
798
 
799
  /**
800
- *
801
  * @return type
802
  */
803
  function get_type() {
@@ -816,7 +825,7 @@ class BPMediaHostWordpress {
816
  */
817
 
818
  /**
819
- *
820
  * @return type
821
  */
822
  function get_group_id() {
@@ -829,7 +838,7 @@ class BPMediaHostWordpress {
829
  */
830
 
831
  /**
832
- *
833
  * @return boolean
834
  */
835
  protected function set_permalinks() {
@@ -876,7 +885,7 @@ class BPMediaHostWordpress {
876
  */
877
 
878
  /**
879
- *
880
  * @global type $wpdb
881
  * @param type $album_id
882
  * @param type $group
26
  */
27
 
28
  /**
29
+ *
30
  * @param type $media_id
31
  */
32
  function __construct($media_id = '') {
44
  */
45
 
46
  /**
47
+ *
48
  * @param type $media_id
49
  * @return boolean
50
  * @throws Exception
89
  */
90
 
91
  /**
92
+ *
93
  * @global type $bp
94
  * @global type $wpdb
95
  * @global type $bp_media_count
100
  * @param type $group
101
  * @param type $is_multiple
102
  * @throws Exception
103
+ * @uses global var $_FILES
104
  */
105
+ function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false) {
106
  do_action('bp_media_before_add_media');
107
+
108
  global $bp, $wpdb, $bp_media_count, $bp_media;
109
  include_once(ABSPATH . 'wp-admin/includes/file.php');
110
  include_once(ABSPATH . 'wp-admin/includes/image.php');
111
 
112
  $post_id = $this->check_and_create_album($album_id, $group);
113
 
114
+ if (!$files) {
115
+ $files = $_FILES['bp_media_file'];
116
+ $file = wp_handle_upload($files);
117
+ } else {
118
+ $file = wp_handle_sideload($files);
119
+ }
120
+
121
  if (isset($file['error']) || $file === null) {
122
  throw new Exception(__('Error Uploading File', BP_MEDIA_TXT_DOMAIN));
123
  }
209
  $activity_content = false;
210
  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));
211
  }
212
+ echo $attachment_id = wp_insert_attachment($attachment, $file, $post_id);
213
  if (!is_wp_error($attachment_id)) {
214
  wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
215
  } else {
230
  } else {
231
  update_post_meta($attachment_id, 'bp-media-key', (-$group));
232
  }
233
+ do_action('bp_media_after_add_media', $this, $is_multiple, $is_activity, $group);
234
+ return $attachment_id;
235
  }
236
 
237
  /**
240
  */
241
 
242
  /**
243
+ *
244
  * @global type $bp_media_counter
245
  * @global type $bp_media_default_excerpts
246
  * @global type $bp_media
249
  function get_media_activity_content() {
250
  global $bp_media_counter, $bp_media_default_excerpts, $bp_media;
251
  $attachment_id = $this->id;
252
+ $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>');
253
  $activity_content .='<div class="bp_media_content">';
254
  switch ($this->type) {
255
  case 'video' :
273
  return false;
274
  }
275
  $activity_content .= '</div>';
276
+ $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>');
277
  return $activity_content;
278
  }
279
 
282
  */
283
 
284
  /**
285
+ *
286
  * @return boolean
287
  */
288
  function get_media_activity_url() {
297
  */
298
 
299
  /**
300
+ *
301
  * @global type $bp_media
302
  * @return boolean
303
  */
314
  */
315
 
316
  /**
317
+ *
318
  * @global type $bp_media_default_excerpts
319
  * @global type $bp_media
320
  * @return boolean|string
358
  */
359
 
360
  /**
361
+ *
362
  * @global type $bp_media_default_excerpts
363
  * @global type $bp_media
364
  * @return string
374
  */
375
 
376
  /**
377
+ *
378
  * @global type $bp_media
379
  * @return boolean
380
  */
444
  */
445
 
446
  /**
447
+ *
448
  * @global type $bp_media
449
  * @return boolean
450
  */
466
  <ul id="activity-stream" class="activity-list item-list">
467
  <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
468
  <div class="activity-content">
469
+ <?php do_action('bp_activity_entry_content'); ?>
470
+ <?php if (is_user_logged_in()) : ?>
471
  <div class="activity-meta no-ajax">
472
  <?php if (bp_activity_can_comment()) : ?>
473
  <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>
474
+ <?php endif; ?>
475
+ <?php if (bp_activity_can_favorite()) : ?>
476
+ <?php if (!bp_get_activity_is_favorite()) : ?>
477
  <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>
478
+ <?php else : ?>
479
  <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>
480
+ <?php endif; ?>
481
  <?php endif; ?>
482
+ <?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?>
483
+ <?php do_action('bp_activity_entry_meta'); ?>
 
484
  </div>
485
+ <?php endif; ?>
486
  </div>
487
+ <?php do_action('bp_before_activity_entry_comments'); ?>
488
+ <?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?>
489
  <div class="activity-comments">
490
+ <?php bp_activity_comments(); ?>
491
+ <?php if (is_user_logged_in()) : ?>
492
  <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(); ?>>
493
  <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div>
494
  <div class="ac-reply-content">
498
  <input type="submit" name="ac_form_submit" value="<?php _e('Post', BP_MEDIA_TXT_DOMAIN); ?>" /> &nbsp; <?php _e('or press esc to cancel.', BP_MEDIA_TXT_DOMAIN); ?>
499
  <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
500
  </div>
501
+ <?php do_action('bp_activity_entry_comments'); ?>
502
+ <?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
503
  </form>
504
+ <?php endif; ?>
505
  </div>
506
+ <?php endif; ?>
507
+ <?php do_action('bp_after_activity_entry_comments'); ?>
508
  </li>
509
  </ul>
510
  </div>
511
+ <?php
512
+ }
513
+ }
514
+ else {
515
+ ?>
516
  <div class="activity">
517
  <ul id="activity-stream" class="activity-list item-list">
518
  <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
519
  <div class="activity-content">
520
+ <?php do_action('bp_activity_entry_content'); ?>
521
+ <?php if (is_user_logged_in()) : ?>
522
  <div class="activity-meta no-ajax">
523
  <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>
524
  </div>
525
+ <?php endif; ?>
526
  </div>
527
  </li>
528
  </ul>
536
  */
537
 
538
  /**
539
+ *
540
  * @return type
541
  */
542
  function get_url() {
548
  */
549
 
550
  /**
551
+ *
552
  * @return type
553
  */
554
  function get_attachment_url() {
567
  */
568
 
569
  /**
570
+ *
571
  * @param type $args
572
  * @return type
573
  */
594
  */
595
 
596
  /**
597
+ *
598
  * @global type $wpdb
599
  * @global type $bp
600
  * @global type $current_user
631
  */
632
 
633
  /**
634
+ *
635
  * @global type $bp_media_count
636
  */
637
  function delete_media() {
659
  */
660
 
661
  /**
662
+ *
663
  * @return boolean|string
664
  */
665
  function get_album_activity_content() {
701
  */
702
 
703
  /**
704
+ *
705
  * @return type
706
  */
707
  function get_content() {
713
  */
714
 
715
  /**
716
+ *
717
  * @return type
718
  */
719
  function get_author() {
725
  */
726
 
727
  /**
728
+ *
729
  * @return type
730
  */
731
  function get_id() {
737
  */
738
 
739
  /**
740
+ *
741
  * @return type
742
  */
743
  function get_edit_url() {
749
  */
750
 
751
  /**
752
+ *
753
  * @return type
754
  */
755
  function get_delete_url() {
761
  */
762
 
763
  /**
764
+ *
765
  * @return string
766
  */
767
  function get_media_activity_type() {
782
  */
783
 
784
  /**
785
+ *
786
  * @return type
787
  */
788
  function get_album_id() {
794
  */
795
 
796
  /**
797
+ *
798
  * @return type
799
  */
800
  function get_title() {
806
  */
807
 
808
  /**
809
+ *
810
  * @return type
811
  */
812
  function get_type() {
825
  */
826
 
827
  /**
828
+ *
829
  * @return type
830
  */
831
  function get_group_id() {
838
  */
839
 
840
  /**
841
+ *
842
  * @return boolean
843
  */
844
  protected function set_permalinks() {
885
  */
886
 
887
  /**
888
+ *
889
  * @global type $wpdb
890
  * @param type $album_id
891
  * @param type $group
app/main/includes/BPMediaUtils.php DELETED
@@ -1,806 +0,0 @@
1
- <?php
2
-
3
- class BPMediaUtils {
4
-
5
- function __construct() {
6
- if (version_compare(BP_MEDIA_DB_VERSION, get_site_option('bp_media_db_version', '1.0'), '>')) {
7
- add_action('admin_notices', array($this,'upgrade_db_notice'));
8
- }
9
- add_action('wp_loaded', array($this,'upgrade_script'));
10
- add_action(bp_core_admin_hook(), array($this,'add_admin_menu'));
11
- add_action('admin_init', array($this,'on_load_page'));
12
- add_action('wp_ajax_bp_media_cancel_request', array($this,'cancel_request'));
13
- add_action('wp_ajax_bp_media_request_type', array($this,'handle_request_type'));
14
- add_action('admin_enqueue_scripts', array($this,'admin_enqueue'));
15
- add_action('bp_admin_tabs', array($this,'admin_tab'));
16
- }
17
-
18
- function upgrade_script() {
19
- if (isset($_GET['bp_media_upgrade_db']) && empty($_REQUEST['settings-updated'])) {
20
- check_admin_referer('bp_media_upgrade_db', 'wp_nonce');
21
- require_once('bp-media-upgrade-script.php');
22
- $current_version = get_site_option('bp_media_db_version', '1.0');
23
- if ($current_version == '2.0')
24
- BPMediaUpgradeScript::upgrade_from_2_0_to_2_1();
25
- else
26
- BPMediaUpgradeScript::upgrade_from_1_0_to_2_1();
27
- remove_action('admin_notices', array($this,'upgrade_db_notice'));
28
- }
29
- }
30
-
31
- /**
32
- * Displays admin notice to upgrade BuddyPress Media Database
33
- */
34
- function upgrade_db_notice() {
35
- ?>
36
- <div class="error"><p>
37
- Please click upgrade to upgrade the database of BuddyPress Media <a class="button" id="refresh_media_count" href ="<?php echo bp_media_get_admin_url(add_query_arg(array('page' => 'bp-media-settings', 'bp_media_upgrade_db' => 1, 'wp_nonce' => wp_create_nonce('bp_media_upgrade_db')), 'admin.php')) ?>" class="button" title="<?php printf(__('It will migrate your BuddyPress Media\'s earlier database to new database.')); ?>">Upgrade</a>
38
- </p></div>
39
- <?php
40
- }
41
-
42
- /**
43
- * Add the BuddyPress Media's options menu in the BuddyPress' options subnavigation.
44
- *
45
- * @since BuddyPress Media 2.0
46
- */
47
- function add_admin_menu() {
48
-
49
- global $bp, $bp_media_errors, $bp_media_messages;
50
- if (!is_super_admin())
51
- return false;
52
- $bp_media_errors = array();
53
- $bp_media_messages = array();
54
- global $bp_media_options;
55
- $bp_media_options = get_site_option('bp_media_options', array(
56
- 'videos_enabled' => true,
57
- 'audio_enabled' => true,
58
- 'images_enabled' => true,
59
- 'download_enabled' => true,
60
- 'remove_linkback' => 1,
61
- ));
62
- if (isset($_POST['submit'])) {
63
- if (isset($_POST['bp_media_options'])) {
64
- foreach ($bp_media_options as $option => $value) {
65
- if (isset($_POST['bp_media_options'][$option])) {
66
- switch ($_POST['bp_media_options'][$option]) {
67
- case 'true' :
68
- $bp_media_options[$option] = true;
69
- break;
70
- case '1' :
71
- $bp_media_options[$option] = 1;
72
- break;
73
- case '2' :
74
- $bp_media_options[$option] = 2;
75
- break;
76
- default :
77
- $bp_media_options[$option] = false;
78
- }
79
- } else {
80
- $bp_media_options[$option] = false;
81
- }
82
- }
83
- if (update_site_option('bp_media_options', $bp_media_options)) {
84
- $bp_media_messages[0] = "<b>Settings saved.</b>";
85
- }
86
- }
87
- do_action('bp_media_save_options');
88
- $bp_media_messages = apply_filters('bp_media_settings_messages', $bp_media_messages);
89
- $bp_media_errors = apply_filters('bp_media_settings_errors', $bp_media_errors);
90
- } else if (isset($_GET['bp_media_refresh_count'])) {
91
-
92
- check_admin_referer('bp_media_refresh_count', 'wp_nonce');
93
- if (!BPMediaFunction::update_count())
94
- $bp_media_errors[] = "<b>Recounting Failed</b>";
95
- else
96
- $bp_media_messages[] = "<b>Recounting of media files done successfully</b>";
97
- }else if (isset($_REQUEST['submit-report'])) {
98
-
99
- if (empty($_REQUEST['ur_name'])) {
100
- $bp_media_errors[] = "<b>Please Enter Name</b>";
101
- }
102
- if (empty($_REQUEST['ur_email'])) {
103
- $bp_media_errors[] = "<b>Please Enter Valid Email Address</b>";
104
- }
105
- if (!empty($_REQUEST['ur_email']) && !is_email(trim($_REQUEST['ur_email']))) {
106
- $bp_media_errors[] = "<b>Please Enter Valid Email Address</b>";
107
- }
108
- if (empty($_REQUEST['ur_subject'])) {
109
- $bp_media_errors[] = "<b>Please Enter Subject</b>";
110
- }
111
- if (empty($_REQUEST['ur_query'])) {
112
- $bp_media_errors[] = "<b>Please Enter Details</b>";
113
- }
114
- if (isset($_REQUEST['request_type']) && $_REQUEST['request_type'] == 'bug_report') {
115
- if (!file_exists(BP_MEDIA_TMP_DIR) && @!mkdir(BP_MEDIA_TMP_DIR, 0777))
116
- $bp_media_errors[] = "The Buddypress Media Temporary directory does not exist and could not be created. Please check that directory have write permissions for the 'uploads' directory. ";
117
- }
118
- if (empty($bp_media_errors)) {
119
-
120
- $attachments = array();
121
- $str_to = BP_MEDIA_SUPPORT_EMAIL;
122
- $str_subject = html_entity_decode(esc_attr(stripslashes($_REQUEST['ur_subject'])), ENT_QUOTES, 'UTF-8');
123
-
124
- $request_type = $_REQUEST['request_type'];
125
- $request_id = $_REQUEST['request_id'];
126
- $server_address = $_REQUEST['server_address'];
127
- $ip_address = $_REQUEST['ip_address'];
128
- $server_type = $_REQUEST['server_type'];
129
- $user_agent = $_REQUEST['user_agent'];
130
- $str_message = '';
131
- $str_title = ($request_type == 'bug_report') ? 'Bug Report' : 'New Feature Request';
132
- switch ($request_type) {
133
- case "bug_report":
134
- $str_title = __('Bug Report', BP_MEDIA_TXT_DOMAIN);
135
- break;
136
- case "new_feature":
137
- $str_title = __('New Feature Request', BP_MEDIA_TXT_DOMAIN);
138
- break;
139
- case "premium_support":
140
- $str_title = __('Premium Support Request', BP_MEDIA_TXT_DOMAIN);
141
- break;
142
- }
143
- $str_message .= "<h3><strong>$str_title</strong></h3>";
144
-
145
- $str_message .= "<table>";
146
- if (isset($_REQUEST['request_id']))
147
- $str_message .= "<tr><td><strong>Request Id : </strong></td><td>" . $_REQUEST['request_id'] . "</td></tr>";
148
- if (isset($_REQUEST['ip_address']))
149
- $str_message .= "<tr><td><strong>Request IP Address : </strong></td><td>" . $_REQUEST['ip_address'] . "</td></tr>";
150
- if (isset($_REQUEST['server_address']))
151
- $str_message .= "<tr><td><strong>Request Server Address : </strong></td><td>" . $_REQUEST['server_address'] . "</td></tr>";
152
- if (isset($_REQUEST['server_type']))
153
- $str_message .= "<tr><td><strong>Request Server Type : </strong></td><td>" . $_REQUEST['server_type'] . "</td></tr>";
154
- if (isset($_REQUEST['user_agent']))
155
- $str_message .= "<tr><td><strong>Request User Agent : </strong></td><td>" . $_REQUEST['user_agent'] . "</td></tr>";
156
- if (BP_MEDIA_VERSION)
157
- $str_message .= "<tr><td><strong>Buddypress Media Version : </strong></td><td>" . BP_MEDIA_VERSION . "</td></tr>";
158
- if (isset($_REQUEST['ur_name']))
159
- $str_message .= "<tr><td><strong>Name : </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_name']))) . "</td></tr>";
160
- if (isset($_REQUEST['ur_phone']))
161
- $str_message .= "<tr><td><strong>Phone No. : </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_phone']))) . "</td></tr>";
162
- $str_message .= "</table><br/><br/>";
163
-
164
- if ($request_type == 'bug_report') {
165
-
166
- $str_message .= "<h3><strong>Wordpress and Hosting Details</strong></h3>";
167
- $str_message .= "<table>";
168
-
169
- if (isset($_REQUEST['ur_wp_admin_login']))
170
- $str_message .= "<tr><td><strong>WP Admin Login : </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_wp_admin_login']))) . "</td></tr>";
171
- if (isset($_REQUEST['ur_wp_admin_pwd']))
172
- $str_message .= "<tr><td><strong>WP Admin Password : </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_wp_admin_pwd']))) . "</td></tr>";
173
- if (isset($_REQUEST['ur_ssh_ftp_host']))
174
- $str_message .= "<tr><td><strong>SSH / FTP Host : </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_ssh_ftp_host']))) . "</td></tr>";
175
- if (isset($_REQUEST['ur_ssh_ftp_login']))
176
- $str_message .= "<tr><td><strong>SSH / FTP Login: </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_ssh_ftp_login']))) . "</td></tr>";
177
- if (isset($_REQUEST['ur_ssh_ftp_pwd']))
178
- $str_message .= "<tr><td><strong>SSH / FTP Password: </strong></td><td>" . esc_attr(stripslashes(trim($_REQUEST['ur_ssh_ftp_pwd']))) . "</td></tr>";
179
- $str_message .= "</table><br/><br/>";
180
-
181
-
182
- /* Create server info file */
183
- $server_data = $this->get_server_info();
184
- $server_info = '';
185
- if (!empty($server_data)) {
186
- $server_info .= '<table cellpadding="2px" >';
187
- foreach ($server_data as $key => $val) {
188
- $server_info .= '<tr><th><strong>' . $key . '</strong></th></th></tr>';
189
- foreach ($val as $title => $content) {
190
- $server_info .= '<tr>';
191
- $server_info .= '<td valign = "top"><strong>' . $title . '</strong></td>';
192
- if (is_array($content)) {
193
- $server_info .= '<td valign = "top"><table>';
194
- foreach ($content as $sub_title => $sub_content) {
195
- $server_info .= '<tr>';
196
- $server_info .= '<td valign = "top"><strong>' . $sub_title . '</strong></td>';
197
- $server_info .= '<td valign = "top">' . print_r($sub_content, true) . '</td>';
198
- $server_info .= '</tr>';
199
- }
200
- $server_info .= '</table></td>';
201
- } else {
202
- $server_info .= '<td>' . $content . '</td>';
203
- }
204
-
205
- $server_info .= '</tr>';
206
- $server_info .= '<tr><td></td><td></td></tr>';
207
- }
208
- }
209
- $server_info .= '</table>';
210
- }
211
-
212
- $server_info_path = BP_MEDIA_TMP_DIR . '/server_info.html';
213
-
214
- if (@file_put_contents($server_info_path, $server_info)) {
215
- $attachments[] = $server_info_path;
216
- }
217
-
218
- /* Create phpinfo file and attach to Email */
219
- if (isset($_REQUEST['ur_send_phpinfo']) && $_REQUEST['ur_send_phpinfo'] == 'true') {
220
- ob_start();
221
- phpinfo();
222
- $php_info = ob_get_contents();
223
- ob_end_clean();
224
-
225
- $php_info_path = BP_MEDIA_TMP_DIR . '/php_info.html';
226
- if (@file_put_contents($php_info_path, $php_info)) {
227
- $attachments[] = $php_info_path;
228
- }
229
- }
230
- /* Attach other files */
231
- if (!empty($_FILES['ur_attachment'])) {
232
- $files = (array) $_FILES['ur_attachment'];
233
- for ($i = 0, $l = count($files); $i < $l; $i++) {
234
- if (isset($files['tmp_name'][$i]) && isset($files['name'][$i]) && isset($files['error'][$i]) && $files['error'][$i] == UPLOAD_ERR_OK) {
235
- $path = BP_MEDIA_TMP_DIR . '/' . $files['name'][$i];
236
- if (@move_uploaded_file($files['tmp_name'][$i], $path)) {
237
- $attachments[] = $path;
238
- }
239
- }
240
- }
241
- }
242
-
243
- /* if(isset($_REQUEST['ur_templates'])){
244
- $templates = $_REQUEST['ur_templates'];
245
- if(!empty($templates)){
246
- foreach ($templates as $template) {
247
- if (!empty($template)) {
248
- $attachments[] = $template;
249
- }
250
- }
251
- }
252
- } */
253
- }
254
- $str_message .= nl2br(esc_attr(stripslashes($_REQUEST['ur_query'])));
255
-
256
-
257
- /* Uniqid Session */
258
- $strSid = md5(uniqid(time()));
259
-
260
- /* Creating Header */
261
- $str_header = "";
262
- $str_header .= "From: " . $_REQUEST['ur_name'] . "<" . $_REQUEST['ur_email'] . ">";
263
- $str_header .= "Reply-To: " . $_REQUEST['ur_name'] . "<" . $_REQUEST['ur_email'] . ">";
264
-
265
- $str_header .= "MIME-Version: 1.0\n";
266
- $str_header .= "Content-Type: multipart/mixed; boundary=\"" . $strSid . "\"\n\n";
267
- $str_header .= "Content-type: text/html; charset=utf-8\n";
268
- $str_header .= "Content-Transfer-Encoding: 7bit\n\n";
269
-
270
- $flgSend = wp_mail($str_to, $str_subject, $str_message, $str_header, $attachments); // @ = No Show Error //
271
-
272
- /* Delete temporary files */
273
- if (!empty($attachments)) {
274
- foreach ($attachments as $attachment) {
275
- if (strstr($attachment, BP_MEDIA_TMP_DIR) !== false) {
276
- @unlink($attachment);
277
- }
278
- }
279
- }
280
- if ($flgSend) {
281
- switch ($request_type) {
282
- case "bug_report":
283
- $succ_msg = __('Thank you, Your bug report sent successfully.', BP_MEDIA_TXT_DOMAIN);
284
- break;
285
- case "new_feature":
286
- $succ_msg = __('Thank you, Your new feature request sent successfully.', BP_MEDIA_TXT_DOMAIN);
287
- break;
288
- case "premium_support":
289
- $succ_msg = __('Thank you, Your premium support request sent successfully, We will contact you soon.', BP_MEDIA_TXT_DOMAIN);
290
- break;
291
- }
292
- $bp_media_messages[] = '<strong>' . $succ_msg . '</strong>';
293
- } else {
294
- $bp_media_errors[] = "<strong>Mail could not be sent</strong>";
295
- }
296
- }
297
- }
298
-
299
- if (isset($bp_media_errors) && count($bp_media_errors)) {
300
- ?>
301
- <div class="error"><p><?php foreach ($bp_media_errors as $error)
302
- echo $error . '<br/>'; ?></p></div><?php } if (isset($bp_media_messages) && count($bp_media_messages)) {
303
- ?>
304
- <div class="updated"><p><?php foreach ($bp_media_messages as $message)
305
- echo $message . '<br/>'; ?></p></div><?php
306
- }
307
-
308
- add_menu_page('Buddypress Media Component', 'BuddyPress Media', 'manage_options', 'bp-media-settings', array($this,'settings_page'));
309
- 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"));
310
- 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,"settings_page"));
311
- 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,"settings_page"));
312
-
313
- $tab = BPMediaAdmin::get_current_tab();
314
- add_action('admin_print_styles-' . $tab, array($this,'admin_enqueue'));
315
- }
316
-
317
- /**
318
- * Applies WordPress metabox funtionality to metaboxes
319
- *
320
- *
321
- */
322
- function on_load_page() {
323
-
324
- /* Javascripts loaded to allow drag/drop, expand/collapse and hide/show of boxes. */
325
- wp_enqueue_script('common');
326
- wp_enqueue_script('wp-lists');
327
- wp_enqueue_script('postbox');
328
-
329
- // Check to see which tab we are on
330
- $tab = BPMediaAdmin::get_current_tab();
331
-
332
- switch ($tab) {
333
- case 'bp-media-addons' :
334
- // All metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
335
- add_meta_box('addons_list_metabox', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($this,'addons_list'), 'bp-media-settings', 'normal', 'core');
336
- break;
337
- case 'bp-media-support' :
338
- // All metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
339
- add_meta_box('bp_media_support_metabox', __('BuddyPress Media Support', 'rtPanel'), array($this,'bp_media_support'), 'bp-media-settings', 'normal', 'core');
340
- add_meta_box('bp_media_form_report_metabox', __('Submit a request form', 'rtPanel'), array($this,'send_request'), 'bp-media-settings', 'normal', 'core');
341
- break;
342
- case $tab :
343
- // All metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
344
- add_meta_box('bp_media_settings_metabox', __('BuddyPress Media Settings', 'rtPanel'), 'bp_media_admin_menu', 'bp-media-settings', 'normal', 'core');
345
- add_meta_box('bp_media_options_metabox', __('Spread the word', 'rtPanel'), array($this,'settings_options'), 'bp-media-settings', 'normal', 'core');
346
- add_meta_box('bp_media_other_options_metabox', __('BuddyPress Media Other options', 'rtPanel'), array($this,'settings_other_options'), 'bp-media-settings', 'normal', 'core');
347
- break;
348
- }
349
- }
350
-
351
- function settings_page() {
352
-
353
- $tab = BPMediaAdmin::get_current_tab();
354
- ?>
355
-
356
- <div class="wrap bp-media-admin">
357
- <div id="icon-buddypress" class="icon32"><br></div>
358
- <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs(__('Media', BP_MEDIA_TXT_DOMAIN)); ?></h2>
359
- <div class="metabox-holder columns-2">
360
- <div class="bp-media-settings-tabs"><?php
361
- // Check to see which tab we are on
362
- if (current_user_can('manage_options')) {
363
- $tabs_html = '';
364
- $idle_class = 'media-nav-tab';
365
- $active_class = 'media-nav-tab media-nav-tab-active';
366
- $tabs = array();
367
-
368
- // Check to see which tab we are on
369
- $tab = BPMediaAdmin::get_current_tab();
370
- /* BuddyPress Media */
371
- $tabs[] = array(
372
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
373
- 'title' => __('Buddypress Media Settings', BP_MEDIA_TXT_DOMAIN),
374
- 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
375
- 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
376
- );
377
-
378
- $tabs[] = array(
379
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
380
- 'title' => __('Buddypress Media Addons', BP_MEDIA_TXT_DOMAIN),
381
- 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
382
- 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
383
- );
384
-
385
- $tabs[] = array(
386
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
387
- 'title' => __('Buddypress Media Support', BP_MEDIA_TXT_DOMAIN),
388
- 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
389
- 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
390
- );
391
-
392
- $pipe = '|';
393
- $i = '1';
394
- foreach ($tabs as $tab) {
395
- if ($i != 1)
396
- $tabs_html.=$pipe;
397
- $tabs_html.= '<a title=""' . $tab['title'] . '" " href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
398
- $i++;
399
- }
400
- echo $tabs_html;
401
- }
402
- ?>
403
- </div>
404
-
405
- <div id="bp-media-settings-boxes">
406
-
407
- <form id="bp_media_settings_form" name="bp_media_settings_form" action="" method="post" enctype="multipart/form-data"><?php
408
- settings_fields('bp_media_options_settings');
409
- do_settings_fields('bp_media_options_settings', '');
410
- echo '<div class="bp-media-metabox-holder">';
411
-
412
- if (isset($_REQUEST['request_type'])) {
413
- BPMediaUtils::bp_media_bug_report_form($_REQUEST['request_type']);
414
- } else {
415
- do_meta_boxes('bp-media-settings', 'normal', '');
416
- }
417
-
418
- echo '</div>';
419
- ?>
420
-
421
- <script type="text/javascript">
422
- //<![CDATA[
423
- jQuery(document).ready( function($) {
424
- // close postboxes that should be closed
425
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
426
- // postboxes setup
427
- postboxes.add_postbox_toggles('bp-media-settings');
428
- });
429
- //]]>
430
- </script>
431
-
432
- </form>
433
- </div><!-- .bp-media-settings-boxes -->
434
- <div class="metabox-fixed metabox-holder alignright bp-media-metabox-holder">
435
- <?php $this->default_admin_sidebar(); ?>
436
- </div>
437
- </div><!-- .metabox-holder -->
438
- </div><!-- .bp-media-admin --><?php
439
- }
440
-
441
- /**
442
- * Displays and updates the options menu of BuddyPress Media
443
- *
444
- * @since BuddyPress Media 2.0
445
- */
446
- function bp_media_admin_menu() {
447
-
448
- $bp_media_errors = array();
449
- $bp_media_messages = array();
450
-
451
- global $bp_media_options;
452
- $bp_media_options = get_site_option('bp_media_options', array(
453
- 'videos_enabled' => true,
454
- 'audio_enabled' => true,
455
- 'images_enabled' => true,
456
- 'download_enabled' => true,
457
- 'remove_linkback' => 1,
458
- ));
459
- ?>
460
-
461
- <?php if (count($bp_media_errors)) { ?>
462
- <div class="error"><p><?php foreach ($bp_media_errors as $error)
463
- echo $error . '<br/>'; ?></p></div>
464
- <?php } if (count($bp_media_messages)) { ?>
465
- <div class="updated"><p><?php foreach ($bp_media_messages as $message)
466
- echo $message . '<br/>'; ?></p></div>
467
- <?php } ?>
468
- <table class="form-table ">
469
- <tbody>
470
- <tr valign="top">
471
- <th scope="row"><label for="videos_enabled">Videos</label></th>
472
- <td>
473
- <fieldset>
474
- <legend class="screen-reader-text"><span>Enable Videos</span></legend>
475
- <label for="videos_enabled"><input name="bp_media_options[videos_enabled]" type="checkbox" id="videos_enabled" value="true" <?php global $bp_media_options;
476
- checked($bp_media_options['videos_enabled'], true) ?>> (Check to enable video upload functionality)</label>
477
- </fieldset>
478
- </td>
479
- </tr>
480
- <tr valign="top">
481
- <th scope="row"><label for="audio_enabled">Audio</label></th>
482
- <td>
483
- <fieldset>
484
- <legend class="screen-reader-text"><span>Enable Audio</span></legend>
485
- <label for="audio_enabled"><input name="bp_media_options[audio_enabled]" type="checkbox" id="audio_enabled" value="true" <?php checked($bp_media_options['audio_enabled'], true) ?>> (Check to enable audio upload functionality)</label>
486
- </fieldset>
487
- </td>
488
- </tr>
489
- <tr valign="top">
490
- <th scope="row"><label for="images_enabled">Images</label></th>
491
- <td>
492
- <fieldset>
493
- <legend class="screen-reader-text"><span>Enable Images</span></legend>
494
- <label for="images_enabled"><input name="bp_media_options[images_enabled]" type="checkbox" id="images_enabled" value="true" <?php checked($bp_media_options['images_enabled'], true) ?>> (Check to enable images upload functionality)</label>
495
- </fieldset>
496
- </td>
497
- </tr>
498
- <tr valign="top">
499
- <th scope="row"><label for="download_enabled">Download</label></th>
500
- <td>
501
- <fieldset>
502
- <legend class="screen-reader-text"><span>Enable Download</span></legend>
503
- <label for="download_enabled"><input name="bp_media_options[download_enabled]" type="checkbox" id="download_enabled" value="true" <?php checked($bp_media_options['download_enabled'], true) ?>> (Check to enable download functionality)</label>
504
- </fieldset>
505
- </td>
506
- </tr>
507
- </tbody>
508
- </table>
509
-
510
- <?php do_action('bp_media_extension_options'); ?>
511
-
512
- <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary bp-media-submit" value="Save Changes"></p>
513
- <div class="clear"></div><?php
514
- }
515
-
516
- function settings_other_options() {
517
- ?>
518
-
519
- <table class="form-table">
520
- <tbody>
521
- <tr valign="top">
522
- <th scope="row"><label for="refresh_media_count">Re-Count Media Entries</label></th>
523
- <td> <fieldset>
524
- <a id="refresh_media_count" href ="?page=bp-media-settings&bp_media_refresh_count=1&wp_nonce=<?php echo wp_create_nonce('bp_media_refresh_count'); ?>" class="button" title="<?php printf(__('It will re-count all media entries of all users and correct any discrepancies.')); ?>">Re-Count</a>
525
- </fieldset>
526
- </td>
527
- </tr>
528
- </tbody>
529
- </table>
530
- <div class="clear"></div>
531
-
532
- <?php
533
- }
534
-
535
- function settings_options() {
536
- global $bp_media_options;
537
- $bp_media_options = get_site_option('bp_media_options', array(
538
- 'videos_enabled' => true,
539
- 'audio_enabled' => true,
540
- 'images_enabled' => true,
541
- 'download_enabled' => true,
542
- 'remove_linkback' => 1,
543
- ));
544
- ?>
545
- <table class="form-table ">
546
- <tbody>
547
- <tr valign="top">
548
- <th scope="row"><label for="remove_linkback">Spread the word</label></th>
549
- <td>
550
- <fieldset>
551
- <legend class="screen-reader-text"><span>Yes, I want to support BuddyPress Media</span></legend>
552
- <label for="remove_linkback_yes"><input name="bp_media_options[remove_linkback]" type="radio" id="remove_linkback_yes" value="2" <?php checked($bp_media_options['remove_linkback'], '2'); ?>> Yes, I support BuddyPress Media</label>
553
- <br/>
554
- <legend class="screen-reader-text"><span>No, I don't want to support BuddyPress Media</span></legend>
555
- <label for="remove_linkback_no"><input name="bp_media_options[remove_linkback]" type="radio" id="remove_linkback_no" value="1" <?php checked($bp_media_options['remove_linkback'], '1'); ?>> No, I don't support BuddyPress Media</label>
556
- </fieldset>
557
- </td>
558
- </tr>
559
- </tbody>
560
- </table>
561
- <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary bp-media-submit" value="Save Changes"></p>
562
- <div class="clear"></div>
563
- <?php }
564
-
565
- function addons_list() {
566
- ?>
567
-
568
- <div class="addon-list">
569
- <ul class="products">
570
-
571
- <li class="product first">
572
- <a href="http://rtcamp.com/store/buddypress-media-kaltura/" title="BuddyPress - Media Kaltura Add-on">
573
- <img width="240" height="184" title="BuddyPress - Media Kaltura Add-on" alt="BuddyPress - Media Kaltura Add-on" src="http://cdn.rtcamp.com/files/2012/10/new-buddypress-media-kaltura-logo-240x184.png">
574
- </a>
575
- <h4><a href="http://rtcamp.com/store/buddypress-media-kaltura/" title="BuddyPress - Media Kaltura Add-on">BuddyPress-Media Kaltura Add-on</a></h4>
576
- <div class="product_desc">
577
- <p>Add support for more video formats using Kaltura video solution.</p>
578
- <p>Works with Kaltura.com, self-hosted Kaltura-CE and Kaltura-on-premise.</p>
579
- </div>
580
- <div class="product_footer">
581
- <span class="price alignleft"><span class="amount">$99</span></span>
582
- <a class="add_to_cart_button alignright product_type_simple" href="http://rtcamp.com/store/?add-to-cart=15446"><?php _e('Buy Now', BP_MEDIA_TXT_DOMAIN); ?></a>
583
- <a class="alignleft product_demo_link" href="http://demo.rtcamp.com/bpm-kaltura/" title="BuddyPress Media Kaltura Add-on">Live Demo</a>
584
- </div><!-- .product_footer -->
585
- </li>
586
- <li class="product last">
587
- <a href="http://rtcamp.com/store/buddypress-media-ffmpeg-converter/" title="BuddyPress-Media FFMPEG Converter Plugin" >
588
- <img width="240" height="184" title="BuddyPress-Media FFMPEG Converter Plugin" alt="BuddyPress-Media FFMPEG Converter Plugin" src="http://cdn.rtcamp.com/files/2012/09/ffmpeg-logo-240x184.png">
589
- </a>
590
- <h4><a href="http://rtcamp.com/store/buddypress-media-ffmpeg-converter/" title="BuddyPress-Media FFMPEG Converter Plugin" >BuddyPress-Media FFMPEG Add-on</a></h4>
591
- <div class="product_desc">
592
- <p>Add supports for more audio &amp; video formats using open-source <a href="https://github.com/rtCamp/media-node">media-node</a>.</p>
593
- <p>Media node comes with automated setup script for Ubuntu/Debian.</p>
594
- </div>
595
- <div class="product_footer">
596
- <span class="price alignleft"><span class="amount">$49</span></span>
597
- <a class="add_to_cart_button alignright product_type_simple" href="http://rtcamp.com/store/?add-to-cart=13677"><?php _e('Buy Now', BP_MEDIA_TXT_DOMAIN); ?></a>
598
- <a class="alignleft product_demo_link" href="http://demo.rtcamp.com/bpm-media" title="BuddyPress Media FFMPEG Add-on">Live Demo</a>
599
- </div><!-- .product_footer -->
600
- </li>
601
-
602
- </ul><!-- .products -->
603
- </div><!-- .addon-list -->
604
-
605
- <?php }
606
-
607
- function support() {
608
- global $bp_media;
609
- ?>
610
-
611
- <div class="bp-media-support">
612
- <h2><?php _e('Need Help/Support?', BP_MEDIA_TXT_DOMAIN); ?></h2>
613
- <ul class="support_list">
614
- <li><a href="http://rtcamp.com/buddypress-media/faq/" title="<?php _e('Read FAQ', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('Read FAQ', BP_MEDIA_TXT_DOMAIN); ?></a> </li>
615
- <li><a href="<?php $bp_media->support_url; ?>" title="<?php _e('Free Support Forum', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('Free Support Forum', BP_MEDIA_TXT_DOMAIN); ?></a></li>
616
- <li><a href="https://github.com/rtCamp/buddypress-media/issues/" title="<?php _e('Github Issue Tracker', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('Github Issue Tracker', BP_MEDIA_TXT_DOMAIN); ?> </a> </li>
617
- </ul>
618
- <br/>
619
-
620
- <h2><?php _e('Hire Us!', BP_MEDIA_TXT_DOMAIN); ?></h2>
621
- <h4><a href="http://rtcamp.com/contact/?purpose=hire"><?php _e('We are available for customisation and premium support. Get on touch with us. :-)', BP_MEDIA_TXT_DOMAIN); ?></a></h4>
622
- <br/>
623
- </div>
624
-
625
- <?php
626
- }
627
-
628
- function handle_request_type() {
629
- $request_type = $_REQUEST['request_type'];
630
- BPMediaUtils::bp_media_bug_report_form($request_type);
631
- die();
632
- }
633
-
634
- function cancel_request() {
635
- ?>
636
- <div class="postbox ">
637
- <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span><?php _e('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
638
- <div class="inside"><?php $this->support(); ?></div>
639
- </div>
640
- <div class="postbox ">
641
- <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span><?php _e('Submit a request form', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
642
- <div class="inside"><?php $this->send_request(); ?></div>
643
- </div><?php
644
- die();
645
- }
646
-
647
- function send_request() {
648
- ?>
649
- <div id="support-form" class="bp-media-form">
650
- <ul>
651
- <li>
652
- <label class="bp-media-label" for="bp-media-request"><?php _e('Request type:', BP_MEDIA_TXT_DOMAIN); ?></label>
653
- <select class="bp-media-select" id="request_type_select">
654
- <option value=""><?php _e('-- Choose Type --', BP_MEDIA_TXT_DOMAIN); ?></option>
655
- <option value="premium_support"><?php _e('Premium Support', BP_MEDIA_TXT_DOMAIN); ?></option>
656
- <option value="new_feature"><?php _e('Suggest a New Feature', BP_MEDIA_TXT_DOMAIN); ?></option>
657
- <option value="bug_report"><?php _e('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN); ?></option>
658
- </select>
659
- </li>
660
- </ul>
661
- </div>
662
- <?php
663
- }
664
-
665
- /**
666
- * Default BuddyPress Media admin sidebar with metabox styling
667
- *
668
- * @since BuddyPress Media 2.0
669
- */
670
- function default_admin_sidebar() {
671
- global $bp_media;
672
- ?>
673
-
674
- <div class="rtmetabox postbox" id="branding">
675
- <div class="inside">
676
- <a href="http://rtcamp.com" title="Empowering The Web With WordPress" id="logo"><img src="<?php echo plugins_url('/img/rtcamp-logo.png', __FILE__); ?>" alt="rtCamp" /></a>
677
- <ul id="social">
678
- <li><a href="<?php printf('%s', 'http://www.facebook.com/rtCamp.solutions/'); ?>" title="<?php _e('Become a fan on Facebook', BP_MEDIA_TXT_DOMAIN); ?>" class="bp-media-facebook bp-media-social"><?php _e('Facebook', BP_MEDIA_TXT_DOMAIN); ?></a></li>
679
- <li><a href="<?php printf('%s', 'https://twitter.com/rtcamp/'); ?>" title="<?php _e('Follow us on Twitter', BP_MEDIA_TXT_DOMAIN); ?>" class="bp-media-twitter bp-media-social"><?php _e('Twitter', BP_MEDIA_TXT_DOMAIN); ?></a></li>
680
- <li><a href="<?php printf('%s', 'http://feeds.feedburner.com/rtcamp/'); ?>" title="<?php _e('Subscribe to our feeds', BP_MEDIA_TXT_DOMAIN); ?>" class="bp-media-rss bp-media-social"><?php _e('RSS Feed', BP_MEDIA_TXT_DOMAIN); ?></a></li>
681
- </ul>
682
- </div>
683
- </div>
684
-
685
- <div class="rtmetabox postbox" id="support">
686
-
687
- <h3 class="hndle"><span><?php _e('Need Help?', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
688
- <div class="inside"><p><?php printf(__(' Please use our <a href="%s">free support forum</a>.<br/><span class="bpm-aligncenter">OR</span><br/>
689
- <a href="%s">Hire us!</a> To get professional customisation/setup service.', BP_MEDIA_TXT_DOMAIN), $bp_media->support_url, 'http://rtcamp.com/buddypress-media/hire/'); ?>.</p></div>
690
- </div>
691
-
692
- <div class="rtmetabox postbox" id="donate">
693
-
694
- <h3 class="hndle"><span><?php _e('Donate', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
695
- <span><a href="http://rtcamp.com/donate/" title="Help the development keep going."><img class="bp-media-donation-image" src ="<?php echo plugins_url('/img/donate.gif', __FILE__); ?>" /></a></span>
696
- <div class="inside"><p><?php printf(__('Help us release more amazing features faster. Consider making a donation to our consistent efforts.', BP_MEDIA_TXT_DOMAIN)); ?>.</p></div>
697
- </div>
698
-
699
- <div class="rtmetabox postbox" id="bp-media-premium-addons">
700
-
701
- <h3 class="hndle"><span><?php _e('Premium Addons', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
702
- <div class="inside">
703
- <ul>
704
- <li><a href="http://rtcamp.com/store/buddypress-media-kaltura/" title="BuddyPress Media Kaltura">BPM-Kaltura</a> - add support for Kaltura.com/Kaltura-CE based video conversion support</li>
705
- <li><a href="http://rtcamp.com/store/buddy-press-media-ffmpeg/" title="BuddyPress Media FFMPEG">BPM-FFMPEG</a> - add FFMEG-based audio/video conversion support</li>
706
- </ul>
707
- <h4><?php printf(__('Are you a developer?', BP_MEDIA_TXT_DOMAIN)) ?></h4>
708
- <p><?php printf(__('If you are developing a BuddyPress Media addon we would like to include it in above list. We can also help you sell them. <a href="%s">More info!</a>', BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/contact/') ?></p></h4>
709
- </div>
710
- </div>
711
-
712
- <div class="rtmetabox postbox" id="bp_media_latest_news">
713
-
714
- <h3 class="hndle"><span><?php _e('Latest News', BP_MEDIA_TXT_DOMAIN); ?></span></h3>
715
- <div class="inside"><img src ="<?php echo admin_url(); ?>/images/wpspin_light.gif" /> Loading...</div>
716
- </div><?php
717
- }
718
-
719
- /**
720
- * Enqueues the scripts and stylesheets needed for the BuddyPress Media's options page
721
- */
722
- function admin_enqueue() {
723
- $current_screen = get_current_screen();
724
- $admin_js = trailingslashit(site_url()) . '?bp_media_get_feeds=1';
725
- wp_enqueue_script('bp-media-js', plugins_url('includes/js/bp-media.js', dirname(__FILE__)));
726
- wp_localize_script('bp-media-js', 'bp_media_news_url', $admin_js);
727
- wp_enqueue_style('bp-media-admin-style', plugins_url('includes/css/bp-media-style.css', dirname(__FILE__)));
728
- }
729
-
730
- /**
731
- * Adds a tab for Media settings in the BuddyPress settings page
732
- */
733
- function admin_tab() {
734
-
735
- if (current_user_can('manage_options')) {
736
- $tabs_html = '';
737
- $idle_class = 'nav-tab';
738
- $active_class = 'nav-tab nav-tab-active';
739
- $tabs = array();
740
-
741
- // Check to see which tab we are on
742
- $tab = BPMediaAdmin::get_current_tab();
743
- /* BuddyPress Media */
744
- $tabs[] = array(
745
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
746
- 'title' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
747
- 'name' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
748
- 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
749
- );
750
-
751
- foreach ($tabs as $tab) {
752
- $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
753
- }
754
- echo $tabs_html;
755
- }
756
- }
757
-
758
- function get_server_info() {
759
- global $wp_version, $wp_db_version, $wpdb;
760
-
761
- $wordpress_plugins = get_plugins();
762
- $wordpress_plugins_active = array();
763
-
764
- foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
765
-
766
- if (is_plugin_active($wordpress_plugin_file)) {
767
-
768
- $plugin_info['plugin_name'] = $wordpress_plugin['Name'];
769
- $plugin_info['PluginURI'] = $wordpress_plugin['PluginURI'];
770
- $plugin_info['Version'] = $wordpress_plugin['Version'];
771
- $plugin_info['AuthorURI'] = $wordpress_plugin['AuthorURI'];
772
- $wordpress_plugins_active[$wordpress_plugin_file] = $plugin_info;
773
- }
774
- }
775
- $theme_info = wp_get_theme();
776
- $theme_data = array();
777
- $theme_data['Name'] = $theme_info->Name;
778
- $theme_data['ThemeURI'] = $theme_info->ThemeURI;
779
- $theme_data['Description'] = $theme_info->Description;
780
- $theme_data['AuthorURI'] = $theme_info->AuthorURI;
781
- $theme_data['Version'] = $theme_info->Version;
782
-
783
- $mysql_version = $wpdb->get_var('SELECT VERSION()');
784
-
785
- $server_info = array(
786
- 'Wordpress' => array(
787
- 'version' => $wp_version,
788
- 'db_version' => $wp_db_version,
789
- 'abspath' => ABSPATH,
790
- 'home' => get_option('home'),
791
- 'siteurl' => get_option('siteurl'),
792
- 'email' => get_option('admin_email'),
793
- 'upload_info' => @wp_upload_dir(),
794
- ),
795
- 'Theme' => $theme_data,
796
- 'Plugins' => $wordpress_plugins_active,
797
- 'Mysql' => array(
798
- 'version' => $mysql_version
799
- )
800
- );
801
-
802
- return $server_info;
803
- }
804
-
805
- }
806
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/includes/bp-media-upload-handler.php CHANGED
@@ -6,17 +6,15 @@ header( "Pragma: no-cache" ); //HTTP 1.0
6
  header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
7
 
8
  ignore_user_abort( true );
9
-
10
  /** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
11
  $path = '/'; // It should be end with a trailing slash
12
 
13
  /** That's all, stop editing from here * */
14
  if ( ! defined( 'WP_LOAD_PATH' ) ) {
15
-
16
  /** classic root path if wp-content and plugins is below wp-config.php */
17
  $classic_root = dirname( dirname( dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) ) ) . '/';
18
- echo $classic_root;
19
- //$classic_root = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/' ;
20
  if ( file_exists( $classic_root . 'wp-load.php' ) )
21
  define( 'WP_LOAD_PATH', $classic_root );
22
  else
6
  header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
7
 
8
  ignore_user_abort( true );
 
9
  /** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
10
  $path = '/'; // It should be end with a trailing slash
11
 
12
  /** That's all, stop editing from here * */
13
  if ( ! defined( 'WP_LOAD_PATH' ) ) {
 
14
  /** classic root path if wp-content and plugins is below wp-config.php */
15
  $classic_root = dirname( dirname( dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) ) ) . '/';
16
+
17
+ //$classic_root = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/' ;
18
  if ( file_exists( $classic_root . 'wp-load.php' ) )
19
  define( 'WP_LOAD_PATH', $classic_root );
20
  else
app/main/privacy/BPMediaPrivacy.php CHANGED
@@ -13,20 +13,14 @@
13
  class BPMediaPrivacy {
14
 
15
  var $settings = array(
16
- 'private' => false,
17
- 'friends' => false,
18
- 'users' => false,
19
- 'public' => true
20
  );
21
 
22
  var $enabled = false;
23
 
24
- var $contexts = array(
25
- 'site' => false,
26
- 'group' => false,
27
- 'profile' => true
28
- );
29
-
30
 
31
  /**
32
  *
@@ -39,35 +33,21 @@ class BPMediaPrivacy {
39
 
40
  }
41
 
42
- function save( $context = '', $settings = array( ), $object_id = false, $object_type = 'media' ) {
43
- if ( empty( $settings ) )
 
44
  return false;
45
 
46
- $defaults = $this->settings;
47
- $settings = wp_parse_args( $settings, $defaults );
48
- return $this->save_by_object( $context, $settings, $object_id, $object_type );
49
  }
50
 
51
- private function save_by_object( $context = '', $settings = array( ), $object_id = false, $object_type = 'media' ) {
52
  if($object_id==false)
53
  return false;
54
 
55
- $settings = apply_filters('bp_media_save_privacy', $settings);
56
 
57
- switch ($object_type){
58
- case 'media':
59
- return update_post_meta($object_id,'bp_media_privacy',$settings);
60
- break;
61
- case 'profile':
62
- return update_user_meta($object_id,'bp_media_privacy',$settings);
63
- break;
64
- case 'activity':
65
- break;
66
- case 'group':
67
- break;
68
-
69
- }
70
- //do_action('bp_media_non_media_privacy',$object_id, $settings);
71
 
72
  }
73
  function check($object_id=false, $object_type='media'){
13
  class BPMediaPrivacy {
14
 
15
  var $settings = array(
16
+ 6 =>'private',
17
+ 4 =>'friends',
18
+ 2 =>'users',
19
+ 0 =>'public'
20
  );
21
 
22
  var $enabled = false;
23
 
 
 
 
 
 
 
24
 
25
  /**
26
  *
33
 
34
  }
35
 
36
+ function save( $level = 0, $object_id = false ) {
37
+
38
+ if(!array_key_exists($level,$this->settings))
39
  return false;
40
 
41
+ return $this->save_by_object( $level, $object_id );
 
 
42
  }
43
 
44
+ private function save_by_object( $level = 0, $object_id = false ) {
45
  if($object_id==false)
46
  return false;
47
 
48
+ $level = apply_filters('bp_media_save_privacy', $level);
49
 
50
+ return update_post_meta($object_id,'bp_media_privacy',$level);
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  }
53
  function check($object_id=false, $object_type='media'){
app/main/profile/BPMediaAlbum.php CHANGED
@@ -21,7 +21,8 @@ class BPMediaAlbum {
21
  $thumbnail,
22
  $edit_url,
23
  $media_entries,
24
- $group_id;
 
25
 
26
  /**
27
  *
@@ -36,7 +37,7 @@ class BPMediaAlbum {
36
  */
37
 
38
  /**
39
- *
40
  * @param type $album_id
41
  */
42
  function __construct($album_id = '') {
@@ -59,7 +60,7 @@ class BPMediaAlbum {
59
  */
60
 
61
  /**
62
- *
63
  * @param type $album_id
64
  * @throws Exception
65
  */
@@ -121,10 +122,13 @@ class BPMediaAlbum {
121
  } else {
122
  $this->thumbnail = '<img src ="' . BP_MEDIA_URL . 'app/assets/img/image_thumb.png">';
123
  }
 
124
  $this->media_entries = get_children(array(
125
  'post_parent' => $this->id,
126
- 'post_type' => 'attachment'
 
127
  ));
 
128
  }
129
 
130
  /**
@@ -138,7 +142,7 @@ class BPMediaAlbum {
138
  */
139
 
140
  /**
141
- *
142
  * @global array $bp_media_count
143
  * @param type $title
144
  * @param type $author_id
@@ -147,7 +151,9 @@ class BPMediaAlbum {
147
  */
148
  function add_album($title, $author_id = 0, $group_id = 0) {
149
  do_action('bp_media_before_add_album');
150
- $author_id = $author_id ? $author_id : get_current_user_id();
 
 
151
  $post_vars = array(
152
  'post_title' => $title,
153
  'post_name' => $title,
@@ -170,6 +176,7 @@ class BPMediaAlbum {
170
  return $album_id;
171
  }
172
 
 
173
  /**
174
  * Deletes the album and all associated attachments
175
  *
@@ -177,7 +184,7 @@ class BPMediaAlbum {
177
  */
178
 
179
  /**
180
- *
181
  * @global array $bp_media_count
182
  */
183
  function delete_album() {
@@ -198,7 +205,7 @@ class BPMediaAlbum {
198
  }
199
 
200
  /**
201
- *
202
  * @param type $title
203
  * @return boolean
204
  */
@@ -242,13 +249,34 @@ class BPMediaAlbum {
242
  */
243
 
244
  /**
245
- *
246
  * @return type
247
  */
248
  function get_entries() {
249
  return $this->media_entries;
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  /**
253
  * Returns the title of the album
254
  *
@@ -256,7 +284,7 @@ class BPMediaAlbum {
256
  */
257
 
258
  /**
259
- *
260
  * @return type
261
  */
262
  function get_title() {
@@ -279,7 +307,7 @@ class BPMediaAlbum {
279
  */
280
 
281
  /**
282
- *
283
  * @return type
284
  */
285
  function get_id() {
@@ -293,7 +321,7 @@ class BPMediaAlbum {
293
  */
294
 
295
  /**
296
- *
297
  * @return type
298
  */
299
  function get_url() {
@@ -307,7 +335,7 @@ class BPMediaAlbum {
307
  */
308
 
309
  /**
310
- *
311
  * @return type
312
  */
313
  function get_owner() {
@@ -319,7 +347,7 @@ class BPMediaAlbum {
319
  */
320
 
321
  /**
322
- *
323
  * @return type
324
  */
325
  function get_edit_url() {
@@ -331,7 +359,7 @@ class BPMediaAlbum {
331
  */
332
 
333
  /**
334
- *
335
  * @return type
336
  */
337
  function get_delete_url() {
@@ -343,7 +371,7 @@ class BPMediaAlbum {
343
  */
344
 
345
  /**
346
- *
347
  * @return type
348
  */
349
  function get_group_id() {
21
  $thumbnail,
22
  $edit_url,
23
  $media_entries,
24
+ $group_id,
25
+ $filters;
26
 
27
  /**
28
  *
37
  */
38
 
39
  /**
40
+ *
41
  * @param type $album_id
42
  */
43
  function __construct($album_id = '') {
60
  */
61
 
62
  /**
63
+ *
64
  * @param type $album_id
65
  * @throws Exception
66
  */
122
  } else {
123
  $this->thumbnail = '<img src ="' . BP_MEDIA_URL . 'app/assets/img/image_thumb.png">';
124
  }
125
+ $this->filter_entries();
126
  $this->media_entries = get_children(array(
127
  'post_parent' => $this->id,
128
+ 'post_type' => 'attachment',
129
+ 'post_mime_type'=> $this->filters
130
  ));
131
+
132
  }
133
 
134
  /**
142
  */
143
 
144
  /**
145
+ *
146
  * @global array $bp_media_count
147
  * @param type $title
148
  * @param type $author_id
151
  */
152
  function add_album($title, $author_id = 0, $group_id = 0) {
153
  do_action('bp_media_before_add_album');
154
+ global $current_user;
155
+ get_currentuserinfo();
156
+ $author_id = $author_id ? $author_id : $current_user->ID;
157
  $post_vars = array(
158
  'post_title' => $title,
159
  'post_name' => $title,
176
  return $album_id;
177
  }
178
 
179
+
180
  /**
181
  * Deletes the album and all associated attachments
182
  *
184
  */
185
 
186
  /**
187
+ *
188
  * @global array $bp_media_count
189
  */
190
  function delete_album() {
205
  }
206
 
207
  /**
208
+ *
209
  * @param type $title
210
  * @return boolean
211
  */
249
  */
250
 
251
  /**
252
+ *
253
  * @return type
254
  */
255
  function get_entries() {
256
  return $this->media_entries;
257
  }
258
 
259
+ /**
260
+ *
261
+ * @global type $bp_media
262
+ */
263
+ function filter_entries(){
264
+ global $bp_media;
265
+ $enabled = $bp_media->enabled();
266
+ if(isset($enabled['upload'])) unset($enabled['upload']);
267
+ if(isset($enabled['album'])) unset($enabled['album']);
268
+ foreach($enabled as $type=>$active){
269
+ if($active==true){
270
+ $filters[] = $type;
271
+ }
272
+
273
+ }
274
+
275
+ if(count($filters)==1) $filters = $filters[0];
276
+ $this->filters = $filters;
277
+ }
278
+
279
+
280
  /**
281
  * Returns the title of the album
282
  *
284
  */
285
 
286
  /**
287
+ *
288
  * @return type
289
  */
290
  function get_title() {
307
  */
308
 
309
  /**
310
+ *
311
  * @return type
312
  */
313
  function get_id() {
321
  */
322
 
323
  /**
324
+ *
325
  * @return type
326
  */
327
  function get_url() {
335
  */
336
 
337
  /**
338
+ *
339
  * @return type
340
  */
341
  function get_owner() {
347
  */
348
 
349
  /**
350
+ *
351
  * @return type
352
  */
353
  function get_edit_url() {
359
  */
360
 
361
  /**
362
+ *
363
  * @return type
364
  */
365
  function get_delete_url() {
371
  */
372
 
373
  /**
374
+ *
375
  * @return type
376
  */
377
  function get_group_id() {
app/main/profile/BPMediaAlbumScreen.php CHANGED
@@ -8,12 +8,14 @@
8
  *
9
  * @author Saurabh Shukla <saurabh.shukla@rtcamp.com>
10
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
11
- *
12
  */
13
  class BPMediaAlbumScreen extends BPMediaScreen {
14
 
 
 
15
  /**
16
- *
17
  * @param type $media_type
18
  * @param type $slug
19
  */
@@ -22,7 +24,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
22
  }
23
 
24
  /**
25
- *
26
  * @global type $bp
27
  */
28
  function screen() {
@@ -54,12 +56,12 @@ class BPMediaAlbumScreen extends BPMediaScreen {
54
  }
55
 
56
  /**
57
- *
58
  * @global type $bp_media_albums_query
59
  */
60
 
61
  /**
62
- *
63
  * @global type $bp_media_albums_query
64
  */
65
  function screen_content() {
@@ -81,7 +83,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
81
  }
82
 
83
  /**
84
- *
85
  * @global type $bp
86
  * @global BPMediaAlbum $bp_media_current_album
87
  * @return boolean
@@ -102,7 +104,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
102
  }
103
 
104
  /**
105
- *
106
  * @global type $bp
107
  * @global BPMediaAlbum $bp_media_current_album
108
  * @global type $bp_media_query
@@ -119,24 +121,28 @@ class BPMediaAlbumScreen extends BPMediaScreen {
119
  echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __("Delete", BP_MEDIA_TXT_DOMAIN) . '</a>';
120
  echo '</div>';
121
  }
122
-
 
 
123
  $this->inner_query($bp_media_current_album->get_id());
124
  $this->hook_before();
125
  if ($bp_media_current_album && $bp_media_query->have_posts()):
126
- echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
127
- if (bp_is_my_profile() || BPMediaGroup::can_upload()) {
128
  echo '<li>';
129
  BPMediaUploadScreen::upload_screen_content();
130
  echo '</li>';
 
131
  }
132
- while ($bp_media_query->have_posts()) : $bp_media_query->the_post();
133
  $this->template->the_content();
 
134
  endwhile;
135
  echo '</ul>';
136
  $this->template->show_more();
137
  else:
138
  BPMediaFunction::show_formatted_error_message(__('Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN), 'info');
139
- if (bp_is_my_profile() || BPMediaGroup::can_upload()) {
140
  echo '<div class="bp-media-area-allocate"></div>';
141
  BPMediaUploadScreen::upload_screen_content();
142
  }
@@ -145,7 +151,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
145
  }
146
 
147
  /**
148
- *
149
  * @global type $bp
150
  * @global type $bp_media_albums_query
151
  */
@@ -169,8 +175,10 @@ class BPMediaAlbumScreen extends BPMediaScreen {
169
  }
170
  }
171
 
 
 
172
  /**
173
- *
174
  * @param type $action
175
  */
176
  function template_actions($action) {
@@ -178,7 +186,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
178
  }
179
 
180
  /**
181
- *
182
  * @global type $bp
183
  * @global type $bp_media_query
184
  * @param type $album_id
@@ -195,15 +203,33 @@ class BPMediaAlbumScreen extends BPMediaScreen {
195
  }
196
  if (!$paged)
197
  $paged = 1;
 
198
  $args = array(
199
  'post_type' => 'attachment',
200
  'post_status' => 'any',
201
  'post_parent' => $album_id,
202
- 'paged' => $paged
 
203
  );
204
  $bp_media_query = new WP_Query($args);
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
 
209
  ?>
8
  *
9
  * @author Saurabh Shukla <saurabh.shukla@rtcamp.com>
10
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
11
+ *
12
  */
13
  class BPMediaAlbumScreen extends BPMediaScreen {
14
 
15
+ var $filters;
16
+
17
  /**
18
+ *
19
  * @param type $media_type
20
  * @param type $slug
21
  */
24
  }
25
 
26
  /**
27
+ *
28
  * @global type $bp
29
  */
30
  function screen() {
56
  }
57
 
58
  /**
59
+ *
60
  * @global type $bp_media_albums_query
61
  */
62
 
63
  /**
64
+ *
65
  * @global type $bp_media_albums_query
66
  */
67
  function screen_content() {
83
  }
84
 
85
  /**
86
+ *
87
  * @global type $bp
88
  * @global BPMediaAlbum $bp_media_current_album
89
  * @return boolean
104
  }
105
 
106
  /**
107
+ *
108
  * @global type $bp
109
  * @global BPMediaAlbum $bp_media_current_album
110
  * @global type $bp_media_query
121
  echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __("Delete", BP_MEDIA_TXT_DOMAIN) . '</a>';
122
  echo '</div>';
123
  }
124
+ $total_post = 10;
125
+ $total_post = get_option('posts_per_page');
126
+
127
  $this->inner_query($bp_media_current_album->get_id());
128
  $this->hook_before();
129
  if ($bp_media_current_album && $bp_media_query->have_posts()):
130
+ echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
131
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
132
  echo '<li>';
133
  BPMediaUploadScreen::upload_screen_content();
134
  echo '</li>';
135
+ $total_post--;
136
  }
137
+ while ($bp_media_query->have_posts() && $total_post>0) : $bp_media_query->the_post();
138
  $this->template->the_content();
139
+ $total_post--;
140
  endwhile;
141
  echo '</ul>';
142
  $this->template->show_more();
143
  else:
144
  BPMediaFunction::show_formatted_error_message(__('Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN), 'info');
145
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
146
  echo '<div class="bp-media-area-allocate"></div>';
147
  BPMediaUploadScreen::upload_screen_content();
148
  }
151
  }
152
 
153
  /**
154
+ *
155
  * @global type $bp
156
  * @global type $bp_media_albums_query
157
  */
175
  }
176
  }
177
 
178
+
179
+
180
  /**
181
+ *
182
  * @param type $action
183
  */
184
  function template_actions($action) {
186
  }
187
 
188
  /**
189
+ *
190
  * @global type $bp
191
  * @global type $bp_media_query
192
  * @param type $album_id
203
  }
204
  if (!$paged)
205
  $paged = 1;
206
+ $this->filter_entries();
207
  $args = array(
208
  'post_type' => 'attachment',
209
  'post_status' => 'any',
210
  'post_parent' => $album_id,
211
+ 'paged' => $paged,
212
+ 'post_mime_type'=>$this->filters
213
  );
214
  $bp_media_query = new WP_Query($args);
215
  }
216
 
217
+ function filter_entries(){
218
+ global $bp_media;
219
+ $enabled = $bp_media->enabled();
220
+ if(isset($enabled['upload'])) unset($enabled['upload']);
221
+ if(isset($enabled['album'])) unset($enabled['album']);
222
+ foreach($enabled as $type=>$active){
223
+ if($active==true){
224
+ $filters[] = $type;
225
+ }
226
+
227
+ }
228
+
229
+ if(count($filters)==1) $filters = $filters[0];
230
+ $this->filters = $filters;
231
+ }
232
+
233
  }
234
 
235
  ?>
app/main/profile/BPMediaScreen.php CHANGED
@@ -44,7 +44,7 @@ class BPMediaScreen {
44
  */
45
 
46
  /**
47
- *
48
  * @param type $media_type
49
  * @param type $slug
50
  */
@@ -60,7 +60,7 @@ class BPMediaScreen {
60
  */
61
 
62
  /**
63
- *
64
  * @param type $media_type
65
  */
66
  private function media($media_type) {
@@ -73,7 +73,7 @@ class BPMediaScreen {
73
  */
74
 
75
  /**
76
- *
77
  * @param type $media_type
78
  */
79
  private function medias($media_type) {
@@ -167,30 +167,34 @@ class BPMediaScreen {
167
  */
168
 
169
  /**
170
- *
171
  * @global type $bp_media_query
172
  * @global type $bp_media_albums_query
173
  */
174
  function screen_content() {
175
- global $bp_media_query, $bp_media_albums_query;
 
 
176
  $this->set_query();
177
 
178
  $this->hook_before();
179
  if ($bp_media_query && $bp_media_query->have_posts()):
180
  echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
181
- if (bp_is_my_profile() || BPMediaGroup::can_upload()) {
182
  echo '<li>';
183
  BPMediaUploadScreen::upload_screen_content();
184
  echo '</li>';
 
185
  }
186
- while ($bp_media_query->have_posts()) : $bp_media_query->the_post();
187
  $this->template->the_content();
 
188
  endwhile;
189
  echo '</ul>';
190
  $this->template->show_more();
191
  else:
192
  BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
193
- if (bp_is_my_profile() || BPMediaGroup::can_upload()) {
194
  echo '<div class="bp-media-area-allocate"></div>';
195
  BPMediaUploadScreen::upload_screen_content();
196
  }
@@ -303,7 +307,7 @@ class BPMediaScreen {
303
  */
304
 
305
  /**
306
- *
307
  * @global BPMediaHostWordpress $bp_media_current_entry
308
  * @global type $bp_media_default_excerpts
309
  */
@@ -345,7 +349,7 @@ class BPMediaScreen {
345
  */
346
 
347
  /**
348
- *
349
  * @global type $bp
350
  * @global BPMediaHostWordpress $bp_media_current_entry
351
  */
@@ -393,7 +397,7 @@ class BPMediaScreen {
393
  */
394
 
395
  /**
396
- *
397
  * @param type $action
398
  */
399
  function template_actions($action) {
@@ -409,7 +413,7 @@ class BPMediaScreen {
409
  */
410
 
411
  /**
412
- *
413
  * @global type $bp
414
  * @global type $bp_media_posts_per_page
415
  * @global type $bp_media_query
44
  */
45
 
46
  /**
47
+ *
48
  * @param type $media_type
49
  * @param type $slug
50
  */
60
  */
61
 
62
  /**
63
+ *
64
  * @param type $media_type
65
  */
66
  private function media($media_type) {
73
  */
74
 
75
  /**
76
+ *
77
  * @param type $media_type
78
  */
79
  private function medias($media_type) {
167
  */
168
 
169
  /**
170
+ *
171
  * @global type $bp_media_query
172
  * @global type $bp_media_albums_query
173
  */
174
  function screen_content() {
175
+ global $bp_media_query;
176
+ $total_post = 10;
177
+ $total_post = get_option('posts_per_page');
178
  $this->set_query();
179
 
180
  $this->hook_before();
181
  if ($bp_media_query && $bp_media_query->have_posts()):
182
  echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
183
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
184
  echo '<li>';
185
  BPMediaUploadScreen::upload_screen_content();
186
  echo '</li>';
187
+ $total_post--;
188
  }
189
+ while ($bp_media_query->have_posts() && $total_post>0) : $bp_media_query->the_post();
190
  $this->template->the_content();
191
+ $total_post--;
192
  endwhile;
193
  echo '</ul>';
194
  $this->template->show_more();
195
  else:
196
  BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
197
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
198
  echo '<div class="bp-media-area-allocate"></div>';
199
  BPMediaUploadScreen::upload_screen_content();
200
  }
307
  */
308
 
309
  /**
310
+ *
311
  * @global BPMediaHostWordpress $bp_media_current_entry
312
  * @global type $bp_media_default_excerpts
313
  */
349
  */
350
 
351
  /**
352
+ *
353
  * @global type $bp
354
  * @global BPMediaHostWordpress $bp_media_current_entry
355
  */
397
  */
398
 
399
  /**
400
+ *
401
  * @param type $action
402
  */
403
  function template_actions($action) {
413
  */
414
 
415
  /**
416
+ *
417
  * @global type $bp
418
  * @global type $bp_media_posts_per_page
419
  * @global type $bp_media_query
app/main/profile/BPMediaTemplate.php CHANGED
@@ -17,65 +17,65 @@ class BPMediaTemplate {
17
  */
18
  function upload_form_multiple() {
19
  global $bp_media_current_album;
20
- $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN);
21
- if (!isset($bp_media_current_album)) {
22
- ?>
23
- <div id="bp-media-album-prompt" title="Select Album">
24
- <span><?php _e('Select Album', BP_MEDIA_TXT_DOMAIN); ?></span>
25
- <div class="bp-media-album-content">
26
- <select id="bp-media-selected-album"><?php
27
- if (bp_is_current_component('groups')) {
28
- $albums = new WP_Query(array(
29
- 'post_type' => 'bp_media_album',
30
- 'posts_per_page' => -1,
31
- 'meta_key' => 'bp-media-key',
32
- 'meta_value' => -bp_get_current_group_id(),
33
- 'meta_compare' => '='
34
- ));
35
- } else {
36
- $albums = new WP_Query(array(
37
- 'post_type' => 'bp_media_album',
38
- 'posts_per_page' => -1,
39
- 'author' => get_current_user_id()
40
- ));
41
- }
42
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
43
- foreach ($albums->posts as $album) {
44
- if ($album->post_title == $post_wall)
45
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
46
- else
47
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
48
- };
49
- }else {
50
- $album = new BPMediaAlbum();
51
- if (bp_is_current_component('groups')) {
52
- $current_group = new BP_Groups_Group(bp_get_current_group_id());
53
- $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
54
- } else {
55
- $album->add_album($post_wall, bp_loggedin_user_id());
56
- }
57
- echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title()->post_title . '</option>';
58
- }
59
- echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
60
- ?>
61
- </select>
62
- </div>
63
- <div class="hide">
64
- <input type="text" id="bp_media_album_new" value="" />
65
- <input type="button" class="button" id="btn-create-new" value="<?php _e('Create', BP_MEDIA_TXT_DOMAIN); ?>"/>
66
- <input type="button" class="button" id="btn-create-cancel" value="<?php _e('Cancel', BP_MEDIA_TXT_DOMAIN); ?>"/>
67
- </div>
68
- </div><?php } else {
69
- ?>
70
- <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
71
- <?php } ?>
72
  <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
73
  <div id="drag-drop-area">
74
  <div class="drag-drop-inside">
75
  <p class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></p>
76
  <p><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></p>
77
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Select Files', BP_MEDIA_TXT_DOMAIN); ?>" class="button" /></p>
78
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
  <div id="bp-media-uploaded-files"></div>
81
  </div>
@@ -171,13 +171,23 @@ class BPMediaTemplate {
171
  case 'media':
172
  global $bp_media_query;
173
  //found_posts
174
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > 10)
175
- $showmore = true;
 
 
 
 
 
176
  break;
177
  case 'albums':
178
  global $bp_media_albums_query;
179
- if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > 10)
180
- $showmore = true;
 
 
 
 
 
181
  break;
182
  }
183
  if ($showmore) {
17
  */
18
  function upload_form_multiple() {
19
  global $bp_media_current_album;
20
+ $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
22
  <div id="drag-drop-area">
23
  <div class="drag-drop-inside">
24
  <p class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></p>
25
  <p><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></p>
26
+ <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Upload Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" /></p>
27
  </div>
28
+ <?php if (!isset($bp_media_current_album)) { ?>
29
+ <div id="bp-media-album-in"><span><?php _e('to', BP_MEDIA_TXT_DOMAIN); ?></span></div>
30
+ <div id="bp-media-album-prompt" title="Album">
31
+ <p><?php _e('Album', BP_MEDIA_TXT_DOMAIN); ?></p>
32
+ <div class="bp-media-album-content">
33
+ <select id="bp-media-selected-album"><?php
34
+ if (bp_is_current_component('groups')) {
35
+ $albums = new WP_Query(array(
36
+ 'post_type' => 'bp_media_album',
37
+ 'posts_per_page' => -1,
38
+ 'meta_key' => 'bp-media-key',
39
+ 'meta_value' => -bp_get_current_group_id(),
40
+ 'meta_compare' => '='
41
+ ));
42
+ } else {
43
+ $albums = new WP_Query(array(
44
+ 'post_type' => 'bp_media_album',
45
+ 'posts_per_page' => -1,
46
+ 'author' => get_current_user_id()
47
+ ));
48
+ }
49
+ if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
50
+ foreach ($albums->posts as $album) {
51
+ if ($album->post_title == $post_wall)
52
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
53
+ else
54
+ echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
55
+ };
56
+ }else {
57
+ $album = new BPMediaAlbum();
58
+ if (bp_is_current_component('groups')) {
59
+ $current_group = new BP_Groups_Group(bp_get_current_group_id());
60
+ $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
61
+ } else {
62
+ $album->add_album($post_wall, bp_loggedin_user_id());
63
+ }
64
+ echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title()->post_title . '</option>';
65
+ }
66
+ echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
67
+ ?>
68
+ </select>
69
+ </div>
70
+ <div class="hide">
71
+ <input type="text" id="bp_media_album_new" value="" placeholder="Album Name" /><br/>
72
+ <input type="button" class="button" id="btn-create-new" value="<?php _e('Create', BP_MEDIA_TXT_DOMAIN); ?>"/>
73
+ <input type="button" class="button" id="btn-create-cancel" value="<?php _e('Cancel', BP_MEDIA_TXT_DOMAIN); ?>"/>
74
+ </div>
75
+ </div>
76
+ <?php } else { ?>
77
+ <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
78
+ <?php } ?>
79
  </div>
80
  <div id="bp-media-uploaded-files"></div>
81
  </div>
171
  case 'media':
172
  global $bp_media_query;
173
  //found_posts
174
+ if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
175
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > (get_option('posts_per_page')-1) )
176
+ $showmore = true;
177
+ } else {
178
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > get_option('posts_per_page') )
179
+ $showmore = true;
180
+ }
181
  break;
182
  case 'albums':
183
  global $bp_media_albums_query;
184
+ if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
185
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > 9)
186
+ $showmore = true;
187
+ } else {
188
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > 10)
189
+ $showmore = true;
190
+ }
191
  break;
192
  }
193
  if ($showmore) {
app/main/profile/BPMediaUploadScreen.php CHANGED
@@ -11,7 +11,7 @@
11
  class BPMediaUploadScreen extends BPMediaScreen {
12
 
13
  /**
14
- *
15
  * @param type $media_type
16
  * @param type $slug
17
  */
@@ -20,7 +20,7 @@ class BPMediaUploadScreen extends BPMediaScreen {
20
  }
21
 
22
  function upload_screen() {
23
- if (bp_is_my_profile() || BPMediaGroup::can_upload()) {
24
  add_action('wp_enqueue_scripts', array($this, 'upload_enqueue'));
25
  add_action('bp_template_title', array($this, 'upload_screen_title'));
26
  add_action('bp_template_content', array($this, 'upload_screen_content'));
@@ -76,7 +76,7 @@ class BPMediaUploadScreen extends BPMediaScreen {
76
  }
77
 
78
  /**
79
- *
80
  * @global type $bp
81
  * @global type $bp_media_options
82
  * @return type
11
  class BPMediaUploadScreen extends BPMediaScreen {
12
 
13
  /**
14
+ *
15
  * @param type $media_type
16
  * @param type $slug
17
  */
20
  }
21
 
22
  function upload_screen() {
23
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
24
  add_action('wp_enqueue_scripts', array($this, 'upload_enqueue'));
25
  add_action('bp_template_title', array($this, 'upload_screen_title'));
26
  add_action('bp_template_content', array($this, 'upload_screen_content'));
76
  }
77
 
78
  /**
79
+ *
80
  * @global type $bp
81
  * @global type $bp_media_options
82
  * @return type
app/main/query/BPMediaQuery.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Don't load this file directly!
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) )
6
+ exit;
7
+
8
+ /**
9
+ * Handles all queries for Media
10
+ *
11
+ * @author Saurabh Shukla <saurabh.shukla@rtcamp.com>
12
+ */
13
+ class BPMediaQuery {
14
+
15
+ /**
16
+ *
17
+ */
18
+ function __construct() {
19
+
20
+ }
21
+
22
+ }
23
+
24
+ ?>
app/main/widgets/BPMediaPopularMedia.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- /*
3
- * To change this template, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-
7
- /**
8
- * Description of BPMediaPopularMediaWidget
9
- *
10
- * @author saurabh
11
- */
12
- class BPMediaPopularMedia extends WP_Widget {
13
-
14
- function __construct() {
15
- $widget_ops = array('classname' => 'BPMediaPopularMedia', 'description' => __("The most popular media on your site", BP_MEDIA_TXT_DOMAIN));
16
- parent::__construct('popular-media', __('Popular BuddyPress Media', BP_MEDIA_TXT_DOMAIN), $widget_ops);
17
- if (is_active_widget(false, false, "popular-media", true)) {
18
- if (defined('WP_DEBUG') && WP_DEBUG)
19
- trigger_error(sprintf(__('%1$s will be <strong>deprecated</strong> from version %2$s! Use %3$s instead.'), "Popular BuddyPress Media Widget", "2.5", "BuddyPress Media Widget"));
20
- else
21
- add_action('admin_notices', array($this, 'deprecated_notice'));
22
- }
23
- }
24
-
25
- function deprecated_notice() {
26
- if (current_user_can('edit_theme_options')) {
27
- echo '<div class="error"><p>';
28
- echo sprintf(__('%1$s will be <strong>deprecated</strong> from version %2$s! Use %3$s instead.'), "Popular BuddyPress Media Widget", "2.5", "BuddyPress Media Widget");
29
- echo '</div>';
30
- }
31
- }
32
-
33
- /**
34
- *
35
- * @param type $args
36
- * @param type $instance
37
- */
38
- function widget($args, $instance) {
39
- extract($args);
40
-
41
- $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Media', BP_MEDIA_TXT_DOMAIN) : $instance['title'], $instance, $this->id_base);
42
-
43
- if (empty($instance['number']) || !$number = absint($instance['number']))
44
- $number = 10;
45
-
46
- echo $before_widget;
47
- echo $before_title . $title . $after_title;
48
- $this->deprecated_notice();
49
- ?>
50
- <div id="popular-media-tabs" class="media-tabs-container">
51
- <!-- <ul>
52
- <li><a href="#popular-media-tabs-comments"><?php _e('comments', BP_MEDIA_TXT_DOMAIN); ?></a></li>
53
- <li><a href="#popular-media-tabs-views"><?php _e('Views', BP_MEDIA_TXT_DOMAIN); ?></a></li>
54
- </ul>-->
55
- <div id="popular-media-tabs-comments" class="bp-media-tab-panel">
56
- <?php
57
- $args = array('post_type' => 'attachment',
58
- 'post_status' => 'any',
59
- 'posts_per_page' => $number,
60
- 'meta_key' => 'bp-media-key',
61
- 'meta_value' => 0,
62
- 'meta_compare' => '>',
63
- 'orderby' => 'comment_count');
64
-
65
- $bp_media_widget_query = new WP_Query($args);
66
-
67
- if ($bp_media_widget_query->have_posts()) {
68
- ?>
69
-
70
- <ul class="widget-item-listing"><?php
71
- while ($bp_media_widget_query->have_posts()) {
72
- $bp_media_widget_query->the_post();
73
-
74
- $entry = new BPMediaHostWordpress(get_the_ID());
75
- ?>
76
-
77
- <?php echo $entry->get_media_gallery_content(); ?><?php }
78
- ?>
79
-
80
- </ul><!-- .widget-item-listing --><?php
81
- }
82
- else
83
- _e('No popular media found', BP_MEDIA_TXT_DOMAIN);
84
-
85
- wp_reset_query();
86
- ?>
87
-
88
- </div><!-- #popular-media-tabs-comments -->
89
- </div>
90
- <?php
91
- echo $after_widget;
92
- }
93
-
94
- /**
95
- *
96
- * @param type $new_instance
97
- * @param type $old_instance
98
- * @return type
99
- */
100
- function update($new_instance, $old_instance) {
101
- $instance = $old_instance;
102
- $instance['title'] = strip_tags($new_instance['title']);
103
- $instance['number'] = (int) $new_instance['number'];
104
- return $instance;
105
- }
106
-
107
- /**
108
- *
109
- * @param type $instance
110
- */
111
- function form($instance) {
112
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
113
- $number = isset($instance['number']) ? absint($instance['number']) : 10;
114
- ?>
115
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', BP_MEDIA_TXT_DOMAIN); ?></label>
116
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
117
-
118
- <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', BP_MEDIA_TXT_DOMAIN); ?></label>
119
- <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
120
- <?php
121
- }
122
-
123
- }
124
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/widgets/BPMediaRecentMedia.php DELETED
@@ -1,236 +0,0 @@
1
- <?php
2
- /*
3
- * To change this template, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-
7
- /**
8
- * Description of BPMediaRecentMediaWidget
9
- *
10
- * @author saurabh
11
- */
12
- class BPMediaRecentMedia extends WP_Widget {
13
-
14
- function __construct() {
15
- $widget_ops = array('classname' => 'widget_recent_media', 'description' => __("The most recent media uploaded on your site", BP_MEDIA_TXT_DOMAIN));
16
- parent::__construct('recent-media', __('Recent BuddyPress Media', BP_MEDIA_TXT_DOMAIN), $widget_ops);
17
- if (is_active_widget(false, false, "recent-media", true)) {
18
- if (defined('WP_DEBUG') && WP_DEBUG)
19
- trigger_error(sprintf(__('%1$s will be <strong>deprecated</strong> from version %2$s! Use %3$s instead.'), "Recent Media Widget", "2.5", "BuddyPress Media Widget"));
20
- else
21
- add_action('admin_notices', array($this, 'deprecated_notice'));
22
- }
23
- }
24
-
25
- function deprecated_notice() {
26
- if (current_user_can('edit_theme_options')) {
27
- echo '<div class="error"><p>';
28
- echo sprintf(__('%1$s will be <strong>deprecated</strong> from version %2$s! Use %3$s instead.'), "Recent BuddyPress Media Widget", "2.5", "BuddyPressMedia Widget");
29
- echo '</div>';
30
- }
31
- }
32
-
33
- /**
34
- *
35
- * @param type $args
36
- * @param type $instance
37
- */
38
- function widget($args, $instance) {
39
- extract($args);
40
-
41
- $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Media', BP_MEDIA_TXT_DOMAIN) : $instance['title'], $instance, $this->id_base);
42
-
43
- if (empty($instance['number']) || !$number = absint($instance['number']))
44
- $number = 10;
45
-
46
- echo $before_widget;
47
- echo $before_title . $title . $after_title;
48
- $this->deprecated_notice();
49
- ?>
50
- <div id="recent-media-tabs" class="media-tabs-container media-tabs-container-tabs">
51
- <ul>
52
- <li><a href="#recent-media-tabs-all"><?php _e('All', BP_MEDIA_TXT_DOMAIN); ?></a></li>
53
- <li><a href="#recent-media-tabs-photos"><?php _e('Photos', BP_MEDIA_TXT_DOMAIN); ?></a></li>
54
- <li><a href="#recent-media-tabs-music"><?php _e('Music', BP_MEDIA_TXT_DOMAIN); ?></a></li>
55
- <li><a href="#recent-media-tabs-videos"><?php _e('Videos', BP_MEDIA_TXT_DOMAIN); ?></a></li>
56
- </ul>
57
- <div id="recent-media-tabs-all" class="bp-media-tab-panel">
58
- <?php
59
- // All Media
60
- $args = array('post_type' => 'attachment',
61
- 'post_status' => 'any',
62
- 'posts_per_page' => $number,
63
- 'meta_key' => 'bp-media-key',
64
- 'meta_value' => 0,
65
- 'meta_compare' => '>');
66
-
67
- $bp_media_widget_query = new WP_Query($args);
68
-
69
- if ($bp_media_widget_query->have_posts()) {
70
- ?>
71
-
72
- <ul class="widget-item-listing"><?php
73
- while ($bp_media_widget_query->have_posts()) {
74
- $bp_media_widget_query->the_post();
75
-
76
- $entry = new BPMediaHostWordpress(get_the_ID());
77
- ?>
78
-
79
- <?php echo $entry->get_media_gallery_content(); ?><?php }
80
- ?>
81
-
82
- </ul><!-- .widget-item-listing --><?php
83
- }
84
- else
85
- _e('No recent media found', BP_MEDIA_TXT_DOMAIN);
86
-
87
- wp_reset_query();
88
- ?>
89
-
90
- </div><!-- #recent-media-tabs-all -->
91
-
92
- <div id="recent-media-tabs-photos" class="bp-media-tab-panel">
93
- <?php
94
- // Recent photos
95
- $args = array('post_type' => 'attachment',
96
- 'post_status' => 'any',
97
- 'post_mime_type' => 'image',
98
- 'posts_per_page' => $number,
99
- 'meta_key' => 'bp-media-key',
100
- 'meta_value' => 0,
101
- 'meta_compare' => '>');
102
-
103
-
104
- $bp_media_widget_query = new WP_Query($args);
105
-
106
- if ($bp_media_widget_query->have_posts()) {
107
- ?>
108
-
109
- <ul class="widget-item-listing"><?php
110
- while ($bp_media_widget_query->have_posts()) {
111
- $bp_media_widget_query->the_post();
112
-
113
- $entry = new BPMediaHostWordpress(get_the_ID());
114
- ?>
115
-
116
- <?php echo $entry->get_media_gallery_content(); ?><?php }
117
- ?>
118
-
119
- </ul><!-- .widget-item-listing --><?php
120
- }
121
- else
122
- _e('No recent photo found', BP_MEDIA_TXT_DOMAIN);
123
-
124
- wp_reset_query();
125
- ?>
126
-
127
- </div><!-- #media-tabs-photos -->
128
-
129
- <div id="recent-media-tabs-music" class="bp-media-tab-panel">
130
- <?php
131
- // Recent Audio
132
- $args = array('post_type' => 'attachment',
133
- 'post_status' => 'any',
134
- 'post_mime_type' => 'audio',
135
- 'posts_per_page' => $number,
136
- 'meta_key' => 'bp-media-key',
137
- 'meta_value' => 0,
138
- 'meta_compare' => '>');
139
-
140
- $bp_media_widget_query = new WP_Query($args);
141
-
142
- if ($bp_media_widget_query->have_posts()) {
143
- ?>
144
-
145
- <ul class="widget-item-listing">
146
- <?php
147
- while ($bp_media_widget_query->have_posts()) {
148
- $bp_media_widget_query->the_post();
149
-
150
- $entry = new BPMediaHostWordpress(get_the_ID());
151
- echo $entry->get_media_gallery_content();
152
- }
153
- ?>
154
-
155
- </ul><!-- .widget-item-listing --><?php
156
- }
157
- else
158
- _e('No recent audio found', BP_MEDIA_TXT_DOMAIN);
159
-
160
- wp_reset_query();
161
- ?>
162
-
163
- </div><!-- #recent-media-tabs-music -->
164
-
165
- <div id="recent-media-tabs-videos" class="bp-media-tab-panel">
166
- <?php
167
- // Recent Video
168
- $args = array('post_type' => 'attachment',
169
- 'post_status' => 'any',
170
- 'post_mime_type' => 'video',
171
- 'posts_per_page' => $number,
172
- 'meta_key' => 'bp-media-key',
173
- 'meta_value' => 0,
174
- 'meta_compare' => '>');
175
-
176
- $bp_media_widget_query = new WP_Query($args);
177
-
178
- if ($bp_media_widget_query->have_posts()) {
179
- ?>
180
-
181
- <ul class="widget-item-listing"><?php
182
- while ($bp_media_widget_query->have_posts()) {
183
- $bp_media_widget_query->the_post();
184
-
185
- $entry = new BPMediaHostWordpress(get_the_ID());
186
- ?>
187
-
188
- <?php echo $entry->get_media_gallery_content(); ?><?php }
189
- ?>
190
-
191
- </ul><!-- .widget-item-listing --><?php
192
- }
193
- else
194
- _e('No recent video found', BP_MEDIA_TXT_DOMAIN);
195
-
196
- wp_reset_query();
197
- ?>
198
-
199
- </div><!-- #media-tabs-videos -->
200
-
201
- </div>
202
- <?php
203
- echo $after_widget;
204
- }
205
-
206
- /**
207
- *
208
- * @param type $new_instance
209
- * @param type $old_instance
210
- * @return type
211
- */
212
- function update($new_instance, $old_instance) {
213
- $instance = $old_instance;
214
- $instance['title'] = strip_tags($new_instance['title']);
215
- $instance['number'] = (int) $new_instance['number'];
216
- return $instance;
217
- }
218
-
219
- /**
220
- *
221
- * @param type $instance
222
- */
223
- function form($instance) {
224
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
225
- $number = isset($instance['number']) ? absint($instance['number']) : 10;
226
- ?>
227
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', BP_MEDIA_TXT_DOMAIN); ?></label>
228
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
229
-
230
- <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', BP_MEDIA_TXT_DOMAIN); ?></label>
231
- <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
232
- <?php
233
- }
234
-
235
- }
236
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/widgets/BPMediaWidget.php CHANGED
@@ -1,296 +1,309 @@
1
  <?php
2
-
3
  /**
4
- * Description of BPMediaMediaWidget
 
 
 
5
  *
6
- * @author faishal
 
 
7
  */
8
- class BPMediaWidget extends WP_Widget {
9
-
10
- function __construct() {
11
- $widget_ops = array('classname' => 'buddypress-media-widget', 'description' => __("The most recent/popular media uploaded on your site", BP_MEDIA_TXT_DOMAIN));
12
- parent::__construct('buddypress-media-wid', __('BuddyPress Media Widget', BP_MEDIA_TXT_DOMAIN), $widget_ops);
13
- }
14
-
15
- /**
16
- *
17
- * @param type $args
18
- * @param type $instance
19
- */
20
- function widget($args, $instance) {
21
- extract($args);
22
- $title = apply_filters('widget_title', empty($instance['title']) ? __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN) : $instance['title'], $instance, $this->id_base);
23
-
24
- if (empty($instance['number']) || !$number = absint($instance['number']))
25
- $number = 10;
26
- $wdType = isset($instance['wdType']) ? esc_attr($instance['wdType']) : 'recent';
27
- $allowAudio = isset($instance['allow_audio']) ? (bool) $instance['allow_audio'] : true;
28
- $allowVideo = isset($instance['allow_video']) ? (bool) $instance['allow_video'] : true;
29
- $allowImage = isset($instance['allow_image']) ? (bool) $instance['allow_image'] : true;
30
- $allowAll = isset($instance['allow_all']) ? (bool) $instance['allow_all'] : true;
31
- $allowMimeType = array();
32
- echo $before_widget;
33
- echo $before_title . $title . $after_title;
34
- if ($wdType == "popular") {
35
- $orderby = 'comment_count';
36
- } else {
37
- $orderby = 'date';
38
- }
39
- $widgetid = $args['widget_id'];
40
- if (!($allowAll || $allowAudio || $allowVideo || $allowImage)) {
41
- ?>
42
- <p><?php printf(__('Please configure this widget <a href="%s" target="_blank" title="Configure BuddyPress Media Widget">here</a>.', 'rtPanel'), admin_url('/widgets.php')); ?></p><?php } else {
43
- ?>
44
-
45
- <div id="<?php echo $wdType; ?>-media-tabs" class="media-tabs-container media-tabs-container-tabs">
46
- <ul>
47
- <?php if ($allowAll) { ?>
48
- <li><a href="#<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>"><?php _e('All', BP_MEDIA_TXT_DOMAIN); ?></a></li>
49
- <?php
50
- }
51
- if ($allowImage) {
52
- array_push($allowMimeType, "image");
53
- ?>
54
- <li><a href="#<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>"><?php _e('Photos', BP_MEDIA_TXT_DOMAIN); ?></a></li>
55
- <?php
56
- }
57
- if ($allowAudio) {
58
- array_push($allowMimeType, "audio");
59
- ?>
60
- <li><a href="#<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>"><?php _e('Music', BP_MEDIA_TXT_DOMAIN); ?></a></li>
61
- <?php
62
- }
63
- if ($allowVideo) {
64
- array_push($allowMimeType, "video");
65
- ?>
66
- <li><a href="#<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>"><?php _e('Videos', BP_MEDIA_TXT_DOMAIN); ?></a></li>
67
- <?php }
68
- ?>
69
- </ul>
70
- <?php if ($allowAll) { ?>
71
- <div id="<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
72
- <?php
73
- // All Media //'post_mime_type' => $allowMimeType,
74
- $args = array('post_type' => 'attachment',
75
- 'post_status' => 'any',
76
- 'posts_per_page' => $number,
77
- 'meta_key' => 'bp-media-key',
78
- 'meta_value' => 0,
79
- 'meta_compare' => '>',
80
- 'orderby' => $orderby
81
- );
82
-
83
- $bp_media_widget_query = new WP_Query($args);
84
-
85
- if ($bp_media_widget_query->have_posts()) {
86
- ?>
87
-
88
- <ul class="widget-item-listing"><?php
89
- while ($bp_media_widget_query->have_posts()) {
90
- $bp_media_widget_query->the_post();
91
-
92
- $entry = new BPMediaHostWordpress(get_the_ID());
93
- ?>
94
-
95
- <?php echo $entry->get_media_gallery_content(); ?><?php }
96
- ?>
97
-
98
- </ul><?php
99
- }
100
- else
101
- _e('No ' . $wdType . ' media found', BP_MEDIA_TXT_DOMAIN);
102
-
103
- wp_reset_query();
104
- ?>
105
-
106
- </div>
107
- <?php
108
- }
109
- if ($allowImage) {
110
- ?>
111
- <div id="<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
112
- <?php
113
- // photos
114
- $args = array('post_type' => 'attachment',
115
- 'post_status' => 'any',
116
- 'post_mime_type' => 'image',
117
- 'posts_per_page' => $number,
118
- 'meta_key' => 'bp-media-key',
119
- 'meta_value' => 0,
120
- 'meta_compare' => '>',
121
- 'orderby' => $orderby);
122
-
123
- $bp_media_widget_query = new WP_Query($args);
124
-
125
- if ($bp_media_widget_query->have_posts()) {
126
- ?>
127
-
128
- <ul class="widget-item-listing"><?php
129
- while ($bp_media_widget_query->have_posts()) {
130
- $bp_media_widget_query->the_post();
131
-
132
- $entry = new BPMediaHostWordpress(get_the_ID());
133
- ?>
134
-
135
- <?php echo $entry->get_media_gallery_content(); ?><?php }
136
- ?>
137
-
138
- </ul><!-- .widget-item-listing --><?php
139
- }
140
- else
141
- _e('No ' . $wdType . ' photo found', BP_MEDIA_TXT_DOMAIN);
142
-
143
- wp_reset_query();
144
- ?>
145
-
146
- </div>
147
- <?php
148
- }
149
- if ($allowAudio) {
150
- ?>
151
-
152
- <div id="<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
153
- <?php
154
- // Audio
155
- $args = array('post_type' => 'attachment',
156
- 'post_status' => 'any',
157
- 'post_mime_type' => 'audio',
158
- 'posts_per_page' => $number,
159
- 'meta_key' => 'bp-media-key',
160
- 'meta_value' => 0,
161
- 'meta_compare' => '>',
162
- 'orderby' => $orderby);
163
- $bp_media_widget_query = new WP_Query($args);
164
-
165
- if ($bp_media_widget_query->have_posts()) {
166
- ?>
167
-
168
- <ul class="widget-item-listing">
169
- <?php
170
- while ($bp_media_widget_query->have_posts()) {
171
- $bp_media_widget_query->the_post();
172
-
173
- $entry = new BPMediaHostWordpress(get_the_ID());
174
- echo $entry->get_media_gallery_content();
175
- }
176
- ?>
177
-
178
- </ul><?php
179
- }
180
- else
181
- _e('No ' . $wdType . ' audio found', BP_MEDIA_TXT_DOMAIN);
182
-
183
- wp_reset_query();
184
- ?>
185
-
186
- </div>
187
-
188
- <?php
189
- }
190
- if ($allowVideo) {
191
- ?>
192
- <div id="<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
193
- <?php
194
- //Video
195
- $args = array('post_type' => 'attachment',
196
- 'post_status' => 'any',
197
- 'post_mime_type' => 'video',
198
- 'posts_per_page' => $number,
199
- 'meta_key' => 'bp-media-key',
200
- 'meta_value' => 0,
201
- 'meta_compare' => '>',
202
- 'orderby' => $orderby);
203
- $bp_media_widget_query = new WP_Query($args);
204
-
205
- if ($bp_media_widget_query->have_posts()) {
206
- ?>
207
-
208
- <ul class="widget-item-listing"><?php
209
- while ($bp_media_widget_query->have_posts()) {
210
- $bp_media_widget_query->the_post();
211
-
212
- $entry = new BPMediaHostWordpress(get_the_ID());
213
- ?>
214
-
215
- <?php echo $entry->get_media_gallery_content(); ?><?php }
216
- ?>
217
-
218
- </ul><?php
219
- }
220
- else
221
- _e('No ' . $wdType . ' video found', BP_MEDIA_TXT_DOMAIN);
222
-
223
- wp_reset_query();
224
- ?>
225
-
226
- </div>
227
- <?php } ?>
228
- </div>
229
- <?php
230
- }
231
- echo $after_widget;
232
- }
233
-
234
- /**
235
- *
236
- * @param type $new_instance
237
- * @param type $old_instance
238
- * @return type
239
- */
240
- function update($new_instance, $old_instance) {
241
- $instance = $old_instance;
242
- $instance['wdType'] = strip_tags($new_instance['wdType']);
243
- $instance['title'] = strip_tags($new_instance['title']);
244
- $instance['number'] = (int) $new_instance['number'];
245
- $instance['allow_audio'] = !empty($new_instance['allow_audio']) ? 1 : 0;
246
- $instance['allow_video'] = !empty($new_instance['allow_video']) ? 1 : 0;
247
- $instance['allow_image'] = !empty($new_instance['allow_image']) ? 1 : 0;
248
- $instance['allow_all'] = !empty($new_instance['allow_all']) ? 1 : 0;
249
-
250
- return $instance;
251
- }
252
-
253
- /**
254
- *
255
- * @param type $instance
256
- */
257
- function form($instance) {
258
- $wdType = isset($instance['wdType']) ? esc_attr($instance['wdType']) : '';
259
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
260
- $number = isset($instance['number']) ? absint($instance['number']) : 10;
261
- $allowAudio = isset($instance['allow_audio']) ? (bool) $instance['allow_audio'] : true;
262
- $allowVideo = isset($instance['allow_video']) ? (bool) $instance['allow_video'] : true;
263
- $allowImage = isset($instance['allow_image']) ? (bool) $instance['allow_image'] : true;
264
- $allowAll = isset($instance['allow_all']) ? (bool) $instance['allow_all'] : true;
265
- ?>
266
- <p><label for="<?php echo $this->get_field_id('wdType'); ?>"><?php _e('Widget Type:', BP_MEDIA_TXT_DOMAIN); ?></label>
267
- <select class="widefat" id="<?php echo $this->get_field_id('wdType'); ?>" name="<?php echo $this->get_field_name('wdType'); ?>">
268
- <option value="recent" <?php if ($wdType == "recent") echo 'selected="selected"'; ?>><?php _e('Recent Media', BP_MEDIA_TXT_DOMAIN); ?></option>
269
- <option value="popular" <?php if ($wdType == "popular") echo 'selected="selected"'; ?>><?php _e('Popular Media', BP_MEDIA_TXT_DOMAIN); ?></option>
270
- </select>
271
- </p>
272
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', BP_MEDIA_TXT_DOMAIN); ?></label>
273
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
274
-
275
- <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', BP_MEDIA_TXT_DOMAIN); ?></label>
276
- <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
277
-
278
- <p>
279
- <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name('allow_all'); ?>" id="<?php echo $this->get_field_id('allow_all'); ?>" <?php checked($allowAll); ?> /><label for="<?php echo $this->get_field_id('allow_all'); ?>"><?php _e('Show All', BP_MEDIA_TXT_DOMAIN); ?></label>
280
- </p>
281
- <p>
282
- <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name('allow_image'); ?>" id="<?php echo $this->get_field_id('allow_image'); ?>" <?php checked($allowImage); ?> /><label for="<?php echo $this->get_field_id('allow_image'); ?>"><?php _e('Show Photos', BP_MEDIA_TXT_DOMAIN); ?></label>
283
- </p>
284
- <p>
285
- <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name('allow_audio'); ?>" id="<?php echo $this->get_field_id('allow_audio'); ?>" <?php checked($allowAudio); ?> /> <label for="<?php echo $this->get_field_id('allow_audio'); ?>"><?php _e('Show Music', BP_MEDIA_TXT_DOMAIN); ?></label>
286
- </p>
287
- <p>
288
- <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name('allow_video'); ?>" id="<?php echo $this->get_field_id('allow_video'); ?>" <?php checked($allowVideo); ?> />
289
- <label for="<?php echo $this->get_field_id('allow_video'); ?>"><?php _e('Show Videos', BP_MEDIA_TXT_DOMAIN); ?></label>
290
- </p>
291
-
292
- <?php
293
- }
 
 
 
 
 
 
 
 
 
294
 
295
  }
296
  ?>
1
  <?php
 
2
  /**
3
+ * Creates the BuddyPress Media Widget that is used to display media in sidebars.
4
+ *
5
+ * @package BuddyPressMedia
6
+ * @subpackage Widgets
7
  *
8
+ * @author Faishal Saiyed <faishal.saiyed@rtcamp.com>
9
+ * @author Umesh Nevase <umesh.nevase@rtcamp.com>
10
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
11
  */
12
+ if ( ! class_exists( 'BPMediaWidget' ) ) {
13
+
14
+ class BPMediaWidget extends WP_Widget {
15
+
16
+ /**
17
+ * Constructs the BPMedia Widget as a child of WP_Widget
18
+ */
19
+ function __construct() {
20
+ $widget_ops = array( 'classname' => 'buddypress-media-widget', 'description' => __( "The most recent/popular media uploaded on your site", BP_MEDIA_TXT_DOMAIN ) );
21
+ parent::__construct( 'buddypress-media-wid', __( 'BuddyPress Media Widget', BP_MEDIA_TXT_DOMAIN ), $widget_ops );
22
+ }
23
+
24
+ /**
25
+ * Displays widget in the frontend (sidebar)
26
+ *
27
+ * @param array $args Arguments passed to the widget instance
28
+ * @param array $instance The title, etc of the specific widget instance
29
+ */
30
+ function widget( $args, $instance ) {
31
+ extract( $args );
32
+ $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? __( 'BuddyPress Media', BP_MEDIA_TXT_DOMAIN ) : $instance[ 'title' ], $instance, $this->id_base );
33
+
34
+ if ( empty( $instance[ 'number' ] ) || ! $number = absint( $instance[ 'number' ] ) )
35
+ $number = 10;
36
+ $wdType = isset( $instance[ 'wdType' ] ) ? esc_attr( $instance[ 'wdType' ] ) : 'recent';
37
+ $allowAudio = isset( $instance[ 'allow_audio' ] ) ? (bool) $instance[ 'allow_audio' ] : true;
38
+ $allowVideo = isset( $instance[ 'allow_video' ] ) ? (bool) $instance[ 'allow_video' ] : true;
39
+ $allowImage = isset( $instance[ 'allow_image' ] ) ? (bool) $instance[ 'allow_image' ] : true;
40
+ $allowAll = isset( $instance[ 'allow_all' ] ) ? (bool) $instance[ 'allow_all' ] : true;
41
+ $allowMimeType = array( );
42
+ echo $before_widget;
43
+ echo $before_title . $title . $after_title;
44
+ if ( $wdType == "popular" ) {
45
+ $orderby = 'comment_count';
46
+ } else {
47
+ $orderby = 'date';
48
+ }
49
+ $widgetid = $args[ 'widget_id' ];
50
+ if ( ! ($allowAll || $allowAudio || $allowVideo || $allowImage) ) {
51
+ ?>
52
+ <p><?php printf( __( 'Please configure this widget <a href="%s" target="_blank" title="Configure BuddyPress Media Widget">here</a>.', 'rtPanel' ), admin_url( '/widgets.php' ) ); ?></p><?php } else {
53
+ ?>
54
+
55
+ <div id="<?php echo $wdType; ?>-media-tabs" class="media-tabs-container media-tabs-container-tabs">
56
+ <ul>
57
+ <?php if ( $allowAll ) { ?>
58
+ <li><a href="#<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>"><?php _e( 'All', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
59
+ <?php
60
+ }
61
+ if ( $allowImage ) {
62
+ array_push( $allowMimeType, "image" );
63
+ ?>
64
+ <li><a href="#<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>"><?php _e( 'Photos', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
65
+ <?php
66
+ }
67
+ if ( $allowAudio ) {
68
+ array_push( $allowMimeType, "audio" );
69
+ ?>
70
+ <li><a href="#<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>"><?php _e( 'Music', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
71
+ <?php
72
+ }
73
+ if ( $allowVideo ) {
74
+ array_push( $allowMimeType, "video" );
75
+ ?>
76
+ <li><a href="#<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>"><?php _e( 'Videos', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
77
+ <?php }
78
+ ?>
79
+ </ul>
80
+ <?php if ( $allowAll ) { ?>
81
+ <div id="<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
82
+ <?php
83
+ $args = array( 'post_type' => 'attachment',
84
+ 'post_status' => 'any',
85
+ 'posts_per_page' => $number,
86
+ 'meta_key' => 'bp-media-key',
87
+ 'meta_value' => 0,
88
+ 'meta_compare' => '>',
89
+ 'orderby' => $orderby
90
+ );
91
+
92
+ $bp_media_widget_query = new WP_Query( $args );
93
+
94
+ if ( $bp_media_widget_query->have_posts() ) {
95
+ ?>
96
+
97
+ <ul class="widget-item-listing"><?php
98
+ while ( $bp_media_widget_query->have_posts() ) {
99
+ $bp_media_widget_query->the_post();
100
+
101
+ $entry = new BPMediaHostWordpress( get_the_ID() );
102
+ ?>
103
+
104
+ <?php echo $entry->get_media_gallery_content(); ?><?php }
105
+ ?>
106
+
107
+ </ul><?php
108
+ }
109
+ else
110
+ _e( 'No ' . $wdType . ' media found', BP_MEDIA_TXT_DOMAIN );
111
+
112
+ wp_reset_query();
113
+ ?>
114
+
115
+ </div>
116
+ <?php
117
+ }
118
+ if ( $allowImage ) {
119
+ ?>
120
+ <div id="<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
121
+ <?php
122
+ // photos
123
+ $args = array( 'post_type' => 'attachment',
124
+ 'post_status' => 'any',
125
+ 'post_mime_type' => 'image',
126
+ 'posts_per_page' => $number,
127
+ 'meta_key' => 'bp-media-key',
128
+ 'meta_value' => 0,
129
+ 'meta_compare' => '>',
130
+ 'orderby' => $orderby );
131
+
132
+ $bp_media_widget_query = new WP_Query( $args );
133
+
134
+ if ( $bp_media_widget_query->have_posts() ) {
135
+ ?>
136
+
137
+ <ul class="widget-item-listing"><?php
138
+ while ( $bp_media_widget_query->have_posts() ) {
139
+ $bp_media_widget_query->the_post();
140
+
141
+ $entry = new BPMediaHostWordpress( get_the_ID() );
142
+ ?>
143
+
144
+ <?php echo $entry->get_media_gallery_content(); ?><?php }
145
+ ?>
146
+
147
+ </ul><!-- .widget-item-listing --><?php
148
+ }
149
+ else
150
+ _e( 'No ' . $wdType . ' photo found', BP_MEDIA_TXT_DOMAIN );
151
+
152
+ wp_reset_query();
153
+ ?>
154
+
155
+ </div>
156
+ <?php
157
+ }
158
+ if ( $allowAudio ) {
159
+ ?>
160
+
161
+ <div id="<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
162
+ <?php
163
+ // Audio
164
+ $args = array( 'post_type' => 'attachment',
165
+ 'post_status' => 'any',
166
+ 'post_mime_type' => 'audio',
167
+ 'posts_per_page' => $number,
168
+ 'meta_key' => 'bp-media-key',
169
+ 'meta_value' => 0,
170
+ 'meta_compare' => '>',
171
+ 'orderby' => $orderby );
172
+ $bp_media_widget_query = new WP_Query( $args );
173
+
174
+ if ( $bp_media_widget_query->have_posts() ) {
175
+ ?>
176
+
177
+ <ul class="widget-item-listing">
178
+ <?php
179
+ while ( $bp_media_widget_query->have_posts() ) {
180
+ $bp_media_widget_query->the_post();
181
+
182
+ $entry = new BPMediaHostWordpress( get_the_ID() );
183
+ echo $entry->get_media_gallery_content();
184
+ }
185
+ ?>
186
+
187
+ </ul><?php
188
+ }
189
+ else
190
+ _e( 'No ' . $wdType . ' audio found', BP_MEDIA_TXT_DOMAIN );
191
+
192
+ wp_reset_query();
193
+ ?>
194
+
195
+ </div>
196
+
197
+ <?php
198
+ }
199
+ if ( $allowVideo ) {
200
+ ?>
201
+ <div id="<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
202
+ <?php
203
+ //Video
204
+ $args = array( 'post_type' => 'attachment',
205
+ 'post_status' => 'any',
206
+ 'post_mime_type' => 'video',
207
+ 'posts_per_page' => $number,
208
+ 'meta_key' => 'bp-media-key',
209
+ 'meta_value' => 0,
210
+ 'meta_compare' => '>',
211
+ 'orderby' => $orderby );
212
+ $bp_media_widget_query = new WP_Query( $args );
213
+
214
+ if ( $bp_media_widget_query->have_posts() ) {
215
+ ?>
216
+
217
+ <ul class="widget-item-listing"><?php
218
+ while ( $bp_media_widget_query->have_posts() ) {
219
+ $bp_media_widget_query->the_post();
220
+
221
+ $entry = new BPMediaHostWordpress( get_the_ID() );
222
+ ?>
223
+
224
+ <?php echo $entry->get_media_gallery_content(); ?><?php }
225
+ ?>
226
+
227
+ </ul><?php
228
+ }
229
+ else
230
+ _e( 'No ' . $wdType . ' video found', BP_MEDIA_TXT_DOMAIN );
231
+
232
+ wp_reset_query();
233
+ ?>
234
+
235
+ </div>
236
+ <?php } ?>
237
+ </div>
238
+ <?php
239
+ }
240
+ echo $after_widget;
241
+ }
242
+
243
+ /**
244
+ * Processes the widget form
245
+ *
246
+ * @param array/object $new_instance The new instance of the widget
247
+ * @param array/object $old_instance The default widget instance
248
+ * @return array/object filtered and corrected instance
249
+ */
250
+ function update( $new_instance, $old_instance ) {
251
+ $instance = $old_instance;
252
+ $instance[ 'wdType' ] = strip_tags( $new_instance[ 'wdType' ] );
253
+ $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
254
+ $instance[ 'number' ] = (int) $new_instance[ 'number' ];
255
+ $instance[ 'allow_audio' ] = ! empty( $new_instance[ 'allow_audio' ] ) ? 1 : 0;
256
+ $instance[ 'allow_video' ] = ! empty( $new_instance[ 'allow_video' ] ) ? 1 : 0;
257
+ $instance[ 'allow_image' ] = ! empty( $new_instance[ 'allow_image' ] ) ? 1 : 0;
258
+ $instance[ 'allow_all' ] = ! empty( $new_instance[ 'allow_all' ] ) ? 1 : 0;
259
+
260
+ return $instance;
261
+ }
262
+
263
+ /**
264
+ * Displays the form for the widget settings on the Widget screen
265
+ *
266
+ * @param object/array $instance The widget instance
267
+ */
268
+ function form( $instance ) {
269
+ $wdType = isset( $instance[ 'wdType' ] ) ? esc_attr( $instance[ 'wdType' ] ) : '';
270
+ $title = isset( $instance[ 'title' ] ) ? esc_attr( $instance[ 'title' ] ) : '';
271
+ $number = isset( $instance[ 'number' ] ) ? absint( $instance[ 'number' ] ) : 10;
272
+ $allowAudio = isset( $instance[ 'allow_audio' ] ) ? (bool) $instance[ 'allow_audio' ] : true;
273
+ $allowVideo = isset( $instance[ 'allow_video' ] ) ? (bool) $instance[ 'allow_video' ] : true;
274
+ $allowImage = isset( $instance[ 'allow_image' ] ) ? (bool) $instance[ 'allow_image' ] : true;
275
+ $allowAll = isset( $instance[ 'allow_all' ] ) ? (bool) $instance[ 'allow_all' ] : true;
276
+ ?>
277
+ <p><label for="<?php echo $this->get_field_id( 'wdType' ); ?>"><?php _e( 'Widget Type:', BP_MEDIA_TXT_DOMAIN ); ?></label>
278
+ <select class="widefat" id="<?php echo $this->get_field_id( 'wdType' ); ?>" name="<?php echo $this->get_field_name( 'wdType' ); ?>">
279
+ <option value="recent" <?php if ( $wdType == "recent" ) echo 'selected="selected"'; ?>><?php _e( 'Recent Media', BP_MEDIA_TXT_DOMAIN ); ?></option>
280
+ <option value="popular" <?php if ( $wdType == "popular" ) echo 'selected="selected"'; ?>><?php _e( 'Popular Media', BP_MEDIA_TXT_DOMAIN ); ?></option>
281
+ </select>
282
+ </p>
283
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', BP_MEDIA_TXT_DOMAIN ); ?></label>
284
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
285
+
286
+ <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', BP_MEDIA_TXT_DOMAIN ); ?></label>
287
+ <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
288
+
289
+ <p>
290
+ <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'allow_all' ); ?>" id="<?php echo $this->get_field_id( 'allow_all' ); ?>" <?php checked( $allowAll ); ?> /><label for="<?php echo $this->get_field_id( 'allow_all' ); ?>"><?php _e( 'Show All', BP_MEDIA_TXT_DOMAIN ); ?></label>
291
+ </p>
292
+ <p>
293
+ <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'allow_image' ); ?>" id="<?php echo $this->get_field_id( 'allow_image' ); ?>" <?php checked( $allowImage ); ?> /><label for="<?php echo $this->get_field_id( 'allow_image' ); ?>"><?php _e( 'Show Photos', BP_MEDIA_TXT_DOMAIN ); ?></label>
294
+ </p>
295
+ <p>
296
+ <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'allow_audio' ); ?>" id="<?php echo $this->get_field_id( 'allow_audio' ); ?>" <?php checked( $allowAudio ); ?> /> <label for="<?php echo $this->get_field_id( 'allow_audio' ); ?>"><?php _e( 'Show Music', BP_MEDIA_TXT_DOMAIN ); ?></label>
297
+ </p>
298
+ <p>
299
+ <input role="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'allow_video' ); ?>" id="<?php echo $this->get_field_id( 'allow_video' ); ?>" <?php checked( $allowVideo ); ?> />
300
+ <label for="<?php echo $this->get_field_id( 'allow_video' ); ?>"><?php _e( 'Show Videos', BP_MEDIA_TXT_DOMAIN ); ?></label>
301
+ </p>
302
+
303
+ <?php
304
+ }
305
+
306
+ }
307
 
308
  }
309
  ?>
index.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/
5
- Description: This plugin adds missing media rich features like photos, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.5.3
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com
@@ -46,12 +46,14 @@ function buddypress_media_autoloader( $class_name ) {
46
  'app/helper/' . $class_name . '.php',
47
  'app/admin/' . $class_name . '.php',
48
  'app/main/' . $class_name . '.php',
 
49
  'app/main/profile/' . $class_name . '.php',
50
  'app/main/group/' . $class_name . '.php',
51
  'app/main/group/dummy/' . $class_name . '.php',
52
  'app/main/includes/' . $class_name . '.php',
53
  'app/main/widgets/' . $class_name . '.php',
54
  'app/log/' . $class_name . '.php',
 
55
  );
56
  foreach ( $rtlibpath as $i => $path ) {
57
  $path = BP_MEDIA_PATH . $path;
@@ -72,8 +74,11 @@ spl_autoload_register( 'buddypress_media_autoloader' );
72
  */
73
  global $bp_media;
74
  $bp_media = new BuddyPressMedia();
 
 
75
 
 
76
  /*
77
- * Look Ma! Very few includes!
78
  */
79
  ?>
2
  /*
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/
5
+ Description: This plugin adds missing media rich features like photos, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.5.4
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com
46
  'app/helper/' . $class_name . '.php',
47
  'app/admin/' . $class_name . '.php',
48
  'app/main/' . $class_name . '.php',
49
+ 'app/main/activity/' . $class_name . '.php',
50
  'app/main/profile/' . $class_name . '.php',
51
  'app/main/group/' . $class_name . '.php',
52
  'app/main/group/dummy/' . $class_name . '.php',
53
  'app/main/includes/' . $class_name . '.php',
54
  'app/main/widgets/' . $class_name . '.php',
55
  'app/log/' . $class_name . '.php',
56
+ 'app/importers/' . $class_name . '.php',
57
  );
58
  foreach ( $rtlibpath as $i => $path ) {
59
  $path = BP_MEDIA_PATH . $path;
74
  */
75
  global $bp_media;
76
  $bp_media = new BuddyPressMedia();
77
+ BuddyPressMedia::get_wall_album();
78
+ //add_action('init','BPMediaBPAlbumImporter');
79
 
80
+ //BPMediaBPAlbumImporter::bpmedia_ajax_import_callback();
81
  /*
82
+ * Look Ma! Very few includes! Next File: /app/main/BuddyPressMedia.php
83
  */
84
  ?>
lang/buddypress-media.po DELETED
@@ -1,1009 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Buddypress Media\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-01-14 17:03+0530\n"
6
- "PO-Revision-Date: 2013-01-14 17:03+0530\n"
7
- "Last-Translator: Saurabh Shukla <saurabh.shukla@rtcamp.com>\n"
8
- "Language-Team: rtCamp <info@rtcamp.com>\n"
9
- "Language: \n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
14
- "X-Poedit-Basepath: ../.\n"
15
- "X-Poedit-SearchPath-0: .\n"
16
-
17
- #: app/helper/BPMediaWidget.php:22
18
- msgid "Argument missing. id is required."
19
- msgstr ""
20
-
21
- #: app/helper/BPMediaFeed.php:38
22
- msgid "No items"
23
- msgstr ""
24
-
25
- #: app/helper/BPMediaFeed.php:44
26
- msgid "Posted "
27
- msgstr ""
28
-
29
- #: app/helper/BPMediaSettings.php:23
30
- msgid "BuddyPress Media Settings"
31
- msgstr ""
32
-
33
- #: app/helper/BPMediaSettings.php:24
34
- msgid "Video"
35
- msgstr ""
36
-
37
- #: app/helper/BPMediaSettings.php:26
38
- msgid "Check to enable video upload functionality"
39
- msgstr ""
40
-
41
- #: app/helper/BPMediaSettings.php:28
42
- msgid "Audio"
43
- msgstr ""
44
-
45
- #: app/helper/BPMediaSettings.php:30
46
- msgid "Check to enable audio upload functionality"
47
- msgstr ""
48
-
49
- #: app/helper/BPMediaSettings.php:32
50
- msgid "Images"
51
- msgstr ""
52
-
53
- #: app/helper/BPMediaSettings.php:34
54
- msgid "Check to enable images upload functionality"
55
- msgstr ""
56
-
57
- #: app/helper/BPMediaSettings.php:36
58
- msgid "Download"
59
- msgstr ""
60
-
61
- #: app/helper/BPMediaSettings.php:38
62
- msgid "Check to enable download functionality"
63
- msgstr ""
64
-
65
- #: app/helper/BPMediaSettings.php:40
66
- #: app/helper/BPMediaSettings.php:41
67
- msgid "Spread the Word"
68
- msgstr ""
69
-
70
- #: app/helper/BPMediaSettings.php:44
71
- msgid "Yes, I support BuddyPress Media"
72
- msgstr ""
73
-
74
- #: app/helper/BPMediaSettings.php:45
75
- msgid "No, I don't want to support BuddyPress Media"
76
- msgstr ""
77
-
78
- #: app/helper/BPMediaSettings.php:48
79
- msgid "BuddyPress Media Other Options"
80
- msgstr ""
81
-
82
- #: app/helper/BPMediaSettings.php:49
83
- msgid "Re-Count Media Entries"
84
- msgstr ""
85
-
86
- #: app/helper/BPMediaSettings.php:52
87
- msgid "It will re-count all media entries of all users and correct any discrepancies."
88
- msgstr ""
89
-
90
- #: app/helper/BPMediaSettings.php:55
91
- msgid "BuddyPress Media Addons for Audio/Video Conversion"
92
- msgstr ""
93
-
94
- #: app/helper/BPMediaSettings.php:56
95
- msgid "Submit a request form"
96
- msgstr ""
97
-
98
- #: app/helper/BPMediaSettings.php:57
99
- msgid "Request Type"
100
- msgstr ""
101
-
102
- #: app/helper/BPMediaSettings.php:73
103
- msgid "Recounting of media files done successfully"
104
- msgstr ""
105
-
106
- #: app/helper/BPMediaSettings.php:75
107
- msgid "Recounting Failed"
108
- msgstr ""
109
-
110
- #: app/helper/BPMediaSettings.php:96
111
- msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' ) "
112
- msgstr ""
113
-
114
- #: app/helper/BPMediaSettings.php:126
115
- #: app/helper/BPMediaSettings.php:156
116
- msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' )"
117
- msgstr ""
118
-
119
- #: app/helper/BPMediaSettings.php:128
120
- msgid "Need to specify atleast to radios else use a checkbox instead"
121
- msgstr ""
122
-
123
- #: app/helper/BPMediaSettings.php:158
124
- msgid "Please provide some values to populate the dropdown. Format : array( 'value' => 'option' )"
125
- msgstr ""
126
-
127
- #: app/helper/BPMediaSupport.php:23
128
- msgid "Submit a Bug Report"
129
- msgstr ""
130
-
131
- #: app/helper/BPMediaSupport.php:26
132
- msgid "Submit a New Feature Request"
133
- msgstr ""
134
-
135
- #: app/helper/BPMediaSupport.php:29
136
- msgid "Submit a Premium Support Request"
137
- msgstr ""
138
-
139
- #: app/helper/BPMediaSupport.php:37
140
- #: app/helper/BPMediaSupport.php:113
141
- msgid "Name"
142
- msgstr ""
143
-
144
- #: app/helper/BPMediaSupport.php:40
145
- #: app/helper/BPMediaSupport.php:116
146
- msgid "Email"
147
- msgstr ""
148
-
149
- #: app/helper/BPMediaSupport.php:43
150
- #: app/helper/BPMediaSupport.php:119
151
- msgid "Website"
152
- msgstr ""
153
-
154
- #: app/helper/BPMediaSupport.php:46
155
- #: app/helper/BPMediaSupport.php:122
156
- msgid "Phone"
157
- msgstr ""
158
-
159
- #: app/helper/BPMediaSupport.php:49
160
- #: app/helper/BPMediaSupport.php:125
161
- msgid "Subject"
162
- msgstr ""
163
-
164
- #: app/helper/BPMediaSupport.php:52
165
- #: app/helper/BPMediaSupport.php:128
166
- msgid "Details"
167
- msgstr ""
168
-
169
- #: app/helper/BPMediaSupport.php:68
170
- msgid "Your WP Admin Login:"
171
- msgstr ""
172
-
173
- #: app/helper/BPMediaSupport.php:71
174
- msgid "Your WP Admin password:"
175
- msgstr ""
176
-
177
- #: app/helper/BPMediaSupport.php:74
178
- msgid "Your SSH / FTP host:"
179
- msgstr ""
180
-
181
- #: app/helper/BPMediaSupport.php:77
182
- msgid "Your SSH / FTP login:"
183
- msgstr ""
184
-
185
- #: app/helper/BPMediaSupport.php:80
186
- msgid "Your SSH / FTP password:"
187
- msgstr ""
188
-
189
- #: app/helper/BPMediaSupport.php:98
190
- msgid "BuddyPress Media Premium Support Request from"
191
- msgstr ""
192
-
193
- #: app/helper/BPMediaSupport.php:100
194
- msgid "BuddyPress Media New Feature Request from"
195
- msgstr ""
196
-
197
- #: app/helper/BPMediaSupport.php:102
198
- msgid "BuddyPress Media Bug Report from"
199
- msgstr ""
200
-
201
- #: app/helper/BPMediaSupport.php:104
202
- msgid "BuddyPress Media Contact from"
203
- msgstr ""
204
-
205
- #: app/helper/BPMediaSupport.php:131
206
- msgid "Request ID"
207
- msgstr ""
208
-
209
- #: app/helper/BPMediaSupport.php:134
210
- msgid "Server Address"
211
- msgstr ""
212
-
213
- #: app/helper/BPMediaSupport.php:137
214
- msgid "IP Address"
215
- msgstr ""
216
-
217
- #: app/helper/BPMediaSupport.php:140
218
- msgid "Server Type"
219
- msgstr ""
220
-
221
- #: app/helper/BPMediaSupport.php:143
222
- msgid "User Agent"
223
- msgstr ""
224
-
225
- #: app/helper/BPMediaSupport.php:147
226
- msgid "WordPress Admin Username"
227
- msgstr ""
228
-
229
- #: app/helper/BPMediaSupport.php:150
230
- msgid "WordPress Admin Password"
231
- msgstr ""
232
-
233
- #: app/helper/BPMediaSupport.php:153
234
- msgid "SSH FTP Host"
235
- msgstr ""
236
-
237
- #: app/helper/BPMediaSupport.php:156
238
- msgid "SSH FTP Username"
239
- msgstr ""
240
-
241
- #: app/helper/BPMediaSupport.php:159
242
- msgid "SSH FTP Password"
243
- msgstr ""
244
-
245
- #: app/helper/BPMediaSupport.php:170
246
- msgid "Thank you for your Feedback/Suggestion."
247
- msgstr ""
248
-
249
- #: app/helper/BPMediaSupport.php:172
250
- msgid "Thank you for posting your support request."
251
- msgstr ""
252
-
253
- #: app/helper/BPMediaSupport.php:173
254
- msgid "We will get back to you shortly."
255
- msgstr ""
256
-
257
- #: app/helper/BPMediaSupport.php:176
258
- msgid "Your server failed to send an email."
259
- msgstr ""
260
-
261
- #: app/helper/BPMediaSupport.php:177
262
- msgid "Kindly contact your server support to fix this."
263
- msgstr ""
264
-
265
- #: app/helper/BPMediaSupport.php:178
266
- #, php-format
267
- msgid "You can alternatively create a support request <a href=\"%s\">here</a>"
268
- msgstr ""
269
-
270
- #: app/helper/BPMediaAddon.php:26
271
- msgid "BuddyPress-Media FFMPEG Add-on"
272
- msgstr ""
273
-
274
- #: app/helper/BPMediaAddon.php:29
275
- msgid "Add supports for more audio & video formats using open-source media-node."
276
- msgstr ""
277
-
278
- #: app/helper/BPMediaAddon.php:30
279
- msgid "Media node comes with automated setup script for Ubuntu/Debian."
280
- msgstr ""
281
-
282
- #: app/helper/BPMediaAddon.php:36
283
- msgid "BuddyPress-Media Kaltura Add-on"
284
- msgstr ""
285
-
286
- #: app/helper/BPMediaAddon.php:39
287
- msgid "Add support for more video formats using Kaltura video solution."
288
- msgstr ""
289
-
290
- #: app/helper/BPMediaAddon.php:40
291
- msgid "Works with Kaltura.com, self-hosted Kaltura-CE and Kaltura-on-premise."
292
- msgstr ""
293
-
294
- #: app/helper/BPMediaAddon.php:82
295
- msgid "Buy Now"
296
- msgstr ""
297
-
298
- #: app/helper/BPMediaAddon.php:83
299
- msgid "Live Demo"
300
- msgstr ""
301
-
302
- #: app/helper/BPMediaUpgrade.php:30
303
- #, php-format
304
- msgid "Please click upgrade to upgrade the database of BuddyPress Media <a class=\"button\" id=\"refresh_media_count\" href =\"%s\" class=\"button\" title=\"It will migrate your BuddyPress Media's earlier database to new database.\">Upgrade</a>"
305
- msgstr ""
306
-
307
- #: app/helper/BPMediaUpgrade.php:103
308
- #: app/helper/BPMediaUpgrade.php:156
309
- #: app/main/group/BPMediaGroupAction.php:95
310
- #, php-format
311
- msgid "%1$s added a %2$s"
312
- msgstr ""
313
-
314
- #: app/admin/BPMediaAdmin.php:54
315
- msgid "Buddypress Media Component"
316
- msgstr ""
317
-
318
- #: app/admin/BPMediaAdmin.php:54
319
- msgid "BuddyPress Media"
320
- msgstr ""
321
-
322
- #: app/admin/BPMediaAdmin.php:55
323
- #: app/admin/BPMediaAdmin.php:175
324
- msgid "Buddypress Media Settings"
325
- msgstr ""
326
-
327
- #: app/admin/BPMediaAdmin.php:55
328
- #: app/admin/BPMediaAdmin.php:176
329
- #: app/main/BuddyPressMedia.php:193
330
- msgid "Settings"
331
- msgstr ""
332
-
333
- #: app/admin/BPMediaAdmin.php:56
334
- #: app/admin/BPMediaAdmin.php:182
335
- msgid "Buddypress Media Addons"
336
- msgstr ""
337
-
338
- #: app/admin/BPMediaAdmin.php:56
339
- #: app/admin/BPMediaAdmin.php:183
340
- msgid "Addons"
341
- msgstr ""
342
-
343
- #: app/admin/BPMediaAdmin.php:57
344
- #: app/admin/BPMediaAdmin.php:189
345
- msgid "Buddypress Media Support"
346
- msgstr ""
347
-
348
- #: app/admin/BPMediaAdmin.php:57
349
- msgid "Support "
350
- msgstr ""
351
-
352
- #: app/admin/BPMediaAdmin.php:95
353
- #: app/main/BuddyPressMedia.php:128
354
- #: app/main/BuddyPressMedia.php:131
355
- msgid "Media"
356
- msgstr ""
357
-
358
- #: app/admin/BPMediaAdmin.php:148
359
- #: app/admin/BPMediaAdmin.php:149
360
- msgid "Buddypress Media"
361
- msgstr ""
362
-
363
- #: app/admin/BPMediaAdmin.php:190
364
- msgid "Support"
365
- msgstr ""
366
-
367
- #: app/admin/BPMediaAdmin.php:257
368
- msgid "Empowering The Web With WordPress"
369
- msgstr ""
370
-
371
- #: app/admin/BPMediaAdmin.php:257
372
- msgid "rtCamp"
373
- msgstr ""
374
-
375
- #: app/admin/BPMediaAdmin.php:259
376
- msgid "Become a fan on Facebook"
377
- msgstr ""
378
-
379
- #: app/admin/BPMediaAdmin.php:259
380
- msgid "Facebook"
381
- msgstr ""
382
-
383
- #: app/admin/BPMediaAdmin.php:260
384
- msgid "Follow us on Twitter"
385
- msgstr ""
386
-
387
- #: app/admin/BPMediaAdmin.php:260
388
- msgid "Twitter"
389
- msgstr ""
390
-
391
- #: app/admin/BPMediaAdmin.php:261
392
- msgid "Subscribe to our feeds"
393
- msgstr ""
394
-
395
- #: app/admin/BPMediaAdmin.php:261
396
- msgid "RSS Feed"
397
- msgstr ""
398
-
399
- #: app/admin/BPMediaAdmin.php:266
400
- msgid "Read FAQ"
401
- msgstr ""
402
-
403
- #: app/admin/BPMediaAdmin.php:267
404
- msgid "Free Support Forum"
405
- msgstr ""
406
-
407
- #: app/admin/BPMediaAdmin.php:268
408
- msgid "Github Issue Tracker"
409
- msgstr ""
410
-
411
- #: app/admin/BPMediaAdmin.php:269
412
- msgid "Hire us!"
413
- msgstr ""
414
-
415
- #: app/admin/BPMediaAdmin.php:269
416
- msgid "To get professional customisation/setup service."
417
- msgstr ""
418
-
419
- #: app/admin/BPMediaAdmin.php:271
420
- msgid "Need Help?"
421
- msgstr ""
422
-
423
- #: app/admin/BPMediaAdmin.php:273
424
- msgid "Help the development keep going."
425
- msgstr ""
426
-
427
- #: app/admin/BPMediaAdmin.php:274
428
- msgid "Help us release more amazing features faster. Consider making a donation to our consistent efforts."
429
- msgstr ""
430
-
431
- #: app/admin/BPMediaAdmin.php:275
432
- msgid "Donate"
433
- msgstr ""
434
-
435
- #: app/admin/BPMediaAdmin.php:278
436
- msgid "BuddyPress Media Kaltura"
437
- msgstr ""
438
-
439
- #: app/admin/BPMediaAdmin.php:278
440
- msgid "BPM-Kaltura"
441
- msgstr ""
442
-
443
- #: app/admin/BPMediaAdmin.php:278
444
- msgid "Add support for Kaltura.com/Kaltura-CE based video conversion support"
445
- msgstr ""
446
-
447
- #: app/admin/BPMediaAdmin.php:279
448
- msgid "BuddyPress Media FFMPEG"
449
- msgstr ""
450
-
451
- #: app/admin/BPMediaAdmin.php:279
452
- msgid "BPM-FFMPEG"
453
- msgstr ""
454
-
455
- #: app/admin/BPMediaAdmin.php:279
456
- msgid "Add FFMEG-based audio/video conversion support"
457
- msgstr ""
458
-
459
- #: app/admin/BPMediaAdmin.php:281
460
- msgid "Are you a developer?"
461
- msgstr ""
462
-
463
- #: app/admin/BPMediaAdmin.php:282
464
- #, php-format
465
- msgid "If you are developing a BuddyPress Media addon we would like to include it in above list. We can also help you sell them. <a href=\"%s\">More info!</a>"
466
- msgstr ""
467
-
468
- #: app/admin/BPMediaAdmin.php:283
469
- msgid "Premium Addons"
470
- msgstr ""
471
-
472
- #: app/admin/BPMediaAdmin.php:286
473
- msgid "Latest News"
474
- msgstr ""
475
-
476
- #: app/main/BuddyPressMedia.php:134
477
- msgid "Photos"
478
- msgstr ""
479
-
480
- #: app/main/BuddyPressMedia.php:137
481
- msgid "Photo"
482
- msgstr ""
483
-
484
- #: app/main/BuddyPressMedia.php:140
485
- msgid "Videos"
486
- msgstr ""
487
-
488
- #: app/main/BuddyPressMedia.php:146
489
- #: app/main/BuddyPressMedia.php:149
490
- msgid "Music"
491
- msgstr ""
492
-
493
- #: app/main/BuddyPressMedia.php:152
494
- msgid "Albums"
495
- msgstr ""
496
-
497
- #: app/main/BuddyPressMedia.php:155
498
- msgid "Album"
499
- msgstr ""
500
-
501
- #: app/main/BuddyPressMedia.php:158
502
- msgid "Upload"
503
- msgstr ""
504
-
505
- #: app/main/BuddyPressMedia.php:251
506
- #, php-format
507
- msgid "The BuddyPress version installed is an older version and is not supported, please update BuddyPress to use BuddyPress Media Plugin.<a class=\"alignright\" href=\"%1$s\">X</a>"
508
- msgstr ""
509
-
510
- #: app/main/BuddyPressMedia.php:256
511
- #, php-format
512
- msgid "You have not installed BuddyPress. Please install latest version of BuddyPress to use BuddyPress Media plugin.<a class=\"alignright\" href=\"%1$s\">X</a>"
513
- msgstr ""
514
-
515
- #: app/main/profile/BPMediaTemplate.php:18
516
- msgid "Select Album"
517
- msgstr ""
518
-
519
- #: app/main/profile/BPMediaTemplate.php:19
520
- #: app/main/profile/BPMediaTemplate.php:66
521
- msgid "x"
522
- msgstr ""
523
-
524
- #: app/main/profile/BPMediaTemplate.php:65
525
- msgid "Create Album"
526
- msgstr ""
527
-
528
- #: app/main/profile/BPMediaTemplate.php:69
529
- msgid "Album Name"
530
- msgstr ""
531
-
532
- #: app/main/profile/BPMediaTemplate.php:79
533
- msgid "Drop files here"
534
- msgstr ""
535
-
536
- #: app/main/profile/BPMediaTemplate.php:80
537
- msgid " or "
538
- msgstr ""
539
-
540
- #: app/main/profile/BPMediaTemplate.php:81
541
- msgid "Select Files"
542
- msgstr ""
543
-
544
- #: app/main/profile/BPMediaScreen.php:107
545
- #: app/main/profile/BPMediaScreen.php:327
546
- msgid "The requested url does not exist"
547
- msgstr ""
548
-
549
- #: app/main/profile/BPMediaScreen.php:118
550
- #, php-format
551
- msgid "%s List Page"
552
- msgstr ""
553
-
554
- #: app/main/profile/BPMediaScreen.php:176
555
- #: app/main/profile/BPMediaAlbumScreen.php:59
556
- #, php-format
557
- msgid "Sorry, no %s were found."
558
- msgstr ""
559
-
560
- #: app/main/profile/BPMediaScreen.php:274
561
- #, php-format
562
- msgid "Edit %s"
563
- msgstr ""
564
-
565
- #: app/main/profile/BPMediaScreen.php:289
566
- #, php-format
567
- msgid "%s Title"
568
- msgstr ""
569
-
570
- #: app/main/profile/BPMediaScreen.php:295
571
- #, php-format
572
- msgid "%s Description"
573
- msgstr ""
574
-
575
- #: app/main/profile/BPMediaScreen.php:301
576
- msgid "Update"
577
- msgstr ""
578
-
579
- #: app/main/profile/BPMediaScreen.php:302
580
- msgid "Back to Media File"
581
- msgstr ""
582
-
583
- #: app/main/profile/BPMediaScreen.php:303
584
- msgid "Back to Media"
585
- msgstr ""
586
-
587
- #: app/main/profile/BPMediaScreen.php:320
588
- msgid "You do not have access to this page."
589
- msgstr ""
590
-
591
- #: app/main/profile/BPMediaScreen.php:348
592
- msgid "Media deleted successfully"
593
- msgstr ""
594
-
595
- #: app/main/profile/BPMediaUploadScreen.php:27
596
- msgid "Upload Media"
597
- msgstr ""
598
-
599
- #: app/main/profile/BPMediaUploadScreen.php:69
600
- msgid "You are not allowed to be here"
601
- msgstr ""
602
-
603
- #: app/main/profile/BPMediaUploadScreen.php:91
604
- #: app/main/profile/BPMediaUploadScreen.php:115
605
- msgid "File uploaded is not supported"
606
- msgstr ""
607
-
608
- #: app/main/profile/BPMediaUploadScreen.php:98
609
- msgid "Image uploads are disabled"
610
- msgstr ""
611
-
612
- #: app/main/profile/BPMediaUploadScreen.php:104
613
- msgid "Video uploads are disabled"
614
- msgstr ""
615
-
616
- #: app/main/profile/BPMediaUploadScreen.php:110
617
- msgid "Audio uploads are disabled"
618
- msgstr ""
619
-
620
- #: app/main/profile/BPMediaUploadScreen.php:128
621
- msgid "Upload Successful"
622
- msgstr ""
623
-
624
- #: app/main/profile/BPMediaUploadScreen.php:133
625
- msgid "You did not specified a file to upload"
626
- msgstr ""
627
-
628
- #: app/main/profile/BPMediaAlbumScreen.php:94
629
- msgid "Sorry, no media items were found in this album."
630
- msgstr ""
631
-
632
- #: app/main/profile/BPMediaAlbum.php:42
633
- msgid "Sorry, the requested album does not exist."
634
- msgstr ""
635
-
636
- #: app/main/group/BPMediaGroupElementExtension.php:62
637
- msgid "Sorry, the requested media does not belong to the group"
638
- msgstr ""
639
-
640
- #: app/main/group/BPMediaGroup.php:163
641
- msgid "Media Settings"
642
- msgstr ""
643
-
644
- #: app/main/group/BPMediaGroupsExtension.php:31
645
- #: app/main/group/BPMediaGroupsExtension.php:69
646
- msgid "Album Creation Control"
647
- msgstr ""
648
-
649
- #: app/main/group/BPMediaGroupsExtension.php:32
650
- #: app/main/group/BPMediaGroupsExtension.php:70
651
- msgid "Who can create Albums in this group?"
652
- msgstr ""
653
-
654
- #: app/main/group/BPMediaGroupsExtension.php:36
655
- #: app/main/group/BPMediaGroupsExtension.php:74
656
- msgid "All Group Members"
657
- msgstr ""
658
-
659
- #: app/main/group/BPMediaGroupsExtension.php:40
660
- #: app/main/group/BPMediaGroupsExtension.php:78
661
- msgid "Group Admins and Mods only"
662
- msgstr ""
663
-
664
- #: app/main/group/BPMediaGroupsExtension.php:44
665
- #: app/main/group/BPMediaGroupsExtension.php:82
666
- msgid "Group Admin only"
667
- msgstr ""
668
-
669
- #: app/main/group/BPMediaGroupsExtension.php:86
670
- msgid "Save Changes"
671
- msgstr ""
672
-
673
- #: app/main/group/BPMediaGroupsExtension.php:106
674
- msgid "There was an error saving, please try again"
675
- msgstr ""
676
-
677
- #: app/main/group/BPMediaGroupsExtension.php:108
678
- msgid "Settings saved successfully"
679
- msgstr ""
680
-
681
- #: app/main/group/BPMediaGroupsExtension.php:124
682
- msgid ""
683
- "You could display a small snippet of information from your group extension here. It will show on the group\n"
684
- "\t home screen."
685
- msgstr ""
686
-
687
- #: app/main/widgets/BPMediaPopularMedia.php:15
688
- msgid "The most popular media on your site"
689
- msgstr ""
690
-
691
- #: app/main/widgets/BPMediaPopularMedia.php:16
692
- #: app/main/widgets/BPMediaPopularMedia.php:22
693
- msgid "Popular Media"
694
- msgstr ""
695
-
696
- #: app/main/widgets/BPMediaPopularMedia.php:32
697
- msgid "comments"
698
- msgstr ""
699
-
700
- #: app/main/widgets/BPMediaPopularMedia.php:33
701
- msgid "Views"
702
- msgstr ""
703
-
704
- #: app/main/widgets/BPMediaPopularMedia.php:62
705
- msgid "No popular media found"
706
- msgstr ""
707
-
708
- #: app/main/widgets/BPMediaPopularMedia.php:84
709
- #: app/main/widgets/BPMediaRecentMedia.php:193
710
- msgid "Title:"
711
- msgstr ""
712
-
713
- #: app/main/widgets/BPMediaPopularMedia.php:87
714
- #: app/main/widgets/BPMediaRecentMedia.php:196
715
- msgid "Number of posts to show:"
716
- msgstr ""
717
-
718
- #: app/main/widgets/BPMediaRecentMedia.php:15
719
- msgid "The most recent media uploaded on your site"
720
- msgstr ""
721
-
722
- #: app/main/widgets/BPMediaRecentMedia.php:16
723
- #: app/main/widgets/BPMediaRecentMedia.php:22
724
- msgid "Recent Media"
725
- msgstr ""
726
-
727
- #: app/main/widgets/BPMediaRecentMedia.php:32
728
- msgid "All"
729
- msgstr ""
730
-
731
- #: app/main/widgets/BPMediaRecentMedia.php:64
732
- msgid "No recent media found"
733
- msgstr ""
734
-
735
- #: app/main/widgets/BPMediaRecentMedia.php:100
736
- msgid "No recent photo found"
737
- msgstr ""
738
-
739
- #: app/main/widgets/BPMediaRecentMedia.php:135
740
- msgid "No recent audio found"
741
- msgstr ""
742
-
743
- #: app/main/widgets/BPMediaRecentMedia.php:170
744
- msgid "No recent video found"
745
- msgstr ""
746
-
747
- #: app/main/includes/BPMediaHostWordpress.php:46
748
- msgid "Sorry, the requested media does not exist."
749
- msgstr ""
750
-
751
- #: app/main/includes/BPMediaHostWordpress.php:84
752
- msgid "Error Uploading File"
753
- msgstr ""
754
-
755
- #: app/main/includes/BPMediaHostWordpress.php:112
756
- msgid "MP4 file you have uploaded is corrupt."
757
- msgstr ""
758
-
759
- #: app/main/includes/BPMediaHostWordpress.php:119
760
- #: app/main/includes/BPMediaHostWordpress.php:124
761
- msgid "The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264."
762
- msgstr ""
763
-
764
- #: app/main/includes/BPMediaHostWordpress.php:129
765
- msgid "The MP4 file you have uploaded is not a video file."
766
- msgstr ""
767
-
768
- #: app/main/includes/BPMediaHostWordpress.php:141
769
- msgid "MP3 file you have uploaded is currupt."
770
- msgstr ""
771
-
772
- #: app/main/includes/BPMediaHostWordpress.php:148
773
- #: app/main/includes/BPMediaHostWordpress.php:153
774
- msgid "The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3."
775
- msgstr ""
776
-
777
- #: app/main/includes/BPMediaHostWordpress.php:158
778
- msgid "The MP3 file you have uploaded is not an audio file."
779
- msgstr ""
780
-
781
- #: app/main/includes/BPMediaHostWordpress.php:172
782
- msgid "Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4."
783
- msgstr ""
784
-
785
- #: app/main/includes/BPMediaHostWordpress.php:179
786
- msgid "Error creating attachment for the media file, please try again"
787
- msgstr ""
788
-
789
- #: app/main/includes/BPMediaHostWordpress.php:252
790
- #, php-format
791
- msgid "%s uploaded a media."
792
- msgstr ""
793
-
794
- #: app/main/includes/BPMediaHostWordpress.php:266
795
- msgid "Uploaded by "
796
- msgstr ""
797
-
798
- #: app/main/includes/BPMediaHostWordpress.php:393
799
- #, php-format
800
- msgid "Comment <span>%s</span>"
801
- msgstr ""
802
-
803
- #: app/main/includes/BPMediaHostWordpress.php:397
804
- msgid "Favorite"
805
- msgstr ""
806
-
807
- #: app/main/includes/BPMediaHostWordpress.php:399
808
- msgid "Remove Favorite"
809
- msgstr ""
810
-
811
- #: app/main/includes/BPMediaHostWordpress.php:418
812
- msgid "Post"
813
- msgstr ""
814
-
815
- #: app/main/includes/BPMediaHostWordpress.php:418
816
- msgid "or press esc to cancel."
817
- msgstr ""
818
-
819
- #: app/main/includes/BPMediaHostWordpress.php:441
820
- msgid "Delete"
821
- msgstr ""
822
-
823
- #: app/main/includes/BPMediaUtils.php:37
824
- msgid "It will migrate your BuddyPress Media's earlier database to new database."
825
- msgstr ""
826
-
827
- #: app/main/includes/BPMediaUtils.php:134
828
- msgid "Bug Report"
829
- msgstr ""
830
-
831
- #: app/main/includes/BPMediaUtils.php:137
832
- msgid "New Feature Request"
833
- msgstr ""
834
-
835
- #: app/main/includes/BPMediaUtils.php:140
836
- msgid "Premium Support Request"
837
- msgstr ""
838
-
839
- #: app/main/includes/BPMediaUtils.php:283
840
- msgid "Thank you, Your bug report sent successfully."
841
- msgstr ""
842
-
843
- #: app/main/includes/BPMediaUtils.php:286
844
- msgid "Thank you, Your new feature request sent successfully."
845
- msgstr ""
846
-
847
- #: app/main/includes/BPMediaUtils.php:289
848
- msgid "Thank you, Your premium support request sent successfully, We will contact you soon."
849
- msgstr ""
850
-
851
- #: app/main/includes/BPMediaUtils.php:339
852
- #: app/main/includes/BPMediaUtils.php:637
853
- msgid "BuddyPress Media Support"
854
- msgstr ""
855
-
856
- #: app/main/includes/BPMediaUtils.php:345
857
- msgid "Spread the word"
858
- msgstr ""
859
-
860
- #: app/main/includes/BPMediaUtils.php:346
861
- msgid "BuddyPress Media Other options"
862
- msgstr ""
863
-
864
- #: app/main/includes/BPMediaUtils.php:612
865
- msgid "Need Help/Support?"
866
- msgstr ""
867
-
868
- #: app/main/includes/BPMediaUtils.php:620
869
- msgid "Hire Us!"
870
- msgstr ""
871
-
872
- #: app/main/includes/BPMediaUtils.php:621
873
- msgid "We are available for customisation and premium support. Get on touch with us. :-)"
874
- msgstr ""
875
-
876
- #: app/main/includes/BPMediaUtils.php:652
877
- msgid "Request type:"
878
- msgstr ""
879
-
880
- #: app/main/includes/BPMediaUtils.php:654
881
- msgid "-- Choose Type --"
882
- msgstr ""
883
-
884
- #: app/main/includes/BPMediaUtils.php:655
885
- msgid "Premium Support"
886
- msgstr ""
887
-
888
- #: app/main/includes/BPMediaUtils.php:656
889
- msgid "Suggest a New Feature"
890
- msgstr ""
891
-
892
- #: app/main/includes/BPMediaUtils.php:688
893
- #, php-format
894
- msgid ""
895
- " Please use our <a href=\"%s\">free support forum</a>.<br/><span class=\"bpm-aligncenter\">OR</span><br/>\n"
896
- "\t\t<a href=\"%s\">Hire us!</a> To get professional customisation/setup service."
897
- msgstr ""
898
-
899
- #: app/main/includes/BPMediaTemplateFunctions.php:28
900
- msgid "Media Title"
901
- msgstr ""
902
-
903
- #: app/main/includes/BPMediaTemplateFunctions.php:29
904
- msgid "Media Description"
905
- msgstr ""
906
-
907
- #: app/main/includes/BPMediaTemplateFunctions.php:30
908
- msgid "Select Media File"
909
- msgstr ""
910
-
911
- #: app/main/includes/BPMediaComponent.php:67
912
- msgid "Search Media..."
913
- msgstr ""
914
-
915
- #: app/main/includes/BPMediaComponent.php:316
916
- msgid "Create"
917
- msgstr ""
918
-
919
- #: app/main/includes/BPMediaComponent.php:318
920
- msgid "Edit Album"
921
- msgstr ""
922
-
923
- #: app/main/includes/BPMediaComponent.php:319
924
- msgid "New Album"
925
- msgstr ""
926
-
927
- #: app/main/includes/BPMediaComponent.php:320
928
- msgid "All Albums"
929
- msgstr ""
930
-
931
- #: app/main/includes/BPMediaComponent.php:321
932
- msgid "View Album"
933
- msgstr ""
934
-
935
- #: app/main/includes/BPMediaComponent.php:322
936
- msgid "Search Albums"
937
- msgstr ""
938
-
939
- #: app/main/includes/BPMediaComponent.php:323
940
- msgid "No album found"
941
- msgstr ""
942
-
943
- #: app/main/includes/BPMediaComponent.php:324
944
- msgid "No album found in Trash"
945
- msgstr ""
946
-
947
- #: app/main/includes/BPMediaComponent.php:348
948
- msgid "Add New Media"
949
- msgstr ""
950
-
951
- #: app/main/includes/BPMediaComponent.php:355
952
- msgid "BuddyPress Media's Media Files"
953
- msgstr ""
954
-
955
- #: app/main/includes/BPMediaFunction.php:189
956
- #, php-format
957
- msgid "%1$s added new media in album %2$s"
958
- msgstr ""
959
-
960
- #: app/main/includes/BPMediaFilters.php:296
961
- msgid "Users"
962
- msgstr ""
963
-
964
- #: app/main/includes/BPMediaFilters.php:298
965
- msgid "Total Photos"
966
- msgstr ""
967
-
968
- #: app/main/includes/BPMediaFilters.php:299
969
- msgid "Total Videos"
970
- msgstr ""
971
-
972
- #: app/main/includes/BPMediaFilters.php:300
973
- msgid "Total Audio"
974
- msgstr ""
975
-
976
- #: app/main/includes/BPMediaFilters.php:301
977
- msgid "Total Albums"
978
- msgstr ""
979
-
980
- #: app/main/includes/BPMediaFilters.php:303
981
- msgid "Groups"
982
- msgstr ""
983
-
984
- #: app/main/includes/BPMediaActions.php:254
985
- msgid "Edit Media"
986
- msgstr ""
987
-
988
- #: app/main/includes/BPMediaActions.php:254
989
- msgid "Edit"
990
- msgstr ""
991
-
992
- #: app/main/includes/BPMediaActions.php:266
993
- #: app/main/includes/BPMediaActions.php:271
994
- msgid "Featured Media"
995
- msgstr ""
996
-
997
- #: app/main/includes/BPMediaActions.php:266
998
- msgid "Featured"
999
- msgstr ""
1000
-
1001
- #: app/main/includes/BPMediaActions.php:271
1002
- msgid "Remove Featured"
1003
- msgstr ""
1004
-
1005
- #: app/main/includes/BPMediaActions.php:534
1006
- #, php-format
1007
- msgid "%1$s created an album %2$s"
1008
- msgstr ""
1009
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/buddypress-media-de.mo CHANGED
Binary file
languages/buddypress-media-es.mo CHANGED
Binary file
languages/buddypress-media-fr.mo CHANGED
Binary file
languages/buddypress-media-it.mo CHANGED
Binary file
languages/buddypress-media-ja.mo CHANGED
Binary file
languages/buddypress-media-nl.mo CHANGED
Binary file
languages/buddypress-media-pl.mo ADDED
Binary file
languages/buddypress-media-pt_BR.mo CHANGED
Binary file
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: 3.5
8
  Tested up to: 3.5
9
- Stable tag: 2.5.3
10
 
11
  Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
@@ -88,6 +88,16 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
88
 
89
  Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/ "Visit BuddyPress Media's Features page") to get some details about future releases.
90
 
 
 
 
 
 
 
 
 
 
 
91
  = 2.5.3 =
92
  * Added option to toggle BuddyPress Media menu in admin bar
93
  * Added incomplete translations for German, Italian, French and Dutch languages
@@ -220,5 +230,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
220
  * HTML5 Video Tag Support (with fallback)
221
 
222
  == Upgrade Notice ==
223
- =2.5.2=
224
- Adds option to toggle menu in admin bar. Added incomplete translations for German, Italian, French and Dutch.
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.5
8
  Tested up to: 3.5
9
+ Stable tag: 2.5.4
10
 
11
  Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
88
 
89
  Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/ "Visit BuddyPress Media's Features page") to get some details about future releases.
90
 
91
+ = 2.5.4 =
92
+ * Added option to enable/disable BuddyPress Media on Groups. (Profile toggle, coming soon)
93
+ * Added Polish language.
94
+ * Media tabs display now responds to admin settings
95
+ * Improved Uploader UI.
96
+ * Improved settings screen.
97
+ * More code comments and documentation added.
98
+ * Fixed gallery responsiveness.
99
+ * A few bug fixes.
100
+
101
  = 2.5.3 =
102
  * Added option to toggle BuddyPress Media menu in admin bar
103
  * Added incomplete translations for German, Italian, French and Dutch languages
230
  * HTML5 Video Tag Support (with fallback)
231
 
232
  == Upgrade Notice ==
233
+ =2.5.4=
234
+ Improved UI and better enable/disable media types.