rtMedia for WordPress, BuddyPress and bbPress - Version 2.7

Version Description

  • Added activity uploader
  • Added lightbox
  • Fixed bug in friends' privacy
  • Fixed bug due to which edit/delete buttons would show up
  • Refactored code and styling
Download this release

Release Info

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

Code changes from version 2.6.7 to 2.7

Files changed (43) hide show
  1. app/admin/BPMediaAdmin.php +204 -194
  2. app/assets/css/admin.css +134 -0
  3. app/assets/css/main.css +159 -132
  4. app/assets/img/bp-media-modal.png +0 -0
  5. app/assets/img/bpm-icon-32.png +0 -0
  6. app/assets/img/close.png +0 -0
  7. app/assets/img/private.png +0 -0
  8. app/assets/img/tab-icon.png +0 -0
  9. app/assets/js/bp-media-activity-uploader.js +138 -232
  10. app/assets/js/main.js +504 -75
  11. app/helper/BPMediaFeed.php +2 -2
  12. app/helper/BPMediaSettings.php +485 -460
  13. app/helper/BPMediaSupport.php +72 -65
  14. app/main/BPMediaGroupLoader.php +2 -1
  15. app/main/BPMediaLoader.php +1 -1
  16. app/main/BuddyPressMedia.php +36 -16
  17. app/main/activity/BPMediaActivity.php +121 -113
  18. app/main/group/BPMediaGroupAction.php +7 -4
  19. app/main/includes/BPMediaActions.php +887 -789
  20. app/main/includes/BPMediaFunction.php +16 -7
  21. app/main/includes/BPMediaHostWordpress.php +48 -18
  22. app/main/includes/bp-media-upload-handler.php +1 -2
  23. app/main/privacy/BPMediaPrivacy.php +17 -8
  24. app/main/profile/BPMediaAlbum.php +3 -4
  25. app/main/profile/BPMediaAlbumScreen.php +210 -193
  26. app/main/profile/BPMediaScreen.php +34 -25
  27. app/main/profile/BPMediaTemplate.php +4 -1
  28. app/main/widgets/BPMediaWidget.php +38 -26
  29. index.php +2 -2
  30. languages/buddypress-media-de.mo +0 -0
  31. languages/buddypress-media-es.mo +0 -0
  32. languages/buddypress-media-fr.mo +0 -0
  33. languages/buddypress-media-it.mo +0 -0
  34. languages/buddypress-media-ja.mo +0 -0
  35. languages/buddypress-media-nl.mo +0 -0
  36. languages/buddypress-media-pl.mo +0 -0
  37. languages/buddypress-media-pt_BR.mo +0 -0
  38. languages/buddypress-media-sr.mo +0 -0
  39. languages/buddypress-media.mo +0 -0
  40. languages/buddypress-media.po +306 -316
  41. lib/simplemodal/jquery.simplemodal-1.4.4.js +758 -0
  42. readme.txt +18 -8
  43. screenshot-12.png +0 -0
app/admin/BPMediaAdmin.php CHANGED
@@ -18,7 +18,7 @@ if (!class_exists('BPMediaAdmin')) {
18
  public $bp_media_feed;
19
 
20
  public function __construct() {
21
- add_action('init',array($this, 'video_transcoding_survey_response'));
22
  $bp_media_feed = new BPMediaFeed();
23
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
24
  $this->bp_media_support = new BPMediaSupport();
@@ -28,6 +28,7 @@ if (!class_exists('BPMediaAdmin')) {
28
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
29
  add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
30
  add_action('wp_ajax_bp_media_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
 
31
  if (is_admin()) {
32
  add_action('admin_enqueue_scripts', array($this, 'ui'));
33
  add_action(bp_core_admin_hook(), array($this, 'menu'));
@@ -67,12 +68,12 @@ if (!class_exists('BPMediaAdmin')) {
67
  public function menu() {
68
  add_menu_page(__('BuddyPress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
69
  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'));
70
- if ( ! BPMediaPrivacy::is_installed() ) {
71
- add_submenu_page('bp-media-settings', __('BuddyPress Media Database Update', BP_MEDIA_TXT_DOMAIN), __('Update Database', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-privacy', array($this, 'privacy_page'));
72
  }
73
  add_submenu_page('bp-media-settings', __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
74
  add_submenu_page('bp-media-settings', __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
75
- if ( bp_get_option('bp-media-survey', true) ) {
76
  add_submenu_page('bp-media-settings', __('BuddyPress Media Convert Videos', BP_MEDIA_TXT_DOMAIN), __('Convert Videos', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-convert-videos', array($this, 'convert_videos_page'));
77
  }
78
  }
@@ -134,7 +135,7 @@ if (!class_exists('BPMediaAdmin')) {
134
  <?php settings_errors(); ?>
135
  <div class="columns-2">
136
  <h3 class="bp-media-settings-tabs"><?php
137
- $this->sub_tabs();
138
  ?>
139
  </h3>
140
 
@@ -162,103 +163,103 @@ if (!class_exists('BPMediaAdmin')) {
162
  </div>
163
  </div><!-- .metabox-holder -->
164
  </div><!-- .bp-media-admin --><?php
165
- do_action( 'bp_media_admin_page_append', $page );
166
- }
167
-
168
- /**
169
- * Adds a tab for Media settings in the BuddyPress settings page
170
- *
171
- * @global type $bp_media
172
- */
173
- public function tab() {
174
-
175
- $tabs_html = '';
176
- $idle_class = 'nav-tab';
177
- $active_class = 'nav-tab nav-tab-active';
178
- $tabs = array();
179
-
180
- // Check to see which tab we are on
181
- $tab = $this->get_current_tab();
182
- /* BuddyPress Media */
183
- $tabs[] = array(
184
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
185
- 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
186
- 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
187
- 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
188
- );
189
-
190
-
191
- foreach ($tabs as $tab) {
192
- $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
193
- }
194
- echo $tabs_html;
195
- }
196
-
197
- /**
198
- * Adds a sub tabs to the BuddyPress Media settings page
199
- *
200
- * @global type $bp_media
201
- */
202
- public function sub_tabs() {
203
- $tabs_html = '';
204
- $idle_class = 'nav-tab';
205
- $active_class = 'nav-tab nav-tab-active';
206
- $tabs = array();
207
-
208
- // Check to see which tab we are on
209
- $tab = $this->get_current_tab();
210
- /* BuddyPress Media */
211
- $tabs[] = array(
212
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
213
- 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
214
- 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
215
- 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
216
- );
217
-
218
- $tabs[] = array(
219
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
220
- 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
221
- 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
222
- 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
223
- );
224
-
225
- $tabs[] = array(
226
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
227
- 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
228
- 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
229
- 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
230
- );
231
-
232
- if ( bp_get_option('bp-media-survey', true) ) {
233
- $tabs[] = array(
234
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-convert-videos'), 'admin.php')),
235
- 'title' => __('BuddyPress Media Covert Videos', BP_MEDIA_TXT_DOMAIN),
236
- 'name' => __('Convert Videos', BP_MEDIA_TXT_DOMAIN),
237
- 'class' => ($tab == 'bp-media-convert-videos') ? $active_class : $idle_class . ' last_tab'
238
- );
239
- }
240
-
241
- $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
242
- foreach ($tabs as $tab) {
243
- $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . ' ' . sanitize_title($tab['name']) . '">' . $tab['name'] . '</a>';
244
- }
245
- echo $tabs_html;
246
- }
247
-
248
- /*
249
- * Updates the media count of all users.
250
- */
251
-
252
- /**
253
- *
254
- * @global type $wpdb
255
- * @return boolean
256
- */
257
- public function update_count() {
258
- global $wpdb;
259
-
260
- $query =
261
- "SELECT
262
  p.post_author,pmp.meta_value,
263
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
264
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
@@ -272,67 +273,67 @@ if (!class_exists('BPMediaAdmin')) {
272
  pmp.meta_key = 'bp_media_privacy' AND
273
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
274
  GROUP BY p.post_author,pmp.meta_value order by p.post_author";
275
- $result = $wpdb->get_results($query);
276
- if (!is_array($result))
277
- return false;
278
- $formatted = array();
279
- foreach ($result as $obj) {
280
- $formatted[$obj->post_author][$obj->meta_value] = array(
281
- 'image' => $obj->Images,
282
- 'video' => $obj->Videos,
283
- 'audio' => $obj->Audio,
284
- 'album' => $obj->Albums,
285
- );
286
- }
287
-
288
- foreach ($formatted as $user => $obj) {
289
- bp_update_user_meta($user, 'bp_media_count', $obj);
290
- }
291
- return true;
292
- }
293
-
294
- /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
295
-
296
- /**
297
- *
298
- * @global type $bp_media_admin
299
- */
300
- public function save_multisite_options() {
301
- global $bp_media_admin;
302
- if (isset($_POST['refresh-count'])) {
303
- $bp_media_admin->update_count();
304
- }
305
- do_action('bp_media_sanitize_settings', $_POST);
306
-
307
- if (isset($_POST['bp_media_options'])) {
308
- bp_update_option('bp_media_options', $_POST['bp_media_options']);
309
  //
310
  // // redirect to settings page in network
311
- wp_redirect(
312
- add_query_arg(
313
- array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
314
- )
315
- );
316
- exit;
317
- }
318
- }
319
-
320
- /* Admin Sidebar */
321
-
322
- /**
323
- *
324
- * @global type $bp_media
325
- */
326
- public function admin_sidebar() {
327
- $current_user = wp_get_current_user();
328
-
329
- $message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', BP_MEDIA_TXT_DOMAIN), home_url());
330
- $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>
331
- <a href="http://twitter.com/home/?status=' . $message . '" class="button button-tweet" target= "_blank">'. __('Tweet', BP_MEDIA_TXT_DOMAIN).'</a>
332
  <a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" class="button button-rating" target= "_blank">' . __('Rate on WordPress.org', BP_MEDIA_TXT_DOMAIN) . '</a>';
333
- new BPMediaAdminWidget('spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), $addons);
334
 
335
- $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
336
  <!-- Identify your business so that you can collect the payments. -->
337
  <input type="hidden" name="business"
338
  value="paypal@rtcamp.com">
@@ -348,10 +349,13 @@ if (!class_exists('BPMediaAdmin')) {
348
  <input type="image" id="rt-donate-button" name="submit" border="0"
349
  src="' . BP_MEDIA_URL . 'app/assets/img/paypal-donate-button.png"
350
  alt="PayPal - The safer, easier way to pay online">
351
- </form>';
352
- new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
 
 
 
353
 
354
- $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>
355
  <div class="mc-field-group">
356
  <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
357
  <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">
@@ -367,38 +371,44 @@ if (!class_exists('BPMediaAdmin')) {
367
  <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>
368
  <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>
369
  </ul>';
370
- new BPMediaAdminWidget('branding', __('Subscribe', BP_MEDIA_TXT_DOMAIN), $branding);
371
-
372
- $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
373
- new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
374
- }
375
-
376
- public function linkback() {
377
- if (isset($_POST['linkback']) && $_POST['linkback']) {
378
- return bp_update_option('bp_media_add_linkback', true);
379
- } else {
380
- return bp_update_option('bp_media_add_linkback', false);
381
- }
382
- die;
383
- }
384
-
385
- public function convert_videos_mailchimp_send() {
386
- if ($_POST['interested'] == 'Yes' && !empty($_POST['choice'])) {
387
- wp_remote_get(add_query_arg( array('bp-media-convert-videos-form' => 1, 'choice' => $_POST['choice'], 'url'=> urlencode($_POST['url']), 'email' => $_POST['email']),'http://rtcamp.com/'));
388
- } else {
389
- bp_update_option('bp-media-survey', 0);
390
- }
391
- echo 'Thank you for your time.';
392
- die;
393
- }
394
-
395
- public function video_transcoding_survey_response(){
396
- if ( isset($_GET['survey-done']) && ($_GET['survey-done'] == md5('survey-done')) ) {
397
- bp_update_option('bp-media-survey', 0);
398
- }
399
- }
400
-
401
- }
402
 
 
 
 
403
  }
 
 
 
 
 
 
 
 
 
 
 
404
  ?>
18
  public $bp_media_feed;
19
 
20
  public function __construct() {
21
+ add_action('init', array($this, 'video_transcoding_survey_response'));
22
  $bp_media_feed = new BPMediaFeed();
23
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
24
  $this->bp_media_support = new BPMediaSupport();
28
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
29
  add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
30
  add_action('wp_ajax_bp_media_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
31
+ add_filter('plugin_row_meta', array($this, 'plugin_meta_premium_addon_link'), 1, 4);
32
  if (is_admin()) {
33
  add_action('admin_enqueue_scripts', array($this, 'ui'));
34
  add_action(bp_core_admin_hook(), array($this, 'menu'));
68
  public function menu() {
69
  add_menu_page(__('BuddyPress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
70
  add_submenu_page('bp-media-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), __('Settings', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
71
+ if (!BPMediaPrivacy::is_installed()) {
72
+ add_submenu_page('bp-media-settings', __('BuddyPress Media Database Update', BP_MEDIA_TXT_DOMAIN), __('Update Database', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-privacy', array($this, 'privacy_page'));
73
  }
74
  add_submenu_page('bp-media-settings', __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
75
  add_submenu_page('bp-media-settings', __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
76
+ if (bp_get_option('bp-media-survey', true)) {
77
  add_submenu_page('bp-media-settings', __('BuddyPress Media Convert Videos', BP_MEDIA_TXT_DOMAIN), __('Convert Videos', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-convert-videos', array($this, 'convert_videos_page'));
78
  }
79
  }
135
  <?php settings_errors(); ?>
136
  <div class="columns-2">
137
  <h3 class="bp-media-settings-tabs"><?php
138
+ $this->sub_tabs();
139
  ?>
140
  </h3>
141
 
163
  </div>
164
  </div><!-- .metabox-holder -->
165
  </div><!-- .bp-media-admin --><?php
166
+ do_action('bp_media_admin_page_append', $page);
167
+ }
168
+
169
+ /**
170
+ * Adds a tab for Media settings in the BuddyPress settings page
171
+ *
172
+ * @global type $bp_media
173
+ */
174
+ public function tab() {
175
+
176
+ $tabs_html = '';
177
+ $idle_class = 'nav-tab';
178
+ $active_class = 'nav-tab nav-tab-active';
179
+ $tabs = array();
180
+
181
+ // Check to see which tab we are on
182
+ $tab = $this->get_current_tab();
183
+ /* BuddyPress Media */
184
+ $tabs[] = array(
185
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
186
+ 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
187
+ 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
188
+ 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
189
+ );
190
+
191
+
192
+ foreach ($tabs as $tab) {
193
+ $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
194
+ }
195
+ echo $tabs_html;
196
+ }
197
+
198
+ /**
199
+ * Adds a sub tabs to the BuddyPress Media settings page
200
+ *
201
+ * @global type $bp_media
202
+ */
203
+ public function sub_tabs() {
204
+ $tabs_html = '';
205
+ $idle_class = 'nav-tab';
206
+ $active_class = 'nav-tab nav-tab-active';
207
+ $tabs = array();
208
+
209
+ // Check to see which tab we are on
210
+ $tab = $this->get_current_tab();
211
+ /* BuddyPress Media */
212
+ $tabs[] = array(
213
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
214
+ 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
215
+ 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
216
+ 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
217
+ );
218
+
219
+ $tabs[] = array(
220
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
221
+ 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
222
+ 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
223
+ 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
224
+ );
225
+
226
+ $tabs[] = array(
227
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
228
+ 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
229
+ 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
230
+ 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
231
+ );
232
+
233
+ if (bp_get_option('bp-media-survey', true)) {
234
+ $tabs[] = array(
235
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-convert-videos'), 'admin.php')),
236
+ 'title' => __('BuddyPress Media Covert Videos', BP_MEDIA_TXT_DOMAIN),
237
+ 'name' => __('Convert Videos', BP_MEDIA_TXT_DOMAIN),
238
+ 'class' => ($tab == 'bp-media-convert-videos') ? $active_class : $idle_class . ' last_tab'
239
+ );
240
+ }
241
+
242
+ $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
243
+ foreach ($tabs as $tab) {
244
+ $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . ' ' . sanitize_title($tab['name']) . '">' . $tab['name'] . '</a>';
245
+ }
246
+ echo $tabs_html;
247
+ }
248
+
249
+ /*
250
+ * Updates the media count of all users.
251
+ */
252
+
253
+ /**
254
+ *
255
+ * @global type $wpdb
256
+ * @return boolean
257
+ */
258
+ public function update_count() {
259
+ global $wpdb;
260
+
261
+ $query =
262
+ "SELECT
263
  p.post_author,pmp.meta_value,
264
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
265
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
273
  pmp.meta_key = 'bp_media_privacy' AND
274
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
275
  GROUP BY p.post_author,pmp.meta_value order by p.post_author";
276
+ $result = $wpdb->get_results($query);
277
+ if (!is_array($result))
278
+ return false;
279
+ $formatted = array();
280
+ foreach ($result as $obj) {
281
+ $formatted[$obj->post_author][$obj->meta_value] = array(
282
+ 'image' => $obj->Images,
283
+ 'video' => $obj->Videos,
284
+ 'audio' => $obj->Audio,
285
+ 'album' => $obj->Albums,
286
+ );
287
+ }
288
+
289
+ foreach ($formatted as $user => $obj) {
290
+ bp_update_user_meta($user, 'bp_media_count', $obj);
291
+ }
292
+ return true;
293
+ }
294
+
295
+ /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
296
+
297
+ /**
298
+ *
299
+ * @global type $bp_media_admin
300
+ */
301
+ public function save_multisite_options() {
302
+ global $bp_media_admin;
303
+ if (isset($_POST['refresh-count'])) {
304
+ $bp_media_admin->update_count();
305
+ }
306
+ do_action('bp_media_sanitize_settings', $_POST);
307
+
308
+ if (isset($_POST['bp_media_options'])) {
309
+ bp_update_option('bp_media_options', $_POST['bp_media_options']);
310
  //
311
  // // redirect to settings page in network
312
+ wp_redirect(
313
+ add_query_arg(
314
+ array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
315
+ )
316
+ );
317
+ exit;
318
+ }
319
+ }
320
+
321
+ /* Admin Sidebar */
322
+
323
+ /**
324
+ *
325
+ * @global type $bp_media
326
+ */
327
+ public function admin_sidebar() {
328
+ $current_user = wp_get_current_user();
329
+
330
+ $message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', BP_MEDIA_TXT_DOMAIN), home_url());
331
+ $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>
332
+ <a href="http://twitter.com/home/?status=' . $message . '" class="button button-tweet" target= "_blank">' . __('Tweet', BP_MEDIA_TXT_DOMAIN) . '</a>
333
  <a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" class="button button-rating" target= "_blank">' . __('Rate on WordPress.org', BP_MEDIA_TXT_DOMAIN) . '</a>';
334
+ new BPMediaAdminWidget('spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), $addons);
335
 
336
+ $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
337
  <!-- Identify your business so that you can collect the payments. -->
338
  <input type="hidden" name="business"
339
  value="paypal@rtcamp.com">
349
  <input type="image" id="rt-donate-button" name="submit" border="0"
350
  src="' . BP_MEDIA_URL . 'app/assets/img/paypal-donate-button.png"
351
  alt="PayPal - The safer, easier way to pay online">
352
+ </form><br />
353
+ <center><b>' . __('OR', BP_MEDIA_TXT_DOMAIN) . '</b></center><br />
354
+ <center>' . __('Use <a href="https://rtcamp.com/store/product-category/buddypress/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media">premium add-ons</a> starting from $9', BP_MEDIA_TXT_DOMAIN) . '</center>';
355
+ ;
356
+ new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
357
 
358
+ $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>
359
  <div class="mc-field-group">
360
  <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
361
  <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">
371
  <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>
372
  <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>
373
  </ul>';
374
+ new BPMediaAdminWidget('branding', __('Subscribe', BP_MEDIA_TXT_DOMAIN), $branding);
375
+
376
+ $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
377
+ new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
378
+ }
379
+
380
+ public function linkback() {
381
+ if (isset($_POST['linkback']) && $_POST['linkback']) {
382
+ return bp_update_option('bp_media_add_linkback', true);
383
+ } else {
384
+ return bp_update_option('bp_media_add_linkback', false);
385
+ }
386
+ die;
387
+ }
388
+
389
+ public function convert_videos_mailchimp_send() {
390
+ if ($_POST['interested'] == 'Yes' && !empty($_POST['choice'])) {
391
+ wp_remote_get(add_query_arg(array('bp-media-convert-videos-form' => 1, 'choice' => $_POST['choice'], 'url' => urlencode($_POST['url']), 'email' => $_POST['email']), 'http://rtcamp.com/'));
392
+ } else {
393
+ bp_update_option('bp-media-survey', 0);
394
+ }
395
+ echo 'Thank you for your time.';
396
+ die;
397
+ }
 
 
 
 
 
 
 
 
398
 
399
+ public function video_transcoding_survey_response() {
400
+ if (isset($_GET['survey-done']) && ($_GET['survey-done'] == md5('survey-done'))) {
401
+ bp_update_option('bp-media-survey', 0);
402
  }
403
+ }
404
+
405
+ public function plugin_meta_premium_addon_link($plugin_meta, $plugin_file, $plugin_data, $status) {
406
+ if (plugin_basename(BP_MEDIA_PATH . 'index.php') == $plugin_file)
407
+ $plugin_meta[] = '<a href="https://rtcamp.com/store/product-category/buddypress/?utm_source=dashboard&#038;utm_medium=plugin&#038;utm_campaign=buddypress-media" title="Premium Add-ons">Premium Add-ons</a>';
408
+ return $plugin_meta;
409
+ }
410
+
411
+ }
412
+
413
+ }
414
  ?>
app/assets/css/admin.css ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
2
+ #wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
3
+ #wpbody-content .bp-media-settings-tabs{margin-bottom: 0; }
4
+ #wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
5
+ #wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
6
+
7
+ #wpbody-content .wrap div.bp-media-metabox-holder{padding-top: 0}
8
+ .bp-media-social{background: url('../img/bp_media_social.png');height: 35px;width: 35px;display: inline-block;font-size: 0px;margin-right:5px;}
9
+ .bp-media-facebook{background-position: 0px 0px;}
10
+ .bp-media-facebook:hover{background-position: 0px 36px;}
11
+ .bp-media-twitter{background-position: 80px 0px;}
12
+ .bp-media-twitter:hover{background-position: 80px 36px;}
13
+ .bp-media-rss{background-position: 35px 0px;}
14
+ .bp-media-rss:hover{background-position: 35px 36px;}
15
+ .bp-media-support .support_list{ margin-left: 25px}
16
+ .bp-media-support .support_list li{list-style: disc;margin-bottom: 10px}
17
+
18
+ #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a{background:url('../img/bpm-icon-16.png') center 1px no-repeat;}
19
+ #adminmenu li.toplevel_page_bp-media-settings:hover .wp-menu-image a,
20
+ #adminmenu li.current.toplevel_page_bp-media-settings .wp-menu-image a{background-position: center 1px;}
21
+ #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a img{display:none;}
22
+ #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%;}
23
+ #debug-info{border:1px solid #CCC; overflow: hidden; padding: 10px; margin-top: 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: 588px;}
24
+ .nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
25
+ .nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -96px;}
26
+ .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/bpm-icon-32.png') -5px 0px no-repeat; padding-left: 32px;}
27
+ .metabox-holder .postbox#latest-news .inside ul li:hover{background-position-y: -96px;}
28
+ #branding #logo{text-align:center;padding: 10px 0;display:block;}
29
+ ul#social{display:block;text-align:center;margin:0;clear: both;}
30
+ #branding #mc-embedded-subscribe-form{float: left;width: 100%;}
31
+ #branding label{float: right;}
32
+ #branding #mc-embedded-subscribe{float: right;padding: 0 3px;}
33
+ #branding #mce-EMAIL{float: left;}
34
+ ul#social li{display:inline;}
35
+ #spread-the-word .button{display:inline-block; margin: 9px 5px 0 5px;}
36
+ #spread-the-word label{display:block;}
37
+ #spread-the-word .inside{text-align: center;}
38
+ #spread-the-word .button-tweet{background: #33ACE6; border-color: #3399DD #3399DD #2288CC; color: #FFFFFF !important; text-shadow: -1px -1px 0 #3399DD;}
39
+ #spread-the-word .button-tweet:hover{background: #3399DD;border-color: #2288CC;box-shadow: 0 0 4px rgba(82, 168, 236, 0.75);}
40
+ #spread-the-word .button-rating{background: #8A8A8A; border-color: #222; color: #FFFFFF !important; text-shadow: -1px -1px 0 #444;}
41
+ #spread-the-word .button-rating:hover{background: #7E7E7E;border-color: #444;box-shadow: 0 0 4px rgba(128,128,128, 0.75);}
42
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab{padding-left:20px;background:url('../img/tab-icon.png') 3px -4px no-repeat;}
43
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.addons{background-position-y:-34px;}
44
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.support{background-position-y:-64px;}
45
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.update-database{background-position-y:-94px;}
46
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.ffmpeg{background-position-y:-154px;}
47
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.kaltura{background-position-y:-184px;}
48
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.convert-videos{background-position-y:-214px;}
49
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.insta{background-position-y:-244px;}
50
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.watermark{background-position-y:-274px;}
51
+ /* Addons page Styling */
52
+
53
+ a.toplevel_page_bp-media-settings div.wp-menu-image{
54
+ background:url('../img/admin-menu.png') 0 -32px no-repeat;
55
+ }
56
+
57
+ #rt-donate-button, .rt-link img{vertical-align: middle;}
58
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings div.wp-menu-image{
59
+ background-position: 0 -32px;
60
+ }
61
+ #adminmenu .menu-icon-generic.wp-has-current-submenu.toplevel_page_bp-media-settings div.wp-menu-image,
62
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings:hover div.wp-menu-image{
63
+ background-position-y:0;
64
+ }
65
+
66
+ #bp-media-addons-list_metabox {background: #ffffff}
67
+ .products ul:after, ul.products:after {clear: both;content: "";display: block;}
68
+ .products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
69
+ .bp-media-addon {margin: 0;}
70
+ .bp-media-addon.first { }
71
+ .bp-media-addon {margin: 20px 10px 30px;padding: 5px;position: relative;border: 1px solid #ccc;}
72
+ .bp-media-addon h4 {background: none repeat scroll 0 0 transparent;border: 0 none;color: #006999;cursor: pointer;font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size: 20px;font-weight: normal;line-height: 26px;margin: 0 0 10px;}
73
+ .bp-media-addon a {text-decoration: none;}
74
+ .bp-media-addon a img, div.product div.images img {box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);}
75
+ .bp-media-addon a img {display: block;height: auto;margin: 5px 15px 5px 5px;transition: all 0.2s ease-in-out 0s;float: left; width: 200px}
76
+
77
+ .bp-media-addon .price, .bp-media-addon .price .amount, .bp-media-addon .price ins {color: #85AD74;font-size: 25px;font-weight: bold;}
78
+ .bp-media-addon .price {line-height: 1.4em;color: #85AD74;display: block;font-weight: normal;margin-bottom: 0.5em;}
79
+ .coming-soon { background: url("../img/coming-soon.png"); z-index: 5; position:absolute;height:191px; opacity:0.9;}
80
+ .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
81
+ .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
82
+ .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
83
+
84
+ .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
85
+ .bp-media-addon .add_to_cart_button{background: #C45200; color: #FFFFFF;display: inline-block;font-size: 18px;font-weight: bold; line-height: 1.4em; margin: 0 20px; padding: 4px 15px;text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6)}
86
+ .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
87
+
88
+ .bp-media-addon .add_to_cart_button:hover{background: none repeat scroll 0 0 #D75A00;
89
+ box-shadow: 0 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.4) inset;
90
+ color: #FFFFFF;}
91
+
92
+ /* Admin bar Menu */
93
+ #wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
94
+ #wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
95
+
96
+ /* BuddyPress media admin support form styling */
97
+ .bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
98
+ .bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
99
+ .bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
100
+ .bp-media-error{background-color: #FFEBE8;border-color: #CC0000;}
101
+ .bp-media-form li{margin-bottom: 10px}
102
+ .bp-media-form .bp-media-label{display: inline-block;margin-right: 10px;width: 150px;vertical-align: top; }
103
+ .bp-media-form .bp-media-input{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
104
+ .bp-media-form .bp-media-checkbox{margin-right: 10px; margin-left: 160px}
105
+ .bp-media-form .bp-media-textarea{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;height: 175px;line-height: 16px;padding: 5px;width: 400px;}
106
+ .bp-media-form .bp-media-select{margin: 0;max-width: 400px;}
107
+ .bp-media-support-attachment label{float: left}
108
+ .bp-media-support-attachment .more-attachment{margin-left: 160px; margin-top: 10px}
109
+ .bp-media-support-attachment .more-attachment:first-child{margin-top: 0px}
110
+ .bp-media-support-attachment .add-more-attachment-btn{clear: both;display: inline-block;margin-left: 160px;margin-top: 10px;}
111
+ .template_select_label{float: left}
112
+ .template_select_container{overflow-x:scroll; width:405px;float: left}
113
+ #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
114
+ /* Miscellaneous */
115
+ #normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
116
+ .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
117
+ .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
118
+ img.bp-media-donation-image{display:block;margin: 10px auto;}
119
+ #donate form{text-align: center;}
120
+ /*Transcoding Teaser*/
121
+ .para-blockquote { background: #E5E5E5; padding: 10px; font-style: italic; }
122
+ #latest-update img, #members-list .update img, #members-list .update {display:block; overflow: hidden;}
123
+ #rtprogressbar {
124
+ background-color: #444;
125
+ border-radius: 13px;
126
+ padding: 3px;
127
+ }
128
+
129
+ #rtprogressbar div {
130
+ background-color: #fb6003;
131
+ width: 0;
132
+ height: 20px;
133
+ border-radius: 10px;
134
+ }
app/assets/css/main.css CHANGED
@@ -1,7 +1,7 @@
1
  /*
2
  * Default stylesheet for BuddyPress Media
3
  */
4
- .bp_media_content img{max-width:98%;}
5
  .bp_media_content .mejs-poster img{max-width: 100%;}
6
  .media.albums .album-edit{display:inline;}
7
  .media h3 {display:block;font-size:20px;font-weight:bold;}
@@ -19,24 +19,11 @@ ul.bp-media-gallery li span img{height: 150px;}
19
  /*li.media div.activity-content div.activity-inner p{display:none;}*/
20
  .media h3{margin-bottom:10px;}
21
  #bp-media-footer {color: #4D4D4D;text-align: center;text-shadow: #FAFAFA 1px 1px 0;}
22
- #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
23
- #wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
24
- #wpbody-content .bp-media-settings-tabs{margin-bottom: 0; }
25
- #wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
26
- #wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
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;}
31
- .bp-media-facebook:hover{background-position: 0px 36px;}
32
- .bp-media-twitter{background-position: 80px 0px;}
33
- .bp-media-twitter:hover{background-position: 80px 36px;}
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
  #item-body:after,ul.bp-media-gallery.item-list:after{content: " ";clear: both;display: block;text-indent: -9999em;}
38
  #item-body{position: relative;}
39
 
 
40
  .bp-media-area-allocate{height: 10px;width: 100%;display: block;}
41
  li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
42
  #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: 15px 0;}
@@ -75,11 +62,13 @@ li #bp-media-uploaded-files{left: 0;position: absolute;top: 155px;}
75
  .bp-media-progress-completed{z-index: 9;width: 0;height: 35px;margin-top: -35px;background-color: #83B4D8;background-image: linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -o-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -moz-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -webkit-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -ms-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);}
76
  .bpm-aligncenter{display: inline-block;text-align: center;width: 100%;}
77
  #bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
78
- .bp-media-single div.bp_media_content{text-align:center;}
 
 
79
  .bp-media-single .bp_media_content .mejs-container{margin-left:auto;margin-right:auto;}
80
 
81
- .bp-media-support .support_list{ margin-left: 25px}
82
- .bp-media-support .support_list li{list-style: disc;margin-bottom: 10px}
83
 
84
  .media-tabs-container .ui-tabs-panel{}
85
  .media-tabs-container .ui-tabs-hide{display: none}
@@ -96,134 +85,172 @@ li #bp-media-uploaded-files{left: 0;position: absolute;top: 155px;}
96
  .media-tabs-container .widget-item-listing li h3 {margin: 0}
97
  .media-tabs-container .widget-item-listing li h3 a{font-size: 13px;font-weight: normal;word-wrap: break-word; }
98
 
99
- .bp-media-actions{margin:20px 0;}
100
- .bp-media-actions a{display:inline-block;}
101
-
102
-
103
- #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a{background:url('../img/bpm-icon-16.png') center 1px no-repeat;}
104
- #adminmenu li.toplevel_page_bp-media-settings:hover .wp-menu-image a,
105
- #adminmenu li.current.toplevel_page_bp-media-settings .wp-menu-image a{background-position: center 1px;}
106
- #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a img{display:none;}
107
- #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%;}
108
- #debug-info{border:1px solid #CCC; overflow: hidden; padding: 10px; margin-top: 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: 588px;}
109
- .nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
110
- .nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -32px;}
111
- .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/bpm-icon-32.png') -5px 0px no-repeat; padding-left: 32px;}
112
- .metabox-holder .postbox#latest-news .inside ul li:hover{background-position-y: -32px;}
113
- #branding #logo{text-align:center;padding: 10px 0;display:block;}
114
- ul#social{display:block;text-align:center;margin:0;clear: both;}
115
- #branding #mc-embedded-subscribe-form{float: left;width: 100%;}
116
- #branding label{float: right;}
117
- #branding #mc-embedded-subscribe{float: right;padding: 0 3px;}
118
- #branding #mce-EMAIL{float: left;}
119
- ul#social li{display:inline;}
120
- #spread-the-word .button{display:inline-block; margin: 9px 5px 0 5px;}
121
- #spread-the-word label{display:block;}
122
- #spread-the-word .inside{text-align: center;}
123
- #spread-the-word .button-tweet{background: #33ACE6; border-color: #3399DD #3399DD #2288CC; color: #FFFFFF !important; text-shadow: -1px -1px 0 #3399DD;}
124
- #spread-the-word .button-tweet:hover{background: #3399DD;border-color: #2288CC;box-shadow: 0 0 4px rgba(82, 168, 236, 0.75);}
125
- #spread-the-word .button-rating{background: #8A8A8A; border-color: #222; color: #FFFFFF !important; text-shadow: -1px -1px 0 #444;}
126
- #spread-the-word .button-rating:hover{background: #7E7E7E;border-color: #444;box-shadow: 0 0 4px rgba(128,128,128, 0.75);}
127
  #bp-media-show-more{width: 200px;margin-left: auto;margin-right: auto;display: block;height: 30px;line-height: 30px;font-size: 20px;}
128
  #bp-media-upload-ui.activity-component{margin-left: 74px;margin-top: 10px;}
129
  ul#activity-stream li.media.album_updated ul{}
130
- ul#activity-stream li.media.album_updated ul li{float: left;margin-right:2%}
131
 
132
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab{padding-left:20px;background:url('../img/tab-icon.png') 3px -4px no-repeat;}
133
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.addons{background-position-y:-34px;}
134
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.support{background-position-y:-64px;}
135
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.update-database{background-position-y:-94px;}
136
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.ffmpeg{background-position-y:-154px;}
137
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.kaltura{background-position-y:-184px;}
138
- .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.convert-videos{background-position-y:-214px;}
139
- /* Addons page Styling */
140
 
141
- a.toplevel_page_bp-media-settings div.wp-menu-image{
142
- background:url('../img/admin-menu.png') 0 -32px no-repeat;
143
- }
144
  .media ul#bp-media-upload-set-privacy li input[type="radio"]{float:left;}
145
- #rt-donate-button, .rt-link img{vertical-align: middle;}
146
- #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings div.wp-menu-image{
147
- background-position: 0 -32px;
148
- }
149
- #adminmenu .menu-icon-generic.wp-has-current-submenu.toplevel_page_bp-media-settings div.wp-menu-image,
150
- #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings:hover div.wp-menu-image{
151
- background-position-y:0;
152
- }
153
-
154
- #bp-media-addons-list_metabox {background: #ffffff}
155
- .products ul:after, ul.products:after {clear: both;content: "";display: block;}
156
- .products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
157
- .bp-media-addon {margin: 0;}
158
- .bp-media-addon.first { }
159
- .bp-media-addon {margin: 20px 10px 30px;padding: 5px;position: relative;border: 1px solid #ccc;}
160
- .bp-media-addon h4 {background: none repeat scroll 0 0 transparent;border: 0 none;color: #006999;cursor: pointer;font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size: 20px;font-weight: normal;line-height: 26px;margin: 0 0 10px;}
161
- .bp-media-addon a {text-decoration: none;}
162
- .bp-media-addon a img, div.product div.images img {box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);}
163
- .bp-media-addon a img {display: block;height: auto;margin: 5px 15px 5px 5px;transition: all 0.2s ease-in-out 0s;float: left; width: 200px}
164
-
165
- .bp-media-addon .price, .bp-media-addon .price .amount, .bp-media-addon .price ins {color: #85AD74;font-size: 25px;font-weight: bold;}
166
- .bp-media-addon .price {line-height: 1.4em;color: #85AD74;display: block;font-weight: normal;margin-bottom: 0.5em;}
167
- .coming-soon { background: url("../img/coming-soon.png"); z-index: 5; position:absolute;height:191px; opacity:0.9;}
168
- .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
169
- .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
170
- .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
171
-
172
- .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
173
- .bp-media-addon .add_to_cart_button{background: #C45200; color: #FFFFFF;display: inline-block;font-size: 18px;font-weight: bold; line-height: 1.4em; margin: 0 20px; padding: 4px 15px;text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6)}
174
- .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
175
-
176
- .bp-media-addon .add_to_cart_button:hover{background: none repeat scroll 0 0 #D75A00;
177
- box-shadow: 0 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.4) inset;
178
- color: #FFFFFF;}
179
-
180
- /* Admin bar Menu */
181
- #wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
182
- #wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
183
-
184
- /* BuddyPress media admin support form styling */
185
- .bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
186
- .bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
187
- .bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
188
- .bp-media-error{background-color: #FFEBE8;border-color: #CC0000;}
189
- .bp-media-form li{margin-bottom: 10px}
190
- .bp-media-form .bp-media-label{display: inline-block;margin-right: 10px;width: 150px;vertical-align: top; }
191
- .bp-media-form .bp-media-input{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
192
- .bp-media-form .bp-media-checkbox{margin-right: 10px; margin-left: 160px}
193
- .bp-media-form .bp-media-textarea{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;height: 175px;line-height: 16px;padding: 5px;width: 400px;}
194
- .bp-media-form .bp-media-select{margin: 0;max-width: 400px;}
195
- .bp-media-support-attachment label{float: left}
196
- .bp-media-support-attachment .more-attachment{margin-left: 160px; margin-top: 10px}
197
- .bp-media-support-attachment .more-attachment:first-child{margin-top: 0px}
198
- .bp-media-support-attachment .add-more-attachment-btn{clear: both;display: inline-block;margin-left: 160px;margin-top: 10px;}
199
- .template_select_label{float: left}
200
- .template_select_container{overflow-x:scroll; width:405px;float: left}
201
- #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
202
- /* Miscellaneous */
203
- #normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
204
- .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
205
- .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
206
- img.bp-media-donation-image{display:block;margin: 10px auto;}
207
- #donate form{text-align: center;}
208
  /* Privacy settings */
209
  #bp-media-upload-set-privacy li{margin: 10px 0;overflow: hidden;}
210
  #bp-media-upload-set-privacy .album-set-privacy-radio{}
211
  #bp-media-upload-set-privacy .album-set-privacy-label{margin: 0;font-weight: normal;}
212
- /*Transcoding Teaser*/
213
- .para-blockquote { background: #E5E5E5; padding: 10px; font-style: italic; }
214
 
215
- #rtprogressbar {
216
- background-color: #444;
217
- border-radius: 13px;
218
- padding: 3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- #rtprogressbar div {
222
- background-color: #fb6003;
223
- width: 0;
224
- height: 20px;
225
- border-radius: 10px;
226
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
  @media (min-width: 981px) and (max-width: 1096px) {
229
  li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
1
  /*
2
  * Default stylesheet for BuddyPress Media
3
  */
4
+ .bp_media_content img{max-width:100%;}
5
  .bp_media_content .mejs-poster img{max-width: 100%;}
6
  .media.albums .album-edit{display:inline;}
7
  .media h3 {display:block;font-size:20px;font-weight:bold;}
19
  /*li.media div.activity-content div.activity-inner p{display:none;}*/
20
  .media h3{margin-bottom:10px;}
21
  #bp-media-footer {color: #4D4D4D;text-align: center;text-shadow: #FAFAFA 1px 1px 0;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  /*#bp-media-upload-ui{position: relative;}*/
23
  #item-body:after,ul.bp-media-gallery.item-list:after{content: " ";clear: both;display: block;text-indent: -9999em;}
24
  #item-body{position: relative;}
25
 
26
+ #bp-media-activity-upload-ui { width: 50%;}
27
  .bp-media-area-allocate{height: 10px;width: 100%;display: block;}
28
  li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
29
  #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: 15px 0;}
62
  .bp-media-progress-completed{z-index: 9;width: 0;height: 35px;margin-top: -35px;background-color: #83B4D8;background-image: linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -o-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -moz-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -webkit-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -ms-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);}
63
  .bpm-aligncenter{display: inline-block;text-align: center;width: 100%;}
64
  #bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
65
+ .bp-media-single div.bp_media_content{text-align:center;width: auto;
66
+ margin: 0 auto;
67
+ position: relative;}
68
  .bp-media-single .bp_media_content .mejs-container{margin-left:auto;margin-right:auto;}
69
 
70
+ .bp-media-actions{margin:20px 0;}
71
+ .bp-media-actions a{display:inline-block;}
72
 
73
  .media-tabs-container .ui-tabs-panel{}
74
  .media-tabs-container .ui-tabs-hide{display: none}
85
  .media-tabs-container .widget-item-listing li h3 {margin: 0}
86
  .media-tabs-container .widget-item-listing li h3 a{font-size: 13px;font-weight: normal;word-wrap: break-word; }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  #bp-media-show-more{width: 200px;margin-left: auto;margin-right: auto;display: block;height: 30px;line-height: 30px;font-size: 20px;}
89
  #bp-media-upload-ui.activity-component{margin-left: 74px;margin-top: 10px;}
90
  ul#activity-stream li.media.album_updated ul{}
91
+ ul#activity-stream li.media.album_updated ul li,ul.bp-media-list-media li{float: left;margin-right:2%}
92
 
 
 
 
 
 
 
 
 
93
 
 
 
 
94
  .media ul#bp-media-upload-set-privacy li input[type="radio"]{float:left;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  /* Privacy settings */
96
  #bp-media-upload-set-privacy li{margin: 10px 0;overflow: hidden;}
97
  #bp-media-upload-set-privacy .album-set-privacy-radio{}
98
  #bp-media-upload-set-privacy .album-set-privacy-label{margin: 0;font-weight: normal;}
 
 
99
 
100
+ .bp-media-single .delete-activity-single,.bp-media-single .delete-activity{
101
+ color: #ff0000;
102
+ font-weight:bold;
103
+ }
104
+ .simplemodal-overlay{
105
+ background:#333 none;
106
+ z-index: 100000;
107
+ }
108
+ .simplemodal-container{
109
+ background:#fff none;
110
+ }
111
+ .bp-media-mod-title{
112
+ display:none;
113
+ }
114
+
115
+ .bp-media-ajax-single{
116
+ padding:0;
117
+ }
118
+ .simplemodal-container .simplemodal-close{
119
+ background: url("../img/bp-media-modal.png") right bottom no-repeat;
120
+ width:22px;
121
+ height:22px;
122
+ display:block;
123
+ position:absolute;
124
+ right:0px;
125
+ top:0px;
126
+ cursor: pointer;
127
+ }
128
+ .simplemodal-container .simplemodal-close:hover{
129
+ background-position: right top;
130
+ }
131
+ .simplemodal-container a.modal-ctrl{
132
+ position:absolute;
133
+ height:100%;
134
+ height:100px;
135
+ width:100px;
136
+ top:50%;
137
+ margin-top:-50px;
138
+ cursor: pointer;
139
+ }
140
+ .simplemodal-container a.modal-ctrl:hover{
141
+ background: #232323 none;
142
+ }
143
+ .simplemodal-container a.modal-ctrl span.img-icon{
144
+ display: block;
145
+ height:22px;
146
+ width:22px;
147
+ margin:39px auto 39px 10px;
148
+
149
+ background: url("../img/bp-media-modal.png") left bottom no-repeat;
150
+ }
151
+ .simplemodal-container a.modal-next span.img-icon{
152
+ background-position: center bottom;
153
+ margin:39px 10px 39px auto;
154
+ }
155
+ .simplemodal-container a.modal-prev:hover span.img-icon{
156
+ background-position: left top;
157
+ }
158
+ .simplemodal-container a.modal-next:hover span.img-icon{
159
+ background-position: center top;
160
+ }
161
+ .simplemodal-container a.modal-prev:hover,
162
+ .simplemodal-container a.modal-next:hover{
163
+ background:url("../img/") no-repeat;
164
+ }
165
+ .simplemodal-container a.modal-prev{
166
+ left: 0px;
167
+ }
168
+ .simplemodal-container a.modal-next{
169
+ right: 0px;
170
+ }
171
+
172
+ .bp-media-ajax-single .bp-media-mod-title{
173
+ display:block;
174
+ margin-top:22px;
175
+ }
176
+ .bp-media-ajax-single .bp-media-mod-title h2{
177
+ margin: 5px 0;
178
+ padding:0;
179
  }
180
+ .bp-media-ajax-single .bp-media-mod-title p{
181
+ line-height:1.4em;
182
+ }
183
+ .bp-media-ajax-single .bp_media_content img,
184
+ .bp-media-ajax-single .bp_media_content video,
185
+ .bp-media-ajax-single .bp_media_content audio{
186
+ max-width: 100%;
187
+ display:inline-block;
188
+ margin:0 auto;
189
+ vertical-align: middle;
190
+ background:#fff none;
191
+ max-height:600px;
192
+ }
193
+ .bp-media-ajax-single .bp_media_author{
194
+ position:absolute;
195
+ top:0;
196
+ left:0;
197
+ }
198
+ .bp-media-ajax-single .bp-media-content-wrap,
199
+ .bp-media-ajax-single .bp_media_content{
200
+ float:left;
201
+ width:auto;
202
+ margin:0;
203
+ position:relative;
204
+ overflow:hidden;
205
+ height:480px;
206
+ min-width:640px;
207
+ background: #333 none;
208
+ display:table;
209
 
 
 
 
 
 
210
  }
211
+ .bp-media-ajax-single .bp_media_content{
212
+ display:table-cell;
213
+ vertical-align: middle;
214
+ float:none;
215
+ }
216
+ .bp-media-ajax-single .bp-media-content-wrap .bp_media_description{
217
+ display:block;
218
+ position:absolute;
219
+ bottom:0;
220
+ left:0;
221
+ }
222
+ .bp-media-ajax-single .bp-media-meta-content-wrap{
223
+ float:left;
224
+ width:250px;
225
+ margin:0;
226
+ min-height:480px;
227
+ margin-left:10px;
228
+ overflow:auto;
229
+ }
230
+ .bp-media-ajax-single .bp-media-meta-content-wrap .activity-meta{
231
+ margin:0;
232
+ }
233
+ .bp-media-ajax-single .bp-media-meta-content-wrap .activity-meta a{
234
+ padding: 2px 8px;
235
+ margin: 5px 5px 0 0;
236
+ display:inline-block;
237
+ }
238
+ .bp-media-ajax-single .bp-media-meta-content-wrap div.activity-comments ul li > ul{
239
+ margin-left:0;
240
+ padding-left:0;
241
+ }
242
+ .bp-media-ajax-single .bp-media-meta-content-wrap div.activity-comments form div.ac-reply-content{
243
+ margin-left:0;
244
+ padding-left:0;
245
+ }
246
+ /*.bp-media-ajax-single .bp-media-meta-content-wrap div.activity-meta a {
247
+ padding: 0;
248
+ float:left;
249
+ }*/
250
+ .bp-media-ajax-preloader{
251
+ display:none;
252
+ }
253
+
254
 
255
  @media (min-width: 981px) and (max-width: 1096px) {
256
  li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
app/assets/img/bp-media-modal.png ADDED
Binary file
app/assets/img/bpm-icon-32.png CHANGED
Binary file
app/assets/img/close.png ADDED
Binary file
app/assets/img/private.png ADDED
Binary file
app/assets/img/tab-icon.png CHANGED
Binary file
app/assets/js/bp-media-activity-uploader.js CHANGED
@@ -1,239 +1,145 @@
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
  });
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
+ $dummy_update_box = jQuery('<textarea id="bp-media-dummy-update"></textarea>');
9
+ $update_container = jQuery('#whats-new-textarea');
10
+ $update_container.append($dummy_update_box);
11
+ overlay_dummy();
12
+ jQuery('#bp-media-dummy-update').focus( function(){
13
+ do_bp_jazz();
14
+ });
15
+
16
+ jQuery('#bp-media-dummy-update').on('keyup',function(){
17
+ $this = jQuery(this);
18
+ $that = jQuery('#bp-media-update-text');
19
+ $that.val($this.val()).change();
20
+ });
21
+ jQuery('#bp-media-update-text').on('change',function(){
22
+ bp_media_overwrite();
23
+ });
24
+ jQuery('#bp-media-update-json').on('change',function(){
25
+ bp_media_overwrite();
26
+ });
27
+
28
+ $bp_media_activity_is_multiple_upload = false;
29
+ $bp_media_activity_uploader=new plupload.Uploader(bp_media_uploader_params);
30
+ $bp_media_activity_album_selected = false;
31
+ $bp_media_activity_uploader.init();
32
+
33
+ $bp_media_activity_uploader.bind('FilesAdded', function(up, files) {
34
+ //bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
35
+ $bp_media_activity_is_multiple_upload = files.length>1;
36
+ jQuery.each(files, function(i, file) {
37
+ $bp_media_activity_extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
38
+ 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>');
39
+ });
40
+ // bp_media_activity_album_selected = jQuery('#bp-media-activity-selected-album').val();
41
+ $bp_media_activity_album_selected = default_album;
42
+ $bp_media_activity_uploader.start();
43
+ do_bp_jazz();
44
+ up.refresh(); // Reposition Flash/Silverlight
45
+ });
46
+ $bp_media_activity_uploader.bind('UploadProgress', function(up, file) {
47
+ jQuery('input#aw-whats-new-submit').prop('disabled',true).addClass('loading');
48
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
49
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
50
+ });
51
+
52
+ $bp_media_activity_uploader.bind('Error', function(up, err) {
53
+ jQuery('#bp-media-activity-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
54
+ ', Message: ' + err.message +
55
+ (err.file ? ', File: ' + err.file.name : '') +
56
+ '</p></div>'
57
+ );
58
+ up.refresh();
59
+ });
60
+ $bp_media_activity_uploader.bind('FileUploaded', function(up, file,response) {
61
+ jQuery('#bp-media-activity-progress-'+file.id+' .bp-media-progress-text b').html("100%");
62
+ $album_arr = [];
63
+ $val = jQuery('#bp-media-update-json').val();
64
+ if($val!=''){
65
+ $album_arr= JSON.parse($val);
66
+ }
67
+ $album_arr.push(parseInt(response.response));
68
+ $album_json =JSON.stringify($album_arr);
69
+ jQuery('#bp-media-update-json').val($album_json).change();
70
+ jQuery('#aw-whats-new-submit').prop('disabled',false).removeClass('loading');
71
+
72
+ });
73
+ $bp_media_activity_uploader.bind('BeforeUpload',function(up){
74
+ up.settings.multipart_params.is_multiple_upload = $bp_media_activity_is_multiple_upload;
75
+ up.settings.multipart_params.bp_media_album_id = $bp_media_activity_album_selected;
76
+ up.settings.multipart_params.is_activity = true;
77
+ });
78
+ //jQuery("#aw-whats-new-submit").off( 'click');
79
+
80
+ jQuery("#aw-whats-new-submit").on( 'click', function() {
81
+ $latest = '';
82
+ $val = bp_media_stringify();
83
+ jQuery("#bp-media-dummy-update").val('');
84
+ jQuery("#bp-media-update-json").val('');
85
+ jQuery("#bp-media-update-txt").val('');
86
+ jQuery("#bp-media-activity-uploaded-files").empty();
87
+ setTimeout(function(){
88
+ if($val!=''){
89
+ $album_arr= JSON.parse($val);
90
+ $lastid = parseInt($album_arr.length) - 1;
91
+ $media_id = $album_arr[parseInt($lastid)];
92
+ $activity = (jQuery('#activity-stream').find('li').first().attr('id')).split('-');
93
+ $activity_id = $activity[1];
94
+ var data = {
95
+ action: 'bp_media_get_latest_activity',
96
+ content : $val,
97
+ id: $activity_id
98
+ };
99
+ jQuery.get(ajaxurl,data,function(response){
100
+ $latest = response;
101
+ jQuery('#latest-update').html($latest);
102
+ });
103
+ }
104
+ },1000);
105
+ });
106
+
107
+ $bp_media_activity_uploader.bind('UploadComplete',function(response){
108
+
109
+ });
110
+ }
111
+
112
+ function overlay_dummy(){
113
+ $update_box = jQuery('#whats-new');
114
+ $position = $update_box.position();
115
+ $dummy_update_box.css({
116
+ 'position' : 'absolute',
117
+ 'top' : $position.top,
118
+ 'left' : $position.left,
119
+ 'width' : $update_box.width(),
120
+ 'height' : $update_box.height()
121
+ });
122
+ }
123
+
124
+ function bp_media_stringify(){
125
+ $album_json = jQuery('#bp-media-update-json').val();
126
+ $update_txt = jQuery('#bp-media-update-text').val();
127
+ $activity = {
128
+ 'media':$album_json,
129
+ 'update_txt':$update_txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  };
131
+ return JSON.stringify($activity);
132
+ }
133
+
134
+ function bp_media_overwrite(){
135
+ jQuery('#whats-new').val(bp_media_stringify());
136
+ }
137
+
138
+ function do_bp_jazz(){
139
+ jQuery("#whats-new-options").css('height','auto');
140
+ jQuery("#whats-new-form textarea").animate({
141
+ height:'50px'
142
+ });
143
+ jQuery("#aw-whats-new-submit").prop("disabled", false);
144
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  });
app/assets/js/main.js CHANGED
@@ -3,83 +3,512 @@
3
  */
4
 
5
  function bp_media_create_element(id){
6
- jQuery('#'+id).mediaelementplayer({
7
- enableKeyboard: false,
8
- startVolume: 1,
9
- success: function(mediaElement,domElement){
10
- var $thisMediaElement = (mediaElement.id) ? jQuery("#"+mediaElement.id) : jQuery(mediaElement);
11
- $thisMediaElement.parents('.mejs-container').find(".mejs-volume-current").css("top","8px");
12
- $thisMediaElement.parents('.mejs-container').find(".mejs-volume-handle").css("top","5px");
13
- }
14
- });
15
  }
16
-
17
  jQuery(document).ready(function(){
18
 
19
- var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
20
- if(bp_media_recent_tabs.length>0){
21
- jQuery(bp_media_recent_tabs).tabs();
22
- }
23
-
24
- var tallest = 0;
25
- jQuery('#recent-media-tabs .bp-media-tab-panel').each(function() {
26
-
27
- var thisHeight = jQuery(this).height();
28
- if(thisHeight > tallest) {
29
- tallest = thisHeight;
30
- }
31
- }).height(tallest);
32
-
33
-
34
- jQuery('#bp-media-show-more').click(function(e){
35
- e.preventDefault();
36
- var data = {
37
- action: 'bp_media_load_more',
38
- page:++bp_media_vars.page,
39
- current_action : bp_media_vars.current_action,
40
- action_variables : bp_media_vars.action_variables,
41
- displayed_user : bp_media_vars.displayed_user,
42
- loggedin_user : bp_media_vars.loggedin_user,
43
- current_group : bp_media_vars.current_group
44
- };
45
-
46
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
47
- jQuery.post(bp_media_vars.ajaxurl, data, function(response) {
48
- if(response.length==0)
49
- jQuery('#bp-media-show-more').parent().remove();
50
- else
51
- jQuery('#bp-media-list').append(response);
52
- });
53
- });
54
- setTimeout(function(){
55
- jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
56
- if(confirm('Are you sure you want to delete this activity and associated media?')){
57
- return true;
58
- }
59
- else{
60
- return false;
61
- }
62
- });
63
-
64
- },1000);
65
-
66
- /* Add Featured Image */
67
- jQuery('.activity-meta').on('click','.bp-media-featured',function(e){
68
- e.preventDefault();
69
- var post_id = jQuery(this).attr('data-post-id');
70
- var album_id = jQuery(this).attr('data-album-id');
71
- var curr_obj = jQuery(this);
72
- var data = {
73
- action: 'bp_media_set_album_cover',
74
- post_id:post_id,
75
- album_id:album_id
76
- };
77
- jQuery.post(bp_media_vars.ajaxurl,data,function( response )
78
- {
79
- curr_obj.text(response);
80
- curr_obj.attr('title',response);
81
- }
82
- );
83
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  });
3
  */
4
 
5
  function bp_media_create_element(id){
6
+ jQuery('#'+id).mediaelementplayer({
7
+ enableKeyboard: false,
8
+ startVolume: 1,
9
+ success: function(mediaElement,domElement){
10
+ var $thisMediaElement = (mediaElement.id) ? jQuery("#"+mediaElement.id) : jQuery(mediaElement);
11
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-current").css("top","8px");
12
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-handle").css("top","5px");
13
+ }
14
+ });
15
  }
16
+ var $current;
17
  jQuery(document).ready(function(){
18
 
19
+ var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
20
+ if(bp_media_recent_tabs.length>0){
21
+ jQuery(bp_media_recent_tabs).tabs();
22
+ }
23
+
24
+ var tallest = 0;
25
+ jQuery('#recent-media-tabs .bp-media-tab-panel').each(function() {
26
+
27
+ var thisHeight = jQuery(this).height();
28
+ if(thisHeight > tallest) {
29
+ tallest = thisHeight;
30
+ }
31
+ }).height(tallest);
32
+
33
+
34
+ jQuery('#bp-media-show-more').click(function(e){
35
+ e.preventDefault();
36
+ var data = load_more_data();
37
+ jQuery.get(bp_media_vars.ajaxurl, data, function(response) {
38
+ if(response.length==0)
39
+ jQuery('#bp-media-show-more').parent().remove();
40
+ else
41
+ jQuery('.bp-media-gallery').append(response);
42
+ });
43
+ });
44
+ setTimeout(function(){
45
+ jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
46
+ if(confirm('Are you sure you want to delete this activity and associated media?')){
47
+ return true;
48
+ }
49
+ else{
50
+ return false;
51
+ }
52
+ });
53
+
54
+ },1000);
55
+
56
+ /* Add Featured Image */
57
+ jQuery('.activity-meta').on('click','.bp-media-featured',function(e){
58
+ e.preventDefault();
59
+ var post_id = jQuery(this).attr('data-post-id');
60
+ var album_id = jQuery(this).attr('data-album-id');
61
+ var curr_obj = jQuery(this);
62
+ var data = {
63
+ action: 'bp_media_set_album_cover',
64
+ post_id:post_id,
65
+ album_id:album_id
66
+ };
67
+ jQuery.get(bp_media_vars.ajaxurl,data,function( response )
68
+ {
69
+ curr_obj.text(response);
70
+ curr_obj.attr('title',response);
71
+ }
72
+ );
73
+ });
74
+
75
+
76
+ jQuery('#bp-media-list').on('click','li a',function(e){
77
+ e.preventDefault();
78
+ $current = jQuery(this);
79
+ load_media($current);
80
+ });
81
+ jQuery('body').on('click','a.modal-next', function(e){
82
+ e.preventDefault();
83
+ $next_current = $current.closest('li').next().find('a');
84
+ if($next_current.length<1){
85
+ var args = load_more_data();
86
+ var request = jQuery.get(bp_media_vars.ajaxurl, args);
87
+ chained = request.then(function( data ) {
88
+ if(data.length==0){
89
+ jQuery('#bp-media-show-more').parent().remove();
90
+ return false;
91
+ }else{
92
+ jQuery('#bp-media-list').append(data);
93
+ return true;
94
+ }
95
+ });
96
+
97
+ chained.done(function( truth ) {
98
+ if(truth!=false){
99
+ $next_current = $current.closest('li').next().find('a');
100
+ $current = $next_current;
101
+ transit_media($current);
102
+ }
103
+ });
104
+ }else{
105
+ $current = $next_current;
106
+ transit_media($next_current);
107
+ }
108
+
109
+
110
+ });
111
+ jQuery('body').on('click','a.modal-prev', function(e){
112
+ e.preventDefault();
113
+ if($current.closest('li').prev().length>0 && $current.closest('li').prev().find('#bp-media-upload-ui').length<1 ){
114
+ $current = $current.closest('li').prev().find('a');
115
+
116
+ transit_media($current);
117
+ }
118
+ });
119
+ jQuery(document.documentElement).keyup(function (event) {
120
+ if (event.keyCode == 37) {
121
+ jQuery('a.modal-prev').trigger('click');
122
+ } else if (event.keyCode == 39) {
123
+ jQuery('a.modal-next').trigger('click');
124
+ }
125
+ });
126
+
127
+ function load_media($current){
128
+ jQuery.get($current.attr('href'),function(response){
129
+ $mediacontent = jQuery(response).find('.bp-media-single');
130
+ $medialoaded = jQuery('<div class="bp-media-ajax-single"></div>');
131
+ $medialoaded.append($mediacontent);
132
+ jQuery.modal($medialoaded,{
133
+ 'zIndex':99999,
134
+ 'autoResize':true,
135
+ 'opacity': 90
136
+ });
137
+ do_fixes($medialoaded);
138
+ });
139
+ }
140
+ function transit_media($current){
141
+ jQuery.get($current.attr('href'),function(response){
142
+ $mediacontent = jQuery(response).find('.bp-media-single');
143
+ $medialoaded = jQuery('.bp-media-ajax-single');
144
+ $medialoaded.empty();
145
+ $medialoaded.append($mediacontent);
146
+ do_fixes($medialoaded);
147
+
148
+ });
149
+ }
150
+
151
+ function do_fixes($medialoaded){
152
+ $medialoaded.find('.bp-media-content-wrap').append('<a class="modal-prev modal-ctrl"><span class="img-icon"></span></a><a class="modal-next modal-ctrl"><span class="img-icon"></span></a>');
153
+ $medialoaded.find('.bp_media_description').remove();
154
+ $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content img');
155
+ if($image.length<1){
156
+ $image = $medialoaded.find('.bp-media-content-wrap .bp_media_content video');
157
+ $dimensions = adjust_dimensions($image);
158
+ adjust_comment_div($dimensions[0]);
159
+ jQuery.modal.update($dimensions[0],$dimensions[1]);
160
+ }
161
+ $form = $medialoaded.find('form.ac-form');
162
+ if($form.length>0){
163
+ $form.find('.ac-reply-avatar').remove();
164
+ $form.html($form.html().replace('&nbsp; or press esc to cancel.',''));
165
+ }
166
+ $image.load(function(){
167
+ $dimensions = adjust_dimensions($image);
168
+ adjust_comment_div($dimensions[0]);
169
+ jQuery.modal.update($dimensions[0],$dimensions[1]);
170
+ })
171
+ }
172
+
173
+ function adjust_dimensions($image){
174
+
175
+ $height = ($image.height()>480)?$image.height():480;
176
+ $width = ($image.width()>640)?$image.width():640;
177
+ $width = $width +280;
178
+ return [$height,$width];
179
+ }
180
+
181
+ function adjust_comment_div($height){
182
+ $medialoaded.find('.bp-media-meta-content-wrap').css({
183
+ 'height': $height,
184
+ 'overflow':'auto'
185
+ });
186
+ }
187
+ function load_more_data(){
188
+ var data = {
189
+ action: 'bp_media_load_more',
190
+ page:++bp_media_vars.page,
191
+ current_action : bp_media_vars.current_action,
192
+ action_variables : bp_media_vars.action_variables,
193
+ displayed_user : bp_media_vars.displayed_user,
194
+ loggedin_user : bp_media_vars.loggedin_user,
195
+ current_group : bp_media_vars.current_group
196
+ };
197
+ return data;
198
+ }
199
+
200
+ /**** Activity Comments *******************************************************/
201
+
202
+ /* Hide all activity comment forms */
203
+ jQuery('form.ac-form').hide();
204
+
205
+ /* Hide excess comments */
206
+ // if ( jQuery('.activity-comments').length )
207
+ // bp_legacy_theme_hide_comments();
208
+
209
+ /* Activity list event delegation */
210
+ jQuery('body').on( 'click', '.bp-media-ajax-single div.activity',function(event) {
211
+ var target = jQuery(event.target);
212
+ if ( target.hasClass('bp-media-featured') ) {
213
+ var post_id = target.attr('data-post-id');
214
+ var album_id = target.attr('data-album-id');
215
+ var data = {
216
+ action: 'bp_media_set_album_cover',
217
+ post_id:post_id,
218
+ album_id:album_id
219
+ };
220
+ target.addClass('loading');
221
+ jQuery.get(bp_media_vars.ajaxurl,data,function( response )
222
+ {
223
+ target.removeClass('loading');
224
+ target.fadeOut( 200, function() {
225
+ jQuery(this).html(response);
226
+ jQuery(this).attr('title',response);
227
+ jQuery(this).fadeIn(200);
228
+ });
229
+
230
+ }
231
+ );
232
+ }
233
+
234
+ /* Favoriting activity stream items */
235
+ if ( target.hasClass('fav') || target.hasClass('unfav') ) {
236
+ console.log('hua');
237
+ event.preventDefault();
238
+ var type = target.hasClass('fav') ? 'fav' : 'unfav';
239
+ var parent = target.closest('.activity_update');
240
+ var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
241
+
242
+ target.addClass('loading');
243
+
244
+ jQuery.post( ajaxurl, {
245
+ action: 'activity_mark_' + type,
246
+ 'cookie': encodeURIComponent(document.cookie),
247
+ 'id': parent_id
248
+ },
249
+ function(response) {
250
+ target.removeClass('loading');
251
+
252
+ target.fadeOut( 200, function() {
253
+ jQuery(this).html(response);
254
+ jQuery(this).attr('title', 'fav' == type ? BP_DTheme.remove_fav : BP_DTheme.mark_as_fav);
255
+ jQuery(this).fadeIn(200);
256
+ });
257
+
258
+ if ( 'fav' == type ) {
259
+ if ( !jQuery('.item-list-tabs #activity-favorites').length )
260
+ jQuery('.item-list-tabs ul #activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>');
261
+
262
+ target.removeClass('fav');
263
+ target.addClass('unfav');
264
+
265
+ jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) + 1 );
266
+ } else {
267
+ target.removeClass('unfav');
268
+ target.addClass('fav');
269
+
270
+ jQuery('.item-list-tabs ul #activity-favorites span').html( Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) - 1 );
271
+
272
+ if ( !Number( jQuery('.item-list-tabs ul #activity-favorites span').html() ) ) {
273
+ if ( jQuery('.item-list-tabs ul #activity-favorites').hasClass('selected') )
274
+ bp_activity_request( null, null );
275
+
276
+ jQuery('.item-list-tabs ul #activity-favorites').remove();
277
+ }
278
+ }
279
+
280
+ if ( 'activity-favorites' == jQuery( '.item-list-tabs li.selected').attr('id') )
281
+ target.parent().parent().parent().slideUp(100);
282
+ });
283
+
284
+ return false;
285
+ }
286
+ /* Comment / comment reply links */
287
+ if ( target.hasClass('acomment-reply') || target.parent().hasClass('acomment-reply') ) {
288
+ if ( target.parent().hasClass('acomment-reply') )
289
+ target = target.parent();
290
+
291
+ var id = target.attr('id');
292
+ ids = id.split('-');
293
+
294
+ var a_id = ids[2]
295
+ var c_id = target.attr('href').substr( 10, target.attr('href').length );
296
+ var form = jQuery( '#ac-form-' + a_id );
297
+
298
+ form.css( 'display', 'none' );
299
+ form.removeClass('root');
300
+ jQuery('.ac-form').hide();
301
+
302
+ /* Hide any error messages */
303
+ form.children('div').each( function() {
304
+ if ( jQuery(this).hasClass( 'error' ) )
305
+ jQuery(this).hide();
306
+ });
307
+
308
+ if ( ids[1] != 'comment' ) {
309
+ jQuery('#acomment-' + c_id).append( form );
310
+ } else {
311
+ jQuery('#activity-' + a_id + ' .activity-comments').append( form );
312
+ }
313
+
314
+ if ( form.parent().hasClass( 'activity-comments' ) )
315
+ form.addClass('root');
316
+
317
+ form.slideDown( 200 );
318
+ jQuery.scrollTo( form, 500, {
319
+ offset:-100,
320
+ easing:'easeOutQuad'
321
+ } );
322
+ jQuery('#ac-form-' + ids[2] + ' textarea').focus();
323
+
324
+ return false;
325
+ }
326
+
327
+ /* Activity comment posting */
328
+ if ( target.attr('name') == 'ac_form_submit' ) {
329
+ var form = target.parents( 'form' );
330
+ var form_parent = form.parent();
331
+ var form_id = form.attr('id').split('-');
332
+
333
+ if ( !form_parent.hasClass('activity-comments') ) {
334
+ var tmp_id = form_parent.attr('id').split('-');
335
+ var comment_id = tmp_id[1];
336
+ } else {
337
+ var comment_id = form_id[2];
338
+ }
339
+
340
+ var content = jQuery( '#' + form.attr('id') + ' textarea' );
341
+
342
+ /* Hide any error messages */
343
+ jQuery( '#' + form.attr('id') + ' div.error').hide();
344
+ target.addClass('loading').prop('disabled', true);
345
+ content.addClass('loading').prop('disabled', true);
346
+
347
+ var ajaxdata = {
348
+ action: 'new_activity_comment',
349
+ 'cookie': encodeURIComponent(document.cookie),
350
+ '_wpnonce_new_activity_comment': jQuery("#_wpnonce_new_activity_comment").val(),
351
+ 'comment_id': comment_id,
352
+ 'form_id': form_id[2],
353
+ 'content': content.val()
354
+ };
355
+
356
+ // Akismet
357
+ var ak_nonce = jQuery('#_bp_as_nonce_' + comment_id).val();
358
+ if ( ak_nonce ) {
359
+ ajaxdata['_bp_as_nonce_' + comment_id] = ak_nonce;
360
+ }
361
+
362
+ jQuery.post( ajaxurl, ajaxdata, function(response) {
363
+ target.removeClass('loading');
364
+ content.removeClass('loading');
365
+
366
+ /* Check for errors and append if found. */
367
+ if ( response[0] + response[1] == '-1' ) {
368
+ form.append( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
369
+ } else {
370
+ form.fadeOut( 200, function() {
371
+ if ( 0 == form.parent().children('ul').length ) {
372
+ if ( form.parent().hasClass('activity-comments') ) {
373
+ form.parent().prepend('<ul></ul>');
374
+ } else {
375
+ form.parent().append('<ul></ul>');
376
+ }
377
+ }
378
+
379
+ /* Preceeding whitespace breaks output with jQuery 1.9.0 */
380
+ var the_comment = jQuery.trim( response );
381
+
382
+ form.parent().children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
383
+ form.children('textarea').val('');
384
+ form.parent().parent().addClass('has-comments');
385
+ } );
386
+ jQuery( '#' + form.attr('id') + ' textarea').val('');
387
+
388
+ /* Increase the "Reply (X)" button count */
389
+ jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
390
+ }
391
+
392
+ jQuery(target).prop("disabled", false);
393
+ jQuery(content).prop("disabled", false);
394
+ });
395
+
396
+ return false;
397
+ }
398
+
399
+ /* Deleting an activity comment */
400
+ if ( target.hasClass('acomment-delete') ) {
401
+ var link_href = target.attr('href');
402
+ var comment_li = target.parent().parent();
403
+ var form = comment_li.parents('div.activity-comments').children('form');
404
+
405
+ var nonce = link_href.split('_wpnonce=');
406
+ nonce = nonce[1];
407
+
408
+ var comment_id = link_href.split('cid=');
409
+ comment_id = comment_id[1].split('&');
410
+ comment_id = comment_id[0];
411
+
412
+ target.addClass('loading');
413
+
414
+ /* Remove any error messages */
415
+ jQuery('.activity-comments ul .error').remove();
416
+
417
+ /* Reset the form position */
418
+ comment_li.parents('.activity-comments').append(form);
419
+
420
+ jQuery.post( ajaxurl, {
421
+ action: 'delete_activity_comment',
422
+ 'cookie': encodeURIComponent(document.cookie),
423
+ '_wpnonce': nonce,
424
+ 'id': comment_id
425
+ },
426
+ function(response) {
427
+ /* Check for errors and append if found. */
428
+ if ( response[0] + response[1] == '-1' ) {
429
+ comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
430
+ } else {
431
+ var children = jQuery( '#' + comment_li.attr('id') + ' ul' ).children('li');
432
+ var child_count = 0;
433
+ jQuery(children).each( function() {
434
+ if ( !jQuery(this).is(':hidden') )
435
+ child_count++;
436
+ });
437
+ comment_li.fadeOut(200);
438
+
439
+ /* Decrease the "Reply (X)" button count */
440
+ var count_span = jQuery('#' + comment_li.parents('#activity-stream > li').attr('id') + ' a.acomment-reply span');
441
+ var new_count = count_span.html() - ( 1 + child_count );
442
+ count_span.html(new_count);
443
+
444
+ /* If that was the last comment for the item, remove the has-comments class to clean up the styling */
445
+ if ( 0 == new_count ) {
446
+ jQuery(comment_li.parents('#activity-stream > li')).removeClass('has-comments');
447
+ }
448
+ }
449
+ });
450
+
451
+ return false;
452
+ }
453
+
454
+ // Spam an activity stream comment
455
+ if ( target.hasClass( 'spam-activity-comment' ) ) {
456
+ var link_href = target.attr( 'href' );
457
+ var comment_li = target.parent().parent();
458
+
459
+ target.addClass('loading');
460
+
461
+ // Remove any error messages
462
+ jQuery( '.activity-comments ul div.error' ).remove();
463
+
464
+ // Reset the form position
465
+ comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) );
466
+
467
+ jQuery.post( ajaxurl, {
468
+ action: 'bp_spam_activity_comment',
469
+ 'cookie': encodeURIComponent( document.cookie ),
470
+ '_wpnonce': link_href.split( '_wpnonce=' )[1],
471
+ 'id': link_href.split( 'cid=' )[1].split( '&' )[0]
472
+ },
473
+
474
+ function ( response ) {
475
+ // Check for errors and append if found.
476
+ if ( response[0] + response[1] == '-1' ) {
477
+ comment_li.prepend( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
478
+
479
+ } else {
480
+ var children = jQuery( '#' + comment_li.attr( 'id' ) + ' ul' ).children( 'li' );
481
+ var child_count = 0;
482
+ jQuery(children).each( function() {
483
+ if ( !jQuery( this ).is( ':hidden' ) ) {
484
+ child_count++;
485
+ }
486
+ });
487
+ comment_li.fadeOut( 200 );
488
+
489
+ // Decrease the "Reply (X)" button count
490
+ var parent_li = comment_li.parents( '#activity-stream > li' );
491
+ jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html( jQuery( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html() - ( 1 + child_count ) );
492
+ }
493
+ });
494
+
495
+ return false;
496
+ }
497
+
498
+ /* Showing hidden comments - pause for half a second */
499
+ if ( target.parent().hasClass('show-all') ) {
500
+ target.parent().addClass('loading');
501
+
502
+ setTimeout( function() {
503
+ target.parent().parent().children('li').fadeIn(200, function() {
504
+ target.parent().remove();
505
+ });
506
+ }, 600 );
507
+
508
+ return false;
509
+ }
510
+ });
511
+
512
+
513
 
514
  });
app/helper/BPMediaFeed.php CHANGED
@@ -8,7 +8,7 @@
8
  */
9
  class BPMediaFeed {
10
 
11
- public $feed_url = 'http://rtcamp.com/tag/buddypress/feed/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media';
12
 
13
  public function __construct($feed_url = '') {
14
  if ($feed_url)
@@ -46,7 +46,7 @@ class BPMediaFeed {
46
  foreach ($rss_items as $item) {
47
  ?>
48
  <li>
49
- <a href='<?php echo $item->get_permalink(); ?>' title='<?php echo __('Posted ', BP_MEDIA_TXT_DOMAIN) . $item->get_date('j F Y | g:i a'); ?>'><?php echo $item->get_title(); ?></a>
50
  </li><?php
51
  }
52
  }
8
  */
9
  class BPMediaFeed {
10
 
11
+ public $feed_url = 'http://rtcamp.com/tag/buddypress/feed/';
12
 
13
  public function __construct($feed_url = '') {
14
  if ($feed_url)
46
  foreach ($rss_items as $item) {
47
  ?>
48
  <li>
49
+ <a href='<?php echo $item->get_permalink(); ?>?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media' title='<?php echo __('Posted ', BP_MEDIA_TXT_DOMAIN) . $item->get_date('j F Y | g:i a'); ?>'><?php echo $item->get_title(); ?></a>
50
  </li><?php
51
  }
52
  }
app/helper/BPMediaSettings.php CHANGED
@@ -5,222 +5,237 @@
5
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
  */
8
- if ( ! class_exists( 'BPMediaSettings' ) ) {
9
-
10
- class BPMediaSettings {
11
-
12
- public function __construct() {
13
- add_action( 'admin_init', array( $this, 'settings' ) );
14
- if ( is_multisite() ) {
15
- add_action( 'network_admin_notices', array( $this, 'privacy_notice' ) );
16
- } else {
17
- add_action( 'admin_notices', array( $this, 'privacy_notice' ) );
18
- }
19
- }
20
-
21
- /**
22
- * Register Settings
23
- *
24
- * @global string BP_MEDIA_TXT_DOMAIN
25
- */
26
-
27
- /**
28
- *
29
- * @global BPMediaAddon $bp_media_addon
30
- */
31
- public function settings() {
32
- global $bp_media, $bp_media_addon;
33
- add_settings_section( 'bpm-settings', __( 'Enabled Media Types', BP_MEDIA_TXT_DOMAIN ), is_multisite() ? array( $this, 'network_notices' ) : '', 'bp-media-settings' );
34
- add_settings_field( 'bpm-image', __( 'Photos', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-settings', array(
35
- 'setting' => 'bp_media_options',
36
- 'option' => 'images_enabled',
37
- 'desc' => __( 'Enable Photos', BP_MEDIA_TXT_DOMAIN )
38
- ) );
39
- add_settings_field( 'bpm-video', __( 'Video', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-settings', array(
40
- 'setting' => 'bp_media_options',
41
- 'option' => 'videos_enabled',
42
- 'desc' => __( 'Enable Video', BP_MEDIA_TXT_DOMAIN )
43
- ) );
44
- add_settings_field( 'bpm-audio', __( 'Audio', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-settings', array(
45
- 'setting' => 'bp_media_options',
46
- 'option' => 'audio_enabled',
47
- 'desc' => __( 'Enable Audio', BP_MEDIA_TXT_DOMAIN )
48
- ) );
49
-
50
- if ( bp_is_active( 'groups' ) ) {
51
- add_settings_section( 'bpm-media-type', __( 'Groups Integration', BP_MEDIA_TXT_DOMAIN ), '', 'bp-media-settings' );
 
 
 
 
 
 
 
 
 
52
  // add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
53
  // 'setting' => 'bp_media_options',
54
  // 'option' => 'enable_on_profile',
55
  // 'desc' => __('Check to enable BuddyPress Media on User profiles', BP_MEDIA_TXT_DOMAIN)
56
  // )
57
  // );
58
- add_settings_field( 'bpm-admin-group', __( 'Groups', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-media-type', array(
59
- 'setting' => 'bp_media_options',
60
- 'option' => 'enable_on_group',
61
- 'desc' => __( 'Allow Media in Groups', BP_MEDIA_TXT_DOMAIN )
62
- )
63
- );
64
- }
65
-
66
-
67
-
68
- add_settings_section( 'bpm-media-fine', __( 'Display Settings', BP_MEDIA_TXT_DOMAIN ), '', 'bp-media-settings' );
69
- add_settings_field( 'bpm-media-count', __( 'Number of media', BP_MEDIA_TXT_DOMAIN ), array( $this, 'textbox' ), 'bp-media-settings', 'bpm-media-fine', array(
70
- 'setting' => 'bp_media_options',
71
- 'option' => 'default_count'
72
- ) );
73
- add_settings_field( 'bpm-download', __( 'Download Button', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-media-fine', array(
74
- 'setting' => 'bp_media_options',
75
- 'option' => 'download_enabled',
76
- 'desc' => __( 'Display download button under media', BP_MEDIA_TXT_DOMAIN )
77
- ) );
78
-
79
- if ( BPMediaPrivacy::is_installed() ) {
80
- add_settings_section( 'bpm-privacy', __( 'Privacy Settings', BP_MEDIA_TXT_DOMAIN ), '', 'bp-media-settings' );
81
- add_settings_field( 'bpm-privacy-enabled', __( 'Enable Privacy', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-privacy', array(
82
- 'setting' => 'bp_media_options',
83
- 'option' => 'privacy_enabled',
84
- 'desc' => __( 'Enable privacy', BP_MEDIA_TXT_DOMAIN )
85
- ) );
86
-
87
- $settings = array(
88
- 6 => __( '<strong>Private</strong> - Visible only to the user', BP_MEDIA_TXT_DOMAIN ),
89
- 4 => __( '<strong>Friends</strong> - Visible to user\'s friends', BP_MEDIA_TXT_DOMAIN ),
90
- 2 => __( '<strong>Users</strong> - Visible to registered users', BP_MEDIA_TXT_DOMAIN ),
91
- 0 => __( '<strong>Public</strong> - Visible to the world', BP_MEDIA_TXT_DOMAIN )
92
- );
93
- if ( ! bp_is_active( 'friends' ) ) {
94
- unset( $settings[ 4 ] );
95
- }
96
- add_settings_field( 'bpm-privacy-private-enabled', __( 'Default Privacy', BP_MEDIA_TXT_DOMAIN ), array( $this, 'radio' ), 'bp-media-settings', 'bpm-privacy', array(
97
- 'setting' => 'bp_media_options',
98
- 'option' => 'default_privacy_level',
99
- 'radios' => $settings,
100
- 'default' => 0,
101
- ) );
102
- add_settings_field( 'bpm-privacy-override-enabled', __( 'User Override', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-privacy', array(
103
- 'setting' => 'bp_media_options',
104
- 'option' => 'privacy_override_enabled',
105
- 'desc' => __( 'Allow users to override admin defaults (<em>Recommended</em>)', BP_MEDIA_TXT_DOMAIN )
106
- ) );
107
- }
108
- add_settings_section( 'bpm-miscellaneous', __( 'Other Settings', BP_MEDIA_TXT_DOMAIN ), '', 'bp-media-settings' );
109
-
110
- add_settings_field( 'bpm-admin-bar-menu', __( 'Admin bar menu', BP_MEDIA_TXT_DOMAIN ), array( $this, 'checkbox' ), 'bp-media-settings', 'bpm-miscellaneous', array(
111
- 'setting' => 'bp_media_options',
112
- 'option' => 'show_admin_menu',
113
- 'desc' => __( 'Enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN )
114
- )
115
- );
116
- add_settings_field( 'bpm-other-settings', __( 'Recount', BP_MEDIA_TXT_DOMAIN ), array( $this, 'button' ), 'bp-media-settings', 'bpm-miscellaneous', array(
117
- 'option' => 'refresh-count',
118
- 'name' => __( 'Recount', BP_MEDIA_TXT_DOMAIN ),
119
- 'desc' => __( 'Repair media counts', BP_MEDIA_TXT_DOMAIN )
120
- ) );
121
-
122
- $bp_media_addon = new BPMediaAddon();
123
- 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' );
124
- add_settings_section( 'bpm-support', __( 'Submit a request form', BP_MEDIA_TXT_DOMAIN ), '', 'bp-media-support' );
125
- add_settings_field( 'bpm-request', __( 'Request Type', BP_MEDIA_TXT_DOMAIN ), array( $this, 'dropdown' ), 'bp-media-support', 'bpm-support', array( 'option' => 'select-request', 'none' => false, 'values' => array(
126
- '' => '-- ' . __( 'Select One', BP_MEDIA_TXT_DOMAIN ) . ' --',
127
- 'premium_support' => __( 'Premium Support', BP_MEDIA_TXT_DOMAIN ),
128
- 'new_feature' => __( 'Suggest a New Feature', BP_MEDIA_TXT_DOMAIN ),
129
- 'bug_report' => __( 'Submit a Bug Report', BP_MEDIA_TXT_DOMAIN ) )
130
- ) );
131
- if ( ! BPMediaPrivacy::is_installed() ) {
132
- $bp_media_privacy = new BPMediaPrivacySettings();
133
- add_filter( 'bp_media_add_sub_tabs', array( $bp_media_privacy, 'ui' ), 99, 2 );
134
- add_settings_section( 'bpm-privacy', __( 'Update Database', BP_MEDIA_TXT_DOMAIN ), array( $bp_media_privacy, 'init' ), 'bp-media-privacy' );
135
- }
136
-
137
- add_settings_section( 'bpm-convert-videos', '', array( $this, 'convert_videos_form' ), 'bp-media-convert-videos' );
138
-
139
- register_setting( 'bp_media', 'bp_media_options', array( $this, 'sanitize' ) );
140
- }
141
-
142
- public function convert_videos_form() {
143
- global $current_user;
144
- get_currentuserinfo();
145
- ?>
146
- <div id="video-transcoding-main-container">
147
- <h2>Survey</h2>
148
- <p class="para-blockquote">We are planning an encoding service where you can convert videos without having to install/configure anything on your server.</p>
149
- <h3>Would you be interested?</h3>
150
- <label><input class="interested" name="interested" type="radio" value="Yes" required="required" /> Yes</label>&nbsp;&nbsp;&nbsp;
151
- <label><input class="not-interested" name="interested" type="radio" value="No" required="required" /> No</label>
152
- <div class="interested-container hidden">
153
- <p class="para-blockquote">Glad to see your interest.<br />
154
- Please provide a little more information to help us plan this service better.</p>
155
- <label><h3>Email</h3> <input class="email" type="email" name="email" size="35" value="<?php echo $current_user->user_email; ?>" placeholder="Email" /></label>
156
-
157
- <h3>How would you use this feature?</h3>
158
- <ul>
159
- <li><label><input class="choice-free" type="radio" name="choice" value="Free" /> Free-only. I will use free-encoding quota only.</label></li>
160
- <li><label><input type="radio" name="choice" value="$9" /> I am ready to pay $9 per month for generous encoding quota.</label></li>
161
- <li><label><input type="radio" name="choice" value="$99" /> I am ready to pay $99 per month for unlimited video encoding!</label></li>
162
- </div>
163
- <input class="url" type="hidden" name="url" value="<?php echo home_url(); ?>" />
164
- <br />
165
- <br />
166
- <input class="button button-primary video-transcoding-survey" type="submit" value="Submit" />
167
- </div><?php
168
- }
169
-
170
- public function network_notices() {
171
- $flag = 1;
172
- if ( get_site_option( 'bpm-media-enable', false ) ) {
173
- echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . get_site_option( 'bpm-media-enable' ) . '</strong></p></div>';
174
- delete_site_option( 'bpm-media-enable' );
175
- $flag = 0;
176
- }
177
- if ( get_site_option( 'bpm-media-type', false ) ) {
178
- echo '<div id="setting-error-bpm-media-type" class="error"><p><strong>' . get_site_option( 'bpm-media-type' ) . '</strong></p></div>';
179
- delete_site_option( 'bpm-media-type' );
180
- $flag = 0;
181
- }
182
-
183
- if ( get_site_option( 'bpm-recount-success', false ) ) {
184
- echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option( 'bpm-recount-success' ) . '</strong></p></div>';
185
- delete_site_option( 'bpm-recount-success' );
186
- $flag = 0;
187
- } elseif ( get_site_option( 'bpm-recount-fail', false ) ) {
188
- echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option( 'bpm-recount-fail' ) . '</strong></p></div>';
189
- delete_site_option( 'bpm-recount-fail' );
190
- $flag = 0;
191
- }
192
-
193
- if ( get_site_option( 'bpm-settings-saved' ) && $flag ) {
194
- echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option( 'bpm-settings-saved' ) . '</strong></p></div>';
195
- }
196
- delete_site_option( 'bpm-settings-saved' );
197
- }
198
-
199
- /**
200
- * Sanitizes the settings
201
- */
202
-
203
- /**
204
- *
205
- * @global type $bp_media_admin
206
- * @param type $input
207
- * @return type
208
- */
209
- public function sanitize( $input ) {
210
- global $bp_media_admin;
211
- if ( isset( $_POST[ 'refresh-count' ] ) ) {
212
- if ( $bp_media_admin->update_count() ) {
213
- if ( is_multisite() )
214
- update_site_option( 'bpm-recount-success', __( 'Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN ) );
215
- else
216
- add_settings_error( __( 'Recount Success', BP_MEDIA_TXT_DOMAIN ), 'bpm-recount-success', __( 'Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN ), 'updated' );
217
- } else {
218
- if ( is_multisite() )
219
- update_site_option( 'bpm-recount-fail', __( 'Recounting Failed', BP_MEDIA_TXT_DOMAIN ) );
220
- else
221
- add_settings_error( __( 'Recount Fail', BP_MEDIA_TXT_DOMAIN ), 'bpm-recount-fail', __( 'Recounting Failed', BP_MEDIA_TXT_DOMAIN ) );
222
- }
223
- }
 
 
 
 
 
 
224
  // if (!isset($_POST['bp_media_options']['enable_on_profile']) && !isset($_POST['bp_media_options']['enable_on_group'])) {
225
  // if (is_multisite())
226
  // 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));
@@ -228,259 +243,269 @@ if ( ! class_exists( 'BPMediaSettings' ) ) {
228
  // 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));
229
  // $input['enable_on_profile'] = 1;
230
  // }
231
- if ( ! isset( $_POST[ 'bp_media_options' ][ 'videos_enabled' ] ) && ! isset( $_POST[ 'bp_media_options' ][ 'audio_enabled' ] ) && ! isset( $_POST[ 'bp_media_options' ][ 'images_enabled' ] ) ) {
232
- if ( is_multisite() )
233
- update_site_option( 'bpm-media-type', __( 'Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN ) );
234
- else
235
- add_settings_error( __( 'Media Type', BP_MEDIA_TXT_DOMAIN ), 'bpm-media-type', __( 'Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN ) );
236
- $input[ 'images_enabled' ] = 1;
237
- }
238
- if ( is_multisite() )
239
- update_site_option( 'bpm-settings-saved', __( 'Settings saved.', BP_MEDIA_TXT_DOMAIN ) );
240
- do_action( 'bp_media_sanitize_settings', $_POST, $input );
241
- return $input;
242
- }
243
-
244
- /**
245
- * Output a checkbox
246
- *
247
- * @global array $bp_media
248
- * @param array $args
249
- */
250
-
251
- /**
252
- *
253
- * @global array $bp_media
254
- * @param type $args
255
- * @return type
256
- */
257
- public function checkbox( $args ) {
258
- global $bp_media;
259
- $options = $bp_media->options;
260
- $defaults = array(
261
- 'setting' => '',
262
- 'option' => '',
263
- 'desc' => '',
264
- );
265
- $args = wp_parse_args( $args, $defaults );
266
- extract( $args );
267
- if ( empty( $option ) ) {
268
- trigger_error( __( 'Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' ) ', BP_MEDIA_TXT_DOMAIN ) );
269
- return;
270
- }
271
-
272
- if ( ! empty( $setting ) ) {
273
- $name = $setting . '[' . $option . ']';
274
- $options = bp_get_option( $setting );
275
- } else
276
- $name = $option;
277
-
278
- if ( ! isset( $options[ $option ] ) )
279
- $options[ $option ] = '';
280
- ?>
281
- <label for="<?php echo $option; ?>">
282
- <input<?php checked( $options[ $option ] ); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
283
- <?php echo $desc; ?>
284
- </label><?php
285
- }
286
-
287
- /**
288
- * Outputs Radio Buttons
289
- *
290
- * @global array $bp_media
291
- * @param array $args
292
- */
293
-
294
- /**
295
- *
296
- * @global array $bp_media
297
- * @param type $args
298
- * @return type
299
- */
300
- public function radio( $args ) {
301
- global $bp_media;
302
- $options = $bp_media->options;
303
- $defaults = array(
304
- 'setting' => '',
305
- 'option' => '',
306
- 'radios' => array( ),
307
- 'default' => '',
308
- );
309
- $args = wp_parse_args( $args, $defaults );
310
- extract( $args );
311
- if ( empty( $option ) || ( 2 > count( $radios ) ) ) {
312
- if ( empty( $option ) )
313
- trigger_error( __( 'Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN ) );
314
- if ( 2 > count( $radios ) )
315
- trigger_error( __( 'Need to specify atleast to radios else use a checkbox instead', BP_MEDIA_TXT_DOMAIN ) );
316
- return;
317
- }
318
-
319
- if ( ! empty( $setting ) ) {
320
- $name = $setting . '[' . $option . ']';
321
- $options = bp_get_option( $setting );
322
- } else
323
- $name = $option;
324
-
325
- if ( (isset( $options[ $option ] ) && empty( $options[ $option ] )) || ! isset( $options[ $option ] ) ) {
326
- $options[ $option ] = $default;
327
- }
328
-
329
- foreach ( $radios as $value => $desc ) {
330
- ?>
331
- <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" />&nbsp;<?php echo $desc; ?></label><br /><?php
332
- }
333
- }
334
-
335
- /**
336
- * Outputs Textbox
337
- *
338
- * @global array $bp_media
339
- * @param array $args
340
- */
341
-
342
- /**
343
- *
344
- * @global array $bp_media
345
- * @param type $args
346
- * @return type
347
- */
348
- public function textbox( $args ) {
349
- global $bp_media;
350
- $options = $bp_media->options;
351
- $defaults = array(
352
- 'setting' => '',
353
- 'option' => '',
354
- 'desc' => '',
355
- 'password' => false,
356
- 'hidden' => false,
357
- );
358
- $args = wp_parse_args( $args, $defaults );
359
- extract( $args );
360
- if ( empty( $option ) ) {
361
- trigger_error( __( 'Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN ) );
362
- return;
363
- }
364
-
365
- if ( ! empty( $setting ) ) {
366
- $name = $setting . '[' . $option . ']';
367
- $options = bp_get_option( $setting );
368
- } else
369
- $name = $option;
370
-
371
- if ( (isset( $options[ $option ] ) && empty( $options[ $option ] )) || ! isset( $options[ $option ] ) ) {
372
- $options[ $option ] = '';
373
- }
374
- ?>
375
- <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' : ($hidden ? $hidden : 'text'); ?>" /><?php
376
- if ( ! empty( $desc ) ) {
377
- echo '<br /><span class="description">' . $desc . '</span>';
378
- }
379
- ?></label><br /><?php
380
- }
381
-
382
- /**
383
- * Outputs Dropdown
384
- *
385
- * @global array $bp_media
386
- * @param array $args
387
- */
388
-
389
- /**
390
- *
391
- * @param type $args
392
- * @return type
393
- */
394
- public function dropdown( $args ) {
395
- $defaults = array(
396
- 'setting' => '',
397
- 'option' => '',
398
- 'none' => true,
399
- 'values' => ''
400
- );
401
- $args = wp_parse_args( $args, $defaults );
402
- extract( $args );
403
- if ( empty( $option ) || empty( $values ) ) {
404
- if ( empty( $option ) )
405
- trigger_error( __( 'Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN ) );
406
- if ( empty( $values ) )
407
- trigger_error( __( 'Please provide some values to populate the dropdown. Format : array( \'value\' => \'option\' )', BP_MEDIA_TXT_DOMAIN ) );
408
- return;
409
- }
410
-
411
- if ( ! empty( $setting ) ) {
412
- $name = $setting . '[' . $option . ']';
413
- $options = bp_get_option( $setting );
414
- } else
415
- $name = $option;
416
-
417
- if ( (isset( $options[ $option ] ) && empty( $options[ $option ] )) || ! isset( $options[ $option ] ) ) {
418
- $options[ $option ] = '';
419
- }
420
- ?>
421
- <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ( $none ) { ?>
422
- <option><?php _e( 'None', BP_MEDIA_TXT_DOMAIN ); ?></option><?php
423
- }
424
- foreach ( $values as $value => $text ) {
425
- ?>
426
- <option<?php selected( $options[ $option ], $value ); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
427
- ?>
428
- </select><?php
429
- }
430
-
431
- /**
432
- * Outputs a Button
433
- *
434
- * @global array $bp_media
435
- * @param array $args
436
- */
437
-
438
- /**
439
- *
440
- * @param type $args
441
- * @return type
442
- */
443
- public function button( $args ) {
444
- $defaults = array(
445
- 'setting' => '',
446
- 'option' => '',
447
- 'name' => 'Save Changes',
448
- 'desc' => '',
449
- );
450
- $args = wp_parse_args( $args, $defaults );
451
- extract( $args );
452
- if ( empty( $option ) ) {
453
- trigger_error( 'Please provide "option" value ( Required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\', \'link\' => \'linkurl\' )' );
454
- return;
455
- }
456
- if ( ! empty( $setting ) ) {
457
- $button = $setting . '[' . $option . ']';
458
- } else
459
- $button = $option;
460
- submit_button( $name, '', $button, false );
461
- if ( ! empty( $desc ) ) {
462
- ?>
463
- <span class="description"><?php echo $desc; ?></a><?php
464
- }
465
- }
466
-
467
- public function privacy_notice() {
468
- if ( BPMediaPrivacy::is_installed() )
469
- return;
470
- $url = add_query_arg(
471
- array( 'page' => 'bp-media-privacy' ), (is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) )
472
- );
473
-
474
- $notice = '
 
 
 
 
 
 
 
 
 
 
475
  <div class="error">
476
- <p>' . __( 'BuddyPress Media 2.6 requires a database upgrade. ', BP_MEDIA_TXT_DOMAIN )
477
- . '<a href="' . $url . '">' . __( 'Update Database', BP_MEDIA_TXT_DOMAIN ) . '.</a></p>
478
  </div>
479
  ';
480
- echo $notice;
481
- }
482
 
483
- }
484
 
485
  }
486
- ?>
5
  * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
  */
8
+ if (!class_exists('BPMediaSettings')) {
9
+
10
+ class BPMediaSettings {
11
+
12
+ public function __construct() {
13
+ add_action('admin_init', array($this, 'settings'));
14
+ if (is_multisite()) {
15
+ add_action('network_admin_notices', array($this, 'privacy_notice'));
16
+ } else {
17
+ add_action('admin_notices', array($this, 'privacy_notice'));
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Register Settings
23
+ *
24
+ * @global string BP_MEDIA_TXT_DOMAIN
25
+ */
26
+
27
+ /**
28
+ *
29
+ * @global BPMediaAddon $bp_media_addon
30
+ */
31
+ public function settings() {
32
+ global $bp_media, $bp_media_addon;
33
+ add_settings_section('bpm-settings', __('Enabled Media Types', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
34
+ add_settings_field('bpm-image', __('Photos', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
35
+ 'setting' => 'bp_media_options',
36
+ 'option' => 'images_enabled',
37
+ 'desc' => __('Enable Photos', BP_MEDIA_TXT_DOMAIN)
38
+ ));
39
+ add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
40
+ 'setting' => 'bp_media_options',
41
+ 'option' => 'videos_enabled',
42
+ 'desc' => __('Enable Video', BP_MEDIA_TXT_DOMAIN)
43
+ ));
44
+ add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
45
+ 'setting' => 'bp_media_options',
46
+ 'option' => 'audio_enabled',
47
+ 'desc' => __('Enable Audio', BP_MEDIA_TXT_DOMAIN)
48
+ ));
49
+ if (bp_is_active('activity')) {
50
+ add_settings_section('bpm-activity-upload', __('Activity Upload', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
51
+ add_settings_field('bpm-activity', __('Activity Uploads', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-activity-upload', array(
52
+ 'setting' => 'bp_media_options',
53
+ 'option' => 'activity_upload',
54
+ 'desc' => __('Enable Activity Uploading', BP_MEDIA_TXT_DOMAIN)
55
+ )
56
+ );
57
+ }
58
+
59
+ if (bp_is_active('groups')) {
60
+ add_settings_section('bpm-media-type', __('Groups Integration', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
61
  // add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
62
  // 'setting' => 'bp_media_options',
63
  // 'option' => 'enable_on_profile',
64
  // 'desc' => __('Check to enable BuddyPress Media on User profiles', BP_MEDIA_TXT_DOMAIN)
65
  // )
66
  // );
67
+ add_settings_field('bpm-admin-group', __('Groups', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
68
+ 'setting' => 'bp_media_options',
69
+ 'option' => 'enable_on_group',
70
+ 'desc' => __('Allow Media in Groups', BP_MEDIA_TXT_DOMAIN)
71
+ )
72
+ );
73
+ }
74
+
75
+
76
+
77
+ add_settings_section('bpm-media-fine', __('Display Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
78
+ add_settings_field('bpm-media-count', __('Number of media', BP_MEDIA_TXT_DOMAIN), array($this, 'textbox'), 'bp-media-settings', 'bpm-media-fine', array(
79
+ 'setting' => 'bp_media_options',
80
+ 'option' => 'default_count',
81
+ 'number' => true
82
+ ));
83
+ add_settings_field('bpm-download', __('Download Button', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-fine', array(
84
+ 'setting' => 'bp_media_options',
85
+ 'option' => 'download_enabled',
86
+ 'desc' => __('Display download button under media', BP_MEDIA_TXT_DOMAIN)
87
+ ));
88
+
89
+ if (BPMediaPrivacy::is_installed()) {
90
+ add_settings_section('bpm-privacy', __('Privacy Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
91
+ add_settings_field('bpm-privacy-enabled', __('Enable Privacy', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-privacy', array(
92
+ 'setting' => 'bp_media_options',
93
+ 'option' => 'privacy_enabled',
94
+ 'desc' => __('Enable privacy', BP_MEDIA_TXT_DOMAIN)
95
+ ));
96
+
97
+ $settings = array(
98
+ 6 => __('<strong>Private</strong> - Visible only to the user', BP_MEDIA_TXT_DOMAIN),
99
+ 4 => __('<strong>Friends</strong> - Visible to user\'s friends', BP_MEDIA_TXT_DOMAIN),
100
+ 2 => __('<strong>Users</strong> - Visible to registered users', BP_MEDIA_TXT_DOMAIN),
101
+ 0 => __('<strong>Public</strong> - Visible to the world', BP_MEDIA_TXT_DOMAIN)
102
+ );
103
+ if (!bp_is_active('friends')) {
104
+ unset($settings[4]);
105
+ }
106
+ add_settings_field('bpm-privacy-private-enabled', __('Default Privacy', BP_MEDIA_TXT_DOMAIN), array($this, 'radio'), 'bp-media-settings', 'bpm-privacy', array(
107
+ 'setting' => 'bp_media_options',
108
+ 'option' => 'default_privacy_level',
109
+ 'radios' => $settings,
110
+ 'default' => 0,
111
+ ));
112
+ add_settings_field('bpm-privacy-override-enabled', __('User Override', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-privacy', array(
113
+ 'setting' => 'bp_media_options',
114
+ 'option' => 'privacy_override_enabled',
115
+ 'desc' => __('Allow users to override admin defaults (<em>Recommended</em>)', BP_MEDIA_TXT_DOMAIN)
116
+ ));
117
+ }
118
+ add_settings_section('bpm-miscellaneous', __('Other Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
119
+
120
+ add_settings_field('bpm-admin-bar-menu', __('Admin bar menu', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
121
+ 'setting' => 'bp_media_options',
122
+ 'option' => 'show_admin_menu',
123
+ 'desc' => __('Enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN)
124
+ )
125
+ );
126
+ add_settings_field('bpm-other-settings', __('Recount', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
127
+ 'option' => 'refresh-count',
128
+ 'name' => __('Recount', BP_MEDIA_TXT_DOMAIN),
129
+ 'desc' => '<br />'.__('Repair media counts', BP_MEDIA_TXT_DOMAIN)
130
+ ));
131
+
132
+ $bp_media_addon = new BPMediaAddon();
133
+ 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');
134
+ add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
135
+ add_settings_field('bpm-request', __('Request Type', BP_MEDIA_TXT_DOMAIN), array($this, 'dropdown'), 'bp-media-support', 'bpm-support', array('option' => 'select-request', 'none' => false, 'values' => array(
136
+ '' => '-- ' . __('Select One', BP_MEDIA_TXT_DOMAIN) . ' --',
137
+ 'premium_support' => __('Premium Support', BP_MEDIA_TXT_DOMAIN),
138
+ 'new_feature' => __('Suggest a New Feature', BP_MEDIA_TXT_DOMAIN),
139
+ 'bug_report' => __('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN))
140
+ ));
141
+ if (!BPMediaPrivacy::is_installed()) {
142
+ $bp_media_privacy = new BPMediaPrivacySettings();
143
+ add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
144
+ add_settings_section('bpm-privacy', __('Update Database', BP_MEDIA_TXT_DOMAIN), array($bp_media_privacy, 'init'), 'bp-media-privacy');
145
+ }
146
+
147
+ add_settings_section('bpm-convert-videos', '', array($this, 'convert_videos_form'), 'bp-media-convert-videos');
148
+
149
+ register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
150
+ }
151
+
152
+ public function convert_videos_form() {
153
+ global $current_user;
154
+ get_currentuserinfo();
155
+ ?>
156
+ <div id="video-transcoding-main-container">
157
+ <h2>Survey</h2>
158
+ <p class="para-blockquote">We are planning an encoding service where you can convert videos without having to install/configure anything on your server.</p>
159
+ <h3>Would you be interested?</h3>
160
+ <label><input class="interested" name="interested" type="radio" value="Yes" required="required" /> Yes</label>&nbsp;&nbsp;&nbsp;
161
+ <label><input class="not-interested" name="interested" type="radio" value="No" required="required" /> No</label>
162
+ <div class="interested-container hidden">
163
+ <p class="para-blockquote">Glad to see your interest.<br />
164
+ Please provide a little more information to help us plan this service better.</p>
165
+ <label><h3>Email</h3> <input class="email" type="email" name="email" size="35" value="<?php echo $current_user->user_email; ?>" placeholder="Email" /></label>
166
+
167
+ <h3>How would you use this feature?</h3>
168
+ <ul>
169
+ <li><label><input class="choice-free" type="radio" name="choice" value="Free" /> Free-only. I will use free-encoding quota only.</label></li>
170
+ <li><label><input type="radio" name="choice" value="$9" /> I am ready to pay $9 per month for generous encoding quota.</label></li>
171
+ <li><label><input type="radio" name="choice" value="$99" /> I am ready to pay $99 per month for unlimited video encoding!</label></li>
172
+ </div>
173
+ <input class="url" type="hidden" name="url" value="<?php echo home_url(); ?>" />
174
+ <br />
175
+ <br />
176
+ <input class="button button-primary video-transcoding-survey" type="submit" value="Submit" />
177
+ </div><?php
178
+ }
179
+
180
+ public function network_notices() {
181
+ $flag = 1;
182
+ if (get_site_option('bpm-media-enable', false)) {
183
+ echo '<div id="setting-error-bpm-media-enable" class="error"><p><strong>' . get_site_option('bpm-media-enable') . '</strong></p></div>';
184
+ delete_site_option('bpm-media-enable');
185
+ $flag = 0;
186
+ }
187
+ if (get_site_option('bpm-media-type', false)) {
188
+ echo '<div id="setting-error-bpm-media-type" class="error"><p><strong>' . get_site_option('bpm-media-type') . '</strong></p></div>';
189
+ delete_site_option('bpm-media-type');
190
+ $flag = 0;
191
+ }
192
+ if (get_site_option('bpm-media-default-count', false)) {
193
+ echo '<div id="setting-error-bpm-media-default-count" class="error"><p><strong>' . get_site_option('bpm-media-default-count') . '</strong></p></div>';
194
+ delete_site_option('bpm-media-default-count');
195
+ $flag = 0;
196
+ }
197
+
198
+ if (get_site_option('bpm-recount-success', false)) {
199
+ echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option('bpm-recount-success') . '</strong></p></div>';
200
+ delete_site_option('bpm-recount-success');
201
+ $flag = 0;
202
+ } elseif (get_site_option('bpm-recount-fail', false)) {
203
+ echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option('bpm-recount-fail') . '</strong></p></div>';
204
+ delete_site_option('bpm-recount-fail');
205
+ $flag = 0;
206
+ }
207
+
208
+ if (get_site_option('bpm-settings-saved') && $flag) {
209
+ echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option('bpm-settings-saved') . '</strong></p></div>';
210
+ }
211
+ delete_site_option('bpm-settings-saved');
212
+ }
213
+
214
+ /**
215
+ * Sanitizes the settings
216
+ */
217
+
218
+ /**
219
+ *
220
+ * @global type $bp_media_admin
221
+ * @param type $input
222
+ * @return type
223
+ */
224
+ public function sanitize($input) {
225
+ global $bp_media_admin;
226
+ if (isset($_POST['refresh-count'])) {
227
+ if ($bp_media_admin->update_count()) {
228
+ if (is_multisite())
229
+ update_site_option('bpm-recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN));
230
+ else
231
+ add_settings_error(__('Recount Success', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN), 'updated');
232
+ } else {
233
+ if (is_multisite())
234
+ update_site_option('bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
235
+ else
236
+ add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
237
+ }
238
+ }
239
  // if (!isset($_POST['bp_media_options']['enable_on_profile']) && !isset($_POST['bp_media_options']['enable_on_group'])) {
240
  // if (is_multisite())
241
  // 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));
243
  // 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));
244
  // $input['enable_on_profile'] = 1;
245
  // }
246
+ if (!isset($_POST['bp_media_options']['videos_enabled']) && !isset($_POST['bp_media_options']['audio_enabled']) && !isset($_POST['bp_media_options']['images_enabled'])) {
247
+ if (is_multisite())
248
+ update_site_option('bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
249
+ else
250
+ add_settings_error(__('Media Type', BP_MEDIA_TXT_DOMAIN), 'bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
251
+ $input['images_enabled'] = 1;
252
+ }
253
+
254
+ $input['default_count'] = intval($_POST['bp_media_options']['default_count']);
255
+ if (!is_int($input['default_count']) || ($input['default_count'] < 0 ) || empty($input['default_count']) ) {
256
+ if (is_multisite())
257
+ update_site_option('bpm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', BP_MEDIA_TXT_DOMAIN));
258
+ else
259
+ add_settings_error(__('Default Count', BP_MEDIA_TXT_DOMAIN), 'bpm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', BP_MEDIA_TXT_DOMAIN));
260
+ $input['default_count'] = 10;
261
+ }
262
+ if (is_multisite())
263
+ update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_TXT_DOMAIN));
264
+ do_action('bp_media_sanitize_settings', $_POST, $input);
265
+ return $input;
266
+ }
267
+
268
+ /**
269
+ * Output a checkbox
270
+ *
271
+ * @global array $bp_media
272
+ * @param array $args
273
+ */
274
+
275
+ /**
276
+ *
277
+ * @global array $bp_media
278
+ * @param type $args
279
+ * @return type
280
+ */
281
+ public function checkbox($args) {
282
+ global $bp_media;
283
+ $options = $bp_media->options;
284
+ $defaults = array(
285
+ 'setting' => '',
286
+ 'option' => '',
287
+ 'desc' => '',
288
+ );
289
+ $args = wp_parse_args($args, $defaults);
290
+ extract($args);
291
+ if (empty($option)) {
292
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' ) ', BP_MEDIA_TXT_DOMAIN));
293
+ return;
294
+ }
295
+
296
+ if (!empty($setting)) {
297
+ $name = $setting . '[' . $option . ']';
298
+ $options = bp_get_option($setting);
299
+ } else
300
+ $name = $option;
301
+
302
+ if (!isset($options[$option]))
303
+ $options[$option] = '';
304
+ ?>
305
+ <label for="<?php echo $option; ?>">
306
+ <input<?php checked($options[$option]); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
307
+ <?php echo $desc; ?>
308
+ </label><?php
309
+ }
310
+
311
+ /**
312
+ * Outputs Radio Buttons
313
+ *
314
+ * @global array $bp_media
315
+ * @param array $args
316
+ */
317
+
318
+ /**
319
+ *
320
+ * @global array $bp_media
321
+ * @param type $args
322
+ * @return type
323
+ */
324
+ public function radio($args) {
325
+ global $bp_media;
326
+ $options = $bp_media->options;
327
+ $defaults = array(
328
+ 'setting' => '',
329
+ 'option' => '',
330
+ 'radios' => array(),
331
+ 'default' => '',
332
+ );
333
+ $args = wp_parse_args($args, $defaults);
334
+ extract($args);
335
+ if (empty($option) || ( 2 > count($radios) )) {
336
+ if (empty($option))
337
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN));
338
+ if (2 > count($radios))
339
+ trigger_error(__('Need to specify atleast to radios else use a checkbox instead', BP_MEDIA_TXT_DOMAIN));
340
+ return;
341
+ }
342
+
343
+ if (!empty($setting)) {
344
+ $name = $setting . '[' . $option . ']';
345
+ $options = bp_get_option($setting);
346
+ } else
347
+ $name = $option;
348
+
349
+ if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
350
+ $options[$option] = $default;
351
+ }
352
+
353
+ foreach ($radios as $value => $desc) {
354
+ ?>
355
+ <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" />&nbsp;<?php echo $desc; ?></label><br /><?php
356
+ }
357
+ }
358
+
359
+ /**
360
+ * Outputs Textbox
361
+ *
362
+ * @global array $bp_media
363
+ * @param array $args
364
+ */
365
+
366
+ /**
367
+ *
368
+ * @global array $bp_media
369
+ * @param type $args
370
+ * @return type
371
+ */
372
+ public function textbox($args) {
373
+ global $bp_media;
374
+ $options = $bp_media->options;
375
+ $defaults = array(
376
+ 'setting' => '',
377
+ 'option' => '',
378
+ 'desc' => '',
379
+ 'password' => false,
380
+ 'hidden' => false,
381
+ 'number' => false,
382
+ );
383
+ $args = wp_parse_args($args, $defaults);
384
+ extract($args);
385
+ if (empty($option)) {
386
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN));
387
+ return;
388
+ }
389
+
390
+ if (!empty($setting)) {
391
+ $name = $setting . '[' . $option . ']';
392
+ $options = bp_get_option($setting);
393
+ } else
394
+ $name = $option;
395
+
396
+ if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
397
+ $options[$option] = '';
398
+ }
399
+ ?>
400
+ <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' : ($hidden ? 'hidden' : ($number ? 'number' : 'text')); ?>" /><?php
401
+ if (!empty($desc)) {
402
+ echo '<br /><span class="description">' . $desc . '</span>';
403
+ }
404
+ ?></label><br /><?php
405
+ }
406
+
407
+ /**
408
+ * Outputs Dropdown
409
+ *
410
+ * @global array $bp_media
411
+ * @param array $args
412
+ */
413
+
414
+ /**
415
+ *
416
+ * @param type $args
417
+ * @return type
418
+ */
419
+ public function dropdown($args) {
420
+ $defaults = array(
421
+ 'setting' => '',
422
+ 'option' => '',
423
+ 'none' => true,
424
+ 'values' => ''
425
+ );
426
+ $args = wp_parse_args($args, $defaults);
427
+ extract($args);
428
+ if (empty($option) || empty($values)) {
429
+ if (empty($option))
430
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN));
431
+ if (empty($values))
432
+ trigger_error(__('Please provide some values to populate the dropdown. Format : array( \'value\' => \'option\' )', BP_MEDIA_TXT_DOMAIN));
433
+ return;
434
+ }
435
+
436
+ if (!empty($setting)) {
437
+ $name = $setting . '[' . $option . ']';
438
+ $options = bp_get_option($setting);
439
+ } else
440
+ $name = $option;
441
+
442
+ if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
443
+ $options[$option] = '';
444
+ }
445
+ ?>
446
+ <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
447
+ <option><?php _e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
448
+ }
449
+ foreach ($values as $value => $text) {
450
+ ?>
451
+ <option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
452
+ ?>
453
+ </select><?php
454
+ }
455
+
456
+ /**
457
+ * Outputs a Button
458
+ *
459
+ * @global array $bp_media
460
+ * @param array $args
461
+ */
462
+
463
+ /**
464
+ *
465
+ * @param type $args
466
+ * @return type
467
+ */
468
+ public function button($args) {
469
+ $defaults = array(
470
+ 'setting' => '',
471
+ 'option' => '',
472
+ 'name' => 'Save Changes',
473
+ 'desc' => '',
474
+ );
475
+ $args = wp_parse_args($args, $defaults);
476
+ extract($args);
477
+ if (empty($option)) {
478
+ trigger_error('Please provide "option" value ( Required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\', \'link\' => \'linkurl\' )');
479
+ return;
480
+ }
481
+ if (!empty($setting)) {
482
+ $button = $setting . '[' . $option . ']';
483
+ } else
484
+ $button = $option;
485
+ submit_button($name, '', $button, false);
486
+ if (!empty($desc)) {
487
+ ?>
488
+ <span class="description"><?php echo $desc; ?></a><?php
489
+ }
490
+ }
491
+
492
+ public function privacy_notice() {
493
+ if (BPMediaPrivacy::is_installed())
494
+ return;
495
+ $url = add_query_arg(
496
+ array('page' => 'bp-media-privacy'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
497
+ );
498
+
499
+ $notice = '
500
  <div class="error">
501
+ <p>' . __('BuddyPress Media 2.6 requires a database upgrade. ', BP_MEDIA_TXT_DOMAIN)
502
+ . '<a href="' . $url . '">' . __('Update Database', BP_MEDIA_TXT_DOMAIN) . '.</a></p>
503
  </div>
504
  ';
505
+ echo $notice;
506
+ }
507
 
508
+ }
509
 
510
  }
511
+ ?>
app/helper/BPMediaSupport.php CHANGED
@@ -9,60 +9,57 @@ if (!class_exists('BPMediaSupport')) {
9
 
10
  class BPMediaSupport {
11
 
 
 
12
  public function __construct() {
13
- add_action('bp_media_admin_page_append', array($this, 'debug_info'));
 
14
  }
15
 
16
- public function debug_info($page) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if ('bp-media-support' == $page) {
18
- global $wpdb, $wp_version, $bp;
19
  ?>
20
  <div id="debug-info">
21
- <h3><?php _e('Debug Info', BP_MEDIA_TXT_DOMAIN); ?></h3>
22
  <table class="form-table">
23
- <tbody>
24
- <tr valign="top">
25
- <th scope="row">PHP</th>
26
- <td><?php echo PHP_VERSION; ?></td>
27
- </tr>
28
- <tr valign="top">
29
- <th scope="row">MYSQL</th>
30
- <td><?php echo $wpdb->db_version(); ?></td>
31
- </tr>
32
- <tr valign="top">
33
- <th scope="row">WordPress</th>
34
- <td><?php echo $wp_version; ?></td>
35
- </tr>
36
- <tr valign="top">
37
- <th scope="row">BuddyPress</th>
38
- <td><?php echo $bp->version; ?></td>
39
- </tr>
40
- <tr valign="top">
41
- <th scope="row">BuddyPress Media</th>
42
- <td><?php echo BP_MEDIA_VERSION; ?></td>
43
- </tr>
44
- <tr valign="top">
45
- <th scope="row">OS</th>
46
- <td><?php echo PHP_OS; ?></td>
47
- </tr>
48
- <tr valign="top">
49
- <th scope="row">Imagick</th><?php
50
- if (extension_loaded('imagick')) {
51
- $imagick = Imagick::getVersion();
52
- } else {
53
- $imagick['versionString'] = 'Not Installed';
54
- } ?>
55
- <td><?php echo $imagick['versionString']; ?></td>
56
- </tr>
57
- <tr valign="top">
58
- <th scope="row">GD</th><?php
59
- if (extension_loaded('gd')) {
60
- $gd = gd_info();
61
- } else {
62
- $gd['GD Version'] = 'Not Installed';
63
- } ?>
64
- <td><?php echo $gd['GD Version']; ?></td>
65
- </tr>
66
  </tbody>
67
  </table>
68
  </div><?php
@@ -179,58 +176,68 @@ if (!class_exists('BPMediaSupport')) {
179
  <body>
180
  <table>
181
  <tr>
182
- <td>' . __("Name", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['name']) . '</td>
183
  </tr>
184
  <tr>
185
- <td>' . __("Email", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['email']) . '</td>
186
  </tr>
187
  <tr>
188
- <td>' . __("Website", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['website']) . '</td>
189
  </tr>
190
  <tr>
191
- <td>' . __("Phone", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['phone']) . '</td>
192
  </tr>
193
  <tr>
194
- <td>' . __("Subject", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['subject']) . '</td>
195
  </tr>
196
  <tr>
197
- <td>' . __("Details", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['details']) . '</td>
198
  </tr>
199
  <tr>
200
- <td>' . __("Request ID", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['request_id']) . '</td>
201
  </tr>
202
  <tr>
203
- <td>' . __("Server Address", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['server_address']) . '</td>
204
  </tr>
205
  <tr>
206
- <td>' . __("IP Address", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ip_address']) . '</td>
207
  </tr>
208
  <tr>
209
- <td>' . __("Server Type", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['server_type']) . '</td>
210
  </tr>
211
  <tr>
212
- <td>' . __("User Agent", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['user_agent']) . '</td>
213
  </tr>';
214
  if ($form_data['request_type'] == 'bug_report') {
215
  $message .= '<tr>
216
- <td>' . __("WordPress Admin Username", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['wp_admin_username']) . '</td>
217
  </tr>
218
  <tr>
219
- <td>' . __("WordPress Admin Password", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['wp_admin_pwd']) . '</td>
220
  </tr>
221
  <tr>
222
- <td>' . __("SSH FTP Host", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_host']) . '</td>
223
  </tr>
224
  <tr>
225
- <td>' . __("SSH FTP Username", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_username']) . '</td>
226
  </tr>
227
  <tr>
228
- <td>' . __("SSH FTP Password", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_pwd']) . '</td>
229
  </tr>
230
  ';
231
  }
232
- $message .= '</table>
233
- </body>
 
 
 
 
 
 
 
 
 
 
234
  </html>';
235
  add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
236
  $headers = 'From: ' . $form_data['name'] . ' <' . $form_data['email'] . '>' . "\r\n";
9
 
10
  class BPMediaSupport {
11
 
12
+ var $debug_info;
13
+
14
  public function __construct() {
15
+ $this->debug_info();
16
+ add_action('bp_media_admin_page_append', array($this, 'debug_info_html'));
17
  }
18
 
19
+ public function debug_info() {
20
+ global $wpdb, $wp_version, $bp;
21
+ $debug_info = array();
22
+ $debug_info['PHP'] = PHP_VERSION;
23
+ $debug_info['MYSQL'] = $wpdb->db_version();
24
+ $debug_info['WordPress'] = $wp_version;
25
+ $debug_info['BuddyPress'] = $bp->version;
26
+ $debug_info['BuddyPress Media'] = BP_MEDIA_VERSION;
27
+ $debug_info['OS'] = PHP_OS;
28
+ if (extension_loaded('imagick')) {
29
+ $imagick = $message = preg_replace(" #((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#ie", "'<a href=\"$1\" target=\"_blank\">$3</a>$4'", Imagick::getVersion() );
30
+ } else {
31
+ $imagick['versionString'] = 'Not Installed';
32
+ }
33
+ $debug_info['Imagick'] = $imagick['versionString'];
34
+ if (extension_loaded('gd')) {
35
+ $gd = gd_info();
36
+ } else {
37
+ $gd['GD Version'] = 'Not Installed';
38
+ }
39
+ $debug_info['GD'] = $gd['GD Version'];
40
+ $debug_info['[php.ini] post_max_size'] = ini_get('post_max_size');
41
+ $debug_info['[php.ini] upload_max_filesize'] = ini_get('upload_max_filesize');
42
+ $debug_info['[php.ini] memory_limit'] = ini_get('memory_limit');
43
+ $this->debug_info = $debug_info;
44
+ }
45
+
46
+ public function debug_info_html($page) {
47
  if ('bp-media-support' == $page) {
 
48
  ?>
49
  <div id="debug-info">
50
+ <h3><?php _e('Debug info', BP_MEDIA_TXT_DOMAIN); ?></h3>
51
  <table class="form-table">
52
+ <tbody><?php
53
+ if ($this->debug_info) {
54
+ foreach ($this->debug_info as $configuration => $value) {
55
+ ?>
56
+ <tr valign="top">
57
+ <th scope="row"><?php echo $configuration; ?></th>
58
+ <td><?php echo $value; ?></td>
59
+ </tr><?php
60
+ }
61
+ }
62
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  </tbody>
64
  </table>
65
  </div><?php
176
  <body>
177
  <table>
178
  <tr>
179
+ <td>Name</td><td>' . strip_tags($form_data['name']) . '</td>
180
  </tr>
181
  <tr>
182
+ <td>Email</td><td>' . strip_tags($form_data['email']) . '</td>
183
  </tr>
184
  <tr>
185
+ <td>Website</td><td>' . strip_tags($form_data['website']) . '</td>
186
  </tr>
187
  <tr>
188
+ <td>Phone</td><td>' . strip_tags($form_data['phone']) . '</td>
189
  </tr>
190
  <tr>
191
+ <td>Subject</td><td>' . strip_tags($form_data['subject']) . '</td>
192
  </tr>
193
  <tr>
194
+ <td>Details</td><td>' . strip_tags($form_data['details']) . '</td>
195
  </tr>
196
  <tr>
197
+ <td>Request ID</td><td>' . strip_tags($form_data['request_id']) . '</td>
198
  </tr>
199
  <tr>
200
+ <td>Server Address</td><td>' . strip_tags($form_data['server_address']) . '</td>
201
  </tr>
202
  <tr>
203
+ <td>IP Address</td><td>' . strip_tags($form_data['ip_address']) . '</td>
204
  </tr>
205
  <tr>
206
+ <td>Server Type</td><td>' . strip_tags($form_data['server_type']) . '</td>
207
  </tr>
208
  <tr>
209
+ <td>User Agent</td><td>' . strip_tags($form_data['user_agent']) . '</td>
210
  </tr>';
211
  if ($form_data['request_type'] == 'bug_report') {
212
  $message .= '<tr>
213
+ <td>WordPress Admin Username</td><td>' . strip_tags($form_data['wp_admin_username']) . '</td>
214
  </tr>
215
  <tr>
216
+ <td>WordPress Admin Password</td><td>' . strip_tags($form_data['wp_admin_pwd']) . '</td>
217
  </tr>
218
  <tr>
219
+ <td>SSH FTP Host</td><td>' . strip_tags($form_data['ssh_ftp_host']) . '</td>
220
  </tr>
221
  <tr>
222
+ <td>SSH FTP Username</td><td>' . strip_tags($form_data['ssh_ftp_username']) . '</td>
223
  </tr>
224
  <tr>
225
+ <td>SSH FTP Password</td><td>' . strip_tags($form_data['ssh_ftp_pwd']) . '</td>
226
  </tr>
227
  ';
228
  }
229
+ $message .= '</table>';
230
+ if ( $this->debug_info ) {
231
+ $message .= '<h3>'.__('Debug Info', BP_MEDIA_TXT_DOMAIN).'</h3>';
232
+ $message .= '<table>';
233
+ foreach ($this->debug_info as $configuration => $value) {
234
+ $message .= '<tr>
235
+ <td>' . $configuration . '</td><td>' . $value . '</td>
236
+ </tr>';
237
+ }
238
+ $message .= '</table>';
239
+ }
240
+ $message .= '</body>
241
  </html>';
242
  add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
243
  $headers = 'From: ' . $form_data['name'] . ' <' . $form_data['email'] . '>' . "\r\n";
app/main/BPMediaGroupLoader.php CHANGED
@@ -67,7 +67,8 @@ class BPMediaGroupLoader {
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) {
67
  return;
68
 
69
  /** This line might break a thing or two in custom themes and widgets */
70
+ if ( isset($bp->action_variables[0]) )
71
+ remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
72
  // add_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::group_activity_query_filter', 10);
73
 
74
  foreach ($bp->bp_options_nav[$current_group] as $key => $nav_item) {
app/main/BPMediaLoader.php CHANGED
@@ -62,7 +62,7 @@ class BPMediaLoader {
62
  public function load_component() {
63
  global $bp;
64
  $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
65
-
66
 
67
  }
68
 
62
  public function load_component() {
63
  global $bp;
64
  $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
65
+
66
 
67
  }
68
 
app/main/BuddyPressMedia.php CHANGED
@@ -146,19 +146,19 @@ class BuddyPressMedia {
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
  }
@@ -348,7 +348,7 @@ class BuddyPressMedia {
348
  */
349
  // new BPMediaActivity();
350
  $class_construct = array(
351
- // 'activity' => false,
352
  'filters' => false,
353
  'actions' => false,
354
  'function' => false,
@@ -421,6 +421,17 @@ class BuddyPressMedia {
421
  */
422
  function media_sizes() {
423
  $def_sizes = array(
 
 
 
 
 
 
 
 
 
 
 
424
  'activity_image' => array(
425
  'width' => 320,
426
  'height' => 240
@@ -602,7 +613,7 @@ class BuddyPressMedia {
602
  if (array_key_exists('default_count', $this->options)) {
603
  $count = $this->options['default_count'];
604
  }
605
- $count =( !is_int( $count ))?0:$count;
606
  return (!$count) ? 10 : $count;
607
  }
608
 
@@ -664,13 +675,22 @@ class BuddyPressMedia {
664
  }
665
  }
666
 
667
- static function plugin_get_version($path=NULL) {
668
- require_once(ABSPATH.'wp-admin/includes/plugin.php');
669
- $path = ($path) ? $path : BP_MEDIA_PATH.'index.php';
670
  $plugin_data = get_plugin_data($path);
671
  $plugin_version = $plugin_data['Version'];
672
  return $plugin_version;
673
  }
 
 
 
 
 
 
 
 
 
674
 
675
  }
676
 
146
  */
147
  public function bp_exists() {
148
  if (!class_exists('BuddyPress')) {
149
+ $plugins = get_plugins();
150
+ if (array_key_exists('buddypress/bp-loader.php', $plugins)) {
151
+ $install_link = wp_nonce_url(admin_url('plugins.php?action=activate&amp;plugin=buddypress%2Fbp-loader.php'), 'activate-plugin_buddypress/bp-loader.php');
152
+ } else {
153
+ include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
154
+ $info = plugins_api('plugin_information', array('slug' => 'buddypress'));
155
+ $install_link = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=buddypress'), 'install-plugin_buddypress');
156
+ }
157
  echo '<div class="error">
158
+ <p><strong>' . __('BuddyPress is not installed.', $this->text_domain) . '</strong></p>
 
 
 
159
  <p>'
160
+ . __('To use BuddyPress Media, BuddyPress must be installed first.', $this->text_domain) .
161
+ ' ' . sprintf(__('<a href="%s">Install BuddyPress now</a>', $this->text_domain), $install_link)
 
 
 
 
 
162
  . '</p>
163
  </div>';
164
  }
348
  */
349
  // new BPMediaActivity();
350
  $class_construct = array(
351
+ 'activity' => false,
352
  'filters' => false,
353
  'actions' => false,
354
  'function' => false,
421
  */
422
  function media_sizes() {
423
  $def_sizes = array(
424
+ 'tiny_image' => array(
425
+ 'width' => 80,
426
+ 'height' => 60
427
+ ),
428
+ 'tiny_video' => array(
429
+ 'width' => 80,
430
+ 'height' => 60
431
+ ),
432
+ 'tiny_audio' => array(
433
+ 'width' => 80,
434
+ ),
435
  'activity_image' => array(
436
  'width' => 320,
437
  'height' => 240
613
  if (array_key_exists('default_count', $this->options)) {
614
  $count = $this->options['default_count'];
615
  }
616
+ $count = (!is_int($count)) ? 0 : $count;
617
  return (!$count) ? 10 : $count;
618
  }
619
 
675
  }
676
  }
677
 
678
+ static function plugin_get_version($path = NULL) {
679
+ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
680
+ $path = ($path) ? $path : BP_MEDIA_PATH . 'index.php';
681
  $plugin_data = get_plugin_data($path);
682
  $plugin_version = $plugin_data['Version'];
683
  return $plugin_version;
684
  }
685
+
686
+ static function get_current_user_default_album(){
687
+ if ( is_user_logged_in() ) {
688
+ $current_user_id = get_current_user_id();
689
+ $album_id = get_user_meta($current_user_id, 'bp-media-default-album', true);
690
+ return $album_id;
691
+ }
692
+ return false;
693
+ }
694
 
695
  }
696
 
app/main/activity/BPMediaActivity.php CHANGED
@@ -14,145 +14,153 @@ if (!class_exists('BPMediaActivity')) {
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
  }
14
  var $media_count = 1;
15
 
16
  public function __construct() {
17
+ global $bp_media;
18
+ $options = $bp_media->options;
19
+ if (isset($options['activity_upload']) && $options['activity_upload'] != 0) {
20
+ add_action('bp_activity_post_form_options', array($this, 'activity_uploader'));
21
+ add_action('bp_groups_posted_update', array($this, 'override_media_album_id'), '', 4);
22
+ add_filter('bp_activity_new_update_content', array($this, 'override_update'));
23
+ add_filter('bp_activity_latest_update_content', array($this, 'override_update'));
24
+ add_filter('bp_get_member_latest_update', array($this, 'latest_update'));
25
+ add_filter('bp_get_activity_latest_update', array($this, 'latest_update'));
26
+ add_action('wp_ajax_bp_media_get_latest_activity', array($this, 'latest_update'));
27
+ add_filter('groups_activity_new_update_content', array($this, 'override_update'));
28
+
29
+ add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags', 1);
30
+ add_action('init', array($this, 'scripts'));
31
+ //remove_filter( 'bp_get_activity_content_body', 'wptexturize' );
32
+ remove_filter('bp_get_activity_content', 'wptexturize');
33
+ }
34
+ }
35
+
36
+ public function scripts() {
37
+ wp_enqueue_script('json2');
38
+ wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
39
  }
40
 
41
  public function activity_uploader() {
42
  ?>
43
+ <input type ="hidden" id="bp-media-update-text" />
44
+ <input type ="hidden" id="bp-media-update-json" />
45
+ <input type ="hidden" id="bp-media-latest-update" />
46
  <div id="bp-media-activity-upload-ui" class="hide-if-no-js drag-drop">
47
+ <input id="bp-media-activity-upload-browse-button" type="button" value="<?php _e('Attach Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" />
48
  <div id="bp-media-activity-uploaded-files"></div>
49
  </div>
50
+ <?php
51
  }
52
 
53
+ public function decode($content) {
54
+ $content = stripslashes($content);
55
+ $activity_json = json_decode($content, true);
56
+ return $activity_json;
57
+ }
 
 
 
 
 
58
 
59
+ public function get_media($content) {
60
+ $activity_json = $this->decode($content);
61
+ $activity_media = json_decode($activity_json['media'], true);
62
+ return $activity_media;
63
+ }
64
 
65
+ public function get_text($content) {
66
+ $activity_json = $this->decode($content);
67
+ $activity_text = $activity_json['update_txt'];
68
+ return $activity_text;
69
+ }
70
 
71
+ public function latest_update($content) {
72
+ global $bp;
73
+ if( isset($_GET['content'] ) ) {
74
+ $update_id = $_GET['id'];
75
+ $content = $_GET['content'];
76
+ }else{
77
+ if ( bp_displayed_user_id() )
78
+ $user_id = bp_displayed_user_id();
79
+ else
80
+ $user_id = bp_get_member_user_id();
81
+ if (!$update = bp_get_user_meta($user_id, 'bp_latest_update', true))
82
+ return $content;
83
+ $update_id = $update['id'];
84
+ $content = $update['content'];
85
+ }
86
+ //$activity_id = $update[''];
87
+ $activity_media = $this->get_media($content);
88
+ $newcontent = $this->get_text($content);
89
+ if (isset($activity_media)) {
90
+ if (!is_array($activity_media)) {
91
+ $activity_media[] = $activity_media;
92
  }
93
+ $media_id = $activity_media[count($activity_media) - 1];
94
+ try{
95
+ $media = new BPMediaHostWordpress($media_id);
96
+ $newcontent .= '<a href="' . $media->get_url() . '">
97
+ <img src="' . $media->get_media_thumbnail() . '"/>
98
+ </a>';
99
+ }catch (Exception $e) {
100
+ echo $e->getMessage();
101
+ }
102
 
103
+ }
104
+
105
+ $newcontent .= ' <a href="' . bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $update_id . '/"> ' . __('View', 'buddypress') . '</a>';
106
+ if (isset($_GET['content'])) {
107
+ echo $newcontent;
108
+ die;
109
+ } else {
110
+ return $newcontent;
111
+ }
112
+ }
113
 
114
+ public function override_update($content) {
115
+ $this->content = $content;
116
+ $activity_media = $this->get_media($content);
117
+ $newcontent = '<p>' . $this->get_text($content) . '</p>';
118
+ if (isset($activity_media)) {
119
+ if (!is_array($activity_media)) {
120
+ $activity_media[] = $activity_media;
121
  }
122
 
123
+ if (count($activity_media) > 1) {
124
+ $newcontent .= '<ul class="bp-media-list-media">';
 
 
125
  }
126
 
127
+ foreach ($activity_media as $media_id) {
128
+ $media = new BPMediaHostWordpress($media_id);
129
+ if (count($activity_media) > 1) {
130
+ $newcontent .= $media->get_album_activity_content();
131
+ } else {
132
+ add_filter('bp_media_single_activity_title', create_function('', 'return;'));
133
+ $newcontent .= $media->get_media_activity_content();
134
  }
135
  }
136
+ if (count($activity_media) > 1) {
137
+ $newcontent .= '</ul>';
138
+ }
139
  }
140
+ return $newcontent;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
 
143
+ public function override_media_album_id($content, $user_id, $group_id, $activity_id) {
144
+ global $bp;
145
+ $activity_media = $this->get_media($content);
146
+ if (isset($activity_media)) {
147
+ if (!is_array($activity_media)) {
148
+ $activity_media[] = $activity_media;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
 
151
+ foreach ($activity_media as $media_id) {
152
+ update_post_meta($media_id, 'bp-media-key', -$group_id);
153
+ $attachment = get_post($media_id);
154
+ $attachment->post_parent = groups_get_groupmeta($group_id, 'bp_media_default_album');
155
+ wp_update_post($attachment);
156
+ $activity_id = groups_record_activity(array(
157
+ 'id' => $activity_id,
158
+ 'user_id' => $user_id,
159
+ 'action' => sprintf(__('%1$s posted an update in the group %2$s', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>'),
160
+ 'content' => $this->override_update($this->content),
161
+ 'type' => 'activity_update',
162
+ 'item_id' => $group_id
163
+ ));
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
  }
166
  }
app/main/group/BPMediaGroupAction.php CHANGED
@@ -84,7 +84,7 @@ static function bp_media_groups_set_query() {
84
  * @global WP_Query $bp_media_albums_query
85
  */
86
  static function bp_media_groups_albums_set_query() {
87
- global $bp, $bp_media_albums_query;
88
  if (isset($bp->action_variables) && isset($bp->action_variables[1]) && $bp->action_variables[1] == 'page' && isset($bp->action_variables[2]) && is_numeric($bp->action_variables[2])) {
89
  $paged = $bp->action_variables[2];
90
  } else {
@@ -97,7 +97,8 @@ static function bp_media_groups_set_query() {
97
  'paged' => $paged,
98
  'meta_key' => 'bp-media-key',
99
  'meta_value' => -bp_get_current_group_id(),
100
- 'meta_compare' => '='
 
101
  );
102
  $bp_media_albums_query = new WP_Query($args);
103
  }
@@ -110,6 +111,7 @@ static function bp_media_groups_set_query() {
110
  * @return boolean
111
  */
112
  static function bp_media_groups_activity_create_after_add_media($media, $hidden = false) {
 
113
  if (function_exists('bp_activity_add')) {
114
  if (!is_object($media)) {
115
  try {
@@ -122,8 +124,9 @@ static function bp_media_groups_set_query() {
122
  'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($media->get_author()), '<a href="' . $media->get_url() . '">' . $media->get_media_activity_type() . '</a>')),
123
  'content' => $media->get_media_activity_content(),
124
  'primary_link' => $media->get_url(),
125
- 'item_id' => $media->get_id(),
126
- 'type' => 'media_upload',
 
127
  'user_id' => $media->get_author()
128
  );
129
  $hidden = apply_filters('bp_media_force_hide_activity', $hidden);
84
  * @global WP_Query $bp_media_albums_query
85
  */
86
  static function bp_media_groups_albums_set_query() {
87
+ global $bp, $bp_media, $bp_media_albums_query;
88
  if (isset($bp->action_variables) && isset($bp->action_variables[1]) && $bp->action_variables[1] == 'page' && isset($bp->action_variables[2]) && is_numeric($bp->action_variables[2])) {
89
  $paged = $bp->action_variables[2];
90
  } else {
97
  'paged' => $paged,
98
  'meta_key' => 'bp-media-key',
99
  'meta_value' => -bp_get_current_group_id(),
100
+ 'meta_compare' => '=',
101
+ 'posts_per_page' => $bp_media->default_count()
102
  );
103
  $bp_media_albums_query = new WP_Query($args);
104
  }
111
  * @return boolean
112
  */
113
  static function bp_media_groups_activity_create_after_add_media($media, $hidden = false) {
114
+ global $bp;
115
  if (function_exists('bp_activity_add')) {
116
  if (!is_object($media)) {
117
  try {
124
  'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($media->get_author()), '<a href="' . $media->get_url() . '">' . $media->get_media_activity_type() . '</a>')),
125
  'content' => $media->get_media_activity_content(),
126
  'primary_link' => $media->get_url(),
127
+ 'component' => $bp->groups->id,
128
+ 'item_id' => $media->group_id,
129
+ 'type' => 'activity_update',
130
  'user_id' => $media->get_author()
131
  );
132
  $hidden = apply_filters('bp_media_force_hide_activity', $hidden);
app/main/includes/BPMediaActions.php CHANGED
@@ -7,411 +7,419 @@
7
  */
8
  class BPMediaActions {
9
 
10
- /**
11
- *
12
- * @global type $bp_media_options
13
- */
14
- function __construct() {
15
- add_action( 'bp_media_before_content', 'BPMediaActions::show_messages' );
16
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ), 11 );
17
- add_action( 'bp_before_activity_delete', 'BPMediaActions::delete_activity_handler' );
18
- add_action( 'wp_enqueue_scripts', array( $this, 'upload_enqueue' ) );
19
- add_action( 'init', 'BPMediaActions::init_count' );
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_after_add_album', array( $this, 'update_count' ) ,999 );
24
- add_action( 'bp_media_album_updated', 'BPMediaActions::album_activity_update' );
25
- add_action( 'bp_media_album_updated', array( $this, 'update_count' ) ,999 );
26
- add_action( 'bp_media_after_edit_album', array( $this, 'update_count' ) ,999 );
27
- add_action( 'bp_media_after_delete_album', array( $this, 'update_count' ) ,999 );
28
- add_action( 'bp_media_after_delete_media', array( $this, 'album_activity_sync' ) );
29
- add_action( 'bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 4 );
30
- add_action( 'wp_ajax_bp_media_load_more', array( $this, 'load_more' ) );
31
- add_action( 'wp_ajax_nopriv_bp_media_load_more', array( $this, 'load_more' ) );
32
- add_action( 'wp_ajax_bp_media_set_album_cover', array( $this, 'set_album_cover' ) );
33
- add_action( 'delete_attachment', array( $this, 'delete_attachment_handler' ) );
34
- add_action( 'wp_ajax_bp_media_add_album', array( $this, 'add_album' ) );
35
- add_action( 'bp_media_after_privacy_install', array( $this, 'update_count' ) ,999 );
36
- add_action( 'bp_media_after_add_media', array( $this, 'update_count' ) ,999 );
37
- add_action( 'bp_media_after_update_media', array( $this, 'update_count' ) ,999 );
38
- add_action( 'bp_media_after_delete_media', array( $this, 'update_count' ) ,999);
39
- $linkback = bp_get_option( 'bp_media_add_linkback', false );
40
- if ( $linkback )
41
- add_action( 'bp_footer', array( $this, 'footer' ) );
42
- }
43
-
44
- /**
45
- * Handles the uploads and creates respective posts for the upload
46
- *
47
- * @since BuddyPress Media 2.0
48
- */
49
-
50
- /**
51
- *
52
- * @global type $bp
53
- * @global type $bp_media_options
54
- * @return type
55
- */
56
- static function handle_uploads() {
57
- global $bp, $bp_media;
58
- $bp_media_options = $bp_media->options;
59
- if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'wp_handle_upload' ) {
60
- /** This section can help in the group activity handling */
61
- // if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id'])) {
62
- // remove_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 3);
63
- // add_action('bp_media_after_add_media', 'BPMediaGroupAction::bp_media_groups_activity_create_after_add_media', 10, 2);
64
- //// add_filter('bp_media_force_hide_activity', 'BPMediaGroupAction::bp_media_groups_force_hide_activity');
65
- // }
66
- /* @var $bp_media_entry BPMediaHostWordpress */
67
- if ( isset( $_FILES ) && is_array( $_FILES ) && array_key_exists( 'bp_media_file', $_FILES ) && $_FILES[ 'bp_media_file' ][ 'name' ] != '' ) {
68
- if ( ! preg_match( '/audio|video|image/i', $_FILES[ 'bp_media_file' ][ 'type' ], $result ) || ! isset( $result[ 0 ] ) ) {
69
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'File uploaded is not supported' );
70
- return;
71
- }
72
- $type = $result[ 0 ];
73
- switch ( $result[ 0 ] ) {
74
- case 'image' :
75
- if ( $bp_media_options[ 'images_enabled' ] == false ) {
76
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'Image uploads are disabled' );
77
- return;
78
- }
79
- break;
80
- case 'video' :
81
- if ( $bp_media_options[ 'videos_enabled' ] == false ) {
82
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'Video uploads are disabled' );
83
- return;
84
- }
85
- break;
86
- case 'audio' :
87
- if ( $bp_media_options[ 'audio_enabled' ] == false ) {
88
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'Audio uploads are disabled' );
89
- return;
90
- }
91
- break;
92
- default :
93
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'File uploaded is not supported' );
94
- return;
95
- }
96
- $class_name = apply_filters( 'bp_media_transcoder', 'BPMediaHostWordpress', $type );
97
- $bp_media_entry = new $class_name();
98
- try {
99
- $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 );
100
- $album_id = isset( $_POST[ 'bp_media_album_id' ] ) ? intval( $_POST[ 'bp_media_album_id' ] ) : 0;
101
- $is_multiple = isset( $_POST[ 'is_multiple_upload' ] ) ? ($_POST[ 'is_multiple_upload' ] == 'true' ? true : false) : false;
102
- $is_activity = isset( $_POST[ 'is_activity' ] ) ? ($_POST[ 'is_activity' ] == 'true' ? true : false) : false;
103
- $description = isset( $_POST[ 'bp_media_description' ] ) ? $_POST[ 'bp_media_description' ] : '';
104
- $group_id = isset( $_POST[ 'bp_media_group_id' ] ) ? intval( $_POST[ 'bp_media_group_id' ] ) : 0;
105
- $entry = $bp_media_entry->add_media( $title, $description, $album_id, $group_id, $is_multiple, $is_activity );
106
- if ( ! isset( $bp->{BP_MEDIA_SLUG}->messages[ 'updated' ][ 0 ] ) )
107
- $bp->{BP_MEDIA_SLUG}->messages[ 'updated' ][ 0 ] = __( 'Upload Successful', BP_MEDIA_TXT_DOMAIN );
108
- } catch ( Exception $e ) {
109
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = $e->getMessage();
110
- }
111
- } else {
112
- $bp->{BP_MEDIA_SLUG}->messages[ 'error' ][ ] = __( 'You did not specified a file to upload', BP_MEDIA_TXT_DOMAIN );
113
- }
114
- }
115
- }
116
 
117
  //add_action('bp_init', 'handle_uploads');
118
 
119
- /**
120
- * Displays the messages that other functions/methods creates according to the BuddyPress' formating
121
- *
122
- * @since BuddyPress Media 2.0
123
- */
124
-
125
- /**
126
- *
127
- * @global type $bp
128
- */
129
- static function show_messages() {
130
- global $bp;
131
- if ( is_array( $bp->{BP_MEDIA_SLUG}->messages ) ) {
132
- $types = array( 'error', 'updated', 'info' );
133
- foreach ( $types as $type ) {
134
- if ( count( $bp->{BP_MEDIA_SLUG}->messages[ $type ] ) > 0 ) {
135
- BPMediaFunction::show_formatted_error_message( $bp->{BP_MEDIA_SLUG}->messages[ $type ], $type );
136
- }
137
- }
138
- }
139
- }
140
-
141
- /**
142
- * Enqueues all the required scripts and stylesheets for the proper working of BuddyPress Media.
143
- *
144
- * @since BuddyPress Media 2.0
145
- */
146
-
147
- /**
148
- *
149
- * @global type $bp
150
- */
151
- function enqueue_scripts_styles() {
152
-
153
- wp_enqueue_script( 'jquery-ui-tabs' );
154
- wp_enqueue_script( 'bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js', '', BP_MEDIA_VERSION );
155
- wp_enqueue_script( 'bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js', '', BP_MEDIA_VERSION );
156
-
157
- global $bp;
158
- $cur_group_id = NULL;
159
- if ( bp_is_active( "groups" ) )
160
- $cur_group_id = bp_get_current_group_id();
161
- $bp_media_vars = array(
162
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
163
- 'page' => 1,
164
- 'current_action' => $cur_group_id ? (empty( $bp->action_variables ) ? BP_MEDIA_IMAGES_SLUG : $bp->action_variables[ 0 ]) : (isset( $bp->current_action ) ? $bp->current_action : false),
165
- 'action_variables' => isset( $bp->action_variables ) ? (empty( $bp->action_variables ) ? array( BP_MEDIA_IMAGES_SLUG ) : $bp->action_variables) : array( BP_MEDIA_IMAGES_SLUG ),
166
- 'displayed_user' => bp_displayed_user_id(),
167
- 'loggedin_user' => bp_loggedin_user_id(),
168
- 'current_group' => $cur_group_id,
169
- );
170
-
171
- wp_localize_script( 'bp-media-default', 'bp_media_vars', $bp_media_vars );
172
- wp_enqueue_style( 'bp-media-mecss', BP_MEDIA_URL . 'lib/media-element/mediaelementplayer.min.css', '', BP_MEDIA_VERSION );
173
- wp_enqueue_style( 'bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION );
174
- }
175
-
176
- /**
177
- *
178
- * @global integer $bp_media_count
179
- * @global object $wpdb
180
- * @param array $args
181
- * @return boolean
182
- */
183
- static function delete_activity_handler( $args ) {
184
- error_log( 'Delete delete :)' );
185
- remove_action( 'bp_media_before_delete_media', 'BPMediaActions::delete_media_handler' );
186
- global $bp_media_count, $wpdb;
187
- if ( ! array_key_exists( 'id', $args ) )
188
- return;
189
-
190
- $activity_id = $args[ 'id' ];
191
- if ( intval( $activity_id ) ) {
192
- $query = "SELECT post_id from $wpdb->postmeta WHERE meta_key='bp_media_child_activity' AND meta_value={$activity_id}";
193
- $result = $wpdb->get_results( $query );
194
- if ( ! (is_array( $result ) && count( $result ) == 1 ) )
195
- return;
196
- $post_id = $result[ 0 ]->post_id;
197
- try {
198
- $post = get_post( $post_id );
199
- if ( ! isset( $post->post_type ) )
200
- return false;
201
- switch ( $post->post_type ) {
202
- case 'attachment':
203
- $media = new BPMediaHostWordpress( $post_id );
204
- $media->delete_media();
205
- break;
206
- case 'bp_media_album':
207
- $album = new BPMediaAlbum( $post_id );
208
- $album->delete_album();
209
- break;
210
- default:
211
- wp_delete_post( $post_id );
212
- }
213
- } catch ( Exception $e ) {
214
- error_log( 'Media tried to delete was already deleted' );
215
- }
216
- }
217
- }
218
-
219
- /**
220
- *
221
- * @param type $media_id
222
- * @return boolean
223
- */
224
- static function delete_media_handler( $media_id ) {
225
- /* @var $media BPMediaHostWordpress */
226
- remove_action( 'bp_before_activity_delete', 'BPMediaActions::delete_activity_handler' );
227
- $activity_id = get_post_meta( $media_id, 'bp_media_child_activity', true );
228
- if ( $activity_id == NULL )
229
- return false;
230
- bp_activity_delete_by_activity_id( $activity_id );
231
- }
232
-
233
- /**
234
- * Called on bp_init by screen functions
235
- *
236
- * @uses global $bp, $bp_media_query
237
- *
238
- * @since BuddyPress Media 2.0
239
- */
240
-
241
- /**
242
- *
243
- * @global type $bp
244
- * @global WP_Query $bp_media_query
245
- * @global type $bp_media_posts_per_page
246
- */
247
- function set_query() {
248
- global $bp, $bp_media_query, $bp_media_posts_per_page;
249
- switch ( $bp->current_action ) {
250
- case BP_MEDIA_IMAGES_SLUG:
251
- $type = 'image';
252
- break;
253
- case BP_MEDIA_AUDIO_SLUG:
254
- $type = 'audio';
255
- break;
256
- case BP_MEDIA_VIDEOS_SLUG:
257
- $type = 'video';
258
- break;
259
- default :
260
- $type = null;
261
- }
262
- if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
263
- $paged = $bp->action_variables[ 1 ];
264
- } else {
265
- $paged = 1;
266
- }
267
- if ( $type ) {
268
- $args = array(
269
- 'post_type' => 'attachment',
270
- 'post_status' => 'any',
271
- 'post_mime_type' => $type,
272
- 'author' => $bp->displayed_user->id,
273
- 'meta_key' => 'bp-media-key',
274
- 'meta_value' => $bp->displayed_user->id,
275
- 'meta_compare' => '=',
276
- 'paged' => $paged,
277
- 'posts_per_page' => $bp_media_posts_per_page
278
- );
279
- $bp_media_query = new WP_Query( $args );
280
- }
281
- }
282
-
283
- /**
284
- * Adds a download button and edit button on single entry pages of media files.
285
- *
286
- * @uses $bp_media_options Global variable
287
- *
288
- * @since BuddyPress Media 2.0
289
- */
290
-
291
- /**
292
- *
293
- * @global type $bp_media_current_entry
294
- * @global type $bp_media_options
295
- * @return boolean
296
- */
297
- function action_buttons() {
298
- if ( ! in_array( 'bp_media_current_entry', $GLOBALS ) )
299
- return false;
300
- global $bp_media_current_entry, $bp_media;
301
-
302
- if ( $bp_media_current_entry != NULL ) {
303
- $featured_post = get_post_meta( $bp_media_current_entry->get_id(), 'featured', true );
304
-
305
- if ( bp_displayed_user_id() == bp_loggedin_user_id() )
306
- echo '<a href="' . $bp_media_current_entry->get_edit_url()
307
- . '" class="button item-button bp-secondary-action bp-media-edit" title="'
308
- . __( 'Edit Media', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Edit', BP_MEDIA_TXT_DOMAIN ) . '</a>';
309
- if ( isset( $bp_media->options[ 'download_enabled' ] ) )
310
- echo '<a href="' . $bp_media_current_entry->get_attachment_url()
311
- . '" class="button item-button bp-secondary-action bp-media-download" title="'
312
- . __( 'Download', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Download', BP_MEDIA_TXT_DOMAIN ) . '</a>';
313
-
314
- if ( (bp_displayed_user_id() == bp_loggedin_user_id()) && ($bp_media_current_entry->get_type() == 'image') ) {
315
- if ( get_post_thumbnail_id( $bp_media_current_entry->get_album_id() ) != $bp_media_current_entry->get_id() )
316
- echo '<a href="#" data-album-id="' . $bp_media_current_entry->get_album_id()
317
- . '" data-post-id="' . $bp_media_current_entry->get_id()
318
- . '" class="button item-button bp-secondary-action bp-media-featured" title="'
319
- . __( 'Set as Album Cover', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Set as Album Cover', BP_MEDIA_TXT_DOMAIN ) . '</a>';
320
- else
321
- echo '<a href="#" data-album-id="'
322
- . $bp_media_current_entry->get_album_id() . '" data-post-id="' . $bp_media_current_entry->get_id()
323
- . '" class="button item-button bp-secondary-action bp-media-featured" title="'
324
- . __( 'Unset as Album Cover', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Unset as Album Cover', BP_MEDIA_TXT_DOMAIN ) . '</a>';
325
- }
326
- }
327
- }
328
-
329
- /* Should be used with Content Disposition Type for media files set to attachment */
330
-
331
- /**
332
- * Shows the media count of a user in the tabs
333
- *
334
- * @since BuddyPress Media 2.0
335
- */
336
-
337
- /**
338
- *
339
- * @global type $bp_media_count
340
- * @param type $user
341
- * @return boolean
342
- */
343
- static function init_count( $user = null ) {
344
- global $bp_media_count, $bp_media;
345
- $enabled = $bp_media->enabled();
346
- $current_access = BPMediaPrivacy::current_access();
347
- if ( ! $user )
348
- $user = bp_displayed_user_id();
349
- if ( $user < 1 ) {
350
- $bp_media_count = null;
351
- return false;
352
- }
353
- $count = bp_get_user_meta( $user, 'bp_media_count', true );
354
- if ( ! $count ) {
355
- $bp_media_count = array(
356
- 0=>array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ),
357
- 2=>array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ),
358
- 4=>array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ),
359
- 6=>array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ),
360
- );
361
- bp_update_user_meta( $user, 'bp_media_count', $bp_media_count );
362
- } else {
363
- $total = array(
364
- 'images' => 0,
365
- 'videos' => 0,
366
- 'audio' => 0,
367
- 'albums' => 0,
368
- 'total' => 0
369
- );
370
- $total_count = 0;
371
- if ( isset( $count ) && is_array( $count ) && count( $count ) > 0 ) {
372
- foreach ( $count as $level => $counts ) {
373
- if ( $level <= $current_access ) {
374
- if ( isset( $counts ) && is_array( $counts ) && count( $counts ) > 0 ) {
375
- foreach ( $counts as $media => $number ) {
376
- if ( array_key_exists( $media, $enabled ) || array_key_exists( $media . 's', $enabled ) ) {
377
- if ( $enabled[ $media ] ) {
378
- $medias = $media;
379
- if ( $media != 'audio' )
380
- $medias .='s';
381
- $total[ $medias ] = $total[ $medias ] + $number;
382
- if ( $media != 'album' ) {
383
- $total_count = $total_count + $total[ $medias ];
384
- }
385
- }
386
- }
387
- }
388
- }
389
- $total[ 'total' ] = $total_count;
390
- }
391
- }
392
- }
393
-
394
- $bp_media_count = $total;
395
- }
396
- add_filter( 'bp_get_displayed_user_nav_' . BP_MEDIA_SLUG, 'BPMediaFilters::items_count_filter', 10, 2 );
397
-
398
- if ( bp_current_component() == BP_MEDIA_SLUG ) {
399
- add_filter( 'bp_get_options_nav_' . BP_MEDIA_IMAGES_SLUG, 'BPMediaFilters::items_count_filter', 10, 2 );
400
- add_filter( 'bp_get_options_nav_' . BP_MEDIA_VIDEOS_SLUG, 'BPMediaFilters::items_count_filter', 10, 2 );
401
- add_filter( 'bp_get_options_nav_' . BP_MEDIA_AUDIO_SLUG, 'BPMediaFilters::items_count_filter', 10, 2 );
402
- add_filter( 'bp_get_options_nav_' . BP_MEDIA_ALBUMS_SLUG, 'BPMediaFilters::items_count_filter', 10, 2 );
403
- }
404
- return true;
405
- }
406
-
407
- public function update_count($object) {
408
-
409
- global $bp;
410
- $user_id = $bp->loggedin_user->id;
411
- global $wpdb;
412
-
413
- $query =
414
- "SELECT
 
 
 
 
 
 
 
 
 
 
 
 
415
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
416
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
417
  SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
@@ -425,400 +433,490 @@ class BPMediaActions {
425
  pmp.meta_key = 'bp_media_privacy' AND
426
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
427
  GROUP BY pmp.meta_value";
428
- $result = $wpdb->get_results( $query );
429
- if ( ! is_array( $result ) )
430
- return false;
431
- foreach ( $result as $level => $obj ) {
432
- $formatted[ $level*2 ] = array(
433
- 'image' => $obj->Images,
434
- 'video' => $obj->Videos,
435
- 'audio' => $obj->Audio,
436
- 'album' => $obj->Albums,
437
- );
438
- }
439
- bp_update_user_meta( $user_id, 'bp_media_count', $formatted );
440
- return true;
441
- }
442
-
443
- /**
444
- * Displays the footer of the BuddyPress Media Plugin if enabled through the dashboard options page
445
- *
446
- * @since BuddyPress Media 2.0
447
- */
448
- function footer() {
449
- ?>
450
- <div id="bp-media-footer"><p>Using <a title="BuddyPress Media adds photos, video and audio upload/management feature" href="http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media">BuddyPress Media</a>.</p></div>
451
- <?php
452
- }
453
-
454
- function upload_enqueue() {
455
- // echo 'action=' . bp_current_action();
456
- // echo '<br />';
457
- // echo 'activity=' . bp_is_activity_component();
458
- // echo '<br />';
459
- // echo 'group=' . bp_is_group_home();
460
- if ( bp_is_activity_component() || bp_is_group_home() ) {
461
- $params = array(
462
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
463
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
464
- 'browse_button' => 'bp-media-activity-upload-browse-button',
465
- 'container' => 'bp-media-activity-upload-ui',
466
- 'drop_element' => 'drag-drop-area',
467
- 'filters' => apply_filters( 'bp_media_plupload_files_filter', array( array( 'title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3" ) ) ),
468
- 'max_file_size' => min( array( ini_get( 'upload_max_filesize' ), ini_get( 'post_max_size' ) ) ),
469
- 'multipart' => true,
470
- 'urlstream_upload' => true,
471
- 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
472
- 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
473
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
474
- 'multi_selection' => true,
475
- 'multipart_params' => apply_filters( 'bp_media_multipart_params_filter', array( 'action' => 'wp_handle_upload' ) )
476
- );
477
- wp_enqueue_script( 'bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array( 'plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers' ), BP_MEDIA_VERSION );
478
- wp_localize_script( 'bp-media-activity-uploader', 'bp_media_uploader_params', $params );
479
- wp_localize_script( 'bp-media-activity-uploader', 'activity_ajax_url', admin_url( 'admin-ajax.php' ) );
480
- } 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 ) ) ) {
481
- $params = array(
482
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
483
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
484
- 'browse_button' => 'bp-media-upload-browse-button',
485
- 'container' => 'bp-media-upload-ui',
486
- 'drop_element' => 'drag-drop-area',
487
- 'filters' => apply_filters( 'bp_media_plupload_files_filter', array( array( 'title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3" ) ) ),
488
- 'max_file_size' => min( array( ini_get( 'upload_max_filesize' ), ini_get( 'post_max_size' ) ) ),
489
- 'multipart' => true,
490
- 'urlstream_upload' => true,
491
- 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
492
- 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
493
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
494
- 'multi_selection' => true,
495
- 'multipart_params' => apply_filters( 'bp_media_multipart_params_filter', array( 'action' => 'wp_handle_upload' ) )
496
- );
497
- wp_enqueue_script( 'bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array( 'plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers' ), BP_MEDIA_VERSION );
498
- wp_localize_script( 'bp-media-uploader', 'bp_media_uploader_params', $params );
 
 
499
  }
500
- wp_enqueue_style( 'bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION );
501
- }
 
502
 
503
  //This is used only on the uploads page so its added as action in the screens function of upload page.
504
 
505
- /**
506
- * Called on bp_init by screen functions
507
- *
508
- * @uses global $bp, $bp_media_albums_query
509
- *
510
- * @since BuddyPress Media 2.2
511
- */
512
-
513
- /**
514
- *
515
- * @global type $bp
516
- * @global WP_Query $bp_media_albums_query
517
- */
518
- function albums_set_query() {
519
- global $bp, $bp_media_albums_query;
520
- if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
521
- $paged = $bp->action_variables[ 1 ];
522
- } else {
523
- $paged = 1;
524
- }
525
- if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
526
- $args = array(
527
- 'post_type' => 'bp_media_album',
528
- 'author' => $bp->displayed_user->id,
529
- 'paged' => $paged,
530
- 'meta_key' => 'bp-media-key',
531
- 'meta_value' => $bp->displayed_user->id,
532
- 'meta_compare' => '='
533
- );
534
- $bp_media_albums_query = new WP_Query( $args );
535
- }
536
- }
537
-
538
- function filter_entries() {
539
- global $bp_media;
540
- $enabled = $bp_media->enabled();
541
- if ( isset( $enabled[ 'upload' ] ) )
542
- unset( $enabled[ 'upload' ] );
543
- if ( isset( $enabled[ 'album' ] ) )
544
- unset( $enabled[ 'album' ] );
545
- foreach ( $enabled as $type => $active ) {
546
- if ( $active == true ) {
547
- $filters[ ] = $type;
548
- }
549
- }
550
-
551
- if ( count( $filters ) == 1 )
552
- $filters = $filters[ 0 ];
553
- return $filters;
554
- }
555
-
556
- /**
557
- * Function to return the media for the ajax requests
558
- */
559
-
560
- /**
561
- *
562
- * @global type $bp
563
- * @global WP_Query $bp_media_query
564
- * @global type $bp_media_posts_per_page
565
- */
566
- function load_more() {
567
-
568
- global $bp, $bp_media_query, $bp_media, $bp_media_albums_query;
569
- $page = isset( $_POST[ 'page' ] ) ? $_POST[ 'page' ] : die();
570
- $current_action = isset( $_POST[ 'current_action' ] ) ? $_POST[ 'current_action' ] : null;
571
- $action_variables = isset( $_POST[ 'action_variables' ] ) ? $_POST[ 'action_variables' ] : null;
572
- $displayed_user = isset( $_POST[ 'displayed_user' ] ) ? $_POST[ 'displayed_user' ] : null;
573
- $loggedin_user = isset( $_POST[ 'loggedin_user' ] ) ? $_POST[ 'loggedin_user' ] : null;
574
- $current_group = isset( $_POST[ 'current_group' ] ) ? $_POST[ 'current_group' ] : null;
575
- $album_id = isset( $_POST[ 'album_id' ] ) ? $_POST[ 'album_id' ] : false;
576
- if ( $current_group ) {
577
- $type_var = isset( $action_variables[ 0 ] ) ? $action_variables[ 0 ] : '';
578
- } else {
579
- $type_var = $current_action;
580
- }
581
-
582
- if ( $current_action == 'albums' ) {
583
- if ( isset( $action_variables[ 1 ] ) ) {
584
- $album_id = $action_variables[ 1 ];
585
- }
586
- }
587
-
588
- if ( ( ! $displayed_user || intval( $displayed_user ) == 0) && ( ! $current_group || intval( $current_group ) == 0) ) {
589
- die();
590
- }
591
- switch ( $type_var ) {
592
- case BP_MEDIA_IMAGES_SLUG:
593
- $type = 'image';
594
- break;
595
- case BP_MEDIA_AUDIO_SLUG:
596
- $type = 'audio';
597
- break;
598
- case BP_MEDIA_VIDEOS_SLUG:
599
- $type = 'video';
600
- break;
601
- case BP_MEDIA_ALBUMS_SLUG:
602
- $type = 'album';
603
- break;
604
- default :
605
- $type = null;
606
- }
607
-
608
- $query = new BPMediaQuery();
609
- $args = $query->init( $type, $album_id, false, $page );
610
- if($type=='album'){
611
- $bp_media_albums_query = new WP_Query( $args );
612
- if ( isset( $bp_media_albums_query->posts ) && is_array( $bp_media_albums_query->posts ) && count( $bp_media_albums_query->posts ) ) {
613
- foreach ( $bp_media_albums_query->posts as $attachment ) {
614
- try {
615
- $media = new BPMediaAlbum( $attachment->ID );
616
- echo $media->get_album_gallery_content();
617
- } catch ( exception $e ) {
618
- die();
619
- }
620
- }
621
- }
622
- }else{
623
- $bp_media_query = new WP_Query( $args );
624
- if ( isset( $bp_media_query->posts ) && is_array( $bp_media_query->posts ) && count( $bp_media_query->posts ) ) {
625
- foreach ( $bp_media_query->posts as $attachment ) {
626
- try {
627
- $media = new BPMediaHostWordpress( $attachment->ID );
628
- echo $media->get_media_gallery_content();
629
- } catch ( exception $e ) {
630
- die();
631
- }
632
- }
633
- }
634
- }
635
- die();
636
- }
637
-
638
- /**
639
- *
640
- * @global type $bp_media_count
641
- * @param type $attachment_id
642
- * @return boolean
643
- */
644
- function delete_attachment_handler( $attachment_id ) {
645
- if ( get_post_meta( $attachment_id, 'bp-media-key' ) ) {
646
- do_action( 'bp_media_before_delete_media', $attachment_id );
647
- global $bp_media_count;
648
- $attachment = get_post( $attachment_id );
649
- preg_match_all( '/audio|video|image/i', $attachment->post_mime_type, $result );
650
- if ( isset( $result[ 0 ][ 0 ] ) )
651
- $type = $result[ 0 ][ 0 ];
652
- else
653
- return false;
654
- BPMediaActions::init_count( $attachment->post_author );
655
- switch ( $type ) {
656
- case 'image':
657
- $images = intval( $bp_media_count[ 'images' ] ) ? intval( $bp_media_count[ 'images' ] ) : 0;
658
- $bp_media_count[ 'images' ] = $images - 1;
659
- break;
660
- case 'audio':
661
- $bp_media_count[ 'audio' ] = intval( $bp_media_count[ 'audio' ] ) - 1;
662
- break;
663
- case 'video':
664
- $bp_media_count[ 'videos' ] = intval( $bp_media_count[ 'videos' ] ) - 1;
665
- break;
666
- default:
667
- return false;
668
- }
669
- bp_update_user_meta( $attachment->post_author, 'bp_media_count', $bp_media_count );
670
- do_action( 'bp_media_after_delete_media', $attachment_id );
671
- return true;
672
- }
673
- }
674
-
675
- /**
676
- * Function to create new album called via ajax request
677
- */
678
- function add_album() {
679
- if ( isset( $_POST[ 'bp_media_album_name' ] ) && $_POST[ 'bp_media_album_name' ] != '' ) {
680
- $album = new BPMediaAlbum();
681
- if ( isset( $_POST[ 'bp_media_group_id' ] ) && intval( $_POST[ 'bp_media_group_id' ] ) > 0 ) {
682
- $group_id = intval( $_POST[ 'bp_media_group_id' ] );
683
- if ( BPMediaGroupLoader::user_can_create_album( $group_id, get_current_user_id() ) ) {
684
- try {
685
- $album->add_album( $_POST[ 'bp_media_album_name' ], 0, $group_id );
686
- echo $album->get_id();
687
- } catch ( exception $e ) {
688
- echo '0';
689
- }
690
- } else {
691
- echo '0';
692
- }
693
- } else {
694
- try {
695
- $album->add_album( $_POST[ 'bp_media_album_name' ] );
696
- echo $album->get_id();
697
- } catch ( exception $e ) {
698
- echo '0';
699
- }
700
- }
701
- } else {
702
- echo '0';
703
- }
704
- die();
705
- }
706
-
707
- function add_new_from_activity() {
708
- BPMediaTemplateFunctions::show_upload_form_multiple_activity();
709
- }
 
710
 
711
  //add_action('bp_after_activity_post_form','add_new_from_activity');
712
 
713
- /**
714
- *
715
- * @param type $album
716
- */
717
- function album_create_activity( $album ) {
718
- /* @var $album BP_Media_Album */
719
- $args = array(
720
- 'action' => apply_filters( 'bp_media_album_created', sprintf( __( '%1$s created an album %2$s', BP_MEDIA_TXT_DOMAIN ), bp_core_get_userlink( $album->get_owner() ), '<a href="' . $album->get_url() . '">' . $album->get_title() . '</a>' ) ),
721
- 'component' => BP_MEDIA_SLUG,
722
- 'type' => 'album_created',
723
- 'primary_link' => $album->get_url(),
724
- 'user_id' => $album->get_owner(),
725
- 'item_id' => $album->get_id()
726
- );
727
- $activity_id = BPMediaFunction::record_activity( $args );
728
- update_post_meta( $album->get_id(), 'bp_media_child_activity', $activity_id );
729
- }
730
-
731
- /**
732
- *
733
- * @param type $album_id
734
- */
735
- function album_activity_update( $album_id ) {
736
- BPMediaFunction::update_album_activity( $album_id );
737
- }
738
-
739
- /**
740
- *
741
- * @param type $media_id
742
- */
743
- function album_activity_sync( $media_id ) {
744
- $album_id = wp_get_post_parent_id( $media_id );
745
- BPMediaFunction::update_album_activity( $album_id, false, $media_id );
746
- }
747
-
748
- /**
749
- *
750
- * @param BPMediaHostWordpress $media
751
- * @param type $hidden
752
- * @return boolean
753
- */
754
- static function activity_create_after_add_media( $media, $hidden = false, $activity = false, $group = false ) {
755
- if ( function_exists( 'bp_activity_add' ) ) {
756
- if ( ! is_object( $media ) ) {
757
- try {
758
- $media = new BPMediaHostWordpress( $media );
759
- } catch ( exception $e ) {
760
- return false;
761
- }
762
- }
763
- $activity_content = $media->get_media_activity_content();
764
- new BPMediaLog( $activity_content );
765
- $args = array(
766
- 'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN ), bp_core_get_userlink( $media->get_author() ), '<a href="' . $media->get_url() . '">' . $media->get_media_activity_type() . '</a>' ) ),
767
- 'content' => $activity_content,
768
- 'primary_link' => $media->get_url(),
769
- 'item_id' => $media->get_id(),
770
- 'type' => 'media_upload',
771
- 'user_id' => $media->get_author()
772
- );
773
-
774
- $hidden = apply_filters( 'bp_media_force_hide_activity', $hidden );
775
-
776
- if ( $activity || $hidden ) {
777
- $args[ 'secondary_item_id' ] = -999;
778
- } else {
779
- $update_activity_id = get_post_meta( $media->get_id(), 'bp_media_child_activity', true );
780
- if ( $update_activity_id ) {
781
- $args[ 'id' ] = $update_activity_id;
782
- $args[ 'secondary_item_id' ] = false;
783
- }
784
- }
785
-
786
- if ( $hidden ) {
787
- do_action( 'bp_media_album_updated', $media->get_album_id() );
788
- }
789
-
790
- if ( $group ) {
791
- $group_info = groups_get_group( array( 'group_id' => $group ) );
792
- if ( 'public' != $group_info->status ) {
793
- $args[ 'hide_sitewide' ] = 1;
794
- }
795
- }
796
-
797
- $activity_id = BPMediaFunction::record_activity( $args );
798
-
799
- if ( $group )
800
- bp_activity_update_meta( $activity_id, 'group_id', $group );
801
-
802
- if ( ! $update_activity_id )
803
- add_post_meta( $media->get_id(), 'bp_media_child_activity', $activity_id );
804
- }
805
- }
806
-
807
- public function set_album_cover() {
808
- $id = $_POST[ 'post_id' ];
809
- $album_id = $_POST[ 'album_id' ];
810
- $album_cover = get_post_thumbnail_id( $album_id );
811
- $text = NULL;
812
- if ( $album_cover && ($album_cover == $id) ) {
813
- delete_post_thumbnail( $album_id );
814
- $text = __( 'Set as Album Cover', BP_MEDIA_TXT_DOMAIN );
815
- } else {
816
- set_post_thumbnail( $album_id, $id );
817
- $text = __( 'Unset as Album Cover', BP_MEDIA_TXT_DOMAIN );
818
- }
819
- echo $text;
820
- die;
821
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
822
 
823
  }
824
  ?>
7
  */
8
  class BPMediaActions {
9
 
10
+ /**
11
+ *
12
+ * @global type $bp_media_options
13
+ */
14
+ function __construct() {
15
+ add_action('bp_media_before_content', 'BPMediaActions::show_messages');
16
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'), 11);
17
+ add_action('bp_before_activity_delete', 'BPMediaActions::delete_activity_handler');
18
+ add_action('wp_enqueue_scripts', array($this, 'upload_enqueue'));
19
+ add_action('init', 'BPMediaActions::init_count');
20
+ add_action('init', array($this, 'default_user_album'));
21
+ add_action('bp_init', array($this, 'default_group_album'));
22
+ add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
23
+ add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
24
+ add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
25
+ add_action('bp_media_after_add_album', array($this, 'update_count'), 999);
26
+ add_action('bp_media_album_updated', 'BPMediaActions::album_activity_update');
27
+ add_action('bp_media_album_updated', array($this, 'update_count'), 999);
28
+ add_action('bp_media_after_edit_album', array($this, 'update_count'), 999);
29
+ add_action('bp_media_after_delete_album', array($this, 'update_count'), 999);
30
+ add_action('bp_media_after_delete_media', array($this, 'album_activity_sync'));
31
+ add_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 4);
32
+ add_action('wp_ajax_bp_media_load_more', array($this, 'load_more'));
33
+ add_action('wp_ajax_nopriv_bp_media_load_more', array($this, 'load_more'));
34
+ add_action('wp_ajax_bp_media_set_album_cover', array($this, 'set_album_cover'));
35
+ add_action('delete_attachment', array($this, 'delete_attachment_handler'));
36
+ add_action('wp_ajax_bp_media_add_album', array($this, 'add_album'));
37
+ add_action('bp_media_after_privacy_install', array($this, 'update_count'), 999);
38
+ add_action('bp_media_after_add_media', array($this, 'update_count'), 999);
39
+ add_action('bp_media_after_update_media', array($this, 'update_count'), 999);
40
+ add_action('bp_media_after_delete_media', array($this, 'update_count'), 999);
41
+ $linkback = bp_get_option('bp_media_add_linkback', false);
42
+ if ($linkback)
43
+ add_action('bp_footer', array($this, 'footer'));
44
+ }
45
+
46
+ /**
47
+ * Handles the uploads and creates respective posts for the upload
48
+ *
49
+ * @since BuddyPress Media 2.0
50
+ */
51
+
52
+ /**
53
+ *
54
+ * @global type $bp
55
+ * @global type $bp_media_options
56
+ * @return type
57
+ */
58
+ static function handle_uploads() {
59
+ global $bp, $bp_media;
60
+ $bp_media_options = $bp_media->options;
61
+ if (isset($_POST['action']) && $_POST['action'] == 'wp_handle_upload') {
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])) {
65
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('File uploaded is not supported');
66
+ return;
67
+ }
68
+ $type = $result[0];
69
+ switch ($result[0]) {
70
+ case 'image' :
71
+ if ($bp_media_options['images_enabled'] == false) {
72
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('Image uploads are disabled');
73
+ return;
74
+ }
75
+ break;
76
+ case 'video' :
77
+ if ($bp_media_options['videos_enabled'] == false) {
78
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('Video uploads are disabled');
79
+ return;
80
+ }
81
+ break;
82
+ case 'audio' :
83
+ if ($bp_media_options['audio_enabled'] == false) {
84
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('Audio uploads are disabled');
85
+ return;
86
+ }
87
+ break;
88
+ default :
89
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('File uploaded is not supported');
90
+ return;
91
+ }
92
+ $class_name = apply_filters('bp_media_transcoder', 'BPMediaHostWordpress', $type);
93
+ $bp_media_entry = new $class_name();
94
+ try {
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
+ $is_activity = isset($_POST['is_activity']) ? ($_POST['is_activity'] == 'true' ? true : false) : false;
99
+ $description = isset($_POST['bp_media_description']) ? $_POST['bp_media_description'] : '';
100
+ $group_id = isset($_POST['bp_media_group_id']) ? intval($_POST['bp_media_group_id']) : 0;
101
+ $entry = $bp_media_entry->add_media($title, $description, $album_id, $group_id, $is_multiple, $is_activity);
102
+ if (!isset($bp->{BP_MEDIA_SLUG}->messages['updated'][0]))
103
+ $bp->{BP_MEDIA_SLUG}->messages['updated'][0] = __('Upload Successful', BP_MEDIA_TXT_DOMAIN);
104
+ } catch (Exception $e) {
105
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = $e->getMessage();
106
+ }
107
+ } else {
108
+ $bp->{BP_MEDIA_SLUG}->messages['error'][] = __('You did not specified a file to upload', BP_MEDIA_TXT_DOMAIN);
109
+ }
110
+ }
111
+ }
 
 
 
 
112
 
113
  //add_action('bp_init', 'handle_uploads');
114
 
115
+ /**
116
+ * Displays the messages that other functions/methods creates according to the BuddyPress' formating
117
+ *
118
+ * @since BuddyPress Media 2.0
119
+ */
120
+
121
+ /**
122
+ *
123
+ * @global type $bp
124
+ */
125
+ static function show_messages() {
126
+ global $bp;
127
+ if (is_array($bp->{BP_MEDIA_SLUG}->messages)) {
128
+ $types = array('error', 'updated', 'info');
129
+ foreach ($types as $type) {
130
+ if (count($bp->{BP_MEDIA_SLUG}->messages[$type]) > 0) {
131
+ BPMediaFunction::show_formatted_error_message($bp->{BP_MEDIA_SLUG}->messages[$type], $type);
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Enqueues all the required scripts and stylesheets for the proper working of BuddyPress Media.
139
+ *
140
+ * @since BuddyPress Media 2.0
141
+ */
142
+
143
+ /**
144
+ *
145
+ * @global type $bp
146
+ */
147
+ function enqueue_scripts_styles() {
148
+
149
+ wp_enqueue_script('jquery-ui-tabs');
150
+ wp_enqueue_script('bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js', '', BP_MEDIA_VERSION);
151
+ wp_enqueue_script('bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js', '', BP_MEDIA_VERSION);
152
+ wp_enqueue_script('bp-media-modal', BP_MEDIA_URL . 'lib/simplemodal/jquery.simplemodal-1.4.4.js', '', BP_MEDIA_VERSION);
153
+ global $bp;
154
+ $cur_group_id = NULL;
155
+ if (bp_is_active("groups"))
156
+ $cur_group_id = bp_get_current_group_id();
157
+ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
158
+ $schema = 'https';
159
+ } else {
160
+ $schema = 'http';
161
+ }
162
+ $bp_media_vars = array(
163
+ 'ajaxurl' => admin_url('admin-ajax.php', $schema),
164
+ 'page' => 1,
165
+ 'current_action' => $cur_group_id ? (empty($bp->action_variables) ? BP_MEDIA_IMAGES_SLUG : $bp->action_variables[0]) : (isset($bp->current_action) ? $bp->current_action : false),
166
+ 'action_variables' => isset($bp->action_variables) ? (empty($bp->action_variables) ? array(BP_MEDIA_IMAGES_SLUG) : $bp->action_variables) : array(BP_MEDIA_IMAGES_SLUG),
167
+ 'displayed_user' => bp_displayed_user_id(),
168
+ 'loggedin_user' => bp_loggedin_user_id(),
169
+ 'current_group' => $cur_group_id,
170
+ );
171
+
172
+ wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
173
+ wp_enqueue_style('bp-media-mecss', BP_MEDIA_URL . 'lib/media-element/mediaelementplayer.min.css', '', BP_MEDIA_VERSION);
174
+ wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
175
+ if (is_admin()) {
176
+ wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
177
+ }
178
+ }
179
+
180
+ /**
181
+ *
182
+ * @global integer $bp_media_count
183
+ * @global object $wpdb
184
+ * @param array $args
185
+ * @return boolean
186
+ */
187
+ static function delete_activity_handler($args) {
188
+ remove_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
189
+ global $bp_media_count, $wpdb;
190
+ if (!array_key_exists('id', $args))
191
+ return;
192
+
193
+ $activity_id = $args['id'];
194
+ if (intval($activity_id)) {
195
+ $query = "SELECT post_id from $wpdb->postmeta WHERE meta_key='bp_media_child_activity' AND meta_value={$activity_id}";
196
+ $result = $wpdb->get_results($query);
197
+ if (!(is_array($result) && count($result) == 1 ))
198
+ return;
199
+ $post_id = $result[0]->post_id;
200
+ try {
201
+ $post = get_post($post_id);
202
+ if (!isset($post->post_type))
203
+ return false;
204
+ switch ($post->post_type) {
205
+ case 'attachment':
206
+ $media = new BPMediaHostWordpress($post_id);
207
+ $media->delete_media();
208
+ break;
209
+ case 'bp_media_album':
210
+ $album = new BPMediaAlbum($post_id);
211
+ $album->delete_album();
212
+ break;
213
+ default:
214
+ wp_delete_post($post_id);
215
+ }
216
+ } catch (Exception $e) {
217
+ error_log('Media tried to delete was already deleted');
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ *
224
+ * @param type $media_id
225
+ * @return boolean
226
+ */
227
+ static function delete_media_handler($media_id) {
228
+ /* @var $media BPMediaHostWordpress */
229
+ remove_action('bp_before_activity_delete', 'BPMediaActions::delete_activity_handler');
230
+ $activity_id = get_post_meta($media_id, 'bp_media_child_activity', true);
231
+ if ($activity_id == NULL)
232
+ return false;
233
+ bp_activity_delete_by_activity_id($activity_id);
234
+ }
235
+
236
+ /**
237
+ * Called on bp_init by screen functions
238
+ *
239
+ * @uses global $bp, $bp_media_query
240
+ *
241
+ * @since BuddyPress Media 2.0
242
+ */
243
+
244
+ /**
245
+ *
246
+ * @global type $bp
247
+ * @global WP_Query $bp_media_query
248
+ * @global type $bp_media_posts_per_page
249
+ */
250
+ function set_query() {
251
+ global $bp, $bp_media_query, $bp_media_posts_per_page;
252
+ switch ($bp->current_action) {
253
+ case BP_MEDIA_IMAGES_SLUG:
254
+ $type = 'image';
255
+ break;
256
+ case BP_MEDIA_AUDIO_SLUG:
257
+ $type = 'audio';
258
+ break;
259
+ case BP_MEDIA_VIDEOS_SLUG:
260
+ $type = 'video';
261
+ break;
262
+ default :
263
+ $type = null;
264
+ }
265
+ if (isset($bp->action_variables) && is_array($bp->action_variables) && isset($bp->action_variables[0]) && $bp->action_variables[0] == 'page' && isset($bp->action_variables[1]) && is_numeric($bp->action_variables[1])) {
266
+ $paged = $bp->action_variables[1];
267
+ } else {
268
+ $paged = 1;
269
+ }
270
+ if ($type) {
271
+ $args = array(
272
+ 'post_type' => 'attachment',
273
+ 'post_status' => 'any',
274
+ 'post_mime_type' => $type,
275
+ 'author' => $bp->displayed_user->id,
276
+ 'meta_key' => 'bp-media-key',
277
+ 'meta_value' => $bp->displayed_user->id,
278
+ 'meta_compare' => '=',
279
+ 'paged' => $paged,
280
+ 'posts_per_page' => $bp_media_posts_per_page
281
+ );
282
+ $bp_media_query = new WP_Query($args);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Adds a download button and edit button on single entry pages of media files.
288
+ *
289
+ * @uses $bp_media_options Global variable
290
+ *
291
+ * @since BuddyPress Media 2.0
292
+ */
293
+
294
+ /**
295
+ *
296
+ * @global type $bp_media_current_entry
297
+ * @global type $bp_media_options
298
+ * @return boolean
299
+ */
300
+ function action_buttons() {
301
+ if (!in_array('bp_media_current_entry', $GLOBALS))
302
+ return false;
303
+ global $bp_media_current_entry, $bp_media;
304
+
305
+ $action_buttons = array();
306
+ if ($bp_media_current_entry != NULL) {
307
+
308
+ if (isset($bp_media->options['download_enabled']))
309
+ $action_buttons[] = '<a href="' . $bp_media_current_entry->get_attachment_url()
310
+ . '" target="_blank" class="button item-button bp-secondary-action bp-media-download" title="'
311
+ . __('Download', BP_MEDIA_TXT_DOMAIN) . '">' . __('Download', BP_MEDIA_TXT_DOMAIN) . '</a>';
312
+
313
+ if ((bp_displayed_user_id() == bp_loggedin_user_id()) && ($bp_media_current_entry->get_type() == 'image')) {
314
+ if (get_post_thumbnail_id($bp_media_current_entry->get_album_id()) != $bp_media_current_entry->get_id())
315
+ $action_buttons[] = '<a href="#" data-album-id="' . $bp_media_current_entry->get_album_id()
316
+ . '" data-post-id="' . $bp_media_current_entry->get_id()
317
+ . '" class="button item-button bp-secondary-action bp-media-featured" title="'
318
+ . __('Set as Album Cover', BP_MEDIA_TXT_DOMAIN) . '">' . __('Set as Album Cover', BP_MEDIA_TXT_DOMAIN) . '</a>';
319
+ else
320
+ $action_buttons[] = '<a href="#" data-album-id="'
321
+ . $bp_media_current_entry->get_album_id() . '" data-post-id="' . $bp_media_current_entry->get_id()
322
+ . '" class="button item-button bp-secondary-action bp-media-featured" title="'
323
+ . __('Unset as Album Cover', BP_MEDIA_TXT_DOMAIN) . '">' . __('Unset as Album Cover', BP_MEDIA_TXT_DOMAIN) . '</a>';
324
+ }
325
+
326
+ if (bp_displayed_user_id() == bp_loggedin_user_id())
327
+ $action_buttons[] = '<a href="' . $bp_media_current_entry->get_edit_url()
328
+ . '" class="button item-button bp-secondary-action bp-media-edit" title="'
329
+ . __('Edit Media', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
330
+ }
331
+ $action_buttons = apply_filters('bp_media_action_buttons', $action_buttons);
332
+ foreach ($action_buttons as $action_button) {
333
+ echo $action_button;
334
+ }
335
+ }
336
+
337
+ /* Should be used with Content Disposition Type for media files set to attachment */
338
+
339
+ /**
340
+ * Shows the media count of a user in the tabs
341
+ *
342
+ * @since BuddyPress Media 2.0
343
+ */
344
+
345
+ /**
346
+ *
347
+ * @global type $bp_media_count
348
+ * @param type $user
349
+ * @return boolean
350
+ */
351
+ static function init_count($user = null) {
352
+ global $bp_media_count, $bp_media;
353
+ $enabled = $bp_media->enabled();
354
+ $current_access = BPMediaPrivacy::current_access();
355
+ if (!$user)
356
+ $user = bp_displayed_user_id();
357
+ if ($user < 1) {
358
+ $bp_media_count = null;
359
+ return false;
360
+ }
361
+ $count = bp_get_user_meta($user, 'bp_media_count', true);
362
+ if (!$count) {
363
+ $bp_media_count = array(
364
+ 0 => array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0),
365
+ 2 => array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0),
366
+ 4 => array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0),
367
+ 6 => array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0),
368
+ );
369
+ bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
370
+ } else {
371
+ $total = array(
372
+ 'images' => 0,
373
+ 'videos' => 0,
374
+ 'audio' => 0,
375
+ 'albums' => 0,
376
+ 'total' => 0
377
+ );
378
+ $total_count = 0;
379
+ if (isset($count) && is_array($count) && count($count) > 0) {
380
+ foreach ($count as $level => $counts) {
381
+ if ($level <= $current_access) {
382
+ if (isset($counts) && is_array($counts) && count($counts) > 0) {
383
+ foreach ($counts as $media => $number) {
384
+ if (array_key_exists($media, $enabled) || array_key_exists($media . 's', $enabled)) {
385
+ if ($enabled[$media]) {
386
+ $medias = $media;
387
+ if ($media != 'audio')
388
+ $medias .='s';
389
+ $total[$medias] = $total[$medias] + $number;
390
+ if ($media != 'album') {
391
+ $total_count = $total_count + $total[$medias];
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ $total['total'] = $total_count;
398
+ }
399
+ }
400
+ }
401
+
402
+ $bp_media_count = $total;
403
+ }
404
+ add_filter('bp_get_displayed_user_nav_' . BP_MEDIA_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
405
+
406
+ if (bp_current_component() == BP_MEDIA_SLUG) {
407
+ add_filter('bp_get_options_nav_' . BP_MEDIA_IMAGES_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
408
+ add_filter('bp_get_options_nav_' . BP_MEDIA_VIDEOS_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
409
+ add_filter('bp_get_options_nav_' . BP_MEDIA_AUDIO_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
410
+ add_filter('bp_get_options_nav_' . BP_MEDIA_ALBUMS_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
411
+ }
412
+ return true;
413
+ }
414
+
415
+ public function update_count($object) {
416
+
417
+ global $bp;
418
+ $user_id = $bp->loggedin_user->id;
419
+ global $wpdb;
420
+ $formatted = array();
421
+ $query =
422
+ "SELECT
423
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
424
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
425
  SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
433
  pmp.meta_key = 'bp_media_privacy' AND
434
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
435
  GROUP BY pmp.meta_value";
436
+ $result = $wpdb->get_results($query);
437
+ if (!is_array($result))
438
+ return false;
439
+ foreach ($result as $level => $obj) {
440
+ $formatted[$level * 2] = array(
441
+ 'image' => $obj->Images,
442
+ 'video' => $obj->Videos,
443
+ 'audio' => $obj->Audio,
444
+ 'album' => $obj->Albums,
445
+ );
446
+ }
447
+ bp_update_user_meta($user_id, 'bp_media_count', $formatted);
448
+ return true;
449
+ }
450
+
451
+ /**
452
+ * Displays the footer of the BuddyPress Media Plugin if enabled through the dashboard options page
453
+ *
454
+ * @since BuddyPress Media 2.0
455
+ */
456
+ function footer() {
457
+ ?>
458
+ <div id="bp-media-footer"><p>Using <a title="BuddyPress Media adds photos, video and audio upload/management feature" href="http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media">BuddyPress Media</a>.</p></div>
459
+ <?php
460
+ }
461
+
462
+ function upload_enqueue() {
463
+ if( is_user_logged_in()){
464
+ if (bp_is_activity_component() || bp_is_group_home()) {
465
+ $params = array(
466
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
467
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
468
+ 'browse_button' => 'bp-media-activity-upload-browse-button',
469
+ 'container' => 'bp-media-activity-upload-ui',
470
+ 'drop_element' => 'drag-drop-area',
471
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
472
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
473
+ 'multipart' => true,
474
+ 'urlstream_upload' => true,
475
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
476
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
477
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
478
+ 'multi_selection' => true,
479
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
480
+ );
481
+ wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
482
+ wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
483
+ wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
484
+ if (bp_get_current_group_id())
485
+ $default_album = $this->default_group_album();
486
+ else
487
+ $default_album = $this->default_user_album();
488
+ wp_localize_script('bp-media-activity-uploader', 'default_album', $default_album ? $default_album : 0);
489
+ } 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))) {
490
+ $params = array(
491
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
492
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
493
+ 'browse_button' => 'bp-media-upload-browse-button',
494
+ 'container' => 'bp-media-upload-ui',
495
+ 'drop_element' => 'drag-drop-area',
496
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
497
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
498
+ 'multipart' => true,
499
+ 'urlstream_upload' => true,
500
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
501
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
502
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
503
+ 'multi_selection' => true,
504
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
505
+ );
506
+ wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
507
+ wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
508
+ }
509
  }
510
+ wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
511
+ wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
512
+ }
513
 
514
  //This is used only on the uploads page so its added as action in the screens function of upload page.
515
 
516
+ /**
517
+ * Called on bp_init by screen functions
518
+ *
519
+ * @uses global $bp, $bp_media_albums_query
520
+ *
521
+ * @since BuddyPress Media 2.2
522
+ */
523
+
524
+ /**
525
+ *
526
+ * @global type $bp
527
+ * @global WP_Query $bp_media_albums_query
528
+ */
529
+ function albums_set_query() {
530
+ global $bp, $bp_media_albums_query;
531
+ if (isset($bp->action_variables) && is_array($bp->action_variables) && isset($bp->action_variables[0]) && $bp->action_variables[0] == 'page' && isset($bp->action_variables[1]) && is_numeric($bp->action_variables[1])) {
532
+ $paged = $bp->action_variables[1];
533
+ } else {
534
+ $paged = 1;
535
+ }
536
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
537
+ $args = array(
538
+ 'post_type' => 'bp_media_album',
539
+ 'author' => $bp->displayed_user->id,
540
+ 'paged' => $paged,
541
+ 'meta_key' => 'bp-media-key',
542
+ 'meta_value' => $bp->displayed_user->id,
543
+ 'meta_compare' => '='
544
+ );
545
+ $bp_media_albums_query = new WP_Query($args);
546
+ }
547
+ }
548
+
549
+ function filter_entries() {
550
+ global $bp_media;
551
+ $enabled = $bp_media->enabled();
552
+ if (isset($enabled['upload']))
553
+ unset($enabled['upload']);
554
+ if (isset($enabled['album']))
555
+ unset($enabled['album']);
556
+ foreach ($enabled as $type => $active) {
557
+ if ($active == true) {
558
+ $filters[] = $type;
559
+ }
560
+ }
561
+
562
+ if (count($filters) == 1)
563
+ $filters = $filters[0];
564
+ return $filters;
565
+ }
566
+
567
+ /**
568
+ * Function to return the media for the ajax requests
569
+ */
570
+
571
+ /**
572
+ *
573
+ * @global type $bp
574
+ * @global WP_Query $bp_media_query
575
+ * @global type $bp_media_posts_per_page
576
+ */
577
+ function load_more() {
578
+ global $bp, $bp_media_query, $bp_media, $bp_media_albums_query;
579
+ $page = isset($_GET['page']) ? $_GET['page'] : die();
580
+ $current_action = isset($_GET['current_action']) ? $_GET['current_action'] : null;
581
+ $action_variables = isset($_GET['action_variables']) ? $_GET['action_variables'] : null;
582
+ $displayed_user = isset($_GET['displayed_user']) ? $_GET['displayed_user'] : null;
583
+ $loggedin_user = isset($_GET['loggedin_user']) ? $_GET['loggedin_user'] : null;
584
+ $current_group = isset($_GET['current_group']) ? $_GET['current_group'] : null;
585
+ $album_id = isset($_GET['album_id']) ? $_GET['album_id'] : false;
586
+ if ($current_group && isset($action_variables[1])) {
587
+ $type_var = 'list';
588
+ } elseif ((isset($action_variables[0]) && $action_variables[0])) {
589
+ $type_var = $action_variables[0];
590
+ } else {
591
+ $type_var = $current_action;
592
+ }
593
+
594
+ if ($current_action == 'albums') {
595
+ if (isset($action_variables[1])) {
596
+ $album_id = $action_variables[1];
597
+ }
598
+ }
599
+
600
+ if ((!$displayed_user || intval($displayed_user) == 0) && (!$current_group || intval($current_group) == 0)) {
601
+ die();
602
+ }
603
+ switch ($type_var) {
604
+ case BP_MEDIA_IMAGES_SLUG:
605
+ $type = 'image';
606
+ break;
607
+ case BP_MEDIA_AUDIO_SLUG:
608
+ $type = 'audio';
609
+ break;
610
+ case BP_MEDIA_VIDEOS_SLUG:
611
+ $type = 'video';
612
+ break;
613
+ case BP_MEDIA_ALBUMS_SLUG:
614
+ $type = 'album';
615
+ break;
616
+ default :
617
+ $type = null;
618
+ }
619
+
620
+ $query = new BPMediaQuery();
621
+ $args = $query->init($type, $album_id, false, $page);
622
+ if ($type == 'album') {
623
+ $bp_media_albums_query = new WP_Query($args);
624
+ if (isset($bp_media_albums_query->posts) && is_array($bp_media_albums_query->posts) && count($bp_media_albums_query->posts)) {
625
+ foreach ($bp_media_albums_query->posts as $attachment) {
626
+ try {
627
+ $media = new BPMediaAlbum($attachment->ID);
628
+ echo $media->get_album_gallery_content();
629
+ } catch (exception $e) {
630
+ die();
631
+ }
632
+ }
633
+ }
634
+ } else {
635
+ $bp_media_query = new WP_Query($args);
636
+ if (isset($bp_media_query->posts) && is_array($bp_media_query->posts) && count($bp_media_query->posts)) {
637
+ foreach ($bp_media_query->posts as $attachment) {
638
+ try {
639
+ $media = new BPMediaHostWordpress($attachment->ID);
640
+ echo $media->get_media_gallery_content();
641
+ } catch (exception $e) {
642
+ die();
643
+ }
644
+ }
645
+ }
646
+ }
647
+ die();
648
+ }
649
+
650
+ /**
651
+ *
652
+ * @global type $bp_media_count
653
+ * @param type $attachment_id
654
+ * @return boolean
655
+ */
656
+ function delete_attachment_handler($attachment_id) {
657
+ if (get_post_meta($attachment_id, 'bp-media-key')) {
658
+ do_action('bp_media_before_delete_media', $attachment_id);
659
+ global $bp_media_count;
660
+ $attachment = get_post($attachment_id);
661
+ preg_match_all('/audio|video|image/i', $attachment->post_mime_type, $result);
662
+ if (isset($result[0][0]))
663
+ $type = $result[0][0];
664
+ else
665
+ return false;
666
+ BPMediaActions::init_count($attachment->post_author);
667
+ switch ($type) {
668
+ case 'image':
669
+ $images = intval($bp_media_count['images']) ? intval($bp_media_count['images']) : 0;
670
+ $bp_media_count['images'] = $images - 1;
671
+ break;
672
+ case 'audio':
673
+ $bp_media_count['audio'] = intval($bp_media_count['audio']) - 1;
674
+ break;
675
+ case 'video':
676
+ $bp_media_count['videos'] = intval($bp_media_count['videos']) - 1;
677
+ break;
678
+ default:
679
+ return false;
680
+ }
681
+ bp_update_user_meta($attachment->post_author, 'bp_media_count', $bp_media_count);
682
+ do_action('bp_media_after_delete_media', $attachment_id);
683
+ return true;
684
+ }
685
+ }
686
+
687
+ /**
688
+ * Function to create new album called via ajax request
689
+ */
690
+ function add_album() {
691
+ if (isset($_POST['bp_media_album_name']) && $_POST['bp_media_album_name'] != '') {
692
+ $album = new BPMediaAlbum();
693
+ if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id']) > 0) {
694
+ $group_id = intval($_POST['bp_media_group_id']);
695
+ if (BPMediaGroupLoader::user_can_create_album($group_id, get_current_user_id())) {
696
+ try {
697
+ $album->add_album($_POST['bp_media_album_name'], 0, $group_id);
698
+ echo $album->get_id();
699
+ } catch (exception $e) {
700
+ echo '0';
701
+ }
702
+ } else {
703
+ echo '0';
704
+ }
705
+ } else {
706
+ try {
707
+ $album->add_album($_POST['bp_media_album_name']);
708
+ echo $album->get_id();
709
+ } catch (exception $e) {
710
+ echo '0';
711
+ }
712
+ }
713
+ } else {
714
+ echo '0';
715
+ }
716
+ die();
717
+ }
718
+
719
+ function add_new_from_activity() {
720
+ BPMediaTemplateFunctions::show_upload_form_multiple_activity();
721
+ }
722
 
723
  //add_action('bp_after_activity_post_form','add_new_from_activity');
724
 
725
+ /**
726
+ *
727
+ * @param type $album
728
+ */
729
+ function album_create_activity($album) {
730
+ /* @var $album BP_Media_Album */
731
+ global $bp;
732
+ $album_info = new BPMediaHostWordpress($album->get_id());
733
+ if ($album_info->get_group_id() > 0 && bp_is_active('groups')) {
734
+ $component = $bp->groups->id;
735
+ $item_id = $album_info->get_group_id();
736
+ } else {
737
+ $component = $bp->activity->id;
738
+ $item_id = 0;
739
+ }
740
+
741
+ $args = array(
742
+ 'action' => apply_filters('bp_media_album_created', sprintf(__('%1$s created an album %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($album->get_owner()), '<a href="' . $album->get_url() . '">' . $album->get_title() . '</a>')),
743
+ 'component' => $component,
744
+ 'type' => 'activity_update',
745
+ 'primary_link' => $album->get_url(),
746
+ 'user_id' => $album->get_owner(),
747
+ 'item_id' => $item_id
748
+ );
749
+ $activity_id = BPMediaFunction::record_activity($args);
750
+ update_post_meta($album->get_id(), 'bp_media_child_activity', $activity_id);
751
+ }
752
+
753
+ /**
754
+ *
755
+ * @param type $album_id
756
+ */
757
+ function album_activity_update($album_id) {
758
+ BPMediaFunction::update_album_activity($album_id);
759
+ }
760
+
761
+ /**
762
+ *
763
+ * @param type $media_id
764
+ */
765
+ function album_activity_sync($media_id) {
766
+ $album_id = wp_get_post_parent_id($media_id);
767
+ BPMediaFunction::update_album_activity($album_id, false, $media_id);
768
+ }
769
+
770
+ /**
771
+ *
772
+ * @param BPMediaHostWordpress $media
773
+ * @param type $hidden
774
+ * @return boolean
775
+ */
776
+ static function activity_create_after_add_media($media, $hidden = false, $activity = false, $group = false) {
777
+ global $bp;
778
+ if (function_exists('bp_activity_add')) {
779
+ $update_activity_id = false;
780
+ if (!is_object($media)) {
781
+ try {
782
+ $media = new BPMediaHostWordpress($media);
783
+ } catch (exception $e) {
784
+ return false;
785
+ }
786
+ }
787
+ $activity_content = $media->get_media_activity_content();
788
+ $args = array(
789
+ 'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($media->get_author()), '<a href="' . $media->get_url() . '">' . $media->get_media_activity_type() . '</a>')),
790
+ 'content' => $activity_content,
791
+ 'primary_link' => $media->get_url(),
792
+ 'item_id' => $media->get_id(),
793
+ 'type' => 'activity_update',
794
+ 'user_id' => $media->get_author()
795
+ );
796
+
797
+ $hidden = apply_filters('bp_media_force_hide_activity', $hidden);
798
+
799
+ if ($activity || $hidden) {
800
+ $args['secondary_item_id'] = -999;
801
+ } else {
802
+ $update_activity_id = get_post_meta($media->get_id(), 'bp_media_child_activity', true);
803
+ if ($update_activity_id) {
804
+ $args['id'] = $update_activity_id;
805
+ $args['secondary_item_id'] = false;
806
+ }
807
+ }
808
+
809
+ if ($hidden && !$activity) {
810
+ do_action('bp_media_album_updated', $media->get_album_id());
811
+ }
812
+
813
+ if ($group) {
814
+ $group_info = groups_get_group(array('group_id' => $group));
815
+ $args['component'] = $bp->groups->id;
816
+ $args['item_id'] = $group;
817
+ if ('public' != $group_info->status) {
818
+ $args['hide_sitewide'] = 1;
819
+ }
820
+ }
821
+
822
+ $activity_id = BPMediaFunction::record_activity($args);
823
+
824
+ if ($group)
825
+ bp_activity_update_meta($activity_id, 'group_id', $group);
826
+
827
+ if (!$update_activity_id)
828
+ add_post_meta($media->get_id(), 'bp_media_child_activity', $activity_id);
829
+ }
830
+ }
831
+
832
+ public function set_album_cover() {
833
+ $id = $_GET['post_id'];
834
+ $album_id = $_GET['album_id'];
835
+ $album_cover = get_post_thumbnail_id($album_id);
836
+ $text = NULL;
837
+ if ($album_cover && ($album_cover == $id)) {
838
+ delete_post_thumbnail($album_id);
839
+ $text = __('Set as Album Cover', BP_MEDIA_TXT_DOMAIN);
840
+ } else {
841
+ set_post_thumbnail($album_id, $id);
842
+ $text = __('Unset as Album Cover', BP_MEDIA_TXT_DOMAIN);
843
+ }
844
+ echo $text;
845
+ die;
846
+ }
847
+
848
+ public function get_thumbnail() {
849
+ $id = $_POST['media_id'];
850
+ $content = '';
851
+ $media = new BPMediaHostWordpress($id);
852
+ switch ($media->get_type()) {
853
+ case 'video' :
854
+ if ($media->get_thumbnail_id()) {
855
+ $image_array = image_downsize($media->get_thumbnail_id(), 'thumbnail');
856
+ $content.=apply_filters('bp_media_ajax_thumbnail_filter', '<video poster="' . $image_array[0] . '" src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $media->get_id() . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $media->get_id() . '");</script>', $media);
857
+ } else {
858
+ $content.=apply_filters('bp_media_ajax_thumbnail_filter', '<video src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_video']['width'] . '" height="' . ($default_sizes['single_video']['height'] == 0 ? 'auto' : $default_sizes['single_video']['height']) . '" type="video/mp4" id="bp_media_video_' . $media->get_id() . '" controls="controls" preload="none"></video><script>bp_media_create_element("bp_media_video_' . $media->get_id() . '");</script>', $media);
859
+ }
860
+ break;
861
+ case 'audio' :
862
+ $content.=apply_filters('bp_media_ajax_thumbnail_filter', '<audio src="' . wp_get_attachment_url($media->get_id()) . '" width="' . $default_sizes['single_audio']['width'] . '" type="audio/mp3" id="bp_media_audio_' . $media->get_id() . '" controls="controls" preload="none" ></audio><script>bp_media_create_element("bp_media_audio_' . $media->get_id() . '");</script>', $media);
863
+ break;
864
+ case 'image' :
865
+ $image_array = image_downsize($media->get_id(), 'thumbnail');
866
+ $content.=apply_filters('bp_media_ajax_thumbnail_filter', '<img src="' . $image_array[0] . '" id="bp_media_image_' . $media->get_id() . '" />', $media);
867
+ break;
868
+ default :
869
+ return false;
870
+ }
871
+
872
+ echo $content;
873
+ die();
874
+ }
875
+
876
+ public function default_user_album() {
877
+ $album_id = 0;
878
+ if (is_user_logged_in()) {
879
+ $current_user_id = get_current_user_id();
880
+ $album_id = get_user_meta($current_user_id, 'bp-media-default-album', true);
881
+ if (!$album_id) {
882
+ $query = new WP_Query(array('post_type' => 'bp_media_album', 'author' => $current_user_id, 'order' => 'ASC', 'posts_per_page' => 1));
883
+ wp_reset_postdata();
884
+ if (isset($query->posts) && isset($query->posts[0])) {
885
+ $album_id = $query->posts[0]->ID;
886
+ }
887
+ if ($album_id) {
888
+ update_user_meta($current_user_id, 'bp-media-default-album', $album_id);
889
+ }
890
+ }
891
+ return $album_id;
892
+ }
893
+ }
894
+
895
+ public function default_group_album() {
896
+ $album_id = 0;
897
+ if ($group_id = bp_get_current_group_id()) {
898
+ $album_id = groups_get_groupmeta($group_id, 'bp_media_default_album');
899
+ if (!$album_id) {
900
+ $args = array(
901
+ 'post_type' => 'bp_media_album',
902
+ 'posts_per_page' => 1,
903
+ 'meta_key' => 'bp-media-key',
904
+ 'meta_value' => -$group_id,
905
+ 'meta_compare' => '=',
906
+ 'order' => 'ASC'
907
+ );
908
+ $query = new WP_Query($args);
909
+ wp_reset_postdata();
910
+ if (isset($query->posts) && isset($query->posts[0])) {
911
+ $album_id = $query->posts[0]->ID;
912
+ }
913
+ if ($album_id) {
914
+ groups_update_groupmeta($group_id, 'bp_media_default_album', $album_id);
915
+ }
916
+ }
917
+ }
918
+ return $album_id;
919
+ }
920
 
921
  }
922
  ?>
app/main/includes/BPMediaFunction.php CHANGED
@@ -17,10 +17,10 @@ class BPMediaFunction {
17
  */
18
  static function record_activity($args = '') {
19
  global $bp;
20
- if(!bp_is_active('activity'))
21
- return false;
22
  $defaults = array(
23
- 'component' => BP_MEDIA_SLUG, // The name/ID of the component e.g. groups, profile, mycomponent
24
  );
25
  add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags');
26
  $r = wp_parse_args($args, $defaults);
@@ -62,6 +62,7 @@ class BPMediaFunction {
62
  $activity_allowedtags['a']['title'] = array();
63
  $activity_allowedtags['a']['href'] = array();
64
  $activity_allowedtags['ul'] = array();
 
65
  $activity_allowedtags['li'] = array();
66
 
67
  return $activity_allowedtags;
@@ -190,6 +191,7 @@ class BPMediaFunction {
190
  * @param type $delete_media_id
191
  */
192
  static function update_album_activity($album, $current_time = true, $delete_media_id = null) {
 
193
  if (!is_object($album)) {
194
  $album = new BPMediaAlbum($album);
195
  }
@@ -202,13 +204,13 @@ class BPMediaFunction {
202
  $args['exclude'] = $delete_media_id;
203
  $attachments = get_posts($args);
204
  if (is_array($attachments)) {
205
- $content = '<ul>';
206
  foreach ($attachments as $media) {
207
  $bp_media = new BPMediaHostWordpress($media->ID);
208
  $content .= $bp_media->get_album_activity_content();
209
  }
210
  $content .= '</ul>';
211
- $activity_id = get_post_meta($album->get_id(), 'bp_media_child_activity');
212
  if ($activity_id) {
213
  $args = array(
214
  'in' => $activity_id,
@@ -216,15 +218,22 @@ class BPMediaFunction {
216
 
217
  $activity = @bp_activity_get($args);
218
  if (isset($activity['activities'][0]->id)) {
 
 
 
 
 
 
 
219
  $args = array(
220
  'content' => $content,
221
  'id' => $activity_id,
222
  'type' => 'album_updated',
223
  'user_id' => $activity['activities'][0]->user_id,
224
  '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>')),
225
- 'component' => BP_MEDIA_SLUG, // The name/ID of the component e.g. groups, profile, mycomponent
226
  'primary_link' => $activity['activities'][0]->primary_link,
227
- 'item_id' => $activity['activities'][0]->item_id,
228
  'secondary_item_id' => $activity['activities'][0]->secondary_item_id,
229
  'recorded_time' => $current_time ? bp_core_current_time() : $activity['activities'][0]->date_recorded,
230
  'hide_sitewide' => $activity['activities'][0]->hide_sitewide
17
  */
18
  static function record_activity($args = '') {
19
  global $bp;
20
+ if (!bp_is_active('activity'))
21
+ return false;
22
  $defaults = array(
23
+ 'component' => $bp->activity->id, // The name/ID of the component e.g. groups, profile, mycomponent
24
  );
25
  add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags');
26
  $r = wp_parse_args($args, $defaults);
62
  $activity_allowedtags['a']['title'] = array();
63
  $activity_allowedtags['a']['href'] = array();
64
  $activity_allowedtags['ul'] = array();
65
+ $activity_allowedtags['ul']['class'] = array();
66
  $activity_allowedtags['li'] = array();
67
 
68
  return $activity_allowedtags;
191
  * @param type $delete_media_id
192
  */
193
  static function update_album_activity($album, $current_time = true, $delete_media_id = null) {
194
+ global $bp;
195
  if (!is_object($album)) {
196
  $album = new BPMediaAlbum($album);
197
  }
204
  $args['exclude'] = $delete_media_id;
205
  $attachments = get_posts($args);
206
  if (is_array($attachments)) {
207
+ $content = '<ul class="bp-media-list-media">';
208
  foreach ($attachments as $media) {
209
  $bp_media = new BPMediaHostWordpress($media->ID);
210
  $content .= $bp_media->get_album_activity_content();
211
  }
212
  $content .= '</ul>';
213
+ $activity_id = get_post_meta($album->get_id(), 'bp_media_child_activity',true);
214
  if ($activity_id) {
215
  $args = array(
216
  'in' => $activity_id,
218
 
219
  $activity = @bp_activity_get($args);
220
  if (isset($activity['activities'][0]->id)) {
221
+ if (isset($_POST['bp_media_group_id'])) {
222
+ $component = $bp->groups->id;
223
+ $item_id = $_POST['bp_media_group_id'];
224
+ } else {
225
+ $component = $bp->activity->id;
226
+ $item_id = $activity['activities'][0]->item_id;
227
+ }
228
  $args = array(
229
  'content' => $content,
230
  'id' => $activity_id,
231
  'type' => 'album_updated',
232
  'user_id' => $activity['activities'][0]->user_id,
233
  '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>')),
234
+ 'component' => $component, // The name/ID of the component e.g. groups, profile, mycomponent
235
  'primary_link' => $activity['activities'][0]->primary_link,
236
+ 'item_id' => $item_id,
237
  'secondary_item_id' => $activity['activities'][0]->secondary_item_id,
238
  'recorded_time' => $current_time ? bp_core_current_time() : $activity['activities'][0]->date_recorded,
239
  'hide_sitewide' => $activity['activities'][0]->hide_sitewide
app/main/includes/BPMediaHostWordpress.php CHANGED
@@ -49,7 +49,7 @@ class BPMediaHostWordpress {
49
  * @return boolean
50
  * @throws Exception
51
  */
52
- function init( $media_id = '' ) {
53
  if ( is_object( $media_id ) ) {
54
  $media = $media_id;
55
  } else {
@@ -65,12 +65,14 @@ class BPMediaHostWordpress {
65
  $this->type = $result[ 0 ][ 0 ];
66
  else
67
  return false;
68
- // $required_access = BPMediaPrivacy::required_access($media->ID);
69
- // $current_access = BPMediaPrivacy::current_access($media->ID);
70
- // $has_access = BPMediaPrivacy::has_access($media->ID);
 
 
71
 
72
  global $bp;
73
- // $messages = BPMediaPrivacy::get_messages( $this->type,$bp->displayed_user->fullname );
74
  $this->id = $media->ID;
75
  $meta_key = get_post_meta( $this->id, 'bp-media-key', true );
76
 
@@ -82,11 +84,11 @@ class BPMediaHostWordpress {
82
  * we use it as negative value in the bp-media-key meta key
83
  */
84
  $this->group_id = $meta_key < 0 ? -$meta_key : 0;
85
- // if($this->group_id<=0){
86
- // if(!$has_access){
87
- // //throw new Exception($messages[$required_access]);
88
- // }
89
- // }
90
 
91
  $this->description = $media->post_content;
92
  $this->name = $media->post_title;
@@ -245,6 +247,22 @@ class BPMediaHostWordpress {
245
  return $attachment_id;
246
  }
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  /**
249
  * Fetches the content of the activity of media upload based on its type
250
  *
@@ -360,7 +378,7 @@ class BPMediaHostWordpress {
360
  return false;
361
  }
362
  $content .= '</div>';
363
- $content .= '<div class="bp_media_description">' . wp_html_excerpt( $this->description, $bp_media_default_excerpts[ 'single_entry_description' ] ) . '</div>';
364
  return $content;
365
  }
366
 
@@ -390,7 +408,6 @@ class BPMediaHostWordpress {
390
  * @return boolean
391
  */
392
  function get_media_gallery_content() {
393
- global $bp_media;
394
  $attachment = $this->id;
395
  switch ( $this->type ) {
396
  case 'video' :
@@ -401,7 +418,7 @@ class BPMediaHostWordpress {
401
  $thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
402
  }
403
  ?>
404
- <li>
405
  <a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>">
406
  <img src="<?php echo apply_filters( 'bp_media_video_thumb', $thumb_url, $attachment, $this->type ); ?>" />
407
  </a>
@@ -417,11 +434,12 @@ class BPMediaHostWordpress {
417
  $thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
418
  }
419
  ?>
420
- <li>
421
  <a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>">
422
  <img src="<?php echo $thumb_url ?>" />
423
  </a>
424
  <h3 title="<?php echo $this->name; ?>"><a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>"><?php echo $this->name ?></a></h3>
 
425
  </li>
426
  <?php
427
  break;
@@ -429,11 +447,12 @@ class BPMediaHostWordpress {
429
  $medium_array = image_downsize( $attachment, 'thumbnail' );
430
  $medium_path = $medium_array[ 0 ];
431
  ?>
432
- <li>
433
  <a href="<?php echo $this->url ?>" title="<?php echo $this->description ?>">
434
  <img src="<?php echo $medium_path ?>" />
435
  </a>
436
  <h3 title="<?php echo $this->name ?>"><a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>"><?php echo $this->name ?></a></h3>
 
437
  </li>
438
  <?php
439
  break;
@@ -490,8 +509,8 @@ class BPMediaHostWordpress {
490
  <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>
491
  <?php endif; ?>
492
  <?php endif; ?>
493
- <?php if ( bp_activity_user_can_delete() ) bp_activity_delete_link(); ?>
494
  <?php do_action( 'bp_activity_entry_meta' ); ?>
 
495
  </div>
496
  <?php endif; ?>
497
  </div>
@@ -622,13 +641,20 @@ class BPMediaHostWordpress {
622
  'in' => $activities[ 0 ]->id
623
  ) );
624
  foreach ( $activities_template->activities as $activity ) {
 
 
 
 
 
 
 
625
  $args = array(
626
  'content' => $this->get_media_activity_content(),
627
  'id' => $activity->id,
628
- 'type' => 'media_upload',
629
  'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN ), bp_core_get_userlink( $this->get_author() ), '<a href="' . $this->get_url() . '">' . $this->get_media_activity_type() . '</a>' ) ),
630
  'primary_link' => $this->get_url(),
631
- 'item_id' => $this->get_id(),
632
  'recorded_time' => $activity->date_recorded,
633
  'user_id' => $this->get_author()
634
  );
@@ -940,5 +966,9 @@ class BPMediaHostWordpress {
940
  return $post_id;
941
  }
942
 
 
 
 
 
943
  }
944
  ?>
49
  * @return boolean
50
  * @throws Exception
51
  */
52
+ function init( $media_id = '') {
53
  if ( is_object( $media_id ) ) {
54
  $media = $media_id;
55
  } else {
65
  $this->type = $result[ 0 ][ 0 ];
66
  else
67
  return false;
68
+
69
+ $required_access = BPMediaPrivacy::required_access($media->ID);
70
+ $current_access = BPMediaPrivacy::current_access($media->ID);
71
+ $has_access = BPMediaPrivacy::has_access($media->ID);
72
+
73
 
74
  global $bp;
75
+ $messages = BPMediaPrivacy::get_messages( $this->type,$bp->displayed_user->fullname );
76
  $this->id = $media->ID;
77
  $meta_key = get_post_meta( $this->id, 'bp-media-key', true );
78
 
84
  * we use it as negative value in the bp-media-key meta key
85
  */
86
  $this->group_id = $meta_key < 0 ? -$meta_key : 0;
87
+ if($this->group_id<=0){
88
+ if(!$has_access){
89
+ throw new Exception('<img src="'.BP_MEDIA_URL.'app/assets/img/private.png" title="'. $messages[$required_access] . '" />');
90
+ }
91
+ }
92
 
93
  $this->description = $media->post_content;
94
  $this->name = $media->post_title;
247
  return $attachment_id;
248
  }
249
 
250
+ function get_media_thumbnail($size='thumbnail'){
251
+ $thumb = '';
252
+ if(in_array($this->type, array('image','video','audio'))){
253
+ if ( $this->thumbnail_id ) {
254
+ $medium_array = image_downsize( $this->thumbnail_id, $size );
255
+ $thumb_url = $medium_array[ 0 ];
256
+ } else {
257
+ $thumb_url = BP_MEDIA_URL . 'app/assets/img/'.$this->type.'_thumb.png';
258
+ }
259
+ $thumb = apply_filters( 'bp_media_video_thumb', $thumb_url, $this->thumbnail_id, $this->type );
260
+ return $thumb;
261
+ }
262
+ return false;
263
+
264
+ }
265
+
266
  /**
267
  * Fetches the content of the activity of media upload based on its type
268
  *
378
  return false;
379
  }
380
  $content .= '</div>';
381
+ $content .= '<div class="bp_media_description">' . nl2br($this->description) . '</div>';
382
  return $content;
383
  }
384
 
408
  * @return boolean
409
  */
410
  function get_media_gallery_content() {
 
411
  $attachment = $this->id;
412
  switch ( $this->type ) {
413
  case 'video' :
418
  $thumb_url = BP_MEDIA_URL . 'app/assets/img/video_thumb.png';
419
  }
420
  ?>
421
+ <li id="bp-media-item-<?php echo $this->id?>">
422
  <a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>">
423
  <img src="<?php echo apply_filters( 'bp_media_video_thumb', $thumb_url, $attachment, $this->type ); ?>" />
424
  </a>
434
  $thumb_url = BP_MEDIA_URL . 'app/assets/img/audio_thumb.png';
435
  }
436
  ?>
437
+ <li id="bp-media-item-<?php echo $this->id?>">
438
  <a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>">
439
  <img src="<?php echo $thumb_url ?>" />
440
  </a>
441
  <h3 title="<?php echo $this->name; ?>"><a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>"><?php echo $this->name ?></a></h3>
442
+ <div class="bp-media-ajax-preloader"></div>
443
  </li>
444
  <?php
445
  break;
447
  $medium_array = image_downsize( $attachment, 'thumbnail' );
448
  $medium_path = $medium_array[ 0 ];
449
  ?>
450
+ <li id="bp-media-item-<?php echo $this->id?>">
451
  <a href="<?php echo $this->url ?>" title="<?php echo $this->description ?>">
452
  <img src="<?php echo $medium_path ?>" />
453
  </a>
454
  <h3 title="<?php echo $this->name ?>"><a href="<?php echo $this->url ?>" title="<?php _e( $this->description, BP_MEDIA_TXT_DOMAIN ); ?>"><?php echo $this->name ?></a></h3>
455
+ <div class="bp-media-ajax-preloader"></div>
456
  </li>
457
  <?php
458
  break;
509
  <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>
510
  <?php endif; ?>
511
  <?php endif; ?>
 
512
  <?php do_action( 'bp_activity_entry_meta' ); ?>
513
+ <?php if ( bp_activity_user_can_delete() ) bp_activity_delete_link(); ?>
514
  </div>
515
  <?php endif; ?>
516
  </div>
641
  'in' => $activities[ 0 ]->id
642
  ) );
643
  foreach ( $activities_template->activities as $activity ) {
644
+ if (isset($_POST['bp_media_group_id'])) {
645
+ $component = $bp->groups->id;
646
+ $item_id = $_POST['bp_media_group_id'];
647
+ } else {
648
+ $component = $bp->activity->id;
649
+ $item_id = $this->get_id();
650
+ }
651
  $args = array(
652
  'content' => $this->get_media_activity_content(),
653
  'id' => $activity->id,
654
+ 'type' => $component,
655
  'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN ), bp_core_get_userlink( $this->get_author() ), '<a href="' . $this->get_url() . '">' . $this->get_media_activity_type() . '</a>' ) ),
656
  'primary_link' => $this->get_url(),
657
+ 'item_id' => $item_id,
658
  'recorded_time' => $activity->date_recorded,
659
  'user_id' => $this->get_author()
660
  );
966
  return $post_id;
967
  }
968
 
969
+ function get_description(){
970
+ return $this->description;
971
+ }
972
+
973
  }
974
  ?>
app/main/includes/bp-media-upload-handler.php CHANGED
@@ -4,7 +4,6 @@
4
  header( "Cache-Control: no-cache, must-revalidate" ); //HTTP 1.1
5
  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
  /** 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
@@ -31,6 +30,6 @@ require_once( WP_LOAD_PATH . 'wp-load.php');
31
  // Check for rights
32
  if ( ! is_user_logged_in() )
33
  wp_die( __( "You are not allowed to be here" ) );
34
-
35
  BPMediaActions::handle_uploads();
36
  ?>
4
  header( "Cache-Control: no-cache, must-revalidate" ); //HTTP 1.1
5
  header( "Pragma: no-cache" ); //HTTP 1.0
6
  header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
 
7
  ignore_user_abort( true );
8
  /** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
9
  $path = '/'; // It should be end with a trailing slash
30
  // Check for rights
31
  if ( ! is_user_logged_in() )
32
  wp_die( __( "You are not allowed to be here" ) );
33
+ @ini_set('memory_limit','1024M');
34
  BPMediaActions::handle_uploads();
35
  ?>
app/main/privacy/BPMediaPrivacy.php CHANGED
@@ -125,8 +125,8 @@ class BPMediaPrivacy {
125
  __( '<strong>Public</strong>, Visible to the world', BP_MEDIA_TXT_DOMAIN )
126
  )
127
  );
128
- if(!bp_is_active('friends')){
129
- unset($settings[4]);
130
  }
131
  return $settings;
132
  }
@@ -192,8 +192,8 @@ class BPMediaPrivacy {
192
  }
193
  }
194
 
195
- $default_level= BPMediaPrivacy::default_privacy();
196
- if($level == false){
197
  $level = $default_level;
198
  }
199
 
@@ -205,7 +205,8 @@ class BPMediaPrivacy {
205
  function save( $level = 0, $object_id = false ) {
206
  if ( $object_id == false )
207
  return false;
208
- if(!$level)$level = 0;
 
209
  if ( ! array_key_exists( $level, BPMediaPrivacy::get_settings() ) )
210
  $level = 0;
211
 
@@ -218,7 +219,7 @@ class BPMediaPrivacy {
218
  global $bp_media;
219
 
220
  foreach ( $activities->activities as $key => $activity ) {
221
- if ( $activity != null && in_array( $activity->type, $bp_media->activity_types ) ) {
222
  $has_access = BPMediaPrivacy::has_access( $activity->item_id );
223
  if ( ! $has_access ) {
224
 
@@ -227,7 +228,7 @@ class BPMediaPrivacy {
227
  $activities->total_activity_count = $activities->total_activity_count - 1;
228
  $activities->pag_num = $activities->pag_num - 1;
229
  }
230
- }
231
  }
232
  $activities_new = array_values( $activities->activities );
233
  $activities->activities = $activities_new;
@@ -283,7 +284,7 @@ class BPMediaPrivacy {
283
  if ( bp_is_my_profile() ) {
284
  $current_privacy = 6;
285
  }
286
- if ( isset( $bp->displayed_user->id ) )
287
  if ( ! (bp_is_my_profile()) ) {
288
  if ( bp_is_active( 'groups' ) && class_exists( 'BP_Group_Extension' ) ) {
289
  if ( bp_get_current_group_id() == 0 ) {
@@ -294,8 +295,16 @@ class BPMediaPrivacy {
294
  }
295
  }
296
  }
 
 
 
 
 
 
 
297
  }
298
  }
 
299
  }
300
 
301
  return $current_privacy;
125
  __( '<strong>Public</strong>, Visible to the world', BP_MEDIA_TXT_DOMAIN )
126
  )
127
  );
128
+ if ( ! bp_is_active( 'friends' ) ) {
129
+ unset( $settings[ 4 ] );
130
  }
131
  return $settings;
132
  }
192
  }
193
  }
194
 
195
+ $default_level = BPMediaPrivacy::default_privacy();
196
+ if ( $level == false ) {
197
  $level = $default_level;
198
  }
199
 
205
  function save( $level = 0, $object_id = false ) {
206
  if ( $object_id == false )
207
  return false;
208
+ if ( ! $level )
209
+ $level = 0;
210
  if ( ! array_key_exists( $level, BPMediaPrivacy::get_settings() ) )
211
  $level = 0;
212
 
219
  global $bp_media;
220
 
221
  foreach ( $activities->activities as $key => $activity ) {
222
+ //if ( $activity != null && in_array( $activity->type, $bp_media->activity_types ) ) {
223
  $has_access = BPMediaPrivacy::has_access( $activity->item_id );
224
  if ( ! $has_access ) {
225
 
228
  $activities->total_activity_count = $activities->total_activity_count - 1;
229
  $activities->pag_num = $activities->pag_num - 1;
230
  }
231
+ //}
232
  }
233
  $activities_new = array_values( $activities->activities );
234
  $activities->activities = $activities_new;
284
  if ( bp_is_my_profile() ) {
285
  $current_privacy = 6;
286
  }
287
+ if ( isset( $bp->displayed_user->id ) ) {
288
  if ( ! (bp_is_my_profile()) ) {
289
  if ( bp_is_active( 'groups' ) && class_exists( 'BP_Group_Extension' ) ) {
290
  if ( bp_get_current_group_id() == 0 ) {
295
  }
296
  }
297
  }
298
+ } else {
299
+ if ( bp_is_active( 'friends' ) ) {
300
+ $is_friend = friends_check_friendship_status( $bp->loggedin_user->id, $bp->displayed_user->id );
301
+ if ( $is_friend == 'is_friend' ) {
302
+ $current_privacy = 4;
303
+ }
304
+ }
305
  }
306
  }
307
+ }
308
  }
309
 
310
  return $current_privacy;
app/main/profile/BPMediaAlbum.php CHANGED
@@ -99,7 +99,7 @@ class BPMediaAlbum {
99
  $this->description = $album->post_content;
100
  $this->name = $album->post_title;
101
  $this->owner = $album->post_author;
102
- if ($this->group_id > 0) {
103
  $current_group = new BP_Groups_Group($this->group_id);
104
  $group_url = bp_get_group_permalink($current_group);
105
  $this->url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
@@ -169,13 +169,12 @@ class BPMediaAlbum {
169
  );
170
  $album_id = wp_insert_post($post_vars);
171
  if ($group_id) {
172
- add_post_meta($album_id, 'bp-media-key', (-$group_id));
173
  } else {
174
- add_post_meta($album_id, 'bp-media-key', $author_id);
175
  }
176
  $this->init($album_id);
177
  do_action('bp_media_after_add_album', $this);
178
- return $album_id;
179
  }
180
 
181
 
99
  $this->description = $album->post_content;
100
  $this->name = $album->post_title;
101
  $this->owner = $album->post_author;
102
+ if ($this->group_id > 0 && bp_is_active('groups')) {
103
  $current_group = new BP_Groups_Group($this->group_id);
104
  $group_url = bp_get_group_permalink($current_group);
105
  $this->url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
169
  );
170
  $album_id = wp_insert_post($post_vars);
171
  if ($group_id) {
172
+ update_post_meta($album_id, 'bp-media-key', (-$group_id));
173
  } else {
174
+ update_post_meta($album_id, 'bp-media-key', $author_id);
175
  }
176
  $this->init($album_id);
177
  do_action('bp_media_after_add_album', $this);
 
178
  }
179
 
180
 
app/main/profile/BPMediaAlbumScreen.php CHANGED
@@ -14,209 +14,226 @@ class BPMediaAlbumScreen extends BPMediaScreen {
14
 
15
  var $filters;
16
 
17
- /**
18
- *
19
- * @param type $media_type
20
- * @param type $slug
21
- */
22
- public function __construct($media_type, $slug) {
23
- parent::__construct($media_type, $slug);
24
- }
25
-
26
- /**
27
- *
28
- * @global type $bp
29
- */
30
- function screen() {
31
- global $bp;
32
- if (isset($bp->action_variables[0])) {
33
- switch ($bp->action_variables[0]) {
34
- case BP_MEDIA_ALBUMS_EDIT_SLUG :
35
- $this->edit_screen();
36
- break;
37
- case BP_MEDIA_ALBUMS_VIEW_SLUG:
38
- $this->entry_screen();
39
- $this->template_actions('entry_screen');
40
- break;
41
- case BP_MEDIA_DELETE_SLUG :
42
- if (!isset($bp->action_variables[1])) {
43
- $this->page_not_exist();
44
- }
45
- $this->entry_delete();
46
- break;
47
- default:
48
- $this->set_query();
49
- $this->template_actions('screen');
50
- }
51
- } else {
52
- $this->set_query();
53
- $this->template_actions('screen');
54
- }
55
- $this->template->loader();
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() {
68
- global $bp_media_albums_query;
69
-
70
- $this->hook_before();
71
-
72
- if ($bp_media_albums_query && $bp_media_albums_query->have_posts()):
73
- echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
74
- while ($bp_media_albums_query->have_posts()) : $bp_media_albums_query->the_post();
75
- $this->template->the_album_content();
76
- endwhile;
77
- echo '</ul>';
78
- $this->template->show_more('albums');
79
- else:
80
- BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
81
- endif;
82
- $this->hook_after();
83
- }
84
-
85
- /**
86
- *
87
- * @global type $bp
88
- * @global BPMediaAlbum $bp_media_current_album
89
- * @return boolean
90
- */
91
- function entry_screen() {
92
- global $bp, $bp_media_current_album;
93
- if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
94
- return false;
95
- try {
96
- $bp_media_current_album = new BPMediaAlbum($bp->action_variables[1]);
97
- } catch (Exception $e) {
98
- /* Send the values to the cookie for page reload display */
99
- @setcookie('bp-message', $_COOKIE['bp-message'], time() + 60 * 60 * 24, COOKIEPATH);
100
- @setcookie('bp-message-type', $_COOKIE['bp-message-type'], time() + 60 * 60 * 24, COOKIEPATH);
101
- $this->template->redirect($this->media_const);
102
- exit;
103
- }
104
- }
105
-
106
- /**
107
- *
108
- * @global type $bp
109
- * @global BPMediaAlbum $bp_media_current_album
110
- * @global type $bp_media_query
111
- * @return boolean
112
- */
113
- function entry_screen_content() {
114
- global $bp, $bp_media_current_album, $bp_media_query;
115
- if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
116
- return false;
117
- if (bp_displayed_user_id() == bp_loggedin_user_id()) {
118
- echo '<div class="album-edit">';
119
- echo '<a href="' . $bp_media_current_album->get_edit_url() . '" class="button item-button bp-secondary-action bp-media-edit bp-media-edit-album" title="' . __('Edit Album', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
120
- 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>';
121
- echo '</div>';
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 albums item-list">';
127
- if (bp_is_my_profile() || BPMediaGroupLoader::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() || BPMediaGroupLoader::can_upload()) {
140
- echo '<div class="bp-media-area-allocate"></div>';
141
- BPMediaUploadScreen::upload_screen_content();
142
- }
143
- endif;
144
- $this->hook_after();
145
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
  function entry_screen_title() {
148
 
149
- global $bp_media_current_album;
150
- /** @var $bp_media_current_entry BPMediaHostWordpress */
151
- if (is_object($bp_media_current_album))
152
- echo $bp_media_current_album->get_title();
153
- }
154
-
155
- /**
156
- *
157
- * @global type $bp
158
- * @global type $bp_media_albums_query
159
- */
160
- function set_query() {
161
- global $bp, $bp_media_albums_query;
162
- if (isset($bp->action_variables) && is_array($bp->action_variables) && isset($bp->action_variables[0]) && $bp->action_variables[0] == 'page' && isset($bp->action_variables[1]) && is_numeric($bp->action_variables[1])) {
163
- $paged = $bp->action_variables[1];
164
- } else {
165
- $paged = 1;
166
- }
167
- if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
168
- $query = new BPMediaQuery();
169
- $args = $query->init('album');
170
- $bp_media_albums_query = new WP_Query($args);
171
- }
172
- }
173
-
174
-
175
-
176
- /**
177
- *
178
- * @global type $bp
179
- * @global type $bp_media_query
180
- * @param type $album_id
181
- */
182
- function inner_query($album_id = 0) {
183
- global $bp, $bp_media_query;
184
- $paged = 0;
185
- $action_variables = isset($bp->canonical_stack['action_variables']) ? $bp->canonical_stack['action_variables'] : null;
186
- if (isset($action_variables) && is_array($action_variables) && isset($action_variables[0])) {
187
- if ($action_variables[0] == 'page' && isset($action_variables[1]) && is_numeric($action_variables[1]))
188
- $paged = $action_variables[1];
189
- else if (isset($action_variables[1]) && $action_variables[1] == 'page' && isset($action_variables[2]) && is_numeric($action_variables[2]))
190
- $paged = $action_variables[2];
191
- }
192
- if (!$paged)
193
- $paged = 1;
194
  $this->filter_entries();
195
- if($bp->current_component=='groups'){
196
- $query = new BPMediaQuery();
197
- $args = $query->init(false,$album_id,false,$paged);
198
- $bp_media_query = new WP_Query($args);
 
 
 
 
 
199
  }
200
- if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
201
- $query = new BPMediaQuery();
202
- $args = $query->init(false,$album_id,false,$paged);
203
- $bp_media_query = new WP_Query($args);
204
- }
205
- }
206
-
207
- function filter_entries(){
208
  global $bp_media;
209
  $enabled = $bp_media->enabled();
210
- if(isset($enabled['upload'])) unset($enabled['upload']);
211
- if(isset($enabled['album'])) unset($enabled['album']);
212
- foreach($enabled as $type=>$active){
213
- if($active==true){
214
- $filters[] = $type;
 
 
215
  }
216
-
217
  }
218
 
219
- if(count($filters)==1) $filters = $filters[0];
 
220
  $this->filters = $filters;
221
  }
222
 
14
 
15
  var $filters;
16
 
17
+ /**
18
+ *
19
+ * @param type $media_type
20
+ * @param type $slug
21
+ */
22
+ public function __construct( $media_type, $slug ) {
23
+ parent::__construct( $media_type, $slug );
24
+ }
25
+
26
+ /**
27
+ *
28
+ * @global type $bp
29
+ */
30
+ function screen() {
31
+ global $bp;
32
+ if ( isset( $bp->action_variables[ 0 ] ) ) {
33
+ switch ( $bp->action_variables[ 0 ] ) {
34
+ case BP_MEDIA_ALBUMS_EDIT_SLUG :
35
+ $this->edit_screen();
36
+ break;
37
+ case BP_MEDIA_ALBUMS_VIEW_SLUG:
38
+ $this->entry_screen();
39
+ $this->template_actions( 'entry_screen' );
40
+ break;
41
+ case BP_MEDIA_DELETE_SLUG :
42
+ if ( ! isset( $bp->action_variables[ 1 ] ) ) {
43
+ $this->page_not_exist();
44
+ }
45
+ $this->entry_delete();
46
+ break;
47
+ default:
48
+ $this->set_query();
49
+ $this->template_actions( 'screen' );
50
+ }
51
+ } else {
52
+ $this->set_query();
53
+ $this->template_actions( 'screen' );
54
+ }
55
+ $this->template->loader();
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() {
68
+ global $bp_media_albums_query;
69
+
70
+ $this->hook_before();
71
+
72
+ if ( $bp_media_albums_query && $bp_media_albums_query->have_posts() ):
73
+ echo '<ul id="bp-album-list" class="bp-media-gallery item-list">';
74
+ while ( $bp_media_albums_query->have_posts() ) : $bp_media_albums_query->the_post();
75
+ $this->template->the_album_content();
76
+ endwhile;
77
+ echo '</ul>';
78
+ $this->template->show_more( 'albums' );
79
+ else:
80
+ BPMediaFunction::show_formatted_error_message( sprintf( __( 'Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN ), $this->slug ), 'info' );
81
+ endif;
82
+ $this->hook_after();
83
+ }
84
+
85
+ /**
86
+ *
87
+ * @global type $bp
88
+ * @global BPMediaAlbum $bp_media_current_album
89
+ * @return boolean
90
+ */
91
+ function entry_screen() {
92
+ global $bp, $bp_media_current_album;
93
+ if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
94
+ return false;
95
+ try {
96
+ $bp_media_current_album = new BPMediaAlbum( $bp->action_variables[ 1 ] );
97
+ } catch ( Exception $e ) {
98
+ /* Send the values to the cookie for page reload display */
99
+ @setcookie( 'bp-message', $_COOKIE[ 'bp-message' ], time() + 60 * 60 * 24, COOKIEPATH );
100
+ @setcookie( 'bp-message-type', $_COOKIE[ 'bp-message-type' ], time() + 60 * 60 * 24, COOKIEPATH );
101
+ $this->template->redirect( $this->media_const );
102
+ exit;
103
+ }
104
+ }
105
+
106
+ /**
107
+ *
108
+ * @global type $bp
109
+ * @global BPMediaAlbum $bp_media_current_album
110
+ * @global type $bp_media_query
111
+ * @return boolean
112
+ */
113
+ function entry_screen_content() {
114
+ global $bp, $bp_media_current_album, $bp_media_query;
115
+ if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
116
+ return false;
117
+ $allowed_edit = false;
118
+ if ( is_user_logged_in() ) {
119
+ if(!bp_is_user()){
120
+ if ( bp_is_active( 'groups' ) ) {
121
+ if ( groups_is_user_admin( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
122
+ $allowed_edit = true;
123
+ } elseif ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
124
+ $allowed_edit = true;
125
+ }
126
+ }
127
+ } else {
128
+ if ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
129
+ $allowed_edit = true;
130
+ }
131
+ }
132
+
133
+ if ( $allowed_edit != false ) {
134
+ echo '<div class="album-edit">';
135
+ echo '<a href="' . $bp_media_current_album->get_edit_url() . '" class="button item-button bp-secondary-action bp-media-edit bp-media-edit-album" title="' . __( 'Edit Album', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Edit', BP_MEDIA_TXT_DOMAIN ) . '</a>';
136
+ 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>';
137
+ echo '</div>';
138
+ }
139
+ }
140
+ $this->inner_query( $bp_media_current_album->get_id() );
141
+ $this->hook_before();
142
+ if ( $bp_media_current_album && $bp_media_query->have_posts() ):
143
+ echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
144
+ if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
145
+ echo '<li>';
146
+ BPMediaUploadScreen::upload_screen_content();
147
+ echo '</li>';
148
+ }
149
+ while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
150
+ $this->template->the_content();
151
+ endwhile;
152
+ echo '</ul>';
153
+ $this->template->show_more();
154
+ else:
155
+ BPMediaFunction::show_formatted_error_message( __( 'Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN ), 'info' );
156
+ if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
157
+ echo '<div class="bp-media-area-allocate"></div>';
158
+ BPMediaUploadScreen::upload_screen_content();
159
+ }
160
+ endif;
161
+ $this->hook_after();
162
+ }
163
 
164
  function entry_screen_title() {
165
 
166
+ global $bp_media_current_album;
167
+ /** @var $bp_media_current_entry BPMediaHostWordpress */
168
+ if ( is_object( $bp_media_current_album ) )
169
+ echo $bp_media_current_album->get_title();
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @global type $bp
175
+ * @global type $bp_media_albums_query
176
+ */
177
+ function set_query() {
178
+ global $bp, $bp_media_albums_query;
179
+ if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
180
+ $paged = $bp->action_variables[ 1 ];
181
+ } else {
182
+ $paged = 1;
183
+ }
184
+ if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
185
+ $query = new BPMediaQuery();
186
+ $args = $query->init( 'album' );
187
+ $bp_media_albums_query = new WP_Query( $args );
188
+ }
189
+ }
190
+
191
+ /**
192
+ *
193
+ * @global type $bp
194
+ * @global type $bp_media_query
195
+ * @param type $album_id
196
+ */
197
+ function inner_query( $album_id = 0 ) {
198
+ global $bp, $bp_media_query;
199
+ $paged = 0;
200
+ $action_variables = isset( $bp->canonical_stack[ 'action_variables' ] ) ? $bp->canonical_stack[ 'action_variables' ] : null;
201
+ if ( isset( $action_variables ) && is_array( $action_variables ) && isset( $action_variables[ 0 ] ) ) {
202
+ if ( $action_variables[ 0 ] == 'page' && isset( $action_variables[ 1 ] ) && is_numeric( $action_variables[ 1 ] ) )
203
+ $paged = $action_variables[ 1 ];
204
+ else if ( isset( $action_variables[ 1 ] ) && $action_variables[ 1 ] == 'page' && isset( $action_variables[ 2 ] ) && is_numeric( $action_variables[ 2 ] ) )
205
+ $paged = $action_variables[ 2 ];
206
+ }
207
+ if ( ! $paged )
208
+ $paged = 1;
 
 
209
  $this->filter_entries();
210
+ if ( $bp->current_component == 'groups' ) {
211
+ $query = new BPMediaQuery();
212
+ $args = $query->init( false, $album_id, false, $paged );
213
+ $bp_media_query = new WP_Query( $args );
214
+ }
215
+ if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
216
+ $query = new BPMediaQuery();
217
+ $args = $query->init( false, $album_id, false, $paged );
218
+ $bp_media_query = new WP_Query( $args );
219
  }
220
+ }
221
+
222
+ function filter_entries() {
 
 
 
 
 
223
  global $bp_media;
224
  $enabled = $bp_media->enabled();
225
+ if ( isset( $enabled[ 'upload' ] ) )
226
+ unset( $enabled[ 'upload' ] );
227
+ if ( isset( $enabled[ 'album' ] ) )
228
+ unset( $enabled[ 'album' ] );
229
+ foreach ( $enabled as $type => $active ) {
230
+ if ( $active == true ) {
231
+ $filters[ ] = $type;
232
  }
 
233
  }
234
 
235
+ if ( count( $filters ) == 1 )
236
+ $filters = $filters[ 0 ];
237
  $this->filters = $filters;
238
  }
239
 
app/main/profile/BPMediaScreen.php CHANGED
@@ -186,7 +186,7 @@ class BPMediaScreen {
186
  BPMediaUploadScreen::upload_screen_content();
187
  echo '</li>';
188
  }
189
- while ($bp_media_query->have_posts() ) : $bp_media_query->the_post();
190
  $this->template->the_content();
191
  endwhile;
192
  echo '</ul>';
@@ -223,7 +223,6 @@ class BPMediaScreen {
223
  $this->template->redirect($this->media_const);
224
  exit;
225
  }
226
-
227
  $this->template_actions('entry_screen');
228
  $this->template->loader();
229
  }
@@ -252,9 +251,19 @@ class BPMediaScreen {
252
  $this->hook_before();
253
  if (!$bp->action_variables[0] == constant($entryslug))
254
  return false;
255
- echo '<div class="bp-media-single bp-media-image">';
 
256
  echo $bp_media_current_entry->get_media_single_content();
 
 
 
 
 
 
 
 
257
  echo $bp_media_current_entry->show_comment_form();
 
258
  echo '</div>';
259
  $this->hook_after();
260
  }
@@ -315,22 +324,22 @@ class BPMediaScreen {
315
  ?>
316
  <form method="post" class="standard-form" id="bp-media-upload-form">
317
  <label for="bp-media-upload-input-title">
318
- <?php printf(__('%s Title', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
319
  </label>
320
  <input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
321
  maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_title'], $bp_media_default_excerpts['activity_entry_title'])) ?>"
322
  value="<?php echo $bp_media_current_entry->get_title(); ?>" />
323
  <label for="bp-media-upload-input-description">
324
- <?php printf(__('%s Description', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
325
  </label>
326
- <input id="bp-media-upload-input-description" type="text" name="bp_media_description" class="settings-input"
327
- maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
328
- value="<?php echo $bp_media_current_entry->get_content(); ?>" />
329
- <?php do_action('bp_media_add_media_fields', $this->media_type); ?>
330
  <div class="submit">
331
  <input type="submit" class="auto" value="<?php _e('Update', BP_MEDIA_TXT_DOMAIN); ?>" />
332
  <a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', BP_MEDIA_TXT_DOMAIN); ?>">
333
- <?php _e('Back to Media', BP_MEDIA_TXT_DOMAIN); ?>
334
  </a>
335
  </div>
336
  </form>
@@ -376,10 +385,10 @@ class BPMediaScreen {
376
  exit;
377
  }
378
  $post_id = $bp_media_current_entry->get_id();
379
- if(bp_is_active('activity')){
380
- $activity_id = get_post_meta($post_id, 'bp_media_child_activity', true);
381
- bp_activity_delete_by_activity_id($activity_id);
382
- }
383
  $bp_media_current_entry->delete_media();
384
 
385
  @setcookie('bp-message', __('Media deleted successfully', BP_MEDIA_TXT_DOMAIN), time() + 60 * 60 * 24, COOKIEPATH);
@@ -417,14 +426,14 @@ class BPMediaScreen {
417
  */
418
  public function set_query() {
419
  global $bp, $bp_media_query;
420
- if(bp_is_current_component('groups')){
421
- global $bp_media;
422
- $def_tab=$bp_media->defaults_tab();
423
- $type_var = isset($bp->action_variables[0])?$bp->action_variables[0]:constant('BP_MEDIA_'.strtoupper($def_tab).'_SLUG');
424
- }else{
425
-
426
- $type_var = $bp->current_action;
427
- }
428
  switch ($type_var) {
429
  case BP_MEDIA_IMAGES_SLUG:
430
  $type = 'image';
@@ -439,9 +448,9 @@ class BPMediaScreen {
439
  $type = null;
440
  }
441
 
442
- $query = new BPMediaQuery();
443
- $args = $query->init($type);
444
- $bp_media_query = new WP_Query($args);
445
  }
446
 
447
  }
186
  BPMediaUploadScreen::upload_screen_content();
187
  echo '</li>';
188
  }
189
+ while ($bp_media_query->have_posts()) : $bp_media_query->the_post();
190
  $this->template->the_content();
191
  endwhile;
192
  echo '</ul>';
223
  $this->template->redirect($this->media_const);
224
  exit;
225
  }
 
226
  $this->template_actions('entry_screen');
227
  $this->template->loader();
228
  }
251
  $this->hook_before();
252
  if (!$bp->action_variables[0] == constant($entryslug))
253
  return false;
254
+ echo '<div class="bp-media-single bp-media-image" id="bp-media-id-'.$bp_media_current_entry->get_id().'">';
255
+ echo '<div class="bp-media-content-wrap" id="bp-media-content-wrap">';
256
  echo $bp_media_current_entry->get_media_single_content();
257
+ echo '</div>';
258
+ echo '<div class="bp-media-meta-content-wrap">';
259
+ echo '<div class="bp-media-mod-title">';
260
+ echo '<h2>';
261
+ $this->entry_screen_title();
262
+ echo '</h2>';
263
+ echo '<p>'.nl2br($bp_media_current_entry->get_description()).'</p>';
264
+ echo '</div>';
265
  echo $bp_media_current_entry->show_comment_form();
266
+ echo '</div>';
267
  echo '</div>';
268
  $this->hook_after();
269
  }
324
  ?>
325
  <form method="post" class="standard-form" id="bp-media-upload-form">
326
  <label for="bp-media-upload-input-title">
327
+ <?php printf(__('%s Title', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
328
  </label>
329
  <input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
330
  maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_title'], $bp_media_default_excerpts['activity_entry_title'])) ?>"
331
  value="<?php echo $bp_media_current_entry->get_title(); ?>" />
332
  <label for="bp-media-upload-input-description">
333
+ <?php printf(__('%s Description', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
334
  </label>
335
+ <textarea id="bp-media-upload-input-description" name="bp_media_description" class="settings-input"
336
+ maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
337
+ ><?php echo $bp_media_current_entry->get_content(); ?></textarea>
338
+ <?php do_action('bp_media_add_media_fields', $this->media_type); ?>
339
  <div class="submit">
340
  <input type="submit" class="auto" value="<?php _e('Update', BP_MEDIA_TXT_DOMAIN); ?>" />
341
  <a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', BP_MEDIA_TXT_DOMAIN); ?>">
342
+ <?php _e('Back to Media', BP_MEDIA_TXT_DOMAIN); ?>
343
  </a>
344
  </div>
345
  </form>
385
  exit;
386
  }
387
  $post_id = $bp_media_current_entry->get_id();
388
+ if (bp_is_active('activity')) {
389
+ $activity_id = get_post_meta($post_id, 'bp_media_child_activity', true);
390
+ bp_activity_delete_by_activity_id($activity_id);
391
+ }
392
  $bp_media_current_entry->delete_media();
393
 
394
  @setcookie('bp-message', __('Media deleted successfully', BP_MEDIA_TXT_DOMAIN), time() + 60 * 60 * 24, COOKIEPATH);
426
  */
427
  public function set_query() {
428
  global $bp, $bp_media_query;
429
+ if (bp_is_current_component('groups')) {
430
+ global $bp_media;
431
+ $def_tab = $bp_media->defaults_tab();
432
+ $type_var = isset($bp->action_variables[0]) ? $bp->action_variables[0] : constant('BP_MEDIA_' . strtoupper($def_tab) . '_SLUG');
433
+ } else {
434
+
435
+ $type_var = $bp->current_action;
436
+ }
437
  switch ($type_var) {
438
  case BP_MEDIA_IMAGES_SLUG:
439
  $type = 'image';
448
  $type = null;
449
  }
450
 
451
+ $query = new BPMediaQuery();
452
+ $args = $query->init($type);
453
+ $bp_media_query = new WP_Query($args);
454
  }
455
 
456
  }
app/main/profile/BPMediaTemplate.php CHANGED
@@ -17,6 +17,9 @@ class BPMediaTemplate {
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">
@@ -61,7 +64,7 @@ class BPMediaTemplate {
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
  ?>
17
  */
18
  function upload_form_multiple() {
19
  global $bp_media_current_album;
20
+ $post_max_size = ini_get('post_max_size');
21
+ $upload_max_filesize = ini_get('upload_max_filesize');
22
+ $memory_limit = ini_get('memory_limit');
23
  $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN); ?>
24
  <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
25
  <div id="drag-drop-area">
64
  } else {
65
  $album->add_album($post_wall, bp_loggedin_user_id());
66
  }
67
+ echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
68
  }
69
  echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
70
  ?>
app/main/widgets/BPMediaWidget.php CHANGED
@@ -29,6 +29,7 @@ if ( ! class_exists( 'BPMediaWidget' ) ) {
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
  $allow= array();
34
  $allowed = array( );
@@ -84,36 +85,47 @@ if ( ! class_exists( 'BPMediaWidget' ) ) {
84
  if ( count( $allowed ) > 3 ) {
85
  unset( $allowed[ 'all' ] );
86
  }
87
- $allowMimeType = array();
88
- echo '<div id="' . $wdType . '-media-tabs" class="media-tabs-container media-tabs-container-tabs">';
89
- echo'<ul>';
90
  foreach ( $allowed as $type ) {
91
  if ( $type != 'all' ) {
92
  array_push( $allowMimeType, $type );
93
- }
94
- echo '<li><a href="#' . $wdType . '-media-tabs-' . $type . '-' . $widgetid . '">';
95
- echo $strings[ $type ];
96
- echo '</a></li>';
97
- }
98
- echo '</ul>';
99
- foreach ( $allowed as $type ) {
100
- echo '<div id="' . $wdType . '-media-tabs-' . $type . '-' . $widgetid . '" class="bp-media-tab-panel">';
101
- $query_type = $type;
102
- if ( $type === 'all' )
103
- $query_type = false;
104
- $query = new BPMediaQuery();
105
- $args = $query->init( $query_type,false,$number );
 
 
 
 
 
106
  $bp_media_widget_query = new WP_Query( $args );
107
- if ( $bp_media_widget_query->have_posts() ) {
108
- echo '<ul class="widget-item-listing">';
109
  while ( $bp_media_widget_query->have_posts() ) {
110
  $bp_media_widget_query->the_post();
111
-
112
  $entry = new BPMediaHostWordpress( get_the_ID() );
113
-
114
  echo $entry->get_media_gallery_content();
115
- }
116
- echo '</ul>';
 
 
 
 
 
 
 
117
  } else {
118
  $media_string = $type;
119
  if ( $type === 'all' ) {
@@ -121,12 +133,12 @@ if ( ! class_exists( 'BPMediaWidget' ) ) {
121
  }
122
  _e( 'No ' . $wdType . ' ' . $media_string . ' found', BP_MEDIA_TXT_DOMAIN );
123
  }
124
- wp_reset_query();
125
 
126
- echo '</div>';
127
- }
128
 
129
- echo '</div>';
130
  }
131
  echo $after_widget;
132
  }
29
  */
30
  function widget( $args, $instance ) {
31
  extract( $args );
32
+ echo $before_widget;
33
  $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? __( 'BuddyPress Media', BP_MEDIA_TXT_DOMAIN ) : $instance[ 'title' ], $instance, $this->id_base );
34
  $allow= array();
35
  $allowed = array( );
85
  if ( count( $allowed ) > 3 ) {
86
  unset( $allowed[ 'all' ] );
87
  }
88
+ $allowMimeType = array(); ?>
89
+ <div id="<?php echo $wdType; ?>-media-tabs" class="media-tabs-container media-tabs-container-tabs">
90
+ <ul><?php
91
  foreach ( $allowed as $type ) {
92
  if ( $type != 'all' ) {
93
  array_push( $allowMimeType, $type );
94
+ } ?>
95
+ <li><a href="#<?php echo $wdType; ?>-media-tabs-<?php echo $type; ?>-<?php echo $widgetid; ?>">
96
+ <?php echo $strings[ $type ]; ?>
97
+ </a></li><?php
98
+ } ?>
99
+ </ul><?php
100
+ foreach ( $allowed as $type ) { ?>
101
+ <div id="<?php echo $wdType; ?>-media-tabs-<?php echo $type; ?>-<?php echo $widgetid; ?>" class="bp-media-tab-panel"><?php
102
+
103
+ $args = array(
104
+ 'post_type' => 'attachment',
105
+ 'post_status' => 'any',
106
+ 'meta_key' => 'bp_media_privacy',
107
+ 'meta_value' => 0,
108
+ 'posts_per_page' => $number
109
+ );
110
+ if ( $type != 'all' )
111
+ $args['post_mime_type'] = $type;
112
  $bp_media_widget_query = new WP_Query( $args );
113
+ if ( $bp_media_widget_query->have_posts() ) { ?>
114
+ <ul class="widget-item-listing"><?php
115
  while ( $bp_media_widget_query->have_posts() ) {
116
  $bp_media_widget_query->the_post();
117
+ try{
118
  $entry = new BPMediaHostWordpress( get_the_ID() );
 
119
  echo $entry->get_media_gallery_content();
120
+ }catch (Exception $e){
121
+ echo '<li>';
122
+ echo $e->getMessage();
123
+ echo '<h3><a>Private</h3>';
124
+ echo '</li>';
125
+ }
126
+
127
+ } ?>
128
+ </ul><?php
129
  } else {
130
  $media_string = $type;
131
  if ( $type === 'all' ) {
133
  }
134
  _e( 'No ' . $wdType . ' ' . $media_string . ' found', BP_MEDIA_TXT_DOMAIN );
135
  }
136
+ wp_reset_query(); ?>
137
 
138
+ </div><?php
139
+ } ?>
140
 
141
+ </div><?php
142
  }
143
  echo $after_widget;
144
  }
index.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
- Description: This plugin adds missing media rich features like photos, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.6.7
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
2
  /*
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
+ Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.7
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
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 CHANGED
Binary file
languages/buddypress-media-pt_BR.mo CHANGED
Binary file
languages/buddypress-media-sr.mo CHANGED
Binary file
languages/buddypress-media.mo CHANGED
Binary file
languages/buddypress-media.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: BuddyPress Media\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-02-25 13:18+0530\n"
6
- "PO-Revision-Date: 2013-02-25 13:18+0530\n"
7
  "Last-Translator: Saurabh Shukla <saurabh.shukla@rtcamp.com>\n"
8
  "Language-Team: rtCamp <info@rtcamp.com>\n"
9
  "Language: \n"
@@ -25,216 +25,230 @@ msgid "Posted "
25
  msgstr ""
26
 
27
  #: app/helper/BPMediaSettings.php:33
28
- msgid "Activate BuddyPress Media"
29
  msgstr ""
30
 
31
- #: app/helper/BPMediaSettings.php:40
32
- msgid "Groups"
33
  msgstr ""
34
 
35
- #: app/helper/BPMediaSettings.php:43
36
- msgid "Enable BuddyPress Media in Groups"
37
  msgstr ""
38
 
39
- #: app/helper/BPMediaSettings.php:47
40
- msgid "Enabled Media Types"
41
- msgstr ""
42
-
43
- #: app/helper/BPMediaSettings.php:48
44
  msgid "Video"
45
  msgstr ""
46
 
47
- #: app/helper/BPMediaSettings.php:51
48
- msgid "Enable videos"
49
  msgstr ""
50
 
51
- #: app/helper/BPMediaSettings.php:53
52
  msgid "Audio"
53
  msgstr ""
54
 
55
- #: app/helper/BPMediaSettings.php:56
56
- msgid "Enable audio"
57
  msgstr ""
58
 
59
- #: app/helper/BPMediaSettings.php:58
60
- msgid "Images"
61
  msgstr ""
62
 
63
- #: app/helper/BPMediaSettings.php:61
64
- msgid "Enable images"
65
  msgstr ""
66
 
67
- #: app/helper/BPMediaSettings.php:64
68
- msgid "Media Display"
69
  msgstr ""
70
 
71
- #: app/helper/BPMediaSettings.php:65
72
- msgid "No. of media items per view"
73
  msgstr ""
74
 
75
- #: app/helper/BPMediaSettings.php:68
76
- msgid "No. of media items displayed per view (defaults to 10)"
77
  msgstr ""
78
 
79
  #: app/helper/BPMediaSettings.php:70
 
 
 
 
 
 
 
 
 
 
 
 
80
  msgid "Download Button"
81
  msgstr ""
82
 
83
- #: app/helper/BPMediaSettings.php:73
84
  msgid "Display download button under media"
85
  msgstr ""
86
 
87
- #: app/helper/BPMediaSettings.php:76
88
- msgid "Privacy"
89
  msgstr ""
90
 
91
- #: app/helper/BPMediaSettings.php:77
92
  msgid "Enable Privacy"
93
  msgstr ""
94
 
95
- #: app/helper/BPMediaSettings.php:80
96
  msgid "Enable privacy"
97
  msgstr ""
98
 
99
- #: app/helper/BPMediaSettings.php:83
100
- msgid "Default Privacy Levels"
101
  msgstr ""
102
 
103
- #: app/helper/BPMediaSettings.php:84
104
- msgid "User Override"
105
  msgstr ""
106
 
107
- #: app/helper/BPMediaSettings.php:87
108
- msgid "Allow users to set privacy and override the defaults"
109
  msgstr ""
110
 
111
- #: app/helper/BPMediaSettings.php:89
112
- msgid "Default Privacy"
113
- msgstr ""
114
-
115
- #: app/helper/BPMediaSettings.php:93
116
- msgid "<strong>Private</strong>, Visible only to the user"
117
  msgstr ""
118
 
119
- #: app/helper/BPMediaSettings.php:94
120
- msgid "<strong>Friends</strong>, Visible to user's friends"
121
  msgstr ""
122
 
123
- #: app/helper/BPMediaSettings.php:95
124
- msgid "<strong>Users</strong>, Visible to registered users"
125
  msgstr ""
126
 
127
- #: app/helper/BPMediaSettings.php:96
128
- msgid "<strong>Public</strong>, Visible to the world"
129
  msgstr ""
130
 
131
- #: app/helper/BPMediaSettings.php:101
132
- msgid "Miscellaneous Settings"
133
  msgstr ""
134
 
135
- #: app/helper/BPMediaSettings.php:103
136
  msgid "Admin bar menu"
137
  msgstr ""
138
 
139
- #: app/helper/BPMediaSettings.php:106
140
  msgid "Enable menu in WordPress admin bar"
141
  msgstr ""
142
 
143
- #: app/helper/BPMediaSettings.php:109
144
- msgid "Re-Count Media Entries"
145
- msgstr ""
146
-
147
- #: app/helper/BPMediaSettings.php:111
148
- msgid "Re-Count"
149
  msgstr ""
150
 
151
- #: app/helper/BPMediaSettings.php:112
152
- msgid "It will re-count all media entries of all users and correct any discrepancies."
153
  msgstr ""
154
 
155
- #: app/helper/BPMediaSettings.php:116
156
  msgid "BuddyPress Media Addons for Audio/Video Conversion"
157
  msgstr ""
158
 
159
- #: app/helper/BPMediaSettings.php:117
160
  msgid "Submit a request form"
161
  msgstr ""
162
 
163
- #: app/helper/BPMediaSettings.php:118
164
  msgid "Request Type"
165
  msgstr ""
166
 
167
- #: app/helper/BPMediaSettings.php:119
168
  msgid "Select One"
169
  msgstr ""
170
 
171
- #: app/helper/BPMediaSettings.php:120
172
  msgid "Premium Support"
173
  msgstr ""
174
 
175
- #: app/helper/BPMediaSettings.php:121
176
  msgid "Suggest a New Feature"
177
  msgstr ""
178
 
179
- #: app/helper/BPMediaSettings.php:122
180
  msgid "Submit a Bug Report"
181
  msgstr ""
182
 
183
- #: app/helper/BPMediaSettings.php:127
184
- #: app/helper/BPMediaSettings.php:470
185
  msgid "Update Database"
186
  msgstr ""
187
 
188
- #: app/helper/BPMediaSettings.php:207
189
- #: app/helper/BPMediaSettings.php:209
190
  msgid "Recounting of media files done successfully"
191
  msgstr ""
192
 
193
- #: app/helper/BPMediaSettings.php:209
194
  msgid "Recount Success"
195
  msgstr ""
196
 
197
- #: app/helper/BPMediaSettings.php:212
198
- #: app/helper/BPMediaSettings.php:214
199
  msgid "Recounting Failed"
200
  msgstr ""
201
 
202
- #: app/helper/BPMediaSettings.php:214
203
  msgid "Recount Fail"
204
  msgstr ""
205
 
206
- #: app/helper/BPMediaSettings.php:226
207
- #: app/helper/BPMediaSettings.php:228
208
  msgid "Atleast one Media Type Must be selected"
209
  msgstr ""
210
 
211
- #: app/helper/BPMediaSettings.php:228
212
  msgid "Media Type"
213
  msgstr ""
214
 
215
- #: app/helper/BPMediaSettings.php:232
 
 
 
 
 
 
 
 
 
216
  msgid "Settings saved."
217
  msgstr ""
218
 
219
- #: app/helper/BPMediaSettings.php:261
220
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' ) "
221
  msgstr ""
222
 
223
- #: app/helper/BPMediaSettings.php:306
224
- #: app/helper/BPMediaSettings.php:354
225
- #: app/helper/BPMediaSettings.php:398
226
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' )"
227
  msgstr ""
228
 
229
- #: app/helper/BPMediaSettings.php:308
230
  msgid "Need to specify atleast to radios else use a checkbox instead"
231
  msgstr ""
232
 
233
- #: app/helper/BPMediaSettings.php:400
234
  msgid "Please provide some values to populate the dropdown. Format : array( 'value' => 'option' )"
235
  msgstr ""
236
 
237
- #: app/helper/BPMediaSettings.php:469
 
 
 
 
238
  msgid "BuddyPress Media 2.6 requires a database upgrade. "
239
  msgstr ""
240
 
@@ -242,145 +256,107 @@ msgstr ""
242
  msgid "Argument missing. id is required."
243
  msgstr ""
244
 
245
- #: app/helper/BPMediaSupport.php:31
 
 
 
 
246
  msgid "Submit a New Feature Request"
247
  msgstr ""
248
 
249
- #: app/helper/BPMediaSupport.php:34
250
  msgid "Submit a Premium Support Request"
251
  msgstr ""
252
 
253
- #: app/helper/BPMediaSupport.php:42
254
- #: app/helper/BPMediaSupport.php:126
255
  msgid "Name"
256
  msgstr ""
257
 
258
- #: app/helper/BPMediaSupport.php:45
259
- #: app/helper/BPMediaSupport.php:129
260
  msgid "Email"
261
  msgstr ""
262
 
263
- #: app/helper/BPMediaSupport.php:48
264
- #: app/helper/BPMediaSupport.php:132
265
  msgid "Website"
266
  msgstr ""
267
 
268
- #: app/helper/BPMediaSupport.php:51
269
- #: app/helper/BPMediaSupport.php:135
270
  msgid "Phone"
271
  msgstr ""
272
 
273
- #: app/helper/BPMediaSupport.php:54
274
- #: app/helper/BPMediaSupport.php:138
275
  msgid "Subject"
276
  msgstr ""
277
 
278
- #: app/helper/BPMediaSupport.php:57
279
- #: app/helper/BPMediaSupport.php:141
280
  msgid "Details"
281
  msgstr ""
282
 
283
- #: app/helper/BPMediaSupport.php:68
284
  msgid "Additional Information"
285
  msgstr ""
286
 
287
- #: app/helper/BPMediaSupport.php:73
288
  msgid "Your WP Admin Login:"
289
  msgstr ""
290
 
291
- #: app/helper/BPMediaSupport.php:76
292
  msgid "Your WP Admin password:"
293
  msgstr ""
294
 
295
- #: app/helper/BPMediaSupport.php:79
296
  msgid "Your SSH / FTP host:"
297
  msgstr ""
298
 
299
- #: app/helper/BPMediaSupport.php:82
300
  msgid "Your SSH / FTP login:"
301
  msgstr ""
302
 
303
- #: app/helper/BPMediaSupport.php:85
304
  msgid "Your SSH / FTP password:"
305
  msgstr ""
306
 
307
- #: app/helper/BPMediaSupport.php:108
308
  msgid "BuddyPress Media Premium Support Request from"
309
  msgstr ""
310
 
311
- #: app/helper/BPMediaSupport.php:111
312
  msgid "BuddyPress Media New Feature Request from"
313
  msgstr ""
314
 
315
- #: app/helper/BPMediaSupport.php:114
316
  msgid "BuddyPress Media Bug Report from"
317
  msgstr ""
318
 
319
- #: app/helper/BPMediaSupport.php:117
320
  msgid "BuddyPress Media Contact from"
321
  msgstr ""
322
 
323
- #: app/helper/BPMediaSupport.php:144
324
- msgid "Request ID"
325
  msgstr ""
326
 
327
- #: app/helper/BPMediaSupport.php:147
328
- msgid "Server Address"
329
- msgstr ""
330
-
331
- #: app/helper/BPMediaSupport.php:150
332
- msgid "IP Address"
333
- msgstr ""
334
-
335
- #: app/helper/BPMediaSupport.php:153
336
- msgid "Server Type"
337
- msgstr ""
338
-
339
- #: app/helper/BPMediaSupport.php:156
340
- msgid "User Agent"
341
- msgstr ""
342
-
343
- #: app/helper/BPMediaSupport.php:160
344
- msgid "WordPress Admin Username"
345
- msgstr ""
346
-
347
- #: app/helper/BPMediaSupport.php:163
348
- msgid "WordPress Admin Password"
349
- msgstr ""
350
-
351
- #: app/helper/BPMediaSupport.php:166
352
- msgid "SSH FTP Host"
353
- msgstr ""
354
-
355
- #: app/helper/BPMediaSupport.php:169
356
- msgid "SSH FTP Username"
357
- msgstr ""
358
-
359
- #: app/helper/BPMediaSupport.php:172
360
- msgid "SSH FTP Password"
361
- msgstr ""
362
-
363
- #: app/helper/BPMediaSupport.php:183
364
  msgid "Thank you for your Feedback/Suggestion."
365
  msgstr ""
366
 
367
- #: app/helper/BPMediaSupport.php:185
368
  msgid "Thank you for posting your support request."
369
  msgstr ""
370
 
371
- #: app/helper/BPMediaSupport.php:186
372
  msgid "We will get back to you shortly."
373
  msgstr ""
374
 
375
- #: app/helper/BPMediaSupport.php:189
376
  msgid "Your server failed to send an email."
377
  msgstr ""
378
 
379
- #: app/helper/BPMediaSupport.php:190
380
  msgid "Kindly contact your server support to fix this."
381
  msgstr ""
382
 
383
- #: app/helper/BPMediaSupport.php:191
384
  #, php-format
385
  msgid "You can alternatively create a support request <a href=\"%s\">here</a>"
386
  msgstr ""
@@ -417,114 +393,98 @@ msgstr ""
417
  msgid "Live Demo"
418
  msgstr ""
419
 
420
- #: app/helper/BPMediaUpgrade.php:35
421
- #, php-format
422
- 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>"
423
- msgstr ""
424
-
425
- #: app/helper/BPMediaUpgrade.php:69
426
- #: app/main/profile/BPMediaTemplate.php:20
427
- msgid "Wall Posts"
428
- msgstr ""
429
-
430
- #: app/helper/BPMediaUpgrade.php:114
431
- #: app/helper/BPMediaUpgrade.php:172
432
- #, php-format
433
- msgid "%1$s added a %2$s"
434
- msgstr ""
435
-
436
- #: app/admin/BPMediaAdmin.php:68
437
  msgid "BuddyPress Media Component"
438
  msgstr ""
439
 
440
- #: app/admin/BPMediaAdmin.php:68
441
- #: app/admin/BPMediaAdmin.php:184
442
- #: app/admin/BPMediaAdmin.php:185
443
  msgid "BuddyPress Media"
444
  msgstr ""
445
 
446
- #: app/admin/BPMediaAdmin.php:69
447
- #: app/admin/BPMediaAdmin.php:212
448
  msgid "BuddyPress Media Settings"
449
  msgstr ""
450
 
451
- #: app/admin/BPMediaAdmin.php:69
452
- #: app/admin/BPMediaAdmin.php:213
453
- #: app/main/BuddyPressMedia.php:414
454
  msgid "Settings"
455
  msgstr ""
456
 
457
- #: app/admin/BPMediaAdmin.php:71
458
  msgid "BuddyPress Media Database Update"
459
  msgstr ""
460
 
461
- #: app/admin/BPMediaAdmin.php:73
462
- #: app/admin/BPMediaAdmin.php:219
463
  msgid "BuddyPress Media Addons"
464
  msgstr ""
465
 
466
- #: app/admin/BPMediaAdmin.php:73
467
- #: app/admin/BPMediaAdmin.php:220
468
  msgid "Addons"
469
  msgstr ""
470
 
471
- #: app/admin/BPMediaAdmin.php:74
472
- #: app/admin/BPMediaAdmin.php:226
473
  msgid "BuddyPress Media Support"
474
  msgstr ""
475
 
476
- #: app/admin/BPMediaAdmin.php:74
477
  msgid "Support "
478
  msgstr ""
479
 
480
- #: app/admin/BPMediaAdmin.php:76
481
  msgid "BuddyPress Media Convert Videos"
482
  msgstr ""
483
 
484
- #: app/admin/BPMediaAdmin.php:76
485
- #: app/admin/BPMediaAdmin.php:235
486
  msgid "Convert Videos"
487
  msgstr ""
488
 
489
- #: app/admin/BPMediaAdmin.php:133
490
  #: app/main/BPMediaComponent.php:297
491
  #: app/main/BPMediaComponent.php:298
492
  #: app/main/BPMediaComponent.php:304
493
  #: app/main/BuddyPressMedia.php:271
494
- #: app/main/BuddyPressMedia.php:275
495
  msgid "Media"
496
  msgstr ""
497
 
498
- #: app/admin/BPMediaAdmin.php:155
499
  msgid "By"
500
  msgstr ""
501
 
502
- #: app/admin/BPMediaAdmin.php:155
503
  msgid "Empowering The Web With WordPress"
504
  msgstr ""
505
 
506
- #: app/admin/BPMediaAdmin.php:227
507
  msgid "Support"
508
  msgstr ""
509
 
510
- #: app/admin/BPMediaAdmin.php:234
511
  msgid "BuddyPress Media Covert Videos"
512
  msgstr ""
513
 
514
- #: app/admin/BPMediaAdmin.php:328
515
  #, php-format
516
  msgid "I use @buddypressmedia http://goo.gl/8Upmv on %s"
517
  msgstr ""
518
 
519
- #: app/admin/BPMediaAdmin.php:329
520
  msgid "Add link to footer"
521
  msgstr ""
522
 
523
- #: app/admin/BPMediaAdmin.php:331
524
  msgid "Tweet"
525
  msgstr ""
526
 
527
- #: app/admin/BPMediaAdmin.php:332
528
  msgid "Rate on WordPress.org"
529
  msgstr ""
530
 
@@ -537,38 +497,46 @@ msgid "USD"
537
  msgstr ""
538
 
539
  #: app/admin/BPMediaAdmin.php:353
 
 
 
 
 
 
 
 
540
  msgid "Donate"
541
  msgstr ""
542
 
543
- #: app/admin/BPMediaAdmin.php:367
544
  msgid "Become a fan on Facebook"
545
  msgstr ""
546
 
547
- #: app/admin/BPMediaAdmin.php:367
548
  msgid "Facebook"
549
  msgstr ""
550
 
551
- #: app/admin/BPMediaAdmin.php:368
552
  msgid "Follow us on Twitter"
553
  msgstr ""
554
 
555
- #: app/admin/BPMediaAdmin.php:368
556
  msgid "Twitter"
557
  msgstr ""
558
 
559
- #: app/admin/BPMediaAdmin.php:369
560
  msgid "Subscribe to our feeds"
561
  msgstr ""
562
 
563
- #: app/admin/BPMediaAdmin.php:369
564
  msgid "RSS Feed"
565
  msgstr ""
566
 
567
- #: app/admin/BPMediaAdmin.php:371
568
  msgid "Subscribe"
569
  msgstr ""
570
 
571
- #: app/admin/BPMediaAdmin.php:374
572
  msgid "Latest News"
573
  msgstr ""
574
 
@@ -578,29 +546,30 @@ msgstr ""
578
 
579
  #: app/main/BPMediaComponent.php:255
580
  #: app/main/BPMediaComponent.php:267
581
- #: app/main/BuddyPressMedia.php:300
582
  msgid "Albums"
583
  msgstr ""
584
 
585
  #: app/main/BPMediaComponent.php:256
586
- #: app/main/BuddyPressMedia.php:303
587
- #: app/main/profile/BPMediaTemplate.php:31
588
  msgid "Album"
589
  msgstr ""
590
 
591
  #: app/main/BPMediaComponent.php:257
592
- #: app/main/profile/BPMediaTemplate.php:72
593
- #: app/main/profile/BPMediaTemplate.php:263
594
  msgid "Create"
595
  msgstr ""
596
 
597
  #: app/main/BPMediaComponent.php:258
598
- #: app/main/profile/BPMediaTemplate.php:249
599
- #: app/main/profile/BPMediaTemplate.php:255
600
  msgid "Create Album"
601
  msgstr ""
602
 
603
  #: app/main/BPMediaComponent.php:259
 
604
  msgid "Edit Album"
605
  msgstr ""
606
 
@@ -636,44 +605,45 @@ msgstr ""
636
  msgid "BuddyPress Media's Media Files"
637
  msgstr ""
638
 
639
- #: app/main/BPMediaGroupLoader.php:251
640
  msgid "Media Settings"
641
  msgstr ""
642
 
643
- #: app/main/BuddyPressMedia.php:151
644
  msgid "BuddyPress is not installed."
645
  msgstr ""
646
 
647
- #: app/main/BuddyPressMedia.php:157
 
 
 
 
648
  #, php-format
649
- msgid ""
650
- "To use BuddyPress Media,\n"
651
- "\t\t\t\t\t\t\t<a href=\"%s\" target=\"_blank\">BuddyPress</a>\n"
652
- "\t\t\t\t\t\t\tmust be installed first."
653
  msgstr ""
654
 
655
- #: app/main/BuddyPressMedia.php:282
656
- msgid "Photos"
657
  msgstr ""
658
 
659
- #: app/main/BuddyPressMedia.php:285
660
  msgid "Photo"
661
  msgstr ""
662
 
663
- #: app/main/BuddyPressMedia.php:288
664
  msgid "Videos"
665
  msgstr ""
666
 
 
667
  #: app/main/BuddyPressMedia.php:294
668
- #: app/main/BuddyPressMedia.php:297
669
  msgid "Music"
670
  msgstr ""
671
 
672
- #: app/main/BuddyPressMedia.php:306
673
  msgid "Upload"
674
  msgstr ""
675
 
676
- #: app/main/BuddyPressMedia.php:495
677
  #, php-format
678
  msgid ""
679
  "The BuddyPress version installed is an\n"
@@ -683,7 +653,7 @@ msgid ""
683
  "\t\t\t\t\t\t\t\t\t\t<a class=\"alignright\" href=\"%1$s\">X</a>"
684
  msgstr ""
685
 
686
- #: app/main/BuddyPressMedia.php:508
687
  #, php-format
688
  msgid ""
689
  "You have not installed BuddyPress.\n"
@@ -692,58 +662,62 @@ msgid ""
692
  "\t\t\t\t\t\t\t\t\t<a class=\"alignright\" href=\"%1$s\">X</a>"
693
  msgstr ""
694
 
695
- #: app/main/profile/BPMediaTemplate.php:24
 
 
 
 
696
  msgid "Drop files here"
697
  msgstr ""
698
 
699
- #: app/main/profile/BPMediaTemplate.php:25
700
  msgid " or "
701
  msgstr ""
702
 
703
- #: app/main/profile/BPMediaTemplate.php:26
704
  #: app/main/profile/BPMediaUploadScreen.php:33
705
  msgid "Upload Media"
706
  msgstr ""
707
 
708
- #: app/main/profile/BPMediaTemplate.php:29
709
  msgid "to"
710
  msgstr ""
711
 
712
- #: app/main/profile/BPMediaTemplate.php:66
713
  msgid "+ Create New Album"
714
  msgstr ""
715
 
716
- #: app/main/profile/BPMediaTemplate.php:73
717
  msgid "Cancel"
718
  msgstr ""
719
 
720
- #: app/main/profile/BPMediaTemplate.php:194
721
  msgid "Show More"
722
  msgstr ""
723
 
724
- #: app/main/profile/BPMediaTemplate.php:227
725
  msgid "Select Album"
726
  msgstr ""
727
 
728
- #: app/main/profile/BPMediaTemplate.php:228
729
- #: app/main/profile/BPMediaTemplate.php:256
730
  msgid "x"
731
  msgstr ""
732
 
733
- #: app/main/profile/BPMediaTemplate.php:248
734
  msgid "Select"
735
  msgstr ""
736
 
737
- #: app/main/profile/BPMediaTemplate.php:259
738
  msgid "Album Name"
739
  msgstr ""
740
 
741
- #: app/main/profile/BPMediaTemplate.php:267
742
  msgid "Add Media"
743
  msgstr ""
744
 
745
  #: app/main/profile/BPMediaScreen.php:112
746
- #: app/main/profile/BPMediaScreen.php:365
747
  msgid "The requested url does not exist"
748
  msgstr ""
749
 
@@ -752,43 +726,44 @@ msgstr ""
752
  msgid "All %s"
753
  msgstr ""
754
 
755
- #: app/main/profile/BPMediaScreen.php:197
 
756
  #, php-format
757
  msgid "Sorry, no %s were found."
758
  msgstr ""
759
 
760
- #: app/main/profile/BPMediaScreen.php:299
761
  #, php-format
762
  msgid "Edit %s"
763
  msgstr ""
764
 
765
- #: app/main/profile/BPMediaScreen.php:320
766
  #, php-format
767
  msgid "%s Title"
768
  msgstr ""
769
 
770
- #: app/main/profile/BPMediaScreen.php:326
771
  #, php-format
772
  msgid "%s Description"
773
  msgstr ""
774
 
775
- #: app/main/profile/BPMediaScreen.php:333
776
  msgid "Update"
777
  msgstr ""
778
 
779
- #: app/main/profile/BPMediaScreen.php:334
780
  msgid "Back to Media File"
781
  msgstr ""
782
 
783
- #: app/main/profile/BPMediaScreen.php:335
784
  msgid "Back to Media"
785
  msgstr ""
786
 
787
- #: app/main/profile/BPMediaScreen.php:358
788
  msgid "You do not have access to this page."
789
  msgstr ""
790
 
791
- #: app/main/profile/BPMediaScreen.php:386
792
  msgid "Media deleted successfully"
793
  msgstr ""
794
 
@@ -821,15 +796,15 @@ msgstr ""
821
  msgid "You did not specified a file to upload"
822
  msgstr ""
823
 
824
- #: app/main/profile/BPMediaAlbumScreen.php:119
825
  msgid "Edit"
826
  msgstr ""
827
 
828
- #: app/main/profile/BPMediaAlbumScreen.php:120
829
  msgid "Delete"
830
  msgstr ""
831
 
832
- #: app/main/profile/BPMediaAlbumScreen.php:143
833
  msgid "Sorry, no media items were found in this album."
834
  msgstr ""
835
 
@@ -837,10 +812,16 @@ msgstr ""
837
  msgid "Sorry, the requested album does not exist."
838
  msgstr ""
839
 
840
- #: app/main/group/BPMediaGroupElementExtension.php:80
841
  msgid "Sorry, the requested media does not belong to the group"
842
  msgstr ""
843
 
 
 
 
 
 
 
844
  #: app/main/group/BPMediaGroupsExtension.php:40
845
  #: app/main/group/BPMediaGroupsExtension.php:87
846
  msgid "Album Creation Control"
@@ -885,17 +866,17 @@ msgid ""
885
  "\t home screen."
886
  msgstr ""
887
 
888
- #: app/main/activity/BPMediaActivity.php:24
889
- msgid "Insert Media"
890
  msgstr ""
891
 
892
- #: app/main/activity/BPMediaActivity.php:72
893
- msgid "There was a problem posting your update, please try again."
894
  msgstr ""
895
 
896
- #: app/main/activity/BPMediaActivity.php:146
897
  #, php-format
898
- msgid "%1$s added new media in album %2$s"
899
  msgstr ""
900
 
901
  #: app/main/widgets/BPMediaWidget.php:20
@@ -906,11 +887,11 @@ msgstr ""
906
  msgid "BuddyPress Media Widget"
907
  msgstr ""
908
 
909
- #: app/main/widgets/BPMediaWidget.php:66
910
  msgid "All"
911
  msgstr ""
912
 
913
- #: app/main/widgets/BPMediaWidget.php:76
914
  #, php-format
915
  msgid ""
916
  "Please configure this widget\n"
@@ -919,43 +900,43 @@ msgid ""
919
  "\t\t\t\t\t\t\t\t\there</a>."
920
  msgstr ""
921
 
922
- #: app/main/widgets/BPMediaWidget.php:122
923
  msgid "No "
924
  msgstr ""
925
 
926
- #: app/main/widgets/BPMediaWidget.php:168
927
  msgid "Widget Type:"
928
  msgstr ""
929
 
930
- #: app/main/widgets/BPMediaWidget.php:170
931
  msgid "Recent Media"
932
  msgstr ""
933
 
934
- #: app/main/widgets/BPMediaWidget.php:171
935
  msgid "Popular Media"
936
  msgstr ""
937
 
938
- #: app/main/widgets/BPMediaWidget.php:174
939
  msgid "Title:"
940
  msgstr ""
941
 
942
- #: app/main/widgets/BPMediaWidget.php:177
943
  msgid "Number of posts to show:"
944
  msgstr ""
945
 
946
- #: app/main/widgets/BPMediaWidget.php:181
947
  msgid "Show All"
948
  msgstr ""
949
 
950
- #: app/main/widgets/BPMediaWidget.php:184
951
  msgid "Show Photos"
952
  msgstr ""
953
 
954
- #: app/main/widgets/BPMediaWidget.php:187
955
  msgid "Show Music"
956
  msgstr ""
957
 
958
- #: app/main/widgets/BPMediaWidget.php:191
959
  msgid "Show Videos"
960
  msgstr ""
961
 
@@ -963,33 +944,41 @@ msgstr ""
963
  msgid "Update BuddyPress Media Database"
964
  msgstr ""
965
 
966
- #: app/main/privacy/BPMediaPrivacySettings.php:96
967
  msgid "Start"
968
  msgstr ""
969
 
970
- #: app/main/privacy/BPMediaPrivacy.php:101
971
  msgid "<strong>Private</strong>, Visible only to myself"
972
  msgstr ""
973
 
974
- #: app/main/privacy/BPMediaPrivacy.php:105
975
  msgid "<strong>Friends</strong>, Visible to my friends"
976
  msgstr ""
977
 
978
- #: app/main/privacy/BPMediaPrivacy.php:129
 
 
 
 
 
 
 
 
979
  msgid "Set default privacy levels for your media"
980
  msgstr ""
981
 
982
- #: app/main/privacy/BPMediaPrivacy.php:281
983
  #, php-format
984
  msgid "This %s is private"
985
  msgstr ""
986
 
987
- #: app/main/privacy/BPMediaPrivacy.php:282
988
  #, php-format
989
  msgid "This %1s is visible only to %2s&rsquo;s friends"
990
  msgstr ""
991
 
992
- #: app/main/privacy/BPMediaPrivacy.php:283
993
  #, php-format
994
  msgid "This %s is visible to logged in users, only"
995
  msgstr ""
@@ -998,79 +987,75 @@ msgstr ""
998
  msgid "Default privacy level for your media has been updated"
999
  msgstr ""
1000
 
1001
- #: app/main/privacy/BPMediaPrivacyScreen.php:59
1002
- msgid "Privacy Settings"
1003
- msgstr ""
1004
-
1005
  #: app/main/includes/BPMediaHostWordpress.php:59
1006
  msgid "Sorry, the requested media does not exist."
1007
  msgstr ""
1008
 
1009
- #: app/main/includes/BPMediaHostWordpress.php:137
1010
  msgid "Error Uploading File"
1011
  msgstr ""
1012
 
1013
- #: app/main/includes/BPMediaHostWordpress.php:164
1014
  msgid "MP4 file you have uploaded is corrupt."
1015
  msgstr ""
1016
 
1017
- #: app/main/includes/BPMediaHostWordpress.php:171
1018
- #: app/main/includes/BPMediaHostWordpress.php:176
1019
  msgid "The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264."
1020
  msgstr ""
1021
 
1022
- #: app/main/includes/BPMediaHostWordpress.php:181
1023
  msgid "The MP4 file you have uploaded is not a video file."
1024
  msgstr ""
1025
 
1026
- #: app/main/includes/BPMediaHostWordpress.php:192
1027
  msgid "MP3 file you have uploaded is currupt."
1028
  msgstr ""
1029
 
1030
- #: app/main/includes/BPMediaHostWordpress.php:199
1031
- #: app/main/includes/BPMediaHostWordpress.php:204
1032
  msgid "The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3."
1033
  msgstr ""
1034
 
1035
- #: app/main/includes/BPMediaHostWordpress.php:209
1036
  msgid "The MP3 file you have uploaded is not an audio file."
1037
  msgstr ""
1038
 
1039
- #: app/main/includes/BPMediaHostWordpress.php:221
1040
  msgid "Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4."
1041
  msgstr ""
1042
 
1043
- #: app/main/includes/BPMediaHostWordpress.php:228
1044
  msgid "Error creating attachment for the media file, please try again"
1045
  msgstr ""
1046
 
1047
- #: app/main/includes/BPMediaHostWordpress.php:319
1048
  #, php-format
1049
  msgid "%s uploaded a media."
1050
  msgstr ""
1051
 
1052
- #: app/main/includes/BPMediaHostWordpress.php:340
1053
  msgid "Uploaded by "
1054
  msgstr ""
1055
 
1056
- #: app/main/includes/BPMediaHostWordpress.php:484
1057
  #, php-format
1058
  msgid "Comment <span>%s</span>"
1059
  msgstr ""
1060
 
1061
- #: app/main/includes/BPMediaHostWordpress.php:488
1062
  msgid "Favorite"
1063
  msgstr ""
1064
 
1065
- #: app/main/includes/BPMediaHostWordpress.php:490
1066
  msgid "Remove Favorite"
1067
  msgstr ""
1068
 
1069
- #: app/main/includes/BPMediaHostWordpress.php:509
1070
  msgid "Post"
1071
  msgstr ""
1072
 
1073
- #: app/main/includes/BPMediaHostWordpress.php:509
1074
  msgid "or press esc to cancel."
1075
  msgstr ""
1076
 
@@ -1086,6 +1071,11 @@ msgstr ""
1086
  msgid "Select Media File"
1087
  msgstr ""
1088
 
 
 
 
 
 
1089
  #: app/main/includes/BPMediaFilters.php:138
1090
  #, php-format
1091
  msgid "Delete %s"
@@ -1111,25 +1101,25 @@ msgstr ""
1111
  msgid "Total Albums"
1112
  msgstr ""
1113
 
1114
- #: app/main/includes/BPMediaActions.php:304
1115
- msgid "Edit Media"
1116
- msgstr ""
1117
-
1118
- #: app/main/includes/BPMediaActions.php:308
1119
  msgid "Download"
1120
  msgstr ""
1121
 
1122
- #: app/main/includes/BPMediaActions.php:315
1123
- #: app/main/includes/BPMediaActions.php:778
1124
  msgid "Set as Album Cover"
1125
  msgstr ""
1126
 
1127
- #: app/main/includes/BPMediaActions.php:320
1128
- #: app/main/includes/BPMediaActions.php:781
1129
  msgid "Unset as Album Cover"
1130
  msgstr ""
1131
 
1132
- #: app/main/includes/BPMediaActions.php:684
 
 
 
 
1133
  #, php-format
1134
  msgid "%1$s created an album %2$s"
1135
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: BuddyPress Media\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-03-20 14:45+0530\n"
6
+ "PO-Revision-Date: 2013-03-20 14:45+0530\n"
7
  "Last-Translator: Saurabh Shukla <saurabh.shukla@rtcamp.com>\n"
8
  "Language-Team: rtCamp <info@rtcamp.com>\n"
9
  "Language: \n"
25
  msgstr ""
26
 
27
  #: app/helper/BPMediaSettings.php:33
28
+ msgid "Enabled Media Types"
29
  msgstr ""
30
 
31
+ #: app/helper/BPMediaSettings.php:34
32
+ msgid "Photos"
33
  msgstr ""
34
 
35
+ #: app/helper/BPMediaSettings.php:37
36
+ msgid "Enable Photos"
37
  msgstr ""
38
 
39
+ #: app/helper/BPMediaSettings.php:39
 
 
 
 
40
  msgid "Video"
41
  msgstr ""
42
 
43
+ #: app/helper/BPMediaSettings.php:42
44
+ msgid "Enable Video"
45
  msgstr ""
46
 
47
+ #: app/helper/BPMediaSettings.php:44
48
  msgid "Audio"
49
  msgstr ""
50
 
51
+ #: app/helper/BPMediaSettings.php:47
52
+ msgid "Enable Audio"
53
  msgstr ""
54
 
55
+ #: app/helper/BPMediaSettings.php:50
56
+ msgid "Activity Upload"
57
  msgstr ""
58
 
59
+ #: app/helper/BPMediaSettings.php:51
60
+ msgid "Activity Uploads"
61
  msgstr ""
62
 
63
+ #: app/helper/BPMediaSettings.php:54
64
+ msgid "Enable Activity Uploading"
65
  msgstr ""
66
 
67
+ #: app/helper/BPMediaSettings.php:60
68
+ msgid "Groups Integration"
69
  msgstr ""
70
 
71
+ #: app/helper/BPMediaSettings.php:67
72
+ msgid "Groups"
73
  msgstr ""
74
 
75
  #: app/helper/BPMediaSettings.php:70
76
+ msgid "Allow Media in Groups"
77
+ msgstr ""
78
+
79
+ #: app/helper/BPMediaSettings.php:77
80
+ msgid "Display Settings"
81
+ msgstr ""
82
+
83
+ #: app/helper/BPMediaSettings.php:78
84
+ msgid "Number of media"
85
+ msgstr ""
86
+
87
+ #: app/helper/BPMediaSettings.php:83
88
  msgid "Download Button"
89
  msgstr ""
90
 
91
+ #: app/helper/BPMediaSettings.php:86
92
  msgid "Display download button under media"
93
  msgstr ""
94
 
95
+ #: app/helper/BPMediaSettings.php:90
96
+ msgid "Privacy Settings"
97
  msgstr ""
98
 
99
+ #: app/helper/BPMediaSettings.php:91
100
  msgid "Enable Privacy"
101
  msgstr ""
102
 
103
+ #: app/helper/BPMediaSettings.php:94
104
  msgid "Enable privacy"
105
  msgstr ""
106
 
107
+ #: app/helper/BPMediaSettings.php:98
108
+ msgid "<strong>Private</strong> - Visible only to the user"
109
  msgstr ""
110
 
111
+ #: app/helper/BPMediaSettings.php:99
112
+ msgid "<strong>Friends</strong> - Visible to user's friends"
113
  msgstr ""
114
 
115
+ #: app/helper/BPMediaSettings.php:100
116
+ msgid "<strong>Users</strong> - Visible to registered users"
117
  msgstr ""
118
 
119
+ #: app/helper/BPMediaSettings.php:101
120
+ msgid "<strong>Public</strong> - Visible to the world"
 
 
 
 
121
  msgstr ""
122
 
123
+ #: app/helper/BPMediaSettings.php:106
124
+ msgid "Default Privacy"
125
  msgstr ""
126
 
127
+ #: app/helper/BPMediaSettings.php:112
128
+ msgid "User Override"
129
  msgstr ""
130
 
131
+ #: app/helper/BPMediaSettings.php:115
132
+ msgid "Allow users to override admin defaults (<em>Recommended</em>)"
133
  msgstr ""
134
 
135
+ #: app/helper/BPMediaSettings.php:118
136
+ msgid "Other Settings"
137
  msgstr ""
138
 
139
+ #: app/helper/BPMediaSettings.php:120
140
  msgid "Admin bar menu"
141
  msgstr ""
142
 
143
+ #: app/helper/BPMediaSettings.php:123
144
  msgid "Enable menu in WordPress admin bar"
145
  msgstr ""
146
 
147
+ #: app/helper/BPMediaSettings.php:126
148
+ #: app/helper/BPMediaSettings.php:128
149
+ msgid "Recount"
 
 
 
150
  msgstr ""
151
 
152
+ #: app/helper/BPMediaSettings.php:129
153
+ msgid "Repair media counts"
154
  msgstr ""
155
 
156
+ #: app/helper/BPMediaSettings.php:133
157
  msgid "BuddyPress Media Addons for Audio/Video Conversion"
158
  msgstr ""
159
 
160
+ #: app/helper/BPMediaSettings.php:134
161
  msgid "Submit a request form"
162
  msgstr ""
163
 
164
+ #: app/helper/BPMediaSettings.php:135
165
  msgid "Request Type"
166
  msgstr ""
167
 
168
+ #: app/helper/BPMediaSettings.php:136
169
  msgid "Select One"
170
  msgstr ""
171
 
172
+ #: app/helper/BPMediaSettings.php:137
173
  msgid "Premium Support"
174
  msgstr ""
175
 
176
+ #: app/helper/BPMediaSettings.php:138
177
  msgid "Suggest a New Feature"
178
  msgstr ""
179
 
180
+ #: app/helper/BPMediaSettings.php:139
181
  msgid "Submit a Bug Report"
182
  msgstr ""
183
 
184
+ #: app/helper/BPMediaSettings.php:144
185
+ #: app/helper/BPMediaSettings.php:502
186
  msgid "Update Database"
187
  msgstr ""
188
 
189
+ #: app/helper/BPMediaSettings.php:229
190
+ #: app/helper/BPMediaSettings.php:231
191
  msgid "Recounting of media files done successfully"
192
  msgstr ""
193
 
194
+ #: app/helper/BPMediaSettings.php:231
195
  msgid "Recount Success"
196
  msgstr ""
197
 
198
+ #: app/helper/BPMediaSettings.php:234
199
+ #: app/helper/BPMediaSettings.php:236
200
  msgid "Recounting Failed"
201
  msgstr ""
202
 
203
+ #: app/helper/BPMediaSettings.php:236
204
  msgid "Recount Fail"
205
  msgstr ""
206
 
207
+ #: app/helper/BPMediaSettings.php:248
208
+ #: app/helper/BPMediaSettings.php:250
209
  msgid "Atleast one Media Type Must be selected"
210
  msgstr ""
211
 
212
+ #: app/helper/BPMediaSettings.php:250
213
  msgid "Media Type"
214
  msgstr ""
215
 
216
+ #: app/helper/BPMediaSettings.php:257
217
+ #: app/helper/BPMediaSettings.php:259
218
+ msgid "\"Number of media\" count value should be numeric and greater than 0."
219
+ msgstr ""
220
+
221
+ #: app/helper/BPMediaSettings.php:259
222
+ msgid "Default Count"
223
+ msgstr ""
224
+
225
+ #: app/helper/BPMediaSettings.php:263
226
  msgid "Settings saved."
227
  msgstr ""
228
 
229
+ #: app/helper/BPMediaSettings.php:292
230
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' ) "
231
  msgstr ""
232
 
233
+ #: app/helper/BPMediaSettings.php:337
234
+ #: app/helper/BPMediaSettings.php:386
235
+ #: app/helper/BPMediaSettings.php:430
236
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' )"
237
  msgstr ""
238
 
239
+ #: app/helper/BPMediaSettings.php:339
240
  msgid "Need to specify atleast to radios else use a checkbox instead"
241
  msgstr ""
242
 
243
+ #: app/helper/BPMediaSettings.php:432
244
  msgid "Please provide some values to populate the dropdown. Format : array( 'value' => 'option' )"
245
  msgstr ""
246
 
247
+ #: app/helper/BPMediaSettings.php:447
248
+ msgid "None"
249
+ msgstr ""
250
+
251
+ #: app/helper/BPMediaSettings.php:501
252
  msgid "BuddyPress Media 2.6 requires a database upgrade. "
253
  msgstr ""
254
 
256
  msgid "Argument missing. id is required."
257
  msgstr ""
258
 
259
+ #: app/helper/BPMediaSupport.php:50
260
+ msgid "Debug info"
261
+ msgstr ""
262
+
263
+ #: app/helper/BPMediaSupport.php:84
264
  msgid "Submit a New Feature Request"
265
  msgstr ""
266
 
267
+ #: app/helper/BPMediaSupport.php:87
268
  msgid "Submit a Premium Support Request"
269
  msgstr ""
270
 
271
+ #: app/helper/BPMediaSupport.php:95
 
272
  msgid "Name"
273
  msgstr ""
274
 
275
+ #: app/helper/BPMediaSupport.php:98
 
276
  msgid "Email"
277
  msgstr ""
278
 
279
+ #: app/helper/BPMediaSupport.php:101
 
280
  msgid "Website"
281
  msgstr ""
282
 
283
+ #: app/helper/BPMediaSupport.php:104
 
284
  msgid "Phone"
285
  msgstr ""
286
 
287
+ #: app/helper/BPMediaSupport.php:107
 
288
  msgid "Subject"
289
  msgstr ""
290
 
291
+ #: app/helper/BPMediaSupport.php:110
 
292
  msgid "Details"
293
  msgstr ""
294
 
295
+ #: app/helper/BPMediaSupport.php:121
296
  msgid "Additional Information"
297
  msgstr ""
298
 
299
+ #: app/helper/BPMediaSupport.php:126
300
  msgid "Your WP Admin Login:"
301
  msgstr ""
302
 
303
+ #: app/helper/BPMediaSupport.php:129
304
  msgid "Your WP Admin password:"
305
  msgstr ""
306
 
307
+ #: app/helper/BPMediaSupport.php:132
308
  msgid "Your SSH / FTP host:"
309
  msgstr ""
310
 
311
+ #: app/helper/BPMediaSupport.php:135
312
  msgid "Your SSH / FTP login:"
313
  msgstr ""
314
 
315
+ #: app/helper/BPMediaSupport.php:138
316
  msgid "Your SSH / FTP password:"
317
  msgstr ""
318
 
319
+ #: app/helper/BPMediaSupport.php:161
320
  msgid "BuddyPress Media Premium Support Request from"
321
  msgstr ""
322
 
323
+ #: app/helper/BPMediaSupport.php:164
324
  msgid "BuddyPress Media New Feature Request from"
325
  msgstr ""
326
 
327
+ #: app/helper/BPMediaSupport.php:167
328
  msgid "BuddyPress Media Bug Report from"
329
  msgstr ""
330
 
331
+ #: app/helper/BPMediaSupport.php:170
332
  msgid "BuddyPress Media Contact from"
333
  msgstr ""
334
 
335
+ #: app/helper/BPMediaSupport.php:231
336
+ msgid "Debug Info"
337
  msgstr ""
338
 
339
+ #: app/helper/BPMediaSupport.php:246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  msgid "Thank you for your Feedback/Suggestion."
341
  msgstr ""
342
 
343
+ #: app/helper/BPMediaSupport.php:248
344
  msgid "Thank you for posting your support request."
345
  msgstr ""
346
 
347
+ #: app/helper/BPMediaSupport.php:249
348
  msgid "We will get back to you shortly."
349
  msgstr ""
350
 
351
+ #: app/helper/BPMediaSupport.php:252
352
  msgid "Your server failed to send an email."
353
  msgstr ""
354
 
355
+ #: app/helper/BPMediaSupport.php:253
356
  msgid "Kindly contact your server support to fix this."
357
  msgstr ""
358
 
359
+ #: app/helper/BPMediaSupport.php:254
360
  #, php-format
361
  msgid "You can alternatively create a support request <a href=\"%s\">here</a>"
362
  msgstr ""
393
  msgid "Live Demo"
394
  msgstr ""
395
 
396
+ #: app/admin/BPMediaAdmin.php:69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  msgid "BuddyPress Media Component"
398
  msgstr ""
399
 
400
+ #: app/admin/BPMediaAdmin.php:69
401
+ #: app/admin/BPMediaAdmin.php:186
402
+ #: app/admin/BPMediaAdmin.php:187
403
  msgid "BuddyPress Media"
404
  msgstr ""
405
 
406
+ #: app/admin/BPMediaAdmin.php:70
407
+ #: app/admin/BPMediaAdmin.php:214
408
  msgid "BuddyPress Media Settings"
409
  msgstr ""
410
 
411
+ #: app/admin/BPMediaAdmin.php:70
412
+ #: app/admin/BPMediaAdmin.php:215
413
+ #: app/main/BuddyPressMedia.php:410
414
  msgid "Settings"
415
  msgstr ""
416
 
417
+ #: app/admin/BPMediaAdmin.php:72
418
  msgid "BuddyPress Media Database Update"
419
  msgstr ""
420
 
421
+ #: app/admin/BPMediaAdmin.php:74
422
+ #: app/admin/BPMediaAdmin.php:221
423
  msgid "BuddyPress Media Addons"
424
  msgstr ""
425
 
426
+ #: app/admin/BPMediaAdmin.php:74
427
+ #: app/admin/BPMediaAdmin.php:222
428
  msgid "Addons"
429
  msgstr ""
430
 
431
+ #: app/admin/BPMediaAdmin.php:75
432
+ #: app/admin/BPMediaAdmin.php:228
433
  msgid "BuddyPress Media Support"
434
  msgstr ""
435
 
436
+ #: app/admin/BPMediaAdmin.php:75
437
  msgid "Support "
438
  msgstr ""
439
 
440
+ #: app/admin/BPMediaAdmin.php:77
441
  msgid "BuddyPress Media Convert Videos"
442
  msgstr ""
443
 
444
+ #: app/admin/BPMediaAdmin.php:77
445
+ #: app/admin/BPMediaAdmin.php:237
446
  msgid "Convert Videos"
447
  msgstr ""
448
 
449
+ #: app/admin/BPMediaAdmin.php:134
450
  #: app/main/BPMediaComponent.php:297
451
  #: app/main/BPMediaComponent.php:298
452
  #: app/main/BPMediaComponent.php:304
453
  #: app/main/BuddyPressMedia.php:271
454
+ #: app/main/BuddyPressMedia.php:274
455
  msgid "Media"
456
  msgstr ""
457
 
458
+ #: app/admin/BPMediaAdmin.php:156
459
  msgid "By"
460
  msgstr ""
461
 
462
+ #: app/admin/BPMediaAdmin.php:156
463
  msgid "Empowering The Web With WordPress"
464
  msgstr ""
465
 
466
+ #: app/admin/BPMediaAdmin.php:229
467
  msgid "Support"
468
  msgstr ""
469
 
470
+ #: app/admin/BPMediaAdmin.php:236
471
  msgid "BuddyPress Media Covert Videos"
472
  msgstr ""
473
 
474
+ #: app/admin/BPMediaAdmin.php:330
475
  #, php-format
476
  msgid "I use @buddypressmedia http://goo.gl/8Upmv on %s"
477
  msgstr ""
478
 
479
+ #: app/admin/BPMediaAdmin.php:331
480
  msgid "Add link to footer"
481
  msgstr ""
482
 
483
+ #: app/admin/BPMediaAdmin.php:332
484
  msgid "Tweet"
485
  msgstr ""
486
 
487
+ #: app/admin/BPMediaAdmin.php:333
488
  msgid "Rate on WordPress.org"
489
  msgstr ""
490
 
497
  msgstr ""
498
 
499
  #: app/admin/BPMediaAdmin.php:353
500
+ msgid "OR"
501
+ msgstr ""
502
+
503
+ #: app/admin/BPMediaAdmin.php:354
504
+ msgid "Use <a href=\"https://rtcamp.com/store/product-category/buddypress/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media\">premium add-ons</a> starting from $9"
505
+ msgstr ""
506
+
507
+ #: app/admin/BPMediaAdmin.php:356
508
  msgid "Donate"
509
  msgstr ""
510
 
511
+ #: app/admin/BPMediaAdmin.php:370
512
  msgid "Become a fan on Facebook"
513
  msgstr ""
514
 
515
+ #: app/admin/BPMediaAdmin.php:370
516
  msgid "Facebook"
517
  msgstr ""
518
 
519
+ #: app/admin/BPMediaAdmin.php:371
520
  msgid "Follow us on Twitter"
521
  msgstr ""
522
 
523
+ #: app/admin/BPMediaAdmin.php:371
524
  msgid "Twitter"
525
  msgstr ""
526
 
527
+ #: app/admin/BPMediaAdmin.php:372
528
  msgid "Subscribe to our feeds"
529
  msgstr ""
530
 
531
+ #: app/admin/BPMediaAdmin.php:372
532
  msgid "RSS Feed"
533
  msgstr ""
534
 
535
+ #: app/admin/BPMediaAdmin.php:374
536
  msgid "Subscribe"
537
  msgstr ""
538
 
539
+ #: app/admin/BPMediaAdmin.php:377
540
  msgid "Latest News"
541
  msgstr ""
542
 
546
 
547
  #: app/main/BPMediaComponent.php:255
548
  #: app/main/BPMediaComponent.php:267
549
+ #: app/main/BuddyPressMedia.php:297
550
  msgid "Albums"
551
  msgstr ""
552
 
553
  #: app/main/BPMediaComponent.php:256
554
+ #: app/main/BuddyPressMedia.php:300
555
+ #: app/main/profile/BPMediaTemplate.php:34
556
  msgid "Album"
557
  msgstr ""
558
 
559
  #: app/main/BPMediaComponent.php:257
560
+ #: app/main/profile/BPMediaTemplate.php:75
561
+ #: app/main/profile/BPMediaTemplate.php:264
562
  msgid "Create"
563
  msgstr ""
564
 
565
  #: app/main/BPMediaComponent.php:258
566
+ #: app/main/profile/BPMediaTemplate.php:250
567
+ #: app/main/profile/BPMediaTemplate.php:256
568
  msgid "Create Album"
569
  msgstr ""
570
 
571
  #: app/main/BPMediaComponent.php:259
572
+ #: app/main/profile/BPMediaAlbumScreen.php:135
573
  msgid "Edit Album"
574
  msgstr ""
575
 
605
  msgid "BuddyPress Media's Media Files"
606
  msgstr ""
607
 
608
+ #: app/main/BPMediaGroupLoader.php:252
609
  msgid "Media Settings"
610
  msgstr ""
611
 
612
+ #: app/main/BuddyPressMedia.php:158
613
  msgid "BuddyPress is not installed."
614
  msgstr ""
615
 
616
+ #: app/main/BuddyPressMedia.php:160
617
+ msgid "To use BuddyPress Media, BuddyPress must be installed first."
618
+ msgstr ""
619
+
620
+ #: app/main/BuddyPressMedia.php:161
621
  #, php-format
622
+ msgid "<a href=\"%s\">Install BuddyPress now</a>"
 
 
 
623
  msgstr ""
624
 
625
+ #: app/main/BuddyPressMedia.php:276
626
+ msgid "Privacy"
627
  msgstr ""
628
 
629
+ #: app/main/BuddyPressMedia.php:282
630
  msgid "Photo"
631
  msgstr ""
632
 
633
+ #: app/main/BuddyPressMedia.php:285
634
  msgid "Videos"
635
  msgstr ""
636
 
637
+ #: app/main/BuddyPressMedia.php:291
638
  #: app/main/BuddyPressMedia.php:294
 
639
  msgid "Music"
640
  msgstr ""
641
 
642
+ #: app/main/BuddyPressMedia.php:303
643
  msgid "Upload"
644
  msgstr ""
645
 
646
+ #: app/main/BuddyPressMedia.php:502
647
  #, php-format
648
  msgid ""
649
  "The BuddyPress version installed is an\n"
653
  "\t\t\t\t\t\t\t\t\t\t<a class=\"alignright\" href=\"%1$s\">X</a>"
654
  msgstr ""
655
 
656
+ #: app/main/BuddyPressMedia.php:515
657
  #, php-format
658
  msgid ""
659
  "You have not installed BuddyPress.\n"
662
  "\t\t\t\t\t\t\t\t\t<a class=\"alignright\" href=\"%1$s\">X</a>"
663
  msgstr ""
664
 
665
+ #: app/main/profile/BPMediaTemplate.php:23
666
+ msgid "Wall Posts"
667
+ msgstr ""
668
+
669
+ #: app/main/profile/BPMediaTemplate.php:27
670
  msgid "Drop files here"
671
  msgstr ""
672
 
673
+ #: app/main/profile/BPMediaTemplate.php:28
674
  msgid " or "
675
  msgstr ""
676
 
677
+ #: app/main/profile/BPMediaTemplate.php:29
678
  #: app/main/profile/BPMediaUploadScreen.php:33
679
  msgid "Upload Media"
680
  msgstr ""
681
 
682
+ #: app/main/profile/BPMediaTemplate.php:32
683
  msgid "to"
684
  msgstr ""
685
 
686
+ #: app/main/profile/BPMediaTemplate.php:69
687
  msgid "+ Create New Album"
688
  msgstr ""
689
 
690
+ #: app/main/profile/BPMediaTemplate.php:76
691
  msgid "Cancel"
692
  msgstr ""
693
 
694
+ #: app/main/profile/BPMediaTemplate.php:195
695
  msgid "Show More"
696
  msgstr ""
697
 
698
+ #: app/main/profile/BPMediaTemplate.php:228
699
  msgid "Select Album"
700
  msgstr ""
701
 
702
+ #: app/main/profile/BPMediaTemplate.php:229
703
+ #: app/main/profile/BPMediaTemplate.php:257
704
  msgid "x"
705
  msgstr ""
706
 
707
+ #: app/main/profile/BPMediaTemplate.php:249
708
  msgid "Select"
709
  msgstr ""
710
 
711
+ #: app/main/profile/BPMediaTemplate.php:260
712
  msgid "Album Name"
713
  msgstr ""
714
 
715
+ #: app/main/profile/BPMediaTemplate.php:268
716
  msgid "Add Media"
717
  msgstr ""
718
 
719
  #: app/main/profile/BPMediaScreen.php:112
720
+ #: app/main/profile/BPMediaScreen.php:372
721
  msgid "The requested url does not exist"
722
  msgstr ""
723
 
726
  msgid "All %s"
727
  msgstr ""
728
 
729
+ #: app/main/profile/BPMediaScreen.php:195
730
+ #: app/main/profile/BPMediaAlbumScreen.php:80
731
  #, php-format
732
  msgid "Sorry, no %s were found."
733
  msgstr ""
734
 
735
+ #: app/main/profile/BPMediaScreen.php:306
736
  #, php-format
737
  msgid "Edit %s"
738
  msgstr ""
739
 
740
+ #: app/main/profile/BPMediaScreen.php:327
741
  #, php-format
742
  msgid "%s Title"
743
  msgstr ""
744
 
745
+ #: app/main/profile/BPMediaScreen.php:333
746
  #, php-format
747
  msgid "%s Description"
748
  msgstr ""
749
 
750
+ #: app/main/profile/BPMediaScreen.php:340
751
  msgid "Update"
752
  msgstr ""
753
 
754
+ #: app/main/profile/BPMediaScreen.php:341
755
  msgid "Back to Media File"
756
  msgstr ""
757
 
758
+ #: app/main/profile/BPMediaScreen.php:342
759
  msgid "Back to Media"
760
  msgstr ""
761
 
762
+ #: app/main/profile/BPMediaScreen.php:365
763
  msgid "You do not have access to this page."
764
  msgstr ""
765
 
766
+ #: app/main/profile/BPMediaScreen.php:394
767
  msgid "Media deleted successfully"
768
  msgstr ""
769
 
796
  msgid "You did not specified a file to upload"
797
  msgstr ""
798
 
799
+ #: app/main/profile/BPMediaAlbumScreen.php:135
800
  msgid "Edit"
801
  msgstr ""
802
 
803
+ #: app/main/profile/BPMediaAlbumScreen.php:136
804
  msgid "Delete"
805
  msgstr ""
806
 
807
+ #: app/main/profile/BPMediaAlbumScreen.php:155
808
  msgid "Sorry, no media items were found in this album."
809
  msgstr ""
810
 
812
  msgid "Sorry, the requested album does not exist."
813
  msgstr ""
814
 
815
+ #: app/main/group/BPMediaGroupElementExtension.php:79
816
  msgid "Sorry, the requested media does not belong to the group"
817
  msgstr ""
818
 
819
+ #: app/main/group/BPMediaGroupAction.php:124
820
+ #: app/main/includes/BPMediaHostWordpress.php:654
821
+ #, php-format
822
+ msgid "%1$s added a %2$s"
823
+ msgstr ""
824
+
825
  #: app/main/group/BPMediaGroupsExtension.php:40
826
  #: app/main/group/BPMediaGroupsExtension.php:87
827
  msgid "Album Creation Control"
866
  "\t home screen."
867
  msgstr ""
868
 
869
+ #: app/main/activity/BPMediaActivity.php:47
870
+ msgid "Attach Media"
871
  msgstr ""
872
 
873
+ #: app/main/activity/BPMediaActivity.php:100
874
+ msgid "View"
875
  msgstr ""
876
 
877
+ #: app/main/activity/BPMediaActivity.php:154
878
  #, php-format
879
+ msgid "%1$s posted an update in the group %2$s"
880
  msgstr ""
881
 
882
  #: app/main/widgets/BPMediaWidget.php:20
887
  msgid "BuddyPress Media Widget"
888
  msgstr ""
889
 
890
+ #: app/main/widgets/BPMediaWidget.php:67
891
  msgid "All"
892
  msgstr ""
893
 
894
+ #: app/main/widgets/BPMediaWidget.php:77
895
  #, php-format
896
  msgid ""
897
  "Please configure this widget\n"
900
  "\t\t\t\t\t\t\t\t\there</a>."
901
  msgstr ""
902
 
903
+ #: app/main/widgets/BPMediaWidget.php:123
904
  msgid "No "
905
  msgstr ""
906
 
907
+ #: app/main/widgets/BPMediaWidget.php:169
908
  msgid "Widget Type:"
909
  msgstr ""
910
 
911
+ #: app/main/widgets/BPMediaWidget.php:171
912
  msgid "Recent Media"
913
  msgstr ""
914
 
915
+ #: app/main/widgets/BPMediaWidget.php:172
916
  msgid "Popular Media"
917
  msgstr ""
918
 
919
+ #: app/main/widgets/BPMediaWidget.php:175
920
  msgid "Title:"
921
  msgstr ""
922
 
923
+ #: app/main/widgets/BPMediaWidget.php:178
924
  msgid "Number of posts to show:"
925
  msgstr ""
926
 
927
+ #: app/main/widgets/BPMediaWidget.php:182
928
  msgid "Show All"
929
  msgstr ""
930
 
931
+ #: app/main/widgets/BPMediaWidget.php:185
932
  msgid "Show Photos"
933
  msgstr ""
934
 
935
+ #: app/main/widgets/BPMediaWidget.php:188
936
  msgid "Show Music"
937
  msgstr ""
938
 
939
+ #: app/main/widgets/BPMediaWidget.php:192
940
  msgid "Show Videos"
941
  msgstr ""
942
 
944
  msgid "Update BuddyPress Media Database"
945
  msgstr ""
946
 
947
+ #: app/main/privacy/BPMediaPrivacySettings.php:93
948
  msgid "Start"
949
  msgstr ""
950
 
951
+ #: app/main/privacy/BPMediaPrivacy.php:113
952
  msgid "<strong>Private</strong>, Visible only to myself"
953
  msgstr ""
954
 
955
+ #: app/main/privacy/BPMediaPrivacy.php:117
956
  msgid "<strong>Friends</strong>, Visible to my friends"
957
  msgstr ""
958
 
959
+ #: app/main/privacy/BPMediaPrivacy.php:121
960
+ msgid "<strong>Users</strong>, Visible to registered users"
961
+ msgstr ""
962
+
963
+ #: app/main/privacy/BPMediaPrivacy.php:125
964
+ msgid "<strong>Public</strong>, Visible to the world"
965
+ msgstr ""
966
+
967
+ #: app/main/privacy/BPMediaPrivacy.php:145
968
  msgid "Set default privacy levels for your media"
969
  msgstr ""
970
 
971
+ #: app/main/privacy/BPMediaPrivacy.php:326
972
  #, php-format
973
  msgid "This %s is private"
974
  msgstr ""
975
 
976
+ #: app/main/privacy/BPMediaPrivacy.php:327
977
  #, php-format
978
  msgid "This %1s is visible only to %2s&rsquo;s friends"
979
  msgstr ""
980
 
981
+ #: app/main/privacy/BPMediaPrivacy.php:328
982
  #, php-format
983
  msgid "This %s is visible to logged in users, only"
984
  msgstr ""
987
  msgid "Default privacy level for your media has been updated"
988
  msgstr ""
989
 
 
 
 
 
990
  #: app/main/includes/BPMediaHostWordpress.php:59
991
  msgid "Sorry, the requested media does not exist."
992
  msgstr ""
993
 
994
+ #: app/main/includes/BPMediaHostWordpress.php:138
995
  msgid "Error Uploading File"
996
  msgstr ""
997
 
998
+ #: app/main/includes/BPMediaHostWordpress.php:165
999
  msgid "MP4 file you have uploaded is corrupt."
1000
  msgstr ""
1001
 
1002
+ #: app/main/includes/BPMediaHostWordpress.php:172
1003
+ #: app/main/includes/BPMediaHostWordpress.php:177
1004
  msgid "The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264."
1005
  msgstr ""
1006
 
1007
+ #: app/main/includes/BPMediaHostWordpress.php:182
1008
  msgid "The MP4 file you have uploaded is not a video file."
1009
  msgstr ""
1010
 
1011
+ #: app/main/includes/BPMediaHostWordpress.php:193
1012
  msgid "MP3 file you have uploaded is currupt."
1013
  msgstr ""
1014
 
1015
+ #: app/main/includes/BPMediaHostWordpress.php:200
1016
+ #: app/main/includes/BPMediaHostWordpress.php:205
1017
  msgid "The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3."
1018
  msgstr ""
1019
 
1020
+ #: app/main/includes/BPMediaHostWordpress.php:210
1021
  msgid "The MP3 file you have uploaded is not an audio file."
1022
  msgstr ""
1023
 
1024
+ #: app/main/includes/BPMediaHostWordpress.php:222
1025
  msgid "Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4."
1026
  msgstr ""
1027
 
1028
+ #: app/main/includes/BPMediaHostWordpress.php:229
1029
  msgid "Error creating attachment for the media file, please try again"
1030
  msgstr ""
1031
 
1032
+ #: app/main/includes/BPMediaHostWordpress.php:335
1033
  #, php-format
1034
  msgid "%s uploaded a media."
1035
  msgstr ""
1036
 
1037
+ #: app/main/includes/BPMediaHostWordpress.php:356
1038
  msgid "Uploaded by "
1039
  msgstr ""
1040
 
1041
+ #: app/main/includes/BPMediaHostWordpress.php:502
1042
  #, php-format
1043
  msgid "Comment <span>%s</span>"
1044
  msgstr ""
1045
 
1046
+ #: app/main/includes/BPMediaHostWordpress.php:506
1047
  msgid "Favorite"
1048
  msgstr ""
1049
 
1050
+ #: app/main/includes/BPMediaHostWordpress.php:508
1051
  msgid "Remove Favorite"
1052
  msgstr ""
1053
 
1054
+ #: app/main/includes/BPMediaHostWordpress.php:527
1055
  msgid "Post"
1056
  msgstr ""
1057
 
1058
+ #: app/main/includes/BPMediaHostWordpress.php:527
1059
  msgid "or press esc to cancel."
1060
  msgstr ""
1061
 
1071
  msgid "Select Media File"
1072
  msgstr ""
1073
 
1074
+ #: app/main/includes/BPMediaFunction.php:233
1075
+ #, php-format
1076
+ msgid "%1$s added new media in album %2$s"
1077
+ msgstr ""
1078
+
1079
  #: app/main/includes/BPMediaFilters.php:138
1080
  #, php-format
1081
  msgid "Delete %s"
1101
  msgid "Total Albums"
1102
  msgstr ""
1103
 
1104
+ #: app/main/includes/BPMediaActions.php:311
 
 
 
 
1105
  msgid "Download"
1106
  msgstr ""
1107
 
1108
+ #: app/main/includes/BPMediaActions.php:318
1109
+ #: app/main/includes/BPMediaActions.php:839
1110
  msgid "Set as Album Cover"
1111
  msgstr ""
1112
 
1113
+ #: app/main/includes/BPMediaActions.php:323
1114
+ #: app/main/includes/BPMediaActions.php:842
1115
  msgid "Unset as Album Cover"
1116
  msgstr ""
1117
 
1118
+ #: app/main/includes/BPMediaActions.php:329
1119
+ msgid "Edit Media"
1120
+ msgstr ""
1121
+
1122
+ #: app/main/includes/BPMediaActions.php:742
1123
  #, php-format
1124
  msgid "%1$s created an album %2$s"
1125
  msgstr ""
lib/simplemodal/jquery.simplemodal-1.4.4.js ADDED
@@ -0,0 +1,758 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SimpleModal 1.4.4 - jQuery Plugin
3
+ * http://simplemodal.com/
4
+ * Copyright (c) 2013 Eric Martin
5
+ * Licensed under MIT and GPL
6
+ * Date: Sun, Jan 20 2013 15:58:56 -0800
7
+ */
8
+
9
+ /**
10
+ * SimpleModal is a lightweight jQuery plugin that provides a simple
11
+ * interface to create a modal dialog.
12
+ *
13
+ * The goal of SimpleModal is to provide developers with a cross-browser
14
+ * overlay and container that will be populated with data provided to
15
+ * SimpleModal.
16
+ *
17
+ * There are two ways to call SimpleModal:
18
+ * 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
19
+ * This call would place the DOM object, #myDiv, inside a modal dialog.
20
+ * Chaining requires a jQuery object. An optional options object can be
21
+ * passed as a parameter.
22
+ *
23
+ * @example $('<div>my data</div>').modal({options});
24
+ * @example $('#myDiv').modal({options});
25
+ * @example jQueryObject.modal({options});
26
+ *
27
+ * 2) As a stand-alone function, like $.modal(data). The data parameter
28
+ * is required and an optional options object can be passed as a second
29
+ * parameter. This method provides more flexibility in the types of data
30
+ * that are allowed. The data could be a DOM object, a jQuery object, HTML
31
+ * or a string.
32
+ *
33
+ * @example $.modal('<div>my data</div>', {options});
34
+ * @example $.modal('my data', {options});
35
+ * @example $.modal($('#myDiv'), {options});
36
+ * @example $.modal(jQueryObject, {options});
37
+ * @example $.modal(document.getElementById('myDiv'), {options});
38
+ *
39
+ * A SimpleModal call can contain multiple elements, but only one modal
40
+ * dialog can be created at a time. Which means that all of the matched
41
+ * elements will be displayed within the modal container.
42
+ *
43
+ * SimpleModal internally sets the CSS needed to display the modal dialog
44
+ * properly in all browsers, yet provides the developer with the flexibility
45
+ * to easily control the look and feel. The styling for SimpleModal can be
46
+ * done through external stylesheets, or through SimpleModal, using the
47
+ * overlayCss, containerCss, and dataCss options.
48
+ *
49
+ * SimpleModal has been tested in the following browsers:
50
+ * - IE 6+
51
+ * - Firefox 2+
52
+ * - Opera 9+
53
+ * - Safari 3+
54
+ * - Chrome 1+
55
+ *
56
+ * @name SimpleModal
57
+ * @type jQuery
58
+ * @requires jQuery v1.3
59
+ * @cat Plugins/Windows and Overlays
60
+ * @author Eric Martin (http://ericmmartin.com)
61
+ * @version 1.4.4
62
+ */
63
+
64
+ ;
65
+ (function (factory) {
66
+ if (typeof define === 'function' && define.amd) {
67
+ // AMD. Register as an anonymous module.
68
+ define(['jquery'], factory);
69
+ } else {
70
+ // Browser globals
71
+ factory(jQuery);
72
+ }
73
+ }
74
+ (function ($) {
75
+ var d = [],
76
+ doc = $(document),
77
+ ua = navigator.userAgent.toLowerCase(),
78
+ wndw = $(window),
79
+ w = [];
80
+
81
+ var browser = {
82
+ ieQuirks: null,
83
+ msie: /msie/.test(ua) && !/opera/.test(ua),
84
+ opera: /opera/.test(ua)
85
+ };
86
+ browser.ie6 = browser.msie && /msie 6./.test(ua) && typeof window['XMLHttpRequest'] !== 'object';
87
+ browser.ie7 = browser.msie && /msie 7.0/.test(ua);
88
+
89
+ /*
90
+ * Create and display a modal dialog.
91
+ *
92
+ * @param {string, object} data A string, jQuery object or DOM object
93
+ * @param {object} [options] An optional object containing options overrides
94
+ */
95
+ $.modal = function (data, options) {
96
+ return $.modal.impl.init(data, options);
97
+ };
98
+
99
+ /*
100
+ * Close the modal dialog.
101
+ */
102
+ $.modal.close = function () {
103
+ $.modal.impl.close();
104
+ };
105
+
106
+ /*
107
+ * Set focus on first or last visible input in the modal dialog. To focus on the last
108
+ * element, call $.modal.focus('last'). If no input elements are found, focus is placed
109
+ * on the data wrapper element.
110
+ */
111
+ $.modal.focus = function (pos) {
112
+ $.modal.impl.focus(pos);
113
+ };
114
+
115
+ /*
116
+ * Determine and set the dimensions of the modal dialog container.
117
+ * setPosition() is called if the autoPosition option is true.
118
+ */
119
+ $.modal.setContainerDimensions = function () {
120
+ $.modal.impl.setContainerDimensions();
121
+ };
122
+
123
+ /*
124
+ * Re-position the modal dialog.
125
+ */
126
+ $.modal.setPosition = function () {
127
+ $.modal.impl.setPosition();
128
+ };
129
+
130
+ /*
131
+ * Update the modal dialog. If new dimensions are passed, they will be used to determine
132
+ * the dimensions of the container.
133
+ *
134
+ * setContainerDimensions() is called, which in turn calls setPosition(), if enabled.
135
+ * Lastly, focus() is called is the focus option is true.
136
+ */
137
+ $.modal.update = function (height, width) {
138
+ $.modal.impl.update(height, width);
139
+ };
140
+
141
+ /*
142
+ * Chained function to create a modal dialog.
143
+ *
144
+ * @param {object} [options] An optional object containing options overrides
145
+ */
146
+ $.fn.modal = function (options) {
147
+ return $.modal.impl.init(this, options);
148
+ };
149
+
150
+ /*
151
+ * SimpleModal default options
152
+ *
153
+ * appendTo: (String:'body') The jQuery selector to append the elements to. For .NET, use 'form'.
154
+ * focus: (Boolean:true) Focus in the first visible, enabled element?
155
+ * opacity: (Number:50) The opacity value for the overlay div, from 0 - 100
156
+ * overlayId: (String:'simplemodal-overlay') The DOM element id for the overlay div
157
+ * overlayCss: (Object:{}) The CSS styling for the overlay div
158
+ * containerId: (String:'simplemodal-container') The DOM element id for the container div
159
+ * containerCss: (Object:{}) The CSS styling for the container div
160
+ * dataId: (String:'simplemodal-data') The DOM element id for the data div
161
+ * dataCss: (Object:{}) The CSS styling for the data div
162
+ * minHeight: (Number:null) The minimum height for the container
163
+ * minWidth: (Number:null) The minimum width for the container
164
+ * maxHeight: (Number:null) The maximum height for the container. If not specified, the window height is used.
165
+ * maxWidth: (Number:null) The maximum width for the container. If not specified, the window width is used.
166
+ * autoResize: (Boolean:false) Automatically resize the container if it exceeds the browser window dimensions?
167
+ * autoPosition: (Boolean:true) Automatically position the container upon creation and on window resize?
168
+ * zIndex: (Number: 1000) Starting z-index value
169
+ * close: (Boolean:true) If true, closeHTML, escClose and overClose will be used if set.
170
+ If false, none of them will be used.
171
+ * closeHTML: (String:'<a class="modalCloseImg" title="Close"></a>') The HTML for the default close link.
172
+ SimpleModal will automatically add the closeClass to this element.
173
+ * closeClass: (String:'simplemodal-close') The CSS class used to bind to the close event
174
+ * escClose: (Boolean:true) Allow Esc keypress to close the dialog?
175
+ * overlayClose: (Boolean:false) Allow click on overlay to close the dialog?
176
+ * fixed: (Boolean:true) If true, the container will use a fixed position. If false, it will use a
177
+ absolute position (the dialog will scroll with the page)
178
+ * position: (Array:null) Position of container [top, left]. Can be number of pixels or percentage
179
+ * persist: (Boolean:false) Persist the data across modal calls? Only used for existing
180
+ DOM elements. If true, the data will be maintained across modal calls, if false,
181
+ the data will be reverted to its original state.
182
+ * modal: (Boolean:true) User will be unable to interact with the page below the modal or tab away from the dialog.
183
+ If false, the overlay, iframe, and certain events will be disabled allowing the user to interact
184
+ with the page below the dialog.
185
+ * onOpen: (Function:null) The callback function used in place of SimpleModal's open
186
+ * onShow: (Function:null) The callback function used after the modal dialog has opened
187
+ * onClose: (Function:null) The callback function used in place of SimpleModal's close
188
+ */
189
+ $.modal.defaults = {
190
+ appendTo: 'body',
191
+ focus: true,
192
+ opacity: 50,
193
+ overlayId: 'simplemodal-overlay',
194
+ overlayCss: {},
195
+ containerId: 'simplemodal-container',
196
+ containerCss: {},
197
+ dataId: 'simplemodal-data',
198
+ dataCss: {},
199
+ minHeight: null,
200
+ minWidth: null,
201
+ maxHeight: null,
202
+ maxWidth: null,
203
+ autoResize: false,
204
+ autoPosition: true,
205
+ zIndex: 1000,
206
+ close: true,
207
+ closeHTML: '<a class="modalCloseImg" title="Close"></a>',
208
+ closeClass: 'simplemodal-close',
209
+ escClose: true,
210
+ overlayClose: false,
211
+ fixed: true,
212
+ position: null,
213
+ persist: false,
214
+ modal: true,
215
+ onOpen: null,
216
+ onShow: null,
217
+ onClose: null
218
+ };
219
+
220
+ /*
221
+ * Main modal object
222
+ * o = options
223
+ */
224
+ $.modal.impl = {
225
+ /*
226
+ * Contains the modal dialog elements and is the object passed
227
+ * back to the callback (onOpen, onShow, onClose) functions
228
+ */
229
+ d: {},
230
+ /*
231
+ * Initialize the modal dialog
232
+ */
233
+ init: function (data, options) {
234
+ var s = this;
235
+
236
+ // don't allow multiple calls
237
+ if (s.d.data) {
238
+ return false;
239
+ }
240
+
241
+ // $.support.boxModel is undefined if checked earlier
242
+ browser.ieQuirks = browser.msie && !$.support.boxModel;
243
+
244
+ // merge defaults and user options
245
+ s.o = $.extend({}, $.modal.defaults, options);
246
+
247
+ // keep track of z-index
248
+ s.zIndex = s.o.zIndex;
249
+
250
+ // set the onClose callback flag
251
+ s.occb = false;
252
+
253
+ // determine how to handle the data based on its type
254
+ if (typeof data === 'object') {
255
+ // convert DOM object to a jQuery object
256
+ data = data instanceof $ ? data : $(data);
257
+ s.d.placeholder = false;
258
+
259
+ // if the object came from the DOM, keep track of its parent
260
+ if (data.parent().parent().size() > 0) {
261
+ data.before($('<span></span>')
262
+ .attr('id', 'simplemodal-placeholder')
263
+ .css({
264
+ display: 'none'
265
+ }));
266
+
267
+ s.d.placeholder = true;
268
+ s.display = data.css('display');
269
+
270
+ // persist changes? if not, make a clone of the element
271
+ if (!s.o.persist) {
272
+ s.d.orig = data.clone(true);
273
+ }
274
+ }
275
+ }
276
+ else if (typeof data === 'string' || typeof data === 'number') {
277
+ // just insert the data as innerHTML
278
+ data = $('<div></div>').html(data);
279
+ }
280
+ else {
281
+ // unsupported data type!
282
+ alert('SimpleModal Error: Unsupported data type: ' + typeof data);
283
+ return s;
284
+ }
285
+
286
+ // create the modal overlay, container and, if necessary, iframe
287
+ s.create(data);
288
+ data = null;
289
+
290
+ // display the modal dialog
291
+ s.open();
292
+
293
+ // useful for adding events/manipulating data in the modal dialog
294
+ if ($.isFunction(s.o.onShow)) {
295
+ s.o.onShow.apply(s, [s.d]);
296
+ }
297
+
298
+ // don't break the chain =)
299
+ return s;
300
+ },
301
+ /*
302
+ * Create and add the modal overlay and container to the page
303
+ */
304
+ create: function (data) {
305
+ var s = this;
306
+
307
+ // get the window properties
308
+ s.getDimensions();
309
+
310
+ // add an iframe to prevent select options from bleeding through
311
+ if (s.o.modal && browser.ie6) {
312
+ s.d.iframe = $('<iframe src="javascript:false;"></iframe>')
313
+ .css($.extend(s.o.iframeCss, {
314
+ display: 'none',
315
+ opacity: 0,
316
+ position: 'fixed',
317
+ height: w[0],
318
+ width: w[1],
319
+ zIndex: s.o.zIndex,
320
+ top: 0,
321
+ left: 0
322
+ }))
323
+ .appendTo(s.o.appendTo);
324
+ }
325
+
326
+ // create the overlay
327
+ s.d.overlay = $('<div></div>')
328
+ .attr('id', s.o.overlayId)
329
+ .addClass('simplemodal-overlay')
330
+ .css($.extend(s.o.overlayCss, {
331
+ display: 'none',
332
+ opacity: s.o.opacity / 100,
333
+ height: s.o.modal ? d[0] : 0,
334
+ width: s.o.modal ? d[1] : 0,
335
+ position: 'fixed',
336
+ left: 0,
337
+ top: 0,
338
+ zIndex: s.o.zIndex + 1
339
+ }))
340
+ .appendTo(s.o.appendTo);
341
+
342
+ // create the container
343
+ s.d.container = $('<div></div>')
344
+ .attr('id', s.o.containerId)
345
+ .addClass('simplemodal-container')
346
+ .css($.extend(
347
+ {
348
+ position: s.o.fixed ? 'fixed' : 'absolute'
349
+ },
350
+ s.o.containerCss,
351
+ {
352
+ display: 'none',
353
+ zIndex: s.o.zIndex + 2
354
+ }
355
+ ))
356
+ .append(s.o.close && s.o.closeHTML
357
+ ? $(s.o.closeHTML).addClass(s.o.closeClass)
358
+ : '')
359
+ .appendTo(s.o.appendTo);
360
+
361
+ s.d.wrap = $('<div></div>')
362
+ .attr('tabIndex', -1)
363
+ .addClass('simplemodal-wrap')
364
+ .css({
365
+ height: '100%',
366
+ outline: 0,
367
+ width: '100%'
368
+ })
369
+ .appendTo(s.d.container);
370
+
371
+ // add styling and attributes to the data
372
+ // append to body to get correct dimensions, then move to wrap
373
+ s.d.data = data
374
+ .attr('id', data.attr('id') || s.o.dataId)
375
+ .addClass('simplemodal-data')
376
+ .css($.extend(s.o.dataCss, {
377
+ display: 'none'
378
+ }))
379
+ .appendTo('body');
380
+ data = null;
381
+
382
+ s.setContainerDimensions();
383
+ s.d.data.appendTo(s.d.wrap);
384
+
385
+ // fix issues with IE
386
+ if (browser.ie6 || browser.ieQuirks) {
387
+ s.fixIE();
388
+ }
389
+ },
390
+ /*
391
+ * Bind events
392
+ */
393
+ bindEvents: function () {
394
+ var s = this;
395
+
396
+ // bind the close event to any element with the closeClass class
397
+ $('.' + s.o.closeClass).bind('click.simplemodal', function (e) {
398
+ e.preventDefault();
399
+ s.close();
400
+ });
401
+
402
+ // bind the overlay click to the close function, if enabled
403
+ if (s.o.modal && s.o.close && s.o.overlayClose) {
404
+ s.d.overlay.bind('click.simplemodal', function (e) {
405
+ e.preventDefault();
406
+ s.close();
407
+ });
408
+ }
409
+
410
+ // bind keydown events
411
+ doc.bind('keydown.simplemodal', function (e) {
412
+ if (s.o.modal && e.keyCode === 9) { // TAB
413
+ s.watchTab(e);
414
+ }
415
+ else if ((s.o.close && s.o.escClose) && e.keyCode === 27) { // ESC
416
+ e.preventDefault();
417
+ s.close();
418
+ }
419
+ });
420
+
421
+ // update window size
422
+ wndw.bind('resize.simplemodal orientationchange.simplemodal', function () {
423
+ // redetermine the window width/height
424
+ s.getDimensions();
425
+
426
+ // reposition the dialog
427
+ s.o.autoResize ? s.setContainerDimensions() : s.o.autoPosition && s.setPosition();
428
+
429
+ if (browser.ie6 || browser.ieQuirks) {
430
+ s.fixIE();
431
+ }
432
+ else if (s.o.modal) {
433
+ // update the iframe & overlay
434
+ s.d.iframe && s.d.iframe.css({
435
+ height: w[0],
436
+ width: w[1]
437
+ });
438
+ s.d.overlay.css({
439
+ height: d[0],
440
+ width: d[1]
441
+ });
442
+ }
443
+ });
444
+ },
445
+ /*
446
+ * Unbind events
447
+ */
448
+ unbindEvents: function () {
449
+ $('.' + this.o.closeClass).unbind('click.simplemodal');
450
+ doc.unbind('keydown.simplemodal');
451
+ wndw.unbind('.simplemodal');
452
+ this.d.overlay.unbind('click.simplemodal');
453
+ },
454
+ /*
455
+ * Fix issues in IE6 and IE7 in quirks mode
456
+ */
457
+ fixIE: function () {
458
+ var s = this, p = s.o.position;
459
+
460
+ // simulate fixed position - adapted from BlockUI
461
+ $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container.css('position') === 'fixed' ? s.d.container : null], function (i, el) {
462
+ if (el) {
463
+ var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth',
464
+ bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft',
465
+ bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth',
466
+ ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth',
467
+ sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop',
468
+ s = el[0].style;
469
+
470
+ s.position = 'absolute';
471
+ if (i < 2) {
472
+ s.removeExpression('height');
473
+ s.removeExpression('width');
474
+ s.setExpression('height','' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"');
475
+ s.setExpression('width','' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"');
476
+ }
477
+ else {
478
+ var te, le;
479
+ if (p && p.constructor === Array) {
480
+ var top = p[0]
481
+ ? typeof p[0] === 'number' ? p[0].toString() : p[0].replace(/px/, '')
482
+ : el.css('top').replace(/px/, '');
483
+ te = top.indexOf('%') === -1
484
+ ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'
485
+ : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
486
+
487
+ if (p[1]) {
488
+ var left = typeof p[1] === 'number' ? p[1].toString() : p[1].replace(/px/, '');
489
+ le = left.indexOf('%') === -1
490
+ ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'
491
+ : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
492
+ }
493
+ }
494
+ else {
495
+ te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
496
+ le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
497
+ }
498
+ s.removeExpression('top');
499
+ s.removeExpression('left');
500
+ s.setExpression('top', te);
501
+ s.setExpression('left', le);
502
+ }
503
+ }
504
+ });
505
+ },
506
+ /*
507
+ * Place focus on the first or last visible input
508
+ */
509
+ focus: function (pos) {
510
+ var s = this, p = pos && $.inArray(pos, ['first', 'last']) !== -1 ? pos : 'first';
511
+
512
+ // focus on dialog or the first visible/enabled input element
513
+ var input = $(':input:enabled:visible:' + p, s.d.wrap);
514
+ setTimeout(function () {
515
+ input.length > 0 ? input.focus() : s.d.wrap.focus();
516
+ }, 10);
517
+ },
518
+ getDimensions: function () {
519
+ // fix a jQuery bug with determining the window height - use innerHeight if available
520
+ var s = this,
521
+ h = typeof window.innerHeight === 'undefined' ? wndw.height() : window.innerHeight;
522
+
523
+ d = [doc.height(), doc.width()];
524
+ w = [h, wndw.width()];
525
+ },
526
+ getVal: function (v, d) {
527
+ return v ? (typeof v === 'number' ? v
528
+ : v === 'auto' ? 0
529
+ : v.indexOf('%') > 0 ? ((parseInt(v.replace(/%/, '')) / 100) * (d === 'h' ? w[0] : w[1]))
530
+ : parseInt(v.replace(/px/, '')))
531
+ : null;
532
+ },
533
+ /*
534
+ * Update the container. Set new dimensions, if provided.
535
+ * Focus, if enabled. Re-bind events.
536
+ */
537
+ update: function (height, width) {
538
+ var s = this;
539
+
540
+ // prevent update if dialog does not exist
541
+ if (!s.d.data) {
542
+ return false;
543
+ }
544
+
545
+ // reset orig values
546
+ s.d.origHeight = s.getVal(height, 'h');
547
+ s.d.origWidth = s.getVal(width, 'w');
548
+
549
+ // hide data to prevent screen flicker
550
+ s.d.data.hide();
551
+ height && s.d.container.css('height', height);
552
+ width && s.d.container.css('width', width);
553
+ s.setContainerDimensions();
554
+ s.d.data.show();
555
+ s.o.focus && s.focus();
556
+
557
+ // rebind events
558
+ s.unbindEvents();
559
+ s.bindEvents();
560
+ },
561
+ setContainerDimensions: function () {
562
+ var s = this,
563
+ badIE = browser.ie6 || browser.ie7;
564
+
565
+ // get the dimensions for the container and data
566
+ var ch = s.d.origHeight ? s.d.origHeight : browser.opera ? s.d.container.height() : s.getVal(badIE ? s.d.container[0].currentStyle['height'] : s.d.container.css('height'), 'h'),
567
+ cw = s.d.origWidth ? s.d.origWidth : browser.opera ? s.d.container.width() : s.getVal(badIE ? s.d.container[0].currentStyle['width'] : s.d.container.css('width'), 'w'),
568
+ dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true);
569
+
570
+ s.d.origHeight = s.d.origHeight || ch;
571
+ s.d.origWidth = s.d.origWidth || cw;
572
+
573
+ // mxoh = max option height, mxow = max option width
574
+ var mxoh = s.o.maxHeight ? s.getVal(s.o.maxHeight, 'h') : null,
575
+ mxow = s.o.maxWidth ? s.getVal(s.o.maxWidth, 'w') : null,
576
+ mh = mxoh && mxoh < w[0] ? mxoh : w[0],
577
+ mw = mxow && mxow < w[1] ? mxow : w[1];
578
+
579
+ // moh = min option height
580
+ var moh = s.o.minHeight ? s.getVal(s.o.minHeight, 'h') : 'auto';
581
+ if (!ch) {
582
+ if (!dh) {
583
+ ch = moh;
584
+ }
585
+ else {
586
+ if (dh > mh) {
587
+ ch = mh;
588
+ }
589
+ else if (s.o.minHeight && moh !== 'auto' && dh < moh) {
590
+ ch = moh;
591
+ }
592
+ else {
593
+ ch = dh;
594
+ }
595
+ }
596
+ }
597
+ else {
598
+ ch = s.o.autoResize && ch > mh ? mh : ch < moh ? moh : ch;
599
+ }
600
+
601
+ // mow = min option width
602
+ var mow = s.o.minWidth ? s.getVal(s.o.minWidth, 'w') : 'auto';
603
+ if (!cw) {
604
+ if (!dw) {
605
+ cw = mow;
606
+ }
607
+ else {
608
+ if (dw > mw) {
609
+ cw = mw;
610
+ }
611
+ else if (s.o.minWidth && mow !== 'auto' && dw < mow) {
612
+ cw = mow;
613
+ }
614
+ else {
615
+ cw = dw;
616
+ }
617
+ }
618
+ }
619
+ else {
620
+ cw = s.o.autoResize && cw > mw ? mw : cw < mow ? mow : cw;
621
+ }
622
+
623
+ s.d.container.css({
624
+ height: ch,
625
+ width: cw
626
+ });
627
+ s.d.wrap.css({
628
+ overflow: (dh > ch || dw > cw) ? 'auto' : 'visible'
629
+ });
630
+ s.o.autoPosition && s.setPosition();
631
+ },
632
+ setPosition: function () {
633
+ var s = this, top, left,
634
+ hc = (w[0]/2) - (s.d.container.outerHeight(true)/2),
635
+ vc = (w[1]/2) - (s.d.container.outerWidth(true)/2),
636
+ st = s.d.container.css('position') !== 'fixed' ? wndw.scrollTop() : 0;
637
+
638
+ if (s.o.position && Object.prototype.toString.call(s.o.position) === '[object Array]') {
639
+ top = st + (s.o.position[0] || hc);
640
+ left = s.o.position[1] || vc;
641
+ } else {
642
+ top = st + hc;
643
+ left = vc;
644
+ }
645
+ s.d.container.css({
646
+ left: left,
647
+ top: top
648
+ });
649
+ },
650
+ watchTab: function (e) {
651
+ var s = this;
652
+
653
+ if ($(e.target).parents('.simplemodal-container').length > 0) {
654
+ // save the list of inputs
655
+ s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]);
656
+
657
+ // if it's the first or last tabbable element, refocus
658
+ if ((!e.shiftKey && e.target === s.inputs[s.inputs.length -1]) ||
659
+ (e.shiftKey && e.target === s.inputs[0]) ||
660
+ s.inputs.length === 0) {
661
+ e.preventDefault();
662
+ var pos = e.shiftKey ? 'last' : 'first';
663
+ s.focus(pos);
664
+ }
665
+ }
666
+ else {
667
+ // might be necessary when custom onShow callback is used
668
+ e.preventDefault();
669
+ s.focus();
670
+ }
671
+ },
672
+ /*
673
+ * Open the modal dialog elements
674
+ * - Note: If you use the onOpen callback, you must "show" the
675
+ * overlay and container elements manually
676
+ * (the iframe will be handled by SimpleModal)
677
+ */
678
+ open: function () {
679
+ var s = this;
680
+ // display the iframe
681
+ s.d.iframe && s.d.iframe.show();
682
+
683
+ if ($.isFunction(s.o.onOpen)) {
684
+ // execute the onOpen callback
685
+ s.o.onOpen.apply(s, [s.d]);
686
+ }
687
+ else {
688
+ // display the remaining elements
689
+ s.d.overlay.show();
690
+ s.d.container.show();
691
+ s.d.data.show();
692
+ }
693
+
694
+ s.o.focus && s.focus();
695
+
696
+ // bind default events
697
+ s.bindEvents();
698
+ },
699
+ /*
700
+ * Close the modal dialog
701
+ * - Note: If you use an onClose callback, you must remove the
702
+ * overlay, container and iframe elements manually
703
+ *
704
+ * @param {boolean} external Indicates whether the call to this
705
+ * function was internal or external. If it was external, the
706
+ * onClose callback will be ignored
707
+ */
708
+ close: function () {
709
+ var s = this;
710
+
711
+ // prevent close when dialog does not exist
712
+ if (!s.d.data) {
713
+ return false;
714
+ }
715
+
716
+ // remove the default events
717
+ s.unbindEvents();
718
+
719
+ if ($.isFunction(s.o.onClose) && !s.occb) {
720
+ // set the onClose callback flag
721
+ s.occb = true;
722
+
723
+ // execute the onClose callback
724
+ s.o.onClose.apply(s, [s.d]);
725
+ }
726
+ else {
727
+ // if the data came from the DOM, put it back
728
+ if (s.d.placeholder) {
729
+ var ph = $('#simplemodal-placeholder');
730
+ // save changes to the data?
731
+ if (s.o.persist) {
732
+ // insert the (possibly) modified data back into the DOM
733
+ ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display));
734
+ }
735
+ else {
736
+ // remove the current and insert the original,
737
+ // unmodified data back into the DOM
738
+ s.d.data.hide().remove();
739
+ ph.replaceWith(s.d.orig);
740
+ }
741
+ }
742
+ else {
743
+ // otherwise, remove it
744
+ s.d.data.hide().remove();
745
+ }
746
+
747
+ // remove the remaining elements
748
+ s.d.container.hide().remove();
749
+ s.d.overlay.hide();
750
+ s.d.iframe && s.d.iframe.hide().remove();
751
+ s.d.overlay.remove();
752
+
753
+ // reset the dialog object
754
+ s.d = {};
755
+ }
756
+ }
757
+ };
758
+ }));
readme.txt CHANGED
@@ -4,9 +4,9 @@ Donate link: http://rtcamp.com/donate
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node
5
  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.6.7
10
 
11
  Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
@@ -23,23 +23,24 @@ BuddyPress Media adds Photos, Music, Videos & Albums to your BuddyPress powered
23
 
24
  = Features =
25
 
26
- [BuddyPress Media's Features page](http://rtcamp.com/buddypress-media/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media) "Visit BuddyPress Media's Features page")
27
 
28
  * **Media uploads**: Users can upload images, music and video straight from their profiles.
 
 
29
  * **Drag and drop**/ **Multiple** file uploader
30
  * **Mobile** uploads: Media can be uploaded on major mobile platforms (Android/iOS)
31
  * **Social**: All uploads show up in the activity streams. Other users can favourite and comment upon media.
32
  * User **albums**: Uploaded media can be organised into albums
33
  * **Groups** Supported: Users can upload media on Groups, as well!
34
  * **HTML5 playback**: with fall back to flash/silverlight player support
35
- * **Privacy** [*new*]: Users can control access to their uploaded media
36
  * **Automatic conversion** (*premium*): of common audio & video formats to mp3/mp4 via [Kaltura Add-On](http://rtcamp.com/store/buddypress-media-kaltura/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version"), and [FFMPEG Add-On](http://rtcamp.com/store/buddypress-media-ffmpeg/ "BuddyPress Media FFMPEG Addon")
37
 
38
  = Roadmap =
39
 
40
  [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Roadmap page")
41
 
42
- * **Activity uploads**: Users wil be able to upload media straight from within an activity update
43
  * **Importers**: Site admins will be able to import media from other media plugins for BuddyPress
44
  * **Video conversion service** integration [*new*]: Videos can be converted via a service without installing or configuring anything on your server.
45
  * **External media** support: Users will be able to add external media using url
@@ -65,6 +66,7 @@ Available [here](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/?utm_
65
  **Coming Soon**
66
 
67
  * **Instagram filters** [*new*] (*premium*): Users will be able to apply Instagram like effects to uploaded images.
 
68
  * **Membership Addon** (*premium*): Users can be given controlled upload quotas and media type access on their profiles and groups.
69
 
70
  = Support =
@@ -86,6 +88,7 @@ BuddyPress Media is now available in *Brazilian Portuguese*, *Spanish*, *Japanes
86
  * [Japanese](https://rtcamp.com/translate/projects/buddypress-media/ja/default) translation by [Tetsu Yamaoka](http://twitter.com/ytetsu)
87
  * [Polish](https://rtcamp.com/translate/projects/buddypress-media/pl/default) translation by [czemubynie](http://profiles.wordpress.org/czemubyniegmailcom/)
88
  * [Serbian](https://rtcamp.com/translate/projects/buddypress-media/sr/default) translation by [nikolakica](http://profiles.wordpress.org/nikolakica/)
 
89
 
90
  == Installation ==
91
 
@@ -112,10 +115,17 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
112
  9. Media Edit View
113
  10. Media Activity
114
  11. Media Widget
 
115
 
116
  == Changelog ==
117
 
118
  Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
 
 
 
 
 
 
119
 
120
  = 2.6.7 =
121
  * Fixes modular compatibility with friends component. Thanks to [Cat555](http://rtcamp.com/support/users/cat555/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media) for reporting this.
@@ -302,5 +312,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
302
  * HTML5 Video Tag Support (with fallback)
303
 
304
  == Upgrade Notice ==
305
- = 2.6.7 =
306
- Important bug fixes
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
+ Requires at least: WordPress 3.5 + BuddyPress 1.6
8
+ Tested up to: WordPress 3.5 + BuddyPress 1.6
9
+ Stable tag: 2.7
10
 
11
  Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
23
 
24
  = Features =
25
 
26
+ [BuddyPress Media's Features page](http://rtcamp.com/buddypress-media/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page")
27
 
28
  * **Media uploads**: Users can upload images, music and video straight from their profiles.
29
+ * **Activity uploads** [*new*]: Users can attach media to their status updates.
30
+ * **Lightbox** [*new*]: Browsing media becomes simpler with a lightbox that includes previous/next navigation.
31
  * **Drag and drop**/ **Multiple** file uploader
32
  * **Mobile** uploads: Media can be uploaded on major mobile platforms (Android/iOS)
33
  * **Social**: All uploads show up in the activity streams. Other users can favourite and comment upon media.
34
  * User **albums**: Uploaded media can be organised into albums
35
  * **Groups** Supported: Users can upload media on Groups, as well!
36
  * **HTML5 playback**: with fall back to flash/silverlight player support
37
+ * **Privacy**: Users can control access to their uploaded media
38
  * **Automatic conversion** (*premium*): of common audio & video formats to mp3/mp4 via [Kaltura Add-On](http://rtcamp.com/store/buddypress-media-kaltura/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version"), and [FFMPEG Add-On](http://rtcamp.com/store/buddypress-media-ffmpeg/ "BuddyPress Media FFMPEG Addon")
39
 
40
  = Roadmap =
41
 
42
  [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Roadmap page")
43
 
 
44
  * **Importers**: Site admins will be able to import media from other media plugins for BuddyPress
45
  * **Video conversion service** integration [*new*]: Videos can be converted via a service without installing or configuring anything on your server.
46
  * **External media** support: Users will be able to add external media using url
66
  **Coming Soon**
67
 
68
  * **Instagram filters** [*new*] (*premium*): Users will be able to apply Instagram like effects to uploaded images.
69
+ * **Photo tagging** [*new*] (*premium*): Users will be able to tag themselves and friends on the uploaded images.
70
  * **Membership Addon** (*premium*): Users can be given controlled upload quotas and media type access on their profiles and groups.
71
 
72
  = Support =
88
  * [Japanese](https://rtcamp.com/translate/projects/buddypress-media/ja/default) translation by [Tetsu Yamaoka](http://twitter.com/ytetsu)
89
  * [Polish](https://rtcamp.com/translate/projects/buddypress-media/pl/default) translation by [czemubynie](http://profiles.wordpress.org/czemubyniegmailcom/)
90
  * [Serbian](https://rtcamp.com/translate/projects/buddypress-media/sr/default) translation by [nikolakica](http://profiles.wordpress.org/nikolakica/)
91
+ * [German](https://rtcamp.com/translate/projects/buddypress-media/de/defaul) translation by [hannes.muc]
92
 
93
  == Installation ==
94
 
115
  9. Media Edit View
116
  10. Media Activity
117
  11. Media Widget
118
+ 12. Lightbox
119
 
120
  == Changelog ==
121
 
122
  Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
123
+ = 2.7 =
124
+ * Added activity uploader
125
+ * Added lightbox
126
+ * Fixed bug in friends' privacy
127
+ * Fixed bug due to which edit/delete buttons would show up
128
+ * Refactored code and styling
129
 
130
  = 2.6.7 =
131
  * Fixes modular compatibility with friends component. Thanks to [Cat555](http://rtcamp.com/support/users/cat555/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media) for reporting this.
312
  * HTML5 Video Tag Support (with fallback)
313
 
314
  == Upgrade Notice ==
315
+ = 2.7 =
316
+ Activity Uploader and lightbox
screenshot-12.png ADDED
Binary file